123456789101112131415161718 |
- !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("three")):"function"==typeof define&&define.amd?define(["three"],t):(e="undefined"!=typeof globalThis?globalThis:e||self).KanKan=t(e.THREE)}(this,(function(e){"use strict";function t(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(n){if("default"!==n){var i=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,i.get?i:{enumerable:!0,get:function(){return e[n]}})}})),t.default=e,Object.freeze(t)}var i=t(e);function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function u(e,t,n){return t&&s(e.prototype,t),n&&s(e,n),e}function h(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function p(e,t){return(p=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function f(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&p(e,t)}function m(e){return(m="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function y(e,t){if(t&&("object"===m(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return h(e)}function w(e){return(w=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function C(e,t,n,i,o,r,a){try{var s=e[r](a),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(i,o)}function k(e){return function(){var t=this,n=arguments;return new Promise((function(i,o){var r=e.apply(t,n);function a(e){C(r,i,o,a,s,"next",e)}function s(e){C(r,i,o,a,s,"throw",e)}a(void 0)}))}}var S=function(e){var t={exports:{}};return e(t,t.exports),t.exports}((function(e){var t=function(e){var t,n=Object.prototype,i=n.hasOwnProperty,o="function"==typeof Symbol?Symbol:{},r=o.iterator||"@@iterator",a=o.asyncIterator||"@@asyncIterator",s=o.toStringTag||"@@toStringTag";function l(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{l({},"")}catch(e){l=function(e,t,n){return e[t]=n}}function c(e,t,n,i){var o=t&&t.prototype instanceof v?t:v,r=Object.create(o.prototype),a=new B(i||[]);return r._invoke=function(e,t,n){var i=h;return function(o,r){if(i===p)throw new Error("Generator is already running");if(i===f){if("throw"===o)throw r;return R()}for(n.method=o,n.arg=r;;){var a=n.delegate;if(a){var s=T(a,n);if(s){if(s===m)continue;return s}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(i===h)throw i=f,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);i=p;var l=u(e,t,n);if("normal"===l.type){if(i=n.done?f:d,l.arg===m)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(i=f,n.method="throw",n.arg=l.arg)}}}(e,n,a),r}function u(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}e.wrap=c;var h="suspendedStart",d="suspendedYield",p="executing",f="completed",m={};function v(){}function g(){}function y(){}var A={};l(A,r,(function(){return this}));var E=Object.getPrototypeOf,b=E&&E(E(P([])));b&&b!==n&&i.call(b,r)&&(A=b);var w=y.prototype=v.prototype=Object.create(A);function x(e){["next","throw","return"].forEach((function(t){l(e,t,(function(e){return this._invoke(t,e)}))}))}function C(e,t){function n(o,r,a,s){var l=u(e[o],e,r);if("throw"!==l.type){var c=l.arg,h=c.value;return h&&"object"==typeof h&&i.call(h,"__await")?t.resolve(h.__await).then((function(e){n("next",e,a,s)}),(function(e){n("throw",e,a,s)})):t.resolve(h).then((function(e){c.value=e,a(c)}),(function(e){return n("throw",e,a,s)}))}s(l.arg)}var o;this._invoke=function(e,i){function r(){return new t((function(t,o){n(e,i,t,o)}))}return o=o?o.then(r,r):r()}}function T(e,n){var i=e.iterator[n.method];if(i===t){if(n.delegate=null,"throw"===n.method){if(e.iterator.return&&(n.method="return",n.arg=t,T(e,n),"throw"===n.method))return m;n.method="throw",n.arg=new TypeError("The iterator does not provide a 'throw' method")}return m}var o=u(i,e.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,m;var r=o.arg;return r?r.done?(n[e.resultName]=r.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=t),n.delegate=null,m):r:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,m)}function I(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function k(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function B(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(I,this),this.reset(!0)}function P(e){if(e){var n=e[r];if(n)return n.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,a=function n(){for(;++o<e.length;)if(i.call(e,o))return n.value=e[o],n.done=!1,n;return n.value=t,n.done=!0,n};return a.next=a}}return{next:R}}function R(){return{value:t,done:!0}}return g.prototype=y,l(w,"constructor",y),l(y,"constructor",g),g.displayName=l(y,s,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===g||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,y):(e.__proto__=y,l(e,s,"GeneratorFunction")),e.prototype=Object.create(w),e},e.awrap=function(e){return{__await:e}},x(C.prototype),l(C.prototype,a,(function(){return this})),e.AsyncIterator=C,e.async=function(t,n,i,o,r){void 0===r&&(r=Promise);var a=new C(c(t,n,i,o),r);return e.isGeneratorFunction(n)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},x(w),l(w,s,"Generator"),l(w,r,(function(){return this})),l(w,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t=[];for(var n in e)t.push(n);return t.reverse(),function n(){for(;t.length;){var i=t.pop();if(i in e)return n.value=i,n.done=!1,n}return n.done=!0,n}},e.values=P,B.prototype={constructor:B,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(k),!e)for(var n in this)"t"===n.charAt(0)&&i.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=t)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var n=this;function o(i,o){return s.type="throw",s.arg=e,n.next=i,o&&(n.method="next",n.arg=t),!!o}for(var r=this.tryEntries.length-1;r>=0;--r){var a=this.tryEntries[r],s=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var l=i.call(a,"catchLoc"),c=i.call(a,"finallyLoc");if(l&&c){if(this.prev<a.catchLoc)return o(a.catchLoc,!0);if(this.prev<a.finallyLoc)return o(a.finallyLoc)}else if(l){if(this.prev<a.catchLoc)return o(a.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return o(a.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&i.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var r=o;break}}r&&("break"===e||"continue"===e)&&r.tryLoc<=t&&t<=r.finallyLoc&&(r=null);var a=r?r.completion:{};return a.type=e,a.arg=t,r?(this.method="next",this.next=r.finallyLoc,m):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),m},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),k(n),m}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var i=n.completion;if("throw"===i.type){var o=i.arg;k(n)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,n,i){return this.delegate={iterator:P(e),resultName:n,nextLoc:i},"next"===this.method&&(this.arg=t),m}},e}(e.exports);try{regeneratorRuntime=t}catch(e){"object"==typeof globalThis?globalThis.regeneratorRuntime=t:Function("r","regeneratorRuntime = r")(t)}}));function D(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);n<t;n++)i[n]=e[n];return i}function L(e,t){if(e){if("string"==typeof e)return D(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?D(e,t):void 0}}function H(e){return function(e){if(Array.isArray(e))return D(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||L(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function V(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function Q(e,t,n){return(Q=V()?Reflect.construct:function(e,t,n){var i=[null];i.push.apply(i,t);var o=new(Function.bind.apply(e,i));return n&&p(o,n.prototype),o}).apply(null,arguments)}var _=[],z=[];function U(e,t){if(e&&"undefined"!=typeof document){var n,i=!0===t.prepend?"prepend":"append",o=!0===t.singleTag,r="string"==typeof t.container?document.querySelector(t.container):document.getElementsByTagName("head")[0];if(o){var a=_.indexOf(r);-1===a&&(a=_.push(r)-1,z[a]={}),n=z[a]&&z[a][i]?z[a][i]:z[a][i]=s()}else n=s();65279===e.charCodeAt(0)&&(e=e.substring(1)),n.styleSheet?n.styleSheet.cssText+=e:n.appendChild(document.createTextNode(e))}function s(){var e=document.createElement("style");if(e.setAttribute("type","text/css"),t.attributes)for(var n=Object.keys(t.attributes),o=0;o<n.length;o++)e.setAttribute(n[o],t.attributes[n[o]]);var a="prepend"===i?"afterbegin":"beforeend";return r.insertAdjacentElement(a,e),e}}U(":root {\n --main-color: #00c8af;\n --font-color: #999;\n}\n\n[x-cloak] {\n display: none !important;\n}\n\n*,\n::before,\n::after {\n -webkit-appearance: none;\n -moz-appearance: none;\n appearance: none;\n -webkit-tap-highlight-color: rgba(255, 255, 255, 0);\n text-rendering: optimizeLegibility !important;\n -webkit-font-smoothing: antialiased !important;\n}\n\n.kankan-app {\n position: relative;\n width: 100%;\n height: 100%;\n overflow: hidden;\n background-color: #292929;\n}\n\n.kankan-app .player {\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n z-index: 1;\n overflow: hidden;\n outline: none;\n border: none;\n}\n\n.kankan-app .player[name='copy'] {\n display: none;\n}\n\n.kankan-app .player-mark {\n display: none;\n cursor: grab;\n position: absolute;\n left: calc(50% - 56px);\n top: calc(50% - 56px);\n z-index: 999;\n width: 102px;\n height: 102px;\n}\n\n.kankan-app__split .player {\n cursor: crosshair;\n}\n\n.kankan-app__split .player[name='main'] {\n width: calc(50% - 1px);\n}\n\n.kankan-app__split .player[name='copy'] {\n width: calc(50% - 1px);\n display: block;\n left: auto;\n right: 0;\n}\n\n.kankan-app__split .player-mark {\n display: block;\n}\n\n.kankan-app__split [xui_tags] div {\n display: none !important;\n}\n\n.ui-view-layout[is-mobile='true'] .kankan-app__split .player[name='main'] {\n width: 100%;\n height: calc(50% - 1px);\n}\n\n.ui-view-layout[is-mobile='true'] .kankan-app__split .player[name='copy'] {\n width: 100%;\n height: calc(50% - 1px);\n display: block;\n top: 50%;\n left: auto;\n right: 0;\n}\n\n.kankan-app__slide-right {\n will-change: transform;\n transition: all 0.2s ease-in-out;\n}\n\n.kankan-app__slide-right-enter {\n opacity: 1;\n transform: translate3d(0, 0, 0);\n}\n\n.kankan-app__slide-right-leave {\n opacity: 0;\n transform: translate3d(100%, 0, 0);\n}\n\n/* plugins */\n.kankan-plugins input {\n padding: 0 5px;\n width: 100%;\n height: 34px;\n background: rgba(255, 255, 255, 0.1);\n border-radius: 4px;\n border: 1px solid rgba(255, 255, 255, 0.2);\n outline: none;\n color: #fff;\n}\n\n.kankan-plugins input:focus {\n border: 1px solid var(--main-color);\n}\n\n.kankan-plugins button {\n cursor: pointer;\n width: 100%;\n height: 34px;\n outline: none;\n border-radius: 4px;\n font-size: 14px;\n background: none !important;\n transition: all 0.3s ease;\n color: var(--main-color);\n border: 1px solid var(--main-color);\n}\n\n/* xui */\n.kankan-app_combox {\n cursor: pointer;\n position: relative;\n background: #323233;\n border-radius: 4px;\n border: 1px solid rgba(255, 255, 255, 0.2);\n outline: none;\n color: #fff;\n height: 34px;\n width: 100%;\n}\n\n.kankan-app_combox .inner-icon {\n cursor: pointer;\n font-size: 12px;\n position: absolute;\n right: 5px;\n top: 50%;\n transform: translateY(-50%);\n color: var(--font-color);\n}\n\n.kankan-app_combox .inner-text {\n display: flex;\n align-items: center;\n padding: 0 5px;\n height: 100%;\n}\n\n.kankan-app_combox .inner-list {\n position: absolute;\n left: 0px;\n right: 0px;\n top: 100%;\n border: 1px solid rgba(255, 255, 255, 0.2);\n background: #323233;\n z-index: 1000;\n}\n\n.kankan-app_combox .inner-list>div {\n height: 34px;\n display: flex;\n align-items: center;\n padding: 0 5px;\n}\n\n.kankan-app_combox .inner-list>div:hover {\n color: var(--main-color);\n}",{});var j={"common.about":"约","common.meter":"米","cad.input":"请输入名称","model.enter":"入户门"},W={num:null,dom:null,env:"production",version:"4.14.3",edition:null,lang:"zh",langs:{},view:!0,mobile:!1,deploy:"",region:"",server:"",resource:"https://4dkk.4dage.com/",showSDKInfo:!0,useShortcutKeys:!1,useStatistics:!0,useAuth:!1,antialias:!0,link:{onAction:null,target:"self"},model:{name:""},scene:{quality:null,markerURL:null,markerOpacity:null,pathEndColor:null,floorlogoId:null},camera:{lookLimitUp:null,lookLimitDown:null},vr:{markerHeight:null},tag:{showIn:null},getServerURL(e){return this.server+e},getResourceURL(e){return this.resource+e},getResourceImageURL(e){return this.getResourceURL("scene_view_data/".concat(this.num,"/images/").concat(e))},getResourceDataURL(e){return this.getResourceURL("scene_view_data/".concat(this.num,"/data/").concat(e))},i18n(e){return this.langs[this.lang]&&this.langs[this.lang][e]?this.langs[this.lang][e]:(this.langs.zh||(this.langs.zh=j),this.langs.zh[e]||"")},isLoadTags:!0};if(W.showSDKInfo)if(navigator.userAgent.toLowerCase().indexOf("chrome")>-1){var q=["\n %c %c 4DKanKan SDK "+W.version+" - https://www.4dkankan.com/ \n","background: #1fe4dc; padding:5px 0;","color: #000; background: #1fe4dc; padding:5px 0;"];console.log.apply(console,q)}else console&&console.log("4DKanKan SDK "+W.version+" - https://www.4dkankan.com/");function J(e,t,n){for(var i=[],o=0;o<e.length;o+=1)void 0!==e&&(null!==e[o]&&"object"==typeof e[o]?i[o]=n({},e[o]):i[o]=e[o]);for(var r=0;r<t.length;r+=1)void 0!==t[r]&&(null!==t[r]&&"object"==typeof t[r]?i[r]=n(e[r],t[r]):i[r]=t[r]);return i}function Y(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];for(var i=t.shift(),o=0;o<t.length;o+=1){var r=t[o];if(null!==i&&null!==r&&void 0!==i&&void 0!==r){if("object"==typeof i&&"object"==typeof r)if(i instanceof Array&&r instanceof Array)i=J(i,r,Y);else for(var a=Object.keys(r),s=0;s<a.length;s+=1){var l=a[s];"__proto__"!==l&&("object"==typeof r[l]&&null!==r[l]?i[l]=Y(i[l],r[l]):void 0!==r[l]&&(i[l]=r[l]))}}else null!=r&&(i=r instanceof Array?J([],r,Y):r)}return i}function Z(e,t){if(!Object.prototype.hasOwnProperty.call(e,t))throw new TypeError("attempted to use private field on non-instance");return e}var X=0;function K(e){return"__private_"+X+++"_"+e}function ee(e){return"[object Array]"===Object.prototype.toString.call(e)}function te(e,t){if(ee(e))for(var n=0;n<e.length;n++)t(e[n]);else t(e)}function ne(e){var t="pending",n=[],i=[],o=[],r=null,a={done:function(){for(var e=0;e<arguments.length;e++)if(arguments[e])if(ee(arguments[e]))for(var i=arguments[e],o=0;o<i.length;o++)"resolved"===t&&i[o].apply(this,r),n.push(i[o]);else"resolved"===t&&arguments[e].apply(this,r),n.push(arguments[e]);return this},fail:function(){for(var e=0;e<arguments.length;e++)if(arguments[e])if(ee(arguments[e]))for(var n=arguments[e],o=0;o<n.length;o++)"rejected"===t&&n[o].apply(this,r),i.push(n[o]);else"rejected"===t&&arguments[e].apply(this,r),i.push(arguments[e]);return this},always:function(){return this.done.apply(this,arguments).fail.apply(this,arguments)},progress:function(){for(var e=0;e<arguments.length;e++)if(arguments[e])if(ee(arguments[e]))for(var n=arguments[e],i=0;i<n.length;i++)"pending"===t&&o.push(n[i]);else"pending"===t&&o.push(arguments[e]);return this},then:function(e,t,n){return ne((function(n){te(e,(function(e){"function"==typeof e?s.done((function(){var t=e.apply(this,arguments);t&&"function"==typeof t?t.promise().then(n.resolve,n.reject,n.notify):n.resolve(t)})):s.done(n.resolve)})),te(t,(function(e){"function"==typeof e?s.fail((function(){var t=e.apply(this,arguments);t&&"function"==typeof t?t.promise().then(n.resolve,n.reject,n.notify):n.reject(t)})):s.fail(n.reject)}))})).promise()},catch:function(){for(var e=0;e<arguments.length;e++)if(arguments[e])if(ee(arguments[e]))for(var n=arguments[e],o=0;o<n.length;o++)"rejected"===t&&n[o].apply(this,r),i.push(n[o]);else"rejected"===t&&arguments[e].apply(this,r),i.push(arguments[e]);return this},promise:function(e){if(null==e)return a;for(var t in a)e[t]=a[t];return e},state:function(){return t},debug:function(){console.log("[debug]",n,i,t)},isRejected:function(){return"rejected"===t},isResolved:function(){return"resolved"===t},pipe:function(e,t,n){return ne((function(n){te(e,(function(e){"function"==typeof e?s.done((function(){var t=e.apply(this,arguments);t&&"function"==typeof t?t.promise().then(n.resolve,n.reject,n.notify):n.resolve(t)})):s.done(n.resolve)})),te(t,(function(e){"function"==typeof e?s.fail((function(){var t=e.apply(this,arguments);t&&"function"==typeof t?t.promise().then(n.resolve,n.reject,n.notify):n.reject(t)})):s.fail(n.reject)}))})).promise()}},s={resolveWith:function(e){if("pending"===t){t="resolved";for(var i=r=arguments.length>1?arguments[1]:[],o=0;o<n.length;o++)n[o].apply(e,i)}return this},rejectWith:function(e){if("pending"===t){t="rejected";for(var n=r=arguments.length>1?arguments[1]:[],o=0;o<i.length;o++)i[o].apply(e,n)}return this},notifyWith:function(e){if("pending"===t)for(var n=r=arguments.length>1?arguments[1]:[],i=0;i<o.length;i++)o[i].apply(e,n);return this},resolve:function(){return this.resolveWith(this,arguments)},reject:function(){return this.rejectWith(this,arguments)},notify:function(){return this.notifyWith(this,arguments)}},l=a.promise(s);return e&&e.apply(l,[l]),l}ne.when=function(){if(arguments.length<2){var e=arguments.length?arguments[0]:void 0;return e&&"function"==typeof e.isResolved&&"function"==typeof e.isRejected?e.promise():ne().resolve(e).promise()}return function(e){for(var t=ne(),n=e.length,i=0,o=new Array(n),r=0;r<e.length;r++)!function(r){var a=null;e[r].done?e[r].done((function(){o[r]=arguments.length<2?arguments[0]:arguments,++i==n&&t.resolve.apply(t,o)})).fail((function(){t.reject(arguments)})):(a=e[r],e[r]=new Deferred,e[r].done((function(){o[r]=arguments.length<2?arguments[0]:arguments,++i==n&&t.resolve.apply(t,o)})).fail((function(){t.reject(arguments)})).resolve(a))}(r);return t.promise()}(arguments)};var ie=ne;function oe(){return new ne}var re=K("deferrals"),ae=function(){function e(t){o(this,e),Object.defineProperty(this,re,{writable:!0,value:{}}),this.app=t}return u(e,[{key:"add",value:function(){var e=k(S.mark((function e(t,n){var i,o=this;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=t(this.app,n),e.abrupt("return",new Promise((function(e,t){i.then&&i.then((function(n){return n.$name?o[n.$name]?e(o[n.$name]):(n.$html&&(n.$scope?n.$scope.insertAdjacentHTML("beforeend",n.$html):o.app.$plugins.insertAdjacentHTML("beforeend",n.$html),delete n.$html),o[n.$name]=n,n.$load&&(n.$load(),delete n.$load),Z(o,re)[re][n.$name]&&Z(o,re)[re][n.$name].resolve(n),void e(n)):t("require a plugin name")}))})));case 2:case"end":return e.stop()}}),e,this)})));return function(t,n){return e.apply(this,arguments)}}()},{key:"get",value:function(e){return null==Z(this,re)[re][e]&&(Z(this,re)[re][e]=oe()),Z(this,re)[re][e]}}]),e}(),se=K("components"),le=function(){function e(t){o(this,e),Object.defineProperty(this,se,{writable:!0,value:void 0}),this.app=t,Z(this,se)[se]={}}return u(e,[{key:"add",value:function(e,t){-1==["store","resource"].indexOf(e)?Z(this,se)[se][e]=t:this.app[e]=t}},{key:"get",value:function(e){return Z(this,se)[se][e]}}]),e}(),ce=location.origin,ue=(document.currentScript||{}).src,he=function(){if(!ue){try{({}).b()}catch(n){var e=n.stack||n.sourceURL||n.stacktrace,t=/(?:http|https|file):\/\/.*?\/.+?.js/.exec(e);t&&(ue=t[0])}}var n=ue.split("/");return n.pop(),ue=n.join("/")+"/",function(){return ue}}();function de(e,t,n){return new Promise((function(i,o){var r=function(e){var t=document.createElement("script");return t.async=!0,e.indexOf(ce+"/")&&(t.crossOrigin="anonymous"),t.src=e,t}(e+(n?"?v=".concat(n):""));r.addEventListener("error",(function(){console.error("load:"+e+" error"),o()})),r.addEventListener("load",(function(){document.head.removeChild(r),i(t)})),document.head.appendChild(r)}))}window.addEventListener("error",(function(e){}));var pe=function(){function e(t){o(this,e),this.app=t}return u(e,[{key:"toast",value:function(e){this.app.emit("gui.toast",e)}},{key:"alert",value:function(e){this.app.emit("gui.alert",e)}},{key:"confirm",value:function(e){this.app.emit("gui.confirm",e)}}]),e}();function fe(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var i,o,r=[],a=!0,s=!1;try{for(n=n.call(e);!(a=(i=n.next()).done)&&(r.push(i.value),!t||r.length!==t);a=!0);}catch(e){s=!0,o=e}finally{try{a||null==n.return||n.return()}finally{if(s)throw o}}return r}}(e,t)||L(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var me,ve,ge={getBaseLog:(e,t)=>Math.log(t)/Math.log(e),convertVisionVector:function(e){return new THREE.Vector3(e.x,e.z,-e.y)},invertVisionVector:function(e){return new THREE.Vector3(e.x,-e.z,e.y)},convertVisionQuaternion:function(e){return new THREE.Quaternion(e.x,e.z,-e.y,e.w).multiply((new THREE.Quaternion).setFromAxisAngle(new THREE.Vector3(0,1,0),THREE.MathUtils.degToRad(90)))},invertVisionQuaternion:function(e){var t=e.clone().multiply((new THREE.Quaternion).setFromAxisAngle(new THREE.Vector3(0,1,0),THREE.MathUtils.degToRad(-90)));return new THREE.Quaternion(t.x,-t.z,t.y,t.w)},convertWorkshopVector:function(e){return new THREE.Vector3(-e.x,e.y,e.z)},convertWorkshopQuaternion:function(e){return new THREE.Quaternion(-e.x,e.y,e.z,-e.w).multiply(new THREE.Quaternion(Math.sqrt(2)/2,Math.sqrt(2)/2,0,0))},convertWorkshopPanoramaQuaternion:function(e){return new THREE.Quaternion(e.x,-e.y,-e.z,e.w).normalize().multiply((new THREE.Quaternion).setFromAxisAngle(new THREE.Vector3(0,1,0),THREE.MathUtils.degToRad(270)))},convertWorkshopOrthoZoom:function(e,t){return-1===e?-1:e*(t.clientHeight/t.clientHeight)},getVec2Angle:function(e,t){return Math.acos(THREE.MathUtils.clamp(this.getVec2Cos(e,t),-1,1))},getVec2Cos:function(e,t){return e.dot(t)/e.length()/t.length()},closeTo:function(e,t,n){return null!=n?Math.abs(e-t)<n:Math.abs(e-t)<1e-6},toPrecision:function(e,t){var n=function(e,t){var n=Math.pow(10,t);return Math.round(e*n)/n};if(e instanceof Array){for(var i=0;i<e.length;i++)e[i]=n(e[i],t);return e}if(e instanceof Object){for(var i in e)e[i]=n(e[i],t);return e}return n(e,t)},isEmptyQuaternion:function(e){return 0===Math.abs(e.x)&&0===Math.abs(e.y)&&0===Math.abs(e.z)&&0===Math.abs(e.w)},projectPositionToCanvas:function(e,t,n,i){(n=n||new THREE.Vector3).copy(e);var o=.5*i.clientWidth,r=.5*i.clientHeight;return n.project(t),n.x=n.x*o+o,n.y=-n.y*r+r,n},convertScreenPositionToNDC:function(e,t,i,o){return(i=i||new n.Vector2).x=e/o.clientWidth*2-1,i.y=-t/o.clientHeight*2+1,i},handelPadding:(me=new Map,function(e,t,n){var i,o=me.get(n);return o&&n.clientWidth==o.width&&n.clientHeight==o.height&&(i=o.pad),i||(i=n.getBoundingClientRect(),me.set(n,{width:n.clientWidth,height:n.clientHeight,pad:i})),{x:e-i.x,y:t-i.y}}),constrainedTurn:function(e){var t=e%(2*Math.PI);return t>Math.PI?t-=2*Math.PI:t<-Math.PI?t+=2*Math.PI:t},getFOVDotThreshold:function(e){return Math.cos(THREE.MathUtils.degToRad(e/2))},transform2DForwardVectorByCubeFace:function(e,t,n,i){switch(e){case GLCubeFaces.GL_TEXTURE_CUBE_MAP_POSITIVE_X:n.set(1,t.y,t.x);break;case GLCubeFaces.GL_TEXTURE_CUBE_MAP_NEGATIVE_X:n.set(-1,t.y,-t.x);break;case GLCubeFaces.GL_TEXTURE_CUBE_MAP_POSITIVE_Y:n.set(-t.x,1,-t.y);break;case GLCubeFaces.GL_TEXTURE_CUBE_MAP_NEGATIVE_Y:n.set(-t.x,-1,t.y);break;case GLCubeFaces.GL_TEXTURE_CUBE_MAP_POSITIVE_Z:n.set(-t.x,t.y,1);break;case GLCubeFaces.GL_TEXTURE_CUBE_MAP_NEGATIVE_Z:n.set(t.x,t.y,-1)}i&&n.normalize()},getFootPoint:function(e,t,n,i){var o=e.clone().sub(t),r=t.clone().sub(n),a=r.length(),s=o.dot(r)/a,l=t.clone().add(r.multiplyScalar(s/a));return i&&l.clone().sub(t).dot(l.clone().sub(n))>0&&(l=l.distanceTo(t)<l.distanceTo(n)?t.clone():n.clone()),l},getCenterOfGravityPoint:function(e){for(var t=0,n=0,i=0,o=1;o<=e.length;o++){var r=e[o%e.length].x,a=e[o%e.length].y,s=e[o-1].x,l=e[o-1].y,c=(r*l-a*s)/2;t+=c,n+=c*(r+s)/3,i+=c*(a+l)/3}return{x:n/=t,y:i/=t}},getBound:function(e){for(var t=new THREE.Box2,n=0,i=e.length;n<i;n++)t.expandByPoint(e[n]);return t},isPointInArea:function(e,t,n){var i=this.getBound(e);if(t.x<i.min.x||t.x>i.max.x||t.y<i.min.y||t.y>i.max.y)return!1;for(var o=!1,r=t.x,a=t.y,s=0,l=e.length-1;s<e.length;l=s++){var c=e[s].x,u=e[s].y,h=e[l].x,d=e[l].y;if((c-r)*(d-a)==(c-r)*(u-a)&&r>=Math.min(c,h)&&r<=Math.max(c,h)&&a>=Math.min(u,d)&&a<=Math.max(u,d))return!!n;u>a!=d>a&&r<(h-c)*(a-u)/(d-u)+c&&(o=!o)}return o},getArea:function(e){for(var t=e.length,n=0,i=t-1,o=0;o<t;i=o++)n+=e[i].x*e[o].y-e[o].x*e[i].y;return-.5*n},isInBetween:function(e,t,n,i){return e<=t&&t<=n||n<=t&&t<=e||this.closeTo(e,t,i)||this.closeTo(t,n,i)},ifPointAtLineBound:function(e,t,n){return ge.isInBetween(t[0].x,e.x,t[1].x,n)&&ge.isInBetween(t[0].y,e.y,t[1].y,n)},isLineIntersect:function(e,t,n){var i=e[1].y-e[0].y,o=e[0].x-e[1].x,r=i*e[0].x+o*e[0].y,a=t[1].y-t[0].y,s=t[0].x-t[1].x,l=a*t[0].x+s*t[0].y,c=i*s-a*o;if(0==c)return!1;var u=(s*r-o*l)/c,h=(i*l-a*r)/c;return n||ge.ifPointAtLineBound({x:u,y:h},e)&&ge.ifPointAtLineBound({x:u,y:h},t)?{x:u,y:h}:void 0},getNormal:function(e){var t,n,i=e.points[1].x-e.points[0].x,o=e.points[1].y-e.points[0].y;if(0!=o)n=-i*(t=1)/o;else{if(0==i)return console.log("两个点一样"),null;t=-o*(n=1)/i}var r=new THREE.Vector3(t,0,n),a=new THREE.Vector3(i,0,o);return r.cross(a).y>0&&(t*=-1,n*=-1),new THREE.Vector2(t,n).normalize()},getQuaBetween2Vector:function(e,t,n){var i=e.angleTo(t),o=e.clone().cross(t).normalize();return 0==o.length()?(new THREE.Quaternion).setFromAxisAngle(n,i):(new THREE.Quaternion).setFromAxisAngle(o,i)},getScaleForConstantSize:function(){var e,t=new THREE.Vector3,n=new THREE.Vector3,i=new THREE.Vector3,o=new THREE.Vector3,r=new THREE.Vector3;return function(){var a=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(a.width2d)e=a.width2d;else{var s;if(s="OrthographicCamera"==a.camera.type?(a.camera.right-a.camera.left)/a.camera.zoom/3:a.position.distanceTo(a.camera.position),null==a.nearBound&&null!=a.farBound||null!=a.nearBound&&null==a.farBound)return null==a.farBound&&s<a.nearBound?a.scale*s/a.nearBound:null==a.nearBound&&s>a.farBound?a.scale*s/a.farBound:a.scale;e=a.maxSize-(a.maxSize-a.minSize)*THREE.MathUtils.smoothstep(s,a.nearBound,a.farBound)}t.copy(a.position).project(a.camera),n.set(a.dom.clientWidth/2,a.dom.clientHeight/2,1).multiply(t),i.set(e/2,0,0).add(n),o.set(2/a.dom.clientWidth,2/a.dom.clientHeight,1).multiply(i),r.copy(o).unproject(a.camera);var l=r.distanceTo(a.position);return l}}(),getCrossPointAtRect:function(e,t,n,i,o,r){var a,s,l=(t.x-e.x)/(t.y-e.y);return((s=function(t){return 1/l*(t-e.x)+e.y}(a=t.x>=e.x?n+o:o))<r||s>r+i)&&(a=function(t){return l*(t-e.y)+e.x}(s=s<r?r:r+i)),new THREE.Vector2(a,s)},getDirFromUV:function(e){e.x%=1,e.x<0&&(e.x+=1);var t,n=Math.cos(e.y*Math.PI),i=2*Math.PI*e.x-Math.PI;t=-Math.PI/2<=i&&i<Math.PI/2?1:-1;var o=Math.tan(i),r=Math.sqrt((1-n*n)/(1+o*o)),a=o*r;return r*t<0&&(r*=-1,a*=-1),a*=-1,new THREE.Vector3(a,n,r)},getUVfromDir:function(e){return(e=e.clone()).x*=-1,{x:Math.atan2(e.x,e.z)/(2*Math.PI)+.5,y:Math.acos(e.y)/Math.PI}},crossRight:function(e,t){var n=t.elements,i=new THREE.Vector3;return i.x=n[0]*e.x+n[1]*e.y+n[2]*e.z+n[3],i.y=n[4]*e.x+n[5]*e.y+n[6]*e.z+n[7],i.z=n[8]*e.x+n[9]*e.y+n[10]*e.z+n[11],i},getNormalDir:function(e,t,n){var i=e.clone().sub(n.position);if(t)var o=n.rot90Matrix.clone();else o=n.matrixWorld.clone();return(i=this.crossRight(i,o)).normalize(),i},getDirByLonLat:function(e,t){var n=new THREE.Vector3,i=THREE.MathUtils.degToRad(90-t),o=THREE.MathUtils.degToRad(e);return n.x=Math.sin(i)*Math.cos(o),n.y=Math.cos(i),n.z=Math.sin(i)*Math.sin(o),n},getYawByDir:e=>Math.atan2(-e.z,e.x)-Math.PI/2,getPitchByDir:e=>Math.atan2(e.y,Math.sqrt(e.x*e.x+e.z*e.z)),getLineIntersect2(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(null!=e.A)var t=e.A,n=e.B,i=e.p1||(new THREE.Vector3).addVctors(t,e.dir0),o=e.p2||(new THREE.Vector3).addVctors(n,e.dir1),r=e.dir0||(new THREE.Vector3).subVectors(i,t),a=e.dir1||(new THREE.Vector3).subVectors(o,n);if(t.equals(n))return{pos3d:i.clone()};var s=r.clone().cross(a),l=ge.getQuaBetween2Vector(s,new THREE.Vector3(0,1,0),new THREE.Vector3(0,1,0)),c=[t,n,i,o].map((function(e){return e.clone().applyQuaternion(l)})),u=ge.isLineIntersect([{x:c[0].x,y:c[0].z},{x:c[2].x,y:c[2].z}],[{x:c[1].x,y:c[1].z},{x:c[3].x,y:c[3].z}],!0),h=l.clone().invert(),d=new THREE.Vector3(u.x,0,u.y),p=d.clone().setY(c[0].y),f=d.clone().setY(c[1].y);return p.applyQuaternion(h),f.applyQuaternion(h),{pos3d:d=(new THREE.Vector3).addVectors(p,f).multiplyScalar(.5),mid1:p,mid2:f}},getLineIntersect(e){if(null!=(e=e||{}).A)var t=e.A,n=e.B,i=e.p1,o=e.p2;if(t.equals(n))return{pos3d:i.clone()};var r=i.clone().sub(t).normalize(),a=o.clone().sub(n).normalize();r.angleTo(a);return function(){var e,r=i.x-t.x,a=i.y-t.y,s=i.z-t.z,l=o.x-n.x,c=o.y-n.y,u=o.z-n.z,h=t.x-n.x,d=t.y-n.y,p=t.z-n.z,f=r*r+a*a+s*s,m=r*l+a*c+s*u,v=l*l+c*c+u*u,g=r*h+a*d+s*p,y=l*h+c*d+u*p,A=f*v-m*m,E=A,b=A,w=0,x=0,C=function(t){e=(1==t?i:o).clone()}.bind(this);if(ge.closeTo(A,0))w=0,E=1,x=y,b=v;else if(x=f*y-m*g,(w=m*y-v*g)<0)return C(1),{pos3d:e,behind:!0};if(x<0)return C(2),{pos3d:e,behind:!0};var T=0,I=0;T=ge.closeTo(w,0)?0:w/E,I=ge.closeTo(x,0)?0:x/b;var k=new THREE.Vector3(t.x+T*r,t.y+T*a,t.z+T*s),B=new THREE.Vector3(n.x+I*l,n.y+I*c,n.z+I*u);return{pos3d:k.clone().add(B).multiplyScalar(.5),mid1:k,mid2:B}}()},getAngle(e,t,n){var i=e.angleTo(t);return e.clone().cross(t)[n]<0&&(i*=-1),i},linearClamp(e,t,n){5==arguments.length&&(t=[arguments[1],arguments[2]],n=[arguments[3],arguments[4]]);var i=t.length;if(e<=t[0])return n[0];if(e>=t[i-1])return n[i-1];for(var o=0;++o<i;)if(e<t[o]){var r=t[o-1],a=t[o],s=n[o-1];e=s+(n[o]-s)*(e-r)/(a-r);break}return e},isInsideFrustum(e,t){var n=new THREE.Matrix4;n.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse);var i=new THREE.Frustum;return i.setFromProjectionMatrix(n),e instanceof THREE.Sphere?i.intersectsSphere(e):i.intersectsBox(e)},getStandardYaw:(e,t)=>(Math.abs(e-t)>Math.PI&&(e>t?e-=2*Math.PI:t-=2*Math.PI),[e,t])},ye={getEaseOut:function(e){var t;return(e=Math.round(e))<2?(e=Math.PI/2,t=ye.easeOutSine):t=function(t,n,i,o){return e>2&&console.log(e),-i/Math.pow(-o,e)*Math.pow(t-o,e)+i},{k:e,easeFun:t}},linearTween:function(e,t,n,i){return n*e/i+t},easeInQuad:function(e,t,n,i){return n*(e/=i)*e+t},easeOutQuad:function(e,t,n,i){return-n*(e/=i)*(e-2)+t},easeInOutQuad:function(e,t,n,i){return(e/=i/2)<1?n/2*e*e+t:-n/2*(--e*(e-2)-1)+t},easeInCubic:function(e,t,n,i){return n*(e/=i)*e*e+t},easeOutCubic:function(e,t,n,i){return e/=i,n*(--e*e*e+1)+t},easeInOutCubic:function(e,t,n,i){return(e/=i/2)<1?n/2*e*e*e+t:n/2*((e-=2)*e*e+2)+t},easeInQuart:function(e,t,n,i){return n*(e/=i)*e*e*e+t},easeOutQuart:function(e,t,n,i){return e/=i,-n*(--e*e*e*e-1)+t},easeInOutQuart:function(e,t,n,i){return(e/=i/2)<1?n/2*e*e*e*e+t:-n/2*((e-=2)*e*e*e-2)+t},easeInQuint:function(e,t,n,i){return n*(e/=i)*e*e*e*e+t},easeOutQuint:function(e,t,n,i){return e/=i,n*(--e*e*e*e*e+1)+t},easeInOutQuint:function(e,t,n,i){return(e/=i/2)<1?n/2*e*e*e*e*e+t:n/2*((e-=2)*e*e*e*e+2)+t},easeInSine:function(e,t,n,i){return-n*Math.cos(e/i*(Math.PI/2))+n+t},easeOutSine:function(e,t,n,i){return n*Math.sin(e/i*(Math.PI/2))+t},easeInOutSine:function(e,t,n,i){return-n/2*(Math.cos(Math.PI*e/i)-1)+t},easeInExpo:function(e,t,n,i){return n*Math.pow(2,10*(e/i-1))+t},easeOutExpo:function(e,t,n,i){return n*(1-Math.pow(2,-10*e/i))+t},easeInOutExpo:function(e,t,n,i){return(e/=i/2)<1?n/2*Math.pow(2,10*(e-1))+t:(e--,n/2*(2-Math.pow(2,-10*e))+t)},easeInCirc:function(e,t,n,i){return e/=i,-n*(Math.sqrt(1-e*e)-1)+t},easeOutCirc:function(e,t,n,i){return e/=i,e--,n*Math.sqrt(1-e*e)+t},easeInOutCirc:function(e,t,n,i){return(e/=i/2)<1?-n/2*(Math.sqrt(1-e*e)-1)+t:(e-=2,n/2*(Math.sqrt(1-e*e)+1)+t)},easeInElastic:function(e,t,n,i){var o=1.70158,r=0,a=n;return 0===e?t:1==(e/=i)?t+n:(r||(r=.3*i),a<Math.abs(n)?(a=n,o=r/4):o=r/(2*Math.PI)*Math.asin(n/a),-a*Math.pow(2,10*(e-=1))*Math.sin((e*i-o)*(2*Math.PI)/r)+t)},easeOutElastic:function(e,t,n,i){var o=1.70158,r=0,a=n;return 0===e?t:1==(e/=i)?t+n:(r||(r=.3*i),a<Math.abs(n)?(a=n,o=r/4):o=r/(2*Math.PI)*Math.asin(n/a),a*Math.pow(2,-10*e)*Math.sin((e*i-o)*(2*Math.PI)/r)+n+t)},easeInOutElastic:function(e,t,n,i){var o=1.70158,r=0,a=n;return 0===e?t:2==(e/=i/2)?t+n:(r||(r=i*(.3*1.5)),a<Math.abs(n)?(a=n,o=r/4):o=r/(2*Math.PI)*Math.asin(n/a),e<1?a*Math.pow(2,10*(e-=1))*Math.sin((e*i-o)*(2*Math.PI)/r)*-.5+t:a*Math.pow(2,-10*(e-=1))*Math.sin((e*i-o)*(2*Math.PI)/r)*.5+n+t)},easeInBack:function(e,t,n,i,o){return void 0===o&&(o=1.70158),n*(e/=i)*e*((o+1)*e-o)+t},easeOutBack:function(e,t,n,i,o){return void 0===o&&(o=1.70158),n*((e=e/i-1)*e*((o+1)*e+o)+1)+t},easeInOutBack:function(e,t,n,i,o){return void 0===o&&(o=1.70158),(e/=i/2)<1?n/2*(e*e*((1+(o*=1.525))*e-o))+t:n/2*((e-=2)*e*((1+(o*=1.525))*e+o)+2)+t},easeOutBounce:function(e,t,n,i){return(e/=i)<1/2.75?n*(7.5625*e*e)+t:e<2/2.75?n*(7.5625*(e-=1.5/2.75)*e+.75)+t:e<2.5/2.75?n*(7.5625*(e-=2.25/2.75)*e+.9375)+t:n*(7.5625*(e-=2.625/2.75)*e+.984375)+t},easeInBounce:function(e,t,n,i){return n-ye.easeOutBounce(i-e,0,n,i)+t},easeInOutBounce:function(e,t,n,i){return e<i/2?.5*ye.easeInBounce(2*e,0,n,i)+t:.5*ye.easeOutBounce(x,2*e-i,0,n,i)+.5*n+t}},Ae={globalDone:null,funcs:[],counter:0,uniqueID:0,start(e,t,n){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,o=arguments.length>4?arguments[4]:void 0,r=arguments.length>5?arguments[5]:void 0,a=arguments.length>6?arguments[6]:void 0,s=arguments.length>7?arguments[7]:void 0,l=!(arguments.length>8&&void 0!==arguments[8])||arguments[8],c={func:e,current:-i*Math.abs(t),duration:(1-Math.max(i,0))*Math.abs(t),done:n,easing:o||ye.linearTween,cycling:t<0,running:!0,debug:i<0,name:r||"T"+this.counter,id:void 0===a?this.counter:a,paused:!1,cancelFun:s,updateCount:0,ignoreFirstFrame:l};return this.funcs.push(c),e(0,16),this.counter+=1,e},trigger(e){var t=void 0===e.delayRatio?0:e.delayRatio,n=e.func||function(){},i=void 0===e.duration?0:e.duration;void 0!==e.cycling&&e.cycling&&(i=-Math.abs(i));var o=e.done||null,r=e.easing||ye.linearTween,a=e.name||"R"+this.counter,s=void 0===e.id?this.counter:e.id;return this.start(n,i,o,t,r,a,s)},setTimeout(e,t,n){var i=void 0===n?this.counter:n;return this.trigger({done:e,duration:void 0===t?0:t,name:"O"+this.counter,id:i})},pause(){this.paused=!0},resume(){this.paused=!1},update(e){this.funcs.forEach((function(t){if(!(0==t.updateCount++&&t.ignoreFirstFrame||t.paused||(t.current+=1e3*e,t.current<0)))if(t.current>=t.duration&&!t.cycling){var n=t.easing(1,0,1,1);t.func(n,1e3*e),t.done&&t.done(),t.running=!1}else{var i=t.easing(t.current%t.duration/t.duration,0,1,1);(t.func(i,1e3*e)||!1)&&(t.done&&t.done(),t.running=!1)}}));var t=this.funcs.length;this.funcs=this.funcs.filter((function(e){return e.running}));var n=this.funcs.length;if(t>0&&0===n&&this.globalDone){var i=this.globalDone;this.globalDone=null,i()}},adjustSpeed(e,t){for(var n=this.getById(e),i=0;i<n.length;i++){var o=n[i];o.duration/=t,o.current/=t}},getById(e){return this.funcs.filter((function(t){return e===t.id}))},get(e){for(var t=0;t<this.funcs.length;t+=1)if(this.funcs[t].func===e)return this.funcs[t];return null},isRunning(e){var t=this.get(e);return null!==t&&t.running},countActive(){for(var e=0,t=0;t<this.funcs.length;t+=1)e+=this.funcs[t].running;return e},listActive(){for(var e=[],t=0;t<this.funcs.length;t+=1)this.funcs[t].running&&e.push(this.funcs[t].name);return e},done(e){this.globalDone=e},cancelById:function(e,t){var n=void 0===e?0:e;this.funcs=this.funcs.filter((function(e){var i=e.id==n;return i&&t&&e.cancelFun&&e.cancelFun(),!i}))},cancel(e){this.funcs=this.funcs.filter((function(t){return t.func!==e}))},getUniqueId(){return this.uniqueID-=1,this.uniqueID}};function Ee(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return be(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return be(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var i=0,o=function(){};return{s:o,n:function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var r,a=!0,s=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return a=e.done,e},e:function(e){s=!0,r=e},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw r}}}}function be(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);n<t;n++)i[n]=e[n];return i}function we(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}var xe=new THREE.PlaneBufferGeometry(1,1,1,1),Ce=function(e){f(n,THREE.Object3D);var t=we(n);function n(){var e,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};o(this,n),e=t.call(this);var r=new THREE.Texture;return r.minFilter=THREE.LinearFilter,r.magFilter=THREE.NearestFilter,r.anisotropy=4,e.root=i.root||h(e),e.sprite=new THREE.Mesh(xe,new THREE.MeshBasicMaterial({map:r,color:16777215,transparent:!0,depthTest:!1,depthWrite:!1})),e.add(e.sprite),e.sprite.renderOrder=null!=i.renderOrder?i.renderOrder:2,e.fontWeight=null==i.fontWeight?"":i.fontWeight,e.rectBorderThick=i.rectBorderThick||0,e.textBorderThick=i.textBorderThick||0,e.fontface="Arial",e.fontsize=i.fontsize||16,e.textBorderColor=i.textBorderColor||{r:0,g:0,b:0,a:0},e.backgroundColor=i.backgroundColor||{r:255,g:255,b:255,a:1},e.textColor=i.textColor||{r:0,g:0,b:0,a:1},e.borderColor=i.borderColor||{r:0,g:0,b:0,a:0},e.borderRadius=null==i.borderRadius?6:i.borderRadius,e.margin=i.margin,e.textshadowColor=i.textshadowColor,e.textAlign=i.textAlign||"center",e.name=i.name,e.sizeInfo=i.sizeInfo,e.lineSpace=i.lineSpace,ve=i.player,e.addEventListener("dispose",e.dispose.bind(h(e))),e.fixOrient=i.fixOrient,e.events={updatePose:e.updatePose.bind(h(e))},i.player.on("update",e.events.updatePose),e.addEventListener("isVisible",(function(t){t.visible&&e.updatePose()})),null!=i.text&&e.setText(i.text),e.updatePose(),e}return u(n,[{key:"updatePose",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.lastFrameChanged,n=void 0===t||t;if(n&&(this.needsUpdate=!0),De.realVisible(this)&&this.needsUpdate){this.needsUpdate=!1;var i="floorplan"==ve.mode?ve.cameraControls.activeControl.camera:ve.camera;if(!this.fixOrient){var o=this.root.parent.getWorldQuaternion(new THREE.Quaternion);this.root.quaternion.multiplyQuaternions(o.invert(),i.quaternion)}if(this.sizeInfo){var r,a=ge.getScaleForConstantSize(Object.assign({camera:(null===(r=ve.cameraControls.activeControl)||void 0===r?void 0:r.camera)||ve.cameraControls.cameras.panorama,dom:ve.domElement},this.sizeInfo,{farBound:"floorplan"==ve.mode&&this.sizeInfo.farBoundPlan||this.sizeInfo.farBound,position:this.root.getWorldPosition(new THREE.Vector3)}));this.scale.set(a,a,a)}}}},{key:"setText",value:function(e){this.text!==e&&(this.text=e instanceof Array?e:[e+""],this.updateTexture())}},{key:"setPos",value:function(e){this.position.copy(e),this.needsUpdate=!0}},{key:"setTextColor",value:function(e){this.textColor=e,this.updateTexture()}},{key:"setBorderColor",value:function(e){this.borderColor=e,this.updateTexture()}},{key:"setBackgroundColor",value:function(e){this.backgroundColor=e,this.updateTexture()}},{key:"setVisible",value:function(e){this.visible=e}},{key:"setUniforms",value:function(e,t){this.sprite.setUniforms(e,t)}},{key:"updateTexture",value:function(){var e=document.createElement("canvas"),t=e.getContext("2d"),n=window.devicePixelRatio;t.font=this.fontWeight+" "+this.fontsize*n+"px "+this.fontface;var i=0,o=[];t.textBaseline="alphabetic";var r,a=0,s=Ee(this.text);try{for(s.s();!(r=s.n()).done;){var l=r.value,c=t.measureText(l),u=c.width;o.push(c),i=Math.max(i,u),a+=c.fontBoundingBoxAscent+c.fontBoundingBoxDescent}}catch(e){s.e(e)}finally{s.f()}var h=(this.margin?(new THREE.Vector2).copy(this.margin):new THREE.Vector2(this.fontsize,.8*this.fontsize)).multiplyScalar(n),d=(this.lineSpace||.5*this.fontsize)*n,p=this.rectBorderThick*n,f=this.textBorderThick*n,m=2*(h.x+p+f)+i,v=2*(h.y+p+f*this.text.length)+d*(this.text.length-1)+a;t.canvas.width=m,t.canvas.height=v,t.font=this.fontWeight+" "+this.fontsize*n+"px "+this.fontface,t.strokeStyle="rgba("+this.borderColor.r+","+this.borderColor.g+","+this.borderColor.b+","+this.borderColor.a+")",t.lineWidth=p,t.fillStyle="rgba("+this.backgroundColor.r+","+this.backgroundColor.g+","+this.backgroundColor.b+","+this.backgroundColor.a+")",this.roundRect(t,p/2,p/2,m-p,v-p,this.borderRadius*n),t.fillStyle="rgba("+this.textColor.r+","+this.textColor.g+","+this.textColor.b+","+this.textColor.a+")";for(var g=h.y+p,y=0;y<this.text.length;y++){g+=(null==o[y].fontBoundingBoxAscent?this.fontsize*n*.8:o[y].fontBoundingBoxAscent)+f;var A="center"==this.textAlign?(i-o[y].width)/2:"left"==this.textAlign?0:i-o[y].width,E=p+f+h.x+A;this.textBorderThick&&(t.strokeStyle="rgba("+this.textBorderColor.r+","+this.textBorderColor.g+","+this.textBorderColor.b+","+this.textBorderColor.a+")",t.lineWidth=this.textBorderThick*n,t.strokeText(this.text[y],E,g)),this.textshadowColor&&(t.shadowOffsetX=0,t.shadowOffsetY=0,t.shadowColor=this.textshadowColor,t.shadowBlur=(this.textShadowBlur||this.fontsize/3)*n),t.fillText(this.text[y],E,g),g+=(null==o[y].fontBoundingBoxDescent?this.fontsize*n*.2:o[y].fontBoundingBoxDescent)+f+d}this.sprite.material.map.image=e,this.sprite.material.map.needsUpdate=!0,this.sprite.material.map.dispose();var b=this.sprite.scale.clone();this.sprite.scale.set(.01*m/n,.01*v/n,1),b.equals(this.sprite.scale)||(this.needsUpdate=!0)}},{key:"roundRect",value:function(e,t,n,i,o,r){e.beginPath(),e.moveTo(t+r,n),e.lineTo(t+i-r,n),e.arcTo(t+i,n,t+i,n+r,r),e.lineTo(t+i,n+o-r),e.arcTo(t+i,n+o,t+i-r,n+o,r),e.lineTo(t+r,n+o),e.arcTo(t,n+o,t,n+o-r,r),e.lineTo(t,n+r),e.arcTo(t,n,t+r,n,r),e.closePath(),e.fill(),e.stroke()}},{key:"dispose",value:function(){this.sprite.material.map.dispose(),this.sprite.material.dispose(),this.parent&&this.parent.remove(this),this.sprite.dispatchEvent({type:"dispose"}),this.events.updatePos&&options.player.off("update",this.events.updatePose),this._listeners=[]}}]),n}();function Te(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return Ie(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Ie(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var i=0,o=function(){};return{s:o,n:function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var r,a=!0,s=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return a=e.done,e},e:function(e){s=!0,r=e},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw r}}}}function Ie(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);n<t;n++)i[n]=e[n];return i}var ke,Be=0,Pe={delayOneFrame(e){window.setTimeout(e,1)},normalizeUrl:e=>e.replace("https://","http://"),domainFromUrl(e){var t=/^([^:]*:\/\/)?(www\.)?([^\/]+)/.exec(e);return t?t[3]:e},average(e,t){if(0===e.length)return null;for(var n=0,i=0,o=0;o<e.length;o++){n+=t?e[o][t]:e[o],i++}return n/i},countUnique(e){for(var t={},n=0;n<e.length;n++)t[e[n]]=1+(t[e[n]]||0);return Object.keys(t).length},averageVectors(e,t){var n=new THREE.Vector3;if(0===e.length)return n;for(var i=0,o=0;o<e.length;o++){var r=t?e[o][t]:e[o];n.add(r),i++}return n.divideScalar(i)},equalLists(e,t){if(e.length!==t.length)return!1;for(var n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0},lowerMedian:(e,t)=>0===e.length?null:(t=t||2,e.sort((function(e,t){return e-t})),e[Math.floor(e.length/t)]),stableSort:(e,t)=>e.map((function(e,t){return{value:e,index:t}})).sort((function(e,n){var i=t(e.value,n.value);return 0!==i?i:e.index-n.index})).map((function(e){return e.value})),sortByScore:function(e,t,n){var i=t?Pe.filterAll(e,t):e;return 0===i.length?[]:i=i.map((function(e){var t=n.map((function(t){return t(e)}));return{item:e,scores:t,score:t.reduce((function(e,t){return e+t}),0)}})).sort((function(e,t){return t.score-e.score}))},filterAll:(e,t)=>e.filter((function(e){return t.every((function(t){return t(e)}))})),formatDate:e=>[e.getFullYear(),e.getMonth()+1,e.getDate()].join("-"),formatDatetime:e=>[e.getFullYear(),e.getMonth()+1,e.getDate(),e.getHours(),e.getMinutes()].join("-"),randomString(e){for(var t="",n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",i=0;i<e;i++)t+=n.charAt(Math.floor(Math.random()*n.length));return t},uint8ToBase64(e,t){t&&"number"==typeof t||(t=8192);for(var n=[],i=0;i<e.length;i+=t)n.push(String.fromCharCode.apply(null,e.subarray(i,i+t)));return btoa(n.join(""))},uuid4:function e(t){return t?(t^16*Math.random()>>t/4).toString(16):([1e7]+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g,e)},nth:e=>1===(e%=10)?e+"st":2===e?e+"nd":3===e?e+"rd":e+"th",extendObject:(e,t)=>(Object.keys(t).forEach((function(n){e[n]=t[n]})),e),deepExtend:function e(t){t=t||{};for(var n=1;n<arguments.length;n++){var i=arguments[n];if(i)for(var o in i)i.hasOwnProperty(o)&&("object"==typeof i[o]?t[o]=e(t[o],i[o]):t[o]=i[o])}return t},inherit(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e},extend(e,t){for(var n in t.prototype)e.prototype[n]=t.prototype[n]},extendObject(e,t){if(t instanceof Object)return Object.keys(t).forEach((function(n){e[n]=t[n]})),e},_textureCache:{},loadTextureFromCache(e){return this._textureCache[e]||(this._textureCache[e]=Re(e)),this._textureCache[e]},extend(e,t){for(var n in t.prototype)e.prototype[n]=t.prototype[n]},valueFromHash(e,t){var n=new RegExp("[#&?]"+e+"=([^#&?]*)").exec(window.location.href);if(!n)return t;var i=n[1];return"boolean"==typeof t?"true"===i||"1"===i:"number"==typeof t?parseFloat(i):window.decodeURIComponent(i)},deepFreeze(e){var t=this;return Object.freeze(e),Object.getOwnPropertyNames(e).forEach((function(n){!e.hasOwnProperty(n)||null===e[n]||"object"!=typeof e[n]&&"function"!=typeof e[n]||Object.isFrozen(e[n])||t.deepFreeze(e[n])})),e},defaultValue(e){if(null!=e&&"object"==typeof e)return Array.isArray(e)?[]:{}},randomUnique:()=>crypto.getRandomValues(new Uint32Array(1))[0],debounce(e,t){var n=null;return arguments.length>2&&void 0!==arguments[2]&&arguments[2]?function(){var n=this,i=Date.now();if(i-Be>=t){for(var o=arguments.length,r=new Array(o),a=0;a<o;a++)r[a]=arguments[a];e.apply(n,r),Be=i}}:function(){for(var i=arguments.length,o=new Array(i),r=0;r<i;r++)o[r]=arguments[r];n&&clearTimeout(n);var a=this;n=setTimeout((function(){e.apply(a,o)}),t)}},getMixedSet:function(e,t){return e.filter((function(e){return t.includes(e)}))},getUnionSet:function(e,t){return e.concat(t.filter((function(t){return!e.includes(t)})))},getDifferenceSet:function(e,t){var n=e.filter((function(e){return!t.includes(e)})),i=t.filter((function(t){return!e.includes(t)}));return n.concat(i)},getDifferenceSetMuti:function(e){var t=[];return e.forEach((function(e){e.forEach((function(e){var n=t.indexOf(e);n>-1?t.splice(n,1):t.push(e)}))})),t},pushToGroupAuto:function(e,t,n,i){var o=function(e,t){return e==t||n&&n(e,t)},r=t.filter((function(t){return t.find((function(n){return(o(n,e[0])||o(n,e[1]))&&(!i||i(t))}))}));if(r.length)if(e.forEach((function(e){r[0].includes(e)||r[0].push(e)})),r.length>1){var a=[];a.relationships=[e.slice()],r.forEach((function(e){var n=Pe.getUnionSet(a.relationships,e.relationships);(a=Pe.getUnionSet(a,e)).relationships=n,t.splice(t.indexOf(e),1)})),t.push(a)}else r[0].relationships.push(e.slice());else e.relationships=[e.slice()],t.push(e)},disconnectGroup:function(e,t,n){var i=t.slice();return e.forEach((function(e){var i,o=t.find((function(t){var o=t.relationships.find((function(t){return e.every((function(e){return t.some((function(t){return function(e,t){return e==t||n&&n(e,t)}(t,e)}))}))}));if(o)return i=o,!0}));if(o){t.splice(t.indexOf(o),1),o.relationships.splice(o.relationships.indexOf(i),1);var r=[];o.relationships.forEach((function(e){Pe.pushToGroupAuto(e,r,n)})),t.push.apply(t,r)}})),{newGroups:t.filter((function(e){return!i.includes(e)}))}},removeFromGroup:function(e,t,n,i){if(t.relationships.filter((function(t){return!t.some((function(t){return e.some((function(e){return function(e,t){return e==t||i&&i(e,t)}(t,e)}))}))})).length!=t.relationships){n.splice(n.indexOf(t),1);var o=[];return t.relationships.forEach((function(e){Pe.pushToGroupAuto(e,o,i)})),n.push.apply(n,o),{newGroups:o}}},getMAXCUBETEXTURESIZE:function(){try{var e=document.createElement("canvas"),t=e.getContext("webgl");return t||(t=e.getContext("experimental-webgl")),t.getParameter(t.MAX_CUBE_MAP_TEXTURE_SIZE)}catch(e){return 0}}},Re=((ke=new THREE.TextureLoader).setCrossOrigin("Anonymous"),ke.crossOrigin=!0,function(e,t,n,i){var o=ke.load(e,t,n,i);return o.magFilter=o.minFilter=THREE.LinearFilter,o.needsUpadte=!0,o});Pe.dataURLtoBlob=function(e){for(var t=e.split(","),n=t[0].match(/:(.*?);/)[1],i=atob(t[1]),o=i.length,r=new Uint8Array(o);o--;)r[o]=i.charCodeAt(o);return new Blob([r],{type:n})},Pe.dataURLtoFile=function(e,t){for(var n=e.split(","),i=n[0].match(/:(.*?);/)[1],o=atob(n[1]),r=o.length,a=new Uint8Array(r);r--;)a[r]=o.charCodeAt(r);return new File([a],t,{type:i})},Pe.saveFile=function(e,t,n){var i=document.createElementNS("http://www.w3.org/1999/xhtml","a");i.href=e,i.download=t;var o=document.createEvent("MouseEvents");o.initMouseEvent("click",!0,!1,window,0,0,0,0,0,!1,!1,!1,!1,0,null),i.dispatchEvent(o),n&&n()},Pe.PrefixPng="data:image/png;base64,",Pe.getBlobSrc=function(e,t){var n=Pe.dataURLtoBlob((t?Pe.PrefixPng:"")+e);return window.URL.createObjectURL(n)},Pe.replaceAll=function(e,t,n){var i=new RegExp(t,"g");return e.replace(i,n)},Pe.randomWord=function(e,t,n){var i="",o=t,r=["0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"];e&&(o=Math.round(Math.random()*(n-t))+t);for(var a=0;a<o;a++){i+=r[Math.round(Math.random()*(r.length-1))]}return i},Pe.getRandomSid=function(){var e=Pe.randomWord(!0,5,7),t=(new Date).getTime()+"",n=t.length;return e+(t=t.substring(n-8,n-5)+t.substring(n-3,n))},Pe.getTime=function(e){var t="",n=Math.round(e/60);return n<10&&(t+="0"),t+=n,1==(e=Math.round(e%60)+"").length&&(e="0"+e),t=t+":"+e},Pe.CloneJson=function(e){var t=JSON.stringify(e);return JSON.parse(t)},Pe.CloneObject=function(e,t){var n=this,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],o=arguments.length>3?arguments[3]:void 0;if(i.includes(THREE.Object3D)||i.push(THREE.Object3D),o||(o=function(){}),!e||"number"==typeof e||"string"==typeof e||e instanceof Function||i.some((function(t){return e instanceof t}))||o(e))return e;if(e instanceof Array)return e.map((function(e){return n.CloneObject(e,t,i,o)}));if(e.clone instanceof Function)return e.clone();var r={};for(var a in e)e[a]instanceof Object&&!t?r[a]=this.CloneObject(e[a],t,i,o):r[a]=e[a];return r},Pe.CloneClassObject=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.ignoreList,i=void 0===n?[]:n,o=t.simpleCopyList,r=void 0===o?[]:o,a=new e.constructor;return this.CopyClassObject(a,e,{ignoreList:i,simpleCopyList:r}),a},Pe.CopyClassObject=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=n.ignoreList,o=void 0===i?[]:i,r=n.simpleCopyList,a=void 0===r?[]:r;for(var s in t){if(s in t.__proto__)break;o.includes(s)||(a.includes(s)?e[s]=t[s]:e[s]=this.CloneObject(t[s],!1,a))}},Pe.ifSame=function(e,t){if(e==t)return!0;if(!e||!t)return!1;if(e.constructor!=t.constructor)return!1;if(e instanceof Array){if(e.length!=t.length)return!1;for(var n=t.slice(0),i=function(t){if(null==(r=n.find((function(n){return ifSame(e[t],n)})))&&!n.includes(r)&&!e.includes(r))return{v:!1};var i=n.indexOf(r);n.splice(i,1)},o=0;o<e.length;o++){var r,a=i(o);if("object"==typeof a)return a.v}return!0}if(e.equals instanceof Function)return e.equals(t);if("number"==typeof e||"string"==typeof e)return!(!isNaN(e)||!isNaN(t))||e==t;if("object"==typeof e){var s=Object.keys(e),l=Object.keys(t);if(!ifSame(s,l))return!1;for(var c in e){if(!ifSame(e[c],t[c]))return!1}return!0}console.log("isSame出现例外")},Pe.canvasToImg=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,n=arguments.length>2?arguments[2]:void 0,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"image/jpeg",o=arguments.length>4?arguments[4]:void 0,r=e.toDataURL(i,t);return n&&this.saveTex(r,i,o),r};var Me,Se=function(e){return"image/"+(e=e.toLowerCase().replace(/jpg/i,"jpeg")).match(/png|jpeg|bmp|gif/)[0]};Pe.saveTex=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"image/jpeg",n=arguments.length>2?arguments[2]:void 0;return function(n){e=e.replace(Se(t),"image/octet-stream");n=n||"4dage_"+(new Date).getTime()+("png"==t?".png":".jpg");Pe.saveFile(e,n)}(n)},Pe.compressImg=function(){var e=k(S.mark((function e(t,n){return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",new Promise((function(e,i){if(t.width>n||t.height>n){var o=n/Math.max(t.width,t.height);console.log("compress img",t.width,t.height,"to",n);var r=Math.round(t.width*o),a=Math.round(t.height*o),s=document.createElement("canvas"),l=s.getContext("2d");l.canvas.width=r,l.canvas.height=a,l.drawImage(t,0,0,r,a);var c=Pe.canvasToImg(s,1),u=new Image;u.src=c,u.onload=function(){e(u)}}else e(t)})));case 1:case"end":return e.stop()}}),e)})));return function(t,n){return e.apply(this,arguments)}}(),Pe.imgAddLabel=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=document.createElement("canvas"),o=i.getContext("2d");o.canvas.width=e.width,o.canvas.height=e.height,o.drawImage(e,0,0,e.width,e.height);var r=n.widthRatioToImg?e.width*n.widthRatioToImg:t.width,a=r*t.height/t.width;null==n.leftRatioToImg&&null!=n.rightRatioToImg&&(n.leftRatioToImg=1-n.rightRatioToImg-(n.widthRatioToImg||t.width/e.width)),null==n.topRatioToImg&&null!=n.bottomRatioToImg&&(n.topRatioToImg=1-n.bottomRatioToImg-a/e.height);var s=e.width*n.leftRatioToImg,l=e.height*n.topRatioToImg;return o.globalAlpha=null!=n.opacity?n.opacity:1,o.drawImage(t,s,l,r,a),Pe.canvasToImg(i,n.quality||.95)},Pe.imgAddText=function(){var e=k(S.mark((function e(t,n,i){var o,r;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return o=new Ce(Object.assign({backgroundColor:{r:0,g:0,b:0,a:0},textColor:{r:255,g:255,b:255,a:1},margin:{x:3,y:3},renderOrder:50,fontsize:20,text:n},i)),(r=new Image).src=o.sprite.material.map.image.toDataURL("image/png",1),e.abrupt("return",new Promise((function(e,n){r.onload=function(){i.horizonCenter&&(i.leftRatioToImg=.5-r.width/t.width/2);var n=Pe.imgAddLabel(t,r,i);o.dispose(),e(n)}})));case 4:case"end":return e.stop()}}),e)})));return function(t,n,i){return e.apply(this,arguments)}}(),Pe.pixelsArrayToDataUrl=function(e,t,n){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:.7,o=arguments.length>4?arguments[4]:void 0,r=document.createElement("canvas");r.width=t,r.height=n;var a=r.getContext("2d");if(e=new e.constructor(e),!o)for(var s=4*t,l=0;l<parseInt(n/2);l++){var c=n-l-1,u=e.slice(l*s,l*s+s),h=e.slice(c*s,c*s+s);e.set(h,l*s),e.set(u,c*s)}var d=a.createImageData(t,n);d.data.set(e),a.putImageData(d,0,0);var p=r.toDataURL("image/png",i);return p},Pe.renderTargetToDataUrl=function(e,t,n,i){var o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:.7,r=arguments.length>5?arguments[5]:void 0,a=t*n,s=new Uint8Array(4*a);i.readRenderTargetPixels(e,0,0,t,n,s);var l=this.pixelsArrayToDataUrl(s,t,n,o,r);return l},Pe.screenPass=new function(){this.screenScene=new THREE.Scene,this.screenQuad=new THREE.Mesh(new THREE.PlaneBufferGeometry(2,2,1)),this.screenQuad.material.depthTest=!0,this.screenQuad.material.depthWrite=!0,this.screenQuad.material.transparent=!0,this.screenScene.add(this.screenQuad),this.camera=new THREE.Camera,this.render=function(e,t,n){this.screenQuad.material=t;var i=e.getClearAlpha();if(e.setClearAlpha(0),void 0===n)e.render(this.screenScene,this.camera);else{var o=e.getRenderTarget();e.setRenderTarget(n),e.clear(),e.render(this.screenScene,this.camera),e.setRenderTarget(o)}e.setClearAlpha(i)}},Pe.renderTex=function(e,t,n){var i=new THREE.WebGLRenderTarget(n.x,n.y,{minFilter:THREE.LinearMipmapLinearFilter,generateMipmaps:!0,format:THREE.RGBAFormat});return this.screenPass.render(t,e,i),i.texture},Pe.updateVisible=function(e,t,n){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,o=arguments.length>4?arguments[4]:void 0;e.unvisibleReasons||(e.unvisibleReasons=[]),e.visibleReasons||(e.visibleReasons=[]);var r,a=function(){e.unvisibleReasons=e.unvisibleReasons.sort((function(e,t){return t.level-e.level})),e.visibleReasons=e.visibleReasons.sort((function(e,t){return t.level-e.level}));var n=(e.visibleReasons[0]?e.visibleReasons[0].level:-1)>=(e.unvisibleReasons[0]?e.unvisibleReasons[0].level:-1);e.visible!=n&&(e.visible=n,e.dispatchEvent({type:"isVisible",visible:n,reason:t}))};n?((r=e.unvisibleReasons.findIndex((function(e){return e.reason==t})))>-1&&(o="cancel",e.unvisibleReasons.splice(r,1)),"add"==o&&(e.visibleReasons.some((function(e){return e.reason==t}))||e.visibleReasons.push({reason:t,level:i}))):((r=e.visibleReasons.findIndex((function(e){return e.reason==t})))>-1&&(o="cancel",e.visibleReasons.splice(r,1)),"cancel"!=o&&(e.unvisibleReasons.some((function(e){return e.reason==t}))||e.unvisibleReasons.push({reason:t,level:i})));a()},Pe.getObjVisiByReason=function(e,t){return!!e.visible||(!e.unvisibleReasons||!e.unvisibleReasons.some((function(e){return e.reason==t})))},Pe.setCameraLayers=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];e.layers.disableAll(),t.concat(n).forEach((function(t){var n=Potree.config.renderLayers[t];null!=n?e.layers.enable(n):console.error("setCameraLayer没找到layer!")}))},Pe.setObjectLayers=function(e,t){var n=Potree.config.renderLayers[t];null!=n?e.traverse((function(e){e.layers.set(n)})):console.error("setCameraLayer没找到layer!")},Pe.intervalTool={list:[],isWaiting:function(e,t,n){var i=this,o=this.list.find((function(t){return t.name==e}));if(o)o.requestUpdate=!0;else{var r=t();o={name:e},this.list.push(o),setTimeout((function(){var a=i.list.indexOf(o);i.list.splice(a,1),(o.requestUpdate||r)&&i.isWaiting(e,t,n)}),n)}}},Pe.batchHandling={lists:[],getSlice:function(e,t,n){var i=n.stopWhenAllUsed,o=n.minCount,r=void 0===o?5:o,a=n.maxCount,s=void 0===a?100:a,l=n.durBound1,c=n.durBound2,u=n.maxUseCount;if(0==t.length||!(u=null==u?Pe.getBestCount({name:e,minCount:r,maxCount:s,durBound1:l,durBound2:c,ifLog:!1}):u))return{list:[]};this.lists[e]||(this.lists[e]={list:[]});var h=this.lists[e].list.filter((function(e){return t.some((function(t){return e.item==t}))}));this.lists[e].list=h,t.forEach((function(e){h.some((function(t){return t.item==e}))||h.push({item:e,count:0})}));var d=h.filter((function(e){return 0==e.count})),p=[];if(d.slice(0,u).forEach((function(e){p.push(e.item),e.count++})),d.length>u);else{if(!i){var f=Math.min(t.length,u)-p.length;h.slice(0,f).forEach((function(e){p.push(e.item),e.count++}))}h.forEach((function(e){return e.count--}))}return{list:p}},addSliceListen(e){var t=e.getList,n=e.callback,i=e.minCount,o=e.maxCount;e.durBound1,e.durBound2,e.maxHistory;var r,a,s=e.player;s.on("update",(function(e){if(!s.flying){var l,c=t(),u=!s.lastFrameChanged,h=s.lastFrameChanged||!a;h?(l=c,r=null):(r||(r=Pe.getDifferenceSet(c,a)),l=r);var d=Pe.batchHandling.getSlice("ifVideoInsight",l,{stopWhenAllUsed:u,minCount:i,maxCount:o,durBound1:3,durBound2:13,maxHistory:3}).list;d.forEach(n),h||(r=Pe.getDifferenceSet(r,d)),a=d}}))}},Pe.getBestCount=(Me={},function(e){var t,n=e.name,i=e.minCount,o=void 0===i?1:i,r=e.maxCount,a=void 0===r?6:r,s=e.durBound1,l=void 0===s?1:s,c=e.durBound2,u=void 0===c?4:c,h=e.ifLog,d=e.maxHistory,p=performance.getEntriesByName("loop-start");if(p.length){var f=performance.now()-p[p.length-1].startTime;t=Math.round(ge.linearClamp(f,l,u,a,o)),d&&(Me[n]||(Me[n]=[]),0==t&&Me[n].length>d-1&&!Me[n].some((function(e){return e>0}))&&(t=1),Me[n].push(t),Me[n].length>d&&Me[n].splice(0,1)),h&&console.log(n,t," ,dur:",f.toFixed(3))}else t=a;return t}),Pe.timeMeasuring={reportTimings:!1,collection:{},registerCollect(e,t){this.collection[e]=t,t.measures=[],t.sum=0},addTimeMark:function(e,t,n){var i=this.collection[e],o=performance.now(),r=i&&(i.measures.length<i.minCount||o-i.lastAddTime>i.refreshTime);if(r||this.reportTimings){if("end"==t&&0==performance.getEntriesByName(e+"-start").length)return;if(performance.mark(e+"-"+t),"end"==t){var a=performance.measure(e,e+"-start",e+"-end");if(!a)return;n&&console.log(e,"耗时",a.duration.toFixed(3)),r&&(i.measures.length>=i.minCount&&(i.measures=[],i.sum=0),i.measures.push(a.duration),i.sum+=a.duration,i.mean=i.sum/i.measures.length,i.measures.sort((function(e,t){return e-t})),i.median=i.measures[parseInt(i.measures.length/2)],i.lastAddTime=o,i.measures.length,i.minCount)}}},report:function(e){if(this.toggle||(this.toggle=e),e-this.toggle>1e3){if(this.reportTimings){var t,n=performance.getEntriesByType("measure"),i=new Set,o=Te(n);try{for(o.s();!(t=o.n()).done;){var r=t.value;i.add(r.name)}}catch(e){o.e(e)}finally{o.f()}var a,s=new Map,l=Te(i);try{for(l.s();!(a=l.n()).done;){var c=a.value;s.set(c,{measures:[],sum:0,n:0,min:1/0,max:-1/0})}}catch(e){l.e(e)}finally{l.f()}var u,h=Te(n);try{for(h.s();!(u=h.n()).done;){var d=u.value,p=s.get(d.name);p.measures.push(d),p.sum+=d.duration,p.n++,p.min=Math.min(p.min,d.duration),p.max=Math.max(p.max,d.duration)}}catch(e){h.e(e)}finally{h.f()}var f,m=Te(s);try{for(m.s();!(f=m.n()).done;){var v=fe(f.value,2),g=(v[0],v[1]);g.mean=g.sum/g.n,g.measures.sort((function(e,t){return e.duration-t.duration})),1===g.n?g.median=g.measures[0].duration:g.n>1&&(g.median=g.measures[parseInt(g.n/2)].duration)}}catch(e){m.e(e)}finally{m.f()}var y=Array.from(i).reduce((function(e,t){return Math.max(e,t.length)}),0)+5,A=" ".concat("NAME".padEnd(y)," |")+" ".concat("MIN".padStart(5)," |")+" ".concat("MEDIAN".padStart(5)," |")+" ".concat("MAX".padStart(5)," |")+" ".concat("AVE".padStart(5)," |")+" ".concat("SAMPLES".padStart(4),"\n");A+=" ".concat("-".repeat(A.length),"\n");var E,b=Te(i=Array.from(i).sort());try{for(b.s();!(E=b.n()).done;){var w=E.value,x=s.get(w),C=x.min.toFixed(2),T=x.median.toFixed(2),I=x.max.toFixed(2),k=x.n,B=x.mean.toFixed(2);A+=" ".concat(w.padEnd(y)," |")+" ".concat(C.padStart(5)," |")+" ".concat(T.padStart(5)," |")+" ".concat(I.padStart(5)," |")+" ".concat(B.padStart(5)," |")+" ".concat(k.toString().padStart(4),"\n")}}catch(e){b.e(e)}finally{b.f()}console.log(A)}performance.clearMarks(),performance.clearMeasures(),this.toggle=e}}},Pe.isVideoPlayed=function(e){return!e.paused&&!isNaN(e.duration)},Pe.GifTexDeal={animateObjects:[],animateTexs:[],addAnimation:function(e,t){var n,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{delay:0},o=arguments.length>3?arguments[3]:void 0,r=this.animateTexs.find((function(t){return t.texture==e}));r?n=r:(n={texture:e,info:i},this.animateTexs.push(n),this.setRepeart(n));var a={animation:n,owner:t,id:o};return this.animateObjects.push(a),a},remove:function(e){var t=this.animateObjects.indexOf(e);if(t>-1){if(this.animateObjects.splice(t,1),!this.animateObjects.find((function(t){return t.animation==e.animation}))){var n=this.animateTexs.indexOf(e.animation);this.animateTexs.splice(n,1),e.animation.texture.repeat.set(1,1)}this.stop(e)}},setRepeart:function(e){e.texture.repeat.set(1/e.info.cellXcount,1/e.info.cellYcount)},start:function(e){var t=this;if(e&&!e.started&&(e.started=!0,!e.animation.started)){e.animation.started=!0;var n=e.animation.info,i=n.cellXcount*n.cellYcount-(n.voidCount||0);if(!(i<=1)){e.startCallback&&e.startCallback();var o=n.duration+n.delay,r=n.delay/o;Ae.start((function(t){var o=Math.floor((i-1)*t),r=o%n.cellXcount,a=n.cellYcount-Math.floor(o/n.cellXcount)-1;e.animation.texture.offset.x=r/n.cellXcount,e.animation.texture.offset.y=a/n.cellYcount}),o,(function(){e.started=!1,e.animation.started=!1,n.waitNextLoop=setTimeout((function(){t.start(e)}),n.waitNextTime||0)}),r,null,e.id,"gif_"+e.animation.texture.id)}}},stop:function(e){e&&e.started&&(e.started=!1,this.animateObjects.find((function(t){return t.animation==e.animation&&t.started}))||(Ae.cancelById("gif_"+e.animation.texture.id),e.animation.texture.offset.set(0,0),e.animation.started=!1,clearTimeout(e.animation.info.waitNextLoop)))}},Pe.getNestedValue=function(e,t){var n,i=e,o=Te(t.split("."));try{for(o.s();!(n=o.n()).done;){var r=n.value;if(void 0===(i=Array.isArray(i)&&!isNaN(parseInt(r))?i[parseInt(r)]:i[r]))return}}catch(e){o.e(e)}finally{o.f()}return i},Pe.watch=function(e,t,n){var i=n;Object.defineProperty(e,t,{get:function(){return i},set:function(e){console.warn("watch:",t,e),i=e}})},Pe.realVisible=function(e){for(var t,n=!0,i=e;i;){if(!1===i.visible){n=!1;break}t=i,i=i.parent}return!n||t instanceof THREE.Scene||(n=!1),n},Pe.isChildOf=function(e,t){for(var n;n&&n!=t;)n=n.curParent;if(n)return!0};var De=Pe,Le=function(e){De.extend(e,EventEmitter)},Fe={mobileVersion(e,t){var n=window.navigator.userAgent.match(e);return n=n?n[1].split(t):[],{major:parseInt(n[0])||0,minor:parseInt(n[1])||0,patch:parseInt(n[2])||0}},isFullscreen:()=>document.fullscreenElement||document.mozFullscreenElement||document.mozFullScreenElement||document.webkitFullscreenElement||document.msFullscreenElement,supportsFullscreen:()=>document.fullscreenEnabled||document.mozFullscreenEnabled||document.mozFullScreenEnabled||document.webkitFullscreenEnabled||document.msFullscreenEnabled,isPointerLocked:()=>document.pointerLockElement||document.mozPointerLockElement||document.webkitPointerLockElement,requestFullscreen(e,t){e.requestFullscreen?e.requestFullscreen():e.mozRequestFullScreen?e.mozRequestFullScreen():e.webkitRequestFullscreen?e.webkitRequestFullscreen(Element.ALLOW_KEYBOARD_INPUT):e.msRequestFullscreen&&e.msRequestFullscreen(),t&&$(document).on("fullscreenchange webkitfullscreenchange mozfullscreenchange MSFullscreenChange",Fe.requestPointerLock)},requestPointerLock(){var e;if(document.fullscreenElement)e=document.fullscreenElement();else if(document.mozFullscreenElement)e=document.mozFullscreenElement();else if(document.mozFullScreenElement)e=document.mozFullScreenElement();else{if(!document.webkitFullscreenElement)return;e=document.webkitFullscreenElement()}e.requestPointerLock=e.requestPointerLock||e.mozRequestPointerLock||e.webkitRequestPointerLock,e.requestPointerLock(),$(document).off("fullscreenchange webkitfullscreenchange mozfullscreenchange MSFullscreenChange",this)},exitPointerLock(){document.exitPointerLock=document.exitPointerLock||document.mozExitPointerLock||document.webkitExitPointerLock,document.exitPointerLock()},exitFullscreen(){document.exitFullscreen?document.exitFullscreen():document.msExitFullscreen?document.msExitFullscreen():document.mozCancelFullScreen?document.mozCancelFullScreen():document.webkitExitFullscreen&&document.webkitExitFullscreen()},details(){var e=navigator.userAgent.match("(Firefox|Chrome|Safari)/([\\d]+)");return e?{name:e[1],version:parseInt(e[2]),platform:navigator.platform}:{}},is(e){return this.details()&&this.details().name===e},inIframe:()=>window.parent!==window,aspectRatio(){var e=window.innerWidth/window.innerHeight;return isFinite(e)?e:0},userAgent:()=>window.navigator.userAgent,isMobile(){var e=navigator.userAgent||navigator.vendor||window.opera;return/(android|bb\d+|meego).+mobile|android|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od|ad)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(e)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(e.substr(0,4))},isLandscape(){return this.isMobile&&this.aspectRatio()>1},isSmallScreen:()=>screen.width/window.devicePixelRatio<240,detectWeixin:function(){return"micromessenger"==window.navigator.userAgent.toLowerCase().match(/MicroMessenger/i)},detectWeixinMiniProgram:function(){return window.navigator.userAgent.match("miniProgram")},detectIE:()=>-1!==window.navigator.userAgent.indexOf("MSIE ")||!!navigator.userAgent.match(/Trident.*rv\:11\./),detectSafari(){return-1!==window.navigator.userAgent.indexOf("Safari")&&!this.detectChrome()},detectFirefox:()=>-1!==window.navigator.userAgent.indexOf("Firefox"),detectChrome(){return-1!==window.navigator.userAgent.indexOf("Chrome")&&!this.detectOpera()},detectOpera:()=>-1!==window.navigator.userAgent.indexOf("OPR"),detectIOS(){return this.detectIPhone()||this.detectIPad()||this.detectIPod()},detectIPad(){var e=window.navigator.userAgent;return/iPad/.test(e)},detectIPod(){var e=window.navigator.userAgent;return/iPod/.test(e)},detectIPhone(){var e=window.navigator.userAgent;return/iPhone/.test(e)},detectAndroid:()=>-1!==window.navigator.userAgent.indexOf("Android"),detectAndroidMobile(){var e=window.navigator.userAgent;return this.detectAndroid()&&-1!==e.indexOf("Mobile")},detectSamsungNative(){var e=window.navigator.userAgent;return-1!==e.indexOf("SM-G900H")||-1!==e.indexOf("GT-I9500")||-1!==e.indexOf("SM-N900")},detectSamsungS6:()=>-1!==window.navigator.userAgent.indexOf("SM-G92"),detectHUAWEI5X:()=>-1!==window.navigator.userAgent.indexOf("KIW-TL00H"),detectWebVR:()=>!(!window.navigator.getVRDisplays||!window.VRDisplay),getVRDisplay(){var e=this;return new Promise((function(t,n){e.detectWebVR()?navigator.getVRDisplays().then((function(e){e.length>=1?t(e[0]):n(null)})).catch((function(){return n(null)})):n(null)}))},iosVersion(){if(!this.detectIOS())throw new DeviceMismatchException("Did not detect an iDevice");return this.mobileVersion(/((?:\d+\_?){1,3}) like Mac OS/,"_")},androidVersion(){if(!this.detectAndroid())throw new DeviceMismatchException("Did not detect an Android based device");return this.mobileVersion(/Android ((?:\d+\.?){1,3})/,".")},valueFromCookie(e,t){var n=new RegExp(e+"=([0-9a-f]+)(; ?|$)").exec(document.cookie);if(!n)return t;var i=n[1];return"boolean"==typeof t?"true"===i||"1"===i:"number"==typeof t?parseFloat(i):i},valueFromHash(e,t){var n=new RegExp("[#&?]"+e+"=([^#&?]*)").exec(window.location.href);if(!n)return t;var i=n[1];return"boolean"==typeof t?"true"===i||"1"===i:"number"==typeof t?parseFloat(i):window.decodeURIComponent(i)},valueFromUrl(e){return this.urlHasValue(e,!0)},urlHasValue:function(e,t){var n=window.location.search.substr(1).split("&");if(t){for(var i=0;i<n.length;i++){var o=n[i].split("=");if(2===o.length&&o[0]===e)return o[1]}return""}for(var r=0;r<n.length;r++){if(n[r].split("=")[0]==e)return!0}return!1},detectVRHeadset(){var e=navigator.userAgent||navigator.vendor,t=/Oculus|Rift/.test(e),n=/HTC|Vive/.test(e),i=/Valve|Index/.test(e),o=/Windows MR/.test(e),r=/PICO 4/.test(e),a=/Daydream/.test(e),s=/Gear VR/.test(e),l=/PlayStation VR/.test(e),c=/Cardboard/.test(e),u=/VR|Head-Mounted|HMD/.test(e);return!!(t||n||i||o||r||a||s||l||c||u)},maybeQilin:()=>window.navigator.userAgent.toLowerCase().includes("linux")},He={green:new THREE.Color("#15FFE2"),yellow:new THREE.Color("#F6FE14"),lightGreen:new THREE.Color("#09e1c0"),newBlue:new THREE.Color("#00c8ae"),altBlue:new THREE.Color(47355),tagDefault:new THREE.Color(223357),classicBlue:new THREE.Color(53759),mpYellow:new THREE.Color(16502016),mpOrange:new THREE.Color(16428055),mpBlue:new THREE.Color(12096),mpLtGrey:new THREE.Color(13751252),mpDkGrey:new THREE.Color(10000019),mpRed:new THREE.Color(12525854),mpOrangeDesat:new THREE.Color(16764529),mpBlueDesat:new THREE.Color(4034734),mpRedDesat:new THREE.Color(14705505),white:new THREE.Color(16777215),black:new THREE.Color(0),_desat(e,t){var n=t||.3,i=(new THREE.Color).copy(e).getHSL(e);return(new THREE.Color).setHSL(i.h,i.s*(1-n),i.l)},_darken(e,t){var n=t||.2,i=e.getHSL(e);return(new THREE.Color).setHSL(i.h,i.s,i.l*(1-n))}},Ve="black",Oe="std",Qe="walk";Math.sign=function(e){return e<0?-1:1};var _e={signedUrlDefaultExpireTime:24e4,signedUrlCheckInterval:1e4,signedUrlRefreshBuffer:15e3,dollhouseFOV:Fe.isMobile()?90:70,dollhouseNear:1,dollhouseFar:5e3,insideFOV:Fe.isMobile()?90:70,insideFOVMax:120,insideNear:.1,insideFar:5e3,insideLookSpeed:.12,insideLookLimitUp:"sds"==Fe.valueFromUrl("ai")?50:Fe.isMobile()?15:25,insideLookLimitDown:"sds"==Fe.valueFromUrl("ai")?-50:Fe.isMobile()?-15:-25,orthoNear:1,orthoFar:5e3,orthoBase:10,planeHeightShift:.1,narrowLandscapeHeight:290,reallyNarrowLandscapeHeight:250,visionTilingStartDate:new Date("8/26/2016"),visionTilingStartVersion:"1.1.407.13667",windowHeightHighQualityThreshold:900,tourStepDelayDefault:3500,tourStepDelaySlideShow:5e3,workshopApsect:9/16,highQualityMaxZoom:2,ultraHighQualityMaxZoom:3},ze=1,Ue=1,Ne=2,Ge=3,je=5,We=6,qe=7,Je=9,Ye=9,Ze=10,Xe=11,Ke=13,$e=14,et=14,tt=20,nt={visions:2,debug:!1,version:"2.23.8-0-g24ec69e",skyboxRadius:2500,job:"dacf7dfa24ae47fab8fcebfe4dc41ab9",preTexture:"_50k_texture_jpg_high1",format:"_50k.dam",skyboxRadius:2500,modelBoundsPadding:5,showNeighbors:!1,useWheel:Fe.valueFromHash("wh",!0),crossOrigin:"anonymous",fancierTransition:!1,wireframe:!1,skyboxWireframe:!1,modelAlpha:1,highlightPanoSelection:!1,showSweeps:!0,showSkyboxes:!1,showMesh:!0,showFloors:!1,showFloorDuration:300,showFloorDelay:300,hideFloorDuration:300,hideFloorDelay:0,reticuleOpacityTransitionTime:250,reticuleColor:He.newBlue,markerOpacityTransitionTime:500,guiAnimationSpeed:250,highlightAnimationDuration:500,modelComponentLoadSpinnerDelay:150,captureErrors:!1,maxMobileTextures:6,minimalMemoryMode:Fe.valueFromHash("m3",Fe.isMobile()),startupFlyinDelay:3e3,vrEnabled:!1,overlay:{width:1,height:.5,depth:.04},dollhouseDefault:{minDistance:15,maxDistance:50,minPolarAngle:THREE.MathUtils.degToRad(10),maxPolarAngle:THREE.MathUtils.degToRad(90)},hideReticuleTimeout:1e3,analytics:{inactivityThreshold:30,sessionTrackingRate:.15,maxTrackedErrors:20,sessionDurationPingFrequency:10,sessionDurationTimeout:15},flydown:{movementEasing:"easeInOutQuad",movementDelay:.001,rotationEasing:"easeInOutQuad",rotationDelay:.5,modelTextureDelay:.75,skyboxDelay:.75},transition:{flySpeed:.0043,flyTime:650,flytimeMaxDistanceThreshold:10,flytimeDistanceMultiplier:120,maxRotSpeed:1.2,aimTime:1500,aimSlowFactor:1.5,blur:.8,movementEasing:"easeOutSine",blendEasing:"easeInOutQuad",fastForwardFactor:Fe.valueFromHash("mfis",3)},show360Views:{enabled:!0,transitionTime:1e3},quickstart:{enabled:1,animation:1400,showTextDelay:500,fadeOutDelay:3e3,fovChange:10},appConfig:{webvr_version:null,segment_key:null,embedly_key:null,branch_key:null,keen_write_key:null,keen_project_id:null},input:{longTapThreshold:200,moveToleranceNDC:.08,touchMoveThreshold:25},labels:{enabled:!1,hideUntilStart:!0,fadeInDuration:250,fadeInDelay:250,fadeOutDuration:250,fadeOutDelay:0,zoomHideThreshhold:{mobile:Fe.isSmallScreen()?.45:.6,desktop:2},zoomTruncateThreshhold:{mobile:Fe.isSmallScreen()?.35:.45,desktop:.85},minLengthForTruncate:16,truncateLength:12,truncateSuffix:"..."},tags:{enabled:Fe.valueFromHash("mt",1),startup:{hideUntilStart:!0,fadeInDuration:500,fadeInDelay:100},visibility:{anyDistance:!0,visibleDistance:8,cameraClearance:.1,alphaTestLevel:.05,hideViaFloor:!0,hideOffScreenDisc:!1,hideOffScreenObject:!1},disc:{opacity:1,disabledOpacity:.5,scale:{nearBound:1.5,farBound:4.8,linkFarBound:!1,linkPercent:40,maxSize:80,minSize:40,baseViewportSize:800,responsiveness:100}},pole:{enabled:!0,height:.5,width:2,opacity:.5,color:"white"},navigate:{nearestPano:!0,lineOfSight:!0,reactivate:!0,aimAt:"disc",tiltTolerance:25,rotateSpeedFactor:.6}},view360:{circleDisToCenter:2.4,visibleDisAtView:15},boundExpandLength:1.5,path:{color:He.newBlue,colorUp:He._desat(He.newBlue,.5),colorDown:He._darken(He.newBlue,.35),opacity:.5,style:"ribbon",height:.025,ribbonWidth:.24,outsideHeight:.5,waypointRadius:.5,waypointIndoorRadius:.24,waypointPulse:1e3,typ:Ve,meshFree:Fe.valueFromHash("mf",1),mapGuides:Fe.valueFromHash("guides",!0),fadeInTime:400,fadeOutTime:300},warp:{nearPanoDist:.1,matchCam:!1,blur:.33,fastTime:1500,teleportTime:1500,outsideTime:2e3,lookAheadMax:.3,lookAheadDist:2.5,softPushDist:.37,softPushEnd:.3,softBendAngle:8,softBendTilt:4,softBendEnd:.3,doBurns:Fe.valueFromHash("kb",!0),burnsAngle:35,minBurnsAngle:35,minDownAngle:-35,maxTurnPerSec:280,maxAimPerSec:35,minRotation:12,maxAimRotation:33.2,turnFriction:.2,flySpeed:.01,minWarpTime:1200,warpInterruptionRedirectTime:500,tourStepDelay:Fe.valueFromHash("st",0),walkDelay:0,walkMaxDist:50,walkMinDist:.8,walkSlideShowThreshhold:3e3,walkExtraPanosDistance:.4,timePerMeter:800,motionLeadTime:500,movementEasing:"easeInOutQuad",blendEasing:"easeInOutQuad",showBunny:!1,loop:Fe.valueFromHash("lp",!1),auto:Fe.valueFromHash("ts",-1),eOrder:"YXZ",stepFactor:.25,brakeStrength:2,minBrakeAngle:.1,maxBrakeAngle:1.8,climbEffort:4},rotationFriction:Fe.isMobile()?.08:.05,rotationAccelerationInside:4.5,rotationAccelerationOutside:.15,rotationAfterMoveMultiplierX:Fe.isMobile()?120:40,rotationAfterMoveMultiplierY:40,rotationAfterMoveHistoryCount:5,panFriction:.09,panAccelerationOutside:60,zoomNearLimit:.1,zoomFarLimit:10,navigation:{panoScores:!1,mouseDirection:!0,filterStrictness:.75,angleFactor:-30,directionFactor:10,distanceFactor:-1,optionalityFactor:3},sdkInit:!1,secretPanelWord:[38,38,40,40,37,39,37,39,66,65],console:Fe.valueFromHash("console",!1),noMeshFloorPositionOffset:new THREE.Vector3(0,-1.2,0),panoramaNeighbourMaxDistance:5,panoFloorClickRadius:.35,showScreenshotLocations:!1,showAxis:!1,showNeighbourRaycasts:!1,colorMarkerOnLoad:!1,colorMarkerByFloor:!1,tiling:{panoPreRenderRepeatDelay:2500,panoPreRenderDelay:500,preRenderTourPanos:Fe.valueFromHash("tileprerender",0),tilingFlagNames:["usetiles","tiles"],maxNavPanoQuality:Fe.valueFromHash("maxtileq",null),maxZoomPanoQuality:Fe.valueFromHash("maxztileq",null),overlayStyle:Fe.valueFromHash("tileoverlay",0),uploadIntervalDelay:Fe.valueFromHash("tileupdelay",10),initialIntervalDelay:Fe.valueFromHash("itiledelay",0),maxNonBaseUploadsPerFrame:Fe.valueFromHash("maxnbtpf",2),maxBaseUploadsPerFrame:Fe.valueFromHash("maxbtpf",6),customCompression:Fe.valueFromHash("tilecustcomp",0),mobileHighQualityOverride:!1,allowUltraHighResolution:!0},zoom:{enabled:!0,forceOff:Fe.valueFromHash("nozoom",0),overridemax:Fe.valueFromHash("maxzoom",null),overridemin:Fe.valueFromHash("minzoom",null),max:_e.highQualityMaxZoom,min:1,transitionStyle:Fe.valueFromHash("zoomtrans",1),activationThreshold:1.1,restoreTime:500,zoomToDefaultWhenToPano:!0},profiling:{enabled:Fe.valueFromHash("mem",!1)}};(nt=De.deepExtend(nt,_e,{insideFOV:Fe.valueFromHash("fov",_e.insideFOV),insideFOVMax:Fe.valueFromHash("fovmax",_e.insideFOVMax),panorama:{transitionTime:1e3,modelAlpha:0,modelAlphaDelay:nt.flydown.modelTextureDelay,modelAlphaLength:1,skyboxOpacity:1,skyboxOpacityDelay:nt.flydown.skyboxDelay,skyboxOpacityLength:.9,fovLength:1,fovDelay:0,cameraMatrixDuration:.8,cameraMatrixDelay:0,cameraMatrixEase:ye.easeInCubic,reticuleOpacity:1,markerOpacity:.3,markerOpacityOnHover:1},dollhouse:{transitionTime:1e3,modelAlpha:1,modelAlphaDelay:0,modelAlphaLength:1-nt.flydown.modelTextureDelay,skyboxOpacity:0,skyboxOpacityDelay:0,skyboxOpacityLength:1-nt.flydown.skyboxDelay,fovLength:1,fovDelay:0,cameraMatrixDuration:.8,cameraMatrixDelay:.3,cameraMatrixEase:ye.easeInQuint,reticuleOpacity:1,markerOpacity:0,markerOpacityOnHover:0},floorplan:{transitionTime:1e3,modelAlpha:1,modelAlphaDelay:0,modelAlphaLength:1-nt.flydown.modelTextureDelay,skyboxOpacity:0,skyboxOpacityDelay:0,skyboxOpacityLength:1-nt.flydown.skyboxDelay,fovLength:1,fovDelay:0,cameraMatrixDuration:.5,cameraMatrixDelay:0,cameraMatrixEase:ye.easeOutQuint,reticuleOpacity:1,markerOpacity:0,markerOpacityOnHover:0,cameraHeight:50},transitioning:{reticuleOpacity:0,markerOpacity:.3,markerOpacityOnHover:1},"floorplan-dollhouse":{rotationDelay:0,rotationDuration:1,cameraMatrixEase:ye.easeInQuint},"floorplan-panorama":{rotationDelay:.5,rotationDuration:1},"dollhouse-panorama":{rotationDelay:.5,rotationDuration:1},"dollhouse-floorplan":{rotationDelay:0,rotationDuration:1,cameraMatrixDuration:1.05,cameraMatrixDelay:.5},"panorama-dollhouse":{rotationDelay:0,rotationDuration:.5,cameraMatrixEase:ye.easeInOutQuad},"panorama-floorplan":{transitionTime:1500,rotationDelay:0,rotationDuration:.5},floorMat:{"stardard-hide":{opacity:.2,brightness:.12,mixRatio:.7,depthTest:!0,renderOrder:Ze},"stardard-show":{opacity:1,brightness:0,mixRatio:0,depthTest:!0,renderOrder:Ue},"hasPlane-normal":{opacity:.024,brightness:.6,mixRatio:1,depthTest:!0,renderOrder:Ze},"hasPlane-curFloor":{opacity:1,brightness:.1,mixRatio:.98,depthTest:!0,renderOrder:Ue}}})).path.meshFree&&(nt.path.typ=Qe),nt.zoom.max=nt.zoom.overridemax||nt.zoom.max,nt.zoom.min=nt.zoom.overridemin||nt.zoom.min,nt.HorizontalBlurShader=new THREE.ShaderPass(THREE.HorizontalBlurShader),nt.VerticalBlurShader=new THREE.ShaderPass(THREE.VerticalBlurShader),nt.VerticalBlurShader.renderToScreen,nt.aspect=window.innerWidth/window.innerHeight,isNaN(_e.aspect)&&(_e.aspect=1),nt.planeBufferGeometry=new THREE.PlaneBufferGeometry(.4,.4,1,1),nt.freeze=Object.freeze({FlyToPano:Ae.getUniqueId(),FlyToNewMode:Ae.getUniqueId(),FlyToSameMode:Ae.getUniqueId(),FlyToViewFloor:Ae.getUniqueId(),LookTransition:Ae.getUniqueId(),ZoomTransition:Ae.getUniqueId(),LookRotationForPlay:Ae.getUniqueId(),wallLineShine:Ae.getUniqueId(),spotShine:Ae.getUniqueId(),rulerShine:Ae.getUniqueId(),outsideFocus:Ae.getUniqueId(),shopCircle:Ae.getUniqueId()});var it,ot,rt,at=nt,st=he(),lt={};function ct(e,t){if(void 0!==lt[e]&&console.warn("Identifier component.".concat(e," has already been declared")),"function"!=typeof t)throw TypeError("argument component not a function");lt[e]=t}var ut=Le((rt=ot=function(){function e(t){o(this,e),this.uid=e.uid++,this.env=e.env,this.version=e.version,this.dom=null,this.$plugins=null,this.core=new le(this),this.config=e.config(t,{}),this.Plugins=new ae(this),this.gui=new pe(this),null!=this.config.vr.markerHeight&&(at.vrMarkerHeight=this.config.vr.markerHeight),null!=this.config.scene.markerOpacity&&(at.panorama.markerOpacity=this.config.scene.markerOpacity),null!=this.config.scene.pathEndColor&&(at.path.color=this.config.scene.pathEndColor)}return u(e,[{key:"withConfig",value:function(e){this.config=Y(this.config,e||{})}},{key:"withDom",value:function(){if(!this.dom){var e="string"==typeof this.config.dom?document.querySelector(this.config.dom):this.config.dom;if(!e)throw new Error("options.dom must be require");var t=document.createElement("div");t.className="kankan-app";var n=document.createElement("div");n.id="kankan-plugins__".concat(this.uid),n.className="kankan-plugins",n.style.position="absolute",n.style.top=0,n.style.left=0,n.style.width="100%",n.style.height="100%",n.style.pointerEvents="none",n.style.zIndex=10;var i=document.createElement("div");i.className="player",i.setAttribute("name","main");var o=document.createElement("div");o.className="player",o.setAttribute("name","copy");var r=document.createElement("div");r.className="player-mark",r.style.backgroundImage="url(".concat(this.resource.base("images/tag_pointer.png"),")"),i.appendChild(r),o.appendChild(r.cloneNode()),t.appendChild(n),t.appendChild(i),t.appendChild(o),e.appendChild(t),this.dom=t,this.$plugins=n}}},{key:"withComponent",value:function(e){var t=lt[e];if(void 0!==t){var n=t();n.prototype.$app=this;for(var i=arguments.length,o=new Array(i>1?i-1:0),r=1;r<i;r++)o[r-1]=arguments[r];this.core.add(e,Q(n,o))}else console.warn("component[".concat(e,"] not a function"))}},{key:"withNewComponent",value:function(e){var t=lt[e];if(void 0!==t){var n=t();n.prototype.$app=this;for(var i=arguments.length,o=new Array(i>1?i-1:0),r=1;r<i;r++)o[r-1]=arguments[r];return Q(n,o)}console.warn("component[".concat(e,"] not a function"))}}],[{key:"root",value:function(e){return st+e}},{key:"config",value:function(e,t){if("object"!=typeof e)return W;for(var n in t&&(t=Object.assign(t,W)),e)-1==["env","version"].indexOf(n)&&void 0!==W[n]&&(t&&(t[n]=e[n]),W[n]=e[n]);return t||W}}]),e}(),ot.uid=1,ot.env=W.env,ot.version=W.version,ot.Config=W,it=rt))||it,ht={};ht.RADIANS_PER_DEGREE=Math.PI/180,ht.DEGREES_PER_RADIAN=180/Math.PI,ht.Vector3=function(e,t,n){this.x=e||0,this.y=t||0,this.z=n||0},ht.Matrix4=function(){this.elements=new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]),arguments.length>0&&console.error("MathLight.Matrix4: the constructor no longer reads arguments. use .set() instead.")},ht.Matrix4.prototype={identity:function(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this},copy:function(e){return this.elements.set(e.elements),this},applyToVector3:function(e){var t=e.x,n=e.y,i=e.z,o=this.elements;return e.x=o[0]*t+o[4]*n+o[8]*i+o[12],e.y=o[1]*t+o[5]*n+o[9]*i+o[13],e.z=o[2]*t+o[6]*n+o[10]*i+o[14],this},getInverse:function(e,t){var n=this.elements,i=e.elements,o=i[0],r=i[1],a=i[2],s=i[3],l=i[4],c=i[5],u=i[6],h=i[7],d=i[8],p=i[9],f=i[10],m=i[11],v=i[12],g=i[13],y=i[14],A=i[15],E=p*y*h-g*f*h+g*u*m-c*y*m-p*u*A+c*f*A,b=v*f*h-d*y*h-v*u*m+l*y*m+d*u*A-l*f*A,w=d*g*h-v*p*h+v*c*m-l*g*m-d*c*A+l*p*A,x=v*p*u-d*g*u-v*c*f+l*g*f+d*c*y-l*p*y,C=o*E+r*b+a*w+s*x;if(0===C){var T="MathLight.Matrix4.getInverse(): can't invert matrix, determinant is 0";if(t)throw new Error(T);return console.warn(T),this.identity()}var I=1/C;return n[0]=E*I,n[1]=(g*f*s-p*y*s-g*a*m+r*y*m+p*a*A-r*f*A)*I,n[2]=(c*y*s-g*u*s+g*a*h-r*y*h-c*a*A+r*u*A)*I,n[3]=(p*u*s-c*f*s-p*a*h+r*f*h+c*a*m-r*u*m)*I,n[4]=b*I,n[5]=(d*y*s-v*f*s+v*a*m-o*y*m-d*a*A+o*f*A)*I,n[6]=(v*u*s-l*y*s-v*a*h+o*y*h+l*a*A-o*u*A)*I,n[7]=(l*f*s-d*u*s+d*a*h-o*f*h-l*a*m+o*u*m)*I,n[8]=w*I,n[9]=(v*p*s-d*g*s-v*r*m+o*g*m+d*r*A-o*p*A)*I,n[10]=(l*g*s-v*c*s+v*r*h-o*g*h-l*r*A+o*c*A)*I,n[11]=(d*c*s-l*p*s-d*r*h+o*p*h+l*r*m-o*c*m)*I,n[12]=x*I,n[13]=(d*g*a-v*p*a+v*r*f-o*g*f-d*r*y+o*p*y)*I,n[14]=(v*c*a-l*g*a-v*r*u+o*g*u+l*r*y-o*c*y)*I,n[15]=(l*p*a-d*c*a+d*r*u-o*p*u-l*r*f+o*c*f)*I,this},makeRotationFromQuaternion:function(e){var t=this.elements,n=e.x,i=e.y,o=e.z,r=e.w,a=n+n,s=i+i,l=o+o,c=n*a,u=n*s,h=n*l,d=i*s,p=i*l,f=o*l,m=r*a,v=r*s,g=r*l;return t[0]=1-(d+f),t[4]=u-g,t[8]=h+v,t[1]=u+g,t[5]=1-(c+f),t[9]=p-m,t[2]=h-v,t[6]=p+m,t[10]=1-(c+d),t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}},ht.Quaternion=function(e,t,n,i){this._x=e||0,this._y=t||0,this._z=n||0,this._w=void 0!==i?i:1},ht.Quaternion.prototype={get x(){return this._x},set x(e){this._x=e},get y(){return this._y},set y(e){this._y=e},get z(){return this._z},set z(e){this._z=e},get w(){return this._w},set w(e){this._w=e},copy:function(e){this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w},inverse:function(){return this.conjugate().normalize()},conjugate:function(){return this._x*=-1,this._y*=-1,this._z*=-1,this},length:function(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)},normalize:function(){var e=this.length();return 0===e?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this},setFromAxisAngle:function(e,t){var n=t/2,i=Math.sin(n);return this._x=e.x*i,this._y=e.y*i,this._z=e.z*i,this._w=Math.cos(n),this},setFromUnitVectors:function(){var e,t;return function(n,i){return void 0===e&&(e=new ht.Vector3),(t=ht.dot(n,i)+1)<1e-6?(t=0,Math.abs(n.x)>Math.abs(n.z)?ht.setVector(e,-n.y,n.x,0):ht.setVector(e,0,-n.z,n.y)):ht.cross(n,i,e),this._x=e.x,this._y=e.y,this._z=e.z,this._w=t,this.normalize()}}(),multiply:function(e){return this.multiplyQuaternions(this,e)},premultiply:function(e){return this.multiplyQuaternions(e,this)},multiplyQuaternions:function(e,t){var n=e._x,i=e._y,o=e._z,r=e._w,a=t._x,s=t._y,l=t._z,c=t._w;return this._x=n*c+r*a+i*l-o*s,this._y=i*c+r*s+o*a-n*l,this._z=o*c+r*l+n*s-i*a,this._w=r*c-n*a-i*s-o*l,this}},ht.convertWorkshopVector=function(e){return new ht.Vector3(-e.x,e.y,e.z)},ht.convertWorkshopQuaternion=function(e){return new ht.Quaternion(-e.x,e.y,e.z,-e.w).multiply(new ht.Quaternion(Math.sqrt(2)/2,Math.sqrt(2)/2,0,0))},ht.convertWorkshopOrthoZoom=function(e){return-1===e?-1:e/16*(window.innerWidth/window.innerHeight)/_e.workshopApsect},ht.convertWorkshopPanoramaQuaternion=function(e){return new ht.Quaternion(e.x,-e.y,-e.z,e.w).normalize().multiply((new ht.Quaternion).setFromAxisAngle(new ht.Vector3(0,1,0),270*ht.RADIANS_PER_DEGREE))},ht.normalize=function(e){var t=e.x*e.x+e.y*e.y+e.z*e.z,n=Math.sqrt(t);e.x/=n,e.y/=n,e.z/=n},ht.dot=function(e,t){return e.x*t.x+e.y*t.y+e.z*t.z},ht.cross=function(e,t,n){var i=e.x,o=e.y,r=e.z;n.x=o*t.z-r*t.y,n.y=r*t.x-i*t.z,n.z=i*t.y-o*t.x},ht.setVector=function(e,t,n,i){e.x=t,e.y=n,e.z=i},ht.copyVector=function(e,t){t.x=e.x,t.y=e.y,t.z=e.z},ht.addVector=function(e,t){e.x+=t.x,e.y+=t.y,e.z+=t.z},ht.subVector=function(e,t){e.x-=t.x,e.y-=t.y,e.z-=t.z},ht.applyQuaternionToVector=function(e,t){var n=t.x,i=t.y,o=t.z,r=e.x,a=e.y,s=e.z,l=e.w,c=l*n+a*o-s*i,u=l*i+s*n-r*o,h=l*o+r*i-a*n,d=-r*n-a*i-s*o;t.x=c*l+d*-r+u*-s-h*-a,t.y=u*l+d*-a+h*-r-c*-s,t.z=h*l+d*-s+c*-a-u*-r},ht.angleBetweenVectors=function(e,t){return Math.acos(ht.dot(e,t))},ht.closeTo=function(e,t,n){var i=Math.pow(10,-(n||4)),o=Math.abs(e.x-t.x)<i&&Math.abs(e.y-t.y)<i&&Math.abs(e.z-t.z)<i;return e.w?o&&Math.abs(e.w-t.w)<i:o};var dt=new THREE.Raycaster,pt={getPos2d:function(e,t,n,i){n=n||t.camera,i=i||t.domElement;var o,r,a=e.clone().project(n);o=(a.x+1)/2*i.clientWidth,r=(1-(a.y+1)/2)*i.clientHeight;var s=o<=i.clientWidth&&o>=0&&r<=i.clientHeight&&r>=0;return{pos:new THREE.Vector2(o,r),vector:a,trueSide:a.z<1,inSight:s}},ifShelter:function(e,t,n,i,o){n||(n=this.getPos2d(e,t)),i=i||t.camera;var r=new THREE.Vector3(n.x,n.y,-1).unproject(i),a=e.clone().sub(r).normalize();dt.set(r,a);var s=null==o?t.model.colliders:t.model.floors.index[o].collider.children,l=dt.intersectObjects(s),c=e.distanceTo(r);if(l&&l.length)for(var u=0;u<l.length;u++)if(l[u].distance<c)return!0},getPosAtPlane:function(e,t,n){var i=e,o=t.mouse,r=new THREE.Vector3(o.x,o.y,-1).unproject(t.camera);if(null!=n.y){var a=n.y;if("floorplan"==t.mode)var s=e.x,l=e.z;else{if(a<t.camera.position.y&&r.y<=i.y)return null;if(r.y==i.y)return void console.log("一样??");if(i.y==a)return void console.log("一样2??");s=((p=(r.y-a)/(i.y-a))*i.x-r.x)/(p-1),l=(p*i.z-r.z)/(p-1)}}else{var c=n.normalVec,u=n.pullPos;if(0!=c.y)return void console.log("N.y != 0");if(r.z==i.z)return void console.log("O.z==A.z?");if(0!=c.z&&0!=c.x){var h=c.x*(i.x-r.x)+c.y*(i.y-r.y)+c.z*(i.z-r.z);if(0==h)return void console.log("分母为0?? return;");var d=-(c.x*r.x+c.y*r.y+c.z*r.z-(u.x*c.x+u.y*c.y+u.z*c.z))/h;s=d*(i.x-r.x)+r.x,a=d*(i.y-r.y)+r.y,l=d*(i.z-r.z)+r.z}else if(0==c.x){l=u.z;if(r.y==i.y)return void console.log("一样??");if(i.y==a)return void console.log("一样2??");if(i.z==l)return void console.log("一样3??");s=((p=(r.z-l)/(i.z-l))*i.x-r.x)/(p-1),a=(p*i.y-r.y)/(p-1)}else if(0==c.z){s=u.x;if(r.y==i.y)return void console.log("一样??");if(i.y==a)return void console.log("一样2??");if(i.x==s)return void console.log("一样3??");var p;a=((p=(r.x-s)/(i.x-s))*i.y-r.y)/(p-1),l=(p*i.z-r.z)/(p-1)}}return new THREE.Vector3(s,a,l)},getMouseIntersect:function(e,t,n){var i=new THREE.Raycaster;e.updateMatrixWorld();var o=new THREE.Vector3(n.x,n.y,-1).unproject(e),r=new THREE.Vector3(n.x,n.y,1).unproject(e).sub(o).normalize();i.set(o,r),t.forEach((function(e){i.layers.enable(ge.getBaseLog(2,e.layers.mask))}));var a=i.intersectObjects(t);if(0===a.length)return null;var s=a.find((function(e){return!0===e.object.visible}));return s||null},ifIntersectChunks:function(e,t,n){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},o=t.clone().sub(e).normalize(),r=i.InfinityLen?1/0:e.distanceTo(t)+(i.extLen||0);if(0!=r){var a=new THREE.Raycaster(e.clone(),o,0,r),s=i.meshes||[];0==s.length&&(s=n.floors.reduce((function(e,t){return t.hidden?e:e.concat(t.collider.children)}),s));var l=a.intersectObjects(s);if(l&&l.length)return l;if(i.throughWidth){var c=ge.getNormal({points:[{x:e.x,y:e.z},{x:t.x,y:t.z}]});c.multiplyScalar(i.throughWidth);var u=new THREE.Vector3(c.x,0,c.y),h=e.clone().add(u);a.set(h,o);var d=a.intersectObjects(i.meshes||n.colliders);if(a.set(e.clone().add(u.negate()),o),d&&d.length)return d;var p=a.intersectObjects(i.meshes||n.colliders);if(p&&p.length)return p}return null}},getVisiblePano:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=[],o=e.clone(),r=n.panos||t.panos.list;return r.forEach((function(e){if(e.isAligned()){var r=e.position.clone(),a=r.distanceTo(o);if(!(null!=n.maxDis&&a>n.maxDis)){var s=new THREE.Raycaster(r.clone(),o.clone().sub(r).normalize(),0,a-(n.tolerance||0)).intersectObjects(n.model||t.colliders,!0);s&&s.length||i.push(e)}}})),i},raycastToFindFloor:function(){var e=[new THREE.Vector3(0,-1,0),new THREE.Vector3(1,-1,0),new THREE.Vector3(0,-1,1),new THREE.Vector3(-1,-1,0),new THREE.Vector3(0,-1,-1),new THREE.Vector3(1,0,0),new THREE.Vector3(0,0,1),new THREE.Vector3(-1,0,0),new THREE.Vector3(0,0,-1)];return function(t,n){var i=[],o=[],r=[];for(var a in t.model.floors.list){var s=t.model.floors.list[a];n.y>=s.boundingBox.min.y&&n.y<=s.boundingBox.max.y&&(i.push(s),o.push.apply(o,H(s.collider.children)))}if(1==i.length)return i[0];if(i.length>1){for(var l=0;l<e.length;l++){var c=new THREE.Raycaster(n.clone(),e[l].clone()).intersectObjects(o);c.length&&function(){var e=c[0].object.parent.floor,t=r.find((function(t){return t.floor==e}));t?t.len++:r.push({floor:e,len:1})}()}return r.sort((function(e,t){t.len,e.len})),r[0]||(r=[],i.forEach((function(e){var t=e.boundingBox,i=[new THREE.Vector3(t.min.x,t.min.y,t.min.z),new THREE.Vector3(t.max.x,t.max.y,t.max.z),new THREE.Vector3(t.min.x,t.min.y,t.max.z),new THREE.Vector3(t.min.x,t.max.y,t.min.z),new THREE.Vector3(t.max.x,t.min.y,t.min.z),new THREE.Vector3(t.max.x,t.max.y,t.min.z),new THREE.Vector3(t.min.x,t.max.y,t.max.z),new THREE.Vector3(t.max.x,t.min.y,t.max.z)],o=0;i.forEach((function(e){return o+=e.distanceTo(n)})),r.push({floor:e,dis:o})})),r.sort((function(e,t){e.dis,t.dis}))),r[0].floor}return n.y<t.model.floors.list[0].center.y?(i=t.model.floors.list.sort((function(e,t){return e.boundingBox.min.y-t.boundingBox.min.y})))[0]:(i=t.model.floors.list.sort((function(e,t){return t.boundingBox.max.y-e.boundingBox.max.y})))[0]}}(),getQuaByAim:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new THREE.Vector3,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:new THREE.Vector3(0,0,-1),i=(new THREE.Quaternion).setFromUnitVectors(n,e.clone().sub(t).normalize());return i},getAimByQua:function(e,t){return new THREE.Vector3(0,0,-1).applyQuaternion(e).add(t)},projectedRadius(e,t,n,i,o){return t instanceof THREE.OrthographicCamera?this.projectedRadiusOrtho(e,t.projectionMatrix,i,o):t instanceof THREE.PerspectiveCamera?this.projectedRadiusPerspective(e,t.fov*Math.PI/180,n,o):void 0},projectedRadiusPerspective(e,t,n,i){var o=1/Math.tan(t/2)/n;return e*(o=o*i/2)},projectedRadiusOrtho(e,t,n,i){var o=new THREE.Vector4(0),r=new THREE.Vector4(e);return o.applyMatrix4(t),r.applyMatrix4(t),o=new THREE.Vector3(o.x,o.y,o.z),r=new THREE.Vector3(r.x,r.y,r.z),o.x=.5*(o.x+1)*n,o.y=.5*(o.y+1)*i,r.x=.5*(r.x+1)*n,r.y=.5*(r.y+1)*i,o.distanceTo(r)}},ft={info(){var e;(e=console).log.apply(e,arguments)},debug(){var e;(e=console).debug.apply(e,arguments)},error(){var e;(e=console).error.apply(e,arguments)},warn(){var e;(e=console).warn.apply(e,arguments)},time(e){console.time(e)},timeEnd(e){console.timeEnd(e)},message(e){alert(e)}},mt=0,vt=1,gt=2,yt=3,At=4,Et=function(){this.actionSequence=[],this.actionSequenceInProgress=!1};Et.prototype.reset=function(e){this.actionSequenceInProgress=!1,this.actionSequence.length=0},Et.prototype.addZoomAction=function(){var e=null,t=null,n=!1,i=function(){e=null,this.actionSequence.length>0&&(this.actionSequence[0].start,this.actionSequence[this.actionSequence.length-1].end),this.reset()};return function(o,r,a){if(o!==r){n||(i=i.bind(this),n=!0),e&&(window.clearTimeout(e),e=null),a===t&&this.actionSequenceInProgress||(this.reset(),t=a),this.actionSequenceInProgress=!0;var s={start:o,end:r};this.actionSequence.push(s),e=window.setTimeout(i,150)}}}();var bt={UP:1,DOWN:-1,LEFT:"L",RIGHT:"R",FORWARD:"F",BACK:"B",reverse:{},opposite:function(e){return this.reverse[e.toString()]}};bt.reverse[bt.UP]=bt.DOWN,bt.reverse[bt.DOWN]=bt.UP,bt.reverse[bt.LEFT]=bt.RIGHT,bt.reverse[bt.RIGHT]=bt.LEFT,bt.reverse[bt.FORWARD]=bt.BACK,bt.reverse[bt.BACK]=bt.FORWARD;var wt=function(){function e(){o(this,e),this.events=[],this.valid=!1}return u(e,[{key:"push",value:function(e,t){this.events.push({direction:e,pano:t}),this.valid=!0}},{key:"pop",value:function(e){var t=this.events.pop();return this.events.length<1&&(this.valid=!1),t}},{key:"peek",value:function(){return this.events.length?this.events[this.events.length-1]:{direction:null,pano:null}}},{key:"invalidate",value:function(){this.events=[],this.valid=!1}},{key:"reversePano",value:function(e){if(!this.valid)return null;var t=this.peek();return bt.opposite(e)===t.direction?(this.pop(),t.pano):null}}]),e}(),xt={PANORAMA:"panorama",DOLLHOUSE:"dollhouse",FLOORPLAN:"floorplan",TRANSITIONING:"transitioning",toInt:function(e){switch(e){case this.PANORAMA:return 1;case this.DOLLHOUSE:return 2;case this.FLOORPLAN:return 3;case this.TRANSITIONING:return-1}throw new Error("未知模式: "+c)},fromInt:function(e){switch(e){case"1":case 1:return this.PANORAMA;case"2":case 2:return this.DOLLHOUSE;case"3":case 3:return this.FLOORPLAN}throw new Error("未知模式: "+c)}},Ct=function(){function e(t,n){o(this,e),this.version=1,this.cache=null,this.expires=0,this.projectNum=t,this.app=n}return u(e,[{key:"validate",value:function(e){return"catalog.json"in e&&Object.keys(e).length>0}},{key:"update",value:function(e){return this.cache=e,this.expires=Date.now()+constants.signedUrlDefaultExpireTime,oe.when()}},{key:"get",value:function(e){return this.app.resource.getViewImagesURL(e)}}]),e}();function Tt(e,t,n){return(Tt="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,n){var i=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=w(e)););return e}(e,t);if(i){var o=Object.getOwnPropertyDescriptor(i,t);return o.get?o.get.call(n):o.value}})(e,t,n||e)}var It=function(){function e(){if(o(this,e),this.list=[],this.index={},Object.defineProperty(this,"length",{get:function(){return this.list.length}}),"function"!=typeof this.getIndex)throw new Error("IndexedCollection.getIndex not implemented in subclass.")}return u(e,[{key:"forEach",value:function(e){this.list.forEach(e)}},{key:"add",value:function(e){this.list.push(e),this.index[this.getIndex(e)]=e}},{key:"extend",value:function(e){for(var t=0;t<e.length;t++)this.add(e[t])}},{key:"get",value:function(e){return this.index[e]}},{key:"first",value:function(){return this.list[0]}},{key:"last",value:function(){return this.list[this.list.length-1]}},{key:"reIndex",value:function(){this.index={};var e=this;this.forEach((function(t){e.index[e.getIndex(t)]=t}))}},{key:"filter",value:function(e){var t=this.list.filter(e);return this.reIndex(),t}},{key:"reduce",value:function(e,t){return this.list.reduce(e,t)}},{key:"sort",value:function(e){return this.list.sort(e)}},{key:"indexOf",value:function(e){for(var t=0;t<this.list.length;++t)if(this.list[t]===e)return t;return-1}},{key:"clone",value:function(){var e=new this.constructor;return e.extend(this.list),e}}]),e}(),kt=function(){function e(t){o(this,e),this.chunksize=t||10,this.chunks={},this.boundingBoxes={},this.children=[],this.offset=new THREE.Vector3(0,.5,0),this.material=new THREE.MeshBasicMaterial({color:16777215*Math.random(),side:THREE.DoubleSide})}return u(e,[{key:"add",value:function(e){var t,n,i,o,r,a,s,l,c,u,h=e.attributes;h?(t=h.position.array,n=void 0!==e.index?e.index.array:void 0):t=e.vertices;var d=new THREE.Vector3;if(n)for(i=0,o=n.length;i<o;i+=3){var p=3*n[i],f=3*n[i+1],m=3*n[i+2];r=(t[p]+t[f]+t[m])/3,a=(t[p+1]+t[f+1]+t[m+1])/3,s=(t[p+2]+t[f+2]+t[m+2])/3,(l=Math.floor(r/this.chunksize)+"."+Math.floor(a/this.chunksize)+"."+Math.floor(s/this.chunksize))in this.chunks?(u=this.chunks[l],c=this.boundingBoxes[l]):(u=this.chunks[l]=[],c=this.boundingBoxes[l]=new THREE.Box3),u.push(t[p],t[p+1],t[p+2],t[f],t[f+1],t[f+2],t[m],t[m+1],t[m+2]),c.expandByPoint(d.set(t[p],t[p+1],t[p+2])),c.expandByPoint(d.set(t[f],t[f+1],t[f+2])),c.expandByPoint(d.set(t[m],t[m+1],t[m+2]))}else for(i=0,o=t.length;i<o;i+=9)r=(t[i]+t[i+3]+t[i+6])/3,a=(t[i+1]+t[i+4]+t[i+7])/3,s=(t[i+2]+t[i+5]+t[i+8])/3,(l=Math.floor(r/this.chunksize)+"."+Math.floor(a/this.chunksize)+"."+Math.floor(s/this.chunksize))in this.chunks?(u=this.chunks[l],c=this.boundingBoxes[l]):(u=this.chunks[l]=[],c=this.boundingBoxes[l]=new THREE.Box3),u.push(t[i],t[i+1],t[i+2],t[i+3],t[i+4],t[i+5],t[i+6],t[i+7],t[i+8]),c.expandByPoint(d.set(t[i],t[i+1],t[i+2])),c.expandByPoint(d.set(t[i+3],t[i+4],t[i+5])),c.expandByPoint(d.set(t[i+6],t[i+7],t[i+8]))}},{key:"build",value:function(){var e=new THREE.Object3D;for(var t in e.material=this.material,e.name="colliderGroup",this.chunks){var n=this.chunks[t],i=new THREE.BufferGeometry;i.setAttribute("position",new THREE.BufferAttribute(new Float32Array(n),3)),i.boundingBox=this.boundingBoxes[t];var o=new THREE.Mesh(i,this.material);o.material.visible=!1,o.name="collider",e.add(o),this.chunks[t]=[]}return e}}]),e}();function Bt(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}var Pt=function(e){f(n,THREE.Object3D);var t=Bt(n);function n(e,i,r){var a;return o(this,n),(a=t.call(this)).model=e,a.floorIndex=i,a.name=r||"楼层"+(i+1),a.panos=[],a.chunksDam=[],a.tiles=[],a.colliderBuilder=new kt(3),a.collider=null,a.center=null,a.boundingBox=new THREE.Box3,a.size=null,a.hidden=!1,a.display=!0,a.conservativeBoundingBox=new THREE.Box3,a.debugColor=16777215*Math.random(),a.transition=null,a.entryArrow=[],a.views=[],a}return u(n,[{key:"chunks",get:function(){if(this.chunksDam.length)return this.chunksDam;var e=[];return this.tiles.forEach((function(t){t.traverse((function(t){t.isChunk&&e.push(t)}))})),e}},{key:"enter",value:function(e){this.model.setFloor(this,e)}},{key:"show",value:function(){var e=this,t=this.model.$app.core.get("Player");this.hidden=!1;var n=this.model.$app.core.get("PanoVideoRenderer").canShowMarker();"panorama"==t.modeTran.split("-")[1]||t.locked||n&&this.panos.forEach((function(e){return e.hasVideo&&e.hasNeighbor()&&(e.marker.material.opacity=1)})),setTimeout((function(){"floorplan"==t.mode&&e.model.floorplanCadImg.showCadPlane(),e.setMaterial(),t.labelManager&&t.labelManager.show(e.floorIndex),t.OverlayManager&&t.OverlayManager.show(e.floorIndex,!0),t.GLTFEditor&&t.GLTFEditor.show(e.floorIndex,!0),e.model.$app.Camera.monitor.control.showAll(e.floorIndex)}),1)}},{key:"hide",value:function(){var e=this;this.hidden=!0,this.setMaterial(),this.panos.forEach((function(e){return e.hasVideo&&(e.marker.material.opacity=0)}));var t=this.model.$app.core.get("Player");setTimeout((function(){t.labelManager&&t.labelManager.hide(e.floorIndex),t.OverlayManager&&t.OverlayManager.hide(e.floorIndex),t.GLTFEditor&&t.GLTFEditor.hide(e.floorIndex),e.model.$app.Camera.monitor.control.hideAll(e.floorIndex)}),1)}},{key:"toggle",value:function(e){void 0===e&&(e=this.hidden),e?this.show():this.hide()}},{key:"addChunk",value:function(e){this.add(e),this.chunksDam.push(e),this.boundingBox.union(e.geometry.boundingBox);var t=new THREE.Vector3;this.boundingBox.getSize(t),this.size=t,this.colliderBuilder.add(e.geometry),e.floor=this}},{key:"addTile",value:function(e){var t=this;e.floorIndex=this.floorIndex,this.tiles.push(e),this.add(e),e.modified="",e.traverse((function(e){if(e.isChunk){e.setMode(t.model.mode,t.model.$app.core.get("Player").modeTran),t.setMaterial(e),t.boundingBox.union(e.geometry.boundingBox);var n=new THREE.Vector3;t.boundingBox.getSize(n),t.size=n,t.colliderBuilder&&t.colliderBuilder.add(e.geometry)}}))}},{key:"removeTile",value:function(e){this.tiles=this.tiles.filter((function(t){return t!==e})),e.traverse((function(e){e.isChunk&&(e.geometry.dispose(),e.material.dispose(),e.material.uniforms.map.value&&e.material.uniforms.map.value.dispose())})),this.remove(e),e.modified="remove"}},{key:"addPano",value:function(e){this.panos.push(e),e.marker&&this.add(e.marker);var t=new THREE.Vector3(1,1,1),n=(new THREE.Box3).setFromCenterAndSize(e.position,t);this.boundingBox.union(n)}},{key:"removePano",value:function(e){var t=this.panos.indexOf(e);t>-1&&this.panos.splice(t,1)}},{key:"addView",value:function(e){this.views.push(e)}},{key:"removeView",value:function(e){var t=this.views.indexOf(e);t>-1&&this.views.splice(t,1)}},{key:"build",value:function(){this.collider=this.colliderBuilder.build(!0),this.collider.floor=this;var e=new THREE.Vector3;this.boundingBox.getCenter(e),this.center=e,this.conservativeBoundingBox.copy(this.boundingBox),this.conservativeBoundingBox.min.y=De.lowerMedian(this.collider.children.map((function(e){return e.geometry.boundingBox.min.y})),5),this.conservativeBoundingBox.max.y=De.lowerMedian(this.collider.children.map((function(e){return e.geometry.boundingBox.max.y})),5),this.colliderBuilder=null}},{key:"toShortString",value:function(){return De.nth(this.floorIndex+1)}},{key:"toString",value:function(){return this.name}},{key:"setMaterial",value:function(e){var t,n;if(e)t=this.matPropName,n=[e];else{this.model.$app.core.get("Player").modeTran;t=this.matPropName=this.hidden?"stardard-hide":"stardard-show",n=this.chunks}var i=at.floorMat[t];n.forEach((function(e){for(var t in i)"renderOrder"==t?e.renderOrder=i[t]:"depthTest"==t||"depthWrite"==t||"transparent"==t?e.materialOutside[t]=i[t]:e.materialOutside.extraValues[t]=e.materialOutside.uniforms[t].value=i[t]}))}}]),n}();function Rt(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}var Mt=function(e){f(n,e);var t=Rt(n);function n(e){var i;return o(this,n),(i=t.call(this)).model=e,i.exploded=!1,i}return u(n,[{key:"add",value:function(e){Tt(w(n.prototype),"add",this).call(this,e),this.model.add(e)}},{key:"getIndex",value:function(e){return e.floorIndex}},{key:"build",value:function(){this.list.forEach((function(e){e.build()}))}},{key:"nextFloor",value:function(e,t){return this.index[e.floorIndex+t]||null}},{key:"getOrMakeFloor",value:function(e){var t=this.index[e];return t||(t=new Pt(this.model,e),this.add(t)),t}},{key:"hide",value:function(){this.list.forEach((function(e){e.hide()}))}},{key:"show",value:function(){this.list.forEach((function(e){e.show()}))}},{key:"getFloorAtPoint",value:function(e){for(var t=null,n=1/0,i=0;i<this.list.length;i++){var o=this.list[i],r=o.distanceToPoint(e);(!t||n>r)&&(n=r,t=o)}return t}}]),n}(It),St={vector:function(e,t,n){var i=e.clone();return t=t.clone(),function(o){e.set(i.x*(1-o)+t.x*o,i.y*(1-o)+t.y*o,i.z*(1-o)+t.z*o),n&&n(e,o)}},quaternion:function(e,t,n){var i=e.clone();return function(o){e.copy(i).slerp(t,o),n&&n(e,o)}},color:function(e,t,n){var i=e.clone();return function(o){e.copy(i).lerp(t,o),n&&n(e,o)}},property(e,t,n,i){var o=e[t];return function(r){e[t]=o*(1-r)+n*r,i&&i(e[t])}},uniform(e,t,n){var i=e.material.uniforms[t].value;return function(o){e.material.uniforms[t]&&(e.material.uniforms[t].value=i*(1-o)+n*o)}},matrix4(e,t){var n=e.clone();return function(i){for(var o=e.elements,r=n.elements,a=t.elements,s=0;s<16;s++)o[s]=r[s]*(1-i)+a[s]*i}},allUniforms(e,t,n){var i=e.map(function(e){return this.uniform(e,t,n)}.bind(this));return function(e){i.forEach((function(t){t(e)}))}}},Dt={PanoRenderComplete:"panorama.render.complete",TileRenderFailure:"panorama.tile.render.failed",TileRenderSuccess:"panorama.tile.render.success",TileUploadAttempted:"panorama.tile.upload.attempted",UploadAttemptedForAllTiles:"panorama.upload.attempted.all.tiles",ZoomLevelRenderStarted:"panorama.zoom.render.started"},Lt=0,Ft=1,Ht=2,Vt=3,Ot=4,Qt={LoadComplete:"panorama.load.complete",LoadFailed:"panorama.load.failed",TileLoaded:"panorama.tile.loaded"},_t=1,zt=2,Ut=3,Nt=4,Gt={uniforms:{map:{type:"t",value:null},opacity:{type:"f",value:1}},vertexShader:"varying vec3 vWorldPosition;\n\nvoid main() {\n vWorldPosition = position;\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}\n",fragmentShader:"uniform samplerCube map;\nuniform float opacity;\n\nvarying vec3 vWorldPosition;\n\nvoid main() {\n vec4 color = textureCube( map, vec3( -vWorldPosition.x, vWorldPosition.yz ) );\n gl_FragColor = vec4(color.rgb, opacity);\n}\n"},jt={uniforms:{panoPosition:{type:"v3",value:new THREE.Vector3}},vertexShader:"varying vec4 worldPosition;\n\nvoid main() {\n\n worldPosition = modelMatrix * vec4(position, 1.0);\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\n}\n",fragmentShader:"uniform vec3 panoPosition;\nvarying vec4 worldPosition;\n\nvoid main() {\n\n float depth = distance(worldPosition.xyz, panoPosition);\n float color = 1.0 - depth / 10.0;\n gl_FragColor = vec4(color, color, color, 1.0);\n\n}\n"},Wt={Common:"\n \n uniform vec4 iMouse;\n uniform vec2 iResolution;\n uniform sampler2D iChannel0; // bufferArray\n uniform sampler2D iChannel1; // 全景图\n uniform int iBrushType; // 笔刷类型(马赛克、高斯模糊、橡皮)\n uniform float iBrushSize;\n uniform float iAngle;\n uniform float iPitch;\n \n \n const float MAX_TRACE_DISTANCE = 3.0; // max trace distance\n const float INTERSECTION_PRECISION = 0.001; // precision of the intersection\n const int NUM_OF_TRACE_STEPS = 100;\n \n const float PI = 3.145;\n \n vec3 spCenter = vec3( 0.0 , 0.0 , -0.8 ); // 画笔中心偏移\n float spRad = 1.; // 值越大, 半径越小\n \n // camera视角变换矩阵,pitch绕x轴,roll绕z轴,angle绕y轴\n mat3 calcLookAtMatrix( in float angle, in float roll, in float pitch )\n {\n vec3 angleVec = vec3( cos(angle), sqrt(cos(angle)*cos(angle) + sin(angle)*sin(angle)) * tan(pitch), sin(angle) );\n vec3 rollVec = vec3( sin(roll), cos(roll), 0.0 );\n \n vec3 ww = normalize( angleVec );\n vec3 uu = normalize( cross(ww, rollVec) );\n vec3 vv = normalize( cross(ww, uu));\n return mat3( uu, vv, ww );\n }\n \n float posMap( vec3 pos ){\n return length(pos - spCenter) - spRad;\n }\n \n float calcIntersection( in vec3 spCenter, in vec3 rayDirec ){\n float h = INTERSECTION_PRECISION*2.0;\n float trace = 0.0;\n \n for( int i=0; i< NUM_OF_TRACE_STEPS ; i++ ){\n if( h < INTERSECTION_PRECISION || trace > MAX_TRACE_DISTANCE ) break;\n h = posMap( spCenter + rayDirec * trace );\n trace += h;\n }\n \n if( trace < MAX_TRACE_DISTANCE ) \n return trace;\n else \n return -1.0;\n }\n \n vec3 calcPoint(vec2 screenPoint, float angle, float pitch) {\n \n mat3 camMat = calcLookAtMatrix(angle, 0.0, pitch);\n vec3 rayDirec = normalize( camMat * vec3(screenPoint.xy, 1.4) ); // create view ray. 2.0 is the lens length\n \n float trace = calcIntersection(spCenter, rayDirec);\n vec3 point = spCenter + rayDirec * trace;\n return point;\n }\n \n // 抗锯齿 原理:给边缘一个透明渐变\n // edge0 向内渐变范围,edge1 向外渐变范围,x 和中心的距离\n float smootherstep(float edge0, float edge1, float x) {\n float t = (x - edge0)/(edge1 - edge0);\n float t1 = t*t*t*(t*(t*6. - 15.) + 10.);\n return clamp(t1, 0.0, 1.0);\n }\n //新版高斯模糊算法\n float weight(float t, float log2radius, float gamma)\n {\n return exp(-gamma * pow(log2radius - t, 2.0));\n }\n vec4 sample_blured(vec2 uv, float radius, float gamma) {\n vec4 pix = vec4(0.0);\n float norm = 0.0;\n for(float i = 0.0; i < 10.0; i += 0.5)\n {\n float k = weight(i, log2(radius), gamma);\n pix += k*texture2D(iChannel1, uv, i); \n norm += k;\n }\n return pix * pow(norm, -0.95);\n }\n\n \n // modelPaint有两个作用:根据鼠标位置显示笔刷、根据鼠标位置涂抹 (通过iIsBrush区分)\n vec4 modelPaint(vec2 uv, int iIsBrush)\n {\n vec2 mouse = (-iResolution.xy + 2.0*iMouse.xy)/iResolution.y;\n \n float hAngle = (uv.x * 2.0 + 0.5) * -PI * 0.9989; // uv在全景图边界处会有些许的错位,乘上0.9989则正常\n float vAngle = uv.y * PI;\n vec3 n = normalize( vec3(\n sin(vAngle) * sin(hAngle),\n -cos(vAngle),\n sin(vAngle) * cos(hAngle)\n ));\n vec3 wPos = spCenter + n * spRad; // 将uv坐标映射到三维上 \n vec3 point = calcPoint(mouse, iAngle, iPitch); // 将鼠标位置映射到三维上 \n\n float brushSize = iBrushSize / 100.; // 笔刷大小\n if(iIsBrush == 0) brushSize += 0.005; // 补偿黑边\n vec4 col;\n // 限制在brushSize范围内 && (按下鼠标 || 显示笔刷)\n if( length( point - wPos ) < brushSize && (iMouse.z > 0.0 || iIsBrush == 1))\n {\n // 涂抹\n if(iMouse.z > 0.0) {\n if(iBrushType == 2) {\n // 马赛克\n float mosaicAccuracy = 2. * iResolution.x / 1024.; // 马赛克精度\n vec2 pixelSize = mosaicAccuracy / iResolution.xy;\n vec2 fixedUV = uv + pixelSize;\n vec2 pxUV = floor(fixedUV/pixelSize)*pixelSize;\n col = texture2D(iChannel1, pxUV);\n } \n else if(iBrushType == 1) {\n // 旧版高斯模糊 在apple端会出现奇怪的边缘bug,原因不明,需要将出现bug的边缘进行裁剪。且在ios端模糊后rgb值偏高\n // const float Directions = 16.0;\n // const float Quality =5.0;\n // float Size = 20.0; // 模糊度\n // vec2 Radius = Size/iResolution.xy;\n // col = texture2D(iChannel1, uv);\n \n // for( float d=0.0; d < PI*2.; d += PI*2./Directions) {\n // for(float i = 1.0/Quality; i <= 1.0; i += 1.0/Quality) {\n //疑似texture2D方法中的uv参数不为原始uv就会出现边缘bug\n // col += texture2D(iChannel1, uv + vec2(cos(d), sin(d)) * Radius * i);\n // }\n // }\n // col /= (Quality * Directions - 16.0);\n\n //新版高斯模糊算法\n float strong = 0.45;\n float blur_radius = 50.0 * strong;\n \n vec2 uv_ = uv;\n #ifdef Not_Cube //xzw add\n uv_.x += 0.25;\n if(uv_.x > 1.0) uv_.x -= 1.0;\n #endif\n \n \n \n col = sample_blured(uv_, blur_radius, 0.5);\n // 对全景贴图进行模糊处理后全景贴图之间的接缝会较为明显,需要对全景贴图接缝进行处理\n float handlepixel = 10.0; //处理宽度\n if (uv_.x > 0.0 && uv_.x < handlepixel / iResolution.x) {\n float newuvx = 1.0 - uv_.x;\n vec3 mixColor = sample_blured(vec2(newuvx, uv_.y), blur_radius, 0.5).rgb;\n col.rgb = col.rgb * (uv_.x * iResolution.x / handlepixel) + mixColor * (1.0-uv_.x * iResolution.x / handlepixel);\n }\n //模糊处理后因为采样原因较原图有所提亮,需将rgb总体调低\n col.rgb *=0.95;\n } \n else {\n // 橡皮\n col = vec4(texture2D(iChannel0, uv).rgb, 0.);\n }\n\n // 边缘渐变\n // 这个shader在涂抹贴图和全景图的衔接处会存在黑边,原因不明。目前通过给黑边一个很小的透明度来规避这个问题。\n // 如果想显示黑边的话,注释掉去黑边的那行代码,然后把newAlpha改成1.。\n if(iBrushType != 0) {\n // 橡皮以外\n // float newAlpha = 1.;\n float newAlpha = min(max(1.-length(point-wPos)/brushSize, 0.) * 2., 1.); // 从内到外渐变消失\n if(length(point-wPos) - brushSize < 0. && length(point-wPos) - brushSize > -0.005){// 0.005去黑边\n if (texture2D(iChannel0, uv).a != 0.0) { //修复边缘bug\n col = texture2D(iChannel0, uv);\n col.a = 0.01;\n }\n newAlpha = 0.01;\n }\n col.a = newAlpha > texture2D(iChannel0, uv).a ? newAlpha : texture2D(iChannel0, uv).a; // 高alpha覆盖低alpha\n } else {\n // 橡皮柔软度\n float newAlpha = min(max(length(point-wPos)/brushSize-0.5, 0.) * (1./0.5), 1.); // 从外到内渐变消失\n if(length(point-wPos) - brushSize*.5 < 0.005 && length(point-wPos) - brushSize*.5 > 0.) newAlpha = 0.01; // 0.005去黑边\n col.a = newAlpha < texture2D(iChannel0, uv).a ? newAlpha : texture2D(iChannel0, uv).a; // 低alpha覆盖高alpha\n }\n }\n \n // 笔刷\n if(iIsBrush == 1) {\n if(iBrushType != 0) {\n col = vec4(1., 1., 1., 0.4); // 其他笔刷白色半透明\n } else {\n col = vec4(1., 1., 1., 0.); // 橡皮笔刷完全透明\n }\n\n // 笔刷边缘\n float ratio = 0.93; // 非边缘占brushSize的比率\n if(length(point-wPos)/brushSize > ratio) col = vec4(.9, .9, .9, 1.);\n // 外边缘抗锯齿\n float m0 = smootherstep(brushSize-0.002, brushSize+0.002, length(point - wPos));\n col = mix(col, vec4(0.), m0);\n if(length(point - wPos) <= brushSize*ratio+0.002) {\n // 内边缘抗锯齿\n float m1 = smootherstep(brushSize*ratio-0.002, brushSize*ratio+0.002, length(point - wPos));\n col = mix(col, vec4(.9, .9, .9, 1.), m1);\n }\n }\n \n } else if(iIsBrush == 0) {\n // brushSize范围外显示已有的涂抹 bufferTexture\n col = texture2D(iChannel0, uv);\n }\n \n return col;\n }\n \n ",Buffer:"\n \n varying vec2 vUv;\n \n void main()\n {\n vec2 uv = vUv;\n gl_FragColor = modelPaint(uv, 0);\n }\n "},qt={define:"\n #ifdef HasClip \n //裁剪模块\n varying vec3 vPos;\n uniform vec3 clipBoxPoints[clipBoxCount*4]; \n //4个vec3为一组(一个立方体)\n uniform int clipBoxType[clipBoxCount];\n //判断裁剪类型并记录有效数据 0为clipInside 1为clipOutSide -1为无效数据\n #endif\n \n #ifdef HasClip\n float inBox(vec3 P, vec3 C, vec3 G, vec3 O, vec3 A){\n return step(0.0,(sign(dot(O-A, P-A)) \n +sign(dot(A-O, P-O)) \n +sign(dot(P-O, C-O)) \n +sign(dot(O-C, P-C)) \n +sign(dot(G-O, P-O)) \n +sign(dot(P-G, O-G))\n - 5.0));\n }\n #endif\n \n ",main:"\n #ifdef HasClip\n float isClip = 0.0; \n //isClip用于标记是否需要裁剪, >0 将会被discard\n \n for(int i = 0; i < clipBoxCount; i++) {\n clipBoxType[i] == -1 ? \n isClip = isClip : \n clipBoxType[i] == 0 ?\n inBox(vPos, clipBoxPoints[i*4], clipBoxPoints[i*4+1], clipBoxPoints[i*4+2], clipBoxPoints[i*4+3]) == 1.0 ?\n isClip = 2.0 :\n isClip = isClip \n : isClip != 2.0 ? \n isClip != -1.0 && inBox(vPos, clipBoxPoints[i*4], clipBoxPoints[i*4+1], clipBoxPoints[i*4+2], clipBoxPoints[i*4+3]) == 0.0 ? isClip = 1.0 : isClip = -1.0 :\n isClip = 2.0;\n }\n \n if(isClip > 0.0) discard;\n #endif\n "},Jt={uniforms:{minOpa:{type:"f",value:.14},minDistance:{type:"f",value:2.5},maxDistance:{type:"f",value:4},map:{type:"t",value:null},repeatInfoMap:{type:"t",value:null},modelAlpha:{type:"f",value:at.modelAlpha},baseColor:{type:"v3",value:new THREE.Color(1,1,1)},opacity:{type:"f",value:1},progress:{type:"f",value:0},blackout:{type:"i",value:0},pano0Map:{type:"t",value:null},pano0Position:{type:"v3",value:new THREE.Vector3},pano0Matrix:{type:"m4",value:new THREE.Matrix4},pano1Map:{type:"t",value:null},pano1Position:{type:"v3",value:new THREE.Vector3},pano1Matrix:{type:"m4",value:new THREE.Matrix4},videoReady:{type:"",value:0},videoTexture:{type:"t",value:null},exposure:{type:"f",value:1},parameters:{type:"m4",value:(new THREE.Matrix4).set(4608,3456,8192,4096,1.95985,1.34,1739,2285,-.00173905,274835e-10,-.0340487,0,1235,954,2112,1584)},clipRect:{type:"v4",value:new THREE.Vector4(.1,.1,.5,.5)},blendFov:{type:"f",value:5},bFlag:{type:"i",value:1},paint1Map:{type:"t",value:null},paint0Map:{type:"t",value:null},iShowBrush:{type:"i",value:0},iMouse:{type:"v4",value:new THREE.Vector4},iResolution:{type:"v2",value:new THREE.Vector2},iChannel0:{type:"t",value:null},iChannel1:{type:"t",value:null},iBrushType:{type:"i",value:1},iBrushSize:{type:"f",value:null},iAngle:{type:"f",value:null},iPitch:{type:"f",value:null},filterBase0:{type:"v3",value:new THREE.Vector3(0,0,0)},filterTemperature0:{type:"f",value:0},filterBase1:{type:"v3",value:new THREE.Vector3(0,0,0)},filterTemperature1:{type:"f",value:0},clipBoxType:{type:"a",value:null},clipBoxPoints:{type:"a",value:null}},vertexShader:"\n\n uniform vec3 pano0Position;\n uniform mat4 pano0Matrix;\n \n uniform vec3 pano1Position;\n uniform mat4 pano1Matrix;\n\n #if defined(checkDistance)\n varying vec3 world_Position; \n #endif\n\n varying vec2 vUv;\n varying vec3 vWorldPosition0;\n varying vec3 vWorldPosition1;\n #ifdef HasClip\n //裁剪模块\n varying vec3 vPos;\n #endif\n \n void main() {\n \n vUv = uv;\n vec4 worldPosition = modelMatrix * vec4(position, 1.0);\n \n #if defined(checkDistance)\n world_Position = worldPosition.xyz; \n #endif\n \n vec3 positionLocalToPanoCenter0 = worldPosition.xyz - pano0Position;\n vWorldPosition0 = (vec4(positionLocalToPanoCenter0, 1.0) * pano0Matrix).xyz;\n vWorldPosition0.x *= -1.0;\n \n vec3 positionLocalToPanoCenter1 = worldPosition.xyz - pano1Position;\n vWorldPosition1 = (vec4(positionLocalToPanoCenter1, 1.0) * pano1Matrix).xyz;\n vWorldPosition1.x *= -1.0;\n \n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n #ifdef HasClip\n vPos = position;\n #endif\n }\n\n ",fragmentShader:"\n #ifdef HasPaint"+Wt.Common+"\n #endif\n\n #define PI 3.141592653 \n\n // #define Not_Cube_0 1\n // #define Not_Cube_1 1\n \n const vec4 BLACK=vec4(0.0,0.0,0.0,1.0);\n const vec4 GREY2=vec4(0.5,0.5,0.5,1.0); \n const vec4 GREY=vec4(0.23,0.23,0.23,1.0); //cadImg greyArea to cover model\n \n uniform sampler2D map;\n uniform float modelAlpha;\n uniform float opacity;\n uniform float progress;\n uniform int blackout;\n uniform vec3 pano0Position;\n uniform vec3 pano1Position;\n uniform float maxDistance;\n uniform float minDistance;\n uniform float minOpa;\n uniform int bFlag;\n uniform vec3 baseColor;\n \n uniform sampler2D paint1Map;\n uniform sampler2D paint0Map;\n uniform int iShowBrush;\n\n uniform vec3 filterBase0;\n uniform float filterTemperature0;\n uniform vec3 filterBase1;\n uniform float filterTemperature1;\n \n #if defined(HasVideo)\n uniform int videoReady;\n uniform sampler2D videoTexture;\n uniform float exposure;\n uniform mat4 parameters;\n uniform float blendFov;\n #endif\n "+qt.define+" \n \n //split Not_Cube defines\n #if defined(Not_Cube_0) \n uniform sampler2D pano0Map;\n #else\n uniform samplerCube pano0Map;\n #endif\n \n #if defined(Not_Cube_1) \n uniform sampler2D pano1Map;\n #else\n uniform samplerCube pano1Map;\n #endif\n \n \n \n #if defined(RepeatUV) \n uniform sampler2D repeatInfoMap;\n #endif\n \n \n varying vec2 vUv;\n varying vec3 vWorldPosition0;\n varying vec3 vWorldPosition1;\n\n #if defined(checkDistance)\n varying vec3 world_Position; \n #endif\n\n \n uniform vec4 clipRect;\n \n\n float linearStep( float start, float end, float value ) {\n\n return clamp( (value - start) / (end - start), 0.0, 1.0 );\n }\n\n vec2 getSamplerCoord( vec3 direction ) \n {\n direction = normalize(direction);\n float tx=atan(direction.x,direction.z)/(PI*2.0)+0.5; //经度角度\n float ty=acos(direction.y)/PI; //纬度角度\n\n return vec2(tx,ty);\n }\n\n // 从LinearEncoding转到sRGBEncoding\n // 参考:https://www.zhangxinxu.com/wordpress/2017/12/linear-rgb-srgb-js-convert/\n vec3 linearToSrgb(vec3 col){\n return mix(col*12.92, 1.055 * pow(col, vec3(0.41667)) - 0.055, step(0.0031308, col));\n }\n \n \n #if defined(HasVideo)\n\n #if (HasVideo == 8)\n \n float f42( float phi_undistorted )\n {\n return - 0.0497*phi_undistorted*phi_undistorted*phi_undistorted*phi_undistorted*phi_undistorted\n + 0.2548*phi_undistorted*phi_undistorted*phi_undistorted*phi_undistorted\n - 0.4303*phi_undistorted*phi_undistorted*phi_undistorted\n - 0.016 *phi_undistorted*phi_undistorted \n + 1.0068*phi_undistorted - 0.0004;\t\t \n }\n\n vec2 uv2CameraCoord( vec2 uv) \n {\n vec2 coor;\n coor.x = (uv.x* parameters[0][0] - parameters[0][3]) / parameters[2][3];\n coor.y = (uv.y* parameters[1][0] - parameters[1][3]) / parameters[3][3];\n return coor;\n }\n \n vec4 f44(sampler2D texture, vec2 dc)\n {\n \n float vm = parameters[0][0];\n float vb = parameters[1][0];\n float vy = parameters[2][0];\n float oh = parameters[3][0];\n\n float wa = parameters[0][1];\n float qa = parameters[1][1];\n float cx = parameters[2][1];\n float cy = parameters[3][1];\n \n float tx = parameters[0][2];\n float ty = parameters[1][2];\n float tz = parameters[2][2];\n \n\n \n float focal_final = wa * 1000.0 / qa;\n \n float ptIn_x = dc.x * vy;\n float ptIn_y = (1.0 - dc.y) * oh;\n \n float ptOut_x, ptOut_y;\n \n float size = vy > oh ? vy : oh;\n \n float camx, camy;\n \n camx = (ptIn_x - vy / 2.0) / size;\n camy = (ptIn_y - oh / 2.0) / size;\n \n float lon, lat;\n \n lon = camx * 2.0 * 3.1415926;\n lat = camy * 2.0 * 3.1415926;\n \n float zq, zw, zr;\n \n zq = 0.33 * tx + cos(lat) * sin(lon);\n zw = 0.33 * ty - sin(lat);\n zr = 0.33 * tz + cos(lat) * cos(lon); \n \n \n float theta = atan(-zw, zq);\n \n float al = atan( sqrt(zq * zq + zw * zw), zr);\n \n float x12, x13;\n \n float wea = f42(al);\n float r = focal_final * tan(wea);\n \n x12 = cx + r * cos(theta);\n x13 = cy - r * sin(theta);\n \n ptOut_x = x13 / vm;\n ptOut_y = x12 / vb;\n \n \n vec2 samplerCoord = vec2(ptOut_x, ptOut_y);\n\n #if VideoMapping == 1\n samplerCoord = uv2CameraCoord(samplerCoord);\n #endif\n\n vec2 samplerCoord_final;\n\n if(bFlag==0)\n {\n samplerCoord_final.x = samplerCoord.y;\n samplerCoord_final.y = 1.0 - samplerCoord.x;\n }\n else\n {\n samplerCoord_final.x = samplerCoord.x;\n samplerCoord_final.y = samplerCoord.y; \n }\n \n // 球幕视频翻转\n return texture2D(texture, samplerCoord_final);\n // return texture2D(texture, samplerCoord);\n \n }\n\n float smoothRect( vec4 clipRect, vec2 mixWidth, vec2 uv )\n {\n float x = clipRect.x < clipRect.z ? \n \n step( clipRect.x, uv.x ) * linearStep( clipRect.x, clipRect.x + mixWidth.x, uv.x ) *\n step( uv.x, clipRect.z ) * linearStep( clipRect.z, clipRect.z - mixWidth.x, uv.x ):\n \n step( clipRect.x, uv.x ) * step( uv.x, 1.0 ) * linearStep( clipRect.x, clipRect.x + mixWidth.x, uv.x ) + \n step( 0.0, uv.x ) * step( uv.x, clipRect.z ) * linearStep( clipRect.z, clipRect.z - mixWidth.x, uv.x );\n \n \n float y = step( clipRect.y, uv.y ) * linearStep( clipRect.y, clipRect.y + mixWidth.y, uv.y ) // from\n * step( uv.y, clipRect.w ) * linearStep( clipRect.w, clipRect.w - mixWidth.y, uv.y ); // to \n \n \n return x * y;\n }\n \n vec3 satEnhance( vec3 inputColor, float sat )\n {\n float R = inputColor.r * 255.0;\n float G = inputColor.g * 255.0;\n float B = inputColor.b * 255.0;\n \n float Y = 0.257 * R + 0.564 * G + 0.098 * B + 16.0;\n float Cb = -0.148 * R - 0.291 * G + 0.439 * B + 128.0;\n float Cr = 0.439 * R - 0.368 * G - 0.071 * B + 128.0;\n\n Cr = sat * (Cr - 128.0) + 128.0;\n Cb = sat * (Cb - 128.0) + 128.0; \n \n float newB = 1.164*(Y-16.0)+2.017*(Cb-128.0);\n float newR = 1.164*(Y-16.0)+1.596*(Cr-128.0);\n float newG = 1.164*(Y-16.0)-0.392*(Cb-128.0)-0.813*(Cr-128.0);\n \n newB /= 255.0;\n newR /= 255.0;\n newG /= 255.0;\n \n return vec3(newR, newG, newB); \n }\n\n\n #elif (HasVideo == 2)\n\n float f42( float phi )\n {\n return (-2.08836240e-05) * pow(phi, 9.0)\n + (-2.20461427e-04) * pow(phi, 8.0) \n + (-8.04183603e-03) * pow(phi, 7.0) \n + (3.95783387e-02) * pow(phi, 6.0)\n + (-6.51361598e-02) * pow(phi, 5.0)\n + (3.16523167e-02) * pow(phi, 4.0)\n + (-1.35220728e-02) * pow(phi, 3.0) \n + (3.86472740e-03) * pow(phi, 2.0)\n + (9.99717594e-01) * pow(phi, 1.0) \n + (3.98472625e-06) * pow(phi, 0.0);\t\t \n }\n\n vec2 uv2CameraCoord( vec2 uv) \n {\n vec2 coor;\n coor.x = (uv.x* parameters[0][0] - parameters[0][3]) / parameters[2][3];\n coor.y = (uv.y* parameters[1][0] - parameters[1][3]) / parameters[3][3];\n return coor;\n }\n \n vec4 f44(sampler2D texture, vec2 dc)\n {\n \n float iw = parameters[0][0]; //inputWidth\n float ih = parameters[1][0]; //inputHeight\n float ow = parameters[2][0]; //outputWidth\n float oh = parameters[3][0]; //outputHeight\n\n float wa = parameters[0][1]; //focal\n float qa = parameters[1][1]; //pixel\n float cx = parameters[2][1]; //cx\n float cy = parameters[3][1]; //cy\n \n float tx = parameters[0][2];\n float ty = parameters[1][2];\n float tz = parameters[2][2];\n \n\n \n float focal_final = wa * 1000.0 / qa;\n \n float ptIn_x = dc.x * ow;\n float ptIn_y = dc.y * oh;\n\n float ptOut_x, ptOut_y;\n \n float size = ow > oh ? ow : oh;\n\n float camx, camy;\n\n camx = (ptIn_x - ow / 2.0) / size;\n camy = (ptIn_y - oh / 2.0) / size;\n\n float lon, lat;\n\n lon = camx * 2.0 * 3.1415926;\n lat = -1.0 * camy * 2.0 * 3.1415926;\n\n float sphx, sphy, sphz;\n\n sphx = cos(lat) * sin(lon);\n sphy = -sin(lat);\n sphz = cos(lat) * cos(lon);\n\n float theta = atan(-sphy, sphx);\n\n float phi_undistorted = atan( sqrt(sphx * sphx + sphy * sphy), sphz);\n\n float phi_distorted = f42(phi_undistorted);\n float r = focal_final * phi_distorted;\n\n float du = cx + r * cos(theta);\n float dv = cy - r * sin(theta);\n \n ptOut_x = (du - 508.0) / 1984.0;\n ptOut_y = 1.0 - (dv - 508.0) / 1984.0;\n \n vec2 samplerCoord = vec2(ptOut_x, ptOut_y);\n \n \n return texture2D(texture, samplerCoord);\n \n }\n\n #elif (HasVideo == 3)\n \n float f42( float phi )\n {\n return (-1.47485770e-02) * pow(phi, 9.0)\n + (9.72111981e-02) * pow(phi, 8.0) \n + (-2.48315153e-01) * pow(phi, 7.0) \n + (3.20998529e-01) * pow(phi, 6.0)\n + (-2.46321067e-01) * pow(phi, 5.0)\n + (9.53838280e-02) * pow(phi, 4.0)\n + (-4.29416319e-02) * pow(phi, 3.0) \n + (1.84551397e-03) * pow(phi, 2.0)\n + (9.99948738e-01) * pow(phi, 1.0) \n + (5.00118946e-07) * pow(phi, 0.0);;\t\t \n }\n\n vec2 uv2CameraCoord( vec2 uv) \n {\n vec2 coor;\n coor.x = (uv.x* parameters[0][0] - parameters[0][3]) / parameters[2][3];\n coor.y = (uv.y* parameters[1][0] - parameters[1][3]) / parameters[3][3];\n return coor;\n }\n \n vec4 f44(sampler2D texture, vec2 dc)\n {\n \n float vm = parameters[0][0];\n float vb = parameters[1][0];\n float vy = parameters[2][0];\n float oh = parameters[3][0];\n\n float wa = parameters[0][1];\n float qa = parameters[1][1];\n float cx = parameters[2][1];\n float cy = parameters[3][1];\n \n float tx = parameters[0][2];\n float ty = parameters[1][2];\n float tz = parameters[2][2];\n \n\n \n float focal_final = wa;\n \n float ptIn_x = dc.x * vy;\n float ptIn_y = (1.0 - dc.y) * oh;\n \n float ptOut_x, ptOut_y;\n \n float size = vy > oh ? vy : oh;\n \n float camx, camy;\n \n camx = (ptIn_x - vy / 2.0) / size;\n camy = (ptIn_y - oh / 2.0) / size;\n \n float lon, lat;\n \n lon = camx * 2.0 * 3.1415926;\n lat = camy * 2.0 * 3.1415926;\n \n float sphx, sphy, sphz;\n \n sphx = cos(lat) * sin(lon);\n sphy = - sin(lat);\n sphz = cos(lat) * cos(lon); \n\n\n //apply rz to video stitch\n\n float r00 = cos(tz);\n float r01 = -1.0 * sin(tz);\n float r02 = 0.0;\n\n float r10 = sin(tz);\n float r11 = cos(tz);\n float r12 = 0.0;\n\n float r20 = 0.0;\n float r21 = 0.0;\n float r22 = 1.0;\n\n float zq, zw, zr;\n\n zq = r00*sphx + r01*sphy + r02*sphz;\n zw = r10*sphx + r11*sphy + r12*sphz;\n zr = r20*sphx + r21*sphy + r22*sphz;\n\n\n float theta = atan(-zw, zq);\n \n float al = atan( sqrt(zq * zq + zw * zw), zr);\n \n float x12, x13;\n \n float wea = f42(al);\n float r = focal_final * (wea);\n \n x12 = cx + r * cos(theta);\n x13 = cy - r * sin(theta);\n \n ptOut_x = x13 / vm;\n ptOut_y = x12 / vb;\n \n \n vec2 samplerCoord = vec2(ptOut_x, ptOut_y);\n\n #if VideoMapping == 1\n samplerCoord = uv2CameraCoord(samplerCoord);\n #endif\n \n samplerCoord.x = 1.0 - samplerCoord.x;\n samplerCoord.y = 1.0 - samplerCoord.y;\n\n vec2 samplerCoord_final;\n\n if(bFlag==0)\n {\n samplerCoord_final.x = 1.0 - samplerCoord.y;\n samplerCoord_final.y = samplerCoord.x;\n }\n else\n {\n samplerCoord_final.x = samplerCoord.x;\n samplerCoord_final.y = samplerCoord.y; \n }\n\n return texture2D(texture, samplerCoord_final);\n // return texture2D(texture, samplerCoord);\n }\n\n float smoothRect( vec4 clipRect, vec2 mixWidth, vec2 uv )\n {\n float x = clipRect.x < clipRect.z ? \n \n step( clipRect.x, uv.x ) * linearStep( clipRect.x, clipRect.x + mixWidth.x, uv.x ) *\n step( uv.x, clipRect.z ) * linearStep( clipRect.z, clipRect.z - mixWidth.x, uv.x ):\n \n step( clipRect.x, uv.x ) * step( uv.x, 1.0 ) * linearStep( clipRect.x, clipRect.x + mixWidth.x, uv.x ) + \n step( 0.0, uv.x ) * step( uv.x, clipRect.z ) * linearStep( clipRect.z, clipRect.z - mixWidth.x, uv.x );\n \n \n float y = step( clipRect.y, uv.y ) * linearStep( clipRect.y, clipRect.y + mixWidth.y, uv.y ) // from\n * step( uv.y, clipRect.w ) * linearStep( clipRect.w, clipRect.w - mixWidth.y, uv.y ); // to \n \n \n return x * y;\n }\n\n vec3 satEnhance( vec3 inputColor, float sat )\n {\n float R = inputColor.r * 255.0;\n float G = inputColor.g * 255.0;\n float B = inputColor.b * 255.0;\n \n float Y = 0.257 * R + 0.564 * G + 0.098 * B + 16.0;\n float Cb = -0.148 * R - 0.291 * G + 0.439 * B + 128.0;\n float Cr = 0.439 * R - 0.368 * G - 0.071 * B + 128.0;\n\n Cr = sat * (Cr - 128.0) + 128.0;\n Cb = sat * (Cb - 128.0) + 128.0; \n \n float newB = 1.164*(Y-16.0)+2.017*(Cb-128.0);\n float newR = 1.164*(Y-16.0)+1.596*(Cr-128.0);\n float newG = 1.164*(Y-16.0)-0.392*(Cb-128.0)-0.813*(Cr-128.0);\n \n newB /= 255.0;\n newR /= 255.0;\n newG /= 255.0;\n \n return vec3(newR, newG, newB); \n }\n\n vec3 conAdjust( vec3 inputColor, float alpha )\n {\n float R = inputColor.r * 255.0;\n float G = inputColor.g * 255.0;\n float B = inputColor.b * 255.0;\n\n float newB = alpha * (B - 0.5) + 0.5;\n float newG = alpha * (G - 0.5) + 0.5;\n float newR = alpha * (R - 0.5) + 0.5;\n\n newB /= 255.0;\n newR /= 255.0;\n newG /= 255.0;\n\n return vec3(newR, newG, newB); \n }\n\n\n #endif\n\n \n\n #endif\n\n\n #if defined(RepeatUV) \n float getUV(float num, float cellSize, float mul){ \n float index = floor(num / cellSize); //第index隔间\n float start = index * cellSize; //区间起始\n float delta = num - start; //相比起始的增量\n float delta_mul = delta * mul; //放大后的增量 \n delta_mul = delta_mul - cellSize * floor(delta_mul / cellSize); //求余。 最终需要的增加量,但是不能超过该区间,所以多出来的要缩减,repeat\n \n return start + delta_mul;\n }\n float round(float num){\n float intPart = floor(num);\n if(num - intPart < 0.5)return intPart;\n else return intPart+1.0;\n } \n #endif\n\n ////////////////////////////////////////////////////////////////\n // 使用HasPaint、hasFilter的原因:减少需要运行的shader代码,优化gpu\n\n // 涂抹\n #ifdef HasPaint\n // 将涂抹贴图贴到全景图上 colorFromPano:全景图,paintMap:涂抹贴图\n vec4 paint(vec4 colorFromPano, sampler2D paintMap, vec3 vWorldPosition) {\n // uv修正\n vec2 sphereUv = getSamplerCoord(vWorldPosition.xyz);\n sphereUv.y = 1. - sphereUv.y;\n sphereUv.x -= 0.25; //全景图和Cube的水平采样起始坐标相差90度,这里矫正 0.25 个采样偏移\n if(sphereUv.x < 0.) sphereUv.x += 1.;\n \n vec4 colBuffer = texture2D(paintMap, sphereUv);\n\n return vec4(colBuffer.rgb * colBuffer.a + colorFromPano.rgb * (1. - colBuffer.a), 1.);\n }\n #endif\n\n ////////////////////////////////////////////////////////////////\n // 滤镜(算法来自shadertoy)\n #ifdef hasFilter\n // 调整亮度[-1, 1]\n vec4 colorBrightness(vec4 color, float brightness) {\n brightness = clamp(brightness, -1., 1.);\n if(brightness < 0.) brightness = brightness/2.;\n return color * (brightness + 1.);\n }\n\n // 调整对比度[-1, 1]\n vec4 colorContrast(vec4 color, float contrast) {\n contrast = clamp(contrast, -1., 1.);\n // return mix(color, vec4(1.0) / (vec4(1.0) + exp(-(color * 10.0 - 5.0))), -contrast);\n return mix(color, smoothstep(0.0, 1.0, color), contrast);\n }\n\n // 调整饱和度[-1, 1]\n vec4 colorSaturation(vec4 color, float saturation) {\n saturation = clamp(saturation, -1., 1.);\n vec3 weights = vec3(0.2125, 0.7154, 0.0721);\n float luminance = dot(color.rgb, weights);\n return mix(vec4(luminance), color, saturation + 1.);\n }\n\n vec3 colorTemperatureToRGB(const in float temperature){\n mat3 m = (temperature <= 6500.0) ? \n mat3(vec3(0.0, -2902.1955373783176, -8257.7997278925690),\n vec3(0.0, 1669.5803561666639, 2575.2827530017594),\n vec3(1.0, 1.3302673723350029, 1.8993753891711275)) : \n mat3(vec3(1745.0425298314172, 1216.6168361476490, -8257.7997278925690),\n vec3(-2666.3474220535695, -2173.1012343082230, 2575.2827530017594),\n vec3(0.55995389139931482, 0.70381203140554553, 1.8993753891711275)); \n return mix(clamp(vec3(m[0] / (vec3(clamp(temperature, 4000.0, 9000.0)) + m[1]) + m[2]), vec3(0.0), vec3(1.0)), vec3(1.0), smoothstep(4000.0, 0.0, temperature));\n }\n // 调整色温[-1, 1]\n vec4 colorTemperature(vec4 color, float temperature) {\n temperature = clamp(temperature, -1., 1.);\n const float LuminancePreservationFactor = 1.0;\n float temperatureFactor;\n float temperatureStrength;\n if(temperature > 0.) {\n temperatureFactor = 4000.0;\n temperatureStrength = mix(0., 1.5, abs(temperature));\n } else {\n temperatureFactor = 9000.0;\n temperatureStrength = mix(0., 2.3, abs(temperature));\n }\n vec3 inColor = color.rgb;\n vec3 outColor = mix(inColor, inColor * colorTemperatureToRGB(temperatureFactor), temperatureStrength); \n // WithQuickAndDirtyLuminancePreservation\n outColor *= mix(1.0, dot(inColor, vec3(0.2126, 0.7152, 0.0722)) / max(dot(outColor, vec3(0.2126, 0.7152, 0.0722)), 1e-5), LuminancePreservationFactor); \n return vec4(outColor, color.a);\n }\n\n // 把滤镜效果融入全景图 colorFromPano:全景图,filterBase:亮度(x)、对比度(y)、饱和度(z),filterTemperature:色温\n vec4 filter(vec4 colorFromPano, vec3 filterBase, float filterTemperature) {\n colorFromPano = colorBrightness(colorFromPano, filterBase.x);\n colorFromPano = colorContrast(colorFromPano, filterBase.y);\n colorFromPano = colorSaturation(colorFromPano, filterBase.z);\n colorFromPano = colorTemperature(colorFromPano, filterTemperature);\n return colorFromPano;\n }\n #endif\n\n\n \n \n void main()\n {\n "+qt.main+" \n vec4 colorFromPano0 = vec4(0.0,0.0,0.0,0.0);\n #if defined(usePanoMap0)\n //即progress < 1.0 通常是1 \n #if (defined(Not_Cube_0) || defined(HasVideo)) \n vec2 samplerCoord0 = getSamplerCoord(vWorldPosition0.xyz); \n #endif \n \n \n #if defined(Not_Cube_0)\n colorFromPano0=texture2D(pano0Map,samplerCoord0); \n #else\n colorFromPano0=textureCube(pano0Map,vWorldPosition0.xyz); \n #endif\n #endif \n \n \n #if (defined(Not_Cube_1) || defined(HasVideo)) \n vec2 samplerCoord1 = getSamplerCoord(vWorldPosition1.xyz); \n #endif \n \n\n #ifdef BasePanoMap\n //普通贴图当做全景图\n vec4 colorFromPano1 = texture2D(map, vUv);\n #ifdef HasVideo\n samplerCoord1.x -= 0.25; \n #endif\n #else \n #if defined(Not_Cube_1)\n vec4 colorFromPano1=texture2D(pano1Map,samplerCoord1); \n #else\n vec4 colorFromPano1=textureCube(pano1Map,vWorldPosition1.xyz); \n #ifdef HasVideo\n samplerCoord1.x -= 0.25; //全景图和Cube的水平采样起始坐标相差90度,这里矫正 0.25 个采样偏移\n #endif\n #endif\n #endif\n\n\n #ifdef HasPaint\n // 涂抹图层(目前涂抹图层要先于球幕视频图层执行,所以会被球幕视频挡住)\n colorFromPano0 = paint(colorFromPano0, paint0Map, vWorldPosition0);\n colorFromPano1 = paint(colorFromPano1, paint1Map, vWorldPosition1);\n #endif\n\n \n // 球幕视频\n #if defined(HasVideo)\n\n vec4 colorFromVideo = vec4(0.0,0.0,0.0,0.0);\n \n #if HasVideo == 8\n\n colorFromVideo = f44(videoTexture, samplerCoord1);\n colorFromVideo.rgb *= exposure;\n\n vec2 transitionSize = 80.0 / vec2( 4096.0, 2048.0 );\n\n \n #if VideoMapping == 0\n float alpha = linearStep(0.3, 0.33, samplerCoord1.x) * 1.0 - linearStep(0.66, 0.7, samplerCoord1.x);\n colorFromPano1 = mix(colorFromPano1, colorFromVideo, alpha * float(videoReady));\n #elif VideoMapping == 1\n\n \n float rect = smoothRect( vec4(\n 0.4166, 0.2833,\n 0.5833, 0.7133\n ), vec2( blendFov / 360.0, blendFov / 180.0 ), samplerCoord1 );\n\n colorFromPano1 = mix(colorFromPano1, colorFromVideo, rect * float(videoReady) * max(0.0,progress*2.0-1.0));\n \n #elif VideoMapping == 2\n\n samplerCoord1 = fract(samplerCoord1);\n\n vec2 clipUV = vec2(\n clipRect.x < clipRect.z ? linearStep( clipRect.x, clipRect.z, samplerCoord1.x ) : linearStep( clipRect.x, clipRect.z + 1.0, samplerCoord1.x < clipRect.z ? samplerCoord1.x + 1.0 : samplerCoord1.x ),\n linearStep( clipRect.y, clipRect.w, samplerCoord1.y )\n );\n clipUV.y = 1.0- clipUV.y;\n\n colorFromVideo = texture2D( videoTexture, clipUV );\n float rect = smoothRect( clipRect, vec2(0.02,0.02), samplerCoord1 );\n\n \n colorFromPano1 = mix( colorFromPano1, colorFromVideo, rect * float(videoReady) * max(0.0,progress*2.0-1.0) );\n\n #endif\n\n #elif HasVideo == 2\n\n colorFromVideo = f44(videoTexture, samplerCoord1);\n float alphaX = linearStep( 0.31, 0.33, samplerCoord1.x) * 1.0 - linearStep(0.65, 0.67, samplerCoord1.x);\n float alphaY = linearStep( 0.15, 0.17, 1.0 - samplerCoord1.y) * 1.0 - linearStep(0.82, 0.84, 1.0 - samplerCoord1.y);\n colorFromPano1 = mix(colorFromPano1, colorFromVideo, alphaX * alphaY * float(videoReady) * max(0.0,progress*2.0-1.0));\t\n\n #elif HasVideo == 3\n\n float cx = parameters[2][1]; //cx\n float cy = parameters[3][1]; //cy\n\n float diffx = (cx - 1824.0) / 16416.0;\n float diffy = (cy - 2736.0) / 7576.0;\n\n colorFromVideo = f44(videoTexture, samplerCoord1);\n colorFromVideo.rgb *= exposure;\n \n\n vec2 transitionSize = 80.0 / vec2( 4096.0, 2048.0 );\n\n \n #if VideoMapping == 0\n float alpha = linearStep(0.3, 0.33, samplerCoord1.x) * 1.0 - linearStep(0.66, 0.7, samplerCoord1.x);\n colorFromPano1 = mix(colorFromPano1, colorFromVideo, alpha * float(videoReady));\n #elif VideoMapping == 1\n \n float rect = smoothRect( vec4(\n 0.4277-diffx, 0.28-diffy,\n 0.572-diffx, 0.72-diffy\n ), vec2( blendFov / 360.0, blendFov / 180.0 ), samplerCoord1 );\n\n colorFromPano1 = mix(colorFromPano1, colorFromVideo, rect * float(videoReady) * max(0.0,progress*2.0-1.0));\n \n #elif VideoMapping == 2\n\n samplerCoord1 = fract(samplerCoord1);\n\n vec2 clipUV = vec2(\n clipRect.x < clipRect.z ? linearStep( clipRect.x, clipRect.z, samplerCoord1.x ) : linearStep( clipRect.x, clipRect.z + 1.0, samplerCoord1.x < clipRect.z ? samplerCoord1.x + 1.0 : samplerCoord1.x ),\n linearStep( clipRect.y, clipRect.w, samplerCoord1.y )\n );\n clipUV.y = 1.0- clipUV.y;\n\n colorFromVideo = texture2D( videoTexture, clipUV );\n\n \n float rect = smoothRect( clipRect, vec2(0.02,0.02), samplerCoord1 );\n\n \n colorFromPano1 = mix( colorFromPano1, colorFromVideo, rect * float(videoReady) * max(0.0,progress*2.0-1.0) );\n\n #endif\n\n #endif\n\n #endif\n\n\n #ifdef hasFilter\n // 滤镜\n colorFromPano0 = filter(colorFromPano0, filterBase0, filterTemperature0);\n colorFromPano1 = filter(colorFromPano1, filterBase1, filterTemperature1);\n #endif\n\n\n\n\n // 合并colorFromPano0和colorFromPano1\n vec4 color; \n \n if(blackout==0)\n { \n #if defined(usePanoMap0) \n color=mix(colorFromPano0,colorFromPano1,progress);\n #else\n color = colorFromPano1;\n #endif \n \n }\n else if(blackout==1)\n {\n color=mix(colorFromPano0,BLACK,min(1.0,progress*2.0));\n color=mix(color,colorFromPano1,max(0.0,progress*2.0-1.0));\n }\n else if(blackout==2)\n {\n color=mix(colorFromPano0,BLACK,progress);\n }\n else if(blackout==3)\n {\n color=mix(BLACK,colorFromPano1,max(0.0,progress*2.0-1.0));\n }\n \n \n \n vec2 uv = vUv;\n \n #if defined(RepeatUV) \n \n vec4 infoColor = texture2D(repeatInfoMap, vUv); \n float mul = round(infoColor.r * 255.0 / 5.0) + round(infoColor.g * 255.0 / 5.0) / 10.0; \n \n if(mul>0.0 && mul != 1.0){\n float cellCount = 8.0; \n \n float cellSize = 1.0 / cellCount;\n float dir = round(infoColor.b * 255.0 / 5.0);\n if (dir == 0.0) {\n uv.x = getUV(uv.x, cellSize, mul) ;\n }else if (dir == 1.0) {\n uv.y = getUV(uv.y, cellSize, mul) ; \n }else{\n uv.x = getUV(uv.x, cellSize, mul) ;\n uv.y = getUV(uv.y, cellSize, mul) ;\n } \n }\n \n #endif\n \n \n #if defined(useModelMap) \n // 合并color和modelColor\n vec4 colorFromTexture = texture2D(map,uv);\n #ifdef Is3dTiles\n // 3dtiles贴图需要用linearToSrgb转到Srgb色彩空间\n colorFromTexture = vec4(linearToSrgb(colorFromTexture.rgb), colorFromTexture.a);\n #endif\n color = mix(color, colorFromTexture, modelAlpha); \n #endif\n\n\n\n float whiteness = 1.0-smoothstep(0.1, 1.0, opacity); \n color = mix(color, GREY, whiteness ); \n \n float opa = opacity;\n #if defined(checkDistance)\n vec3 cameraPos = mix(pano0Position, pano1Position, progress);\n float dis = distance(cameraPos, world_Position);\n float disOpa=minOpa;\n if(dis < minDistance)\n {\n disOpa=1.0;\n }\n else if(dis<maxDistance)\n {\n float k=(minOpa-1.0)/(maxDistance-minDistance);\n disOpa=k*dis+1.0-k*minDistance;\n } \n float whiteness2 = 1.0-smoothstep(0.1,0.2,disOpa); \n color = mix(color, GREY2, whiteness2); \n opa *= disOpa;\n \n #endif\n \n\n\n #ifdef HasPaint\n // 笔刷\n if(iShowBrush == 1) {\n vec2 sphereUv = getSamplerCoord(vWorldPosition1.xyz);\n sphereUv.y = 1. - sphereUv.y;\n sphereUv.x -= 0.25; //全景图和Cube的水平采样起始坐标相差90度,这里矫正 0.25 个采样偏移\n if(sphereUv.x < 0.) sphereUv.x += 1.;\n vec4 brushBuffer = modelPaint(sphereUv, 1);\n if(brushBuffer.a > 0.) {\n color = vec4(brushBuffer.rgb * brushBuffer.a + color.rgb * (1. - brushBuffer.a), 1.);\n } \n }\n #endif\n \n\n\n\n gl_FragColor = vec4(color.rgb * baseColor, opa);\n \n \n \n }\n ",fragmentBufferShader:Wt.Common+Wt.Buffer},Yt={uniforms:{map:{type:"t",value:null},modelAlpha:{type:"f",value:at.modelAlpha},depthmapRatio:{type:"f",value:0},opacity:{type:"f",value:1},progress:{type:"f",value:0},considerOcclusion:{type:"i",value:at.fancierTransition},highlightPanoSelection:{type:"i",value:0},useThirdPano:{type:"i",value:at.useThirdPano},pano0Map:{type:"t",value:null},pano0Depth:{type:"t",value:null},pano0Position:{type:"v3",value:new THREE.Vector3},pano0Matrix:{type:"m4",value:new THREE.Matrix4},pano0Weight:{type:"f",value:at.transition.pano0Weight},pano1Map:{type:"t",value:null},pano1Depth:{type:"t",value:null},pano1Position:{type:"v3",value:new THREE.Vector3},pano1Matrix:{type:"m4",value:new THREE.Matrix4},pano1Weight:{type:"f",value:at.transition.pano1Weight},pano2Map:{type:"t",value:null},pano2Depth:{type:"t",value:null},pano2Position:{type:"v3",value:new THREE.Vector3},pano2Matrix:{type:"m4",value:new THREE.Matrix4},pano2Weight:{type:"f",value:at.transition.pano2Weight}},vertexShader:"uniform vec3 pano0Position;\nuniform mat4 pano0Matrix;\n\nuniform vec3 pano1Position;\nuniform mat4 pano1Matrix;\n\nuniform vec3 pano2Position;\nuniform mat4 pano2Matrix;\n\nvarying vec2 vUv;\nvarying vec3 vWorldPosition0;\nvarying vec3 vWorldPosition1;\nvarying vec3 vWorldPosition2;\n\nvarying vec4 worldPosition;\n\nvoid main() {\n\n vUv = uv;\n worldPosition = modelMatrix * vec4(position, 1.0);\n\n vec3 positionLocalToPanoCenter0 = worldPosition.xyz - pano0Position;\n vWorldPosition0 = (vec4(positionLocalToPanoCenter0, 1.0) * pano0Matrix).xyz;\n vWorldPosition0.x *= -1.0;\n\n vec3 positionLocalToPanoCenter1 = worldPosition.xyz - pano1Position;\n vWorldPosition1 = (vec4(positionLocalToPanoCenter1, 1.0) * pano1Matrix).xyz;\n vWorldPosition1.x *= -1.0;\n\n vec3 positionLocalToPanoCenter2 = worldPosition.xyz - pano2Position;\n vWorldPosition2 = (vec4(positionLocalToPanoCenter2, 2.0) * pano2Matrix).xyz;\n vWorldPosition2.x *= -1.0;\n\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\n}\n",fragmentShader:"uniform sampler2D map;\nuniform float depthmapRatio;\nuniform float modelAlpha;\nuniform float opacity;\nuniform float progress;\nuniform int considerOcclusion;\nuniform int highlightPanoSelection;\nuniform int useThirdPano;\n\nuniform vec3 pano0Position;\nuniform samplerCube pano0Map;\nuniform samplerCube pano0Depth;\nuniform float pano0Weight;\n\nuniform vec3 pano1Position;\nuniform samplerCube pano1Map;\nuniform samplerCube pano1Depth;\nuniform float pano1Weight;\n\nuniform vec3 pano2Position;\nuniform samplerCube pano2Map;\nuniform samplerCube pano2Depth;\nuniform float pano2Weight;\n\nvarying vec2 vUv;\nvarying vec3 vWorldPosition0;\nvarying vec3 vWorldPosition1;\nvarying vec3 vWorldPosition2;\n\nvarying vec4 worldPosition;\n\nvoid main() {\n\n vec4 depthFromPano0 = textureCube( pano0Depth, vWorldPosition0.xyz );\n vec4 depthFromPano1 = textureCube( pano1Depth, vWorldPosition1.xyz );\n vec4 depthFromPano2 = textureCube( pano2Depth, vWorldPosition2.xyz );\n\n vec4 colorFromPano0 = textureCube( pano0Map, vWorldPosition0.xyz );\n vec4 colorFromPano1 = textureCube( pano1Map, vWorldPosition1.xyz );\n vec4 colorFromPano2 = textureCube( pano2Map, vWorldPosition2.xyz );\n\n float distanceToPano0 = distance(worldPosition.xyz, pano0Position);\n float distanceToPano1 = distance(worldPosition.xyz, pano1Position);\n float distanceToPano2 = distance(worldPosition.xyz, pano2Position);\n\n float cameraToPano0 = distance(cameraPosition.xyz, pano0Position);\n float cameraToPano1 = distance(cameraPosition.xyz, pano1Position);\n float cameraToPano2 = distance(cameraPosition.xyz, pano2Position);\n\n float contributionFromPano0 = cameraToPano0 == 0.0 ? 1000.0 : pano0Weight / cameraToPano0;\n float contributionFromPano1 = cameraToPano1 == 0.0 ? 1000.0 : pano1Weight / cameraToPano1;\n float contributionFromPano2 = cameraToPano2 == 0.0 ? 1000.0 : pano2Weight / cameraToPano2;\n\n contributionFromPano0 *= 1.0 / distanceToPano0;\n contributionFromPano1 *= 1.0 / distanceToPano1;\n contributionFromPano2 *= 1.0 / distanceToPano2;\n\n if(considerOcclusion == 1) {\n bool occludedFromPano0 = distanceToPano0 / 10.0 > 1.01 - depthFromPano0.x;\n bool occludedFromPano1 = distanceToPano1 / 10.0 > 1.01 - depthFromPano1.x;\n bool occludedFromPano2 = distanceToPano2 / 10.0 > 1.01 - depthFromPano2.x;\n\n if(occludedFromPano0){contributionFromPano0 *= 0.1;}\n if(occludedFromPano1){contributionFromPano1 *= 0.1;}\n if(occludedFromPano2){contributionFromPano2 *= 0.1;}\n //if(occludedFromPano0 && occludedFromPano1 && !occludedFromPano2) { contributionFromPano2 += 0.5; }\n }\n\n float contributionSum = contributionFromPano0 + contributionFromPano1 + contributionFromPano2;\n contributionFromPano0 /= contributionSum;\n contributionFromPano1 /= contributionSum;\n contributionFromPano2 /= contributionSum;\n\n vec4 colorFromPanos = colorFromPano0 * contributionFromPano0;\n colorFromPanos += colorFromPano1 * contributionFromPano1;\n colorFromPanos += colorFromPano2 * contributionFromPano2;\n\n vec4 depthFromPanos = depthFromPano0 * contributionFromPano0;\n depthFromPanos += depthFromPano1 * contributionFromPano1;\n depthFromPanos += depthFromPano2 * contributionFromPano2;\n\n vec4 colorFromTexture = texture2D( map, vUv );\n colorFromPanos = mix(colorFromPanos, colorFromTexture, modelAlpha);\n\n if(highlightPanoSelection == 1) {\n colorFromPanos.r = contributionFromPano0;\n colorFromPanos.g = contributionFromPano1;\n colorFromPanos.b = contributionFromPano2;\n }\n\n gl_FragColor = vec4(mix(colorFromPanos, depthFromPanos, depthmapRatio).rgb, opacity);\n\n}\n"},Zt={uniforms:{map:{type:"t",value:null},opacity:{type:"f",value:1},brightness:{type:"f",value:.23},mixRatio:{type:"f",value:.3},clipBoxType:{type:"a",value:null},clipBoxPoints:{type:"a",value:null}},vertexShader:"\n varying vec2 vUv;\n #ifdef HasClip \n //裁剪模块\n varying vec3 vPos; \n #endif\n\n void main() {\n vUv = uv;\n #ifdef HasClip\n vPos = position;\n #endif\n\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n }",fragmentShader:"\n uniform sampler2D map;\n uniform float opacity;\n varying vec2 vUv;\n uniform float brightness;\n uniform float mixRatio;\n "+qt.define+" \n \n //vec4 grey = vec4(0.23, 0.23, 0.23, 1.0); //cadImg greyArea to cover model, base color\n \n vec4 grey = vec4(brightness, brightness, brightness, 1.0); \n \n // 从LinearEncoding转到sRGBEncoding\n vec3 linearToSrgb(vec3 col){\n return mix(col*12.92, 1.055 * pow(col, vec3(0.41667)) - 0.055, step(0.0031308, col));\n }\n \n \n void main() {\n "+qt.main+" \n vec2 uv = vUv; \n vec4 colorFromTexture = texture2D( map, uv ); \n #ifdef Is3dTiles\n // 3dtiles贴图需要用linearToSrgb转到Srgb色彩空间\n colorFromTexture = vec4(linearToSrgb(colorFromTexture.rgb), colorFromTexture.a);\n #endif\n \n colorFromTexture = mix(colorFromTexture, grey, mixRatio ); \n gl_FragColor = vec4(colorFromTexture.rgb, opacity);\n }\n "},Xt={uniforms:{map:{type:"t",value:null},opacity:{type:"f",value:1},color:{type:"c",value:new THREE.Color(at.path.color)}},vertexShader:"varying vec2 vUv;\nvarying vec3 vN;\nvarying vec4 vP;\n\nvoid main() {\n\n vUv = uv;\n vN= normalMatrix * normal;\n vP = modelViewMatrix * vec4( position, 1.0 );\n gl_Position = projectionMatrix * vP;\n}\n",fragmentShader:"uniform sampler2D map;\nuniform float opacity;\nvarying vec2 vUv;\nuniform vec3 color;\nvarying vec3 vN; // show-1182\nvarying vec4 vP; // show-1182\n\nvoid main() {\n\t// TODO add scroll-in and pulsing behaviors\n\tvec3 vNn = normalize(vN);\n\tvec3 vPn = normalize(vP.xyz);\n\tfloat f = pow(1.0-abs(dot(vNn,vPn)),0.2);\n vec4 colorFromTexture = texture2D( map, vUv );\n colorFromTexture.a *= f;\n gl_FragColor = vec4((color.rgb*colorFromTexture.rgb),\n \t\t\t\t\t\t(opacity*colorFromTexture.a));\n}\n"},Kt={uniforms:{radius:{type:"f",value:0}},vertexShader:"varying vec4 worldPosition;\n\nvoid main() {\n\n worldPosition = modelMatrix * vec4(position, 1.0);\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\n}\n",fragmentShader:"varying vec4 worldPosition;\nuniform float radius;\n\nvoid main() {\n\n vec4 topColor = vec4(0.094, 0.102, 0.11, 1.0);\n vec4 bottomColor = vec4(0.2, 0.216, 0.235, 1.0);\n float normalizedHeight = (worldPosition.y + radius) / (radius * 2.0);\n float ratio = smoothstep(0.0, 0.5, normalizedHeight);\n gl_FragColor = mix(bottomColor, topColor, ratio);\n\n}\n"},$t={uniforms:{opacity:{type:"f",value:0},color:{type:"c",value:new THREE.Color},bg:{type:"t",value:null},mask:{type:"t",value:null}},vertexShader:"varying vec2 vUv;\nvoid main() {\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n}",fragmentShader:"uniform float opacity;\nuniform vec3 color;\nuniform sampler2D bg;\nuniform sampler2D mask;\n\nvarying vec2 vUv;\n\nvoid main() {\n vec4 maskColor = texture2D(mask, vUv);\n vec4 bgColor = texture2D(bg, vUv);\n vec3 mappedColor = mix(bgColor.rgb, color, maskColor.a);\n gl_FragColor = vec4(mappedColor, bgColor.a * opacity);\n}\n"},en={uniforms:{uTime:{value:0},opacity:{value:1},dark:{type:"i",value:0},openning:{type:"f",value:0},uColor:{value:(new THREE.Color).setRGB(0,.7843137254901961,.6862745098039216)}},vertexShader:"\n\n uniform float uTime;\n uniform float openning;\n\n varying vec2 vUv;\n \n\n vec3 scalePos( vec3 pos ) {\n\n float s = 1.0 + 0.3 * abs( sin(uTime) ) ;\n\n pos.x *= s;\n pos.y *= s;\n pos.z *= s;\n\n return pos;\n }\n\n void main() \n {\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4( scalePos( position ), 1.0);\n }\n\n ",fragmentShader:"\n \n uniform float uTime;\n uniform vec3 uColor;\n uniform float opacity;\n uniform int dark;\n \n varying vec2 vUv;\n \n vec4 circle( vec2 position, vec2 center, float radius )\n {\n vec4 backgroundColor = vec4( 0.0, 0.0, 0.0, 0.0 );\n\n vec4 color = mix( backgroundColor, vec4(uColor, 1.0 ), smoothstep( radius + 0.05, radius, length( position - center )) );\n \n return color;\n }\n\n\n vec4 ring( vec2 position, vec2 center, vec2 radius )\n {\n \n float len = length( position - center );\n\n float alpha = smoothstep( radius.x - 0.03, radius.x + 0.01, len) - smoothstep(radius.y - 0.03, radius.y + 0.03, len);\n\n return mix( vec4( 0.0 ), vec4( 1.0 ), alpha);\n }\n\n\n\n void main() {\n\n\n vec2 uv = vUv * 2.0 - 1.0;\n\n //uv *= (0.85 + abs( sin(uTime) * 0.5 ));\n\n \n vec4 mainColor = vec4( 0.0 );\n mainColor += circle( uv, vec2(0.0), 0.4 );\n mainColor += ring( uv, vec2(0.0), vec2(0.3, 0.35));\n\n \n float r = (uv.x * uv.x + uv.y * uv.y) * 4.0;\n \n float intensity = sin( r - uTime * 2.5 );\n float alpha = 1.0 - 0.25* r;\n\n intensity = intensity * step(r, 3.5 ) * step(1.0, r);\t\n intensity = smoothstep( 0.9, 1.0, intensity );\n\n mainColor += vec4( vec3(intensity), intensity * alpha);\n \n \n \n gl_FragColor = vec4(mainColor.rgb, mainColor.a * opacity);\n \n }\n "},tn={uniforms:{opacity:{type:"f",value:1},dark:{type:"i",value:0},map:{type:"t",value:null},uTime:{value:0},openning:{type:"f",value:0}},vertexShader:"\n\n uniform float openning;\n uniform float uTime;\n\n varying vec2 vUv;\n\n vec3 scalePos( vec3 pos ) {\n\n float s = cos(openning * 3.1415926*0.28) * (1.0 + 0.3 * abs( sin(uTime)) * step( openning, 0.5 ) );\n\n pos.x *= s;\n pos.y *= s;\n pos.z *= s;\n\n return pos;\n }\n\n \n \n void main() \n {\n vUv = uv;\n\n gl_Position = projectionMatrix * viewMatrix * modelMatrix * vec4( scalePos(position), 1.0);\n }\n \n ",fragmentShader:"\n\n uniform float opacity;\n uniform int dark;\n uniform float uTime;\n uniform sampler2D map;\n uniform float openning;\n \n varying vec2 vUv;\n \n\n vec4 circle( vec2 position, vec2 center, float radius, vec4 color )\n {\n vec4 backgroundColor = vec4( 0.0 );\n \n float alpha = smoothstep( radius + 0.03, radius - 0.03, length( position - center ));\n\n return mix( backgroundColor, color, alpha );\n }\n\n vec4 ring( vec2 position, vec2 center, vec2 radius, vec4 color )\n {\n vec4 backgroundColor = vec4( 0.0, 0.0, 0.0, 0.0);\n \n float len = length( position - center );\n \n float alpha = smoothstep( radius.x - 0.03, radius.x + 0.03, len) - smoothstep(radius.y - 0.03, radius.y + 0.03, len);\n \n return mix( backgroundColor, color, alpha);\n }\n\n void main() {\n\n vec2 uv = vUv;\n\n vec4 color = texture2D(map, uv);\n \n if(dark == 1 && (color.r + color.g + color.b < 240.0*3.0/255.0))\n {\n color.rgb *= 0.9;\n }\n\n\n vec2 coord = uv * 2.0 - 1.0;\n vec4 opennedColor = vec4(0.0);\n\n opennedColor += circle( coord, vec2(0.0), 0.25, vec4(1.0, 1.0, 1.0, 0.5) );\n opennedColor += circle( coord, vec2(0.0), 0.5, vec4(1.0, 1.0, 1.0, 0.3) );\n\n color = mix( color, opennedColor, openning );\n \n gl_FragColor = vec4(color.rgb, color.a * opacity);\n }\n\n "},nn={uniforms:{progress:{type:"f",value:0},bigCircleProgress:{type:"f",value:0},smallCircleProgress:{type:"f",value:0},map:{type:"t",value:null},map0:{type:"t",value:null},map1:{type:"t",value:null},map2:{type:"t",value:null},opacity:{type:"f",value:0}},vertexShader:"\n\n // uniform float openning;\n // uniform float uTime;\n\n varying vec2 vUv;\n\n void main() \n {\n vUv = uv;\n gl_Position = projectionMatrix * viewMatrix * modelMatrix * vec4(position, 1.0);\n }\n \n ",fragmentShader:"\n\n // uniform float opacity;\n // uniform int dark;\n // uniform float uTime;\n // uniform sampler2D map;\n // uniform float openning;\n \n // varying vec2 vUv;\n \n\n // vec4 circle( vec2 position, vec2 center, float radius, vec4 color )\n // {\n // vec4 backgroundColor = vec4( 0.0 );\n \n // float alpha = smoothstep( radius + 0.03, radius - 0.03, length( position - center ));\n\n // return mix( backgroundColor, color, alpha );\n // }\n\n // vec4 ring( vec2 position, vec2 center, vec2 radius, vec4 color )\n // {\n // vec4 backgroundColor = vec4( 0.0, 0.0, 0.0, 0.0);\n \n // float len = length( position - center );\n \n // float alpha = smoothstep( radius.x - 0.03, radius.x + 0.03, len) - smoothstep(radius.y - 0.03, radius.y + 0.03, len);\n \n // return mix( backgroundColor, color, alpha);\n // }\n\n // void main() {\n\n // vec2 uv = vUv;\n\n // vec4 color = texture2D(map, uv);\n \n // if(dark == 1 && (color.r + color.g + color.b < 240.0*3.0/255.0))\n // {\n // color.rgb *= 0.9;\n // }\n\n\n // vec2 coord = uv * 2.0 - 1.0;\n // vec4 opennedColor = vec4(0.0);\n\n // opennedColor += circle( coord, vec2(0.0), 0.25, vec4(1.0, 1.0, 1.0, 0.5) );\n // opennedColor += circle( coord, vec2(0.0), 0.5, vec4(1.0, 1.0, 1.0, 0.3) );\n\n // color = mix( color, opennedColor, openning );\n \n // gl_FragColor = vec4(color.rgb, color.a * opacity);\n // //gl_FragColor = vec4( 0.86, 0.078, 0.2353, 1.0);\n // }\n\n //xst add\n //从min1-max1缩放到min2-max2,value本来是min1-max1范围内的,相应的返回对应的值\n float linearClamp(float value, float min1,float max1,float min2,float max2){\n return min2 + (value - min1) * (max2 - min2)/(max1 - min1);\n }\n\n /* vec4 ring( vec2 position, vec2 center, float minRadius, float maxRadius, vec4 color, vec4 backgroundColor)\n {\n float len = length( position - center );\n if(len>minRadius && len < maxRadius){\n return color;\n }\n else{\n return backgroundColor;\n }\n } */\n\n \n\n /* bool sameside(vec2 uv, vec3 A, vec3 B, vec3 C) //permet d'indiquer de quel coté d'une ligne on se trouve (0 ou 1)\n {\n vec3 u = vec3(uv.x,uv.y,0.0);\n vec3 valuexy = cross(B-A,C-A);\n vec3 valuexz = cross(B-A,u-A);\n \n if(dot(valuexy,valuexz)>=0.){return true;}\n else{return false;} \n }\n \n bool inTriangle(vec2 uv,vec3 v[3]) // permet d'indiquer si on se trouve bien a l'intérieur d'un triangle (3 ligne)\n {\n if(sameside(uv,v[0],v[1],v[2]) && sameside(uv,v[1],v[2],v[0]) && sameside(uv,v[2],v[0],v[1])){return true;}\n else{return false;}\n \n } */\n\n \n\n //放大,从radius放大到maxRadius\n /* vec2 zoomUV2(vec2 vuv,float radius,float maxRadius){\n vec2 dis = vuv - vec2(0.5);\n float len = length(dis);\n\n float step = maxRadius/radius;\n if(len < radius ){\n return vec2(0.5 + dis.x/step,0.5 + dis.y/step);\n }\n else{\n return vuv; \n }\n } */\n\n uniform float bigCircleProgress;\n uniform sampler2D map;\n varying vec2 vUv;\n \n \n vec4 noRepeat(sampler2D sampler, vec2 uv){\t\t\t\t\t \n vec4 color;\n if(uv.x<0.0) \t color = vec4(0.0, 0.0, 0.0, 0.0) ;\n else if(uv.x>1.0) color = vec4(0.0, 0.0, 0.0, 0.0) ;\n else if(uv.y<0.0) color = vec4(0.0, 0.0, 0.0, 0.0) ;\n else if(uv.y>1.0) color = vec4(0.0, 0.0, 0.0, 0.0) ;\t\n else color = texture2D(sampler, uv);\n return color ;\t\t\n }\n //缩小,把maxRadius缩小到radius\n vec2 zoomInUV(vec2 vuv,float radius,float maxRadius){\n vec2 dis = vuv - vec2(0.5);\n float len = length(dis);\n \n float step = radius/maxRadius;\n if(len < maxRadius ){\n return vec2(0.5 + dis.x/step,0.5 + dis.y/step);\n }\n else{\n return vuv; \n }\n }\n \n float circle(vec2 vuv, float radius){\n vec2 dis = vuv - vec2(0.5);\n float len = length(dis);\n float w = abs(len - radius);\n \n if(w < 0.015 ){//画圈圈,有效的\n return 2.0; \n }else if(w < 0.03){\n return 1.0 - (w-0.015) / (0.03-0.015); //边缘模糊抗锯齿\n }else if(len<radius){\n return -1.0;\n }else if(len>radius){\n return -2.0;\n }\n }\n \n \n void main() {\n\n vec2 uv = vUv;\n\n float sTime = 0.26;\n float mTime = 0.48;\n float eTime = 0.8;\n\n\n float mTime2 = 0.57; \n\n float lineWidth = 0.02;\n float outerRadius = 0.4;\n float extendRadius = 0.5;\n float outerRadius2;\n \n vec2 center = vec2(0.5);\n \n //float innerRadius = 0.3; //三角形所在半径\n\n\n\n\n //贴图缩小\n \n\n float flag;\n //开始的时候是静止的\n if(bigCircleProgress<sTime){\n flag = circle( uv, outerRadius); \n }else{\n //圈圈放大\n if(bigCircleProgress<mTime){\n \n outerRadius2 = outerRadius + smoothstep(0.0, mTime-sTime, bigCircleProgress-sTime ) * (extendRadius - outerRadius - lineWidth) ;\n \n //outerRadius2 = outerRadius + linearClamp(bigCircleProgress-sTime, 0.0, mTime-sTime,0.0, extendRadius - outerRadius - lineWidth);\n //flag = circle( uv, outerRadius + linearClamp(bigCircleProgress-sTime, 0.0, mTime-sTime,0.0, extendRadius - outerRadius - lineWidth));\n flag = circle( uv, outerRadius2); \n }\n //圈圈缩小\n else if(bigCircleProgress<eTime){ \n \n outerRadius2 = extendRadius - lineWidth - smoothstep(0.0, eTime-mTime, bigCircleProgress-mTime ) * (extendRadius - outerRadius - lineWidth) ;\n \n //outerRadius2 = extendRadius - lineWidth - linearClamp(bigCircleProgress-mTime, 0.0, eTime-mTime, 0.0, extendRadius - outerRadius - lineWidth);\n flag = circle( uv, outerRadius2); \n \n if(bigCircleProgress<mTime2){ \n outerRadius = outerRadius + smoothstep(0.0, mTime2-mTime, bigCircleProgress-mTime ) * (extendRadius - outerRadius - lineWidth) ;\n \n }else{\n outerRadius = extendRadius - lineWidth - smoothstep(0.0, eTime-mTime2, bigCircleProgress-mTime2 ) * (extendRadius - outerRadius - lineWidth) ;\n }\n \n } \n else{//恢复正常\n flag = circle( uv, outerRadius); \n } \n }\n \n \n\n if(flag == 2.0){//在圈圈上\n gl_FragColor = vec4( 1.0, 1.0, 1.0, 1.0);\n }else if(flag == -2.0){//大于圈圈的\n gl_FragColor = vec4(1.0, 1.0, 1.0, 0.0);\n }else if(flag<=1.0 && flag>=0.0){ //圈边缘模糊抗锯齿\n gl_FragColor = vec4(1.0, 1.0, 1.0, flag);\n }else if(flag == -1.0){//圈内 \n vec2 zoomuv = zoomInUV(uv, outerRadius,extendRadius);\n gl_FragColor = noRepeat(map, zoomuv); \n } \n }\n\n "},on={uniforms:{map:{type:"t",value:null},opacity:{type:"f",value:1},pulse:{type:"f",value:1},nearFade:{type:"v2",value:new THREE.Vector2(2*at.insideNear,2*at.path.waypointIndoorRadius)},color:{type:"c",value:new THREE.Color("#fff")}},vertexShader:"varying vec2 vUv;\nvarying vec4 vPointView;\n\nvoid main() {\n\n vUv = uv;\n vPointView = modelViewMatrix * vec4( position, 1.0 );\n gl_Position = projectionMatrix * vPointView;\n\n}\n",fragmentShader:"uniform sampler2D map;\nuniform float opacity;\nuniform float pulse; // another opacity, with a different clock\nuniform vec2 nearFade;\nvarying vec2 vUv;\nvarying vec4 vPointView;\nuniform vec3 color;\n\nvoid main() {\n\t// TODO add scroll-in and pulsing behaviors\n\tfloat depthFade = min(1.0, (abs(vPointView.z)-nearFade.x)/(nearFade.y-nearFade.x));\n vec4 colorFromTexture = texture2D( map, vUv );\t\t// we only use the alpha!\n gl_FragColor = vec4(color.rgb,\n \t\t\t\t\t\t(pulse*opacity*colorFromTexture.a * depthFade));\n}\n"},rn={uniforms:{opacity:{type:"f",value:1},pano1Map:{type:"t",value:null},pano1Matrix:{type:"m4",value:new THREE.Matrix4}},vertexShader:"uniform mat4 pano1Matrix;varying vec3 vWorldPosition;void main(){vWorldPosition=(vec4(position,1.0)*pano1Matrix).xyz;gl_Position=projectionMatrix*modelViewMatrix*vec4(position,1.0);}",fragmentShader:"uniform float opacity;varying vec3 vWorldPosition;\n#define PI 3.141592653 \n\n#if defined(Not_Cube)\nuniform sampler2D pano1Map;vec4 texCubemapWith2D(sampler2D t,vec3 dir){dir=normalize(dir);float tx=atan(dir.x,dir.z)/(PI*2.0)+0.5;float ty=acos(dir.y)/PI;vec4 color=texture2D(t,vec2(tx,ty));return color;}\n#else\nuniform samplerCube pano1Map;\n#endif\nvoid main(){\n#if defined(Not_Cube)\nvec4 colorFromPanos=texCubemapWith2D(pano1Map,vec3(-1.0*vWorldPosition.x,vWorldPosition.yz));\n#else\nvec4 colorFromPanos=textureCube(pano1Map,vec3(-1.0*vWorldPosition.x,vWorldPosition.yz));\n#endif\ngl_FragColor=vec4(colorFromPanos.rgb,opacity);}"},an={uniforms:{uColor:{type:"vec4",value:null},uTime:{type:"f",value:0}},vertexShader:"\n \n varying vec2 vUv;\n \n void main() \n {\n vUv = uv;\n \n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n }\n\n ",fragmentShader:"\n \n #define PI2 6.2831852 \n\n uniform vec4 uColor;\n uniform float uTime;\n\n varying vec2 vUv;\n\n float lerp( float a, float b, float alpha ) \n {\n return a + (b -a ) * alpha;\n }\n\n vec4 ring( vec2 uv, vec2 radius )\n {\n float len = length( uv );\n float angle = atan( uv.y, uv.x );\n float opacity = 0.7;\n \n float progress = fract( uTime / 4000.0 );\n\n float step1 = step( 0.0, progress );\n float step2 = step( 0.25, progress );\n float step3 = step( 0.75, progress );\n\n float progressStep1 = smoothstep( 0.0, 0.25, progress );\n float progressStep2 = smoothstep( 0.25, 1.0, progress );\n \n radius *= progressStep1 * step1;\n opacity *= (1.0 - smoothstep( 0.7, 1.0, progress ));\n\n float alpha = smoothstep( radius.x - 0.01, radius.x, len ) - smoothstep( radius.y, radius.y + 0.01, len );\n \n float speed = step2 * ( progressStep2 * 20.0 );\n\n float period = floor(30.0 - 29.0 * progressStep2);\n \n float interval = lerp( 0.0, 0.012, 1.0- progressStep2 );\n \n float dashed = smoothstep( interval * period, interval * period, fract( period * angle / PI2 + speed ) )\n - smoothstep( 1.0 - interval * period, 1.0 - interval * period , fract( period * angle / PI2 + speed ) );\n \n alpha *= dashed;\n \n return mix( vec4(0.0), vec4(1.0, 1.0, 1.0, opacity), alpha );\n }\n\n\n void main()\n {\n\n vec2 uv = vUv * 2.0 - 1.0;\n\n vec4 mainColor = vec4(0);\n\n mainColor += ring(uv, vec2(0.2, 0.22));\t\t\n \n gl_FragColor = mainColor;\n }\n "},sn={uniforms:{opacity:{type:"f",value:1},dark:{type:"i",value:0},map:{type:"t",value:null},position:{value:new THREE.Vector3(0,0,0)}},vertexShader:"\n\n varying vec2 vUv;\n\n\n void main() \n {\n vUv = uv;\n\n vec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0);\n\n vec2 scale;\n scale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) );\n scale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) );\n scale *= mvPosition.z * 0.5;\n\n vec2 alignedPosition = position.xy * scale;\n\n mvPosition.xy += alignedPosition;\n\n gl_Position = projectionMatrix * mvPosition;\n\n }\n ",fragmentShader:"\n \n uniform float opacity;\n uniform int dark;\n uniform sampler2D map;\n \n \n varying vec2 vUv;\n \n void main()\n {\n\n vec4 color = texture2D(map, vUv); \n\n if( dark == 1 && (color.r + color.g + color.b < 240.0*3.0/255.0))\n {\n color.rgb *= 0.9;\n } \n\n gl_FragColor = vec4(color.rgb, color.a * opacity);\n }\n \n "},ln={uniforms:{progress:{type:"f",value:0},bigCircleProgress:{type:"f",value:0},smallCircleProgress:{type:"f",value:0},map:{type:"t",value:null},opacity:{type:"f",value:0}},vertexShader:" \n varying vec2 vUv; \n /* vec2 Scale(vec2 vuv, float scale){\n scale = 1.0/scale; \n vuv.x=(uv.x-0.5) * scale + 0.5; \n vuv.y=(uv.y-0.5) * scale + 0.5 ; \n return vuv ; \t\t\t\t\t \t\t\n } */\t\n\n void main(){ \n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n \n }\n\n ",fragmentShader:"\n \n uniform sampler2D map;\n uniform float opacity; \n uniform float bigCircleProgress;\n uniform float smallCircleProgress;\n vec4 noRepeat(sampler2D sampler, vec2 uv){\t\t\t\t\t \n vec4 color;\n if(uv.x<0.0) \t color = vec4(0.0, 0.0, 0.0, 0.0) ;\n else if(uv.x>1.0) color = vec4(0.0, 0.0, 0.0, 0.0) ;\n else if(uv.y<0.0) color = vec4(0.0, 0.0, 0.0, 0.0) ;\n else if(uv.y>1.0) color = vec4(0.0, 0.0, 0.0, 0.0) ;\t\n else color = texture2D(sampler, uv);\n return color ;\t\t\n }\n vec4 mixColor(vec4 downColor,vec4 upColor){\n return vec4(upColor.rgb * upColor.a + (1.0 - upColor.a) * downColor.rgb, upColor.a+downColor.a);//下层的分量通过上层的a来决定,暂时这么设置\n /* vec4 sum = downColor + upColor; \n if(sum.a == 0.0){\n \treturn sum;\n }\n float upPct = upColor.a / sum.a;\n float downPct = downColor.a / sum.a; \n return vec4(upColor.rgb * upPct + downColor.rgb * downPct , sum.a ); */\n }\n\n float drawMinCircle(vec2 vuv, float minR){\n vec2 dis = vuv - vec2(0.5);\n float len = length(dis);\n float w = abs(len - minR);\n \n if(w < 0.01 ){//画圈圈,有效的\n return 1.0; \n }else if(w < 0.03){\n return 1.0 - (w-0.01) / (0.03-0.01); //边缘模糊抗锯齿\n }else if(len < minR){\n return 2.0; //圈圈内的情况\n }else{\n return 0.0; //透明 ,不考虑\n }\n }\n \n float drawCircle(vec2 vuv, float maxR,float minR){\n vec2 dis = vuv - vec2(0.5);\n float len = length(dis);\n if(abs(len - maxR) < 0.04 ){//画圈圈,有效的\n return len; \n }\n else if(len < maxR && len > minR){\n return 1.0; //minR到maxR之间的区域\n }\n else{\n return 2.0; //透明 ,不考虑\n }\n }\n \n vec2 Scale(vec2 vuv, float scale){\n scale = 1.0/scale; \n vec2 uv;\n uv.x=(vuv.x-0.5) * scale + 0.5; \n uv.y=(vuv.y-0.5) * scale + 0.5 ; \n return uv ; \t\t\t\t\t \t\t\n }\t\n \n varying vec2 vUv; varying vec2 vUv1; varying vec2 vUv2; \n void main(){ \n //xst添加\n \n float vtime2 = 0.08; //收缩结束时间\n float vtime22 = 0.24; //开始扩散时间\n float vtime32 = 0.51; //结束扩散时间\n float vtime3 = 0.56; //开始渐变出外圈的时间\n float vtime4 = 1.0; //结束时间\n \n float minRadius = 0.32 ; //内圈外围的半径\n float progress1 = bigCircleProgress - vtime22; //外圈进度,bigCircleProgress:0-1\n float progress2 = smallCircleProgress - vtime22; //内圈进度,smallCircleProgress:-0.2-1.5\n \n vec2 dis = vUv - vec2(0.5);\n float len = length(dis);\n \n if(bigCircleProgress>vtime3 || len < minRadius){//静止 \n gl_FragColor = noRepeat(map, vUv); \n if(bigCircleProgress > vtime3 && bigCircleProgress < vtime4 && len > minRadius){ //结尾逐渐显示外圈\n gl_FragColor.a *= (bigCircleProgress - vtime3) / (vtime4 - vtime3);\n }\n }else if(bigCircleProgress<vtime2 ){ //开始缩小外圈 \n float progress = bigCircleProgress / vtime2 ; \n float minScale = 0.7; float maxScale = 1.0;\n vec2 uv = Scale(vUv, maxScale*(1.0-progress)+minScale*progress);\n \n vec4 color = noRepeat(map, uv); \n /* if( color.a != 0.0){//变淡\n color.a = color.a * (1.0 - progress * 1.0/vtime2);\n } */\n float w = abs(len - minRadius); //交界处抗锯齿过渡\n if(w < 0.04){\n color.a *= w / 0.04;\n } \n gl_FragColor = color; \n }else if(bigCircleProgress>vtime22 && bigCircleProgress < vtime32){//扩大波纹\n \n float maxRadius = minRadius + 0.58*progress1; //大一些,先扩大,progress1的范围:0-0.5\n float midRadius = minRadius + 0.58*progress2; //小一些,后扩大,progress2的范围:-0.2-1.5,比progress1多了点,这一点要在后面处理掉\n \n float value = drawMinCircle(vUv, minRadius);\n if(value == 0.0){ //圈圈外\n value = drawCircle(vUv, midRadius,minRadius); //1.0表示midRadius到minRadius之间的区域,2.0表示其他区域,其他值表示midRadius上的\n if(value == 1.0){ //内圈和最里面的圈圈中间,透明\n //gl_FragColor = vec4( 1.0, 1.0, 1.0, 0.0); \n }\n else if(value != 2.0){ //内圈附近,需要渐变\n gl_FragColor = vec4( 1.0, 1.0, 1.0, ((value - midRadius) * 20.0+0.2) * (bigCircleProgress - vtime32) / (vtime22 - vtime32)); \n \n }\n else { //内圈的外部\n value = drawCircle(vUv, maxRadius,midRadius); \n if(value == 1.0){ //中间透明\n //gl_FragColor = vec4( 1.0, 1.0, 1.0, 0.0); \n }\n else if(value != 2.0){ //外圈附近,需要渐变\n gl_FragColor = vec4( 1.0, 1.0, 1.0, ((value - maxRadius) * 20.0+0.2) * (bigCircleProgress - vtime32) / (vtime22 - vtime32)); \n }\n else{ \n gl_FragColor = vec4( 1.0, 1.0, 1.0, 0.0); //透明\n }\n }\n \n }\n /* else if(value == 1.0){\n //gl_FragColor = vec4( 1.0, 1.0, 1.0, 1.0); //白色\n }\n else if(value == 2.0){\n gl_FragColor = vec4( 1.0, 1.0, 1.0, 0.0); //圈圈内透明\n }\n else{//渐变模糊,抗锯齿\n gl_FragColor = vec4( 1.0, 1.0, 1.0, value); \n } */\n\n /* //处理多于progress1的部分\n if(progress2 > vtime2){\n vec4 color = noRepeat(map, vUv);\n gl_FragColor = color;\n gl_FragColor.a = gl_FragColor.a * (progress2-vtime2)*2.0;\n } */\n }\n gl_FragColor.a *= opacity;\n }\n \n "},cn={uniforms:{progress:{type:"f",value:0},bigCircleProgress:{type:"f",value:0},smallCircleProgress:{type:"f",value:0},map:{type:"t",value:null},map0:{type:"t",value:null},map1:{type:"t",value:null},map2:{type:"t",value:null},opacity:{type:"f",value:0}},vertexShader:"\n\n varying vec2 vUv;\n void main() \n {\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n }\n\n ",fragmentShader:"\n \n uniform float bigCircleProgress;\n varying vec2 vUv;\n\n //从min1-max1缩放到min2-max2,value本来是min1-max1范围内的,相应的返回对应的值\n float linearClamp(float value, float min1,float max1,float min2,float max2){\n return min2 + (value - min1) * (max2 - min2)/(max1 - min1);\n }\n\n void main()\n {\n // if(vUv.y > 0.3){\n // gl_FragColor = vec4( 0.86, 0.078, 0.2353, 1.0);\n // } \n // else{\n // gl_FragColor = vec4( 1.0, 1.0, 1.0, 1.0);\n // }\n //gl_FragColor = vec4( 1.0, 1.0, 1.0, 1.0);\n //gl_FragColor = vec4( vPoint.x, vPoint.y, vPoint.z, 1.0);\n \n float vtime = 0.2; //持续时间 但不一定是秒\n float step = 1.0/vtime;\n float len = 0.5;\n\n if(bigCircleProgress<vtime){\n if(vUv.y < bigCircleProgress*step ){\n float v = linearClamp(vUv.y, bigCircleProgress*step - len,bigCircleProgress*step,0.0,1.0);\n gl_FragColor = vec4( 1.0, 1.0, 1.0, v);\n //if(bigCircleProgress*step > len && vUv.y < bigCircleProgress*step - len){\n if(vUv.y < bigCircleProgress*step - len){\n gl_FragColor.a = 0.0;\n }\n }\n } \n else{\n gl_FragColor.a = 0.0;\n }\n }\n "},un={uniforms:{activeProgress:{type:"f",value:0},mapIn:{type:"t",value:null},mapOut:{type:"t",value:null},mapOut2:{type:"t",value:null},opacity:{type:"f",value:0},changeMap:{type:"i",value:0}},vertexShader:" \n varying vec2 vUv; \n void main() \n { \n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n }\n\t\t",fragmentShader:"\n varying vec2 vUv; \n uniform sampler2D mapOut; \n uniform sampler2D mapOut2;\n uniform sampler2D mapIn; \n uniform float opacity;\n //uniform int isActive; \n \n uniform float activeProgress;\n \n uniform int changeMap; //是否有mapIn贴图,有的话就是中间要换成mapIn\n \n const float x1=0.2333, x2=0.76669, y1=0.388, y2=0.9333; \n const vec4 sumColor = vec4(1.24,1.24,1.24,2.0);//用于中心部分反转黑白的颜色\n \n \n \n vec4 getColor_default(vec4 mapColor, vec4 mapColor2, int where,vec2 vUvInside ,vec4 white){\n vec4 color;\n if(where == 1){\n color = vec4(1.0,1.0,1.0,mapColor.a);\n }else{\n\n if(changeMap == 1){ \n if(where == 2){\n vec4 color0 = texture2D(mapIn,vUvInside);\n if(mapColor2.r==1.0){color = color0;}\n else color = mix(white, color0, mapColor2.r);//平滑1的内边缘 \n } \n else color = mapColor;\n }else{ \n if(where == 2){ \n vec4 color0 = sumColor-mapColor; \n if(mapColor2.r==1.0){color = color0;}\n else{\n color = mix(white, color0, mapColor2.r);//平滑1的内边缘 \n float c = (color.x + color.y + color.z) / 3.0;//去红边,改为灰色 \n color = vec4(c,c,c,1.0); \n }\n } \n else color = mapColor; \n }\n } \n return color;\n }\n \n vec4 getColor_hovered(vec4 mapColor, vec4 mapColor2, int where,vec2 vUvInside ,vec4 green){\n vec4 color;\n if(changeMap == 1){\n if(where == 2){\n vec4 color0 = texture2D(mapIn,vUvInside);\n if(mapColor2.r==1.0){color = color0;}\n else color = mix(green, color0, mapColor2.r);//平滑内边缘 \n }\n else if(mapColor.a>0.0 && mapColor.a<1.0) color = green; //因为开启了抗锯齿,导致外边缘有点问题,所以自己绘制\n else color = mapColor;\n }else{ \n color = mapColor; \n }\n return color;\n }\n \n \n \n \n void main(){ \n \n vec4 mapColor = texture2D(mapOut,vUv);\n vec4 mapColor2 = texture2D(mapOut2,vUv);//用于分区的贴图 \n vec2 vUvInside = vec2((vUv.x-x1)/(x2-x1), (vUv.y-y1)/(y2-y1)); \n \n \n //绿色的 r=0 白色r=1\n //where: 0是透明外层, 1是绿环, 2是中间圆 \n //int where = mapColor2.a <= 0.0 ? 0 : (mapColor2.r <= 0.0 || mapColor2.a<1.0 ) ? 1 : 2; // 这个废弃是因为缩小时1外边缘的半透明会侵犯2区域,本该属于2的变为1,内边缘绘制成不透明白色锯齿。故而改为先选出2\n int where = mapColor2.a <= 0.0 ? 0 : (mapColor2.r >0.0 && mapColor2.a>0.5 ) ? 2 : 1; //2中包含1-2的过渡,因为要在2中平滑. 之所以2需要mapColor2.a>0.5是因为在左边缘多了一条奇怪r>0的竖线,为了去掉它提高了a阈值。\n \n \n \n vec4 green = vec4(0.0, 0.7843137, 0.6823529, mapColor.a);\n vec4 white = vec4(1.0, 1.0, 1.0, mapColor.a);\n \n \n if(activeProgress == 0.0){ //普通\n gl_FragColor = getColor_default( mapColor, mapColor2, where, vUvInside , white);\n \n }else if(activeProgress == 1.0){ \n gl_FragColor = getColor_hovered( mapColor, mapColor2, where, vUvInside , green); \n }else{\n vec4 color0 = getColor_default(mapColor, mapColor2, where, vUvInside , white);\n vec4 color1 = getColor_hovered(mapColor, mapColor2, where, vUvInside , green);\n \n gl_FragColor = mix(color0,color1,activeProgress);\n } \n \n gl_FragColor.a *= opacity; \n \n \n }\n "},hn={uniforms:{circleRadius:{type:"f",value:.815},progress:{type:"f",value:0},mapOut:{type:"t",value:null},mapIn:{type:"t",value:null},changeMap:{type:"i",value:0}},vertexShader:" \n varying vec2 vUv; \n \n void main() \n { \n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n }\n\t\t",fragmentShader:"\n varying vec2 vUv; \n uniform float circleRadius;\n uniform float progress;\n uniform sampler2D mapOut; \n uniform sampler2D mapIn; \n uniform int changeMap;\n void main(){ \n vec4 mapColor = texture2D(mapOut,vUv);\n vec2 vUv2 = vec2(vUv.x*2.0-1.0,vUv.y*2.0-1.0);\n float d = vUv2.x*vUv2.x+vUv2.y*vUv2.y; \n if(progress > 0.0){ \n vec4 ringColorNew = vec4(0.0, 0.7943137, 0.6823529, 0.68);\n \n if(d>circleRadius && d<=1.0){\n gl_FragColor = mix(mapColor, ringColorNew, progress);\n }else{\n if(changeMap == 1 && d<=circleRadius){ \n vec4 colorFromTexture2 = texture2D(mapIn,vUv); \n gl_FragColor = mix(mapColor, colorFromTexture2, progress);\n }\n else{\n if(d<=circleRadius)gl_FragColor = mapColor;\n //else gl_FragColor = vec4(mapColor.xyz, min(1.0-progress,mapColor.a)); //如果不把自定义图显示成圆的话用这句\n else gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0);\n }\n }\n }else{\n if(d>1.0)gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0);\n else gl_FragColor = mapColor;\n } \n \n \n }\n "},dn={uniforms:{tDiffuse:{type:"t",value:null}},vertexShader:" \n //uniform mat4 panoMatrix; \n varying vec4 vWorldPosition;\n void main() \n { \n \n vWorldPosition = modelMatrix * vec4(position, 1.0);\n //vWorldPosition = (vec4(vWorldPosition, 1.0) * panoMatrix).xyz;\n vWorldPosition.x *= -1.0;\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n }\n\t\t",fragmentShader:"\n varying vec4 vWorldPosition;\n uniform sampler2D tDiffuse; \n \n #define PI 3.141592653 \n \n vec2 getSamplerCoord( vec3 direction ) \n {\n direction = normalize(direction);\n float tx=atan(direction.x,direction.z)/(PI*2.0)+0.5;\n float ty=acos(direction.y)/PI;\n\n return vec2(tx,ty);\n }\n \n void main() \n {\n vec2 samplerCoord = getSamplerCoord(vWorldPosition.xyz);\n gl_FragColor = texture2D(tDiffuse, samplerCoord);\n } \n \n "};function pn(e){return"precision highp float;\nprecision highp int;\n\nuniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"+e}function fn(e){e.vertexShader&&(e.vertexShader="precision highp float;\nprecision highp int;\n\nuniform mat4 modelMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec2 uv;\n"+e.vertexShader),e.fragmentShader&&(e.fragmentShader=pn(e.fragmentShader),e==Jt&&(e.fragmentBufferShader=pn(e.fragmentBufferShader)))}fn(Gt),fn(jt),fn(Jt),fn(Yt),fn(Zt),fn(Xt),fn(Kt),fn($t),fn(en),fn(tn),fn(nn),fn(on),fn(rn),fn(an),fn(sn),fn(ln),fn(cn),fn(un),fn(hn),fn(dn);var mn={cube:Gt,customDepth:jt,model:Jt,modelDebug:Yt,modelOutside:Zt,ribbon:Xt,skysphere:Kt,tagDisc:$t,tagDiscDefault:en,tagDiscCustom:tn,tagVideoMarker:nn,waypoint:on,basicTextured:{uniforms:{tDiffuse:{type:"t",value:null},alpha:{type:"f",value:1}},vertexShader:"varying vec2 vUv;\nvoid main() {\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n}",fragmentShader:"varying vec2 vUv;\nuniform float alpha;\nuniform sampler2D tDiffuse;\nvoid main() {\n vec4 texColor = texture2D(tDiffuse, vUv);\n gl_FragColor = vec4(texColor.rgb, texColor.a * alpha);\n}"},copyCubeMap:{uniforms:{tDiffuse:{type:"t",value:null},alpha:{type:"f",value:1}},vertexShader:"varying vec3 vWorldPos;\nvoid main() {\n vWorldPos = vec3(-position.x, -position.y, position.z);\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n}",fragmentShader:"varying vec3 vWorldPos;\nuniform float alpha;\nuniform samplerCube tDiffuse;\nvoid main() {\n vec4 texColor = textureCube(tDiffuse, vWorldPos);\n gl_FragColor = vec4(texColor.rgb, texColor.a * alpha);\n}"},skybox:rn,videoLoading:an,videoMakerWidget:sn,videoPanoMarker:ln,videoStemLine:cn,linkSpot:un,linkSpotInside:hn,sphereRenderToCube:dn},vn=function(e,t){return function(){for(var n=new Array(arguments.length),i=0;i<n.length;i++)n[i]=arguments[i];return e.apply(t,n)}},gn=Object.prototype.toString;function yn(e){return"[object Array]"===gn.call(e)}function An(e){return void 0===e}function En(e){return null!==e&&"object"==typeof e}function bn(e){if("[object Object]"!==gn.call(e))return!1;var t=Object.getPrototypeOf(e);return null===t||t===Object.prototype}function wn(e){return"[object Function]"===gn.call(e)}function xn(e,t){if(null!=e)if("object"!=typeof e&&(e=[e]),yn(e))for(var n=0,i=e.length;n<i;n++)t.call(null,e[n],n,e);else for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.call(null,e[o],o,e)}var Cn={isArray:yn,isArrayBuffer:function(e){return"[object ArrayBuffer]"===gn.call(e)},isBuffer:function(e){return null!==e&&!An(e)&&null!==e.constructor&&!An(e.constructor)&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)},isFormData:function(e){return"undefined"!=typeof FormData&&e instanceof FormData},isArrayBufferView:function(e){return"undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&e.buffer instanceof ArrayBuffer},isString:function(e){return"string"==typeof e},isNumber:function(e){return"number"==typeof e},isObject:En,isPlainObject:bn,isUndefined:An,isDate:function(e){return"[object Date]"===gn.call(e)},isFile:function(e){return"[object File]"===gn.call(e)},isBlob:function(e){return"[object Blob]"===gn.call(e)},isFunction:wn,isStream:function(e){return En(e)&&wn(e.pipe)},isURLSearchParams:function(e){return"undefined"!=typeof URLSearchParams&&e instanceof URLSearchParams},isStandardBrowserEnv:function(){return("undefined"==typeof navigator||"ReactNative"!==navigator.product&&"NativeScript"!==navigator.product&&"NS"!==navigator.product)&&("undefined"!=typeof window&&"undefined"!=typeof document)},forEach:xn,merge:function e(){var t={};function n(n,i){bn(t[i])&&bn(n)?t[i]=e(t[i],n):bn(n)?t[i]=e({},n):yn(n)?t[i]=n.slice():t[i]=n}for(var i=0,o=arguments.length;i<o;i++)xn(arguments[i],n);return t},extend:function(e,t,n){return xn(t,(function(t,i){e[i]=n&&"function"==typeof t?vn(t,n):t})),e},trim:function(e){return e.replace(/^\s*/,"").replace(/\s*$/,"")},stripBOM:function(e){return 65279===e.charCodeAt(0)&&(e=e.slice(1)),e}};function Tn(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}var In=function(e,t,n){if(!t)return e;var i;if(n)i=n(t);else if(Cn.isURLSearchParams(t))i=t.toString();else{var o=[];Cn.forEach(t,(function(e,t){null!=e&&(Cn.isArray(e)?t+="[]":e=[e],Cn.forEach(e,(function(e){Cn.isDate(e)?e=e.toISOString():Cn.isObject(e)&&(e=JSON.stringify(e)),o.push(Tn(t)+"="+Tn(e))})))})),i=o.join("&")}if(i){var r=e.indexOf("#");-1!==r&&(e=e.slice(0,r)),e+=(-1===e.indexOf("?")?"?":"&")+i}return e};function kn(){this.handlers=[]}kn.prototype.use=function(e,t){return this.handlers.push({fulfilled:e,rejected:t}),this.handlers.length-1},kn.prototype.eject=function(e){this.handlers[e]&&(this.handlers[e]=null)},kn.prototype.forEach=function(e){Cn.forEach(this.handlers,(function(t){null!==t&&e(t)}))};var Bn=kn,Pn=function(e,t,n){return Cn.forEach(n,(function(n){e=n(e,t)})),e},Rn=function(e){return!(!e||!e.__CANCEL__)},Mn=function(e,t){Cn.forEach(e,(function(n,i){i!==t&&i.toUpperCase()===t.toUpperCase()&&(e[t]=n,delete e[i])}))},Sn=function(e,t,n,i,o){return function(e,t,n,i,o){return e.config=t,n&&(e.code=n),e.request=i,e.response=o,e.isAxiosError=!0,e.toJSON=function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:this.config,code:this.code}},e}(new Error(e),t,n,i,o)},Dn=Cn.isStandardBrowserEnv()?{write:function(e,t,n,i,o,r){var a=[];a.push(e+"="+encodeURIComponent(t)),Cn.isNumber(n)&&a.push("expires="+new Date(n).toGMTString()),Cn.isString(i)&&a.push("path="+i),Cn.isString(o)&&a.push("domain="+o),!0===r&&a.push("secure"),document.cookie=a.join("; ")},read:function(e){var t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove:function(e){this.write(e,"",Date.now()-864e5)}}:{write:function(){},read:function(){return null},remove:function(){}},Ln=["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"],Fn=Cn.isStandardBrowserEnv()?function(){var e,t=/(msie|trident)/i.test(navigator.userAgent),n=document.createElement("a");function i(e){var i=e;return t&&(n.setAttribute("href",i),i=n.href),n.setAttribute("href",i),{href:n.href,protocol:n.protocol?n.protocol.replace(/:$/,""):"",host:n.host,search:n.search?n.search.replace(/^\?/,""):"",hash:n.hash?n.hash.replace(/^#/,""):"",hostname:n.hostname,port:n.port,pathname:"/"===n.pathname.charAt(0)?n.pathname:"/"+n.pathname}}return e=i(window.location.href),function(t){var n=Cn.isString(t)?i(t):t;return n.protocol===e.protocol&&n.host===e.host}}():function(){return!0},Hn=function(e){return new Promise((function(t,n){var i=e.data,o=e.headers;Cn.isFormData(i)&&delete o["Content-Type"];var r=new XMLHttpRequest;if(e.auth){var a=e.auth.username||"",s=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";o.Authorization="Basic "+btoa(a+":"+s)}var l=function(e,t){return e&&!/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(t)?function(e,t){return t?e.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,""):e}(e,t):t}(e.baseURL,e.url);if(r.open(e.method.toUpperCase(),In(l,e.params,e.paramsSerializer),!0),r.timeout=e.timeout,r.onreadystatechange=function(){if(r&&4===r.readyState&&(0!==r.status||r.responseURL&&0===r.responseURL.indexOf("file:"))){var i="getAllResponseHeaders"in r?function(e){var t,n,i,o={};return e?(Cn.forEach(e.split("\n"),(function(e){if(i=e.indexOf(":"),t=Cn.trim(e.substr(0,i)).toLowerCase(),n=Cn.trim(e.substr(i+1)),t){if(o[t]&&Ln.indexOf(t)>=0)return;o[t]="set-cookie"===t?(o[t]?o[t]:[]).concat([n]):o[t]?o[t]+", "+n:n}})),o):o}(r.getAllResponseHeaders()):null,o={data:e.responseType&&"text"!==e.responseType?r.response:r.responseText,status:r.status,statusText:r.statusText,headers:i,config:e,request:r};!function(e,t,n){var i=n.config.validateStatus;n.status&&i&&!i(n.status)?t(Sn("Request failed with status code "+n.status,n.config,null,n.request,n)):e(n)}(t,n,o),r=null}},r.onabort=function(){r&&(n(Sn("Request aborted",e,"ECONNABORTED",r)),r=null)},r.onerror=function(){n(Sn("Network Error",e,null,r)),r=null},r.ontimeout=function(){var t="timeout of "+e.timeout+"ms exceeded";e.timeoutErrorMessage&&(t=e.timeoutErrorMessage),n(Sn(t,e,"ECONNABORTED",r)),r=null},Cn.isStandardBrowserEnv()){var c=(e.withCredentials||Fn(l))&&e.xsrfCookieName?Dn.read(e.xsrfCookieName):void 0;c&&(o[e.xsrfHeaderName]=c)}if("setRequestHeader"in r&&Cn.forEach(o,(function(e,t){void 0===i&&"content-type"===t.toLowerCase()?delete o[t]:r.setRequestHeader(t,e)})),Cn.isUndefined(e.withCredentials)||(r.withCredentials=!!e.withCredentials),e.responseType)try{r.responseType=e.responseType}catch(t){if("json"!==e.responseType)throw t}"function"==typeof e.onDownloadProgress&&r.addEventListener("progress",e.onDownloadProgress),"function"==typeof e.onUploadProgress&&r.upload&&r.upload.addEventListener("progress",e.onUploadProgress),e.cancelToken&&e.cancelToken.promise.then((function(e){r&&(r.abort(),n(e),r=null)})),i||(i=null),r.send(i)}))},Vn={"Content-Type":"application/x-www-form-urlencoded"};function On(e,t){!Cn.isUndefined(e)&&Cn.isUndefined(e["Content-Type"])&&(e["Content-Type"]=t)}var Qn,_n={adapter:(("undefined"!=typeof XMLHttpRequest||"undefined"!=typeof process&&"[object process]"===Object.prototype.toString.call(process))&&(Qn=Hn),Qn),transformRequest:[function(e,t){return Mn(t,"Accept"),Mn(t,"Content-Type"),Cn.isFormData(e)||Cn.isArrayBuffer(e)||Cn.isBuffer(e)||Cn.isStream(e)||Cn.isFile(e)||Cn.isBlob(e)?e:Cn.isArrayBufferView(e)?e.buffer:Cn.isURLSearchParams(e)?(On(t,"application/x-www-form-urlencoded;charset=utf-8"),e.toString()):Cn.isObject(e)?(On(t,"application/json;charset=utf-8"),JSON.stringify(e)):e}],transformResponse:[function(e){if("string"==typeof e)try{e=JSON.parse(e)}catch(e){}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,validateStatus:function(e){return e>=200&&e<300}};_n.headers={common:{Accept:"application/json, text/plain, */*"}},Cn.forEach(["delete","get","head"],(function(e){_n.headers[e]={}})),Cn.forEach(["post","put","patch"],(function(e){_n.headers[e]=Cn.merge(Vn)}));var zn=_n;function Un(e){e.cancelToken&&e.cancelToken.throwIfRequested()}var Nn=function(e){return Un(e),e.headers=e.headers||{},e.data=Pn(e.data,e.headers,e.transformRequest),e.headers=Cn.merge(e.headers.common||{},e.headers[e.method]||{},e.headers),Cn.forEach(["delete","get","head","post","put","patch","common"],(function(t){delete e.headers[t]})),(e.adapter||zn.adapter)(e).then((function(t){return Un(e),t.data=Pn(t.data,t.headers,e.transformResponse),t}),(function(t){return Rn(t)||(Un(e),t&&t.response&&(t.response.data=Pn(t.response.data,t.response.headers,e.transformResponse))),Promise.reject(t)}))},Gn=function(e,t){t=t||{};var n={},i=["url","method","data"],o=["headers","auth","proxy","params"],r=["baseURL","transformRequest","transformResponse","paramsSerializer","timeout","timeoutMessage","withCredentials","adapter","responseType","xsrfCookieName","xsrfHeaderName","onUploadProgress","onDownloadProgress","decompress","maxContentLength","maxBodyLength","maxRedirects","transport","httpAgent","httpsAgent","cancelToken","socketPath","responseEncoding"],a=["validateStatus"];function s(e,t){return Cn.isPlainObject(e)&&Cn.isPlainObject(t)?Cn.merge(e,t):Cn.isPlainObject(t)?Cn.merge({},t):Cn.isArray(t)?t.slice():t}function l(i){Cn.isUndefined(t[i])?Cn.isUndefined(e[i])||(n[i]=s(void 0,e[i])):n[i]=s(e[i],t[i])}Cn.forEach(i,(function(e){Cn.isUndefined(t[e])||(n[e]=s(void 0,t[e]))})),Cn.forEach(o,l),Cn.forEach(r,(function(i){Cn.isUndefined(t[i])?Cn.isUndefined(e[i])||(n[i]=s(void 0,e[i])):n[i]=s(void 0,t[i])})),Cn.forEach(a,(function(i){i in t?n[i]=s(e[i],t[i]):i in e&&(n[i]=s(void 0,e[i]))}));var c=i.concat(o).concat(r).concat(a),u=Object.keys(e).concat(Object.keys(t)).filter((function(e){return-1===c.indexOf(e)}));return Cn.forEach(u,l),n};function jn(e){this.defaults=e,this.interceptors={request:new Bn,response:new Bn}}jn.prototype.request=function(e){"string"==typeof e?(e=arguments[1]||{}).url=arguments[0]:e=e||{},(e=Gn(this.defaults,e)).method?e.method=e.method.toLowerCase():this.defaults.method?e.method=this.defaults.method.toLowerCase():e.method="get";var t=[Nn,void 0],n=Promise.resolve(e);for(this.interceptors.request.forEach((function(e){t.unshift(e.fulfilled,e.rejected)})),this.interceptors.response.forEach((function(e){t.push(e.fulfilled,e.rejected)}));t.length;)n=n.then(t.shift(),t.shift());return n},jn.prototype.getUri=function(e){return e=Gn(this.defaults,e),In(e.url,e.params,e.paramsSerializer).replace(/^\?/,"")},Cn.forEach(["delete","get","head","options"],(function(e){jn.prototype[e]=function(t,n){return this.request(Gn(n||{},{method:e,url:t,data:(n||{}).data}))}})),Cn.forEach(["post","put","patch"],(function(e){jn.prototype[e]=function(t,n,i){return this.request(Gn(i||{},{method:e,url:t,data:n}))}}));var Wn=jn;function qn(e){this.message=e}qn.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")},qn.prototype.__CANCEL__=!0;var Jn=qn;function Yn(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");var t;this.promise=new Promise((function(e){t=e}));var n=this;e((function(e){n.reason||(n.reason=new Jn(e),t(n.reason))}))}Yn.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},Yn.source=function(){var e;return{token:new Yn((function(t){e=t})),cancel:e}};var Zn=Yn;function Xn(e){var t=new Wn(e),n=vn(Wn.prototype.request,t);return Cn.extend(n,Wn.prototype,t),Cn.extend(n,t),n}var Kn=Xn(zn);Kn.Axios=Wn,Kn.create=function(e){return Xn(Gn(Kn.defaults,e))},Kn.Cancel=Jn,Kn.CancelToken=Zn,Kn.isCancel=Rn,Kn.all=function(e){return Promise.all(e)},Kn.spread=function(e){return function(t){return e.apply(null,t)}},Kn.isAxiosError=function(e){return"object"==typeof e&&!0===e.isAxiosError};var $n=Kn,ei=Kn;$n.default=ei;var ti=$n,ni=null,ii=null,oi=null;Promise.prototype.done=Promise.prototype.then,Promise.prototype.fail=Promise.prototype.catch,void 0===window.TextEncoder&&(window.TextEncoder=function(){function e(){o(this,e)}return u(e,[{key:"encode",value:function(e){return unescape(encodeURIComponent(e)).split("").map((function(e){return e.charCodeAt()}))}}]),e}(),window.TextDecoder=function(){function e(){o(this,e)}return u(e,[{key:"decode",value:function(e){return decodeURIComponent(escape(String.fromCharCode.apply(null,e)))}}]),e}());var ri={retry(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1e3;return new Promise((function(i,o){e().then(i).catch((function(r){t<=1?o(r):setTimeout((function(){ri.retry(e,t-1,n).then(i).catch(o)}),n)}))}))},get:(e,t)=>(t&&"object"==typeof t&&(-1==e.indexOf("?")?e+="?":e+="&",e+=new URLSearchParams(t).toString()),ni.get(e)),getImage(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:3;if("aws"==ii.region&&-1!=e.indexOf("x-oss-process=image")){var n=e.split("?");e=n[0]+encodeURIComponent("?"+n[1].replace(/\//g,"@"))}return ri.retry((function(){return new Promise((function(t,n){var i=new Image;i.crossOrigin="anonymous",i.src=e,i.onload=function(){t(i)},i.onerror=function(){n("[".concat(e,"] load fail"))}}))}),t)},getText:e=>ni.get(e,{responseType:"text"}),getBueffer:e=>ni.get(e,{responseType:"arraybuffer"}),getBlob:e=>ni.get(e,{responseType:"blob"}),post:(e,t)=>ni.post(e,t),postFile(e,t){var n=new FormData,i=null;for(var o in t.onUploadProgress&&(i=t.onUploadProgress,delete t.onUploadProgress),t)if("files"===o&&t[o].length>0)for(var r=0;r<t[o].length;r++){var a=t[o][r];a instanceof File?n.append(o,a):a.file?a.filename?n.append(o,a.file,a.filename):n.append(o,a.file):console.warn("file is wong !",t)}else"file"==o||"filename"===o?"file"==o&&(t.filename?n.append("file",t[o],t.filename):n.append("file",t[o])):n.append(o,t[o]);return ni.post(e,n,{headers:{"Content-Type":"multipart/form-data"},onUploadProgress:i})}};var ai=he(),si={data:{}};function li(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}si.load=function(e,t,n){var i=si.data[e];return i?(t&&setTimeout((function(){t(i)}),1),i):(i=new THREE.Texture,at.minimalMemoryMode&&(i.minFilter=THREE.LinearFilter,i.magFilter=THREE.LinearFilter,i.generateMipmaps=!1),i.sourceFile=e,si.data[e]=i,ri.getImage(e).then((function(e){i.image=e,i.needsUpdate=!0,t&&t(i)})).catch(n),i)},si.loadWithoutUpdate=function(){var e=k(S.mark((function e(t,n,i){var o;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(o=si.data[t.split("?")[0]])){e.next=6;break}return n&&n(o),e.abrupt("return",o);case 6:return o=new THREE.Texture,at.minimalMemoryMode&&(o.minFilter=THREE.LinearFilter,o.magFilter=THREE.LinearFilter,o.generateMipmaps=!1),o.sourceFile=t,si.data[t.split("?")[0]]=o,e.next=12,ri.getImage(t).then((function(e){o.image=e,o.needsUpdate=!0,n&&n(o)})).catch(i);case 12:return e.abrupt("return",o);case 13:case"end":return e.stop()}}),e)})));return function(t,n,i){return e.apply(this,arguments)}}(),si.loadBase64=function(e,t){t=t||"png";var n=new THREE.Texture;return n.image=document.createElement("img"),n.image.setAttribute("src","data:image/"+t+";base64,"+e),at.minimalMemoryMode&&(n.minFilter=THREE.LinearFilter,n.magFilter=THREE.LinearFilter,n.generateMipmaps=!1),n.needsUpdate=!0,n},si.isLoaded=function(e){return!!si.data[e]},si.getImageURL=function(e){return e&&0===e.indexOf("http")?e:ai+e};var ci={lineWidth:{value:1,type:"f"},resolution:{value:new THREE.Vector2(1,1),type:"v2"},dashScale:{value:1,type:"f"},dashSize:{value:1,type:"f"},gapSize:{value:1,type:"f"}},ui={uniforms:THREE.UniformsUtils.merge([THREE.UniformsLib.common,THREE.UniformsLib.fog,ci]),vertexShader:"#include <common>\n#include <color_pars_vertex>\n \n#include <logdepthbuf_pars_vertex>\n \nuniform float lineWidth;\nuniform vec2 resolution;\nattribute vec3 instanceStart;\nattribute vec3 instanceEnd;\nattribute vec3 instanceColorStart;\nattribute vec3 instanceColorEnd;\nvarying vec2 vUv;\n#ifdef USE_DASH\n\tuniform float dashScale;\n\tattribute float instanceDistanceStart;\n\tattribute float instanceDistanceEnd;\n\tvarying float vLineDistance;\n#endif\nvoid trimSegment( const in vec4 start, inout vec4 end ) {\n\tfloat a = projectionMatrix[ 2 ][ 2 ]; \n\tfloat b = projectionMatrix[ 3 ][ 2 ]; \n\tfloat nearEstimate = - 0.5 * b / a;\n\tfloat alpha = ( nearEstimate - start.z ) / ( end.z - start.z );\n\tend.xyz = mix( start.xyz, end.xyz, alpha );\n}\nvoid main() {\n\t#ifdef USE_COLOR\n\t\tvColor.xyz = ( position.y < 0.5 ) ? instanceColorStart : instanceColorEnd;\n\t#endif\n\t#ifdef USE_DASH\n\t\tvLineDistance = ( position.y < 0.5 ) ? dashScale * instanceDistanceStart : dashScale * instanceDistanceEnd;\n\t#endif\n\tfloat aspect = resolution.x / resolution.y;\n\tvUv = uv;\n\tvec4 start = modelViewMatrix * vec4( instanceStart, 1.0 );\n\tvec4 end = modelViewMatrix * vec4( instanceEnd, 1.0 );\n\tbool perspective = ( projectionMatrix[ 2 ][ 3 ] == - 1.0 ); \n\tif ( perspective ) {\n\t\tif ( start.z < 0.0 && end.z >= 0.0 ) {\n\t\t\ttrimSegment( start, end );\n\t\t} else if ( end.z < 0.0 && start.z >= 0.0 ) {\n\t\t\ttrimSegment( end, start );\n\t\t}\n\t}\n\tvec4 clipStart = projectionMatrix * start;\n\tvec4 clipEnd = projectionMatrix * end;\n\tvec2 ndcStart = clipStart.xy / clipStart.w;\n\tvec2 ndcEnd = clipEnd.xy / clipEnd.w;\n\tvec2 dir = ndcEnd - ndcStart;\n\tdir.x *= aspect;\n\tdir = normalize( dir );\n\tvec2 offset = vec2( dir.y, - dir.x );\n\tdir.x /= aspect;\n\toffset.x /= aspect;\n\tif ( position.x < 0.0 ) offset *= - 1.0;\n\tif ( position.y < 0.0 ) {\n\t\toffset += - dir;\n\t} else if ( position.y > 1.0 ) {\n\t\toffset += dir;\n\t}\n\toffset *= lineWidth;\n\toffset /= resolution.y;\n\tvec4 clip = ( position.y < 0.5 ) ? clipStart : clipEnd;\n\toffset *= clip.w;\n\tclip.xy += offset;\n\tgl_Position = clip;\n\tvec4 mvPosition = ( position.y < 0.5 ) ? start : end; \n\t#include <logdepthbuf_vertex>\n\t \n \n}\t",fragmentShader:"uniform vec3 diffuse;\n\tuniform float opacity;\n\t#ifdef USE_DASH\n\t\tuniform float dashSize;\n\t\tuniform float gapSize;\n\t#endif\n\tvarying float vLineDistance;\n\t#include <common>\n\t#include <color_pars_fragment>\n\t#include <fog_pars_fragment>\n\t#include <logdepthbuf_pars_fragment>\n\t \n\tvarying vec2 vUv;\n\tvoid main() {\n\t\t \n\t\t#ifdef USE_DASH\n\nif ( vUv.y < - 1.0 || vUv.y > 1.0 ) discard; \n\nif ( mod( vLineDistance, dashSize + gapSize ) > dashSize ) discard; \n\t\t#endif\n\t\tif ( abs( vUv.y ) > 1.0 ) {\n\nfloat a = vUv.x;\n\nfloat b = ( vUv.y > 0.0 ) ? vUv.y - 1.0 : vUv.y + 1.0;\n\nfloat len2 = a * a + b * b;\n\nif ( len2 > 1.0 ) discard;\n\t\t}\n\t\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t\t#include <logdepthbuf_fragment>\n\t\t#include <color_fragment>\n\t\tgl_FragColor = vec4( diffuseColor.rgb, diffuseColor.a );\n\t\t#include <premultiplied_alpha_fragment>\n\t\t#include <tonemapping_fragment>\n\t\t#include <encodings_fragment>\n\t\t#include <fog_fragment>\n\t}"},hi=[],di=function(e){f(n,THREE.ShaderMaterial);var t=li(n);function n(e){var i;return o(this,n),i=t.call(this,{type:"LineMaterial",uniforms:THREE.UniformsUtils.clone(ui.uniforms),vertexShader:ui.vertexShader,fragmentShader:ui.fragmentShader}),Object.defineProperties(h(i),{opacity:{enumerable:!0,get:function(){return this.uniforms.opacity.value},set:function(e){this.uniforms.opacity.value=e}}}),i.isLineMaterial=!0,i.dashed=!1,i.setValues(e),hi.push(h(i)),i.addEventListener("dispose",(function(){var e=hi.indexOf(h(i));e>-1&&hi.splice(e,1)})),i}return u(n,[{key:"color",get:function(){return this.uniforms.diffuse.value},set:function(e){this.uniforms.diffuse.value=e}},{key:"lineWidth",get:function(){return this.uniforms.lineWidth.value},set:function(e){this.uniforms.lineWidth.value=e}},{key:"dashScale",get:function(){return this.uniforms.dashScale.value},set:function(e){this.uniforms.dashScale.value=e}},{key:"dashSize",get:function(){return this.uniforms.dashSize.value},set:function(e){this.uniforms.dashSize.value=e}},{key:"gapSize",get:function(){return this.uniforms.gapSize.value},set:function(e){this.uniforms.gapSize.value=e}},{key:"resolution",get:function(){return this.uniforms.resolution.value},set:function(e){this.uniforms.resolution.value.copy(e)}},{key:"dashed",get:function(){return"USE_DASH"in this.defines},set:function(e){e?this.defines.USE_DASH="":delete this.defines.USE_DASH,this.needsUpdate=!0}},{key:"copy",value:function(e){return THREE.ShaderMaterial.prototype.copy.call(this,e),this.color.copy(e.color),this.lineWidth=e.lineWidth,this.resolution=e.resolution,this}}],[{key:"init",value:function(e){e.core.get("SceneRenderer").addComponent(this)}},{key:"setSize",value:function(e,t){hi.forEach((function(n){n.resolution=new THREE.Vector2(e,t)}))}}]),n}(),pi=function(e){f(n,THREE.InstancedBufferGeometry);var t=li(n);function n(){var e,i,r;o(this,n),(e=t.call(this)).computeBoundingBox=(i=new THREE.Box3,function(){null===e.boundingBox&&(e.boundingBox=new THREE.Box3);var t=e.attributes.instanceStart,n=e.attributes.instanceEnd;void 0!==t&&void 0!==n&&(e.boundingBox.setFromBufferAttribute(t),i.setFromBufferAttribute(n),e.boundingBox.union(i))}),e.computeBoundingSphere=(r=new THREE.Vector3,function(){null===e.boundingSphere&&(e.boundingSphere=new THREE.Sphere),null===e.boundingBox&&e.computeBoundingBox();var t=e.attributes.instanceStart,n=e.attributes.instanceEnd;if(void 0!==t&&void 0!==n){var i=e.boundingSphere.center;e.boundingBox.getCenter(i);for(var o=0,a=0,s=t.count;a<s;a++)r.fromBufferAttribute(t,a),o=Math.max(o,i.distanceToSquared(r)),r.fromBufferAttribute(n,a),o=Math.max(o,i.distanceToSquared(r));e.boundingSphere.radius=Math.sqrt(o),isNaN(e.boundingSphere.radius)&&console.error("LineSegmentsGeometry.computeBoundingSphere(): Computed radius is NaN. The instanced position data is likely to have NaN values.",h(e))}}),e.type="LineSegmentsGeometry",new THREE.BufferGeometry;var a=new THREE.BufferAttribute(new Uint16Array([0,2,1,2,3,1,2,4,3,4,5,3,4,6,5,6,7,5]),1);return e.setIndex(a),e.setAttribute("position",new THREE.Float32BufferAttribute([-1,2,0,1,2,0,-1,1,0,1,1,0,-1,0,0,1,0,0,-1,-1,0,1,-1,0],3)),e.setAttribute("uv",new THREE.Float32BufferAttribute([-1,2,1,2,-1,1,1,1,-1,-1,1,-1,-1,-2,1,-2],2)),e.isLineSegmentsGeometry=!0,e}return u(n,[{key:"applyMatrix",value:function(e){var t=this.attributes.instanceStart,n=this.attributes.instanceEnd;return void 0!==t&&(e.applyToBufferAttribute(t),e.applyToBufferAttribute(n),t.data.needsUpdate=!0),null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this}},{key:"setPositions",value:function(e){var t;e instanceof Float32Array?t=e:Array.isArray(e)&&(t=new Float32Array(e));var n=new THREE.InstancedInterleavedBuffer(t,6,1);return this.setAttribute("instanceStart",new THREE.InterleavedBufferAttribute(n,3,0)),this.setAttribute("instanceEnd",new THREE.InterleavedBufferAttribute(n,3,3)),this.computeBoundingBox(),this.computeBoundingSphere(),this}},{key:"setColors",value:function(e){var t;e instanceof Float32Array?t=e:Array.isArray(e)&&(t=new Float32Array(e));var n=new THREE.InstancedInterleavedBuffer(t,6,1);return this.setAttribute("instanceColorStart",new THREE.InterleavedBufferAttribute(n,3,0)),this.setAttribute("instanceColorEnd",new THREE.InterleavedBufferAttribute(n,3,3)),this}},{key:"fromWireframeGeometry",value:function(e){return this.setPositions(e.attributes.position.array),this}},{key:"fromEdgesGeometry",value:function(e){return this.setPositions(e.attributes.position.array),this}},{key:"fromMesh",value:function(e){return this.fromWireframeGeometry(new THREE.WireframeGeometry(e.geometry)),this}},{key:"fromLineSegements",value:function(e){var t=e.geometry;return t.isGeometry?this.setPositions(t.vertices):t.isBufferGeometry&&this.setPositions(t.position.array),this}},{key:"toJSON",value:function(){}},{key:"clone",value:function(){}},{key:"copy",value:function(e){return this}}]),n}(),fi=function(e){f(n,e);var t=li(n);function n(){var e;return o(this,n),(e=t.call(this)).type="LineGeometry",e.isLineGeometry=!0,e}return u(n,[{key:"setPositions",value:function(e){for(var t=e.length-3,i=new Float32Array(2*t),o=0;o<t;o+=3)i[2*o]=e[o],i[2*o+1]=e[o+1],i[2*o+2]=e[o+2],i[2*o+3]=e[o+3],i[2*o+4]=e[o+4],i[2*o+5]=e[o+5];return Tt(w(n.prototype),"setPositions",this).call(this,i),this}},{key:"setColors",value:function(e){for(var t=e.length-3,i=new Float32Array(2*t),o=0;o<t;o+=3)i[2*o]=e[o],i[2*o+1]=e[o+1],i[2*o+2]=e[o+2],i[2*o+3]=e[o+3],i[2*o+4]=e[o+4],i[2*o+5]=e[o+5];return Tt(w(n.prototype),"setColors",this).call(this,i),this}},{key:"fromLine",value:function(e){var t=e.geometry;return t.isGeometry?this.setPositions(t.vertices):t.isBufferGeometry&&this.setPositions(t.position.array),this}},{key:"copy",value:function(e){return this}}]),n}(pi),mi=function(e){f(n,e);var t=li(n);function n(e,i){var r;return o(this,n),(r=t.call(this,e,i)).type="Fatline",r.isFatline=!0,r.geometry=void 0!==e?e:new fi,r.material=void 0!==i?i:new di({color:16777215*Math.random()}),r}return u(n,[{key:"copy",value:function(e){return this}}]),n}(function(e){f(n,THREE.Mesh);var t=li(n);function n(e,i){var r,a,s;return o(this,n),(r=t.call(this,e,i)).computeLineDistances=(a=new THREE.Vector3,s=new THREE.Vector3,function(){for(var e=r.geometry,t=e.attributes.instanceStart,n=e.attributes.instanceEnd,i=new Float32Array(2*t.data.count),o=0,l=0,c=t.data.count;o<c;o++,l+=2)a.fromBufferAttribute(t,o),s.fromBufferAttribute(n,o),i[l]=0===l?0:i[l-1],i[l+1]=i[l]+a.distanceTo(s);var u=new THREE.InstancedInterleavedBuffer(i,2,1);return e.setAttribute("instanceDistanceStart",new THREE.InterleavedBufferAttribute(u,1,0)),e.setAttribute("instanceDistanceEnd",new THREE.InterleavedBufferAttribute(u,1,1)),h(r)}),r.type="LineSegments2",r.isLineSegments2=!0,r.geometry=void 0!==e?e:new pi,r.material=void 0!==i?i:new di({color:16777215*Math.random()}),r}return u(n,[{key:"copy",value:function(e){return this}}]),n}()),vi=He.lightGreen,gi=null,yi={createLine:function(e){var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(n.mat)t=n.mat;else{var i={color:n.color||vi,transparent:!n.dontAlwaysSeen,depthTest:!!n.dontAlwaysSeen};n.deshed&&(i.lineWidth=n.lineWidth||1,i.dashSize=n.dashSize||.1,i.gapSize=n.gapSize||.1),t=new THREE[n.deshed?"LineDashedMaterial":"LineBasicMaterial"](i)}var o=new THREE.LineSegments(new THREE.BufferGeometry,t);return o.renderOrder=n.renderOrder||4,this.moveLine(o,e),o},moveLine:function(e,t){if(0==t.length)return console.log(1);var n=[];t.forEach((function(e){return n.push(e.x,e.y,e.z)})),e.geometry.setAttribute("position",new THREE.BufferAttribute(new Float32Array(n),3)),e.geometry.attributes.position.needsUpdate=!0,e.geometry.computeBoundingSphere(),e.material instanceof THREE.LineDashedMaterial&&e.computeLineDistances()},createFatLineMat:function(e){var t=Object.assign({},{lineWidth:5,color:16777215,transparent:!0,depthWrite:!1,depthTest:!1,dashSize:.1,gapSize:.1},e,{});return new di(t)},createFatLine:function(e,t){var n=new fi;n.setColors(t.color||[1,1,1]);var i=t.material||this.createFatLineMat(t),o=new mi(n,i);return o.scale.set(1,1,1),o.renderOrder=2,this.moveFatLine(o,e),o},moveFatLine:function(e,t){var n=e.geometry,i=[];t.forEach((function(e){return i.push(e.x,e.y,e.z)})),i.length>0?(n||(n=e.geometry=new fi),n.attributes.instanceEnd&&n.attributes.instanceEnd.data.array.length!=i.length&&(n.dispose(),n=new fi,e.geometry=n),n.setPositions(i),e.material.dashed&&e.computeLineDistances()):(n.dispose(),e.geometry=new fi)},createBoldLine:function(e,t,n){gi=n;var i=(t=t||{})&&t.cylinder,o=e[1].clone().sub(e[0]),r=function(){i.lastVector=o;var e=new THREE.Vector3(0,-1,0),t=e.clone().cross(o).normalize(),n=e.angleTo(o);i.quaternion.setFromAxisAngle(t,n)};if(t&&"init"==t.type){if((i=new THREE.Mesh).material=t.mat,0==o.length())return i;r()}if(0==o.length())return i;if("update"!=t.type){var a=e[0].clone().add(e[1]).multiplyScalar(.5);i.position.copy(a),i.lastVector&&"moveAndRotate"!=t.type?i.lastVector&&o.angleTo(i.lastVector)>0&&r():r()}var s=e[0].distanceTo(e[1]),l=t&&t.standPos||gi.position,c=W.isMobile?20:40,u=e[0].distanceTo(l),h=e[1].distanceTo(l),d=ge.getFootPoint(l,e[0],e[1]);if(t.constantBold||"panorama"!=gi.mode)var p=[new THREE.Vector2(.1,s/2),new THREE.Vector2(.1,-s/2)];else if(d.clone().sub(e[0]).dot(d.clone().sub(e[1]))>0)p=[new THREE.Vector2(u/c,s/2),new THREE.Vector2(h/c,-s/2)];else{var f=d.distanceTo(l),m=d.distanceTo(e[0]);p=[new THREE.Vector2(u/c,s/2),new THREE.Vector2(f/c,s/2-m),new THREE.Vector2(h/c,-s/2)]}return i.geometry&&i.geometry.dispose(),i.geometry=new THREE.LatheBufferGeometry(p,4),i.renderOrder=2,i},updateBoldLine:function(e,t,n,i,o){this.createBoldLine(t,{type:n,cylinder:e,standPos:i,constantBold:o},gi)},Fatline:mi,fatLineGeometry:fi};function Ai(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}var Ei,bi,wi,xi,Ci,Ti,Ii,ki=new THREE.PlaneBufferGeometry(.4,.4,1,1),Bi=.5,Pi=[],Ri=function(){return wi||(wi=new Wi)},Mi=function(){return xi||(xi=new qi)},Si=function(){return Ci||(Ci=new ji)},Di=function(e){return Ti||((Ti=De.loadTextureFromCache(si.getImageURL(Ei.scene.markerURL||"images/marker.png"))).minFilter=THREE.LinearMipMapLinearFilter,Ti.generateMipmaps=!0,Ti.anisotropy=4),Ti},Li=function(e,t){var n=e.opacity;Object.defineProperty(e,"opacity",{get:function(){return n},set:function(i){e instanceof ji&&(t=e.marker),n=i,De.updateVisible(t,"hideWhenZeroOpa",0!=i)}})},Fi=function(e){f(n,THREE.Mesh);var t=Ai(n);function n(e){var i;o(this,n),i=t.call(this),bi=e.$app.core.get("Player"),i.pano=e,i.config=Ei=e.$app.config,i.geometry=ki,i.widget=null,i.material=new THREE.MeshBasicMaterial({map:Di("normalMarker"),side:THREE.DoubleSide,opacity:0,transparent:!0,depthWrite:!1,depthTest:!1}),i.visible=!1,i.renderOrder=Ge,i.name="marker",i.layers.set(Ft),i.updateMatrixWorld(),i.initAnimate(),at.colorMarkerOnLoad&&i.on("load",(function(){this.marker.material.color.set(65280)})),Li(i.material,h(i));var r=i.visible;return Object.defineProperty(h(i),"visible",{get:function(){return r},set:function(t){e.flagSpot&&(t?e.flagSpot.show():e.flagSpot.hide()),r=t}}),i}return u(n,[{key:"updateStyle",value:function(e,t){var n=this.material.opacity;if("animate"==t){var i=Si();i.marker=this,this.material!=i&&(this.normalMaterial=this.material,this.material=i)}else this.normalMaterial&&(this.material=this.normalMaterial),"video"==t?this.setWidget(e,this.pano,t):(this.pano.oldFlagSpot=this.pano.flagSpot,this.pano.flagSpot=null,this.pano.oldFlagSpot&&this.pano.oldFlagSpot.hide());this.material.opacity=n}},{key:"setWidget",value:function(e,t,n){if("video"==n)if(t.oldFlagSpot)t.flagSpot=t.oldFlagSpot;else if(!t.flagSpot){var i=new Ni(e,"flagSpot___"+t.id,{position:t.position.clone(),state:"videoPanoFlag",sid:"flagSpot___"+t.id,style:"videoMarker",pano:t});i.style="videoMarker",i.createMarkLine({type:"flagSpot",stemLineLen:Bi,markerPos:this.position}).marker=this,i.rePos(i.markLine.groundPoint.clone().add(new THREE.Vector3(0,Bi,0))),Pi.push(i),t.flagSpot=i,this.visible||i.hide()}}},{key:"initAnimate",value:function(){Ii||(bi.on("update",(function(){!function(){for(var e=0;e<Hi.length;e++)Hi[e].uniforms.progress.value=Vi,Hi[e].uniforms.bigCircleProgress.value=Oi,Hi[e].uniforms.smallCircleProgress.value=_i;Pi.forEach((function(e){return e.update()})),Vi>1&&(Vi=0);Vi+=zi,Oi>1?Ui&&(Oi=0,_i=Qi):(Oi+=zi,_i+=zi)}()})),Ii=!0)}}]),n}(),Hi=[],Vi=0,Oi=0,Qi=-.12,_i=Qi,zi=.0045,Ui=!0;var Ni=function(e){f(n,EventEmitter);var t=Ai(n);function n(e,i,r){var a;return o(this,n),(a=t.call(this)).model=e,a.sid=i,a.floor=null,a.floors=[],a.position=(new THREE.Vector3).copy(r.position),a.content={},a.initContent(r),a.snapInfo=r.snapInfo,a.style=r.style||"default",a.color=(new THREE.Color).setRGB(0,.7843137254901961,.6862745098039216),r.color&&a.color.setStyle(r.color),a.styleImageURL=r.styleImageURL,a.hoverColor=He._darken(a.content.color,.2),a.animTime=0,a.animated=!1,a.openning=0,a.openTransition=null,a.mode=xt.PANORAMA,a.obj3d=null,a.disc=null,a.discWorldPosition=null,a.discScale=.06,a.floorIndex=r.floorIndex,a.visibleTransition=null,a.hoveringDisc=!1,a.state=r.state,a.videoPano=r.pano,a.build(),a}return u(n,[{key:"initContent",value:function(e){this.content.description=e.description,this.content.label=e.label,this.content.link=e.link,this.content.outLink=e.outLink,this.content.color=(new THREE.Color).set(e.color||He.tagDefault),this.content.fileName=e.fileName||{},this.content.fileSrc=e.fileSrc||{},this.content.media=e.media||[]}},{key:"getFloors",value:function(){var e=this;this.floors=[],this.visiblePanos&&this.visiblePanos.forEach((function(t){e.model.panos.index[t]&&(e.floors.includes(e.model.panos.index[t].floor)||e.floors.push(e.model.panos.index[t].floor))})),this.floor&&!this.floors.includes(this.floor)&&this.floors.push(this.floor)}},{key:"rePos",value:function(e){this.position.copy(e),this.obj3d.position.copy(e)}},{key:"createMarkLine",value:function(e){return this.markLine=new Gi({type:e.type,stemLineLen:e.stemLineLen,markerPos:e.markerPos,tag:this,model:this.model}),this.markLine}},{key:"build",value:function(){return this.floor=this.videoPano.floor,this.floorIndex=this.floor.floorIndex,this.floor&&(this.obj3d=this.buildObject3D(),this.floor.add(this.obj3d)),this.getFloors(),this}},{key:"buildObject3D",value:function(){var e=this,t=new THREE.Object3D;t.position.copy(this.position);var n=this.model.$app.config;this.animated=!0;var i=n.isMobile?new THREE.PlaneBufferGeometry(2.4,2.4):new THREE.PlaneBufferGeometry(1,1);return this.disc=new THREE.Mesh(i,Mi()),this.disc.layers.set(Ft),this.disc.renderOrder=Ge,bi.on("mode.changing",(function(t,n){e.disc.renderOrder="floorplan"!=n?Ge:5})),this.disc.tag=this,this.disc.pano=this.videoPano,this.disc.name="disc",t.add(this.disc),t.name="tagGroup",t}},{key:"hide",value:function(e,t){this.hidden||(this.hidden=!0,this.markLine&&this.markLine.hide(),this.disc&&(this.disc.visible=!1))}},{key:"show",value:function(e,t){this.hidden&&(this.hidden=!1,this.markLine&&this.markLine.show(),this.disc&&(this.disc.visible=!0))}},{key:"update",value:function(){this.disc&&(this.discWorldPosition=this.disc.getWorldPosition(new THREE.Vector3),this.updateDisc())}},{key:"updateDisc",value:function(){var e=this.model.mode,t="floorplan"==this.model.player.mode?this.model.player.cameraControls.activeControl.camera:this.model.player.camera,i=at.tags.visibility,o=at.tags.disc.scale,r=e===xt.DOLLHOUSE||e===xt.FLOORPLAN?at.tags.visibility.visibleDistance:t.position.distanceTo(this.discWorldPosition);if(this.obj3d.visible=0!==this.disc.material.opacity&&(i.anyDistance||r<=i.visibleDistance||e===xt.TRANSITIONING)&&(!i.hideViaFloor||this.tagVisibleOnCurrentFloor(e))&&(!i.hideOffScreenDisc||!this.offScreen(this.disc,t))&&(!i.hideOffScreenObject||!this.offScreen(this.obj3d,t)),this.obj3d.visible&&this.disc.visible){this.markLine.stemLine.rotation.y=-new THREE.Vector2(this.markLine.stemLine.position.x-t.position.x,this.markLine.stemLine.position.z-t.position.z).angle()+Math.PI/2,"floorplan"==this.model.$app.core.get("Player").modeTran.split("-")[1]?this.disc.quaternion.copy(t.quaternion):this.disc.lookAt(t.position);var a=ge.getScaleForConstantSize({maxSize:o.maxSize,minSize:"videoPanoFlag"==this.state&&e!=xt.PANORAMA?30:o.minSize,nearBound:o.nearBound,farBound:o.farBound,camera:t,position:this.discWorldPosition,dom:this.model.$app.dom}),s=1+at.tags.disc.scale.responsiveness/100*(n.viewportScale()-1);this.discScale=a*s;try{this.model.player.linkEditor.setTagVisible?this.discScale*=1.5:this.isMeasurePoint?this.discScale*=.9:this.model.$app.TagManager.editHandle&&this.model.$app.TagManager.editHandle.editing&&(this.discScale*=2.5)}catch(e){}this.disc.scale.set(2*this.discScale,2*this.discScale,2*this.discScale);var l=.95*this.discScale;this.markLine.stemLine.scale.y=(Bi-l)/Bi,this.markLine.stemLine.position.copy(this.markLine.stemLine.originPos),this.markLine.stemLine.position.y-=l/2}}},{key:"tagVisibleOnCurrentFloor",value:function(e){return!(e===xt.DOLLHOUSE||e===xt.FLOORPLAN)||this.model.allFloorsVisible||!!this.floors.find((function(e){return!e.hidden}))}}],[{key:"viewportScale",value:function(){var e=document.getElementsByClassName("player")[0];return n.viewportWidth===e.clientWidth&&n.viewportHeight===e.clientHeight||(n.viewportWidth=e.clientWidth,n.viewportHeight=e.clientHeight,n.currentViewportScale=Math.sqrt(Math.min(n.viewportWidth,n.viewportHeight)/at.tags.disc.scale.baseViewportSize)),n.currentViewportScale}}]),n}(),Gi=function(){function e(t){o(this,e),this.tag=t.tag,this.groundPoint=t.groundPoint||t.markerPos,this.stemLine=new THREE.Mesh(new THREE.PlaneBufferGeometry(.006,t.stemLineLen),Ri()),this.stemLine.position.copy(this.groundPoint.clone().add(new THREE.Vector3(0,t.stemLineLen/2,0))),this.stemLine.originPos=this.stemLine.position.clone(),this.stemLine.name="markGroup-stemLine",this.stemLine.layers.set(Ft),this.stemLine.renderOrder=Ge,this.tag.obj3d.parent.add(this.stemLine)}return u(e,[{key:"hide",value:function(){this.stemLine.visible=!1}},{key:"show",value:function(){this.stemLine.visible=!0}}]),e}(),ji=function(e){f(n,THREE.RawShaderMaterial);var t=Ai(n);function n(){var e;o(this,n),e=t.call(this);var i=THREE.UniformsUtils.clone(mn.videoPanoMarker.uniforms);return i.map.value=Di("normalMarker"),i.opacity.value=1,e.vertexShader=mn.videoPanoMarker.vertexShader,e.fragmentShader=mn.videoPanoMarker.fragmentShader,e.uniforms=i,e.transparent=!0,e.depthTest=!1,Li(h(e)),Hi.push(h(e)),e}return n}(),Wi=function(e){f(n,THREE.RawShaderMaterial);var t=Ai(n);function n(){var e;o(this,n),e=t.call(this);var i=THREE.UniformsUtils.clone(mn.videoStemLine.uniforms);return e.vertexShader=mn.videoStemLine.vertexShader,e.fragmentShader=mn.videoStemLine.fragmentShader,e.uniforms=i,e.transparent=!0,e.depthTest=!1,e.side=THREE.DoubleSide,Hi.push(h(e)),e}return n}(),qi=function(e){f(n,THREE.MeshBasicMaterial);var t=Ai(n);function n(){var e;o(this,n);var i=si.load(si.getImageURL("images/videoTag.png"));return(e=t.call(this,{map:i,transparent:!0,depthTest:!1})).animation=De.GifTexDeal.addAnimation(i,h(e),{cellXcount:6,cellYcount:5,voidCount:0,loop:!0,duration:1200,delay:600,waitNextTime:1700},0),e.animation.startCallback=function(){Oi=0,_i=Qi},Ui=!1,De.GifTexDeal.start(e.animation),bi.on("mode.changing",(function(t,n){e.depthTest="floorplan"!=n&&"panorama"!=n})),e}return n}(),Ji=0,Yi=1,Zi=2,Xi=3,Ki=4,$i=5,eo={TILE_SIZE:512,FACES_PER_PANO:6,LocationOnTile:{Center:0,UpperLeft:1,UpperRight:2,LowerRight:3,LowerLeft:4},getTileVector:function(e,t,n,i,o,r,a,s){var l=e/t,c=t/e*2,u=c/2,h=i/l*2-1+u,d=(o=l-1-o)/l*2-1+u;switch(r=r||eo.LocationOnTile.Center){case eo.LocationOnTile.UpperLeft:h-=u,d+=u,h+=a*c;break;case eo.LocationOnTile.UpperRight:h+=u,d+=u,d-=a*c;break;case eo.LocationOnTile.LowerRight:h+=u,d-=u,h-=a*c;break;case eo.LocationOnTile.LowerLeft:h-=u,d-=u,d+=a*c;break;case eo.LocationOnTile.Center:}switch(n){case Ji:ht.setVector(s,-1,d,-h);break;case Yi:ht.setVector(s,1,d,h);break;case Zi:ht.setVector(s,-h,1,-d);break;case Xi:ht.setVector(s,-h,-1,d);break;case Ki:ht.setVector(s,-h,d,1);break;case $i:ht.setVector(s,h,d,-1)}ht.normalize(s)},getFaceForTile:function(e,t){var n=eo.TILE_SIZE;e<eo.TILE_SIZE&&(n=e);var i=Math.floor(e/n),o=i*i;return Math.floor(t/o)},getTileLocation:function(e,t,n){var i=eo.TILE_SIZE;e<eo.TILE_SIZE&&(i=e);var o=eo.getFaceForTile(e,t),r=Math.floor(e/i),a=t-o*(r*r);return n.tileX=a%r,n.tileY=Math.floor(a/r),n.face=o,n.faceTileIndex=a,n},getTileCountForSize:function(e){if(e<=eo.TILE_SIZE)return eo.FACES_PER_PANO;var t=Math.floor(e/eo.TILE_SIZE);return t*t*eo.FACES_PER_PANO}};eo.getRelativeDirection=function(){var e=new ht.Matrix4,t=new ht.Quaternion;return function(n,i){t.copy(n),t.inverse(),e.makeRotationFromQuaternion(t),e.applyToVector3(i),ht.normalize(i)}}(),eo.matchingTilesInDirection=function(){var e=new ht.Vector3,t=new ht.Vector3(0,0,-1),n=new ht.Quaternion,i=function(e,t){e.push({face:t.face,faceTileIndex:t.faceTileIndex,tileX:t.tileX,tileY:t.tileY})},o=function(){var e={face:-1,faceTileIndex:-1,tileX:-1,tileY:-1};return function(t,n,o){for(var r=eo.getTileCountForSize(t),a=0,s=0;s<r;s++)eo.getTileLocation(t,s,e),n&&!n(e)||(a++,o&&i(o,e));return a}}();return function(i,r,a,s,l,c){var u=r<eo.TILE_SIZE?r:eo.TILE_SIZE;if(!s&&!l)return o(r,null,c);var h=!!l;if(l=l||s,l=Math.max(0,Math.min(l,360)),s=Math.max(0,Math.min(s,360)),ht.copyVector(a,e),eo.getRelativeDirection(i.quaternion,e),h){n.setFromUnitVectors(e,t);return o(r,(function(e){return eo.isTileWithinFrustum(r,u,e.face,e.tileX,e.tileY,n,s,l)}),c)}return o(r,(function(t){return eo.isTileWithinFOV(r,u,t.face,t.tileX,t.tileY,e,s)}),c)}}(),eo.isTileWithinFrustum=function(){var e=new ht.Vector3;return function(t,n,i,o,r,a,s,l){for(var c=Math.tan(.5*l*ht.RADIANS_PER_DEGREE),u=-c,h=Math.tan(.5*s*ht.RADIANS_PER_DEGREE),d=-h,p=eo.mapFaceToCubemapFace(i),f=0,m=0,v=0,g=0,y=0,A=eo.LocationOnTile.Center;A<=eo.LocationOnTile.LowerLeft;A++)if(eo.getTileVector(t,n,p,o,r,A,0,e),ht.applyQuaternionToVector(a,e),e.z>=-1e-5);else{var E=-1/e.z,b=e.x*E,w=e.y*E;w>c?f++:w<u&&m++,b>h?v++:b<d&&g++,y++}return m!==y&&f!==y&&v!==y&&g!==y}}(),eo.isTileWithinFOV=function(){var e=new ht.Vector3,t=new ht.Vector3(0,1,0),n=new ht.Vector3(1,0,0);return function(i,o,r,a,s,l,c){var u=eo.mapFaceToCubemapFace(r);if(ht.cross(l,t,n),eo.getTileVector(i,o,u,a,s,eo.LocationOnTile.Center,0,e),eo.isWithinFOV(e,l,c,null))return!0;for(var h=c/360,d=Math.floor(1/h),p=0,f=0;f<d;f++){for(var m=eo.LocationOnTile.UpperLeft;m<=eo.LocationOnTile.LowerLeft;m++)if(eo.getTileVector(i,o,u,a,s,m,p,e),eo.isWithinFOV(e,l,c,null))return!0;p+=h}return!1}}(),eo.isWithinFOV=function(){var e=new ht.Vector3,t=new ht.Vector3;return function(n,i,o,r){if(ht.copyVector(n,t),r){ht.copyVector(r,e),ht.normalize(e);var a=ht.dot(e,n);e.x*=a,e.y*=a,e.z*=a,ht.subVector(t,e)}var s=o/2*ht.RADIANS_PER_DEGREE,l=Math.cos(s);return ht.dot(t,i)>=l}}(),eo.mapFaceToCubemapFace=function(){var e={0:Zi,1:Ki,2:Ji,3:$i,4:Yi,5:Xi};return function(t){return e[t]}}();var to={UP:new THREE.Vector3(0,1,0),DOWN:new THREE.Vector3(0,-1,0),LEFT:new THREE.Vector3(-1,0,0),RIGHT:new THREE.Vector3(1,0,0),FORWARD:new THREE.Vector3(0,0,-1),BACK:new THREE.Vector3(0,0,1),ZERO:new THREE.Vector3(0,0,0)};function no(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}var io=(new THREE.Quaternion).setFromAxisAngle(new THREE.Vector3(0,1,0),-Math.PI/2),oo={backgroundColor:{r:0,g:0,b:0,a:0},textColor:{r:255,g:255,b:255,a:1},fixOrient:!0,renderOrder:Ge,fontsize:34},ro={backgroundColor:{r:255,g:255,b:255,a:.4},textColor:{r:0,g:0,b:0,a:1},borderRadius:15,renderOrder:Ge},ao=Fe.urlHasValue("panoLabel"),so=function(e){f(i,EventEmitter);var t,n=no(i);function i(e,t,r,a,s){var l,c,u,d,p;o(this,i),(l=n.call(this)).raycastToFindFloor=function(){var e=[new THREE.Vector3(0,-1,0),new THREE.Vector3(1,-1,0),new THREE.Vector3(0,-1,1),new THREE.Vector3(-1,-1,0),new THREE.Vector3(0,-1,-1),new THREE.Vector3(1,0,0),new THREE.Vector3(0,0,1),new THREE.Vector3(-1,0,0),new THREE.Vector3(0,0,-1)];return function(){for(var t=0;t<e.length;t++){var n=new THREE.Raycaster(this.position.clone(),e[t].clone()).intersectObjects(this.model.colliders);if(n.length)return n[0].object.parent.floor}return null}}(),l.findNeighourPanos=function(){return this.model.panos.setNeighbour(this.id,this.id,!1),this.model.panos.forEach(function(e){if(e!==this&&(!this.model.panos.neighbourMap[this.id]||void 0===this.model.panos.neighbourMap[this.id][e.id])){var t=this.position.distanceTo(e.position);if(t>at.panoramaNeighbourMaxDistance)return this.model.panos.setNeighbour(this,e,!1),void i.raycastsSkipped++;var n=e.position.clone().sub(this.position).normalize(),o=new THREE.Raycaster(this.position,n.clone(),0,t).intersectObjects(this.model.colliders);i.raycastsDone++,this.model.panos.setNeighbour(this,e,0===o.length),at.showNeighbourRaycasts&&(o.length?this.floor.model.add(new THREE.ArrowHelper(n,this.position,o[0].distance,16711680)):this.floor.model.add(new THREE.ArrowHelper(n,this.position,t,16777215,0,0)))}}.bind(this)),this.model.panos.neighbourMap[this.id]},l.enter=(c=null,function(){this.setZoomed(!1),this.emit(Qt.Enter,c,this),c=this,this.model.setHighMap(this),this.model.dispatchEvent({type:"panoEntered"})}),l.loadTiledPano=(u={},d={},p={},function(e,t,n,i,o,r){null!=i||(i=!0),null!=o||(o=!0);var a=this.getWaitDeferred(e),s=a.deferred,l=null,c=null;if(n&&("number"==typeof n?l=n:(l=n.hFov,c=n.vFov)),this.isLoaded(e))s.resolve(e);else{if(!a.active){a.active=!0;var h=this.id+":"+e;if(u[h]=u[h]||[],p[h]=null,n){var f=[],m=eo.matchingTilesInDirection(this,e,t,l,c,f);p[h]=f,u[h].forEach((function(e){var t=p[h].find((function(t){return e.faceTileIndex==t.faceTileIndex&&e.face==t.face}));t&&(t.loaded=!0)})),p[h].some((function(e){return!e.loaded}))||(s.resolve(e),this.resetWaitDeferred(e),p[h]=null),ft.info("Loading partial pano: "+this.id+" with "+m+" tiles")}d[this.id]||(d[this.id]=!0,this.on(Qt.LoadComplete,function(e,t){var n=this.getWaitDeferred(e).deferred;n&&"pending"===n.state()&&this.highestPartialTileRenderOpCompleted>=e&&(n.resolve(e,t),this.resetWaitDeferred(e))}.bind(this)),this.on(Qt.LoadFailed,function(e){var t=this.getWaitDeferred(e).deferred;t&&"pending"===t.state()&&this.highestPartialTileRenderOpCompleted>=e&&(t.reject(e),this.resetWaitDeferred(e))}.bind(this)),this.on(Qt.TileLoaded,function(e,t,n){var i=this.id+":"+e;u[i]=u[i]||[];var o=eo.getTileLocation(e,t,{}),r=o.faceTileIndex,a=o.face;u[i].push({faceTileIndex:r,face:a});var s=this.getWaitDeferred(e).deferred;if(s&&"pending"===s.state()&&(s.notify(e,t,n),p[i])){var l=p[i].find((function(e){return e.faceTileIndex==r&&e.face==a}));l&&(l.loaded=!0),p[i].some((function(e){return!e.loaded}))||(this.onPanoRendered(this.id,e,n,!0),s.resolve(e,n),this.resetWaitDeferred(e),p[i]=null)}}.bind(this)))}this.tileDownloader.clearForceQueue(),this.tileDownloader.forceQueueTilesForPano(this,e,t,l,c,r);var v=this.curTileQuality||this.qualityManager.getMaxNavPanoSize();this.tiledPanoRenderTarget=this.panoRenderer.activateTiledPano(this,v,i),this.panoRenderer.renderPanoTiles(this.id,t,o,null,v)}return s.promise()}),l.id=t,l.panoType=r.panoType,l.neighbourUUIDs=r.neighbours||[],l.neighbourPanos=null,l.floor=null,l.floorIndex=r.subgroup||0,l.failedLoadingAt=0,l.maxLoadRetries=4,l.origin=r.position.clone(),l.position=r.position.clone(),l.quaternion=r.quaternion.clone(),l.appId=r.index+1,l.$app=e,l.model=l.$app.core.get("Player").model,l.debugColor=(new THREE.Color).setHSL(.06+.53*Math.random(),.8+.2*Math.random(),.5+.2*Math.random()),l.floorPosition=r.puck?r.puck.clone():null,l.marker=null,l.noBlockPanos=[],l.blocks=[],l.seeMarkers=r.seeMarkers,l.tiled=null!=r.tiled?r.tiled:l.model.supportsTiles,l.isAligned()&&(l.marker=new Fi(h(l)));var f=(new THREE.Quaternion).multiplyQuaternions(l.quaternion,io),m=(new THREE.Matrix4).compose(l.position,f,new THREE.Vector3(1,1,1));return l.tiled?(l.rot90Matrix=m,l.matrixWorld=(new THREE.Matrix4).compose(l.position,l.quaternion,new THREE.Vector3(1,1,1))):(l.solidSkybox=new THREE.Texture([null,null,null,null,null,null]),l.solidSkybox.flipY=!1,at.minimalMemoryMode&&(l.solidSkybox.minFilter=THREE.LinearFilter,l.solidSkybox.magFilter=THREE.LinearFilter,l.solidSkybox.generateMipmaps=!1),l.quaternion=f,l.matrixWorld=m),l.zoomed=!1,l.panoRenderer=null,l.qualityManager=null,l.tileDownloader=null,l.tiledPanoRenderTarget=null,l.resolutionPromise={},l.minimumTiledPanoLoaded=!1,l.highestPartialTileRenderOpCompleted=0,l.highestFullTileRenderOpCompleted=0,l.shouldRedrawOnBaseLoaded=!1,l.lockUntilRenderingComplete=!1,a?(l.hasVideo=!0,l.videoInfo=a):l.hasVideo=!1,l.panoVideo=!1,l.filterEffect={brightness:0,contrast:0,saturation:0,temperature:0},l}return u(i,[{key:"hasFilter",get:function(){var e=this.$app.FilterManager.filterTemp[this.id]||this.filterEffect,t=e.brightness,n=e.contrast,i=e.saturation,o=e.temperature;return 0!==t||0!==n||0!==i||0!==o}},{key:"exit",value:function(){this.tiled?(this.clearWaitDeferreds(),this.minimumTiledPanoLoaded=!1,this.tiledPanoRenderTarget=null,this.setZoomed(!1),this.panoRenderer.deactivateTiledPano(this),this.highestPartialTileRenderOpCompleted=0,this.highestFullTileRenderOpCompleted=0):this.useAtScreenB||(this.solidSkybox.dispose(),this.solidSkybox.loaded=!1,this.solidSkybox.version=0),this.emit("exit")}},{key:"hoverOn",value:function(e){0==at[e].markerOpacityOnHover||this.$app.core.get("Player").locked||this.marker&&Ae.start(St.property(this.marker.material,"opacity",at[e].markerOpacityOnHover),250)}},{key:"hoverOff",value:function(e){0==at[e].markerOpacity||this.$app.core.get("Player").locked||this.marker&&Ae.start(St.property(this.marker.material,"opacity",at[e].markerOpacity),250)}},{key:"build1",value:function(){this.floor=this.floor||this.model.floors.get(this.floorIndex)||this.raycastToFindFloor()||this.model.floors.list[0],this.floorIndex=this.floor.floorIndex,this.floor.addPano(this),this.floorPosition=this.floorPosition||this.raycastFloorPosition(),this.neighbourPanos=this.neighbourPanos||this.findNeighourPanos(),at.colorMarkerByFloor&&this.marker&&this.marker.material.color.set(this.floor.debugColor)}},{key:"build2",value:function(){var e=this;this.floorPosition=this.floorPosition||this.interpolateFloorPosition(),this.height=this.position.distanceTo(this.floorPosition),this.placeMarker(),this.isAligned()&&(this.$app.config.view||this.addLabel(),setTimeout((function(){ao&&e.addLabel2()}),1))}},{key:"placeMarker",value:function(){this.marker&&(this.marker.position.copy(this.floorPosition),this.marker.position.y+=.01,this.marker.lookAt(new THREE.Vector3(0,1,0).add(this.marker.position)))}},{key:"attachToPanoRenderer",value:function(e){this.panoRenderer=e,this.panoRenderer.on(Dt.TileRenderSuccess,this.onTileRendered.bind(this)),this.panoRenderer.on(Dt.PanoRenderComplete,this.onPanoRendered.bind(this)),this.panoRenderer.on(Dt.TileRenderFailure,this.onTileRenderFail.bind(this)),this.panoRenderer.on(Dt.UploadAttemptedForAllTiles,this.onUploadAttemptedForAllTiles.bind(this))}},{key:"updateMakerStyle",value:function(e){this.marker&&("animate"==e?this.marker.updateStyle(this.model,"animate",this):this.hasVideo&&this.panoVideoRenderer.ifEnable()||this.panoVideo?this.marker.updateStyle(this.model,"video",this):this.marker.updateStyle(this.model,"normal",this))}},{key:"createVrMarker",value:function(e,t){var n=this;this.isAligned()&&(this.vrMarker=new THREE.Sprite(new THREE.SpriteMaterial({transparent:!0,opacity:.75,map:e,depthTest:!1})),this.vrMarker.name="vrMarker",this.vrMarker.scale.set(.16,.16,1),this.vrMarker.boluoType="vr",this.vrMarker.position.copy(this.position),this.vrMarker.position.y-=.2,this.vrMarker.enabled=!0,De.updateVisible(this.vrMarker,"vr",!1),this.vrMarker.renderOrder=Ge,this.vrMarker.pano=this,this.model.vrMarkers.push(this.vrMarker),this.model.add(this.vrMarker),this.vrMarker.addEventListener("click",(function(){"portrait"!=window.VRScreenType&&t.flyToPano({pano:n})})))}},{key:"hasNeighbor",value:function(){var e=this;return this.neighbourUUIDs.filter((function(t){return t!=e.id})).length>0}},{key:"attachToPanoVideoRenderer",value:function(e){this.hasVideo&&(this.panoVideoRenderer=e,this.on(Qt.Enter,e.onVideoPanoramasEnter.bind(e)),this.on(Qt.Exit,e.onVideoPanoramasExit.bind(e)))}},{key:"getWaitDeferred",value:function(e){var t=this.resolutionPromise[this.id];t||(t={},this.resolutionPromise[this.id]=t);var n=t[e];return n||(n={deferred:oe(),active:!1},t[e]=n),n}},{key:"resetWaitDeferred",value:function(e){var t=this.getWaitDeferred(e);t.active=!1,t.deferred=oe()}},{key:"clearWaitDeferreds",value:function(){var e=this.resolutionPromise[this.id];for(var t in e||(e={},this.resolutionPromise[this.id]=e),e)if(e.hasOwnProperty(t)){var n=e[t];n.active=!1,n.deferred=oe()}}},{key:"onUploadAttemptedForAllTiles",value:function(e,t,n){e===this.id&&(t===this.qualityManager.getPanoSize(_t)&&this.shouldRedrawOnBaseLoaded&&(this.shouldRedrawOnBaseLoaded=!1,this.panoRenderer.resetRenderStatus(this.id,!0,!1),this.panoRenderer.renderPanoTiles(this.id,null,!0,!0)))}},{key:"onTileRendered",value:function(e,t,n,i){e===this.id&&this.emit(Qt.TileLoaded,t,n,i)}},{key:"onPanoRendered",value:function(e,t,n,i){e===this.id&&(this.minimumTiledPanoLoaded=!0,this.updateSkyboxForZoomLevel(),t>this.highestPartialTileRenderOpCompleted&&(this.highestPartialTileRenderOpCompleted=t),!i&&t>this.highestFullTileRenderOpCompleted&&(this.highestFullTileRenderOpCompleted=t),this.emit("load",t),this.model.emit("load",this),this.emit(Qt.LoadComplete,t,n))}},{key:"setZoomed",value:function(e){this.zoomed=e,this.updateSkyboxForZoomLevel(),e?"1k"!=this.$app.core.get("QualityManager").navTileClass&&this.model.showHighMap():this.model.hideHighMap()}},{key:"ensureSkyboxReadyForRender",value:function(){this.tiled||(this.solidSkybox.loaded||(this.solidSkybox.needsUpdate=!0),this.solidSkybox.loaded=!0)}},{key:"updateSkyboxForZoomLevel",value:function(){this.minimumTiledPanoLoaded&&this.model.updateProjectedPanos(this)}},{key:"getSkyboxTexture",value:function(){return this.tiled?this.minimumTiledPanoLoaded?this.zoomed&&this.qualityManager.maxRenderTargetSize>this.qualityManager.maxNavPanoSize?this.panoRenderer.zoomRenderTarget.texture:this.tiledPanoRenderTarget&&this.tiledPanoRenderTarget.texture:null:this.solidSkybox}},{key:"onTileRenderFail",value:function(e,t,n){e===this.id&&this.emit(Qt.LoadFailed,t)}},{key:"isLoaded",value:function(e){return this.tiled?(e&&"string"==typeof e&&console.error("Wrong panoSize given to Panorama.isLoaded(); a tiled pano uses PanoSizeClass"),!!this.minimumTiledPanoLoaded&&(!e||this.highestFullTileRenderOpCompleted>=e)):(e&&"number"==typeof e&&console.error("Wrong panoSize given to Panorama.isLoaded(); a non-tiled pano uses high/low."),!!this.solidSkybox.high||e in this.solidSkybox)}},{key:"loadCube",value:(t=k(S.mark((function e(t){var n,i,o;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.isLoaded(t)){e.next=3;break}return ft.info("Skipping load of pano, already loaded"),e.abrupt("return",ie.when());case 3:if(this.emit("loading",t),this.model.emit("loading",this),n=this.getCubemapUrls(this.id,t),"360view"!=this.panoType){e.next=12;break}if((i=this.$app.core.get("Player")).viewLinkManager.views[this.id]){e.next=10;break}return e.abrupt("return");case 10:(o=i.viewLinkManager.views[this.id].panoImgVersion)&&(n+="&"+o);case 12:return e.abrupt("return",ri.getImage(n).then(function(){var e=k(S.mark((function e(n){var i;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.mapSrc){e.next=5;break}return i=Fe.maybeQilin()?4096:8192,e.next=4,De.compressImg(n,i);case 4:n=e.sent;case 5:return this.solidSkybox[t]=n,this.solidSkybox.minFilter=THREE.LinearFilter,"high"!==t&&this.solidSkybox.high||(this.solidSkybox.image=this.solidSkybox[t],this.solidSkybox.low=null),this.solidSkybox.dispose(),this.solidSkybox.needsUpdate=!0,this.emit("load",t),this.model.emit("load",this),e.abrupt("return",this);case 13:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}().bind(this),function(){ft.error("Downloading cubemap for pano",this.id,"failed"),this.failedLoadingAt=Date.now()}.bind(this),(function(){console.log("load cubeTex 出现问题?")})));case 13:case"end":return e.stop()}}),e,this)}))),function(e){return t.apply(this,arguments)})},{key:"loadCubeImage",value:function(e){var t=oe(),n=new Image;return n.onerror=function(){t.reject()},n.onload=function(){t.resolve(n)},n.crossOrigin=THREE.ImageUtils.crossOrigin,n.src=e,t}},{key:"getCubemapUrls",value:function(e,t){if(this.mapSrc)return this.mapSrc;var n=!1;Fe.valueFromUrl("m")&&Fe.valueFromUrl("m2")&&("sxz"==this.$app.store.getValue("metadata").sceneFrom&&(n=!0));return this.$app.resource.getViewImagesURL("pan/".concat(t,"/").concat(e,".jpg").concat(n?"?x-oss-process=image/resize,m_lfit,w_4096":""))}},{key:"worldPosition",value:function(){return this.position}},{key:"isAligned",value:function(){return!this.panoType}},{key:"updateTileQuality",value:function(e){this.$app.core.get("Player");var t=this.qualityManager.getMaxNavPanoSize();this.curTileQuality=Math.min(e,t)}},{key:"getVideoFilter",value:function(e){var t,n,o,r=this;if(this.hasVideo&&this.$app.core.get("PanoVideoRenderer").ifEnable())if(this.videoInfo.dir)o=this.videoInfo.dir.clone(),n=THREE.MathUtils.degToRad(this.videoInfo.hfov/2);else{var a=(new THREE.Quaternion).setFromAxisAngle(new THREE.Vector3(0,1,0),THREE.MathUtils.degToRad(this.model.supportsTiles?90:180)),s=to.FORWARD.clone().applyQuaternion(a.multiply(this.quaternion)).add(this.position);o=s.clone().sub(this.position),n=THREE.MathUtils.degToRad(32.5)}else this.panoVideo&&(o=this.panoVideo.dir.clone(),n=THREE.MathUtils.degToRad(this.panoVideo.hfov/2));return o&&(t="across"==e?function(e,t){var n=(new THREE.Vector3).subVectors(e,r.position).setY(0).normalize(),a=(new THREE.Vector3).subVectors(t,r.position).setY(0).normalize(),s=(new THREE.Vector3).addVectors(n,a).normalize(),l=n.angleTo(s),c=(new THREE.Vector3).addVectors(r.position,o);return i.filters.isInFanAngle(r.position,s,l)(c)}:i.filters.isInFanAngle(this.position,o,n)),t}},{key:"addLabel",value:function(){this.label=new Ce(Object.assign({player:this.$app.core.get("Player")},oo,{text:this.appId}));var e=ge.linearClamp(this.label.text.length,2,6,.38,.19);this.label.scale.set(e,e,e),this.marker.add(this.label)}},{key:"addLabel2",value:function(){this.removeLabel(),this.label2=new Ce(Object.assign({player:this.$app.core.get("Player"),sizeInfo:{minSize:50,maxSize:300,nearBound:.2,farBound:Math.max(20,this.model.size.length()/3),farBoundPlan:250}},ro,{text:"".concat(this.id,"-f").concat(this.floorIndex)}));var e=this.floorPosition.clone();e.y+=.4,this.label2.position.copy(e),this.floor.add(this.label2)}},{key:"removeLabel",value:function(){this.label2&&(this.floor.remove(this.label2),this.label2.material.dispose(),this.label2=null)}}]),i}();function lo(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}so.raycastsSkipped=0,so.raycastsDone=0,so.filters={inDirection:function(e,t,n){return function(i){return i.position.clone().sub(e).normalize().dot(t)>n}},inFloorDirection:function(e,t,n){return function(i){return i.floorPosition.clone().sub(e).normalize().dot(t)>n}},inFloorDirection_2d:function(e,t,n){return function(i){var o=new THREE.Vector2(i.floorPosition.x,i.floorPosition.z),r=new THREE.Vector2(e.x,e.z);return o.sub(r).normalize().dot(new THREE.Vector2(t.x,t.z))>n}},inPanoDirection:function(e,t,n){return n=at.navigation.panoScores?at.navigation.filterStrictness:n,function(i){var o=i.floorPosition.clone().sub(e).normalize(),r=i.position.clone().sub(e).normalize();return o.dot(t)>n||r.dot(t)>n}},atFloor:function(e){return function(t){return!e||t.floor===e}},not:function(e){return function(t){return t!==e}},notIn:function(e){return function(t){return-1===e.indexOf(t)}},isLoaded:function(){return function(e){return e.isLoaded()}},isNotLoaded:function(){return function(e){return!e.isLoaded()}},isCloseEnoughTo:function(e,t){return function(n){return e.distanceTo(n.floorPosition)<t}},isClampDisSquaredTo:function(e,t,n){return function(i){var o=e.distanceToSquared(i.floorPosition);return o>t&&o<n}},hasMinimumHeightDifferenceTo:function(e,t){return function(n){return Math.abs(n.position.y-e.y)>t}},isNotBehindNormal:function(e,t){var n=new THREE.Vector3;return t=t.clone(),function(i){return n.copy(i.position).sub(e).normalize().dot(t)>0}},isNeighbourPanoTo:function(e){return function(t){return!e||!e.neighbourPanos||!!e.neighbourPanos[t.id]}},isNeighbourOfNeighbourTo:function(e){return function(t){return!!e.neighbourPanos[t.id]||e.neighbourUUIDs.some((function(n){var i=e.model.panos.get(n);return!!i&&i.neighbourPanos[t.id]}))}},isNotRecentlyFailed:function(e){return function(t){return Date.now()-t.failedLoadingAt>e}},isOnVisibleFloor:function(){return function(e){return!e.floor.hidden}},isPanoAligned:function(){return function(e){return e.isAligned()}},isInFanAngle:function(e,t,n){return function(i){var o=t.setY(0),r=i.clone().sub(e).setY(0);return o.angleTo(r)<=n}}},so.sortFunctions={distanceToPoint:function(e){return function(t,n){return t.position.distanceTo(e)-n.position.distanceTo(e)}},floorDistanceToPoint:function(e){return function(t,n){return t.floorPosition.distanceTo(e)-n.floorPosition.distanceTo(e)}},choose:function(e){return function(t,n){return e.id===t.id?-1:e.id===n.id?1:0}}},so.scoreFunctions={distance:function(e,t){return t=t||at.navigation.distanceFactor,function(n){return e?e.position.distanceTo(n.position)*t:0}},distanceSquared:function(e,t){return t=t||at.navigation.distanceFactor,function(n){return e?e.position.distanceToSquared(n.position)*t:0}},direction:function(e,t,n){return function(i){return i.position.clone().sub(e).normalize().dot(t)*(n||at.navigation.directionFactor)}},directionFloor:function(e,t){return function(n){return n.floorPosition.clone().sub(e).normalize().dot(t)*at.navigation.directionFactor}},angle:function(e,t){return function(n){return n.position.clone().sub(e).normalize().angleTo(t)*at.navigation.angleFactor}},inFieldOfView:function(e,t){return function(n){return n.position.clone().sub(e).normalize().dot(t)>.75?10:-1}},optionality:function(e){return function(t){return t.neighbourUUIDs.filter((function(t){return!(t in e.neighbourUUIDs)&&t!==e.id})).length*at.navigation.optionalityFactor}},penalizeHeightDifferenceUnder:function(e,t){return function(n){return e.y-n.position.y<t?-20:0}}};var co=function(e){f(n,e);var t=lo(n);function n(e){var i;return o(this,n),(i=t.call(this)).neighbourMap={},i.map=null,i.animatePanoId=null,e&&e.TourManager.player.then((function(e){e.on("play2",(function(){i.list.forEach((function(e){e.label&&De.updateVisible(e.label,"recordTour",!1)}))})),e.on("end",(function(){i.list.forEach((function(e){e.label&&De.updateVisible(e.label,"recordTour",!0)}))})),e.on("pause",(function(){i.list.forEach((function(e){e.label&&De.updateVisible(e.label,"recordTour",!0)}))}))})),i}return u(n,[{key:"getIndex",value:function(e){return e.id}},{key:"find",value:function(e,t){var n=De.filterAll(this.list,e);return 0===n.length?null:(t&&t.forEach((function(e){n=De.stableSort(n,e)})),n[0])}},{key:"lowestByScore",value:function(e,t,n){return this.findRankedByScore(0,e,t,n)}},{key:"findRankedByScore",value:function(e,t,n,i){i&&(i.candidates=null,i.pano=null),e||(e=0);var o=De.sortByScore(this.list,t,n);return!o||0===o.length||e>=o.length?null:(i&&(i.candidates=o,i.pano=o[e].item),o[e].item)}},{key:"getNeighbours",value:function(e){return this.neighbourMap[e.id]}},{key:"setNeighbour",value:function(e,t,n){return this.neighbourMap[e.id]||(this.neighbourMap[e.id]={}),this.neighbourMap[t.id]||(this.neighbourMap[t.id]={}),this.neighbourMap[e.id][e.id]=!0,this.neighbourMap[t.id][t.id]=!0,this.neighbourMap[e.id][t.id]=n,this.neighbourMap[t.id][e.id]=n,this.neighbourMap[e.id]}},{key:"findClosest",value:function(e,t){var n=[so.filters.isPanoAligned()];return t&&n.push(so.filters.inDirection(e,t,.75)),this.find(n,[so.sortFunctions.distanceToPoint(e)])}},{key:"fadeMarkerOpacity",value:function(e,t,n){if(Ae.cancelById("fadeMarkerOpacity"),this.list.findIndex((function(e){return e.marker}))<0)logger.info("marker findIndex<0");else{var i,o=function(e,n){e.member=e.member.filter((function(t){return t.marker&&t.marker.material.opacity!=e.toOp})),Ae.trigger({func:function(t,n){e.member.forEach((function(n){var i=n.marker.oldOpacity,o=i+t*(e.toOp-i);n.marker&&(n.marker.material.opacity=o)}))}.bind(this),duration:null==t?at.markerOpacityTransitionTime:t,name:"_fpm_"+n,id:"fadeMarkerOpacity"})};this.forEach((function(e){e.marker&&(e.marker.oldOpacity=e.marker.material.opacity)})),i=(e=null==e?at.panorama.markerOpacity:e)>0&&n?n:[{member:this.list,toOp:e}];for(var r=0;r<i.length;r++)o(i[r],r)}}},{key:"closestPanoTowardPoint",value:function(e){var t=e.point,n=e.require||[],i={position:t},o=new THREE.Vector3,r=e.rank||[so.scoreFunctions.distanceSquared(i,-2)];e.force;var a=e.getAll,s=e.angleTolerDecrease||2;n.push(so.filters.isPanoAligned()),n.push((function(e){return e.hasNeighbor()})),n.push((function(e){o.copy(t).sub(e.position);var n=-THREE.MathUtils.radToDeg(Math.atan(o.y/Math.sqrt(o.x*o.x+o.z*o.z))),i=at.insideFOV/2-s,r=at.insideLookLimitDown-i,a=at.insideLookLimitUp+i;return r<n&&n<a})),e.floor&&n.push(so.filters.atFloor(e.floor));var l=De.sortByScore(this.list,n,r);return a?l:l&&l.length>0&&l[0].item}}]),n}(It);function uo(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}var ho=function(e){f(n,THREE.Mesh);var t=uo(n);function n(e,i){var r,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:50;o(this,n),e=e.clone().expandByVector(new THREE.Vector3(a,a,a));var s=new THREE.Vector3;e.getSize(s);var l=new THREE.BoxGeometry(s.x,s.y,s.z);l.computeBoundingBox(),r=t.call(this,l,i);var c=new THREE.Vector3;return e.getCenter(c),a&&(c.y+=a-.1),r.position.copy(c),r.frustumCulled=!1,r}return n}();function po(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}var fo=function(e){f(n,THREE.RawShaderMaterial);var t=po(n);function n(e,i){var r;if(o(this,n),(e=e||{}).not_Cube){var a=e.defines||{};a.Not_Cube="",e.defines=a}i=i||"model";if((r=t.call(this,De.extendObject({fragmentShader:mn[i].fragmentShader,vertexShader:mn[i].vertexShader,uniforms:THREE.UniformsUtils.clone(mn[i].uniforms),name:"ModelTextureMaterial"},e))).uniforms.progress){var s=0;Object.defineProperty(r.uniforms.progress,"value",{get:function(){return s},set:function(e){e<1?"usePanoMap0"in r.defines||(r.defines.usePanoMap0="",r.needsUpdate=!0):"usePanoMap0"in r.defines&&(delete r.defines.usePanoMap0,r.needsUpdate=!0),s=e}})}return r}return u(n,[{key:"setProjectedPanos",value:function(e,t,n){var i=this;if("BasePanoMap"in this.defines||(n&&(this.uniforms.progress.value=0),e.ensureSkyboxReadyForRender(),t.ensureSkyboxReadyForRender(),this.updateTexDefines(e,t)),this.uniforms.pano0Map.value=e.getSkyboxTexture(),this.uniforms.pano0Position.value.copy(e.position),this.uniforms.pano0Matrix.value.copy(e.matrixWorld),this.uniforms.pano1Map.value=t.getSkyboxTexture(),this.uniforms.pano1Position.value.copy(t.position),this.uniforms.pano1Matrix.value.copy(t.matrixWorld),delete this.defines.HasVideo,t.hasVideo){this.uniforms.exposure.value=t.videoInfo.exposure||1,this.uniforms.blendFov.value=t.videoInfo.blendFov||5,t.videoInfo.clipRect&&this.uniforms.clipRect.value.set(t.videoInfo.clipRect.leftBottom.x,t.videoInfo.clipRect.leftBottom.y,t.videoInfo.clipRect.rightTop.x,t.videoInfo.clipRect.rightTop.y),this.defines.VideoMapping=t.videoInfo.mapping||0,this.defines.HasVideo=t.videoInfo.cameraType||8;var o=t.panoVideoRenderer.videoPlayer,r=o._resource?o._resource.get(t.id).video:o.instances.get(t.id).videoElement;0==r.readyState?r.addEventListener("resize",(function(e){i.uniforms.bFlag.value=r.videoWidth>r.videoHeight?1:0}),!1):this.uniforms.bFlag.value=r.videoWidth>r.videoHeight?1:0}t.hasFilter||e.hasFilter?this.defines.hasFilter=!0:delete this.defines.hasFilter,this.needsUpdate=!0}},{key:"updateTexDefines",value:function(e,t){var n=this,i=!1,o=function(e,t){e.tiled?null!=n.defines["Not_Cube_"+t]&&(delete n.defines["Not_Cube_"+t],i=!0):null==n.defines["Not_Cube_"+t]&&(n.defines["Not_Cube_"+t]="",i=!0)};o(e,0),o(t,1),i&&(this.needsUpdate=!0)}}]),n}();function mo(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}var vo=function(e){f(n,e);var t=mo(n);function n(e,i){var r;o(this,n),ft.time("Computing a nice bounding cubemap");var a=new fo({side:THREE.BackSide,transparent:!0});return a.uniforms.modelAlpha.value=0,a.uniforms.opacity.value=1-at.modelAlpha,(r=t.call(this,e,a,i)).renderOrder=ze,ft.timeEnd("Computing a nice bounding cubemap"),r}return n}(ho);function go(){}go.prototype={on:function(e,t,n){var i=this.e||(this.e={});return(i[e]||(i[e]=[])).push({fn:t,ctx:n}),this},once:function(e,t,n){var i=this;function o(){i.off(e,o),t.apply(n,arguments)}return o._=t,this.on(e,o,n)},emit:function(e){for(var t=[].slice.call(arguments,1),n=((this.e||(this.e={}))[e]||[]).slice(),i=0,o=n.length;i<o;i++)n[i].fn.apply(n[i].ctx,t);return this},off:function(e,t){var n=this.e||(this.e={}),i=n[e],o=[];if(i&&t)for(var r=0,a=i.length;r<a;r++)i[r].fn!==t&&i[r].fn._!==t&&o.push(i[r]);return o.length?n[e]=o:delete n[e],this}};var yo=go,Ao=go;yo.TinyEmitter=Ao;var Eo={map:{type:"t",value:null},opacity:{type:"f",value:1},opaRadius:{type:"f",value:.2}},bo="\n varying vec2 vUv;\n void main() {\n vUv = uv; gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n }",wo="uniform sampler2D map; \n uniform float opacity;\n uniform float opaRadius;\n varying vec2 vUv; \n void main() {\n vec2 vUv2 = vec2(vUv.x*2.0 - 1.0, vUv.y*2.0 - 1.0); \n vec4 colorFromTexture = texture2D( map, vUv ); \n float opa = 1.0; \n float r = vUv2.x*vUv2.x + vUv2.y*vUv2.y; \n if(r > 1.0) opa = 0.0; \n else if(r < opaRadius)opa = 1.0; \n else{\t\n float a = -1.0 / ((opaRadius - 1.0)*(opaRadius - 1.0));\n float b = -2.0 * a * opaRadius;\t\n float c = 1.0 + a * opaRadius * opaRadius; \n opa = a * r*r + b * r + c; \n } \n gl_FragColor = vec4(colorFromTexture.rgb, opacity * colorFromTexture.a * opa );\n }\n ";function xo(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}var Co=new THREE.TextureLoader,To={floorLogo:{name:"floorLogoImg.png",geometry:new THREE.Vector4(2.5,2.5,1,1),size:100,position:new THREE.Vector3(0,-1.49,0),renderOrder:99}},Io=new THREE.PlaneGeometry(2.5,2.5,1,1),ko=function(e){f(n,e);var t=xo(n);function n(e){var i,r;return o(this,n),(i=t.call(this)).changefloorLogoOpa=function(e){var t=0==e.index?this.firstLogo:this.secondLogo;Ae.cancelById("flOpa_"+e.index),null!=e.from&&(t.material.opacity=e.from),e.dur?Ae.start(St.property(t.material,"opacity",e.opa),e.dur||0,null,e.delay||0,ye.easeInQuad,"changefloorLogoOpa","flOpa_"+e.index):t.material.opacity=e.opa},i.updateFloorlogo=(r=new THREE.Quaternion,function(e){var t,n;if(!this.fixDirection&&e&&this.ready&&((this.firstLogo.visible||0!=this.firstLogo.material.opacity||this.secondLogo.visible||0!=this.secondLogo.material.opacity)&&(n=!0),n)){var i,o=this.app.core.get("Player").camera.quaternion;if((i=ht.closeTo(o,r,5))||(r=o.clone()),!i){var a=this.app.core.get("Player").getDirection(),s=ge.getYawByDir(a);this.isCompass&&this.compassArrow1?(t=new THREE.Euler(0,0,s-this.firstLogo.rotation.z),this.compassArrow1.rotation.copy(t),this.compassArrow2.rotation.copy(t)):(t=new THREE.Euler(-Math.PI/2,0,s),this.firstLogo.rotation.copy(t),this.secondLogo.rotation.copy(t))}}}),i.setDir=function(e){this.fixDirection&&(this.firstLogo.rotation.z=THREE.MathUtils.degToRad(-e),this.secondLogo.rotation.z=THREE.MathUtils.degToRad(-e))},i.app=e,i.ready=!1,i.fixDirection=!1,i.baseSize=1,i.curSize=1,i.firstLogo=new THREE.Mesh(Io,new THREE.MeshBasicMaterial({transparent:!0,depthWrite:!1,depthTest:!1})),i.secondLogo=i.firstLogo.clone(),i.secondLogo.material=i.firstLogo.material.clone(),De.updateVisible(i.secondLogo,"flyToPano",!1),i.app.store.on("flooruser",(function(e){setTimeout((function(){i.setCompassAngle()}),30)})),i}return u(n,[{key:"bindEvents",value:function(){}},{key:"createFloorLogo",value:function(){var e=this,t=this.getLogo(),n=t.url,i=t.size/100;this.setSize(i),this.setLogoMesh(this.firstLogo),this.setLogoMesh(this.secondLogo);var o=function(){e.firstLogo.material.needsUpdate=!0,e.secondLogo.material.needsUpdate=!0,De.updateVisible(e.firstLogo,"unready",!0),De.updateVisible(e.secondLogo,"unready",!0),e.emit("ready"),e.ready=!0};if(t.isCompass)this.app.core.get("Player").cameraControls.controls.panorama.insideLookLimitDown=-60,this.changeToCompass(o);else var r=Co.load(n,(function(){e.changeTex(r),o()}))}},{key:"setLogoMesh",value:function(e){return e.name="floorlogo",e.position.set(To.floorLogo.position.x,To.floorLogo.position.y,To.floorLogo.position.z),e.rotation.set(-Math.PI/2,0,0),e.renderOrder=To.floorLogo.renderOrder,De.updateVisible(e,"unready",!1),De.updateVisible(e,"outside",!1),e}},{key:"changeTex",value:function(e,t){var n=this.firstLogo.material;n.map&&n.map.dispose();var i=this.getTex(e,t);this.firstLogo.material.map=i,this.secondLogo.material.map=i}},{key:"changeToCompass",value:function(e){var t=this;this.isCompass=!0;var n=0,i=function(i){2==++n&&(t.changeTex(r,1),t.compassArrow1||(t.compassArrow1=new THREE.Mesh(Io,new THREE.MeshBasicMaterial({map:o,transparent:!0,side:THREE.SingleSide,depthTest:!1})),t.compassArrow1.name="compassArrow",t.firstLogo.add(t.compassArrow1),t.compassArrow1.position.set(0,0,.01),t.compassArrow2=t.compassArrow1.clone(),t.secondLogo.add(t.compassArrow2),t.compassArrow1.renderOrder=t.compassArrow2.renderOrder=To.floorLogo.renderOrder+1),t.compassArrow1.visible=t.compassArrow2.visible=!0,t.setCompassAngle(),t.baseSize=.64,t.setSize(),e&&e())},o=Co.load(this.app.resource.getAppURL("images/floorlogos/compass_arrow.png"),i),r=Co.load(this.app.resource.getAppURL("images/floorlogos/compass_floor.png"),i)}},{key:"setCompassAngle",value:function(){if(this.isCompass){var e=-THREE.MathUtils.degToRad(this.app.core.get("Player").compass.angle);this.firstLogo.rotation.set(-Math.PI/2,0,e),this.secondLogo.rotation.set(-Math.PI/2,0,e)}}},{key:"changeFloorLogo",value:function(e){if(this.ready){if(e.isCompass)this.changeToCompass();else if("url"in e||"id"in e||"image"in e)if(this.isCompass=!1,this.compassArrow1&&(this.compassArrow1.visible=this.compassArrow2.visible=!1),e.url)Co.load(e.url,this.changeTex.bind(this));else if(e.id)Co.load(this.app.resource.getAppURL("images/floorlogos/".concat(e.id,".png")),this.changeTex.bind(this));else if(e.image){var t=new THREE.Texture(e.image);t.needsUpdate=!0,this.changeTex(t)}e.size&&this.setSize(e.size/100)}}},{key:"setSize",value:function(e){e&&(this.curSize=e);var t=this.curSize*this.baseSize;this.firstLogo.scale.set(t,t,t),this.secondLogo.scale.set(t,t,t)}},{key:"getTex",value:function(e,t){var n=THREE.UniformsUtils.clone(Eo);n.map.value=e;var i=new THREE.ShaderMaterial({fragmentShader:wo,vertexShader:bo,uniforms:n,side:THREE.SingleSide,transparent:!0,premultipliedAlpha:!0});null!=t&&(i.uniforms.opaRadius.value=t),i.needsUpdate=!0;var o=De.renderTex(i,this.app.core.get("SceneRenderer").renderer,{x:e.image.width,y:e.image.height});return i.dispose(),o.anisotropy=5,o}},{key:"getLogo",value:function(){var e=this.app.store.getValue("metadata"),t="",n=e.floorLogoSize||100,i=0===parseInt(e.floorLogoType);if(!i){var o=this.app.config.scene.floorlogoId||e.floorLogo||"0";"zh"!=this.app.config.lang&&(o="en/"+o),"aws"==this.app.config.region&&(o="aws/"+o),t="user"===e.floorLogo?this.app.resource.getUserResourceURL(e.floorLogoFile):this.app.resource.getAppURL("images/floorlogos/".concat(o,".png"))}return{url:t,size:n,isCompass:i}}}]),n}(yo);function Bo(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}var Po=THREE.BoxBufferGeometry,Ro=THREE.BufferGeometry,Mo=THREE.Color,So=THREE.CylinderBufferGeometry,Do=THREE.DoubleSide,Lo=THREE.Euler,Fo=THREE.Float32BufferAttribute,Ho=THREE.Line;THREE.LineBasicMaterial;var Vo=THREE.Matrix4,Oo=THREE.Mesh,Qo=THREE.MeshBasicMaterial,_o=THREE.Object3D,zo=THREE.OctahedronBufferGeometry,Uo=THREE.PlaneBufferGeometry,No=THREE.Quaternion;THREE.Raycaster;var Go,jo,Wo,qo,Jo,Yo,Zo,Xo=THREE.TorusBufferGeometry,Ko=new THREE.Raycaster,$o=new THREE.Vector3,er=new THREE.Vector3,tr=new THREE.Quaternion,nr={X:new THREE.Vector3(1,0,0),Y:new THREE.Vector3(0,1,0),Z:new THREE.Vector3(0,0,1)},ir=new THREE.Vector3,or=new THREE.Vector3,rr=new THREE.Vector3,ar=new THREE.Vector3,sr=new THREE.Vector3,lr=new THREE.Vector3,cr=0,ur=new THREE.Vector3,hr=new THREE.Quaternion,dr=new THREE.Vector3,pr=new THREE.Vector3,fr=new THREE.Quaternion,mr=new THREE.Quaternion,vr=new THREE.Vector3,gr=new THREE.Vector3,yr=new THREE.Quaternion,Ar=new THREE.Vector3,Er=new THREE.Vector3,br=new THREE.Quaternion,wr=new THREE.Quaternion,xr=new THREE.Vector3,Cr=new THREE.Vector3,Tr=new THREE.Vector3,Ir=new THREE.Quaternion,kr=new THREE.Vector3,Br=0,Pr=new THREE.Vector3,Rr=new THREE.Vector3,Mr=new THREE.Vector3,Sr=1,Dr=function(e){f(n,THREE.Object3D);var t=Bo(n);function n(e,i,r){var a;return o(this,n),a=t.call(this),void 0===i&&(console.warn('THREE.TransformControls: The second parameter "domElement" is now mandatory.'),i=document),a.visible=!1,a.domElement=i,Yo=new Lr(r),a.add(Yo),Zo=new Nr(r),a.add(Zo),a.player=r.player,a.options=r,Go={type:"change"},jo={type:"mouseDown"},qo={type:"mouseUp",mode:a.mode},Wo={type:"mousing"},Jo={type:"objectChange"},a.defineProperty("camera",e),a.defineProperty("object",void 0),a.defineProperty("enabled",!0),a.defineProperty("axis",null),a.defineProperty("mode","translate"),a.defineProperty("translationSnap",null),a.defineProperty("rotationSnap",null),a.defineProperty("scaleSnap",null),a.defineProperty("space","world"),a.defineProperty("spaceForRotate",null),a.defineProperty("size",1),a.defineProperty("dragging",!1),a.defineProperty("showX",!0),a.defineProperty("showY",!0),a.defineProperty("showZ",!0),a.defineProperty("worldPosition",Er),a.defineProperty("worldPositionStart",gr),a.defineProperty("worldQuaternion",br),a.defineProperty("worldQuaternionStart",yr),a.defineProperty("cameraPosition",ur),a.defineProperty("cameraQuaternion",hr),a.defineProperty("pointStart",ir),a.defineProperty("pointEnd",or),a.defineProperty("rotationAxis",ar),a.defineProperty("rotationAngle",cr),a.defineProperty("eye",Cr),i.addEventListener("mousedown",a.onPointerDown.bind(h(a)),!1),i.addEventListener("touchstart",a.onPointerDown.bind(h(a)),!1),i.addEventListener("mousemove",a.onPointerHover.bind(h(a)),!1),i.addEventListener("touchmove",a.onPointerHover.bind(h(a)),!1),i.addEventListener("touchmove",a.onPointerMove.bind(h(a)),!1),window.addEventListener("mouseup",a.onPointerUp.bind(h(a)),!1),window.addEventListener("pointerup",a.onPointerUp.bind(h(a)),!1),i.addEventListener("touchend",a.onPointerUp.bind(h(a)),!1),i.addEventListener("touchcancel",a.onPointerUp.bind(h(a)),!1),i.addEventListener("touchleave",a.onPointerUp.bind(h(a)),!1),a.isTransformControls=!0,a}return u(n,[{key:"dispose",value:function(){domElement.removeEventListener("mousedown",this.onPointerDown.bind(this)),domElement.removeEventListener("touchstart",this.onPointerDown.bind(this)),domElement.removeEventListener("mousemove",this.onPointerHover.bind(this)),document.removeEventListener("mousemove",this.onPointerMove.bind(this)),domElement.removeEventListener("touchmove",this.onPointerHover.bind(this)),domElement.removeEventListener("touchmove",this.onPointerMove.bind(this)),window.removeEventListener("mouseup",this.onPointerUp.bind(this),!1),window.removeEventListener("pointerup",this.onPointerUp.bind(this),!1),domElement.removeEventListener("touchend",this.onPointerUp.bind(this)),domElement.removeEventListener("touchcancel",this.onPointerUp.bind(this)),domElement.removeEventListener("touchleave",this.onPointerUp.bind(this)),this.traverse((function(e){e.geometry&&e.geometry.dispose(),e.material&&e.material.dispose()}))}},{key:"attach",value:function(e){return this.object=e,this.visible=!0,W.isTyping=!0,this}},{key:"detach",value:function(){return this.object=void 0,this.visible=!1,this.axis=null,W.isTyping=!1,this}},{key:"setSize",value:function(e,t){}},{key:"switchEditState",value:function(e){var t=JSON.stringify(this.options.scaleAxis);"overlay"==e?(this.options.NoScaleZ=!0,this.options.scaleAxis=["x","y"]):"panovideo"==e?(this.mode="scale",this.options.NoScaleZ=!0,this.options.scaleAxis=["x","y"]):("decoration"==e||"clipbox"==e)&&(this.options.NoScaleZ=!1,this.options.scaleAxis=["x","y","z"]),t!=JSON.stringify(this.options.scaleAxis)&&this.rebuildAxis("scale"),this.editState=e}},{key:"filterRotateAxis",value:function(e){var t=JSON.stringify(this.options.rotateAxis);this.options.rotateAxis=e,t!=JSON.stringify(this.options.rotateAxis)&&this.rebuildAxis("rotate")}},{key:"rebuildAxis",value:function(e){Yo.gizmo[e].removeFromParent(),Yo.picker[e].removeFromParent(),Yo.gizmo[e].traverse((function(e){e.geometry&&e.geometry.dispose(),e.material&&e.material.dispose()})),Yo.picker[e].traverse((function(e){e.geometry&&e.geometry.dispose(),e.material&&e.material.dispose()}));var t=Yo["update"+e.charAt(0).toUpperCase()+e.slice(1)](),n=t.gizmo,i=t.picker;Yo.add(Yo.gizmo[e]=Yo.setupGizmo(n)),Yo.add(Yo.picker[e]=Yo.setupGizmo(i)),Yo.picker[e].visible=!1}},{key:"handleDragStart",value:function(){this.editState&&this.onPointerDown()}},{key:"handleDragging",value:function(){this.editState&&this.onPointerMove()}},{key:"handleDragEnd",value:function(){this.editState&&this.onPointerUp()}},{key:"defineProperty",value:function(e,t){var n=t;Object.defineProperty(this,e,{get:function(){return void 0!==n?n:t},set:function(t){n!==t&&(n=t,Zo[e]=t,Yo[e]=t,this.dispatchEvent({type:e+"-changed",value:t}),this.dispatchEvent(Go))}}),this[e]=t,Zo[e]=t,Yo[e]=t}},{key:"updateMatrixWorld",value:function(){void 0!==this.object&&(this.object.updateMatrixWorld(),this.object.parent.matrixWorld.decompose(pr,fr,vr),this.object.matrixWorld.decompose(Er,br,xr),mr.copy(fr).invert(),wr.copy(br).invert()),this.camera.updateMatrixWorld(),this.camera.matrixWorld.decompose(ur,hr,dr),Cr.copy(ur).sub(Er).normalize(),_o.prototype.updateMatrixWorld.call(this)}},{key:"pointerHover",value:function(e){if(void 0!==this.object&&!0!==this.dragging&&(void 0===e.button||0===e.button)){var t=new THREE.Vector3(e.x,e.y,-1).unproject(this.camera);Ko.set(t,this.player.getMouseDirection(e));var n=Ko.intersectObjects(Yo.picker[this.mode].children,!0)[0]||!1;n?(this.axis=n.object.name,this.intersect=n.object,this.player.domElement.style.cursor="pointer"):(this.intersect=null,this.axis=null,this.player.domElement.style.cursor="")}}},{key:"pointerDown",value:function(e){if(!(void 0===this.object||!0===this.dragging||void 0!==e.button&&0!==e.button||0!==e.button&&void 0!==e.button||null===this.axis)){var t=new THREE.Vector3(e.x,e.y,-1).unproject(this.camera);Ko.set(t,this.player.getMouseDirection(e));var n=Ko.intersectObjects([Zo],!0)[0]||!1;if(n){var i=this.space;if("scale"===this.mode?i="local":"E"!==this.axis&&"XYZE"!==this.axis&&"XYZ"!==this.axis||(i="world"),"local"===i&&"rotate"===this.mode){var o=this.rotationSnap;"X"===this.axis&&o&&(this.object.rotation.x=Math.round(this.object.rotation.x/o)*o),"Y"===this.axis&&o&&(this.object.rotation.y=Math.round(this.object.rotation.y/o)*o),"Z"===this.axis&&o&&(this.object.rotation.z=Math.round(this.object.rotation.z/o)*o)}this.object.updateMatrixWorld(),this.object.parent.updateMatrixWorld(),Tr.copy(this.object.position),Ir.copy(this.object.quaternion),kr.copy(this.object.scale),this.object.matrixWorld.decompose(gr,yr,Ar),ir.copy(n.point).sub(gr),"clipbox"==this.editState&&this.axis&&nr[this.axis]&&(Rr.copy(ir),Sr=Math.sign(this.intersect.scale[this.axis.toLowerCase()]),Pr.copy(nr[this.axis]).multiplyScalar(Sr),Mr.copy(Pr).applyQuaternion(Ir).multiplyScalar(1e5)),this.player.cameraControls.activeControl&&(this.player.cameraControls.activeControl.enabled=!1)}this.dragging=!0,jo.mode=this.mode,this.dispatchEvent(jo)}}},{key:"pointerMove",value:function(e){var t=this.axis,n=this.mode,i=this.object,o=this.space;if("scale"===n?o="local":"E"!==t&&"XYZE"!==t&&"XYZ"!==t||(o="world"),void 0!==i&&null!==t&&!1!==this.dragging&&(void 0===e.button||0===e.button)){var r=new THREE.Vector3(e.x,e.y,-1).unproject(this.camera);Ko.set(r,this.player.getMouseDirection(e));var a=Ko.intersectObjects([Zo],!0)[0]||!1;if(!1!==a){if(or.copy(a.point).sub(gr),"translate"===n){if(rr.copy(or).sub(ir),"local"===o&&"XYZ"!==t&&rr.applyQuaternion(wr),-1===t.indexOf("X")&&(rr.x=0),-1===t.indexOf("Y")&&(rr.y=0),-1===t.indexOf("Z")&&(rr.z=0),"local"===o&&"XYZ"!==t?rr.applyQuaternion(Ir).divide(vr):rr.applyQuaternion(mr).divide(vr),i.overlayType){var s=i.floor.boundingBox.min.y-rr.y-Tr.y;s>0&&s<.024&&(rr.y=i.floor.boundingBox.min.y-Tr.y)}rr.y*=Math.sign(i.scale.y),rr.z*=Math.sign(i.scale.z),i.position.copy(rr).add(Tr),this.translationSnap&&("local"===o&&(i.position.applyQuaternion(tr.copy(Ir).invert()),-1!==t.search("X")&&(i.position.x=Math.round(i.position.x/this.translationSnap)*this.translationSnap),-1!==t.search("Y")&&(i.position.y=Math.round(i.position.y/this.translationSnap)*this.translationSnap),-1!==t.search("Z")&&(i.position.z=Math.round(i.position.z/this.translationSnap)*this.translationSnap),i.position.applyQuaternion(Ir)),"world"===o&&(i.parent&&i.position.add($o.setFromMatrixPosition(i.parent.matrixWorld)),-1!==t.search("X")&&(i.position.x=Math.round(i.position.x/this.translationSnap)*this.translationSnap),-1!==t.search("Y")&&(i.position.y=Math.round(i.position.y/this.translationSnap)*this.translationSnap),-1!==t.search("Z")&&(i.position.z=Math.round(i.position.z/this.translationSnap)*this.translationSnap),i.parent&&i.position.sub($o.setFromMatrixPosition(i.parent.matrixWorld))))}else if("scale"===n){if(-1!==t.search("XYZ")){var l=or.length()/ir.length();or.dot(ir)<0&&(l*=-1),this.options.NoScaleZ?er.set(l,l,1):er.set(l,l,l)}else if(-1!==t.search("XY")){l=or.length()/ir.length();or.dot(ir)<0&&(l*=-1),er.set(l,l,1)}else $o.copy(ir),er.copy(or),$o.applyQuaternion(wr),er.applyQuaternion(wr),er.divide($o),-1===t.search("X")&&(er.x=1),-1===t.search("Y")&&(er.y=1),-1===t.search("Z")&&(er.z=1);if("overlay"==this.editState||"decoration"==this.editState){"overlay"==this.editState&&(kr.x*=at.overlay.width,kr.y*=at.overlay.height);var c,u=["x","y","z"],h={min:{v:1/0},max:{v:-1/0}};u.forEach((function(e){if(er[e]=Math.abs(er[e]),1!=er[e]){var t=er[e]*kr[e];t<h.min.v?(h.min.axis=e,h.min.v=t):t>h.min.v&&(h.max.axis=e,h.max.v=t)}})),h.min.v<.1?c=.1/kr[h.min.axis]:h.max.v>10&&(c=10/kr[h.max.axis]),c&&u.forEach((function(e){1!=er[e]&&(er[e]=c)})),"overlay"==this.editState&&(kr.x/=at.overlay.width,kr.y/=at.overlay.height)}if("clipbox"==this.editState&&t&&nr[t]){var d=or.clone(),p=Rr.clone(),f=d.distanceTo(Mr),m=p.distanceTo(Mr),v=-Math.sign(f-m);rr.copy(or).sub(Rr),Rr.copy(or),"local"===o&&"XYZ"!==t&&rr.applyQuaternion(wr),-1===t.indexOf("X")&&(rr.x=0),-1===t.indexOf("Y")&&(rr.y=0),-1===t.indexOf("Z")&&(rr.z=0),"local"===o&&"XYZ"!==t?rr.applyQuaternion(Ir).divide(vr):rr.applyQuaternion(mr).divide(vr),rr.y*=Math.sign(i.scale.y),rr.z*=Math.sign(i.scale.z);var g=Pr.clone().multiplyScalar(rr.length()*Sr*v),y=rr.clone().multiplyScalar(.5);i.scale.add(g),i.scale.x=Math.max(.1,i.scale.x),i.scale.y=Math.max(.1,i.scale.y),i.scale.z=Math.max(.1,i.scale.z),i.position.add(y)}else i.scale.copy(kr).multiply(er);this.scaleSnap&&(-1!==t.search("X")&&(i.scale.x=Math.round(i.scale.x/this.scaleSnap)*this.scaleSnap||this.scaleSnap),-1!==t.search("Y")&&(i.scale.y=Math.round(i.scale.y/this.scaleSnap)*this.scaleSnap||this.scaleSnap),-1!==t.search("Z")&&(i.scale.z=Math.round(i.scale.z/this.scaleSnap)*this.scaleSnap||this.scaleSnap)),"overlay"==this.editState&&(i.width=at.overlay.width*i.scale.x,i.height=at.overlay.height*i.scale.y,this.player.EditOverlay.updateOverlayScaleDisplay())}else if("rotate"===n){if(rr.copy(or).sub(ir),"floorplan"==this.player.mode)var A=this.player.cameraControls.cameras.floorplan,E=5/((A.right-A.left)/A.aspect);else E=5/Er.distanceTo($o.setFromMatrixPosition(this.camera.matrixWorld));"E"===t?(ar.copy(Cr),cr=or.angleTo(ir),sr.copy(ir).normalize(),lr.copy(or).normalize(),cr*=lr.cross(sr).dot(Cr)<0?1:-1):"XYZE"===t?(ar.copy(rr).cross(Cr).normalize(),cr=rr.dot($o.copy(ar).cross(this.eye))*E):"X"!==t&&"Y"!==t&&"Z"!==t||(ar.copy(nr[t]),$o.copy(nr[t]),"local"===o&&$o.applyQuaternion(br),cr=rr.dot($o.cross(Cr).normalize())*E),this.rotationSnap&&(cr=Math.round(cr/this.rotationSnap)*this.rotationSnap),this.rotationAngle=cr;var b="local"===o;this.spaceForRotate&&("X"===t&&(b="local"===this.spaceForRotate.x),"Y"===t&&(b="local"===this.spaceForRotate.y),"Z"===t&&(b="local"===this.spaceForRotate.z)),b&&"E"!==t&&"XYZE"!==t?(i.quaternion.copy(Ir),i.quaternion.multiply(tr.setFromAxisAngle(ar,cr)).normalize()):(ar.applyQuaternion(mr),i.quaternion.copy(tr.setFromAxisAngle(ar,cr)),i.quaternion.multiply(Ir).normalize())}this.dispatchEvent(Object.assign(Wo,{mode:this.mode,state:this.editState,axis:t,angle:cr,deltaAngle:cr-Br})),this.dispatchEvent(Go),this.dispatchEvent(Jo),Br=cr}}}},{key:"pointerUp",value:function(e){void 0!==this.object&&(this.dragging&&null!==this.axis&&(qo.mode=this.mode,this.dispatchEvent(qo)),this.dragging=!1,void 0===e.button&&(this.axis=null),this.player.cameraControls.activeControl&&(this.player.cameraControls.activeControl.pointerDragOn=!1,this.player.cameraControls.activeControl.enabled=!0),Br=0)}},{key:"getPointer",value:function(e){if(e){if(document.pointerLockElement)return{x:0,y:0,button:e.button};var t=e.changedTouches?e.changedTouches[0]:e,n=domElement.getBoundingClientRect();return{x:(t.clientX-n.left)/n.width*2-1,y:-(t.clientY-n.top)/n.height*2+1,button:e.button}}console.log("hhahhhahah")}},{key:"onPointerHover",value:function(e){this.enabled&&this.pointerHover(this.player.mouse)}},{key:"onPointerDown",value:function(e){this.enabled&&(this.pointerHover(this.player.mouse),this.pointerDown(this.player.mouse))}},{key:"onPointerMove",value:function(e){this.enabled&&this.dragging&&this.pointerMove(this.player.mouse)}},{key:"onPointerUp",value:function(e){this.enabled&&this.pointerUp(this.player.mouse)}},{key:"getMode",value:function(){return this.mode}},{key:"setMode",value:function(e){this.mode=e}},{key:"setTranslationSnap",value:function(e){this.translationSnap=e}},{key:"setRotationSnap",value:function(e){this.rotationSnap=e}},{key:"setScaleSnap",value:function(e){this.scaleSnap=e}},{key:"setSpace",value:function(e){this.space=e}},{key:"update",value:function(){console.warn("THREE.TransformControls: update function has no more functionality and therefore has been deprecated.")}}]),n}(),Lr=function(e){f(n,THREE.Object3D);var t=Bo(n);function n(e){var i;o(this,n),(i=t.call(this)).type="TransformControlsGizmo",i.options=e,i.player=e.player;var r=new THREE.MeshBasicMaterial({depthTest:!1,depthWrite:!1,transparent:!0,side:Do,fog:!1}),a=new THREE.LineBasicMaterial({depthTest:!1,depthWrite:!1,transparent:!0,linewidth:1,fog:!1}),s=r.clone();s.opacity=.35;var l=r.clone();l.opacity=.1;var c=r.clone();c.color.set(16711680);var u=r.clone();u.color.set(65280);var h=r.clone();h.color.set(255);var d=r.clone();d.opacity=.75,d.color.set(15790320);var p=d.clone();p.color.set(16776960);var f=d.clone();f.color.set(65535);var m=d.clone();m.color.set(16711935),r.clone().color.set(16776960);var v=a.clone();v.color.set(16711680);var g=a.clone();g.color.set(65280);var y=a.clone();y.color.set(255),a.clone().color.set(65535),a.clone().color.set(16711935);var A=a.clone();A.color.set(16776960);var E=a.clone();E.color.set(7895160),A.clone().opacity=.25;var b=new So(0,.07,.2,12,1,!1),w=new Po(.125,.125,.125),x=new Ro;x.setAttribute("position",new Fo([0,0,0,1,0,0],3));var C={"x+":[{x:0,y:0,z:0},{x:.5,y:0,z:0}],"x-":[{x:0,y:0,z:0},{x:-.5,y:0,z:0}],"y+":[{x:0,y:0,z:0},{x:0,y:.5,z:0}],"y-":[{x:0,y:0,z:0},{x:0,y:-.5,z:0}],"z+":[{x:0,y:0,z:0},{x:0,y:0,z:.5}],"z-":[{x:0,y:0,z:0},{x:0,y:0,z:-.5}]},T={},I={x:yi.createFatLineMat({lineWidth:3,color:16711680,depthTest:!1,opacity:.9}),y:yi.createFatLineMat({lineWidth:3,color:65280,depthTest:!1,opacity:.9}),z:yi.createFatLineMat({lineWidth:3,color:255,depthTest:!1,opacity:.9})},k=function(e,t){var n=C[e],i=I[t],o=yi.createFatLine(n,{material:i});return T[e]=o.geometry,o.renderOrder=4,o},B=function(e,t){for(var n=new Ro,i=[],o=0;o<=64*t;++o)i.push(0,Math.cos(o/32*Math.PI)*e,Math.sin(o/32*Math.PI)*e);return n.setAttribute("position",new Fo(i,3)),n},P={X:[[new Oo(b,c),[.5,0,0],[0,0,-Math.PI/2],null,"fwd"],[k("x+","x")]],Y:[[new Oo(b,u),[0,.5,0],null,null,"fwd"],[k("y+","y")]],Z:[[new Oo(b,h),[0,0,.5],[Math.PI/2,0,0],null,"fwd"],[k("z+","z")]]},R={X:[[new Oo(new So(.2,0,.5,4,1,!1),s),[.3,0,0],[0,0,-Math.PI/2]]],Y:[[new Oo(new So(.2,0,.5,4,1,!1),s),[0,.3,0]]],Z:[[new Oo(new So(.2,0,.5,4,1,!1),s),[0,0,.3],[Math.PI/2,0,0]]]},M={START:[[new Oo(new zo(.01,2),l),null,null,null,"helper"]],END:[[new Oo(new zo(.01,2),l),null,null,null,"helper"]],DELTA:[[new Ho(function(){var e=new Ro;return e.setAttribute("position",new Fo([0,0,0,1,1,1],3)),e}(),l),null,null,null,"helper"]],X:[[new Ho(x,l.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]],Y:[[new Ho(x,l.clone()),[0,-1e3,0],[0,0,Math.PI/2],[1e6,1,1],"helper"]],Z:[[new Ho(x,l.clone()),[0,0,-1e3],[0,-Math.PI/2,0],[1e6,1,1],"helper"]]};i.updateRotate=function(){var t={X:[[new Ho(B(1,.5),v)],[new Oo(new zo(.04,0),c),[0,0,.99],null,[1,3,1]]],Y:[[new Ho(B(1,.5),g),null,[0,0,-Math.PI/2]],[new Oo(new zo(.04,0),u),[0,0,.99],null,[3,1,1]]],Z:[[new Ho(B(1,.5),y),null,[0,Math.PI/2,0]],[new Oo(new zo(.04,0),h),[.99,0,0],null,[1,3,1]]],XYZE:[[new Ho(B(1,1),E),null,[0,Math.PI/2,0]]]},n={AXIS:[[new Ho(x,l.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]]},i={X:[[new Oo(new Xo(1,.1,4,24),s),[0,0,0],[0,-Math.PI/2,-Math.PI/2]]],Y:[[new Oo(new Xo(1,.1,4,24),s),[0,0,0],[Math.PI/2,0,0]]],Z:[[new Oo(new Xo(1,.1,4,24),s),[0,0,0],[0,0,-Math.PI/2]]]};return e.rotateAxis&&(e.rotateAxis.indexOf("x")<0&&(delete t.X,delete t.XYZE,delete i.X),e.rotateAxis.indexOf("y")<0&&(delete t.Y,delete t.XYZE,delete i.Y),e.rotateAxis.indexOf("z")<0&&(delete t.Z,delete t.XYZE,delete i.Z)),{gizmo:t,picker:i,helper:n}},i.updateScale=function(){var t={X:[[new Oo(w,c),[.5,0,0],[0,0,-Math.PI/2]],[k("x-","x")]],Y:[[new Oo(w,u),[0,.5,0]],[k("y-","y")]],Z:[[new Oo(w,h),[0,0,.5],[Math.PI/2,0,0]],[k("z-","z"),null,[0,-Math.PI/2,0],[.5,1,1]]],XY:[[new Oo(w,p),[.5,.5,0]]],YZ:[[new Oo(w,f),[0,.5,.5]]],XZ:[[new Oo(w,m),[.5,0,.5]]],XYZX:[[new Oo(new Po(.125,.125,.125),d.clone()),[.5,.5,.5]]]},n={X:[[new Oo(new So(.2,0,.5,4,1,!1),s),[.3,0,0],[0,0,-Math.PI/2]]],Y:[[new Oo(new So(.2,0,.5,4,1,!1),s),[0,.3,0]]],Z:[[new Oo(new So(.2,0,.5,4,1,!1),s),[0,0,.3],[Math.PI/2,0,0]]],XY:[[new Oo(w,s),[.5,.5,0]]],YZ:[[new Oo(w,s),[0,.5,.5]]],XZ:[[new Oo(w,s),[.5,0,.5]]],XYZX:[[new Oo(new Po(.2,.2,.2),s),[.5,.5,.5]]]};return e.scaleAxis&&(e.scaleAxis.indexOf("z")<0&&(delete t.Z,delete t.YZ,delete t.XZ,delete t.XYZX,delete n.Z,delete n.YZ,delete n.XZ,delete n.XYZX),e.scaleAxis.indexOf("x")>-1&&e.scaleAxis.indexOf("y")>-1&&e.scaleAxis.indexOf("z")>-1&&(delete t.XY,delete t.YZ,delete t.XZ,delete n.XY,delete n.YZ,delete n.XZ)),{gizmo:t,picker:n,helper:{X:[[new Ho(x,l.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]],Y:[[new Ho(x,l.clone()),[0,-1e3,0],[0,0,Math.PI/2],[1e6,1,1],"helper"]],Z:[[new Ho(x,l.clone()),[0,0,-1e3],[0,-Math.PI/2,0],[1e6,1,1],"helper"]]}}},i.setupGizmo=function(e){var t=new _o;for(var n in e)for(var i=e[n].length;i--;){var o=e[n][i][0],r=e[n][i][1],a=e[n][i][2],s=e[n][i][3],l=e[n][i][4];if("Fatline"!=o.type&&(o=o.clone()),o.name=n,o.tag=l,r&&o.position.set(r[0],r[1],r[2]),a&&o.rotation.set(a[0],a[1],a[2]),s&&o.scale.set(s[0],s[1],s[2]),o.updateMatrix(),o.geometry.clone()){var c=o.geometry.clone();c.applyMatrix4(o.matrix),o.geometry=c}else o.geometry.applyMatrix4(o.matrix);o.renderOrder=1/0,o.position.set(0,0,0),o.rotation.set(0,0,0),o.scale.set(1,1,1),t.add(o)}return t};var S=new THREE.Vector3(0,0,0),D=new Lo,L=new THREE.Vector3(0,1,0),F=new THREE.Vector3(0,0,0),H=new Vo,V=new No,O=new No,Q=new No,_=new THREE.Vector3(1,0,0),z=new THREE.Vector3(0,1,0),U=new THREE.Vector3(0,0,1);return i.gizmo={},i.picker={},i.helper={},i.add(i.gizmo.translate=i.setupGizmo(P)),i.add(i.gizmo.rotate=i.setupGizmo(i.updateRotate().gizmo)),i.add(i.gizmo.scale=i.setupGizmo(i.updateScale().gizmo)),i.add(i.picker.translate=i.setupGizmo(R)),i.add(i.picker.rotate=i.setupGizmo(i.updateRotate().picker)),i.add(i.picker.scale=i.setupGizmo(i.updateScale().picker)),i.add(i.helper.translate=i.setupGizmo(M)),i.add(i.helper.rotate=i.setupGizmo(i.updateRotate().helper)),i.add(i.helper.scale=i.setupGizmo(i.updateScale().helper)),i.picker.translate.visible=!1,i.picker.rotate.visible=!1,i.picker.scale.visible=!1,i.updateMatrixWorld=function(){var t=this.space;"scale"===this.mode&&(t="local");var n="local"===t?this.worldQuaternion:Q;this.gizmo.translate.visible="translate"===this.mode,this.gizmo.rotate.visible="rotate"===this.mode,this.gizmo.scale.visible="scale"===this.mode,this.helper.translate.visible="translate"===this.mode,this.helper.rotate.visible="rotate"===this.mode,this.helper.scale.visible="scale"===this.mode;var i=[];i=(i=(i=i.concat(this.picker[this.mode].children)).concat(this.gizmo[this.mode].children)).concat(this.helper[this.mode].children);var o=this.worldPosition.distanceTo(this.cameraPosition);if("transitioning"!=this.player.mode||"floorplan"!=this.player.modeTran.split("-")[0]&&"floorplan"!=this.player.modeTran.split("-")[1]){if("floorplan"==this.player.mode){o=((r=this.player.cameraControls.cameras.floorplan).right-r.left)/r.aspect}}else{var r,a=((r=this.player.cameraControls.cameras.floorplan).right-r.left)/r.aspect;o=Math.min(o,a)}for(var s=o*this.size/7,l=0;l<i.length;l++){var c=i[l];if(c.visible=!0,c.rotation.set(0,0,0),c.position.copy(this.worldPosition),c.scale.set(1,1,1).multiplyScalar(s),"helper"!==c.tag){if(c.quaternion.copy(n),"translate"===this.mode||"scale"===this.mode){var u=.99;e.dontHideWhenFaceCamera||("X"!==c.name&&"XYZX"!==c.name||Math.abs(L.copy(_).applyQuaternion(n).dot(this.eye))>u&&(c.scale.set(1e-10,1e-10,1e-10),c.visible=!1),"Y"!==c.name&&"XYZY"!==c.name||Math.abs(L.copy(z).applyQuaternion(n).dot(this.eye))>u&&(c.scale.set(1e-10,1e-10,1e-10),c.visible=!1),"Z"!==c.name&&"XYZZ"!==c.name||Math.abs(L.copy(U).applyQuaternion(n).dot(this.eye))>u&&(c.scale.set(1e-10,1e-10,1e-10),c.visible=!1),"XY"===c.name&&Math.abs(L.copy(U).applyQuaternion(n).dot(this.eye))<.2&&(c.scale.set(1e-10,1e-10,1e-10),c.visible=!1),"YZ"===c.name&&Math.abs(L.copy(_).applyQuaternion(n).dot(this.eye))<.2&&(c.scale.set(1e-10,1e-10,1e-10),c.visible=!1),"XZ"===c.name&&Math.abs(L.copy(z).applyQuaternion(n).dot(this.eye))<.2&&(c.scale.set(1e-10,1e-10,1e-10),c.visible=!1));var h=!1;L.copy(U).applyQuaternion(n).dot(this.eye)<0&&(h=!0),-1!==c.name.search("X")&&(L.copy(_).applyQuaternion(n).dot(this.eye)<0?("Fatline"==c.type?c.geometry=T["x-"]:c.scale.x*=-1,"world"==this.space?c.position.add(new THREE.Vector3(-.1,0,0)):this.parent.object&&c.position.add(new THREE.Vector3(-Math.abs(this.parent.object.width||.1)/2,0,h||"XYZX"==c.name?0:this.parent.object.depth||0).applyQuaternion(c.quaternion))):("Fatline"==c.type&&(c.geometry=T["x+"]),"world"==this.space?c.position.add(new THREE.Vector3(.1,0,0)):this.parent.object&&c.position.add(new THREE.Vector3(Math.abs(this.parent.object.width||.1)/2,0,h||"XYZX"==c.name?0:this.parent.object.depth||0).applyQuaternion(c.quaternion)))),-1!==c.name.search("Y")&&(L.copy(z).applyQuaternion(n).dot(this.eye)<0?("Fatline"==c.type?c.geometry=T["y-"]:c.scale.y*=-1,"world"==this.space?c.position.add(new THREE.Vector3(0,-.1,0)):this.parent.object&&c.position.add(new THREE.Vector3(0,-Math.abs(this.parent.object.height||.1)/2,h||"XYZX"==c.name?0:this.parent.object.depth||0).applyQuaternion(c.quaternion))):("Fatline"==c.type&&(c.geometry=T["y+"]),"world"==this.space?c.position.add(new THREE.Vector3(0,.1,0)):this.parent.object&&c.position.add(new THREE.Vector3(0,Math.abs(this.parent.object.height||.1)/2,h||"XYZX"==c.name?0:this.parent.object.depth||0).applyQuaternion(c.quaternion)))),-1!==c.name.search("Z")&&(h?("Fatline"==c.type?c.geometry=T["z-"]:c.scale.z*=-1,"world"==this.space&&c.position.add(new THREE.Vector3(0,0,-.1))):("Fatline"==c.type&&(c.geometry=T["z+"]),"world"==this.space?c.position.add(new THREE.Vector3(0,0,.1)):this.parent.object&&c.position.add(new THREE.Vector3(0,0,this.parent.object.depth||0).applyQuaternion(c.quaternion))))}else"rotate"===this.mode&&(O.copy(n),L.copy(this.eye).applyQuaternion(V.copy(n).invert()),-1!==c.name.search("E")&&c.quaternion.setFromRotationMatrix(H.lookAt(this.eye,F,z)),"X"===c.name&&(this.spaceForRotate&&(n="local"===this.spaceForRotate.x?this.worldQuaternion:Q,O.copy(n),L.copy(this.eye).applyQuaternion(V.copy(n).invert())),V.setFromAxisAngle(_,Math.atan2(-L.y,L.z)),V.multiplyQuaternions(O,V),c.quaternion.copy(V)),"Y"===c.name&&(this.spaceForRotate&&(n="local"===this.spaceForRotate.y?this.worldQuaternion:Q,O.copy(n),L.copy(this.eye).applyQuaternion(V.copy(n).invert())),V.setFromAxisAngle(z,Math.atan2(L.x,L.z)),V.multiplyQuaternions(O,V),c.quaternion.copy(V)),"Z"===c.name&&(this.spaceForRotate&&(n="local"===this.spaceForRotate.z?this.worldQuaternion:Q,O.copy(n),L.copy(this.eye).applyQuaternion(V.copy(n).invert())),V.setFromAxisAngle(U,Math.atan2(L.y,L.x)),V.multiplyQuaternions(O,V),c.quaternion.copy(V)));c.visible=c.visible&&(-1===c.name.indexOf("X")||this.showX),c.visible=c.visible&&(-1===c.name.indexOf("Y")||this.showY),c.visible=c.visible&&(-1===c.name.indexOf("Z")||this.showZ),c.visible=c.visible&&(-1===c.name.indexOf("E")||this.showX&&this.showY&&this.showZ),c.material._opacity=c.material._opacity||c.material.opacity,c.material._color=c.material._color||c.material.color.clone(),c.material.color.copy(c.material._color),c.material.opacity=c.material._opacity,this.enabled?this.axis&&(c.name===this.axis||this.axis.split("").some((function(e){return c.name===e}))?(c.material.opacity=1,c.material.color.lerp(new Mo(1,1,1),.5)):(c.material.opacity*=.25,c.material.color.lerp(new Mo(1,1,1),.5))):(c.material.opacity*=.5,c.material.color.lerp(new Mo(1,1,1),.5))}else c.visible=!1,"AXIS"===c.name?(c.position.copy(this.worldPositionStart),c.visible=!!this.axis,"X"===this.axis&&(V.setFromEuler(D.set(0,0,0)),c.quaternion.copy(n).multiply(V),Math.abs(L.copy(_).applyQuaternion(n).dot(this.eye))>.9&&(c.visible=!1)),"Y"===this.axis&&(V.setFromEuler(D.set(0,0,Math.PI/2)),c.quaternion.copy(n).multiply(V),Math.abs(L.copy(z).applyQuaternion(n).dot(this.eye))>.9&&(c.visible=!1)),"Z"===this.axis&&(V.setFromEuler(D.set(0,Math.PI/2,0)),c.quaternion.copy(n).multiply(V),Math.abs(L.copy(U).applyQuaternion(n).dot(this.eye))>.9&&(c.visible=!1)),"XYZE"===this.axis&&(V.setFromEuler(D.set(0,Math.PI/2,0)),L.copy(this.rotationAxis),c.quaternion.setFromRotationMatrix(H.lookAt(F,L,z)),c.quaternion.multiply(V),c.visible=this.dragging),"E"===this.axis&&(c.visible=!1)):"START"===c.name?(c.position.copy(this.worldPositionStart),c.visible=this.dragging):"END"===c.name?(c.position.copy(this.worldPosition),c.visible=this.dragging):"DELTA"===c.name?(c.position.copy(this.worldPositionStart),c.quaternion.copy(this.worldQuaternionStart),S.set(1e-10,1e-10,1e-10).add(this.worldPositionStart).sub(this.worldPosition).multiplyScalar(-1),S.applyQuaternion(this.worldQuaternionStart.clone().invert()),c.scale.copy(S),c.visible=this.dragging):(c.quaternion.copy(n),this.dragging?c.position.copy(this.worldPositionStart):c.position.copy(this.worldPosition),this.axis&&(c.visible=-1!==this.axis.search(c.name)))}_o.prototype.updateMatrixWorld.call(this)},i}return n}(),Fr=new THREE.Vector3(1,0,0),Hr=new THREE.Vector3(0,1,0),Vr=new THREE.Vector3(0,0,1),Or=new THREE.Vector3,Qr=new THREE.Vector3,_r=new THREE.Vector3,zr=new THREE.Matrix4,Ur=new THREE.Quaternion,Nr=(Fr=new THREE.Vector3(1,0,0),Hr=new THREE.Vector3(0,1,0),Vr=new THREE.Vector3(0,0,1),Or=new THREE.Vector3,Qr=new THREE.Vector3,_r=new THREE.Vector3,zr=new THREE.Matrix4,Ur=new THREE.Quaternion,function(e){f(n,THREE.Mesh);var t=Bo(n);function n(e){var i;return o(this,n),(i=t.call(this,new Uo(1e4,1e4,2,2),new Qo({color:"#ff0000",visible:!1,wireframe:!1,side:Do,transparent:!0,opacity:.6}))).type="TransformControlsPlane",i}return u(n,[{key:"updateMatrixWorld",value:function(){var e=this.space;switch(this.parent.intersect?this.position.copy(this.parent.intersect.position):this.position.copy(this.worldPosition),"scale"===this.mode&&(e="local"),Fr.set(1,0,0).applyQuaternion("local"===e?this.worldQuaternion:Ur),Hr.set(0,1,0).applyQuaternion("local"===e?this.worldQuaternion:Ur),Vr.set(0,0,1).applyQuaternion("local"===e?this.worldQuaternion:Ur),_r.copy(Hr),this.mode){case"translate":case"scale":switch(this.axis){case"X":_r.copy(this.eye).cross(Fr),Qr.copy(Fr).cross(_r);break;case"Y":_r.copy(this.eye).cross(Hr),Qr.copy(Hr).cross(_r);break;case"Z":_r.copy(this.eye).cross(Vr),Qr.copy(Vr).cross(_r);break;case"XY":Qr.copy(Vr);break;case"YZ":Qr.copy(Fr);break;case"XZ":_r.copy(Vr),Qr.copy(Hr);break;case"XYZ":case"E":default:Qr.set(0,0,0)}break;case"rotate":default:Qr.set(0,0,0)}0===Qr.length()?this.quaternion.copy(this.cameraQuaternion):(zr.lookAt(Or.set(0,0,0),Qr,_r),this.quaternion.setFromRotationMatrix(zr)),_o.prototype.updateMatrixWorld.call(this)}}]),n}());function Gr(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}var jr=function(e){f(n,THREE.EventDispatcher);var t=Gr(n);function n(e){var i;return o(this,n),(i=t.call(this)).undoList=[],i.redoList=[],i.applyData=e.applyData,i.getData=e.getData,i.dataBefore,e.player.domElement.addEventListener("keydown",(function(e){90==e.keyCode&&e.ctrlKey?i.undo():89==e.keyCode&&e.ctrlKey&&i.redo()})),i}return u(n,[{key:"undo",value:function(){if(this.undoList.length>0){var e,t=this.undoList.pop();this.applyData&&(e=!this.applyData(t.before)),e||this.redoList.push(t),e&&this.undo(),this.dispatchEvent("undo")}}},{key:"redo",value:function(){this.undoList.length;var e=this.redoList.pop();e&&(this.undoList.push(e),this.applyData&&this.applyData(e.after),this.dispatchEvent("redo"))}},{key:"beforeChange",value:function(e){if(!this.dataBefore){var t=this.getData(e);t&&(this.dataBefore=t)}}},{key:"afterChange",value:function(e){this.dataBefore&&(this.writeIn({before:this.dataBefore,after:this.getData(e)}),this.dataBefore=null)}},{key:"writeIn",value:function(e){this.redoList.length=0,this.undoList.push(e)}},{key:"clear",value:function(){this.redoList.length=0,this.undoList.length=0,this.dataBefore=null}}]),n}(),Wr={priorityEvent:[{hide:"none"},{polygonMark_move:"move"},{polygonMark_hover:"pointer"},{polygonMark_subPen:"url("+si.getImageURL("images/polygon_mark/pic_pen_sub.png")+"),auto"},{polygonMark_addPen:"url("+si.getImageURL("images/polygon_mark/pic_pen_add.png")+"),auto"},{polygonMark_pen:"url("+si.getImageURL("images/polygon_mark/pic_pen.png")+"),auto"},{hoverTranHandle:"grab"},{dragOverlay:"move"},{hoverOverlay:"pointer"},{hoverMonitor:"pointer"},{addOverlay:"url(https://4dkk.4dage.com/v3-test/img/box_video.png),auto"},{hoverFootMarker:"pointer"},{hoverView:"pointer"},{dragView:"move"},{viewChoosePos:"pointer"}],list:[],currentCursorIndex:null,init:function(e){this.domElements=[e.domElement]},add:function(e){var t=this.priorityEvent.find((function(t){return t[e]}));t?this.list.includes(e)||(this.judge({addItem:t,name:e}),this.list.push(e)):console.error("CursorDeal 未定义优先级 name:"+e)},remove:function(e){var t=this.list.indexOf(e);t>-1&&(this.list.splice(t,1),this.judge())},judge:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(t.addItem){var n=this.priorityEvent.indexOf(t.addItem);(n<this.currentCursorIndex||null==this.currentCursorIndex)&&(this.domElements.forEach((function(e){return e.style.cursor=t.addItem[t.name]})),this.currentCursorIndex=n)}else{var i={index:1/0,cursor:null};this.list.forEach((function(t){var n=e.priorityEvent.find((function(e){return e[t]})),o=e.priorityEvent.indexOf(n);o<i.index&&(i.index=o,i.cursor=n[t])})),this.currentCursorIndex=i.index,this.domElements.forEach((function(e){return e.style.cursor=i.cursor||""}))}}};function qr(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return Jr(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Jr(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var i=0,o=function(){};return{s:o,n:function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var r,a=!0,s=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return a=e.done,e},e:function(e){s=!0,r=e},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw r}}}}function Jr(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);n<t;n++)i[n]=e[n];return i}function Yr(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}var Zr=.6,Xr={x:{color:"#ea3f3f"},xyz:{color:"#ccc"},y:{color:"#86c215"},z:{color:"#3396f8"}},Kr=function(e){f(n,THREE.Object3D);var t=Yr(n);function n(e){var i;o(this,n),(i=t.call(this)).player=e,i.modesEnabled={},i.visible=!1,i.selection=[],i.pivot=new THREE.Vector3,i.dragging=!1,i.showPickVolumes=!1,i.player.on("update",i.update.bind(h(i)));var r=Xr.x.color,a=Xr.y.color,s=Xr.z.color,l=Xr.xyz.color;i.activeHandle=null,i.scaleHandles={"scale.x+":{name:"scale.x+",node:new THREE.Object3D,color:r,alignment:[1,0,0]},"scale.x-":{name:"scale.x-",node:new THREE.Object3D,color:r,alignment:[-1,0,0]},"scale.y+":{name:"scale.y+",node:new THREE.Object3D,color:a,alignment:[0,1,0]},"scale.y-":{name:"scale.y-",node:new THREE.Object3D,color:a,alignment:[0,-1,0]},"scale.z+":{name:"scale.z+",node:new THREE.Object3D,color:s,alignment:[0,0,1]},"scale.z-":{name:"scale.z-",node:new THREE.Object3D,color:s,alignment:[0,0,-1]},lines:{name:"lines",node:new THREE.Object3D,dontScale:!0}},i.focusHandles={"focus.x+":{name:"focus.x+",node:new THREE.Object3D,color:r,alignment:[1,0,0]},"focus.x-":{name:"focus.x-",node:new THREE.Object3D,color:r,alignment:[-1,0,0]},"focus.y+":{name:"focus.y+",node:new THREE.Object3D,color:a,alignment:[0,1,0]},"focus.y-":{name:"focus.y-",node:new THREE.Object3D,color:a,alignment:[0,-1,0]},"focus.z+":{name:"focus.z+",node:new THREE.Object3D,color:s,alignment:[0,0,1]},"focus.z-":{name:"focus.z-",node:new THREE.Object3D,color:s,alignment:[0,0,-1]}},i.translationHandles={"translation.x":{name:"translation.x",node:new THREE.Object3D,color:r,alignment:[1,0,0]},"translation.y":{name:"translation.y",node:new THREE.Object3D,color:a,alignment:[0,1,0]},"translation.z":{name:"translation.z",node:new THREE.Object3D,color:s,alignment:[0,0,1]},"translation.xyz":{name:"translation.xyz",node:new THREE.Object3D,color:l,alignment:[0,0,0],alignment2:[1,1,1]},"translation.plane.xy":{name:"translation.plane.xy",node:new THREE.Object3D,color:s,alignment:[0,0,1],alignment2:[1,1,0]},"translation.plane.yz":{name:"translation.plane.yz",node:new THREE.Object3D,color:r,alignment:[1,0,0],alignment2:[0,1,1]},"translation.plane.xz":{name:"translation.plane.xz",node:new THREE.Object3D,color:a,alignment:[0,1,0],alignment2:[1,0,1]}},i.rotationHandles={"rotation.x":{name:"rotation.x",node:new THREE.Object3D,color:r,alignment:[1,0,0]},"rotation.y":{name:"rotation.y",node:new THREE.Object3D,color:a,alignment:[0,1,0]},"rotation.z":{name:"rotation.z",node:new THREE.Object3D,color:s,alignment:[0,0,1]}},i.handles=Object.assign({},i.scaleHandles,{},i.translationHandles,i.rotationHandles),i.pickVolumes=[],i.initializeScaleHandles(),i.initializeFocusHandles(),i.initializeTranslationHandles(),i.initializeRotationHandles();var c=new THREE.BufferGeometry,u=[];u.push(-.5,-.5,.5),u.push(.5,-.5,.5),u.push(.5,-.5,.5),u.push(.5,-.5,-.5),u.push(.5,-.5,-.5),u.push(-.5,-.5,-.5),u.push(-.5,-.5,-.5),u.push(-.5,-.5,.5),u.push(-.5,.5,.5),u.push(.5,.5,.5),u.push(.5,.5,.5),u.push(.5,.5,-.5),u.push(.5,.5,-.5),u.push(-.5,.5,-.5),u.push(-.5,.5,-.5),u.push(-.5,.5,.5),u.push(-.5,-.5,.5),u.push(-.5,.5,.5),u.push(.5,-.5,.5),u.push(.5,.5,.5),u.push(.5,-.5,-.5),u.push(.5,.5,-.5),u.push(-.5,-.5,-.5),u.push(-.5,.5,-.5);var d=new Float32Array(u);c.setAttribute("position",new THREE.BufferAttribute(d,3)),i.frame=new THREE.LineSegments(c,new THREE.LineBasicMaterial({color:16776960})),i.add(i.frame),i.setModeEnable(["translation"]),i.traverse((function(e){e.pickDontCheckDis=!0}));return i.history=new jr({applyData:function(e){if(function(e){for(;e.parent;)e=e.parent;if(e instanceof THREE.Scene)return!0}(e.object))return e.matrix.decompose(e.object.position,e.object.quaternion,e.object.scale),e.object.matrix.copy(e.matrix),i.dispatchEvent({type:"changeByHistory",data:e}),!0},getData:function(e){return e},player:i.player}),i.addEventListener("transformed",(function(e){var t=i.selection[0];i.history.beforeChange({object:t,matrix:e.matrixBefore.clone()})})),i.addEventListener("stopDrag",(function(e){var t=i.selection[0];t&&i.history.afterChange({object:t,matrix:t.matrix.clone()})})),i}return u(n,[{key:"attach",value:function(e){this.selection=[e]}},{key:"detach",value:function(e){if(!e)return this.selection=[];var t=this.selection.indexOf(e);this.selection.splice(t,1)}},{key:"setModeEnable",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],n=0;["translation","scale","rotation"].forEach((function(i){var o=e[i+"Handles"],r=t.includes(i);for(var a in o)De.updateVisible(o[a].node,"modeForce",!!r);e.modesEnabled[i]=!!r,r&&n++})),"mixedModes"!=this.style&&n>1?this.changeStyle("mixedModes"):"singleMode"!=this.style&&1==n&&this.changeStyle("singleMode")}},{key:"changeStyle",value:function(e){var t=this,n="singleMode"==e?30:25,i="singleMode"==e?15:10;["x","y","z"].forEach((function(i){t.translationHandles["translation."+i].node.children.forEach((function(t){t.name.includes("arrow")?De.updateVisible(t,"modeStyle","singleMode"==e):t.name.includes("handle")&&(t.material.lineWidth="singleMode"==e?5:7)})),t.rotationHandles["rotation."+i].translateNode.scale.set(n,n,n)})),["xy","yz","xz"].forEach((function(e){var n=t.translationHandles["translation.plane."+e];n.node.children[0].scale.set(i,i,i),n.node.children[0].position.fromArray(n.alignment2).multiplyScalar(1.5*i)})),De.updateVisible(this.scaleHandles.lines.node,"modeStyle","singleMode"==e),this.style=e}},{key:"initializeTranslationHandles",value:function(){for(var e=this,t=new THREE.BoxGeometry(1,1,1),n=new THREE.CylinderBufferGeometry(0,4,10,12,1,!1),i=(new THREE.Quaternion).setFromAxisAngle(new THREE.Vector3(1,0,0),-Math.PI/2),o=new THREE.OctahedronBufferGeometry(5,0),r=new THREE.PlaneBufferGeometry(1,1),a=function(){var a=l[s],c=e.handles[a],u=c.node;e.add(u),u.name=a;var h=Q(THREE.Vector3,H(c.alignment)),d=void 0,p=void 0,f=void 0,m=void 0,v=void 0,g=void 0,y=!1,A=void 0,E={color:c.color,opacity:Zr,transparent:!0,side:a.includes("plane")?THREE.DoubleSide:THREE.FrontSide},b=new THREE.MeshBasicMaterial(E),w=new THREE.MeshNormalMaterial({opacity:.2,transparent:!0,visible:e.showPickVolumes});if(a.includes("xyz"))d=o,y=!0,A=12;else if(a.includes("plane"))d=r,y=!0,v=Q(THREE.Vector3,H(c.alignment2)),g=h,a.includes("xy")||a.includes("yz")||a.includes("xz");else{d=t;var x=new THREE.Vector3(0,0,50);p=yi.createFatLine([x,x.clone().negate()],Object.assign(E,{lineWidth:6})),g=h,A=10,m=new THREE.Vector3(4,4,120);var C,T=new THREE.Mesh(n,b);T.name="".concat(a,".arrow"),T.renderOrder=11,(C=T.position).set.apply(C,H(c.alignment)).multiplyScalar(55),T.lookAt(0,0,0),u.add(T);var I=T.clone();I.position.negate(),I.lookAt(0,0,0),u.add(I),T.quaternion.multiply(i),I.quaternion.multiply(i)}p||(p=new THREE.Mesh(d,b)),p.name="".concat(a,".handle"),u.add(p),A&&(p.renderOrder=A),g&&p.lookAt(g),v&&p.position.copy(v),y?y&&(f=p):(f=new THREE.Mesh(d,w),m&&f.scale.copy(m)),f&&(p!=f?(p.add(f),f.name="".concat(a,".pick_volume")):f.name+=" & pick_volume",f.handle=a,e.pickVolumes.push(f)),u.setOpacity=function(e){if(a.includes("plane")){e=1-1.5*(1-e)}var t={x:b.opacity},n=new TWEEN.Tween(t).to({x:e},0);n.onUpdate((function(){p.visible=t.x>0,f&&(f.visible=t.x>0),b.opacity=t.x,p.material.opacity=t.x,w.opacity=.5*t.x})),n.start()},f.addEventListener("drag",(function(t){e.dragTranslationHandle(t)})),f.addEventListener("drop",(function(t){e.dropTranslationHandle(t)}))},s=0,l=Object.keys(this.translationHandles);s<l.length;s++)a()}},{key:"initializeScaleHandles",value:function(){for(var e=this,t=new THREE.SphereGeometry(1,32,32),n=new THREE.SphereGeometry(1,16,16),i=function(){var i,a=r[o],s=e.scaleHandles[a],l=s.node;if(l.name=a,e.add(l),"lines"==a)return["x","y","z"].forEach((function(t){var n=e.scaleHandles["scale."+t+"+"],i=e.scaleHandles["scale."+t+"-"],o=yi.createFatLine([(new THREE.Vector3).fromArray(n.alignment).multiplyScalar(.5),(new THREE.Vector3).fromArray(i.alignment).multiplyScalar(.5)],{color:n.color,lineWidth:4});l.add(o)})),l.setOpacity=function(e){e*=.6,l.children.forEach((function(t){return t.material.opacity=e}))},"continue";(i=l.position).set.apply(i,H(s.alignment)).multiplyScalar(.5);var c=new THREE.MeshBasicMaterial({color:s.color,side:THREE.DoubleSide,opacity:Zr,transparent:!0}),u=new THREE.MeshBasicMaterial({color:6710886,side:THREE.BackSide,opacity:Zr,transparent:!0}),h=new THREE.MeshNormalMaterial({opacity:.2,transparent:!0,side:THREE.DoubleSide,visible:e.showPickVolumes}),d=new THREE.Mesh(t,c);d.scale.set(5,5,5),d.name="".concat(a,".handle"),l.add(d),d.renderOrder=10;var p=new THREE.Mesh(n,h);p.name="".concat(a,".pick_volume"),p.scale.set(1.5,1.5,1.5),d.add(p),p.handle=a,e.pickVolumes.push(p),l.setOpacity=function(e){var t={x:c.opacity},n=new TWEEN.Tween(t).to({x:e},0);n.onUpdate((function(){d.visible=t.x>0,p.visible=t.x>0,c.opacity=t.x,u.opacity=t.x,p.material.opacity=.5*t.x})),n.start()},p.addEventListener("drag",(function(t){return e.dragScaleHandle(t)})),p.addEventListener("drop",(function(t){return e.dropScaleHandle(t)}))},o=0,r=Object.keys(this.scaleHandles);o<r.length;o++)i()}},{key:"initializeRotationHandles",value:function(){for(var e=this,t=new THREE.TorusGeometry(1.3,2.3*.015,8,64,Math.PI/2),n=new THREE.TorusGeometry(1.3,2.3*.06,6,4,Math.PI/2),i=function(){var i=r[o],a=e.handles[i],s=a.node;e.add(s),s.name=i;var l=new THREE.MeshBasicMaterial({color:a.color,opacity:Zr,transparent:!0}),c=new THREE.MeshNormalMaterial({opacity:.2,transparent:!0,visible:e.showPickVolumes}),u=new THREE.Mesh(t,l);u.name="".concat(i,".handle"),u.scale.set(30,30,30),u.lookAt(Q(THREE.Vector3,H(a.alignment))),s.add(u),a.translateNode=u;var h=new THREE.Mesh(n,c);h.name="".concat(i,".pick_volume"),h.scale.set(1,1,1),h.handle=i,u.add(h),e.pickVolumes.push(h),s.setOpacity=function(e){var t={x:l.opacity},n=new TWEEN.Tween(t).to({x:e},0);n.onUpdate((function(){u.visible=t.x>0,h.visible=t.x>0,l.opacity=t.x,c.opacity=.5*t.x})),n.start()},h.addEventListener("drag",(function(t){e.dragRotationHandle(t)})),h.addEventListener("drop",(function(t){e.dropRotationHandle(t)}))},o=0,r=Object.keys(this.rotationHandles);o<r.length;o++)i()}},{key:"initializeFocusHandles",value:function(){}},{key:"dragRotationHandle",value:function(e){var t=e.drag,n=this.activeHandle;if(this.player.camera,n&&n.name.includes("rotation")){var i=Q(THREE.Vector3,H(n.alignment)),o=new THREE.Vector3;if(o.copy(Q(THREE.Vector4,H(i.toArray()).concat([0])).applyMatrix4(n.node.matrixWorld)),o.normalize(),t.intersectionStart)n=t.handle;else{t.intersectionStart=t.point,t.objectStart=t.object.getWorldPosition(new THREE.Vector3),t.handle=n;var r=(new THREE.Plane).setFromNormalAndCoplanarPoint(o,t.intersectionStart);t.dragPlane=r,t.pivot=t.intersectionStart}if(t.dragPlane){this.dragging=!0;var a=this.player.raycaster.ray.intersectPlane(t.dragPlane,new THREE.Vector3);if(a){var s=this.getWorldPosition(new THREE.Vector3),l=a,c=t.pivot.clone().sub(s).normalize(),u=l.clone().sub(s).normalize(),h=Math.acos(c.dot(u));if(h*=Math.sign(c.cross(u).dot(o)),Number.isNaN(h))return;var d,p=this.selection[0].matrix.clone(),f=Q(THREE.Vector3,H(n.alignment)),m=qr(this.selection);try{for(m.s();!(d=m.n()).done;){var v=d.value,g=v.quaternion.clone(),y=(new THREE.Quaternion).setFromAxisAngle(f,h),A=(new THREE.Matrix4).setPosition(s.clone().negate()),E=(new THREE.Matrix4).makeRotationFromQuaternion(g.clone().invert().premultiply(y).premultiply(g)),b=(new THREE.Matrix4).setPosition(s.clone());v.matrix.premultiply(A).premultiply(E).premultiply(b),v.matrix.decompose(v.position,v.quaternion,v.scale),v.updateMatrixWorld(),v.dispatchEvent({type:"orientation_changed",object:v}),v.dispatchEvent({type:"position_changed",object:v})}}catch(e){m.e(e)}finally{m.f()}this.dispatchEvent({type:"transformed",changeType:["orientation"],matrixBefore:p}),t.pivot=a}}}}},{key:"dropRotationHandle",value:function(e){this.dragging=!1,this.setActiveHandle(null),this.dispatchEvent({type:"stopDrag",handle:"rotation"})}},{key:"dragTranslationHandle",value:function(e){var t=e.drag,n=this.activeHandle;this.player.camera;var i=this.player.getDirection();if(n&&n.name.includes("translation")&&this.selection[0]){var o=this.getWorldPosition(new THREE.Vector3);if(t.intersectionStart||(t.intersectionStart=t.point,t.worldPositionStart=this.selection[0].getWorldPosition(new THREE.Vector3),t.objectQua=this.selection[0].quaternion.clone(),t.objectQuaInv=t.objectQua.clone().invert(),this.dragging=!0),t.intersectionStart){var r,a=this.player.raycaster.ray,s=n.name.split(".").pop();if("xyz"==s)r=i;else{var l=new THREE.Vector3;r=new THREE.Vector3;var c=new THREE.Vector3(1,0,0).applyQuaternion(t.objectQua),u=new THREE.Vector3(0,1,0).applyQuaternion(t.objectQua),h=new THREE.Vector3(0,0,1).applyQuaternion(t.objectQua);switch(s){case"x":l.copy(i).cross(c),r.copy(c).cross(l);break;case"y":l.copy(i).cross(u),r.copy(u).cross(l);break;case"z":l.copy(i).cross(h),r.copy(h).cross(l);break;case"xy":r.copy(h);break;case"yz":r.copy(c);break;case"xz":r.copy(u)}}t.dragPlane=(new THREE.Plane).setFromNormalAndCoplanarPoint(r,o);var d=a.intersectPlane(t.dragPlane,new THREE.Vector3);if(d){var p=(new THREE.Vector3).subVectors(d,t.worldPositionStart);if(t.pointStart){t.pointEnd=p;var f=(new THREE.Vector3).subVectors(t.pointEnd,t.pointStart);f.applyQuaternion(t.objectQuaInv),n.name.includes("x")||(f.x=0),n.name.includes("y")||(f.y=0),n.name.includes("z")||(f.z=0),f.applyQuaternion(t.objectQua);var m=this.selection[0].matrix.clone();this.selection[0].position.copy(f).add(t.worldPositionStart);var v,g=qr(this.selection);try{for(g.s();!(v=g.n()).done;){var y=v.value;y.updateMatrixWorld(),y.dispatchEvent({type:"position_changed",object:y})}}catch(e){g.e(e)}finally{g.f()}this.dispatchEvent({type:"transformed",changeType:["position"],matrixBefore:m})}else t.pointStart=p}}}}},{key:"dropTranslationHandle",value:function(e){this.dragging=!1,this.setActiveHandle(null),this.dispatchEvent({type:"stopDrag",handle:"translation"})}},{key:"dropScaleHandle",value:function(e){this.dragging=!1,this.setActiveHandle(null),this.dispatchEvent({type:"stopDrag",handle:"scale"})}},{key:"dragScaleHandle",value:function(e){var t=e.drag,n=this.activeHandle;if(n&&n.name.includes("scale")){var i=this.player.camera;if(t.intersectionStart)n=t.handle;else{t.intersectionStart=t.point,t.objectStart=t.object.getWorldPosition(new THREE.Vector3),t.handle=n;var o,r=t.intersectionStart,a=Q(THREE.Vector4,H(n.alignment).concat([0])).applyMatrix4(this.matrixWorld),s=(new THREE.Vector3).addVectors(r,a),l=new THREE.Line3(r.clone(),s.clone());if(t.line=l,"OrthographicCamera"==i.type)o=new THREE.Vector3(0,0,-1).applyQuaternion(i.quaternion);else{var c=l.closestPointToPoint(i.position,!1,new THREE.Vector3);o=(new THREE.Vector3).subVectors(i.position,c)}var u=(new THREE.Plane).setFromNormalAndCoplanarPoint(o,t.intersectionStart);t.dragPlane=u,t.pivot=t.intersectionStart}if(this.dragging=!0,t.dragPlane){var h=this.player.raycaster.ray.intersectPlane(t.dragPlane,new THREE.Vector3);if(h){var d=t.line.closestPointToPoint(h,!1,new THREE.Vector3),p=n.alignment.reduce((function(e,t){return e+t}),0),f=this.selection[0].matrixWorld.clone().invert(),m=d.clone().applyMatrix4(f),v=t.pivot.clone().applyMatrix4(f),g=(new THREE.Vector3).subVectors(m,v).clone().normalize();0===d.distanceTo(t.pivot)&&g.set(0,0,0);var y,A=g.dot(Q(THREE.Vector3,H(n.alignment))),E=Q(THREE.Vector3,H(n.alignment)),b=(new THREE.Vector3).subVectors(d,t.pivot),w=E.clone().multiplyScalar(b.length()*p*A),x=this.selection[0].matrix.clone(),C=qr(this.selection);try{for(C.s();!(y=C.n()).done;){var T=y.value,I=T.boundingBox,k=I.min,B=I.max,P=0!=E.x?(E.x>0?k:B).clone().setY(0).setZ(0):0!=E.y?(E.y>0?k:B).clone().setX(0).setZ(0):(E.z>0?k:B).clone().setX(0).setY(0),R=P.clone().applyMatrix4(T.matrixWorld),M=T.boundingBox.getSize(new THREE.Vector3),S=w.clone().divide(M);0==M.x&&(S.x=0),0==M.y&&(S.y=0),0==M.z&&(S.z=0),T.scale.add(S),T.scale.max(new THREE.Vector3(.1,.1,.1)),T.updateMatrixWorld();var D=P.clone().applyMatrix4(this.selection[0].matrixWorld);T.position.sub((new THREE.Vector3).subVectors(D,R)),T.updateMatrixWorld(),T.dispatchEvent({type:"position_changed",object:T}),T.dispatchEvent({type:"scale_changed",object:T})}}catch(e){C.e(e)}finally{C.f()}this.dispatchEvent({type:"transformed",changeType:["position","scale"],matrixBefore:x}),t.pivot.copy(d)}}}}},{key:"setActiveHandle",value:function(e){if(!this.dragging&&this.activeHandle!==e){if(this.activeHandle=e,null===e)for(var t=0,n=Object.keys(this.handles);t<n.length;t++){var i=n[t];this.handles[i].node.setOpacity(0)}this.activeHandle?Wr.add("hoverTranHandle"):Wr.remove("hoverTranHandle");for(var o=0,r=Object.keys(this.translationHandles);o<r.length;o++){var a=r[o],s=this.translationHandles[a];this.activeHandle===s?s.node.setOpacity(1):s.node.setOpacity(Zr)}for(var l=0,c=Object.keys(this.rotationHandles);l<c.length;l++){var u=c[l];this.rotationHandles[u].node.setOpacity(Zr)}for(var h=0,d=Object.keys(this.scaleHandles);h<d.length;h++){var p=d[h],f=this.scaleHandles[p];if(this.activeHandle===f){f.node.setOpacity(1);for(var m=0,v=Object.keys(this.translationHandles);m<v.length;m++){var g=v[m];this.translationHandles[g].node.setOpacity(Zr)}}else f.node.setOpacity(Zr)}e&&e.node.setOpacity(1)}}},{key:"update",value:function(){var e=this;if(1===this.selection.length){this.visible=!0,this.updateMatrix(),this.updateMatrixWorld();var t=this.selection[0];t.matrixWorld;var n=this.player.camera,i=this.player.domElement,o=t.boundingBox.getCenter(new THREE.Vector3).clone().applyMatrix4(t.matrixWorld),r=t.boundingBox.getSize(new THREE.Vector3).multiply(t.scale);if(r.max(new THREE.Vector3(.1,.1,.1)),this.scale.copy(r),this.position.copy(o),this.rotation.copy(t.rotation),this.updateMatrixWorld(),!this.dragging&&(this.modesEnabled.rotation||this.modesEnabled.translation)){var a=this.matrixWorld.clone().invert(),s=n.getWorldPosition(new THREE.Vector3).applyMatrix4(a);if(this.modesEnabled.translation&&["xy","yz","xz"].forEach((function(t){var n=e.translationHandles["translation.plane."+t].node.children[0].position;s.x&&(n.x=Math.sign(s.x)*Math.abs(n.x)),s.y&&(n.y=Math.sign(s.y)*Math.abs(n.y)),s.z&&(n.z=Math.sign(s.z)*Math.abs(n.z))})),this.modesEnabled.rotation){var l=s.z>0,c=!l,u=Math.PI/2,h=this.rotationHandles["rotation.x"].node.rotation,d=this.rotationHandles["rotation.y"].node.rotation,p=this.rotationHandles["rotation.z"].node.rotation;h.order="ZYX",d.order="ZYX",l?s.x>0&&s.y>0?(h.x=1*u,d.y=3*u,p.z=0*u):s.x<0&&s.y>0?(h.x=1*u,d.y=2*u,p.z=1*u):s.x<0&&s.y<0?(h.x=2*u,d.y=2*u,p.z=2*u):s.x>0&&s.y<0&&(h.x=2*u,d.y=3*u,p.z=3*u):c&&(s.x>0&&s.y>0?(h.x=0*u,d.y=0*u,p.z=0*u):s.x<0&&s.y>0?(h.x=0*u,d.y=1*u,p.z=1*u):s.x<0&&s.y<0?(h.x=3*u,d.y=1*u,p.z=2*u):s.x>0&&s.y<0&&(h.x=3*u,d.y=0*u,p.z=3*u))}}for(var f=0,m=Object.keys(this.handles);f<m.length;f++){var v=m[f],g=this.handles[v],y=g.node;if(De.getObjVisiByReason(y,"modeForce")){var A=g.alignment;if(!A||v.includes("rotation")&&"OrthographicCamera"!=n.type)De.updateVisible(y,"faceToCamHide",!0);else{var E=void 0,b=Q(THREE.Vector3,H(A)).applyQuaternion(this.quaternion);E="OrthographicCamera"==n.type?new THREE.Vector3(0,0,-1).applyQuaternion(n.quaternion):(new THREE.Vector3).subVectors(o,n.position).normalize();var w=void 0;w=v.includes("rotation")||v.includes("plane")?Math.abs(b.dot(E))<.1:Math.abs(b.dot(E))>.995,De.updateVisible(y,"faceToCamHide",!w)}if(y.visible&&!g.dontScale){var x=y.getWorldPosition(new THREE.Vector3).distanceTo(n.position),C=pt.projectedRadius(1,n,x,i.clientWidth,i.clientHeight),T=y.parent.getWorldScale(new THREE.Vector3),I=3/C,k=new THREE.Vector3(I,I,I).divide(T),B=(new THREE.Matrix4).makeRotationFromEuler(y.rotation).clone().invert();k.applyMatrix4(B),k.x=Math.abs(k.x),k.y=Math.abs(k.y),k.z=Math.abs(k.z),y.scale.copy(k)}}}}else this.visible=!1}},{key:"onPointerMove",value:function(){var e=this;if(this.player.camera,1===this.selection.length)if(this.dragging)this.intersect&&this.intersect.object.dispatchEvent({type:"drag",drag:this.drag});else{var t=this.player.raycaster,n=this.pickVolumes.filter((function(t){var n=t.handle.split(".")[0];if(e.modesEnabled[n])return t.parent.parent.visible})),i=t.intersectObjects(n,!0);if((i=i.sort((function(e,t){return(t.object.renderOrder||0)-(e.object.renderOrder||0)}))).length>0){var o=i[0],r=o.object.handle;this.setActiveHandle(this.handles[r]),this.intersect=o}else this.intersect,this.setActiveHandle(null),this.intersect=null}}},{key:"handleDragStart",value:function(){1===this.selection.length&&this.intersect&&(this.drag=this.intersect,this.intersect.object.dispatchEvent({type:"drag",drag:this.drag}),this.player.cameraControls.activeControl&&(this.player.cameraControls.activeControl.enabled=!1))}},{key:"handleDragEnd",value:function(){this.drag&&(this.drag.object.dispatchEvent({type:"drop"}),this.drag=null,this.player.cameraControls.activeControl&&(this.player.cameraControls.activeControl.enabled=!0))}}]),n}(),$r="move",ea="rotate",ta="zoom",na="endRotation",ia="moveModel",oa="mode.changed",ra="mode.changing",aa="pano.chosen",sa="closest.pano.changing",la="flyin.finished",ca="flying.started",ua="flying.ended",ha="ready",da="start.inside",pa="start.outside",fa="view.changed",ma="warp.interrupted.flyto",va="input.start";new THREE.TextureLoader;var ga=new THREE.PlaneBufferGeometry(1,1),ya=function(){function e(t){o(this,e),this.app=t,this.config=this.app.config,this.show=!0,this.done=0,this.ready=!1,this.center=new THREE.Vector3,this.deferred=oe()}return u(e,[{key:"getCadInfo",value:function(e){var t=this.app.store.getValue("flooruser").cadInfo;if(t instanceof Array)if(1==this.model.floors.list.length)t=t[0];else{var n=t.find((function(t){return t.subgroup==e}));n||(n=t[e]),t=n}else if(!t)return null;return t}},{key:"changeCadVisible",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};null!=t.show&&(this.show=t.show),this.model.floors.forEach((function(t){t.plane?t.plane.visible=!!e:console.warn("还没有创建plane")}))}},{key:"deleteCustomFloorTexture",value:function(e){console.log("deleteCustomFloorTexture!查看是否有问题",e);var t=this.model.floors.index[e];t.plane.visible=!1,t.plane.material.opacity=0,t.plane.material.map=null,t.plane.material.needsUpdate=!0}},{key:"updateCustomFloorTexture",value:function(e,t){console.log("updateCustomFloorTexture!",e),this.floorPlanImgUrls[e]=t,this.updateCadPlane(e)}},{key:"createCustomPlane",value:function(e,t){this.floorPlanImgUrls[e]=t,this.updateCadPlane(e)}},{key:"changeModelOpacity",value:function(){}},{key:"init",value:function(e){var t=this;this.player=this.app.core.get("Player"),this.model=e;var n=this.app.store.getValue("flooruser");n?this.getCadImgUrl(n):this.app.store.on("flooruser",(function(e){t.getCadImgUrl(e)})),this.player.on(ra,(function(e,n,i,o){if(n==xt.FLOORPLAN){t.shouldShowPlane=!0,setTimeout((function(){t.shouldShowPlane&&t.showCadPlane()}),Math.min(1e3,o))}else t.shouldShowPlane=!1,t.hideCadPlane(),t.changeModelOpacity("hidePlane")})),this.ready=!0}},{key:"createCadAllPlanes",value:function(e){var t=this;if("image"==e.type)e.floors.forEach((function(e){t.createCustomPlane(e.subgroup,t.app.resource.getUserResourceURL(e.filename))})),this.ready=!0;else{if(!this.app.store.getValue("metadata").floorPlanUser)return this.ready=!0,void this.deferred.resolve();this.model.floors.forEach((function(e){t.createCadPlane(e.floorIndex)}))}}},{key:"createCadPlane",value:function(e){this.updateCadPlane(e)}},{key:"updateCadPlane",value:function(e){var t=this,n=0,i=this.floorPlanImgUrls[e],o=this.model.floors.index[e];if(console.log("开始加载floorplan_".concat(e,".png, imgUrl: ").concat(i)),i){var r=o.deferred=new oe;return n=this.player.modeTran&&"floorplan"==this.player.modeTran.split("-")[1]?1:0,si.load(i,(function(a){if(a.image&&o.deferred==r){o.cadImg=a.image,o.shouldShowPlane?(a.needsUpdate=!0,console.warn("加载完毕floorplan_".concat(e,".png, ").concat(i))):(a.dispose(),console.error("dispose Tex"),a=null);var s=o.plane;if(s)s.material.map=a,s.material.needsUpdate=!0;else{var l=t.createCadPlaneMaterial(a,n);s=new THREE.Mesh(ga,l),o.shouldShowPlane||(s.visible=!1)}t.model.add(s),o.plane=s,t.setCadPlanePose(s,e),o.deferred=null,r.resolve(!0)}}),(function(n){o.deferred=null,o.imgLoadFailed=!0,r.resolve(!1),t.changeModelOpacity("hidePlane"),console.warn("没有floorplan_".concat(e,".png, ").concat(i))})),o.deferred}this.deleteCadPlane(o),o.imgLoadFailed=!0}},{key:"createCadPlaneMaterial",value:function(e,t){return new THREE.MeshBasicMaterial({map:e,opacity:t,transparent:!0,side:THREE.DoubleSide,depthTest:!1})}},{key:"getCadImgUrl",value:function(e){var t=this;this.floorPlanImgUrls=[],this.app.store.getValue("metadata").floorPlanUser&&this.model.floors.forEach((function(n){var i=n.floorIndex;if("image"==e.type){var o=e.floors.findIndex((function(e){return e.subgroup==i}));if(-1==o&&(o=i),!e.floors[o])return console.error("cad缺少此楼层数据,楼层:",o);t.floorPlanImgUrls[i]=t.app.resource.getUserResourceURL(e.floors[o].filename)}else t.floorPlanImgUrls[i]=t.app.resource.getUserResourceURL("floor-cad-".concat(i,".png"))}))}},{key:"setCadPlanePose",value:function(e,t){var n,i=this.model.floors.index[t].boundingBox,o=i.getCenter(this.center),r=i.getSize(new THREE.Vector3);if(e.rotation.x=-Math.PI/2,"image"!=this.app.store.getValue("flooruser").type&&(n=this.getCadInfo(t))&&n.bound){r.x=n.bound.right-n.bound.left,r.z=n.bound.bottom-n.bound.top,o.x=(n.bound.right+n.bound.left)/2,o.z=(n.bound.bottom+n.bound.top)/2;var a=this.app.store.getValue("metadata"),s=parseFloat(a.floorPlanAngle||0);e.rotation.z=s}e.renderOrder=Xe,e.name="floorplanImg",this.adjustModelForPlane(i,t,r,o,!1,n)}},{key:"adjustModelForPlane",value:function(e,t,n,i,o,r){var a=this.model.floors.index[t];if(o)a.plane.position.y=e.max.y+_e.planeHeightShift;else if(n=n||e.getSize(new THREE.Vector3),i=i||e.getCenter(new THREE.Vector3),r){var s=a.cadImg.width,l=a.cadImg.height,c=a.cadImgRatio=n.x/(s-r.left-r.right),u=c*s,h=c*l;this.width=u,this.height=h;var d=(r.left-r.right)/2*c,p=(r.top-r.bottom)/2*c;a.plane.position.set(i.x-d,e.max.y+_e.planeHeightShift,i.z-p),a.plane.scale.set(u,h,1)}else a.plane.scale.set(n.x,n.z,1),a.plane.position.copy(i).setY(e.max.y+_e.planeHeightShift)}},{key:"setVisibleForCadImg",value:function(){var e=this,t=0===this.app.store.getValue("metadata").controls.showBigMap;if(this.show&&!t)return this.ready?void((this.app.TagManager.showTagsVisible||this.app.ViewLinkEdit.markView||this.player.EditOverlay.isAdding||this.player.EditOverlay.editPlane||this.player.GLTFEditor.adding||this.player.GLTFEditor.selecting)&&this.hideCadPlane()):this.deferred.then((function(){return e.showCadPlane()}))}},{key:"showCadPlane",value:function(e){var t=this,n=0===this.app.store.getValue("metadata").controls.showBigMap;null==e&&(e=this.model.currentFloor.floorIndex);var i=this.model.floors.index[e];if(!this.show||n||this.app.TagManager.showTagsVisible||this.app.ViewLinkEdit.markView||this.player.EditOverlay.isAdding||this.player.EditOverlay.editPlane||this.player.GLTFEditor.adding||this.player.GLTFEditor.selecting||this.model.$app.Plugins.EditCAD&&this.model.$app.Plugins.EditCAD.display&&"image"==!this.app.store.getValue("flooruser").type)return i.shouldShowPlane=!1;if(!i.deferred){this.model.floors.list.length>1&&this.hideCadPlane({ignoreFloor:i}),i.shouldShowPlane=!0;var o=i.plane;if(!o&&!i.imgLoadFailed){var r=this.updateCadPlane(e);return r?r.then((function(){i.shouldShowPlane&&t.showCadPlane(e)})):this.changeModelOpacity()}this.changeModelOpacity();var a=this.model.showOnFloorplan;this.model.setModelDisplay(a,"hideOnfloorplan"),o&&(o.material.opacity=1,o.visible=!0,o.material.map||(o.material.map=new THREE.Texture(i.cadImg),o.material.map.needsUpdate=!0,o.material.needsUpdate=!0))}}},{key:"hideCadPlane",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.ignoreFloor;if(!this.ready)return this.deferred.then((function(){return e.hideCadPlane()}));this.model.floors.forEach((function(e){n!=e&&(e.shouldShowPlane=!1,e.plane&&(e.plane.visible=!1,e.plane.material.map&&(e.plane.material.map.dispose(),e.plane.material.map=null,e.plane.material.needsUpdate=!0)))})),this.changeModelOpacity()}},{key:"displayCadPlane",value:function(e){this.setVisible(e),e?this.showCadPlane():this.hideCadPlane()}},{key:"deleteAllCadPlanes",value:function(){var e=this;this.model.floors.forEach(function(){var t=k(S.mark((function t(n){return S.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:e.deleteCadPlane(n);case 1:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}())}},{key:"deleteCadPlane",value:function(e){e.plane&&(e.plane.geometry.dispose(),e.plane.material.map&&e.plane.material.map.dispose(),e.plane.material.dispose(),this.model.remove(e.plane),e.plane=null),e.cadImg=null,e.imgLoadFailed=!1}},{key:"updateAllCadPlanes",value:function(){var e=this,t=this.app.store.getValue("flooruser");this.getCadImgUrl(t),this.model.floors.forEach((function(t){e.deleteCadPlane(t)}))}},{key:"setModelOpacity",value:function(e){}},{key:"getVisible",value:function(){return this.show}},{key:"setVisible",value:function(e){this.show=e}}]),e}(),Aa={clampVFOV:function(e,t,n,i){return Aa.getHFOVFromVFOV(e,n,i)>t?Aa.getVFOVFromHFOV(t,n,i):e},getHFOVForCamera:function(e,t,n,i){return t||(n=(t=e.aspect)/e.aspect),Aa.getHFOVFromVFOV(e.fov,t,n,i)},getHFOVFromVFOV:function(e,t,n,i){var o=2*Math.atan(Math.tan(e*ht.RADIANS_PER_DEGREE/2)*(t/n));return i?o:o*ht.DEGREES_PER_RADIAN},getVFOVFromHFOV:function(e,t,n,i){var o=2*Math.atan(Math.tan(e*ht.RADIANS_PER_DEGREE/2)*(n/t));return i?o:o*ht.DEGREES_PER_RADIAN}};function Ea(e,t){var n=this;this.sid=e.sid,this.showSid=e.showSid,this.text=e.text||"",this.state=e.state||"active",this.player=t,this.app=t.$app,this.elem=document.createElement("div"),this.elem.className="ruler",this.elem.setAttribute("data-name",""),this.elem.style.display="none",this.elem.innerHTML='\n\t\t<div class="ruler-line">\n\t\t\t<em></em>\n\t\t\t<div class="ruler-label">\n\t\t\t\t<div class="ruler-label-point"></div>\n\t\t\t\t<span class="ruler-label-name">'.concat(this.text,"</span>\n\t\t\t</div>\n\t\t</div>\n\t"),this.setPoints(e.points),this.player.cornerRulers.push(this);var i=0;!function e(){document.querySelector(".widgets-rulers")?document.querySelector(".widgets-rulers").append(n.elem):i++<4&&setTimeout(e,500)}()}Ea.prototype.setPoints=function(e){this.points&&this.points[0].equals(e[0])&&this.points[1].equals(e[1])||(this.points=e,this.updateText())},Ea.prototype.updateText=function(){this.length=Math.round(100*this.points[0].distanceTo(this.points[1]))/100,this.text=this.app.config.i18n("common.about")+this.length+this.app.config.i18n("common.meter")+(this.showSid?" | "+this.sid:""),this.elem.querySelector(".ruler-label-name").innerText=this.text},Ea.prototype.remove=function(){this.elem.remove()},Ea.prototype.getCrossPoint=function(e,t){var n,i,o,r=this.player.domElement.clientWidth,a=this.player.domElement.clientHeight,s=(t.x-e.x)/(t.y-e.y),l=function(t){return s*(t-e.y)+e.x},c=function(t){return 1/s*(t-e.x)+e.y};return t.x>r||t.x<0?(o=t.x>r?r:0,t.y<0||t.y>a?((n=l(i=t.y<0?0:a))>r||n<0)&&(i=c(n=o)):i=c(n=o)):n=l(i=t.y<0?0:a),new THREE.Vector2(n,i)},Ea.prototype.getPosInCrossPoint=function(e,t){var n=this.player.domElement.clientWidth,i=this.player.domElement.clientHeight;return ge.getCrossPointAtRect(e,t,n,i,0,0)},Ea.prototype.getPosAtSphere=function(e){this.fishPoints=[],this.points.forEach(function(t){var n=pt.getPosAtSphere(t.clone(),e);this.fishPoints.push(n)}.bind(this))};Ea.prototype.getPosInScreen=function(e,t,n){var i=e.point.clone().add(t.point).multiplyScalar(.5),o=pt.getPos2d(i,this.player);if(o.trueSide){var r=e.pos2d.trueSide?e.pos2d:t.pos2d;return o.inSight&&(o.pos=this.getPosInCrossPoint(r.pos,o.pos),o.vector=null),{result:"p1p2",p1:r,p2:o}}if(!(n+1>1)){var a=e.pos2d.trueSide?e:t;return this.getPosInScreen(a,{point:i,pos2d:o},++n)}},Ea.prototype.update=function(){if("panorama"==this.player.mode&&"active"==this.state){var e=pt.getPos2d(this.points[0],this.player),t=pt.getPos2d(this.points[1],this.player);if(!e.trueSide||!t.trueSide){if(!e.trueSide&&!t.trueSide)return void(this.elem.style.display="none");var n=this.getPosInScreen({point:this.points[0],pos2d:e},{point:this.points[1],pos2d:t},0);if(!n)return void(this.elem.style.display="none");e=n.p1,t=n.p2}var i=e.pos,o=t.pos,r=i.distanceTo(o);if(0!=r){var a=Math.acos((i.x-o.x)/r);a%=360,a*=180/Math.PI;var s=i.clone().sub(o),l=new THREE.Vector3(s.x,s.y,0),c=new THREE.Vector3(1,0,0);a*=l.cross(c).z>0?1:-1;var u=this.elem.querySelector(".ruler-line");u.style.width=r+"px",u.style.left=t.pos.x+"px",u.style.top=t.pos.y+"px",u.style.transform="rotate("+-a+"deg)";var h,d,p=.5,f=this.player.domElement.clientWidth,m=this.player.domElement.clientHeight;if(e.inSight&&t.inSight)h=(i.x+o.x)/2;else{var v,g;v=e.inSight?i.clone():this.getCrossPoint(o,i),g=t.inSight?o.clone():this.getCrossPoint(i,o);var y=v.clone().add(g).multiplyScalar(.5);if(h=y.x,d=y.y,y.x>f||y.x<0||y.y>m||y.y<0)return void(this.elem.style.display="none");if(o.x==i.x){if(o.y==i.y)return void console.warn("pos1和2一样???");p=o.y<i.y?(d-o.y)/(i.y-o.y):(o.y-d)/(o.y-i.y)}else p=o.x<i.x?(h-o.x)/(i.x-o.x):(o.x-h)/(o.x-i.x);if(p<0||p>1)return void(this.elem.style.display="none")}this.elem.style.display="";var A=this.elem.querySelector(".ruler-label");"left"!=this.dir&&h<f/2||"right"==this.dir?A.classList.add("reverse"):A.classList.remove("reverse"),A.style.transform="rotate("+a+"deg)",A.style.left=100*p+"%"}else console.warn("ruler间距为0!")}else this.elem.style.display="none"};var ba,wa="scene-renderer-context-created",xa="after-render",Ca=Fe.urlHasValue("pointLabel"),Ta=Ca,Ia={backgroundColor:{r:255,g:255,b:255,a:.4},textColor:{r:0,g:0,b:0,a:1},borderRadius:15,renderOrder:50},ka=function(){function e(t){o(this,e),this.app=t,this.roomInfo={},this.rulerVisi=!1,this.version=2,this.cad=null,this.planeNeedAdjust=[],this.appType=null,this.showRulers=Ca,this.updateList=[]}return u(e,[{key:"init",value:function(e){if(this.model=e,ba=this.app.core.get("Player"),Object.keys(this.roomInfo).length&&this.roomInfo[Object.keys(this.roomInfo)[0]].rooms.length)return!1;var t=this.app.store.getValue("metadata"),n=this.app.store.getValue("flooruser");return this.initRoomInfo(De.CloneJson(n)),t&&t.controls.showScale?(this.showRulers=!0,!0):void 0}},{key:"switchDisplay",value:function(e){this.showRulers=!!e,this.updateRulersVisi()}},{key:"initRoomInfo",value:function(e){var t=this;new THREE.MeshBasicMaterial({transparent:!0,wireframe:!0,opacity:.3,color:"#ff9999",depthTest:!1,side:THREE.DoubleSide});var n=new THREE.Object3D;this.model.add(n),n.visible=!1,this.cad=e,this.initFloorPlan(e);this.app.core.get("SceneRenderer").on(xa,(function(e){ba.lastFrameChanged&&(De.intervalTool.isWaiting("updateRulersVisi_"+t.app.resource.num,(function(){t.updateRulersVisi()}),500),t.updateList.forEach((function(e){e.update()})))}))}},{key:"initFloorPlan",value:function(e){var t=this;De.timeMeasuring.addTimeMark("initFloorPlan","start"),e.floors.forEach((function(e,n){var i=ba.model.floors.index[n];if(i){var o=i.boundingBox.min.y,r=i.boundingBox.max.y;for(var a in e.bottom=o,e.top=r,e.points){var s=e.points[a],l=s.parent,c=t.getPos3dFrom2d(s,o),u=t.getPos3dFrom2d(s,r),h={point:s,horizons:[],verti:null};for(var d in h.verti=t.addRuler(c,u,"floor".concat(n,"-p").concat(a,"-verti")),l)if("null"!=d&&e.walls[d]){l[d];var p=e.walls[d].start==a?"end":"start",f=e.walls[d][p],m=t.getHorRuler(a,f,n,o);h.horizons.push(m)}else console.warn("该点有wall == null的walls",s);h.horizons=h.horizons.sort((function(e,t){return e.angle-t.angle})),s.pointRulerInfo=h,Ca&&t.addLabel(s,c,i)}}else console.error("没找到floor",e)})),De.timeMeasuring.addTimeMark("initFloorPlan","end",!0)}},{key:"getHorRuler",value:function(e,t,n,i){e==t&&console.error("p1Id == p2Id");var o=e.split("Point")[1],r=t.split("Point")[1],a="f".concat(n,"-").concat(o,"-").concat(r,"-hor"),s="f".concat(n,"-").concat(r,"-").concat(o,"-hor"),l=ba.cornerRulers.find((function(e){return e.sid==a}));if(l)return{ruler:l,angle:l.angle};if(l=ba.cornerRulers.find((function(e){return e.sid==s})))return{ruler:l,angle:(l.angle+Math.PI)%(2*Math.PI)};var c=this.cad.floors[n],u=c.points[e],h=c.points[t];return(l=this.addRuler(this.getPos3dFrom2d(u,i),this.getPos3dFrom2d(h,i),a,Ta)).angle=(new THREE.Vector2).subVectors(h,u).angle(),l.pointIds=[e,t],{ruler:l,angle:l.angle}}},{key:"addRuler",value:function(e,t,n,i){return new Ea({sid:n,points:[e,t],state:"unable",showSid:i},ba)}},{key:"addLabel",value:function(e,t,n){var i=new Ce(Object.assign({},Ia,{text:e.vectorId.split("Point")[1],player:ba}));i.sprite.material.depthTest=!0;var o=t.clone();o.y+=.2,i.position.copy(o),n.add(i),Ia.scale||(Ia.scale=ge.linearClamp(this.model.size.length(),10,500,.5,7));var r=Ia.scale;i.scale.set(r,r,r)}},{key:"getPos3dFrom2d",value:function(e,t){return new THREE.Vector3(e.x,t,-e.y)}},{key:"getPos2dFrom3d",value:function(e){return new THREE.Vector2(e.x,-e.z)}},{key:"isShelter",value:function(e,t,n){var i,o=[t,n],r=[];return t.parent&&r.push.apply(r,H(Object.keys(t.parent))),n.parent&&r.push.apply(r,H(Object.keys(n.parent))),!!Object.values(e.walls).find((function(a){if(!r.some((function(e){return e==a.vectorId}))){var s=[e.points[a.start],e.points[a.end]];return(i=ge.isLineIntersect(o,s))?ge.closeTo(i.x,t.x,.01)&&ge.closeTo(i.y,t.y,.01)||ge.closeTo(i.x,n.x,.01)&&ge.closeTo(i.y,n.y,.01)?void 0:i:void 0}}))}},{key:"ifPanoSeePoints",value:function(e){var t=this;De.timeMeasuring.addTimeMark("ifPanoSeePoints","start");var n=e.getVideoFilter();e.visibleRulerInfos=[];var i=this.getPos2dFrom3d(e.position),o=this.cad.floors[e.floorIndex];if(!o){if(ba.model.floors.index[e.floorIndex]||1!=ba.model.floors.length)return void console.error("ifPanoSeePoints 没找到楼层");o=ba.model.floors.list[0]}var r=o.bottom,a=1/(2*Math.sin(THREE.MathUtils.degToRad(5))),s=THREE.MathUtils.degToRad(5),l=function(l){var c=o.points[l],p=c.pointRulerInfo.horizons,f=(new THREE.Vector2).subVectors(i,c).angle(),m=[];if(p.length>2){var v=p.find((function(e){return e.angle>f}));if(v){var g=p.indexOf(v);m=0==g?[v,p[p.length-1]]:[p[g-1],v]}else m=[p[0],p[p.length-1]]}else m=p;if(i.distanceTo(c)>m.reduce((function(e,t){return e+t.ruler.length}),0)*a)return"continue";var y=t.getPos3dFrom2d(c,r);if(n&&n(y))return Ca&&console.log("点在视频区域内",c),"continue";var A=[];if(m.forEach((function(a,s){A[s]={},a.anotherPoint2d=o.points[a.ruler.pointIds.find((function(e){return e!=l}))],a.anotherPoint=t.getPos3dFrom2d(a.anotherPoint2d,r);var u=(new THREE.Vector2).addVectors(a.anotherPoint2d,c).multiplyScalar(.5);return t.isShelter(o,u,i)?(Ca&&console.log("isShelter线段中点被遮挡",a.ruler.pointIds,e.id),void(A[s].lineShelter=!0)):n&&n(a.anotherPoint)?(Ca&&console.log("端点在视频区域内",a),void(A[s].coverVideo=!0)):n&&e.getVideoFilter("across").apply(void 0,H(a.ruler.points))?(Ca&&console.log("线横跨视频区域",a),void(A[s].coverVideo=!0)):(A[s].panoToSidePoint=(new THREE.Vector3).subVectors(a.anotherPoint,e.position).setY(0),void A[s].panoToSidePoint.normalize())})),0==(m=m.filter((function(e,t){return!A[t].coverVideo&&!A[t].lineShelter}))).length)return"continue";A=A.filter((function(e,t){return!e.coverVideo&&!e.lineShelter}));var E=(u=(new THREE.Vector3).subVectors(y,e.position).setY(0)).lengthSq();u.normalize();var b=void 0,w=void 0,x=void 0,C=void 0;if(2==m.length?(h=(new THREE.Vector3).subVectors(y,m[0].anotherPoint).setY(0),d=(new THREE.Vector3).subVectors(y,m[1].anotherPoint).setY(0),u.clone().cross(h).y,u.clone().cross(d).y,(f>=0&&f<m[0].angle||f>m[1].angle&&f<2*Math.PI)&&(m=[m[1],m[0]]),x=A[0].panoToSidePoint,C=A[1].panoToSidePoint):(x=A[0].panoToSidePoint,C=u),w=(new THREE.Vector3).addVectors(x,C).normalize(),b=Math.acos(x.dot(C)),u.dot(w)<0&&(w.negate(),b=2*Math.PI-b),b<s)return Ca&&console.log("coverRad过小",l,e.id,b.toFixed(3)),"continue";e.visibleRulerInfos.push({pId:c.vectorId,point:c,neibourHorizons:m,coverRad:b,panoToPoint:u,disSquaredToPano:E,backSide:void 0,midVec:w})};for(var c in o.points){var u,h,d;l(c)}De.timeMeasuring.addTimeMark("ifPanoSeePoints","end",!0)}},{key:"updateRulersVisi",value:function(){this.lastShowRulers&&this.lastShowRulers.forEach((function(e){e.state="unable"}));var e=ba.currentPano;if(this.updateList=this.lastShowRulers||[],!this.showRulers||ba.flying||"panorama"!=ba.mode||!e.isAligned()||at.vrEnabled&&at.vrSplitScreen)this.lastShowRulers=[];else{e.visibleRulerInfos||this.ifPanoSeePoints(e);var t=ba.getDirection().setY(0).normalize();ba.position;var n=this.getPos2dFrom3d(ba.position),i=Aa.getHFOVForCamera(ba.cameraControls.activeControl.camera,null,null,!0),o=De.sortByScore(e.visibleRulerInfos,[],[function(e){var n=Math.acos(e.midVec.dot(t)),o=Math.min(e.coverRad/2+n,i/2)+Math.min(e.coverRad/2-n,i/2),r=.5*(Math.PI-n),a=5+e.disSquaredToPano/30,s=3*Math.pow(1+o+r,3),l=s/a;return e.logMsg="v ".concat(o,", v2 ").concat(r,", v复合").concat(s,", dis复合 ").concat(a,", "),l}]);if(Ca&&console.log(o),o[0]){o[0].item.neibourHorizons.forEach((function(t){return t.ruler.points.forEach((function(t){return t.y=e.floorPosition.y}))})),o[0].item.point.pointRulerInfo.verti.points[0].y=e.floorPosition.y,o[0].item.point.pointRulerInfo.verti.updateText();var r=o[0].item.neibourHorizons.map((function(e){return e.ruler})).concat(o[0].item.point.pointRulerInfo.verti);if(r.forEach((function(e){e.dir=null,e.state="active"})),this.lastShowRulers=r,this.updateList=De.getUnionSet(this.updateList,r),2==o[0].item.neibourHorizons.length){var a=n.distanceTo(o[0].item.point),s=o[0].item.neibourHorizons[0].ruler,l=o[0].item.neibourHorizons[1].ruler;s.length<a/2&&(s.dir="left"),l.length<a/2&&(l.dir="right")}}}this.updateList.forEach((function(e){e.update()}))}}]),e}();function Ba(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}var Pa,Ra=1.5,Ma=function(e){f(n,THREE.Object3D);var t=Ba(n);function n(e){var i;return o(this,n),(i=t.call(this)).app=e,i.getArrow(),i.createArrows(),i}return u(n,[{key:"getArrow",value:function(){var e=new THREE.Object3D,t=yi.createLine([new THREE.Vector3,new THREE.Vector3(0,0,3)]),n=new THREE.Mesh(new THREE.BoxGeometry(.1,.1,Ra));n.position.set(0,0,4.25);var i=new THREE.Mesh(new THREE.CylinderBufferGeometry(0,.3,.5,12,1,!1));i.position.set(0,0,5.25),i.rotation.set(Math.PI/2,0,0),e.add(n),e.add(t),e.add(i),this.arrowGroup=e}},{key:"createArrows",value:function(){var e=this;new THREE.MeshBasicMaterial({color:"#00d7df",side:2,transparent:!0,opacity:.8,depthWrite:!1});var t={x:"#ea3f3f",y:"#86c215",z:"#3396f8"};["x","y","z"].forEach((function(n){var i=(new THREE.Color).set(t[n]),o=e.arrowGroup.clone();o.children.forEach((function(e){e.material=e.material.clone(),e.material.color.copy(i)}));var r=e.createLabel(n,i);r.position.set(0,0,6*1.05),o.add(r);var a=e.createLabel("1m",i,20,.4);a.position.set(0,0,1),o.add(a),"y"==n?o.rotation.x=-Math.PI/2:"x"==n&&(o.rotation.y=Math.PI/2),e.add(o)}))}},{key:"createLabel",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:120,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1.2,o=new Ce({backgroundColor:{r:0,g:0,b:0,a:0},textColor:{r:255*t.r,g:255*t.g,b:255*t.b,a:1},fontsize:n,renderOrder:5,player:this.app.core.get("Player"),text:e,name:"axis"});return o.scale.set(i,i,i),o}}]),n}();function Sa(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}var Da=Fe.urlHasValue("highMapColor"),La=Le(Pa=function(e){f(n,THREE.Object3D);var t=Sa(n);function n(e){var i;o(this,n),(i=t.call(this)).setupCustomProperties=function(){var e=at.modelAlpha;Object.defineProperty(this,"alpha",{get:function(){return e},set:function(t){e=t,this.chunks.forEach((function(t){t.material&&t.material.uniforms.modelAlpha&&(t.material.uniforms.modelAlpha.value=e,e?"useModelMap"in t.material.defines||(t.material.defines.useModelMap="",t.material.needsUpdate=!0):"useModelMap"in t.material.defines&&(delete t.material.defines.useModelMap,t.material.needsUpdate=!0))}))}})},i.build=function(){var e=this;this.currentFloor=this.floors.last(),this.floors.build(),this.colliders=this.floors.reduce((function(e,t){return e.concat(t.collider.children)}),[]),this.panos.forEach((function(t){t.build1(),t.on("enter",(function(){t.floor!==e.currentFloor&&e.setFloor(t.floor)}))})),this.panos.forEach((function(e){e.build2()})),this.floors.forEach(function(e){this.boundingBox.union(e.boundingBox)}.bind(this));var t=new THREE.Vector3,n=new THREE.Vector3;this.boundingBox.getSize(t),this.boundingBox.getCenter(n),this.size=t,this.center=n,this.floors.forEach(function(e){ft.info("Floor "+e+": "+e.children.length+" chunks, "+e.panos.length+" panos.")}.bind(this)),this.skybox=new vo(this.boundingBox),this.skybox.matrixWorldNeedsUpdate=!0,this.add(this.skybox),this.skyBoxTight=new vo(this.boundingBox,2),ft.debug("Done building model"),so.raycastsDone>0&&(ft.warn("raycasts: "+so.raycastsDone),ft.warn("raycasts skipped: "+so.raycastsSkipped)),this.floorLogos.createFloorLogo(),this.add(this.floorLogos.firstLogo),this.add(this.floorLogos.secondLogo),Fe.urlHasValue("axis")&&this.add(new Ma(this.$app)),setTimeout((function(){e.floorplanCadImg.init(e),e.wallManager.init(e)}),100),this.addHighMapCube();var i=this.$app.core.get("PanoVideoRenderer").videosInfo;if(i){var o=i.parameters;this.updateVideoRenderParameters(o)}if(this.builded=!0,this.dispatchEvent({type:"builded"}),this.texSizeBlock=this.chunks.reduce((function(e,t){var n=t.material.uniforms.map.value;return e+Math.pow(n.image.width/512,2)}),0).toFixed(1),this.$app.config.mobile&&Fe.urlHasValue("vlog")){setInterval((function(){var t=e.getDrawedTexCount().toFixed(1),n=document.querySelector("#app .information .title span");n&&(n.innerText=t+"|"+e.$app.core.get("Player").lowTile)}),1e3);var r=document.querySelector("#app .information .right");r&&r.addEventListener("click",(function(){window.logEnable=!window.logEnable}))}return this.texSizeBlock>40&&setTimeout((function(){var t,n=e.$app.core.get("Player"),i=e.$app.config.mobile?100:60,o=e.texSizeBlock-Math.min(.5*e.texSizeBlock,i),r=[],a={update:function(){if("panorama"!=n.mode||n.flying||n.lastFrameChanged)r.length=0;else{t&&(delete t.material.defines.useModelMap,t.material.needsUpdate=!0,t=null);var i,a=e.getDrawedTexCount();if(a>o)(i=e.chunks.find((function(e){var t=e.material.uniforms.map.value;return t&&t._listeners&&t._listeners.dispose&&t._listeners.dispose.length>0})))&&i.material.uniforms.map.value.dispose();else if(a<o){var s=De.sortByScore(e.chunks,[function(e){if(!r.includes(e)){var t=e.material.uniforms.map.value;return t&&!(t._listeners&&t._listeners.dispose&&t._listeners.dispose.length>0)&&Math.pow(t.image.width/512,2)+a<=o}}],[function(t){var i=0;return t.floor==e.currentFloor&&(i+=1),ge.isInsideFrustum(t.geometry.boundingBox,n.camera)&&(i+=1),i}]);s.length&&((i=s[0].item).material.defines.useModelMap="",i.material.needsUpdate=!0,t=i,r.push(i))}}}};e.$app.core.get("SceneRenderer").addComponent(a)}),1e3),Promise.resolve(this)},i.toggleAlpha=function(){this.alpha<1?this.alpha=1:this.alpha=0},i.waitForLoad=function(e,t){t()||(this.waitQueue.push({object:e,isLoadedCallback:t}),1===this.waitQueue.length&&this.emit("waiting"))},i.hide=function(){this.floors.hide()},i.show=function(){this.floors.show()},i.floorNames=function(){return this.floors.names()},i.setFloor=function(e,t){this.allFloorsVisible&&this.emit("allfloors.toggled",!1,this.currentFloor),this.allFloorsVisible=!1,this._setFloor(e,t)},i.toggleAllFloors=function(e){this.allFloorsVisible=void 0!==e?e:!this.allFloorsVisible,this.emit("allfloors.toggled",this.allFloorsVisible,this.currentFloor),this._setFloor(this.currentFloor)},i._setFloor=function(e,t){var n=this;t=t||this.mode;var i=this.currentFloor;this.currentFloor=e,this.$app.core.get("Player").mode,t===xt.PANORAMA?this.show():t!==xt.FLOORPLAN&&t!==xt.DOLLHOUSE||this.floors.list.forEach(function(e,t){var n=e===this.currentFloor||this.allFloorsVisible;e.toggle(n)}.bind(this)),this.emit("floor.changed",this.currentFloor,t,i),setTimeout((function(){return n.$app.core.get("SceneRenderer").update3dTiles({force:!0})}),10)},i.toggleExplode=function(){this.floors.toggleExplodeHorizontal()},i.toggleExplodeUp=function(){this.floors.toggleExplodeVertical()},i.nextFloor=function(e){return this.floors.nextFloor(this.currentFloor,e)},i.addFloor=function(e){this.floors.add(e)},i.getFloorAtPoint=function(e){return this.floors.getFloorAtPoint(e)},i.addTile=function(e,t){this.floors.getOrMakeFloor(e).addTile(t)},i.removeTile=function(e){this.floors.getOrMakeFloor(e.floorIndex).removeTile(e)},i.addChunk=function(e,t){this.floors.getOrMakeFloor(e).addChunk(t)},i.setMode=function(e){var t=this;if(!this.supportedModes[e])throw new BasicException("Mode not supported for this model: "+e);this.mode=e,this.chunks.forEach((function(n){n.setMode(e,t.player.modeTran)}))},i.updateProjectedPanos=function(e){this.projectedPano0&&this.projectedPano1&&(e==this.projectedPano0||e==this.projectedPano1)&&this.setProjectedPanos(this.projectedPano0,this.projectedPano1,!1)},i.setProjectedPanos=function(e,t,n){null!=n||(n=!0),n=!!n,this.projectedPano0=e,this.projectedPano1=t,this.skybox.material.setProjectedPanos(e,t,n),this.chunks.forEach((function(i){i.materialInside.setProjectedPanos(e,t,n)})),this.highMapCube&&this.highMapCube.tiles.forEach((function(i){i.material.setProjectedPanos(e,t,n)}))},i.setSide=function(e){this.floors.forEach((function(t){t.collider.material.side=e}))},i.fadePanoMarkers=function(e,t){var n=this,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},o=i.mode,r=i.hideVideoFlag;if(this.player){var a=this.player.currentPano;if(at.vrEnabled&&"portrait"!=window.VRScreenType)this.updateVrMarker();else{var s=this.$app.core.get("PanoVideoRenderer").canShowMarker(),l=function(){var e=[],i=[];n.player.model.panos.forEach((function(t){t.hasVideo||t.panoVideo?r||!t.hasNeighbor()||t.floor.hidden||!s?i.push(t):e.push(t):i.push(t)})),n.panos.fadeMarkerOpacity(1,t,[{toOp:0,member:i},{toOp:at.panorama.markerOpacity,member:e}])};if(0==e)l();else if((o||this.player.mode)==xt.PANORAMA&&a){var c=[],u=[],h=a.getVideoFilter();this.player.model.panos.forEach((function(e){h&&h(e.position)||!(a.seeMarkers.indexOf(e.id)>-1)?u.push(e):c.push(e)})),this.panos.fadeMarkerOpacity(e,t,[{toOp:at.panorama.markerOpacity,member:c},{toOp:0,member:u}])}else"panorama"!=this.player.modeTran.split("-")[1]&&l()}}},i.outsideAllowed=function(){return this.supportedModes[xt.DOLLHOUSE]&&this.supportedModes[xt.FLOORPLAN]},i.getOption=function(e){return{autoload:!1,floors:!0,local:!1,url:e.config.num,urlFiles:"http://www.4dage.com/BigScene7niu/api/player/models/"+e.config.num+"/files",useVisionModelData:!0}},i.getModelMeta=function(e){return{sid:e.config.num,name:"四维时代",status:"viewable",floors:"",metainfo:{allowed_methods:["GET","OPTIONS","HEAD"]},image:"http://7xo6he.com2.z0.glb.qiniucdn.com/images/images1/07.13.2015_16.22.30.jpg",images:[],job:{uuid:"dacf7dfa24ae47fab8fcebfe4dc41ab9"},layers:[]}};var r=i.getOption(e),a=i.getModelMeta(e);return i.$app=e,i.sid=a.sid,i.data=a,i.options=r,i.urls=new Ct(i.sid,e),i.outdoorPanoLocations=[],i.floors=new Mt(h(i)),i.floorsEnabled=void 0===r.floors||r.floors,i.changingFloor=!1,i.panos=new co(e),i.colliders=[],i.loadPanosPromise=null,i.loadMeshTexturesPromise=null,i.auxDataPromise=null,i.mesh3dTilesLoaded=!1,i.meshTexturesLoaded=!1,i.meshTextures=[],i.mattertags={},i.tagsShown=!1,i.shouldShowMattertags=!1,i.has360Views=!1,i.showingLabels=at.labels.enabled&&a.player_options.labels,i.supportedModes={},i.supportedModes[xt.PANORAMA]=!0,i.supportedModes[xt.DOLLHOUSE]=!a.player_options||a.player_options.dollhouse&&Fe.valueFromHash("dh",1),i.supportedModes[xt.FLOORPLAN]=!a.player_options||a.player_options.floor_plan&&Fe.valueFromHash("dh",1),i.supportedModes[xt.TRANSITIONING]=!0,i.supportsTiles=!0,i.supportsVR=a.is_vr,i.mode=xt.DOLLHOUSE,i.size=null,i.center=null,i.boundingBox=new THREE.Box3,i.currentFloor=null,i.allFloorsVisible=!0,i.projectedPano0=null,i.projectedPano1=null,i.floorsEnabled&&a.floors&&-1!==a.floors.indexOf(",")&&a.floors.split(",").forEach(function(e,t){this.addFloor(new Floor(this,t,e.trim()))}.bind(h(i))),i.waitQueue=[],i.on("load",function(e){0!==this.waitQueue.length&&(this.waitQueue=this.waitQueue.filter((function(e){return!e.isLoadedCallback()})),0===this.waitQueue.length&&this.emit("waiting-done"))}.bind(h(i))),i.setupCustomProperties(),i.vrMarkers=[],i.floorLogos=new ko(i.$app),i.floorplanCadImg=new ya(i.$app),i.wallManager=new ka(i.$app),i}return u(n,[{key:"chunks",get:function(){var e=[];return this.floors.forEach((function(t){return e.push.apply(e,H(t.chunks))})),e}},{key:"getDrawedTexCount",value:function(){return this.chunks.reduce((function(e,t){var n=t.material.uniforms.map.value;return n?e+(n._listeners&&n._listeners.dispose&&n._listeners.dispose.length>0?Math.pow(n.image.width/512,2):0):e}),0)}},{key:"createTranControl",value:function(e){var t={player:e,dontHideWhenFaceCamera:!0,scaleAxis:["x","y"],NoScaleZ:!0};this.transformControls=new Dr(e.camera,e.domElement,t),this.transformControls.space="local",this.transformControls.setSize(1.2),this.add(this.transformControls),this.transformControls.visible=!1,this.transformTool=new Kr(e),this.add(this.transformTool)}},{key:"updateVideoTexture",value:function(e){this.skybox&&(this.skybox.material.uniforms.videoTexture.value=e),this.chunks.forEach((function(t){t.materialInside.uniforms.videoTexture.value=e})),this.highMapCube&&this.highMapCube.tiles.forEach((function(t){t.material.uniforms.videoTexture.value=e}))}},{key:"suspendVideoRender",value:function(){this.skybox&&(this.skybox.material.uniforms.videoReady.value=0),this.chunks.forEach((function(e){e.materialInside.uniforms.videoReady.value=0})),this.highMapCube&&this.highMapCube.tiles.forEach((function(e){e.material.uniforms.videoReady.value=0}))}},{key:"resumeVideoRender",value:function(){this.skybox&&(this.skybox.material.uniforms.videoReady.value=1,this.skybox.material.uniforms.progress.value=1),this.chunks.forEach((function(e){e.materialInside.uniforms.videoReady.value=1,e.materialInside.uniforms.progress.value=1})),this.highMapCube&&this.highMapCube.tiles.forEach((function(e){e.material.uniforms.videoReady.value=1,e.material.uniforms.progress.value=1}))}},{key:"updateVideoRenderParameters",value:function(e){var t=[this.skybox.material].concat(H(this.chunks.map((function(e){return e.materialInside}))));this.highMapCube&&this.highMapCube.tiles.forEach((function(e){t.push(e.material)})),t.forEach((function(t){t.uniforms.parameters.value.set(e.inputWidth,e.inputHeight,e.outputWidth,e.outputHeight,e.focal,e.pixel,e.centerX,e.centerY,e.translateX,e.translateY,e.translateZ,0,e.lenOffsetX,e.lenOffsetY,e.videoWidth,e.videoHeight),8==e.cameraType?t.defines.HasVideo=8:2==e.cameraType?t.defines.HasVideo=2:3==e.cameraType&&(t.defines.HasVideo=3),t.defines.VideoMapping=e.mapping,t.needsUpdate=!0}))}},{key:"updateVrMarker",value:function(e){var t=this;if(this.player.currentPano.isAligned()){if(e=null==e?at.vrEnabled:e)for(var n in this.panos.index){var i=this.panos.index[n];i.isAligned()&&(i.marker.opacity=0)}else this.fadePanoMarkers(null,null);this.vrMarkers.forEach((function(n){var i=e&&t.player.currentPano.id!=n.pano.id&&!!t.player.currentPano.neighbourPanos[n.pano.id];//!! 是防止undefined
- De.updateVisible(n,"vr",i)}))}}},{key:"addHighMapCube",value:function(){var e=this;if("4k"==this.$app.core.get("QualityManager").tileClass&&2048==this.$app.core.get("QualityManager").maxRenderTargetSize){var t=new THREE.PlaneGeometry(1,1,1,1),n=new THREE.Object3D;n.tiles=[];for(var i=0;i<6;i++){for(var o=new THREE.Object3D,r=0;r<8;r++)for(var a=0;a<8;a++){var s=new THREE.Mesh(t,new fo({side:THREE.DoubleSide,depthTest:!1,transparent:!0,defines:{BasePanoMap:""}}));if(s.material.uniforms.progress.value=1,s.material.uniforms.modelAlpha.value=0,s.position.set(r-3.5,a-3.5,-4),Da){s.material.uniforms.opacity.value=.4;var l=Math.random();s.material.uniforms.baseColor.value=(new THREE.Color).setHSL(l,.8,.9)}s.visible=!1,s.tileX=r,s.tileY=a,s.cubeFace=i,s.renderOrder=Ne,n.tiles.push(s),o.add(s)}switch(i){case Ji:o.rotation.set(0,Math.PI/2,0);break;case Yi:o.rotation.set(0,-Math.PI/2,0);break;case Zi:var c=(new THREE.Quaternion).setFromAxisAngle(new THREE.Vector3(0,1,0),Math.PI),u=(new THREE.Quaternion).setFromAxisAngle(new THREE.Vector3(1,0,0),Math.PI/2);o.quaternion.copy(c).multiply(u);break;case Xi:c=(new THREE.Quaternion).setFromAxisAngle(new THREE.Vector3(0,1,0),Math.PI),u=(new THREE.Quaternion).setFromAxisAngle(new THREE.Vector3(1,0,0),-Math.PI/2);o.quaternion.copy(c).multiply(u);break;case Ki:o.rotation.set(0,Math.PI,0);break;case $i:o.rotation.set(0,0,0)}o.scale.set(1,-1,1),o.cubeFace=i,n.add(o)}n.name="highMapCube",this.highMapCube=n,this.add(n),n.scale.set(.21,.21,.21),this.highMapCube.visible=!1,this.highMapCube.texLoadedCount=0,this.$app.core.get("SceneRenderer").on(xa,(function(t){e.highMapCube.visibleTiles&&e.updateTiles(),e.player&&e.player.lastFrameChanged&&De.intervalTool.isWaiting("update4kTiles_"+e.$app.resource.num,(function(){var t=e.player.getDirection();e.updateTiles(t)}),500)}))}}},{key:"isHighMapLoaded",value:function(e,t,n){return!!this.highMapCube.children[e].children[8*t+n].material.uniforms.map.value}},{key:"updateTiles",value:function(e){var t=this;if(this.highMapCube&&this.highMapCube.visible&&!(this.highMapCube.tiles.filter((function(e){return e.image})).length<=10)){if(e){var n=this.player.cameraControls.cameras.panorama,i=Aa.getHFOVForCamera(n,null,null,!0)/2,o=THREE.MathUtils.degToRad(n.fov)/2,r=this.highMapCube.tiles;r.forEach((function(n){var r=n.getWorldPosition(new THREE.Vector3),a=(new THREE.Vector3).subVectors(r,t.highMapCube.position).normalize(),s=a.clone().setY(e.y).normalize().dot(e),l=Math.acos(s),c=-200;l>i+.08?n.score=-100:(c=Math.abs(Math.acos(a.y)-Math.acos(e.y)),n.score=c>o+.08?-100:-(l/i+c/o)),n.scores=l.toFixed(3)+", "+c.toFixed(3),-100==n.score&&t.resetTile(n)})),this.highMapCube.visibleTiles=r.filter((function(e){return e.score>-100}))}var a=this.highMapCube.visibleTiles.filter((function(e){return!e.material.uniforms.map.value}));if(a.length){var s=De.getBestCount({name:"4kmaxTileRecover",minCount:0,maxCount:2,durBound1:1.5,durBound2:6,ifLog:!1,maxHistory:2}),l=0;a.forEach((function(e,n){l>=s||t.recoverTile(e)&&l++}))}}}},{key:"getHighImage",value:function(e,t,n,i){this.highMapCube.children[t].children[8*n+i].image=e}},{key:"updateHighMap",value:function(e,t,n,i){var o=this.highMapCube.children[t].children[8*n+i];e&&(o.image=e);var r=o.material.uniforms;if(!r.map.value&&(!this.highMapCube.visibleTiles||this.highMapCube.visibleTiles.includes(o))){var a=new THREE.Texture;a.image=e,a.flipY=!1,a.wrapS=a.wrapT=THREE.ClampToEdgeWrapping,a.generateMipmaps=!1,a.minFilter=THREE.LinearFilter,a.needsUpdate=!0,r.map.value=a,Da&&(r.opacity.value=1),o.visible=!0,o.material.needsUpdate=!0}}},{key:"recoverTile",value:function(e){if(!e.material.uniforms.map.value)return e.image?(this.updateHighMap(e.image,e.cubeFace,e.tileX,e.tileY),!0):void 0}},{key:"resetTile",value:function(e,t){t&&(e.image=null);var n=e.material.uniforms.map.value;if(n){n.dispose(),n.loaded=!1,n.version=0;var i=this.$app.core.get("SceneRenderer").renderer.properties.get(n);this.$app.core.get("SceneRenderer").renderer.getContext().deleteTexture(i.__webglTexture),e.material.uniforms.map.value=null,Da&&(e.material.uniforms.opacity.value=.4),e.material.needsUpdate=!0,e.visible=!1}}},{key:"resetHighMap",value:function(){var e=this;this.highMapCube&&(this.highMapCube.children.forEach((function(t){return t.children.forEach((function(t){e.resetTile(t,!0)}))})),this.highMapCube.visibleTiles=null,this.hideHighMap())}},{key:"setHighMap",value:function(e){this.highMapCube&&(this.highMapCube.position.copy(e.position),this.highMapCube.quaternion.copy(e.quaternion))}},{key:"showHighMap",value:function(){this.highMapCube&&(this.highMapCube.visible=!0)}},{key:"hideHighMap",value:function(){this.highMapCube&&(this.highMapCube.visible=!1)}},{key:"showLowestTile",value:function(e){if(this._3dTilesRuntime){this._3dTilesRuntime.pauseTilesetUpdate(!1);var t=this.$app.core.get("SceneRenderer");t.autoUpdate3dTiles=!e,t.autoUpdate3dTiles&&t.update3dTiles({force:!0}),this._3dTilesRuntime.limit2lowestDepth(e),this._3dTilesRuntime.ingoreVisibleCompute(e),this._3dTilesRuntime.pauseTilesetUpdate(e)}}},{key:"setModelDisplay",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"force";this._3dTilesRuntime?this._3dTilesRuntime.getTileset().visible=e:this.chunks.forEach((function(n){return De.updateVisible(n,t,e)}))}},{key:"showOnFloorplan",get:function(){var e=this.$app.store.getValue("metadata").controls.showTexture;return e||null==e}}]),n}())||Pa;function Fa(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}var Ha=function(e){f(n,EventEmitter);var t=Fa(n);function n(e){var i;return o(this,n),e=e||{},(i=t.call(this)).position=new THREE.Vector3,i.quaternion=new THREE.Quaternion,i.update(e),i}return u(n,[{key:"isValid",value:function(){return!!this.cameraMode}},{key:"update",value:function(e){return this.cameraMode=e.cameraMode||this.cameraMode,this.pano=e.pano||this.pano,e.position&&this.position.copy(e.position),e.quaternion&&this.quaternion.copy(e.quaternion),this}}]),n}();function Va(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}var Oa=function(e){f(n,THREE.Mesh);var t=Va(n);function n(e){var i;o(this,n),i=t.call(this);var r=THREE.UniformsUtils.clone(mn.waypoint.uniforms);return r.map.value=De.loadTextureFromCache(si.getImageURL("images/blueReticle.png")),r.map.value.minFilter=THREE.LinearMipMapLinearFilter,r.map.value.anisotropy=4,r.opacity.value=0,(i=t.call(this,new THREE.PlaneBufferGeometry(.4,.4,1,1),new THREE.RawShaderMaterial({side:THREE.DoubleSide,depthWrite:!1,depthTest:!1,transparent:!0,vertexShader:mn.waypoint.vertexShader,fragmentShader:mn.waypoint.fragmentShader,uniforms:r,name:"waypoint",opacity:0}))).layers.set(Ht),i.renderOrder=qe,i.player=e,i.direction=new THREE.Vector3,i.hidden=!0,i.mouseLastMoveTime=Date.now(),i}return u(n,[{key:"move",value:function(e,t,n){this.hidden=n,this.mouseLastMoveTime=Date.now()}},{key:"hide",value:function(){this.hidden||(this.hidden=!0,Ae.start(St.property(this.material.uniforms.opacity,"value",0),at.reticuleOpacityTransitionTime))}},{key:"show",value:function(){this.hidden=!1,this.material.opacity<=0&&Ae.start(St.property(this.material.uniforms.opacity,"value",at[this.player.mode].reticuleOpacity),at.reticuleOpacityTransitionTime)}},{key:"update",value:function(){Date.now()-this.mouseLastMoveTime>at.hideReticuleTimeout&&!this.hidden&&this.hide()}},{key:"updatePosition",value:function(e,t){if(!this.hidden){if(!t)return this.hide();var n=t.point,i=e.distanceTo(n),o=1+.01*i;i<1&&(o-=1-i),this.show(),this.scale.set(o,o,o),this.direction=this.direction.multiplyScalar(.8),this.direction.add(t.face.normal.clone().multiplyScalar(.2)),this.position.copy(n).add(t.face.normal.clone().multiplyScalar(.01)),this.lookAt(this.position.clone().add(this.direction))}}}]),n}(),Qa="move",_a="interaction.direct",za="interaction.key",Ua="input.start",Na="input.pinch",Ga="input.scroll",ja="autopan.interrupt",Wa="autopan.complete",qa="autopan.clamped",Ja="longtap",Ya=Object.freeze({None:0,Queued:1,ForceQueued:2,Downloading:3,Downloaded:4,DownloadFailed:5}),Za=Object.freeze({None:0,DirectionalFOV:1}),Xa=function(){var e=function e(t,n){var i=e._panoSpaceDir,o=e._fovThreshold,r=e._fovThresholdNarrow,a=Math.max(Math.min(i.dot(t.direction),1),-1),s=Math.max(Math.min(i.dot(n.direction),1),-1);return t._dot=a,n._dot=s,a>=o&&s<o?-1:a<o&&s>=o?1:a>=r&&s<r?-1:a<r&&s>=r||t.panoSize>n.panoSize?1:n.panoSize>t.panoSize?-1:-(a-s)};return e._panoSpaceDir=new THREE.Vector3,e._fovThreshold=-1,e._fovThresholdNarrow=-1,e}(),Ka=function(){function e(t,n,i,r,a){o(this,e),this.filterAndPrioritize=function(){var t=[],n=[],i=[];return function(o,r,a){var s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:10;"360view"!=this.priorityCriteria.pano.panoType&&(this.populateNeighborPanos(this.priorityCriteria.pano,r,t),this.populateScoredPanos(this.priorityCriteria.pano,r,n,this.priorityCriteria.cameraDir,e.MAX_SCORED_PANOS_TOCONSIDER));var l=this.baseSize,c=this.standardSize,u=this.highSize,h=this.ultraHighSize;this.queueTilesForPano(o,a,this.priorityCriteria.pano,l),this.priorityCriteria.upcomingPanos&&this.queueTilesForPanos(o,this.priorityCriteria.upcomingPanos,a,l,e.MAX_UPCOMING_PANOS_TOADD),i.length=0,this.canDownloadSize(c)&&o.length<s&&this.queueTilesInDirectionForPano(i,a,this.priorityCriteria.pano,c,this.priorityCriteria.cameraPosition,this.priorityCriteria.cameraDir,e.DIRECTIONAL_FOV_NARROW),e.sortPanoTiles(i,this.priorityCriteria.pano,this.priorityCriteria.cameraDir),e.appendQueue(o,i),this.queueTilesForPanos(o,n,a,l,e.MAX_SCORED_PANOS_TOADD),i.length=0,o.length<s&&(this.canDownloadSize(u)&&o.length+i.length<s&&this.queueTilesInDirectionForPano(i,a,this.priorityCriteria.pano,u,this.priorityCriteria.cameraPosition,this.priorityCriteria.cameraDir,e.DIRECTIONAL_FOV_NARROW),this.canDownloadSize(h)&&o.length+i.length<s&&this.queueTilesInDirectionForPano(i,a,this.priorityCriteria.pano,h,this.priorityCriteria.cameraPosition,this.priorityCriteria.cameraDir,e.DIRECTIONAL_FOV_NARROW),e.sortPanoTiles(i,this.priorityCriteria.pano,this.priorityCriteria.cameraDir),e.appendQueue(o,i),i.length=0),o.length<s&&(this.canDownloadSize(c)&&o.length+i.length<s&&this.queueTilesInDirectionForPano(i,a,this.priorityCriteria.pano,c,this.priorityCriteria.cameraPosition,this.priorityCriteria.cameraDir,e.DIRECTIONAL_FOV),this.canDownloadSize(u)&&o.length+i.length<s&&this.queueTilesInDirectionForPano(i,a,this.priorityCriteria.pano,u,this.priorityCriteria.cameraPosition,this.priorityCriteria.cameraDir,e.DIRECTIONAL_FOV),this.canDownloadSize(h)&&o.length+i.length<s&&this.queueTilesInDirectionForPano(i,a,this.priorityCriteria.pano,h,this.priorityCriteria.cameraPosition,this.priorityCriteria.cameraDir,e.DIRECTIONAL_FOV),e.sortPanoTiles(i,this.priorityCriteria.pano,this.priorityCriteria.cameraDir),e.appendQueue(o,i)),this.queueTilesForPanos(o,t,a,l)}}(),this.queueTilesForPano=function(){var e={filter:Za.None};return function(t,n,i,o){if(i.tiled)return this.filterAndQueueTileDownloadDescriptors(t,n,i,o,e)}}(),this.queueTilesForPanosInDirection=function(){var e=new THREE.Vector3;return function(t,n,i,o,r,a,s,l){for(var u=0,h=0;h<i.length;h++){var d=i[h];if(e.copy(d.position),e.sub(r),e.normalize(),Math.max(Math.min(a.dot(e),1),-1)>=c.getFOVDotThreshold(s))if(u+=this.queueTilesInDirectionForPano(t,n,d,o,r,a,s)>0?1:0,l&&u>=l)break}return u}}(),this.queueTilesInDirectionForPano=function(){var e={filter:Za.DirectionalFOV,direction:new THREE.Vector3,fov:60},t=new THREE.Vector3;return function(n,i,o,r,a,s,l){if(o.tiled)return t.copy(s),eo.getRelativeDirection(o.quaternion,t),e.direction.copy(t),e.fov=l,this.filterAndQueueTileDownloadDescriptors(n,i,o,r,e)}}(),this.filterAndQueueTileDownloadDescriptors=function(){var e=[];return function(t,n,i,o,r){var a=n.getTileDownloadDescriptors(i,o);e.length=0,this.filterTileDownloadDescriptors(i,a,e,r);for(var s=0,l=0;l<e.length;l++){var c=e[l];c&&(t.push(c),s++)}return s}}(),this.filterTileDownloadDescriptors=(new THREE.Vector3,function(e,t,n,i){var o,r;switch(i.filter){case Za.DirectionalFOV:for(o=0;o<t.length;o++)r=t[o],eo.isTileWithinFOV(r.panoSize,r.tileSize,r.face,r.tileX,r.tileY,i.direction,i.fov)&&n.push(r);break;default:for(o=0;o<t.length;o++)r=t[o],n.push(r)}for(o=0;o<n.length;o++)r=n[o],this.canIncludeDescriptor(r)||(n[o]=null)}),this.qualityManager=t,this.maxNavQuality=this.qualityManager.getMaxNavPanoSize(),this.maxZoomQuality=this.qualityManager.getMaxZoomPanoSize(),this.baseSize=n,this.standardSize=i,this.highSize=r,this.ultraHighSize=a,this.priorityCriteria=new e.PriorityCriteria(null,new THREE.Vector3(0,0,0),new THREE.Vector3(0,0,-1),new THREE.Vector3(0,0,-1))}return u(e,[{key:"updateCriteria",value:function(e,t,n,i){this.priorityCriteria.pano=e,this.priorityCriteria.cameraPosition.copy(t),this.priorityCriteria.cameraDir.copy(n),this.priorityCriteria.upcomingPanos=i,this.maxNavQuality=this.qualityManager.limitQuality&&e.curTileQuality?e.curTileQuality:this.qualityManager.getMaxNavPanoSize(),this.maxZoomQuality=this.qualityManager.getMaxZoomPanoSize()}},{key:"canDownloadSize",value:function(e){return this.maxNavQuality>=e||this.maxZoomQuality>=e&&this.zoomingActive}},{key:"populateNeighborPanos",value:function(e,t,n){(n=n||[]).length=0;var i=t.getNeighbours(e);for(var o in i)if(i.hasOwnProperty(o)){var r=t.get(o);n.push(r)}return n}},{key:"populateScoredPanos",value:function(t,n,i,o,r){(i=i||[]).length=0;var a=[so.filters.inPanoDirection(t.position,o,e.DIRECTION_SCORE_STRICTNESS),so.filters.not(t)],s=[so.scoreFunctions.distanceSquared(t),so.scoreFunctions.direction(t.position,o)],l=De.sortByScore(n.list,a,s);if(l)for(var c=0;c<l.length&&c<r;c++){var u=l[c].item;i.push(u)}return i}},{key:"queueTilesForPanos",value:function(e,t,n,i,o){for(var r=0,a=0;a<t.length;a++){var s=t[a];if(r+=this.queueTilesForPano(e,n,s,i)>0?1:0,o&&r>=o)break}return r}},{key:"queueTilesInDirectionForPanos",value:function(e,t,n,i,o,r,a,s){for(var l=0,c=0;c<n.length;c++){var u=n[c];if(l+=this.queueTilesInDirectionForPano(e,t,u,i,r,a)>0?1:0,s&&l>=s)break}return l}},{key:"canIncludeDescriptor",value:function(e){return e.status!==Ya.Downloading&&e.status!==Ya.Downloaded}},{key:"canIncludePano",value:function(e,t){return!e.isLoaded(t)}},{key:"setZoomingActive",value:function(e){e!==this.zoomingActive&&(this.zoomingActive=e)}}],[{key:"PriorityCriteria",value:function(e,t,n,i,o){this.pano=e,this.cameraPosition=(new THREE.Vector3).copy(t),this.cameraDir=(new THREE.Vector3).copy(n),this.panoSpaceDir=(new THREE.Vector3).copy(i),this.upcomingPanos=o,this.copy=function(e){this.pano=e.pano,this.cameraPosition.copy(e.cameraPosition),this.cameraDir.copy(e.cameraDir),this.panoSpaceDir.copy(e.panoSpaceDir),this.upcomingPanos=o},this.zoomingActive=!1}},{key:"appendQueue",value:function(e,t){if(e&&t)for(var n=0;n<t.length;n++)e.push(t[n])}},{key:"getFOVDotThreshold",value:function(e){return Math.cos(THREE.MathUtils.degToRad(e/2))}},{key:"sortPanoTiles",value:function(t,n,i){Xa._panoSpaceDir.copy(i),eo.getRelativeDirection(n.quaternion,Xa._panoSpaceDir),Xa._fovThresholdNarrow=ge.getFOVDotThreshold(e.DIRECTIONAL_FOV_NARROW),Xa._fovThreshold=ge.getFOVDotThreshold(e.DIRECTIONAL_FOV),t.sort(Xa)}},{key:"insertSortedPanoTile",value:function(t,n,i,o){Xa._panoSpaceDir.copy(o),eo.getRelativeDirection(i.quaternion,Xa._panoSpaceDir),Xa._fovThresholdNarrow=ge.getFOVDotThreshold(e.DIRECTIONAL_FOV_NARROW),Xa._fovThreshold=ge.getFOVDotThreshold(e.DIRECTIONAL_FOV);for(var r=-1,a=0;a<t.length;a++){if(Xa(n,t[a])<=0){r=a;break}}if(-1===r)t[t.length]=n;else{for(var s=t.length;s>r;s--)t[s]=t[s-1];t[r]=n}}}]),e}();Ka.DIRECTIONAL_FOV=180,Ka.DIRECTIONAL_FOV_NARROW=120,Ka.MAX_SCORED_PANOS_TOCONSIDER=6,Ka.MAX_SCORED_PANOS_TOADD=2,Ka.MAX_UPCOMING_PANOS_TOADD=3,Ka.DIRECTION_SCORE_STRICTNESS=.75;var $a={ZERO:48,ONE:49,TWO:50,THREE:51,FOUR:52,FIVE:53,SIX:54,SEVEN:55,EIGHT:56,NINE:57,LEFTARROW:37,UPARROW:38,RIGHTARROW:39,DOWNARROW:40,A:65,B:66,C:67,D:68,E:69,F:70,G:71,H:72,I:73,J:74,K:75,L:76,M:77,N:78,O:79,P:80,Q:81,R:82,S:83,T:84,U:85,V:86,W:87,X:88,Y:89,Z:90,SPACE:32,RETURN:13,SEMICOLON:186,PLUSEQUALS:187,DASHUNDERSCORE:189,OPENBRACKET:219};Fe.detectFirefox()&&($a.SEMICOLON=59,$a.PLUSEQUALS=61,$a.DASHUNDERSCORE=173);var es="model-added",ts="active-model-changed";function ns(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}var is=function(e){f(n,e);var t=ns(n);function n(e){var i;return o(this,n),(i=t.call(this,e)).panoId=e.panoId,i.orthoZoom=e.orthoZoom,i.floorVisibility=e.floorVisibility,i.thumbUrl=e.thumbUrl,i.name=e.name,i}return u(n,[{key:"isPano",value:function(){return this.panoId&&""!==this.panoId}}]),n}(Ha),os=function(){function e(t,n,i){o(this,e),this.flightStepWalk=function(e,t,n){var i=new THREE.Vector3,o=new THREE.Vector3,r=function(e,t){var n=Math.min(this.player.position.distanceTo(e.position),at.transition.flytimeMaxDistanceThreshold)*at.transition.flytimeDistanceMultiplier+at.transition.flyTime;o.copy(to.FORWARD),this.player.getDirection(o),i.copy(t).sub(e.position).normalize();var r=i.dot(o),a=Math.acos(r),s=a/n;return s>.001&&(n*=s/.001,a<1&&(n*=1.2)),n};return function(e,t,n){if(this.warpInterrupted)n&&n();else if(this.activeTransType!==l.WALK)this._clearWarpShading(),this._warpStopFlying(),this.player.spider.draw(),this.placeCpm(),n&&n();else if(this.player.currentPano!==e){var i={pano:e,lookAtPoint:t,duration:null,maxDistanceOverride:at.warp.walkMaxDist,skipWarpingCheck:!1,constantMoveSpeed:!0};i.duration=r.call(this,e,t),this.player.nonInterruptingFlyToPano(i,n)}else n&&n()}}(),this.warpTravel_WALK=function(){var e=[];return function(t){var n=this.player.model.panos;e.length=0;for(var i=null,o=!1,r=0;r<this.nodes.length;r++){var a=this.nodes[r],s=n.get(a);this.nodes.length,o=i&&s.position.distanceTo(i.position)<at.warp.walkMinDist,i&&o||(e.push(a),i=s)}o&&this.nodes.length>1&&(e[e.length-1]=this.nodes[this.nodes.length-1]);var l=e.length,c=n.get(e[l-1]),u=new Array(l+1);u[u.length-1]=function(){t&&t()}.bind(this);for(var h=l-1,d=u.length-1;d>0;d-=1){var p=e[h];c=n.get(p);var f=new THREE.Vector3;this.getLookAtForWalkingTourNode(e,h,f),u[d-1]=this.makeWalkFlightFunc(c,f,u[d]),h--}u[0]()}}(),this.getLookAtForWalkingTourNode=function(){var e=new THREE.Vector3,t=new THREE.Vector3,n=new THREE.Vector3,i=new THREE.Vector3,o=new THREE.Vector3;return function(r,a,s){var l=r.length;if(a>=l)return!1;var c=1,u=1;t.set(0,0,0),o.set(0,0,0);for(var h=null,d=a;d<a+3&&!(d>=l);d++){if(h=this.player.model.panos.get(r[d]),this.getOrientationForWalkingTourNode(r,d,n),d===a&&e.copy(n),i.copy(n),d>a){var p=i.dot(e)<.65;c*=p?.2:.75,u*=p?.2:.4}n.multiplyScalar(c),t.add(n),o.lerp(h.position,u)}return t.normalize(),s.copy(o),s.add(t),!0}}(),this.obj3d=null,this.nodes=[],this.colorHull=[],this.shortPaths={},this.floorHull=null,this.cameraHull=null,this.floorPathDistance=0,this.floorCurvePoints=null,this.floorCurveColors=null,this.camCurvePoints=null,this.warpDestHeroLoc=null,this.warpDestPano=null,this.warpPathPoints=null,this.warpPathLengths=[0],this.warpLength=0,this.closeWarpDistance=4,this.UP=to.UP.clone(),this.longestStep=0,this.upcomingTransType=null,this.burnsDir=1,this.prevNextDist=0,this.nextI=0,this.activeTransType=null,this.lastTransType=null,this.bunnyObj=null,this.director=t,this.player=n,this.playerControls=i,this.modelManager=n.modelManager,this.updateModel(),this.bindEvents(),this.warping=!1,this.waitingToWarp=!1,this.warpInterrupted=!1,this.warpInterruptionBlackoutStyle=null,this.warpInterruptionTravelTime=null,this.pathImg={},this.brushPrefs={linewidth:7,strokeWidth:15,cvSegments:48,paveStep:.1,paveWidth:.2,lookBlendDist:3,maxTurn:THREE.MathUtils.degToRad(2)},this.hintPrefs={rad:.18,width:.0125,depth:.0625,setBack:-.04,markRad:.25,markInnerRad:.16},this.init()}return u(e,[{key:"init",value:function(){this.pathImg.pathEnd=De.loadTextureFromCache(si.getImageURL("images/pathEnd.png"))}},{key:"setScene",value:function(e){this.createCpm(e)}},{key:"updateModel",value:function(){this.model=this.modelManager.getActiveModel()}},{key:"bindEvents",value:function(){this.modelManager.on(ts,this.updateModel.bind(this))}},{key:"pointPathDistance",value:function(e){for(var t=0,n=1;n<e.length;n+=1)t+=e[n-1].distanceTo(e[n]);return t}},{key:"pointPathLengths",value:function(e){for(var t=[0],n=1;n<e.length;n+=1)t.push(t[n-1]+e[n-1].distanceTo(e[n]));return t}},{key:"interpAlongPath",value:function(e,t,n){var i,o=new THREE.Vector3,r=t[t.length-1];if(n<1){i=n*r;for(var a=1;a<t.length;a+=1)if(t[a]>i){var s=(i-t[a-1])/(t[a]-t[a-1]);return o.copy(e[a]),o.sub(e[a-1]),o.multiplyScalar(s),o.add(e[a-1]),o}}else o.copy(e[e.length-1]);return o}},{key:"pathHeight",value:function(){return at.path.height}},{key:"createBunnyObj",value:function(e){this.bunnyObj||(this.bunnyObj=new THREE.AxesHelper(.1),this.bunnyObj.visible=at.warp.showBunny),this.bunnyObj.parent&&this.bunnyObj.parent.remove(this.bunnyObj),e.add(this.bunnyObj)}},{key:"createCpm",value:function(e){if(!this.currentPanoMarker){var t=this.makeWaypointObj(this.pathImg.pathEnd,"Current");t.material.uniforms.opacity.value=0,this.currentPanoMarker={mesh:t,placed:!1}}this.currentPanoMarker.mesh.parent&&this.currentPanoMarker.mesh.parent.remove(this.currentPanoMarker.mesh),this.placeCpm(),this.currentPanoMarker.mesh.parent||e.add(this.currentPanoMarker.mesh)}},{key:"placeCpm",value:function(){if(at.path.mapGuides&&this.player.currentPano&&this.player.currentPano.isAligned()){var e=this.player.currentPano.floor;this.currentPanoMarker.mesh.parent!==this.player.currentPano.floor&&(this.currentPanoMarker.mesh.parent&&this.currentPanoMarker.mesh.parent.remove(this.currentPanoMarker.mesh),e.add(this.currentPanoMarker.mesh)),this.currentPanoMarker.mesh.position.copy(this.player.currentPano.floorPosition).sub(e.position),this.currentPanoMarker.mesh.position.y+=this.pathHeight(),this.currentPanoMarker.placed=!0}else this.popOutCpm()}},{key:"fadeInCpm",value:function(e){this.player.mode===xt.PANORAMA&&this.player.currentPano&&!this.player.currentPano.isAligned()||at.path.mapGuides&&this.currentPanoMarker.placed&&Ae.start(St.property(this.currentPanoMarker.mesh.material.uniforms.opacity,"value",1),e)}},{key:"fadeOutCpm",value:function(e){Ae.start(St.property(this.currentPanoMarker.mesh.material.uniforms.opacity,"value",0),e)}},{key:"popInCpm",value:function(){at.path.mapGuides&&this.currentPanoMarker.placed&&this.fadeInCpm(2)}},{key:"popOutCpm",value:function(){this.fadeOutCpm(2)}},{key:"buildWarpDestinationDescriptor",value:function(e,t,n,i,o,r){return new is({cameraMode:i,position:e,quaternion:t,panoId:n,orthoZoom:r,floorVisibility:o,thumbUrl:null,name:null})}},{key:"buildWarpDestinationDescriptorFromHero",value:function(e){return this.buildWarpDestinationDescriptor(e.position,e.quaternion,this.getHeroId(e),e.cameraMode,e.floorVisibility,e.orthoZoom)}},{key:"setWarpDestination",value:function(e){this.warpDestHeroLoc=e}},{key:"setWarpDestinationByHeroIndex",value:function(e){var t=this.getHeroDescriptorByHeroIndex(e);return null!==t&&(this.setWarpDestination(t),!0)}},{key:"setWarpDestinationByPano",value:function(e,t){return!!this.model.panos.get(e.id)&&this.setWarpDestinationByPanoId(e.id,t)}},{key:"setWarpDestinationByPanoId",value:function(e,t){var n=this.model.panos.get(e);if(n){t=t||new THREE.Quaternion;var i=this.buildWarpDestinationDescriptor(n.position,t,n.id,"panorama",[],-1);return this.setWarpDestination(i),!0}return!1}},{key:"getHeroDescriptorByHeroIndex",value:function(e){var t=objects.play.heroCount();if(null!==this.warpDestHeroLoc&&t<2)return ft.info("ShowPath.getHeroDescriptorByHeroIndex() -> Only one hero location is available."),this.model.getHeroDescriptorByIndex(0);var n=this.model.getHeroDescriptorByIndex(e);n=util.getPlayDataItem(e),1==objects.store.getters["guide/plays"][e].type&&(n=util.getPlayDataItem(e,0));var i=util.convertHighlight(n),o=new is(i);if(o){var r=o.isPano()?o.panoId:o.cameraMode;ft.debug('ShowPath.getHeroDescriptorByHeroIndex() -> New brush/warp destination: "'+r+'" out of '+t+" choices.")}return o}},{key:"getHeroDescriptorByPano",value:function(e){return this.model.panos.get(e.id)?this.getHeroDescriptorByPanoId(e.id):null}},{key:"getHeroDescriptorByPanoId",value:function(e){var t=this.getHeroIndexFromPanoId(e);return this.getHeroDescriptorByHeroIndex(t)}},{key:"getHeroIndexFromPanoId",value:function(e){for(var t=0;t<this.model.heroLocations.length;t++){var n=this.model.heroLocations[t],i=this.getHeroId(n);if(i&&i===e)return t}return-1}},{key:"getHeroPano",value:function(e){if(null===e)return ft.warn("getHeroPano(): no destination"),null;var t=this.getHeroId(e),n=this.model.panos.get(t);return void 0===n&&(n=null,""!==t&&ft.debug('unable to find pano "'+t+'"')),n}},{key:"getHeroId",value:function(e){return e.panoId}},{key:"setWarpDestPano",value:function(){return this.warpDestPano=this.getHeroPano(this.warpDestHeroLoc),this.warpDestPano}},{key:"findShortestPath",value:function(e,t){if(!e||!t)return null;var n=at.warp.walkExtraPanosDistance,i=e.id+":"+t.id+":"+n;if(this.shortPaths.hasOwnProperty(i))return this.shortPaths[i]?this.shortPaths[i].slice():null;var o=t.id+":"+e.id+":"+n;if(this.shortPaths.hasOwnProperty(o))return this.shortPaths[o]?this.shortPaths[o].slice().reverse():null;var r=this.model.panos.aStarSearch(e,t);return this.model.panos.includeNodesNearPath(r,n),this.shortPaths[i]=r?r.slice():null,r}},{key:"makePathHulls",value:function(e){var t,n,i,o,r,a=0,s=[],l=[],c=[],u=this.model.panos;o=(t=u.get(e[0])).floor.floorIndex;for(var h=0;h<e.length;h+=1)(n=(t=u.get(e[h])).floorPosition.clone().sub(this.model.position)).y+=this.pathHeight(),s.push(n),l.push(t.position.clone()),i=t.floor.floorIndex,c.push(i>o?at.path.colorUp:i<o?at.path.colorDown:at.path.color),h>0&&((r=l[h].distanceTo(l[h-1]))>a&&(a=r));return a>this.longestStep&&(this.longestStep=a,ft.debug("path contains "+a+" meter segment")),{floor:s,camera:l,color:c}}},{key:"makeFloorCurves",value:function(e,t,n){var i=this.player.mode===xt.PANORAMA?at.path.waypointIndoorRadius:at.path.waypointRadius,o=this.pointPathDistance(e)-2*i,r=e.slice(0),a=r[1].clone().sub(r[0]);a.y=0,a.normalize().multiplyScalar(i),r[0]=(new THREE.Vector3).copy(r[0]).add(a),(a=r[r.length-2].clone().sub(r[r.length-1])).y=0,a.normalize().multiplyScalar(i),r[r.length-1]=(new THREE.Vector3).copy(r[r.length-1]).add(a);var s=new THREE.CatmullRomCurve3(r),l=Math.floor(o/n);l=4*Math.floor(l/4),l=Math.max(4,l);for(var c,u,h=s.getSpacedPoints(l),d=[],p=new THREE.Vector3,f=0;f<h.length;f+=1){u=0,c=h[f].distanceTo(e[0]);for(var m=1;m<e.length;m+=1)p.copy(h[f]).sub(e[m]),p.y*=4,p.length()<c&&(u=m);d.push(t[u])}return{distance:o,points:h,colors:d}}},{key:"makeCameraCurvePoints",value:function(e,t){var n=this.pointPathDistance(e);return new THREE.CatmullRomCurve3(e).getSpacedPoints(Math.max(2,Math.floor(n/t)))}},{key:"setPathHulls",value:function(e){var t=this.makePathHulls(e);this.floorHull=t.floor,this.cameraHull=t.camera,this.colorHull=t.color}},{key:"setFloorCurves",value:function(){var e=this.makeFloorCurves(this.floorHull,this.colorHull,this.brushPrefs.paveStep);this.floorPathDistance=e.distance,this.floorCurvePoints=e.points,this.floorCurveColors=e.colors}},{key:"setCameraCurvePoints",value:function(){this.camCurvePoints=this.makeCameraCurvePoints(this.cameraHull,at.warp.stepFactor*this.brushPrefs.paveStep)}},{key:"chooseWarpPath",value:function(e){var t,n,i,o=this.playerControls.cameras[xt.PANORAMA];if(this.player.currentPano===this.warpDestPano||!e)return this.warpPathPoints=null,this.warpLength=0,!1;this.nodes=this.findShortestPath(this.player.currentPano,this.warpDestPano),this.setPathHulls(this.nodes),void 0===this.nodes||null===this.nodes||this.nodes.length<1?(ft.debug("warp path to unreachable node"),n=(t=this.warpDestPano.position.clone().sub(o.position)).clone().negate(),t.multiplyScalar(.15).add(o.position),n.multiplyScalar(.15).add(this.warpDestPano.position),t.y=o.position.y,n.y=this.warpDestPano.position.y,i=new THREE.CubicBezierCurve3(o.position.clone(),t,n,this.warpDestPano.position.clone()),this.warpPathPoints=i.getSpacedPoints(this.brushPrefs.cvSegments)):(ft.debug("follow warp path (path distance was "+this.nodes.length+" nodes, "+this.floorPathDistance+")"),this.setCameraCurvePoints(),this.warpPathPoints=this.camCurvePoints.slice(0)),this.warpLength=0,this.warpPathLengths=[0];for(var r=new THREE.Vector3,a=new THREE.Vector3,s=Math.cos(THREE.MathUtils.degToRad(at.warp.minBrakeAngle)),l=Math.cos(THREE.MathUtils.degToRad(at.warp.maxBrakeAngle)),c=1;c<this.warpPathPoints.length;c+=1){r.copy(this.warpPathPoints[c-1]).sub(this.warpPathPoints[c]);var u=r.length();r.y*=at.warp.climbEffort;var h=r.length()/u;if(c>1){r.setY(0).normalize(),a.copy(this.warpPathPoints[c-2]).sub(this.warpPathPoints[c-1]).setY(0).normalize();var d=Math.min(1,r.dot(a)),p=1+(at.warp.brakeStrength-1)*(1-THREE.MathUtils.smoothstep(d,l,s));h=Math.max(p,h)}this.warpLength+=u*h,this.warpPathLengths[c]=this.warpLength}return!0}},{key:"drawPathRibbon",value:function(e,t){this.bunnyObj.visible=at.warp.showBunny;for(var n=.6*at.path.ribbonWidth*.5,i=new THREE.Vector3,o=new THREE.Vector3(0,this.pathHeight(),0),r=new THREE.BufferGeometry,a=new THREE.Vector3,s=0;s<e.length;s+=1){a.copy(e[s]),0===s?a.sub(e[s+1]):a.sub(e[s-1]).negate(),a.normalize(),i.crossVectors(a,to.UP),i.multiplyScalar(n);var l=(new THREE.Vector3).copy(e[s]).add(o);l.sub(i),r.vertices.push(l),(l=(new THREE.Vector3).copy(e[s]).add(o)).add(i),r.vertices.push(l)}var c,u,h,d=0;for(s=0;s<e.length-1;s+=1){var p=2*s,f=d,m=d+=e[s+1].distanceTo(e[s]),v=t[s],g=t[s+1];(c=new THREE.Face3(p,p+1,p+2)).vertexColors=[new THREE.Color(v),new THREE.Color(v),new THREE.Color(g)],r.faces.push(c),r.faceVertexUvs[0].push([new THREE.Vector2(0,f),new THREE.Vector2(1,f),new THREE.Vector2(0,m)]),(c=new THREE.Face3(p+2,p+1,p+3)).vertexColors=[new THREE.Color(g),new THREE.Color(v),new THREE.Color(g)],r.faces.push(c),r.faceVertexUvs[0].push([new THREE.Vector2(0,m),new THREE.Vector2(1,f),new THREE.Vector2(1,m)])}r.computeFaceNormals(),r.computeVertexNormals(),this.player.mode===xt.PANORAMA?((h=THREE.UniformsUtils.clone(mn.ribbon.uniforms)).map.value=this.pathImg.path,h.opacity.value=0,h.color.value.set(at.path.color),u=new THREE.RawShaderMaterial({side:THREE.DoubleSide,depthWrite:!1,transparent:!0,vertexShader:mn.ribbon.vertexShader,fragmentShader:mn.ribbon.fragmentShader,uniforms:h,name:"ribbonT",opacity:0})):u=new THREE.MeshBasicMaterial({color:16777215,side:THREE.DoubleSide,name:"ribbonOut",vertexColors:THREE.VertexColors});var y=new THREE.Mesh(r,u);return y.name="ribbon",this.player.mode===xt.PANORAMA&&(y.renderOrder=Ye),y}},{key:"drawPathPavement",value:function(e){for(var t,n=new THREE.Vector3,i=new THREE.BufferGeometry,o=new THREE.Vector3,r=0;r<e.length;r+=1)o.copy(e[r]),0===r?o.sub(e[r+1]).negate():o.sub(e[r-1]),o.normalize(),n.crossVectors(o,to.UP),n.multiplyScalar(this.brushPrefs.paveWidth),(t=(new THREE.Vector3).copy(e[r])).sub(n),i.vertices.push(t),i.vertices.push((new THREE.Vector3).copy(e[r])),(t=(new THREE.Vector3).copy(e[r])).add(n),i.vertices.push(t);var a,s,l;for(r=0;r<e.length-1;r+=1)a=3*r+1,l=(s=.25*r)+.25,i.faces.push(new THREE.Face3(a-1,a,a+3)),i.faceVertexUvs[0].push([new THREE.Vector2(0,s),new THREE.Vector2(.5,s),new THREE.Vector2(.5,l)]),i.faces.push(new THREE.Face3(a+3,a+2,a-1)),i.faceVertexUvs[0].push([new THREE.Vector2(.5,l),new THREE.Vector2(0,l),new THREE.Vector2(0,s)]),i.faces.push(new THREE.Face3(a+3,a,a+1)),i.faceVertexUvs[0].push([new THREE.Vector2(.5,l),new THREE.Vector2(.5,s),new THREE.Vector2(1,s)]),i.faces.push(new THREE.Face3(a+3,a+1,a+4)),i.faceVertexUvs[0].push([new THREE.Vector2(.5,l),new THREE.Vector2(1,s),new THREE.Vector2(1,l)]);var c=this.player.mode===xt.PANORAMA?new THREE.MeshBasicMaterial({color:at.path.color,side:THREE.DoubleSide,transparent:!0,depthWrite:!1,opacity:0,name:"paveT",map:this.pathImg.path}):new THREE.MeshBasicMaterial({color:at.path.color,side:THREE.DoubleSide,transparent:!0,depthWrite:!1,opacity:1,name:"paveO",map:this.pathImg.path});return new THREE.Mesh(i,c)}},{key:"makeWaypointObj",value:function(e,t){var n=this.player.mode===xt.PANORAMA?at.path.waypointIndoorRadius:at.path.waypointRadius,i=this.pathHeight(),o=new THREE.CylinderGeometry(n,n,i,32),r=THREE.UniformsUtils.clone(mn.waypoint.uniforms);r.map.value=e,r.opacity.value=0,r.color.value.set(at.path.color);var a={side:THREE.DoubleSide,depthWrite:!1,depthTest:!1,transparent:!0,vertexShader:mn.waypoint.vertexShader,fragmentShader:mn.waypoint.fragmentShader,uniforms:r,name:"waypoint",opacity:0};this.player.mode!==xt.PANORAMA&&(a.depthTest=!1,a.name="wayPtOut");var s=new THREE.RawShaderMaterial(a),l=new THREE.Mesh(o,s);return l.renderOrder=Ge,l.name=t,l}},{key:"makeStartMarker",value:function(e,t){var n=(new THREE.Vector3).copy(t[1]).sub(t[0]);n.y=0,n.normalize();var i=Math.acos(n.x),o=this.makeWaypointObj(this.pathImg.pathStart,"Start");return o.rotateOnAxis(new THREE.Vector3(0,1,0),i),o.position.copy(e),o}},{key:"makeEndMarker",value:function(e){var t=this.makeWaypointObj(this.pathImg.pathEnd,"End"),n=this.model.panos.get(this.nodes[0]).floor.floorIndex,i=this.model.panos.get(this.nodes[this.nodes.length-1]).floor.floorIndex;return n<i?t.material.uniforms.color.value.set(at.path.colorUp):n>i&&t.material.uniforms.color.value.set(at.path.colorDown),t.position.copy(e),t}},{key:"pathClean",value:function(e){if(e){for(var t in e.children)this.pathClean(e.children[t]);e.geometry&&e.geometry.dispose(),e.material&&e.material.dispose()}}},{key:"discardPathObject",value:function(){if(this.obj3d){var e=this.obj3d.parent;e&&e.remove(this.obj3d),this.pathClean(this.obj3d)}this.obj3d=null,this.popInCpm()}},{key:"discardSlow",value:function(){if(this.obj3d){if(this.player.mode!==xt.PANORAMA)return void this.discardPathObject();for(var e,t=0,n=function(){this.discardPathObject()}.bind(this),i=0;i<this.obj3d.children.length;i+=1)void 0!==(e=this.obj3d.children[i]).material&&!0===e.material.transparent&&(void 0!==e.material.uniforms?Ae.start(St.property(e.material.uniforms.opacity,"value",0),at.path.fadeOutTime,n,0,ye[at.warp.blendEasing]):Ae.start(St.property(e.material,"opacity",0),at.path.fadeOutTime,n,0,ye[at.warp.blendEasing]),t+=1,n=null);0===t&&this.discardPathObject(),this.player.mode!==xt.PANORAMA&&this.fadeInCpm(at.path.fadeInTime-3)}}},{key:"appearSlow",value:function(){var e;this.fadeOutCpm(at.path.fadeInTime);for(var t=this.player.mode===xt.PANORAMA?at.path.opacity:1,n=0;n<this.obj3d.children.length;n+=1)void 0!==(e=this.obj3d.children[n]).material&&!0===e.material.transparent&&(void 0!==e.material.uniforms?Ae.start(St.property(e.material.uniforms.opacity,"value",t),at.path.fadeInTime,null,0,ye[at.warp.blendEasing]):Ae.start(St.property(e.material,"opacity",t),at.path.fadeInTime,null,0,ye[at.warp.blendEasing]))}},{key:"update",value:function(){this.obj3d&&this.obj3d.updateMatrixWorld()}},{key:"calcBurnsAmount",value:function(e){var t=THREE.MathUtils.degToRad(at.warp.burnsAngle);if(this.player.mode===xt.PANORAMA){var n=this.burnsDir*t;if(this.upcomingTransType===Ve)return n;var i=e;if(null===i)return ft.warn("Transition request for non-highlight"),n;var o=this.getHeroDescriptorByHeroIndex(i);if(null===o)return n;if(!o.isPano())return n;var r=this.getHeroPano(o),a=this.playerControls.cameras[xt.PANORAMA],s=to.FORWARD.clone().applyQuaternion(a.quaternion).setY(0).normalize(),l=Math.min(THREE.MathUtils.degToRad(at.warp.minBurnsAngle),t),c=function(e){var n=Math.acos(Math.min(1,e.dot(s))),i=(new THREE.Vector3).crossVectors(s,e);return Math.max(l,Math.min(Math.abs(n),t))*Math.sign(i.y)};if(r===this.player.currentPano)return c(to.FORWARD.clone().applyQuaternion(o.quaternion).setY(0).normalize());var u=this.findShortestPath(this.player.currentPano,r);if(null==u||u.length<1)return ft.debug("Empty path ahead..."),n;var h=this.makePathHulls(u),d=new THREE.CatmullRomCurve3(h.camera),p=Math.min(.1,at.warp.lookAheadDist/d.getLength());return c(d.getPointAt(p).clone().sub(a.position).setY(0).normalize())}return this.player.mode===xt.DOLLHOUSE?.02*this.burnsDir:this.burnsDir}},{key:"waitNextStep",value:function(e,t){var n=at.warp.tourStepDelay;n||(n=this.lastTransType===Ve?constants.tourStepDelaySlideShow:constants.tourStepDelayDefault);var i=new THREE.Euler,o=new THREE.Vector3;ft.debug("Starting wait: "+(void 0!==t));var r=this.calcBurnsAmount(e),a=function(){this.endWarpState(),this.player.mode===xt.DOLLHOUSE&&(this.playerControls.cameras[xt.DOLLHOUSE].controls.rotationAcceleration.x=0),t&&t()}.bind(this),s=function(e,t){if(this.warpInterrupted)return a(),!0;var s=t||1e3/60;if(at.warp.doBurns)if(this.player.mode===xt.PANORAMA){var l=this.playerControls.cameras[xt.PANORAMA];i.setFromQuaternion(WarpcameraStyle.quaternion,at.warp.eOrder);var c=s*r/n;i.y+=c,o.set(0,0,-1),o.applyEuler(i),o.add(l.position),l.controls.lookAt(o),l.controls.lookVector.copy(o),l.lookAt(o)}else this.player.mode===xt.DOLLHOUSE?this.playerControls.controls[xt.DOLLHOUSE].rotationAcceleration.x=r:this.playerControls.controls[xt.FLOORPLAN].absoluteScale*=.9996}.bind(this);this.startWarpState(),Ae.start(s,n,a,0,ye.easeInOutQuad,"wait")}},{key:"warpToNonPano",value:function(e){if(this.discardPathObject(),this.warpDestHeroLoc.cameraMode===xt.DOLLHOUSE||this.warpDestHeroLoc.cameraMode===xt.FLOORPLAN){var t=function(){e&&e()}.bind(this);this.player.flyToNewMode({mode:this.warpDestHeroLoc.cameraMode,duration:at.warp.outsideTime,warpDest:this.warpDestHeroLoc,callback:t,force:!0})}else ft.warn("no warp destination!!!"),e&&e()}},{key:"_resetWarpShaderParams",value:function(e){this.player.mode===xt.PANORAMA&&(void 0!==e.material.uniforms.blackout&&(e.material.uniforms.blackout.value=0),void 0!==e.material.uniforms.modelAlpha&&(e.material.uniforms.modelAlpha.value=0))}},{key:"_clearWarpShading",value:function(){for(var e=this.model.chunks,t=0;t<e.length;t+=1)this._resetWarpShaderParams(e[t]),e[t].visible=!0;this._resetWarpShaderParams(this.model.skybox)}},{key:"_warpStopFlying",value:function(){this.activeTransType=null,this.placeCpm()}},{key:"_wrapupTravelOnlyBits",value:function(){this._warpStopFlying(),this.warpPathPoints&&(this.player.currentPano.exit(),this.warpDestPano.enter(),this.player.currentPano=this.warpDestPano),this.placeCpm()}},{key:"_wrapupTravel",value:function(e){this._wrapupTravelOnlyBits(),this.warpCameraAim(e)}},{key:"_wrapupWarpShading",value:function(e){this._clearWarpShading(),this._wrapupTravel(e)}},{key:"wrapupWarpShadingOnly",value:function(e,t){t!==gt&&this._clearWarpShading(),this._wrapupTravelOnlyBits(),this.upcomingTransType=null,e&&e()}},{key:"_warpCameraAim",value:function(e,t){var n=this.warpDestHeroLoc.quaternion,i=this.playerControls.cameras[xt.PANORAMA],o=new THREE.Vector3(0,0,1).applyQuaternion(n).normalize(),r=new THREE.Vector3(0,0,1).applyQuaternion(i.quaternion).normalize().dot(o),a=THREE.MathUtils.radToDeg(Math.acos(r)),s=new THREE.Euler(0,0,0,at.warp.eOrder).setFromQuaternion(n,at.warp.eOrder),l=(new THREE.Euler).setFromQuaternion(i.quaternion,at.warp.eOrder),c=new THREE.Euler(s.x-l.x,s.y-l.y,s.z-l.z,at.warp.eOrder);c.y=ge.constrainedTurn(c.y),this.burnsDir=Math.sign(c.y);var u=new THREE.Euler(0,0,0,at.warp.eOrder),h=new THREE.Vector3,d=function(e,t){return!!this.warpInterrupted||(u.x=l.x+e*c.x,u.y=l.y+e*c.y,u.z=l.z+e*c.z,h.set(0,0,-1),h.applyEuler(u),h.add(i.position),i.controls.lookAt(h),i.controls.lookVector.copy(h),void i.lookAt(h))}.bind(this);return a>at.warp.minRotation?Ae.start(d,e,t,0,ye[at.warp.movementEasing]):(ft.debug("Aim angle only is "+a.toPrecision(3)+" degrees, skipping explicit re-aim"),void(t&&t()))}},{key:"_warpBendAim",value:function(e,t,n,i){var o=i||0,r=this.playerControls.cameras[xt.PANORAMA],a=new THREE.Euler(0,0,0,at.warp.eOrder).setFromQuaternion(this.warpDestHeroLoc.quaternion,at.warp.eOrder),s=(new THREE.Euler).setFromQuaternion(r.quaternion,at.warp.eOrder),l=new THREE.Euler(a.x-s.x,a.y-s.y,a.z-s.z,at.warp.eOrder);l.y=ge.constrainedTurn(l.y);var c=Math.min(THREE.MathUtils.degToRad(at.warp.softBendTilt),Math.abs(l.x));l.x=c*Math.sign(l.x),c=Math.min(THREE.MathUtils.degToRad(Math.max(0,at.warp.softBendAngle)),c),this.burnsDir=Math.sign(l.y),c*=Math.sign(l.y),l.y=c;var u=new THREE.Euler(0,0,0,at.warp.eOrder),h=new THREE.Vector3,d=function(e,t){if(e<.5)u.x=s.x+e*l.x,u.y=s.y+e*l.y,u.z=s.z+e*l.z;else{var n=(1-e)*at.warp.softBendEnd;u.x=a.x-n*l.x,u.y=a.y-n*l.y,u.z=a.z-n*l.z}h.set(0,0,-1),h.applyEuler(u),h.add(r.position),r.controls.lookAt(h),r.controls.lookVector.copy(h),r.lookAt(h)}.bind(this);return Ae.start(d,t,n,o,ye[at.warp.movementEasing])}},{key:"_warpStepCameraAim",value:function(e,t,n){var i=this.playerControls.cameras[xt.PANORAMA],o=new THREE.Euler(0,0,0,at.warp.eOrder).setFromQuaternion(this.warpDestHeroLoc.quaternion,at.warp.eOrder),r=(new THREE.Euler).setFromQuaternion(i.quaternion,at.warp.eOrder),a=new THREE.Euler(o.x-r.x,o.y-r.y,o.z-r.z,at.warp.eOrder);a.y=ge.constrainedTurn(a.y),this.burnsDir=Math.sign(a.y);var s=new THREE.Euler(0,0,0,at.warp.eOrder),l=new THREE.Vector3,c=function(e,t){e<.5?s.copy(r):s.copy(o),l.set(0,0,-1),l.applyEuler(s),l.add(i.position),i.controls.lookAt(l),i.controls.lookVector.copy(l),i.lookAt(l)}.bind(this);return Ae.start(c,t,n,0,ye[at.warp.movementEasing])}},{key:"setBurnsDir",value:function(){var e=this.playerControls.cameras[xt.PANORAMA],t=new THREE.Euler(0,0,0,at.warp.eOrder).setFromQuaternion(this.warpDestHeroLoc.quaternion,at.warp.eOrder),n=(new THREE.Euler).setFromQuaternion(e.quaternion,at.warp.eOrder),i=new THREE.Euler(t.x-n.x,t.y-n.y,t.z-n.z,at.warp.eOrder);i.y=ge.constrainedTurn(i.y),this.burnsDir=Math.sign(i.y)}},{key:"stepWarpPath",value:function(e,t){var n=this.playerControls.cameras[xt.PANORAMA],i=this.warpPathPoints?this.warpPathPoints[0]:e;if(!i)return n.position.copy(this.warpDestPano.position),!0;var o=this.warpDestPano.position;if(null!==this.nodes&&this.cameraHull&&this.cameraHull.length>1){var r=new THREE.Vector3;t<.5?r.copy(this.cameraHull[1]).sub(i).normalize().multiplyScalar(at.warp.softPushDist*t).add(i):r.copy(this.cameraHull[this.cameraHull.length-2]).sub(o).normalize().multiplyScalar(at.warp.softPushDist*at.warp.softPushEnd*(1-t)).add(o),n.position.copy(r)}else t<.5?n.position.copy(i):n.position.copy(o)}},{key:"interruptAndFastForward",value:function(e,t){this.warping&&(this.warpInterrupted=!0,this.warpInterruptionBlackoutStyle=e,this.warpInterruptionTravelTime=t,null!==this.warpInterruptionBlackoutStyle&&void 0!==this.warpInterruptionBlackoutStyle||(this.warpInterruptionBlackoutStyle=vt),null!==this.warpInterruptionTravelTime&&void 0!==this.warpInterruptionTravelTime||(this.warpInterruptionTravelTime=at.minWarpTime))}},{key:"warpCameraAim",value:function(e){var t=at.warp.minWarpTime;if(this.upcomingTransType===Ve)t=at.warp.teleportTime;else{var n=this.playerControls.cameras[xt.PANORAMA],i=new THREE.Euler(0,0,0,at.warp.eOrder).setFromQuaternion(this.warpDestHeroLoc.quaternion,at.warp.eOrder),o=(new THREE.Euler).setFromQuaternion(n.quaternion,at.warp.eOrder),r=new THREE.Euler(i.x-o.x,i.y-o.y,i.z-o.z,at.warp.eOrder);r.y=ge.constrainedTurn(r.y);var a=1e3*Math.abs(r.y)/THREE.MathUtils.degToRad(at.warp.maxAimPerSec);t=Math.max(t,a)}var s=function(){this._warpStopFlying(),this.discardSlow(),e&&e()}.bind(this);this._warpCameraAim(t,s)}},{key:"warpCommonParameters",value:function(e,t,n,i){this.model.skybox.material.uniforms.blackout.value=i;var o=St.uniform(this.model.skybox,"progress",1),r=St.allUniforms(this.model.chunks,"progress",1),a=!1,s=function(){if(this.warpInterrupted)return a=!0,!0}.bind(this),l=function(e,t){return n&&a?(this.model.skybox.material.uniforms.progress.value=0,!0):void o(e,t)}.bind(this),c=function(e,t){return n&&a?(r(0),!0):void r(e,t)}.bind(this);Ae.start(s,e,null,t,null,"safeHaltWatch"),Ae.start(l,e,null,t,ye[at.warp.blendEasing],"skyboxProgress"),Ae.start(c,e,null,t,ye[at.warp.blendEasing],"chunkProgress")}},{key:"warpTravel_STD",value:function(e){var t,n=Math.min(at.warp.lookAheadMax,at.warp.lookAheadDist/this.warpLength),i=this.playerControls.cameras[a.PANORAMA],o=(Math.min(.25,3/this.warpLength),Math.min(.35,7/this.warpLength)),r=new THREE.Euler(0,0,0,at.warp.eOrder),s=new THREE.Vector3,c=(new THREE.Euler).setFromQuaternion(i.quaternion,at.warp.eOrder),u=(new THREE.Euler).copy(c),h=i.position.clone(),p=new THREE.Matrix4,f=new THREE.Euler,m=at.warp.minWarpTime;m+=this.warpLength*at.warp.timePerMeter,at.warp.flySpeed>.01&&(m=1e3*this.warpLength/at.warp.flySpeed);var v=!1,y=this.warpDestHeroLoc.quaternion,A=new THREE.Vector3(0,0,-1).applyQuaternion(y).normalize(),E=this.warpPathPoints[this.warpPathPoints.length-1].clone().sub(this.warpPathPoints[this.warpPathPoints.length-2]).normalize(),b=E.dot(A),w=THREE.MathUtils.radToDeg(Math.acos(b)),x=function(e){var t=o;return THREE.MathUtils.smoothstep(e,0,t)*(1-THREE.MathUtils.smoothstep(e,1-t,1))},C=function(){return p.lookAt(h,t,to.UP),r.setFromRotationMatrix(p,at.warp.eOrder),c.setFromQuaternion(i.quaternion,at.warp.eOrder),f.set(r.x-c.x,r.y-c.y,r.z-c.z,at.warp.eOrder),ge.constrainedTurn(f.y)}.bind(this),T=function(e,t){if(this.warpInterrupted)return v=!0,!0}.bind(this),I=function(e,t){return v||!this.warpPathPoints?(effects.blur(0),!0):void effects.blur(e)}.bind(this),k=St.allUniforms(this.model.chunks,"modelAlpha",1),B=function(e,t){return v||!this.warpPathPoints?(k(0),!0):void k(e,t)}.bind(this),P=function(e,t){if(!this.warpPathPoints)return i.position.copy(this.warpDestPano.position),!0;if(v)return!0;var n=this.interpAlongPath(this.warpPathPoints,this.warpPathLengths,e);i.position.copy(n),h=this.interpAlongPath(this.warpPathPoints,this.warpPathLengths,.99*e)}.bind(this),R=function(e,i){return this.warpPathPoints?!!v||void(t=this.interpAlongPath(this.warpPathPoints,this.warpPathLengths,Math.min(e+n,1))):(ft.debug("Lost bunny."),!0)}.bind(this),M=function(e,o){if(v)return ft.debug(">>>> Walkthrough interupted at t="+e),!0;if(!this.warpPathPoints)return!0;var a=this.warpLength*e,l=THREE.MathUtils.smoothstep(a,0,this.brushPrefs.lookBlendDist),d=THREE.MathUtils.smoothstep(a,this.warpLength-this.brushPrefs.lookBlendDist,this.warpLength);at.warp.matchCam&&(l*=1-d),p.lookAt(h,t,to.UP),r.setFromRotationMatrix(p,at.warp.eOrder),c.setFromQuaternion(i.quaternion,at.warp.eOrder),f.set(r.x-c.x,r.y-c.y,r.z-c.z,at.warp.eOrder),f.y=ge.constrainedTurn(f.y),r.x=c.x+l*f.x,r.y=c.y+l*f.y,r.z=c.z+l*f.z,f.set(r.x-u.x,r.y-u.y,r.z-u.z,at.warp.eOrder),f.y=ge.constrainedTurn(f.y);var m=THREE.MathUtils.degToRad(at.warp.maxTurnPerSec)*o/1e3;f.y=Math.sign(f.y)*Math.min(m,Math.abs(f.y)),u.x=u.x+f.x*at.warp.turnFriction,u.y=u.y+f.y*at.warp.turnFriction,u.z=u.z+f.z*at.warp.turnFriction,u.x=Math.max(THREE.MathUtils.degToRad(at.warp.minDownAngle),u.x);var g=t.clone().sub(h).normalize();if(w<at.warp.maxAimRotation&&d>0){var y=1-d;g.x=g.x*y+d*E.x,g.y=g.y*y+d*E.y,g.z=g.z*y+d*E.z,g.normalize()}this.bunnyObj.position.copy(i.position).add(g),s.set(0,0,-1).applyEuler(u).normalize(),s.multiplyScalar(8),s.add(i.position),e>1-n&&at.warp.matchCam||(i.controls.lookAt(s),i.controls.lookVector.copy(s),i.lookAt(s))}.bind(this),S=function(){v?(this.discardSlow(),this.upcomingTransType=l.BLACK,this.warpTravel_BLACK(-.5,this.warpInterruptionTravelTime,yt,e)):this._wrapupWarpShading(e)}.bind(this);R(0);var D=at.warp.motionLeadTime+1e3*Math.abs(C())/THREE.MathUtils.degToRad(at.warp.maxTurnPerSec),L=D/(m+=D);this.warpCommonParameters(m,L,!0,mt),Ae.start(T,m,null,0,null,"_haltWatcher"),at.warp.blur>0&&(g.blurStrength=at.warp.blur,Ae.start(I,m,null,L,x,"blurring")),Ae.start(B,m,null,L,x,"modelAlpha"),Ae.start(P,m,null,L,d[at.warp.blendEasing],"followPath"),Ae.start(R,m,null,L,d[at.warp.blendEasing],"goBunny"),Ae.start(M,m,S,0,d[at.warp.blendEasing],"lookAtBunny")}},{key:"warpTravel_BLACK",value:function(e,t,n,i){this.player.model.floorLogos.firstLogo.visible=!1,this.player.model.floorLogos.secondLogo.visible=!1;var o=e||0;null!=t||(t=at.warp.teleportTime),this.warpCommonParameters(t,o,!1,n),this.model.chunks.forEach((function(e){e.material.uniforms.blackout.value=n})),this._warpBendAim(null,t,null,o);var r=function(){this.wrapupWarpShadingOnly(i,n)}.bind(this),a=this.player.position.clone();Ae.start(this.stepWarpPath.bind(this,a),t,r,o,ye[at.warp.blendEasing],"stepMotion")}},{key:"makeWalkFlightFunc",value:function(e,t,n){return this.flightStepWalk.bind(this,e,t,n)}},{key:"getOrientationForWalkingTourNode",value:function(e,t,n){var i=e.length;if(t>=i)return!1;if(t===i-1)n.copy(to.FORWARD).applyQuaternion(this.warpDestHeroLoc.quaternion);else{var o=this.player.model.panos.get(e[t]),r=this.player.model.panos.get(e[t+1]);n.copy(r.position).sub(o.position)}return n.normalize(),!0}},{key:"warpCameraTravel",value:function(e,t,n,i){if(this.activeTransType=this.upcomingTransType,this.lastTransType=this.activeTransType,this.upcomingTransType=null,e)this.activeTransType===Ve?this.warpTravel_BLACK(null,n,t,i):this.activeTransType===Qe?this.warpTravel_WALK(function(){this._clearWarpShading(),this._warpStopFlying(),this.player.spider.draw(),this.placeCpm(),i&&i()}.bind(this)):this.warpTravel_STD(i);else{var o=function(){this._wrapupTravel(i)}.bind(this),r={pano:this.warpDestPano,lookAtPoint:null,duration:null,maxDistanceOverride:null,skipWarpingCheck:!1};this.player.flyToPano(r,o)}}},{key:"startWarpState",value:function(){this.warping=!0,this.warpInterrupted=!1,this.warpInterruptionBlackoutStyle=null,this.warpInterruptionTravelTime=null}},{key:"endWarpState",value:function(){this.warping=!1}},{key:"warpToPano",value:function(e,t,n,i){if(this.warping)ft.warn("Cannot warp when already warping");else{if(this.upcomingTransType=e,this.activeTransType=null,!this.setWarpDestPano())return this.upcomingTransType=null,void this.warpToNonPano(i);if(this.player.mode!==xt.PANORAMA)return this.upcomingTransType=null,this.discardSlow(),void this.player.flyToNewMode({mode:xt.PANORAMA,pano:this.warpDestPano,duration:at.warp.outsideTime,warpDest:this.warpDestHeroLoc,callback:i,force:!0});if(!this.warpDestPano)return ft.warn("no warp destination, callback dropped"),void(this.upcomingTransType=null);var o=!(this.model.panos.isNeighbour(this.player.currentPano,this.warpDestPano)&&this.warpDestPano!==this.player.currentPano&&this.warpDestPano.position.distanceTo(this.player.currentPano.position)<at.warp.nearPanoDist),r=this.chooseWarpPath(o);if(r&&this.upcomingTransType!==Qe){var a=function(){this.waitingToWarp=!1,this.warpToPano(e,t,n,i)}.bind(this);if(this.player.checkAndWaitForPanoLoad(this.warpDestPano,"high","low",this.player.basePanoSize,a))return void(this.waitingToWarp=!0)}this.player.currentPano||(ft.warn("Arrived at a very strange spot!"),this.player.currentPano=this.warpDestPano,this.placeCpm(),this.fadeOutCpm(at.path.fadeOutTime),this.player.spider.draw()),ft.debug("Warping to pano ",this.warpDestPano.position),this.upcomingTransType!==Qe&&this.player.emit(aa,this.player.currentPano,this.warpDestPano),this.startWarpState();var s=function(){this.endWarpState(),i&&i()}.bind(this);r?this.warpCameraTravel(o,t,n,s):this.warpCameraAim(s),this.player.smoothZoomToDefault(at.zoom.restoreTime)}}}]),e}(),rs="zoom.in",as="zoom.out",ss="zoom.max",ls="zoom.min";function cs(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}var us=new WeakMap,hs=function(t){f(i,t);var n=cs(i);function i(e){var t;return o(this,i),(t=n.call(this,e)).decoderPath="",t.decoderConfig={},t.decoderBinary=null,t.decoderPending=null,t.workerLimit=4,t.workerPool=[],t.workerNextTaskID=1,t.workerSourceURL="",t.defaultAttributeIDs={position:"POSITION",normal:"NORMAL",color:"COLOR",uv:"TEX_COORD"},t.defaultAttributeTypes={position:"Float32Array",normal:"Float32Array",color:"Float32Array",uv:"Float32Array"},t}return u(i,[{key:"setDecoderPath",value:function(e){return this.decoderPath=e,this}},{key:"setDecoderConfig",value:function(e){return this.decoderConfig=e,this}},{key:"setWorkerLimit",value:function(e){return this.workerLimit=e,this}},{key:"load",value:function(t,n,i,o){var r=this,a=new e.FileLoader(this.manager);a.setPath(this.path),a.setResponseType("arraybuffer"),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(t,(function(e){r.decodeDracoFile(e,n).catch(o)}),i,o)}},{key:"decodeDracoFile",value:function(e,t,n,i){var o={attributeIDs:n||this.defaultAttributeIDs,attributeTypes:i||this.defaultAttributeTypes,useUniqueIDs:!!n};return this.decodeGeometry(e,o).then(t)}},{key:"decodeGeometry",value:function(e,t){var n,i=this,o=JSON.stringify(t);if(us.has(e)){var r=us.get(e);if(r.key===o)return r.promise;if(0===e.byteLength)throw new Error("THREE.DRACOLoader: Unable to re-decode a buffer with different settings. Buffer has already been transferred.")}var a=this.workerNextTaskID++,s=e.byteLength,l=this._getWorker(a,s).then((function(i){return n=i,new Promise((function(i,o){n._callbacks[a]={resolve:i,reject:o},n.postMessage({type:"decode",id:a,taskConfig:t,buffer:e},[e])}))})).then((function(e){return i._createGeometry(e.geometry)}));return l.catch((function(){return!0})).then((function(){n&&a&&i._releaseTask(n,a)})),us.set(e,{key:o,promise:l}),l}},{key:"_createGeometry",value:function(t){var n=new e.BufferGeometry;t.index&&n.setIndex(new e.BufferAttribute(t.index.array,1));for(var i=0;i<t.attributes.length;i++){var o=t.attributes[i],r=o.name,a=o.array,s=o.itemSize;n.setAttribute(r,new e.BufferAttribute(a,s))}return n}},{key:"_loadLibrary",value:function(t,n){var i=new e.FileLoader(this.manager);return i.setPath(this.decoderPath),i.setResponseType(n),i.setWithCredentials(this.withCredentials),new Promise((function(e,n){i.load(t,e,void 0,n)}))}},{key:"preload",value:function(){return this._initDecoder(),this}},{key:"_initDecoder",value:function(){var e=this;if(this.decoderPending)return this.decoderPending;var t="object"!=typeof WebAssembly||"js"===this.decoderConfig.type,n=[];return t?n.push(this._loadLibrary("draco_decoder.js","text")):(n.push(this._loadLibrary("draco_wasm_wrapper.js","text")),n.push(this._loadLibrary("draco_decoder.wasm","arraybuffer"))),this.decoderPending=Promise.all(n).then((function(n){var i=n[0];t||(e.decoderConfig.wasmBinary=n[1]);var o=ds.toString(),r=["/* draco decoder */",i,"","/* worker */",o.substring(o.indexOf("{")+1,o.lastIndexOf("}"))].join("\n");e.workerSourceURL=URL.createObjectURL(new Blob([r]))})),this.decoderPending}},{key:"_getWorker",value:function(e,t){var n=this;return this._initDecoder().then((function(){if(n.workerPool.length<n.workerLimit){var i=new Worker(n.workerSourceURL);i._callbacks={},i._taskCosts={},i._taskLoad=0,i.postMessage({type:"init",decoderConfig:n.decoderConfig}),i.onmessage=function(e){var t=e.data;switch(t.type){case"decode":i._callbacks[t.id].resolve(t);break;case"error":i._callbacks[t.id].reject(t);break;default:console.error('THREE.DRACOLoader: Unexpected message, "'+t.type+'"')}},n.workerPool.push(i)}else n.workerPool.sort((function(e,t){return e._taskLoad>t._taskLoad?-1:1}));var o=n.workerPool[n.workerPool.length-1];return o._taskCosts[e]=t,o._taskLoad+=t,o}))}},{key:"_releaseTask",value:function(e,t){e._taskLoad-=e._taskCosts[t],delete e._callbacks[t],delete e._taskCosts[t]}},{key:"debug",value:function(){console.log("Task load: ",this.workerPool.map((function(e){return e._taskLoad})))}},{key:"dispose",value:function(){for(var e=0;e<this.workerPool.length;++e)this.workerPool[e].terminate();return this.workerPool.length=0,this}}]),i}(e.Loader);function ds(){var e,t;function n(e,t,n,i,o,r){var a=r.num_components(),s=n.num_points()*a,l=s*o.BYTES_PER_ELEMENT,c=function(e,t){switch(t){case Float32Array:return e.DT_FLOAT32;case Int8Array:return e.DT_INT8;case Int16Array:return e.DT_INT16;case Int32Array:return e.DT_INT32;case Uint8Array:return e.DT_UINT8;case Uint16Array:return e.DT_UINT16;case Uint32Array:return e.DT_UINT32}}(e,o),u=e._malloc(l);t.GetAttributeDataArrayForAllPoints(n,r,c,l,u);var h=new o(e.HEAPF32.buffer,u,s).slice();return e._free(u),{name:i,array:h,itemSize:a}}onmessage=function(i){var o=i.data;switch(o.type){case"init":e=o.decoderConfig,t=new Promise((function(t){e.onModuleLoaded=function(e){t({draco:e})},DracoDecoderModule(e)}));break;case"decode":var r=o.buffer,a=o.taskConfig;t.then((function(e){var t=e.draco,i=new t.Decoder,s=new t.DecoderBuffer;s.Init(new Int8Array(r),r.byteLength);try{var l=function(e,t,i,o){var r,a,s=o.attributeIDs,l=o.attributeTypes,c=t.GetEncodedGeometryType(i);if(c===e.TRIANGULAR_MESH)r=new e.Mesh,a=t.DecodeBufferToMesh(i,r);else{if(c!==e.POINT_CLOUD)throw new Error("THREE.DRACOLoader: Unexpected geometry type.");r=new e.PointCloud,a=t.DecodeBufferToPointCloud(i,r)}if(!a.ok()||0===r.ptr)throw new Error("THREE.DRACOLoader: Decoding failed: "+a.error_msg());var u={index:null,attributes:[]};for(var h in s){var d=self[l[h]],p=void 0,f=void 0;if(o.useUniqueIDs)f=s[h],p=t.GetAttributeByUniqueId(r,f);else{if(-1===(f=t.GetAttributeId(r,e[s[h]])))continue;p=t.GetAttribute(r,f)}u.attributes.push(n(e,t,r,h,d,p))}c===e.TRIANGULAR_MESH&&(u.index=function(e,t,n){var i=3*n.num_faces(),o=4*i,r=e._malloc(o);t.GetTrianglesUInt32Array(n,o,r);var a=new Uint32Array(e.HEAPF32.buffer,r,i).slice();return e._free(r),{array:a,itemSize:1}}(e,t,r));return e.destroy(r),u}(t,i,s,a),c=l.attributes.map((function(e){return e.array.buffer}));l.index&&c.push(l.index.array.buffer),self.postMessage({type:"decode",id:o.id,geometry:l},c)}catch(e){console.error(e),self.postMessage({type:"error",id:o.id,error:e.message})}finally{t.destroy(s),t.destroy(i)}}))}}}var ps=new THREE.GLTFLoader,fs=new hs;fs.setDecoderPath(si.getImageURL("images/loaders/DRACOLoader/draco/")),ps.setDRACOLoader(fs);var ms=function(e,t){ps.load(e,t)};function vs(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}var gs,ys={},As=function(e){f(n,THREE.Object3D);var t=vs(n);function n(e){var i;return o(this,n),(i=t.call(this)).parts={body:null,foot:null,line:null},i.type=e,i.addEventListener("createDone",(function(){i.traverse((function(e){e.isMesh&&(e.renderOrder=je-1,e.material.transparent=!0)}))})),i.type.indexOf("ground")>-1?i.createBracket():i.createFrame(),i}return u(n,[{key:"show",value:function(){this.overlay.visible&&("wall_1"!=this.type||0!=this.overlay.depthTemp)?this.visible=!0:this.visible=!1}},{key:"hide",value:function(){this.visible=!1}},{key:"setFrameThickness",value:function(e){"wall_1"==this.type?(isNaN(e)&&(e=0),this.overlay.depthTemp=e,e?this.show():this.hide()):e=this.type.indexOf("wall")>-1?at.overlay.depth:0,this.overlay.depth=e,this.overlay.plane.position.set(0,0,e),this.update({mode:"scale"})}},{key:"setOverlay",value:function(e,t){if(this.overlay=e,e.frame=this,this.visible=e.visible,t){var n=this.computeOverlayTransform({reverse:!0}),i=n.position,o=n.quaternion;this.position.copy(i),this.quaternion.copy(o)}else{this.position.copy(this.overlay.position),this.quaternion.copy(this.overlay.quaternion);var r=this.computeOverlayTransform(),a=r.position,s=r.quaternion;this.overlay.position.copy(a),this.overlay.quaternion.copy(s)}this.update({mode:"scale"})}},{key:"computeOverlayTransform",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=this.overlay.position.clone(),n=this.overlay.quaternion.clone(),i=e.reverse?-1:1,o=at.overlay.height*this.overlay.scale.y;switch(this.type){case"ground_1":t.add(new THREE.Vector3(0,(ys[this.type].height+o/2)*i,0).applyQuaternion(this.overlay.quaternion));break;case"ground_2":n.multiply((new THREE.Quaternion).setFromAxisAngle(new THREE.Vector3(1,0,0),-Math.PI/6*i)),t.add(new THREE.Vector3(0,ys[this.type].height*i,0).applyQuaternion(1==i?this.quaternion:n));break;case"wall_0":case"wall_1":case"wall_2":case"wall_3":t.add(new THREE.Vector3(0,(o/2+this.getFrameModelData().border)*i,0).applyQuaternion(this.quaternion))}return this.setFrameThickness(this.overlay.depth),{position:t,quaternion:n}}},{key:"createBracket",value:function(){var e=this,t=new THREE.MeshPhongMaterial({color:0});if(t.visible=!1,"ground_1"==this.type){this.parts.body=new THREE.Group;var n=new THREE.Mesh(new THREE.PlaneGeometry(at.overlay.width,at.overlay.height),t);n.scale.z=-1,this.parts.body.backFace=n;var i=new THREE.Group;this.parts.body.bottom=i,this.parts.body.add(i,n),this.add(this.parts.body),this.initBracketMeshData((function(t){i.add(t);var o=t.children[1].material;n.material=o,e.dispatchEvent({type:"createDone"})}))}else{this.parts.body=new THREE.Group,this.parts.body.rotateX(-Math.PI/6),this.add(this.parts.body);var o=new THREE.Mesh(new THREE.BoxGeometry(.02,at.overlay.height,.02),t);o.position.z-=.01;var r=new THREE.Mesh(new THREE.BoxGeometry(.1,.01,.04),t);r.position.y+=at.overlay.height/2+.005;var a=new THREE.Mesh(new THREE.BoxGeometry(.1,.01,.04),t);a.position.y-=at.overlay.height/2+.005;var s=new THREE.Mesh(new THREE.PlaneGeometry(at.overlay.width,at.overlay.height),t);s.scale.z=-1,this.parts.body.middle=o,this.parts.body.top=r,this.parts.body.bottom=a,this.parts.body.backFace=s,this.parts.body.add(o,r,a,s),this.parts.foot=new THREE.Group,this.parts.foot.position.z-=.02,this.add(this.parts.foot),this.initBracketMeshData((function(t){e.parts.foot.add(t);var n=t.children[0].material;o.material=r.material=a.material=s.material=n,e.dispatchEvent({type:"createDone"})})),this.parts.body.position.y+=ys[this.type].height}}},{key:"createFrame",value:function(){var e=new THREE.Mesh;this.parts.body=e;var t=this.getFrameModelData(),n=t.vertices,i=t.indexs,o=t.uvs,r=t.normals;e.geometry=new THREE.BufferGeometry,e.geometry.setAttribute("position",new THREE.BufferAttribute(new Float32Array(n),3)),e.geometry.setAttribute("uv",new THREE.BufferAttribute(new Float32Array(o),2)),e.geometry.setIndex(new THREE.BufferAttribute(new Uint16Array(i),1)),r?e.geometry.setAttribute("normal",new THREE.BufferAttribute(new Float32Array(r),3)):e.geometry.computeVertexNormals(),"wall_0"==this.type?(e.material=new THREE.MeshPhongMaterial({color:"#eeeeee"}),this.parts.line=new THREE.LineSegments(new THREE.EdgesGeometry(e.geometry),new THREE.LineBasicMaterial({color:0})),this.add(this.parts.line)):"wall_3"==this.type?e.material=new THREE.MeshStandardMaterial({color:"#222222"}):"wall_2"!=this.type&&"wall_1"!=this.type||(e.material=new THREE.MeshLambertMaterial({color:"#cccccc"})),e.position.z-=.001,this.add(e),this.dispatchEvent({type:"createDone"})}},{key:"update",value:function(e){var t=Math.abs(at.overlay.width*this.overlay.scale.x),n=Math.abs(at.overlay.height*this.overlay.scale.y);if(!e||"translate"==e.mode)switch(this.type){case"ground_1":this.overlay.position.copy(this.position).add(new THREE.Vector3(0,n/2+ys[this.type].height,0).applyQuaternion(this.quaternion));break;case"ground_2":this.overlay.position.copy(this.position).add(new THREE.Vector3(0,ys[this.type].height,0).applyQuaternion(this.quaternion));break;case"wall_0":case"wall_1":case"wall_2":case"wall_3":this.position.copy(this.overlay.position).add(new THREE.Vector3(0,-n/2-this.getFrameModelData().border,0).applyQuaternion(this.quaternion));break;default:this.overlay.position.copy(this.position)}if(!e||"rotate"==e.mode)switch(this.type){case"ground_1":this.overlay.rotation.copy(this.rotation),this.overlay.position.set(0,ys[this.type].height+n/2,0).applyQuaternion(this.quaternion).add(this.position);break;case"ground_2":this.overlay.quaternion.setFromAxisAngle(new THREE.Vector3(1,0,0).applyQuaternion(this.overlay.quaternion),-Math.PI/6).multiply(this.quaternion),this.parts.body.quaternion.copy(this.quaternion).invert().multiply(this.overlay.quaternion),this.overlay.position.copy(this.position).add(new THREE.Vector3(0,ys[this.type].height,0).applyQuaternion(this.quaternion));break;case"wall_0":case"wall_1":case"wall_2":case"wall_3":this.overlay.rotation.copy(this.rotation),this.overlay.position.set(0,this.getFrameModelData().border+n/2,0).applyQuaternion(this.quaternion).add(this.position);break;default:this.overlay.rotation.copy(this.rotation)}if(!e||"scale"==e.mode)switch(this.type){case"ground_1":this.parts.body.bottom.scale.x=this.overlay.scale.x,this.parts.body.backFace.scale.set(this.overlay.scale.x,this.overlay.scale.y,-this.overlay.scale.z),this.parts.body.backFace.position.set(0,n/2+ys[this.type].height,0),this.overlay.position.copy(this.position).add(new THREE.Vector3(0,n/2+ys[this.type].height,0).applyQuaternion(this.quaternion));break;case"ground_2":this.parts.body.middle.scale.y=this.overlay.scale.y,this.parts.body.top.position.y=n/2+.005,this.parts.body.bottom.position.y=-n/2-.005,this.parts.body.backFace.scale.set(this.overlay.scale.x,this.overlay.scale.y,-this.overlay.scale.z);break;case"wall_0":case"wall_1":case"wall_2":case"wall_3":var i=this.getFrameModelData(t,n),o=i.vertices,r=i.normals;this.parts.body.geometry.setAttribute("position",new THREE.BufferAttribute(new Float32Array(o),3)),r&&this.parts.body.geometry.setAttribute("normal",new THREE.BufferAttribute(new Float32Array(r),3)),this.position.set(0,-this.getFrameModelData().border-n/2,0).applyQuaternion(this.quaternion).add(this.overlay.position),this.parts.line&&(this.parts.line.geometry.dispose(),this.parts.line.geometry=new THREE.EdgesGeometry(this.parts.body.geometry))}}},{key:"getFrameModelData",value:function(e,t){var n=this.overlay&&!isNaN(this.overlay.depth)?this.overlay.depth:at.overlay.depth;!e&&(e=at.overlay.width),!t&&(t=at.overlay.height);for(var i={wall_0:{border:.05,vertices:[e/2,t/2,n,e/2+.01,t/2+.01,n+.02,e/2+.05,t/2+.05,n+.02,e/2,-t/2,n,e/2+.01,-t/2-.01,n+.02,e/2+.05,-t/2-.05,n+.02,-e/2,-t/2,n,-e/2-.01,-t/2-.01,n+.02,-e/2-.05,-t/2-.05,n+.02,-e/2,t/2,n,-e/2-.01,t/2+.01,n+.02,-e/2-.05,t/2+.05,n+.02,e/2+.05,t/2+.05,0,e/2+.05,-t/2-.05,0,-e/2-.05,-t/2-.05,0,-e/2-.05,t/2+.05,0],indexs:[0,3,4,0,4,1,1,4,5,1,5,2,3,6,7,3,7,4,4,7,8,4,8,5,6,9,10,6,10,7,7,10,11,7,11,8,9,0,1,9,1,10,10,1,2,10,2,11,0,6,3,0,9,6,2,13,12,2,5,13,5,14,13,5,8,4,8,15,14,8,11,15,11,12,15,11,2,12,12,13,14,12,14,15]},wall_1:{border:0,vertices:[e/2,t/2,n,e/2,t/2,0,e/2,-t/2,n,e/2,-t/2,0,-e/2,-t/2,n,-e/2,-t/2,0,-e/2,t/2,n,-e/2,t/2,0],normals:[1,1,1,1,1,-1,1,-1,1,1,-1,-1,-1,-1,1,-1,-1,-1,-1,1,1,-1,1,-1],indexs:[0,2,3,0,3,1,2,4,5,2,5,3,4,6,7,4,7,5,6,0,1,6,1,7,0,4,2,0,6,4,1,3,5,1,5,7]},wall_2:{border:.06,vertices:[e/2+.02,t/2+.02,n,e/2+.02,t/2+.02,n+.03,e/2+.06,t/2+.06,n,e/2+.02,-t/2-.02,n,e/2+.02,-t/2-.02,n+.03,e/2+.06,-t/2-.06,n,-e/2-.02,-t/2-.02,n,-e/2-.02,-t/2-.02,n+.03,-e/2-.06,-t/2-.06,n,-e/2-.02,t/2+.02,n,-e/2-.02,t/2+.02,n+.03,-e/2-.06,t/2+.06,n,e/2+.06,t/2+.06,0,e/2+.06,-t/2-.06,0,-e/2-.06,-t/2-.06,0,-e/2-.06,t/2+.06,0],normals:[-1,-1,0,1,1,1,-1,-.5,-1,-1,-1,0,1,1,1,-1,-.5,-1,-1,-1,0,1,1,1,-1,-.5,-1,-1,-1,0,1,1,1,-1,-.5,-1,-1,.1,-1,1,.1,-1,-1,.1,-1,1,.1,-1],indexs:[0,3,4,0,4,1,1,4,5,1,5,2,3,6,7,3,7,4,4,7,8,4,8,5,6,9,10,6,10,7,7,10,11,7,11,8,9,0,1,9,1,10,10,1,2,10,2,11,0,6,3,0,9,6,2,13,12,2,5,13,5,14,13,5,8,14,8,15,14,8,11,15,11,12,15,11,2,12,12,13,14,12,14,15]},wall_3:{border:.05,vertices:[e/2,t/2,n,e/2+.05,t/2+.05,n,e/2,-t/2,n,e/2+.05,-t/2-.05,n,-e/2,-t/2,n,-e/2-.05,-t/2-.05,n,-e/2,t/2,n,-e/2-.05,t/2+.05,n,e/2+.05,t/2+.05,0,e/2+.05,-t/2-.05,0,-e/2-.05,-t/2-.05,0,-e/2-.05,t/2+.05,0],normals:[1,1,1,1,1,1,1,-1,1,1,-1,1,-1,-1,1,-1,-1,1,-1,1,1,-1,1,1,1,1,-1,1,-1,-1,-1,-1,-1,-1,1,-1],indexs:[0,2,3,0,3,1,2,4,5,2,5,3,4,6,7,4,7,5,6,0,1,6,1,7,0,4,2,0,6,4,1,9,8,1,3,9,3,10,9,3,5,10,5,11,10,5,7,11,7,8,11,7,1,8,8,9,10,8,10,11]}}[this.type],o=1;o<i.vertices.length;o+=3)i.vertices[o]+=t/2+i.border;i.uvs=[];for(var r=0;r<i.vertices.length*(2/3)/8;r++)i.uvs.push(0,1,1,1,1,0,0,0);return i}},{key:"initBracketMeshData",value:function(e){var t=this;if(ys[this.type]&&ys[this.type].loaded)e&&e(ys[this.type].object.clone());else{if("ground_1"==this.type){var n=.2;return ys[this.type]={object:null,height:.58*n,loaded:!1},ms(si.getImageURL("images/brackets/bracket_1.glb"),(function(i){var o=i.scene;o.position.y*=n,o.rotateY(Math.PI/2),o.scale.set(n,n,1/2.44),o.children.forEach((function(e){"Plane"!==e.name&&e.material.color.setRGB(.3,.3,.3)})),ys[t.type].object=o,ys[t.type].loaded=!0,e&&e(o)})),ys[this.type]}if("ground_2"==this.type){var i=.5;ys[this.type]={object:null,height:.795,loaded:!1},ms(si.getImageURL("images/brackets/bracket_2.glb"),(function(n){var o=n.scene;o.children.forEach((function(e){"dizuo001"==e.name?e.material.opacity=.6:e.material.color.setRGB(.3,.3,.3)})),o.scale.set(i,i,i),o.position.y+=.01,ys[t.type].object=o,ys[t.type].loaded=!0,e&&e(o)}))}}}},{key:"switchTranformControls",value:function(e){"scale"==e.mode||"translate"==e.mode&&this.type.indexOf("wall")>-1?e.attach(this.overlay):e.attach(this)}},{key:"remove",value:function(e){if(this.removeFromParent(),!e){var t=this.computeOverlayTransform({reverse:!0}),n=t.position,i=t.quaternion;this.overlay.position.copy(n),this.overlay.quaternion.copy(i)}}},{key:"dispose",value:function(e){this.remove(e),this.traverse((function(e){e.isMesh&&(e.geometry.dispose(),e.material.dispose())}))}}]),n}();function Es(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}var bs=function(e){f(n,THREE.Object3D);var t=Es(n);function n(e,i,r){var a;o(this,n),a=t.call(this),gs=!e.$app.config.view,a.player=e,a._planeGeometry=new THREE.PlaneGeometry(at.overlay.width,at.overlay.height,1,1),a._boxGeometry=new THREE.BoxBufferGeometry(at.overlay.width,at.overlay.height,at.overlay.depth);var s=H(a._boxGeometry.index.array);return s.splice(24,6),a._boxGeometry.setIndex(new THREE.BufferAttribute(new Uint16Array(s),1)),a._boxMat=new THREE.MeshBasicMaterial({color:"#eeeeee",transparent:!0,opacity:.8}),a.videoPlayer=r,a.isHidden=!1,null==i.reverse&&(i.reverse=!1),null==i.limitToOnlyPano&&(i.limitToOnlyPano=!1),a.cornerPoints=[],a.info=i,a.sid=i.sid,a.build(i),a.name="overlay_"+a.sid,a.floor=a.player.model.floors.get(i.floorIndex)||a.raycastToFindFloor(),a.updateVisibleOnFloor(),a.addEventListener("isVisible",(function(e){a.player.EditOverlay.editPlane==h(a)&&a.player.EditOverlay.controlSelectOverlay(e.visible?h(a):null)})),a}return u(n,[{key:"show",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";De.updateVisible(this,e,!0),this.frame&&this.frame.show(),"forceHide"==e&&(this.isHidden=!1)}},{key:"hide",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";De.updateVisible(this,e,!1),this.frame&&this.frame.hide(),"forceHide"==e&&(this.isHidden=!0)}},{key:"raycastToFindFloor",value:function(){return this.floor=pt.raycastToFindFloor(this.player,this.plane.getWorldPosition(new THREE.Vector3)),this.floor||(console.error("Overlay raycastToFindFloor cannot find floor?"),this.floor=this.player.model.floors.first()),this.floor}},{key:"updateVisibleOnFloor",value:function(e){this.player.model.currentFloor==this.floor||this.player.model.allFloorsVisible||"panorama"==this.player.modeTran.split("-")[1]?this.show("visiOnFloor"):this.hide("visiOnFloor")}},{key:"build",value:function(e){var t=this;this.modified=e.modified;var n=new THREE.Mesh(this._planeGeometry,new THREE.MeshBasicMaterial({color:"#00c8af",opacity:.4,transparent:!0,polygonOffset:!0,polygonOffsetFactor:-.9,polygonOffsetUnits:-4}));if(n.renderOrder=je,this.add(n),this.plane=n,this.player.OverlayManager.add(this),e.media){if(e.media.includes("video"))e.type="video",gs?this.loadVideo():this.player.on("view.changed",(function(){var e=t.info.media instanceof HTMLVideoElement?1e3:200;De.intervalTool.isWaiting("overlayInsight_"+t.player.model.sid,(function(){t.player.flying||(t.visible&&t.inSight()?t.videoControl(!0):t.videoControl(!1))}),e)}));else if(e.media.includes("photo")){var i=new Image;i.crossOrigin="anonymous",this.info.isBillboard?i.src=this.getMapSrc():i.src=this.player.$app.resource.getUserResourceURL(e.poster),i.onload=function(){t.dispatchEvent({type:"mapLoaded"})},e.media=i,e.type="photo"}n.material.color=new THREE.Color(1,1,1)}null==e.width&&(e.width=at.overlay.width),null==e.height&&(e.height=at.overlay.height),this.setFromInfo(e)}},{key:"loadVideo",value:function(){return this.info.media instanceof HTMLVideoElement||(this.info.media=this.videoPlayer.getVideo(this.info.sid),this.info.media.addEventListener("ended",(function(){info.media.play(),info.media.paused})),this.setFromInfo(this.info),this.plane.material.needsUpdate=!0),this.info.media}},{key:"setFromInfo",value:function(e){var t=this,n=this.plane;if(e.width&&(this.scale.setX(e.width/at.overlay.width),this.width=e.width),e.height&&(this.scale.setY(e.height/at.overlay.height),this.height=e.height),!isNaN(e.depth)&&(this.depth=e.depth),e.pos instanceof Array&&(e.pos=(new THREE.Vector3).fromArray(e.pos)),e.qua instanceof Array&&(e.qua=(new THREE.Quaternion).fromArray(e.qua)),e.pos&&this.position.copy(e.pos),e.qua&&this.quaternion.copy(e.qua),e.reverse&&(this.scale.x*=-1),this.isHidden=e.hide,De.updateVisible(this,"forceHide",!this.isHidden),e.type){if(n.material.map)n.material.map.image=e.media,n.material.map.needsUpdate=!0;else{if("video"==e.type){if(!(this.info.media instanceof HTMLVideoElement))return;var i=new THREE.VideoTexture(e.media);if(n.material.map=i,!gs){var o=i.needsUpdate;Object.defineProperty(i,"needsUpdate",{get:function(){return o},set:function(e){(o=!t.info.media.paused&&e)&&(i.version++,i.source.needsUpdate=!0)}})}}else n.material.map=new THREE.Texture(e.media),n.material.map.needsUpdate=!0;n.material.map.wrapS=n.material.map.wrapT=THREE.ClampToEdgeWrapping,n.material.map.minFilter=THREE.LinearFilter,n.material.map.magFilter=THREE.LinearFilter,n.material.map.anisotropy=4,n.material.map.generateMipmaps=!1,n.material.opacity=1}this.file=e.file}this.overlayType=e.type,e.frameType||this.info.isBillboard||(e.frameType="wall_1"),this.info.isBillboard||this.addFrame(e.frameType,"new"!==this.modified),this.limitToOnlyPano=!!e.limitToOnlyPano&&this.player.model.panos.index[e.limitToOnlyPano],this.limitToOnlyPano&&this.limitToOnlyPano!=this.player.currentPano&&this.hide("limitToOnlyPano"),this.visiblePanos=pt.getVisiblePano(this.position,this.player.model)}},{key:"addFrame",value:function(e,t){if(!this.frame||this.frame.type!==e||t){if(this.frame&&(this.frame.dispose(t),this.frame=null),e){t||"wall_1"!=e||(this.depth=this.depthTemp);var n=new As(e);n.setOverlay(this,t),this.player.OverlayManager.frameGroup.add(n)}}else{var i=this.frame.computeOverlayTransform({reverse:!0}),o=i.position,r=i.quaternion;this.frame.position.copy(o),this.frame.quaternion.copy(r)}}},{key:"dispose",value:function(){this.plane.material.dispose(),this.plane.material.map=null,this.parent.remove(this)}},{key:"inSight",value:function(){if(gs)return!0;if("panorama"!=this.player.mode||!this.player.currentPano){var e=new THREE.Matrix4;e.multiplyMatrices(this.player.camera.projectionMatrix,this.player.camera.matrixWorldInverse);var t=new THREE.Frustum;t.setFromProjectionMatrix(e),this.plane.geometry.boundingBox||this.plane.geometry.computeBoundingBox();var n=this.plane.geometry.boundingBox.clone().applyMatrix4(this.matrixWorld);return t.intersectsBox(n)}if(this.visiblePanos&&!this.visiblePanos.includes(this.player.currentPano))return!1;if(this.player.camera){var i,o=this.getCornerPoint(),r=new THREE.Vector2(2,2),a=1/this.player.zoomLevel,s=this.getMediaSize();if(s.x>0&&(a*=Math.sqrt(s.x*s.y)/1e3),r.multiplyScalar(a),o.diffLon<r.x||o.diffLat<r.y)return!1;for(var l=0,c=(i=o.diffLon<15&&o.diffLat<15?[o.cornerPoint[0]]:o.cornerPoint).length;l<c;l++){var u=pt.getPos2d(i[l],this.player);if(u.trueSide&&u.inSight)return!0}}}},{key:"getMediaSize",value:function(){var e=new THREE.Vector2;return this.info.media instanceof Image?(e.x=this.info.media.width,e.y=this.info.media.height):this.info.media instanceof HTMLVideoElement?(e.x=this.info.media.videoWidth||1e3,e.y=this.info.media.videoHeight||1e3):(e.x=1e3,e.y=1e3),e}},{key:"getCornerPoint",value:function(){var e,t,n,i=this;if(this.cornerPoints[this.player.currentPano.id])return this.cornerPoints[this.player.currentPano.id];this.plane&&(n=this.plane.getWorldPosition(new THREE.Vector3),e=[new THREE.Vector3(-.5,.5,0),new THREE.Vector3(.5,.5,0),new THREE.Vector3(.5,-.5,0),new THREE.Vector3(-.5,-.5,0)]);var o=-1/0,r=1/0,a=-1/0,s=1/0,l=this.player.currentPano.position.clone(),c=(n=this.position.clone()).clone().sub(l).normalize(),u={};this.player.cameraControls.controls.panorama.lookAt.call(u,null,c),e.forEach((function(e){var t=e.applyMatrix4(i.plane.matrixWorld).clone().sub(l).normalize(),n={};i.player.cameraControls.controls.panorama.lookAt.call(n,null,t);var c=(n.lon-u.lon)%360;Math.abs(c)>180&&(c+=c>0?-360:360);var h=n.lat-u.lat;o=Math.max(c,o),r=Math.min(c,r),a=Math.max(h,a),s=Math.min(h,s)}));var h=o-r,d=a-s;return d>180?t=e:(o+=u.lon,a+=u.lat,r+=u.lon,s+=u.lat,t=[ge.getDirByLonLat(o,a),ge.getDirByLonLat(r,s),ge.getDirByLonLat(o,s),ge.getDirByLonLat(r,a)].map((function(e){return e.negate().add(l)})),t=[n].concat(H(t))),this.cornerPoints[this.player.currentPano.id]={cornerPoint:t,diffLon:h,diffLat:d},this.cornerPoints[this.player.currentPano.id]}},{key:"videoControl",value:function(e){var t=this.info.media;this.shouldPlay=e,e&&"stop"!=e?e&&(!t.paused&&t instanceof HTMLVideoElement||(t=this.loadVideo()).play()):t instanceof HTMLVideoElement&&!t.paused&&t.pause()}}]),n}();function ws(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}function xs(){document.fullscreenElement&&"VIDEO"===document.fullscreenElement.tagName&&document.fullscreenElement.getAttribute("unfullscreen")&&(document.exitFullscreen?document.exitFullscreen():document.msExitFullscreen?document.msExitFullscreen():document.mozCancelFullScreen?document.mozCancelFullScreen():document.oRequestFullscreen?document.oCancelFullScreen():document.webkitExitFullscreen?document.webkitExitFullscreen():document.webkitCancelFullScreen&&document.webkitCancelFullScreen(),setTimeout((function(){xs()}),250))}Fe.detectAndroidMobile()&&(window.addEventListener("resize",(function(){setTimeout((function(){xs()}),500)})),window.addEventListener("orientationchange",(function(e){if(0==window.orientation||180==window.orientation){var t=document.querySelectorAll("video[box]");t.forEach((function(e){e.remove()})),setTimeout((function(){t.forEach((function(e){document.body.appendChild(e),e.play()}))}),500)}else{var n=document.querySelectorAll("video[box]");n.forEach((function(e){e.remove()})),setTimeout((function(){n.forEach((function(e){document.body.appendChild(e),e.play()}))}),500)}})));var Cs=function(e){f(n,EventEmitter);var t=ws(n);function n(e){var i;return o(this,n),(i=t.call(this)).player=e,i.instances=new Map,i.video=null,i}return u(n,[{key:"addVideo",value:function(e){var t=this._createVideo(this._getVideoPath(e));return this.instances.set(e,t),t.videoElement.masters=[],t}},{key:"getVideo",value:function(e,t){var n=this.instances.get(e);return n||(n=this.addVideo(e)),t&&n.videoElement.masters.push(t),n.videoElement}},{key:"_getVideoPath",value:function(e){}},{key:"_createVideo",value:function(e){var t=this,n=document.createElement("video");n.setAttribute("crossOrigin","anonymous"),n.setAttribute("playsinline","true"),n.setAttribute("webkit-playsinline","true"),n.setAttribute("controls","true"),n.setAttribute("unfullscreen","true"),n.autoplay=!1,n.muted=!0,n.loop=!0,n.style.position="fixed",n.style.left="0",n.style.top="0",n.style.zIndex="0",n.style.width="1px",n.style.opacity="0",document.body.appendChild(n),n.player=this;var i=flvjs.createPlayer({type:"flv",url:e});return i.videoElement=n,i.attachMediaElement(n),i.on(flvjs.Events.ERROR,(function(){t._onPlayerError(),console.log("尝试使用mp4链接进行播放"),n.src=e.replace(".flv",".mp4")})),i.load(),i}},{key:"_onPlayerError",value:function(){console.warn("视频加载失败")}}]),n}();function Ts(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}var Is=function(e){f(n,e);var t=Ts(n);function n(e){return o(this,n),t.call(this,e)}return u(n,[{key:"_createVideo",value:function(e){var t=document.createElement("video");t.setAttribute("crossOrigin","anonymous"),t.setAttribute("playsinline","true"),t.setAttribute("webkit-playsinline","true"),t.setAttribute("controls","true"),t.setAttribute("box","true"),t.setAttribute("unfullscreen","true"),t.autoplay=!1,t.muted=!0,t.loop=!0,t.style.position="fixed",t.style.left="0",t.style.top="0",t.style.zIndex="0",t.style.width="1px",t.style.opacity="0",document.body.appendChild(t),t.player=this;var n=flvjs.createPlayer({type:"flv",url:e});return n.videoElement=t,n.attachMediaElement(t),n.on(flvjs.Events.ERROR,this._onPlayerError.bind(this)),n.load(),n}},{key:"_getVideoPath",value:function(e){return this.player.$app.resource.getUserResourceURL(e+".flv")}}]),n}(Cs);function ks(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}var Bs=function(e){f(n,EventEmitter);var t=ks(n);function n(e){var i;return o(this,n),(i=t.call(this)).player=e,i.video=null,i.videos=new Map,i}return u(n,[{key:"addVideo",value:function(e){var t=this._createVideoElement(this._getVideoPath(e));return this.videos.set(e,t),t.masters=[],t}},{key:"getVideo",value:function(e,t){var n=this.videos.get(e);return n||(n=this.addVideo(e)),t&&n.masters.push(t),n}},{key:"_getVideoPath",value:function(e){return this.player.$app.resource.getUserResourceURL(e+".mp4")}},{key:"_createVideoElement",value:function(e){var t=document.createElement("video");return t.setAttribute("crossOrigin","anonymous"),t.setAttribute("playsinline","true"),t.setAttribute("x5-playsinline","true"),t.setAttribute("webkit-playsinline","true"),t.setAttribute("x5-video-player-type","h5"),t.setAttribute("controls","true"),t.setAttribute("x-webkit-airplay","allow"),t.autoplay=!0,t.muted=!0,t.loop=!0,t.src=e,t.style.position="fixed",t.style.left="0",t.style.top="0",t.style.zIndex="1000",t.style.width="300px",t.style.height="300px",t}}]),n}();function Ps(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}var Rs,Ms,Ss=function(e){f(n,e);var t=Ps(n);function n(e){return o(this,n),t.call(this,e)}return u(n,[{key:"_getVideoPath",value:function(e){return this.player.$app.resource.getUserResourceURL(e+".mp4")}}]),n}(Bs);function Ds(){Ms={version:1,upPath:"",videoPath:Rs.resource.getViewResourceURL("video/"),videoInfos:new Map,parameters:{inputWidth:0,inputHeight:0,outputWidth:0,outputHeight:0,focal:0,pixel:0,centerX:0,centerY:0,translateX:0,translateY:0,translateZ:0,lenOffsetX:0,lenOffsetY:0,videoWidth:0,videoHeight:0,mapping:0,cameraType:0,blend_fov:5}}}var Ls=null;function Fs(e,t,n){t&&(JSON.parse(t).forEach((function(t){e.videoInfos.set(t.panoId,{dir:(new THREE.Vector3).copy(t.dir),hfov:parseFloat(t.hfov),vfov:parseFloat(t.vfov),mp4:{url:e.videoPath+t.panoId+"-user.mp4"+n},mpeg:{url:e.videoPath+t.panoId+"-user.ts",size:t.tsSize+n},flv:{url:e.videoPath+t.panoId+"-user.flv"+n},exposure:1,clipRect:t.rect,mapping:2})})),e.parameters.mapping=2,e.parameters.cameraType=8)}var Hs={handle:function(e,t){Rs=t,Ms||Ds();var n="";if(void 0!==e.version&&(n="?imagesVersion="+e.version),!e.videos)return e.videos={version:Ms.version,videos:Ms.videoInfos,parameters:Ms.parameters},void Fs(Ms,e.videosUser,n);try{var i=e.videos;if(!i.data||!i.data.length)return e.videos={version:Ms.version,videos:Ms.videoInfos,parameters:Ms.parameters},void Fs(Ms,e.videosUser,n)}catch(e){console.error(e)}var o,r=e.sceneFrom||"pro";if("pro"==r){var a=e.videos,s=a.version||0;return Ms.version=s,Ms.parameters.cameraType=8,1==s?a.data.forEach((function(e){Ms.videoInfos.set(e.id,{mp4:{url:Ms.videoPath+e.id+".mp4"+n},mpeg:{url:Ms.videoPath+e.id+".ts",size:e.tsSize+n},flv:{url:Ms.videoPath+e.id+".flv"+n},exposure:Number(e.value)||1,mapping:0,cameraType:8,blend_fov:e.blend_fov||5})})):s>1&&a.data.forEach((function(e){Ms.videoInfos.set(e.id,{mp4:{url:Ms.videoPath+e.id+".mp4"+n},mpeg:{url:Ms.videoPath+e.id+".ts"+n,size:e.tsSize},flv:{url:Ms.videoPath+e.id+".flv"+n},exposure:Number(e.value)||1,mapping:1,cameraType:8,blend_fov:e.blend_fov||5})})),(o=a.upPath,Ls||(Ls=new Promise((function(e,t){o||t("找不到参数请求地址"),ri.getText(o).then((function(t){return e(t)})).catch((function(e){return t(e)}))})).then((function(e){var t=e.split(/\n/).filter((function(e){return""!=e.trim()})).map((function(e){return e.split(":")})),n=Number(t[0][1]),i=Number(t[1][1]),o=t[2][1].trim().split(/\s+/).map((function(e){return Number(e)})),r=t[7][0].trim().split(/\s+/).map((function(e){return Number(e)}))[3],a=t[8][0].trim().split(/\s+/).map((function(e){return Number(e)}))[3],s=t[9][0].trim().split(/\s+/).map((function(e){return Number(e)}))[3];return Ms.parameters.focal=n,Ms.parameters.pixel=i,Ms.parameters.centerX=o[0],Ms.parameters.centerY=o[1],Ms.parameters.translateX=r,Ms.parameters.translateY=a,Ms.parameters.translateZ=s,Ms})).catch((function(e){return console.warn("球幕视频【八目】:参数文件加载失败",e),Ms})).finally((function(){return Ms})))).then((function(t){return s<=2?(t.parameters.inputWidth=2304,t.parameters.inputHeight=1728,t.parameters.outputWidth=2048,t.parameters.outputHeight=1024):s>2&&(t.parameters.inputWidth=4608,t.parameters.inputHeight=3456,t.parameters.outputWidth=8192,t.parameters.outputHeight=4096,t.parameters.lenOffsetX=1235,t.parameters.lenOffsetY=954,t.parameters.videoWidth=2112,t.parameters.videoHeight=1584,t.parameters.mapping=1),e.videos={version:t.version,videos:t.videoInfos,parameters:t.parameters},Fs(t,e.videosUser,n),t})).catch((function(e){throw e}))}if("lite"==r){var l=e.videos,c=l.version||0;Ms.version=c,Ms.parameters.cameraType=2;var u="";return void 0!==e.version&&(u="?imagesVersion="+e.version),1==c&&l.data.forEach((function(e){Ms.videoInfos.set(e.id,{mp4:{url:Ms.videoPath+e.id+".mp4"+u},mpeg:{url:Ms.videoPath+e.id+".ts",size:e.tsSize+u},flv:{url:Ms.videoPath+e.id+".flv"+u},exposure:Number(e.value)||1,mapping:1,cameraType:2,blend_fov:e.blend_fov||5})})),function(e){return Ls||(Ls=new Promise((function(t,n){e||n("找不到参数请求地址"),ri.getText(e,null,(function(e){t(e)}),(function(e){n(e)}))})).then((function(e){var t={};return e.split("\n").map((function(e){if(e.length>0){var n=e.split(":"),i=n[0],o=n[1].trim().split(" ");t[i]=Number(o[0])}})),Ms.parameters.focal=t.focal,Ms.parameters.centerX=t.cx,Ms.parameters.centerY=t.cy,Ms.parameters.translateX=t.tx,Ms.parameters.translateY=t.ty,Ms.parameters.translateZ=t.tz,Ms})).catch((function(e){return console.warn("球幕视频【双目】:参数文件加载失败"),Ms})).finally((function(){return Ms})))}(l.upPath).then((function(t){return 1==c&&(t.parameters.inputWidth=3e3,t.parameters.inputHeight=3e3,t.parameters.outputWidth=4096,t.parameters.outputHeight=2048,t.parameters.pixel=1.12),e.videos={version:t.version,videos:t.videoInfos,parameters:t.parameters},t})).catch((function(e){throw e}))}if("minion"==r||"laser"==r){var h=e.videos,d=h.version||0;Ms.version=d,Ms.parameters.cameraType=3;var p="";return void 0!==e.version&&(p="?imagesVersion="+e.version),h.data.forEach((function(e){Ms.videoInfos.set(e.id,{mp4:{url:Ms.videoPath+e.id+".mp4"+p},mpeg:{url:Ms.videoPath+e.id+".ts",size:e.tsSize+p},flv:{url:Ms.videoPath+e.id+".flv"+p},exposure:Number(e.value)||1,mapping:1,cameraType:3,blend_fov:e.blend_fov||5})})),function(e){return Ls||(Ls=new Promise((function(t,n){e||n("找不到参数请求地址"),t(ri.getText(e))})).then((function(e){var t={};return e.split("\n").map((function(e){if(e.length>0){var n=e.split(":"),i=n[0],o=n[1].trim().split(" ");t[i]=Number(o[0])}})),Ms.parameters.focal=t.focal,Ms.parameters.centerX=t.cx,Ms.parameters.centerY=t.cy,Ms.parameters.translateX=t.rx,Ms.parameters.translateY=t.ry,Ms.parameters.translateZ=t.rz,Ms})).catch((function(e){return console.warn("球幕视频【转台】:参数文件加载失败",e),Ms})).finally((function(){return Ms})))}(h.upPath).then((function(t){return t.parameters.inputWidth=5472,t.parameters.inputHeight=3648,t.parameters.outputWidth=4096,t.parameters.outputHeight=2048,t.parameters.lenOffsetX=920,t.parameters.lenOffsetY=500,t.parameters.videoWidth=3630,t.parameters.videoHeight=2670,t.parameters.pixel=1.12,e.videos={version:t.version,videos:t.videoInfos,parameters:t.parameters},Fs(t,e.videosUser,p),t})).catch((function(e){throw e}))}console.warn("有尚不支持的相机来源:",r)},getEnvironment:function(){Ms||Ds();var e="PC",t="H5";return Fe.detectAndroidMobile()?e="Android":Fe.detectIOS()&&(e="Ios"),Fe.detectWeixin()&&(t="WeChat",navigator.userAgent.match("miniProgram")&&(t="WeChatMiniprogram")),{os:e,environment:t}}};function Vs(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}var Os=function(e){f(n,EventEmitter);var t=Vs(n);function n(e){var i;o(this,n),(i=t.call(this)).player=e,i.group=new THREE.Object3D,i.group.name="OverlayGroup",i.frameGroup=new THREE.Object3D,i.frameGroup.name="OverlayFrameGroup",e.OverlayManager=h(i),i.withBox=!0,i.lineMat=yi.createFatLineMat({depthTest:!1,lineWidth:2,color:"#4fffff",opacity:.3}),i.model=i.player.model,i.model.add(i.group),i.model.add(i.frameGroup),i.player.$app.core.get("SceneRenderer").addComponent(h(i)),i.VideoManager=i.player.$app.VideoManager;var r=i.player.$app.store.getValue("metadata");if(r.boxVideos&&r.boxVideos.length){var a=r.boxVideos[0],s=Hs.getEnvironment(),l=s.os,c=s.environment;!window.MediaSource||"Android"!=l&&"WeChat"!=c?i.overlayVideoPlayer=new Ss(i.player):i.overlayVideoPlayer=new Is(i.player),i.add(new bs(i.player,a,i.overlayVideoPlayer))}return r.boxPhotos&&r.boxPhotos.length&&r.boxPhotos.forEach((function(e){i.add(new bs(i.player,e))})),e.on("collectIntersectMesh",(function(e){e.push.apply(e,H(i.group.children.filter((function(e){return e.visible})).map((function(e){return e.plane}))))})),e.on("judgeIntersect",(function(e,t){e&&(e.object.overlayType||e.object.parent.overlayType)?(i.hoverOverlay(e.object),t.consume()):i.hoverOverlay(null)})),e.on("pointerStart",(function(){i.autoPlay()})),e.on(ca,(function(e){var t=e.panoId;i.group.children.forEach((function(e){e.limitToOnlyPano&&(e.limitToOnlyPano.id!=t?(e.hide("limitToOnlyPano"),i.player.EditOverlay.editPlane==e&&i.VideoManager.emit("videos/panel/updatePanoVisi",!1)):(e.show("limitToOnlyPano"),i.player.EditOverlay.editPlane==e&&i.VideoManager.emit("videos/panel/updatePanoVisi",!0)))}))})),e.$app.config.view&&(e.on(ua,(function(t){var n,o=t.currentPano;"panorama"==e.mode&&(n=o.getVideoFilter()),i.group.children.forEach((function(e){n&&n(e.position)?e.hide("coveredPanoVideo"):e.show("coveredPanoVideo")}))})),i.group.children.filter((function(e){return"video"==e.info.type}))),i}return u(n,[{key:"add",value:function(e){this.group.add(e)}},{key:"show",value:function(e,t){this.group.children.forEach((function(n){t&&n.info.hide||"all"!=e&&n.floor.floorIndex!=e||n.show("visiOnFloor")}))}},{key:"hide",value:function(e){this.group.children.forEach((function(t){"all"!=e&&t.floor.floorIndex!=e||t.hide("visiOnFloor")}))}},{key:"setGroupVisible",value:function(e){this.group.visible=!!e,this.frameGroup.visible=!!e}},{key:"setSize",value:function(e,t){this.openOverlay&&this.resizeOverlay()}},{key:"hoverOverlay",value:function(e,t,n){if(this.group.visible){var i;if(this.withBox&&e?e=(i=e.parent).plane:i=e,i&&i.info.isBillboard&&null==i.targetPano&&W.view,this.model.player.billboardManager.editPlane||this.highlight(i,t),!e)return this.hoveringPlane&&(this.hoveringPlane.info.isBillboard&&((n=n||{}).data={sid:this.hoveringPlane.info.sid,title:this.hoveringPlane.info.title,panoId:this.hoveringPlane.info.panoId,subgroup:this.hoveringPlane.info.subgroup},this.model.player.billboardManager.emit("hoverBillboard",{sid:this.hoveringPlane.info.sid,state:!1,event:n})),this.hoveringPlane=null),Wr.remove("hoverOverlay"),void Wr.remove("dragOverlay");i.isEditing&&i.info.isBillboard?Wr.add("dragOverlay"):Wr.add("hoverOverlay"),this.hoveringPlane=i,i.info.isBillboard&&((n=n||{}).data={sid:i.info.sid,title:i.info.title,panoId:i.info.panoId,subgroup:i.info.subgroup},this.model.player.billboardManager.emit("hoverBillboard",{sid:i.info.sid,state:!0,event:n}))}}},{key:"highlight",value:function(e,t){var n=this;if(!this.player.$app.config.view){if(e){if(e.visible&&e!=this.highlightPlane){this.highlightPlane&&this.highlight(null),this.highlightPlane=e;for(var i=e.plane.geometry.getAttribute("position").array,o=new THREE.Object3D,r=[0,1,3,2],a=0;a<4;a++){var s=[{x:i[3*r[a]],y:i[3*r[a]+1],z:i[3*r[a]+2]},{x:i[3*r[(a+1)%4]],y:i[3*r[(a+1)%4]+1],z:i[3*r[(a+1)%4]+2]}];o.add(yi.createFatLine(s,{material:this.lineMat}))}this.group.children.forEach((function(e){var t=n.withBox?e.plane:e;t.border&&(t.border.children.forEach((function(e){return e.geometry.dispose()})),t.remove(t.border))})),this.lineMat.opacity=0,Ae.cancelById(at.freeze.wallLineShine,!0),Ae.start(function(e){this.lineMat.opacity=e}.bind(this),200,null,0,ye[at.transition.blendEasing],"wallLineShine",at.freeze.wallLineShine),e.plane.border=o,e.plane.add(o)}}else{if(this.highlightPlane){var l=function(){c.border.children.forEach((function(e){e.geometry.dispose()})),c.remove(c.border)},c=this.withBox?this.highlightPlane.plane:this.highlightPlane;Ae.cancelById(at.freeze.wallLineShine),"soon"==t?(this.lineMat.opacity=0,l()):Ae.start(function(e){this.lineMat.opacity=1-e}.bind(this),200,l,0,ye[at.transition.blendEasing],"wallLineShine",at.freeze.wallLineShine,l)}this.highlightPlane=null}}}},{key:"getMatFromCss",value:function(e){if(e.includes("matrix3d"))var t=e.slice(9,-1).split(",");else t=e.slice(7,-1).split(",");if(t.forEach((function(e,n){t[n]=parseFloat(e)})),16==t.length)var n=(new THREE.Matrix4).fromArray(t);else if(6==t.length)n=(new THREE.Matrix4).fromArray([t[0],t[1],0,0,t[2],t[3],0,0,0,0,1,0,t[4],t[5],0,1]);return n}},{key:"getCssFromMatrix",value:function(e){return"matrix3d("+e.elements+")"}},{key:"getOverlayOpenPos",value:function(e){var t=e.width/(.9*$("#player").width()),n=e.height/(.9*$("#player").height()),i=1/Math.max(t,n),o=-e.width*i/$("#player").width(),r=player.cameraControls.activeControl?player.cameraControls.activeControl.camera:player.camera,a=new THREE.Vector3(o,0,-1).unproject(r).clone().sub(player.camera.position),s=player.getDirection(),l=s.angleTo(a),c=e.width/2/Math.tan(l);this.withBox&&(c+=e.plane.position.length());var u=player.camera.position.clone().add(s.clone().multiplyScalar(c));return this.useCssRender||this.updatePlaneElemStyle(i),u}},{key:"updatePlaneElemStyle",value:function(e){this.openOverlay.elem.css({width:this.openOverlay.width*e+"px",height:this.openOverlay.height*e+"px"})}},{key:"getPlanePos",value:function(e){return this.withBox?(new THREE.Vector3).setFromMatrixPosition(e.plane.matrixWorld):e.position.clone()}},{key:"clickOverlay",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=n.dontEmit,o=n.forceFlyToPlane,r=n.afterFly,a=n.event;if(e.info.isBillboard){i||((a=a||{}).data={sid:e.info.sid,title:e.info.title,panoId:e.info.panoId,subgroup:e.info.subgroup},this.model.player.billboardManager.emit("clickBillboard",{sid:e.info.sid,event:a}));var s=this.model.player.$app.core.get("Scene").firstView.pano;if(!o){var l=this.model.player.model.panos.index[e.targetPano];return void(null==l||l!=s&&!l.hasNeighbor()||this.model.player.flyToPano({pano:l}))}if(null!=e.homePanoId){var c=this.model.player.model.panos.index[e.homePanoId];if(null!=c&&(c==s||c.hasNeighbor()))return void this.model.player.flyToPano({pano:c,lookAtPoint:e.position,checkAlone:!0})}}if(!(this.openOverlay&&!e||this.model.player.GLTFEditor.selecting)){Wr.remove("hoverOverlay");var u=this.withBox&&e?e.plane:e;"video"==e.overlayType&&u.material.map.image.play();var h=this.player.cameraControls.cameras.panorama.aspect*Math.tan(THREE.MathUtils.degToRad(this.model.player.zoomFov/2)),d=Math.tan(THREE.MathUtils.degToRad(this.model.player.zoomFov/2)),p=e.width/2/h,f=e.height/2/d,m=Math.max(p,f);if(m*=m,console.log("goodDistance "+m),e.limitToOnlyPano)this.player.flyToPano({pano:e.limitToOnlyPano,lookAtPoint:e.position});else{var v=e.visiblePanos;0==v.length&&console.warn("clickOverlay 找不到visiblePanos");var g={};this.player.$app.Camera.flyToPoint(e.position.clone(),{rank:[function(t){var n=new THREE.Vector3(0,0,1).applyQuaternion(e.quaternion),i=t.position.clone().sub(e.position),o=n.dot(i.normalize());return g[t.id]=o,200*o},function(t){var n=t.position.clone().distanceToSquared(e.position),i=m*Math.abs(g[t.id]);return-1*Math.abs(n-i)/i},function(n){return-500*n.position.clone().sub(e.position).normalize().dot(t.player.getDirection())}],require:[function(e){return v.includes(e)}],dealDistance:5,done:r})}var y=!i&&this.player.EditOverlay&&this.player.EditOverlay.editing;y&&(this.player.EditOverlay.editPlane&&this.player.EditOverlay.editPlane.uuid!=e.uuid||this.player.EditOverlay.isAdding&&this.player.domElement.style.cursor.indexOf("box_video.png")<0||y&&this.player.EditOverlay.editPlane!=e&&setTimeout((function(){var n=JSON.parse(JSON.stringify(e.info));n.sid=e.sid,n.type=e.overlayType,t.VideoManager.emit("videos/panel/display",n),t.player.EditOverlay.updateOverlayPanel(e),e.updateVisibleOnFloor()}),10))}}},{key:"autoPlay",value:function(e){this.group.children.forEach((function(e){!e.clickToPlayInited&&e.info.media instanceof HTMLVideoElement&&!De.isVideoPlayed(e.info.media)&&e.shouldPlay&&(console.log("try mobileAutoPlay "),e.videoControl(!0),De.isVideoPlayed(e.info.media)&&(console.log("clickToPlayInited "),e.clickToPlayInited=!0))}))}}]),n}();function Qs(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}var _s=function(e){f(n,EventEmitter);var t=Qs(n);function n(e){var i;return o(this,n),(i=t.call(this)).editing=!1,i.overlayMaxCount=1,i.meshGroup=new THREE.Object3D,i.player=e,i}return u(n,[{key:"checkIfCanInit",value:function(){return this.player.model&&this.player.model.chunks.length&&this.player.currentPano&&this.player.model.transformControls}},{key:"waitToInit",value:function(){var e=this;console.log("waitToInit");var t=setInterval((function(){e.checkIfCanInit()&&(e.init(),clearInterval(t))}),50)}},{key:"init",value:function(){var e=this;this.checkIfCanInit()?(this.VideoManager=this.player.$app.VideoManager,this.transformControls=this.player.model.transformControls,this.transformControls.addEventListener("mousing",(function(t){var n;"overlay"==t.state&&(e.VideoManager.emit("VideoManager.BoxVideo.transform",t.mode),null===(n=e.editPlane)||void 0===n||n.frame.update(t))})),this.meshGroup.name="overlay-group",this.player.model.add(this.meshGroup),this.meshGroup.visible=!1,this.player.OverlayManager.group.children.forEach((function(t){e.updateOverlayInfo(t)})),window.addEventListener("keydown",(function(t){var n;if(!e.editing){switch(t.which){case 87:n="translate";break;case 82:n="scale"}n&&e.VideoManager.emit("videos/panel/switchTclMode",n),t.stopPropagation()}})),this.enter()):this.waitToInit()}},{key:"enter",value:function(){this.editing||(this.editing=!0,this.meshGroup.visible=!0,this.player.cameraControls.controls.dollhouse.resetRanges(3),this.player.cameraControls.controls.panorama.insideLookLimitDown=W.isMobile?-55:-50)}},{key:"leave",value:function(){this.editing&&(this.editing=!1,this.endAddPlane(),this.meshGroup.visible=!1,this.transformControls.switchEditState(null),this.player.cameraControls.controls.dollhouse.resetRanges(),this.player.cameraControls.controls.panorama.insideLookLimitDown=null)}},{key:"beginToAddPlane",value:function(){this.player.viewLinkManager.exitView(),this.player.reticule.visible=!1,this.isAdding=!0,Wr.add("addOverlay")}},{key:"endAddPlane",value:function(){this.isAdding=!1,Wr.remove("addOverlay"),this.player.reticule.visible=!0}},{key:"addOverlay",value:function(e){var t=e.intersect.face.normal.clone(),n=to.UP.angleTo(t)>Math.PI/4?"wall":"ground";this.player.getMouseDirection().angleTo(e.intersect.face.normal)<Math.PI/2&&t.negate(),console.log("normal",t),t.y>.85&&(t=this.player.getMouseDirection().negate()),t.y=0,t.normalize();var i=(new THREE.Quaternion).setFromRotationMatrix((new THREE.Matrix4).lookAt(t,to.ZERO,to.UP)),o=e.intersect.point.add(t.multiplyScalar(.01)),r=new bs(this.player,{sid:De.getRandomSid(),floorIndex:this.player.model.currentFloor.floorIndex,pos:o,qua:i,modified:"new",frameType:n+"_1"});r.updateMatrixWorld(),this.player.OverlayManager.clickOverlay(r),this.VideoManager.emit("videos/panel/switchTclMode","translate"),this.endAddPlane()}},{key:"updateOverlayInfo",value:function(e){e.info.isBillboard||(e.info={width:e.width,height:e.height,depth:e.depth,pos:e.position.clone(),qua:e.quaternion.clone(),reverse:e.scale.x<0,media:e.plane.material.map.image,file:e.file,type:e.overlayType,hide:e.isHidden,frameType:e.frame&&e.frame.type,limitToOnlyPano:e.limitToOnlyPano&&e.limitToOnlyPano.id})}},{key:"undoEdit",value:function(){if(this.editPlane){var e=this.editPlane;"new"==e.modified?this.disposeOverlay(e):(e.setFromInfo(e.info),"delete"==e.modified&&this.player.OverlayManager.add(e))}}},{key:"updateOverlayScaleDisplay",value:function(){var e=this.editPlane,t=Math.abs(e.width)/190,n=Math.abs(e.height)/190,i=1/Math.max(t,n),o=Math.round(Math.abs(e.width)*i),r=Math.round(Math.abs(e.height)*i);this.VideoManager.emit("videos/panel/changeSize",{wText:e.width.toFixed(2),hText:e.height.toFixed(2),width:o,height:r,depth:isNaN(e.depth)?at.overlay.depth:e.depth})}},{key:"updateOverlayPanel",value:function(e){this.editPlane=e;var t=e.plane,n=t.material.map&&t.material.map.image;this.VideoManager.emit("videos/panel/updatePoster",n),this.updateOverlayScaleDisplay(),this.transformControls.switchEditState("overlay"),e.frame?this.VideoManager.emit("videos/panel/changeDepth",100*e.depth):this.VideoManager.emit("videos/panel/changeDepth",0),this.player.emit("beginEditOverlay")}},{key:"controlSelectOverlay",value:function(e){e&&e.visible?e.frame?e.frame.switchTranformControls(this.transformControls):this.transformControls.attach(e):this.transformControls.detach()}},{key:"useImgRatio",value:function(e){var t=this.editPlane.plane;if(t.material.map){var n=t.material.map.image,i="video"==this.editPlane.overlayType?n.videoWidth:n.width,o="video"==this.editPlane.overlayType?n.videoHeight:n.height;if("suitSize"==e){var r=Math.min(Math.max(i,o)/200,1);if(i>o)var a=r,s=r*o/i;else s=r,a=r*i/o}else{var l=Math.sqrt(Math.abs(this.editPlane.width*this.editPlane.height)/(i*o));a=l*i*(this.editPlane.width<0?-1:1),s=l*o*(this.editPlane.height<0?-1:1)}this.editPlane.scale.setX(a/at.overlay.width),this.editPlane.scale.setY(s/at.overlay.height),this.editPlane.width=a,this.editPlane.height=s,this.updateOverlayScaleDisplay()}}},{key:"overlayUploaded",value:function(e,t){var n=this.editPlane.plane;t.style.width="100%",t.style.height="100%",t instanceof HTMLVideoElement?(n.material.map=new THREE.VideoTexture(t),n.material.map.image.play(),this.editPlane.overlayType="video",t.autoplay=!0,t.loop=!0,t.volume=0,t.muted=!0):(n.material.map=new THREE.Texture(t),n.material.map.needsUpdate=!0,this.editPlane.overlayType="photo"),n.material.map.minFilter=THREE.LinearFilter,this.useImgRatio(),this.editPlane.file=e,n.material.opacity=1,n.material.color=new THREE.Color(1,1,1),n.material.needsUpdate=!0,this.VideoManager.emit("videos/panel/updatePoster",t),this.editPlane.frame&&this.editPlane.frame.update({mode:"scale"})}},{key:"getOverlaySavingInfo",value:function(){var e=this.editPlane;if(e.file||e.plane.material.map&&e.plane.material.map.image){var t={width:ge.toPrecision(e.width,4),height:ge.toPrecision(e.height,4),depth:ge.toPrecision(e.depth,4),pos:ge.toPrecision(e.position.toArray(),4),qua:ge.toPrecision(e.quaternion.toArray(),4),reverse:e.scale.x<0,sid:e.sid,media:[e.overlayType],hide:e.isHidden,floorIndex:e.floor.floorIndex,frameType:e.frame&&e.frame.type,limitToOnlyPano:e.limitToOnlyPano&&e.limitToOnlyPano.id},n=this;return{data:t,type:"new"==e.modified?1:0,needSaveMedia:!e.info||e.file!=e.info.file,done:function(){try{e.modified=!1,e.visiblePanos=pt.getVisiblePano(e.position,n.player.model),n.updateOverlayInfo(e)}catch(e){console.error(e)}}}}}},{key:"disposeOverlay",value:function(e){if(e==this.player.OverlayManager.hoveringPlane&&this.player.OverlayManager.hoverOverlay(null,"soon"),e.plane.material.map){var t=e.plane.material.map.image;t&&t.load&&(t.src="",t.load())}e.dispose(),e.modified="delete",e.frame&&e.frame.dispose()}},{key:"DeleteOverlay",value:function(e,t){var n=this;t(e.sid,(function(){n.disposeOverlay(e),n.controlSelectOverlay(null)}))}}]),n}();function zs(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}ct("store",(function(){return function(e){f(r,e);var t,n,i=zs(r);function r(){var e;return o(this,r),(e=i.call(this)).__store={},e}return u(r,[{key:"get",value:function(){var e=k(S.mark((function e(t,n){var i;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n&&(this.$app.resource.reload=!0),!this.__store[t]||n){e.next=3;break}return e.abrupt("return",this.__store[t]);case 3:if(i=null,"function"!=typeof this.$app.resource[t]){e.next=8;break}return e.next=7,this.$app.resource[t]();case 7:i=e.sent;case 8:return this.$app.resource.reload=!1,e.abrupt("return",i||this.__store[t]);case 10:case"end":return e.stop()}}),e,this)})));return function(t,n){return e.apply(this,arguments)}}()},{key:"getAppImage",value:(n=k(S.mark((function e(t){return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.__store[t]){e.next=2;break}return e.abrupt("return",this.__store[t]);case 2:return e.next=4,this.$app.resource.getAppImage(t);case 4:return e.abrupt("return",this.__store[t]);case 5:case"end":return e.stop()}}),e,this)}))),function(e){return n.apply(this,arguments)})},{key:"getUserImage",value:(t=k(S.mark((function e(t,n){return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.__store[t]||n){e.next=2;break}return e.abrupt("return",this.__store[t]);case 2:return e.next=4,this.$app.resource.getUserImage(t);case 4:return e.abrupt("return",this.__store[t]);case 5:case"end":return e.stop()}}),e,this)}))),function(e,n){return t.apply(this,arguments)})},{key:"getValue",value:function(e){return this.__store[e]}},{key:"setValue",value:function(e,t,n){if(void 0===e||void 0===t)return this;var i=this.__store[e];return i&&(i[t]=n,this.emit(e,i,t)),this}},{key:"set",value:function(e,t){var n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if(void 0===e)return this;n&&(this.__store[e]=t),this.emit(e,t)}}]),r}(yo)}));var Us,Ns,Gs={WalkManger:{enter:'单击<img src="'.concat(si.getImageURL("images/roam/roam_checked.png"),'" crossorigin="anonymous">设置选中点位漫游可行。'),firstPointLimit:"初始点位无法隐藏。",link:"漫游到选中点位时,操作点位可以行走。",unLink:"漫游到选中点位时,操作点位不可行走。",show:"该点位已显示",hide:"已隐藏该点位,漫游时将不再显示",deactive:'单击<img src="'.concat(si.getImageURL("images/roam/roam_visible.png"),'" crossorigin="anonymous">设置点位漫游可行。'),activeHidePoint:'该点位已隐藏,点击<img src="'.concat(si.getImageURL("images/roam/roam_visible.png"),'" crossorigin="anonymous">可显示。')},TagManger:{unLink:"在该点位漫游时不再显示选中热点。"}};function js(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}var Ws=function(){function e(t){o(this,e),this.player=t,this.setPanoVisible=!1,this.setMultiFloorPanoVisible=!1,this.setTagVisible=!1,this.footIcons,this.actionIcons,this.activePano,this.panoVLines={},this.panoVTemp,this.tagVsetting,this.tagsVLines={},this.tagVTemp,this.linkToFloorPano,Us=t.model.panos.list.filter((function(e){return e.isAligned()})),Ns=t.model.panos.index}return u(e,[{key:"init",value:function(){var e=this;this.inited||(this.footTex1=si.load(si.getImageURL("images/End_256.png")),this.footTex2=si.load(si.getImageURL("images/End_unable_256.png")),this.footTex1_v=si.load(this.player.$app.resource.getAppURL("images/video_256.png")),this.footTex2_v=si.load(this.player.$app.resource.getAppURL("images/video_unable_256.png")),this.footTex5=si.load(si.getImageURL("images/mutil_connect_upper.png")),this.footTex6=si.load(si.getImageURL("images/mutil_connect_lower.png")),this.actionVisiTex0=si.load(si.getImageURL("images/roam/roam_invisible.png")),this.actionVisiTex1=si.load(si.getImageURL("images/roam/roam_visible.png")),this.actionLinkTex0=si.load(si.getImageURL("images/roam/roam_uncheck.png")),this.actionLinkTex1=si.load(si.getImageURL("images/roam/roam_checked.png")),this.ifAllPanoNoNeighbor(),this.meshGroup=new THREE.Object3D,this.meshGroup.name="setVisible-group",this.player.model.add(this.meshGroup),this.player.model.on("floor.changed",(function(t,n){(e.setTagVisible||e.setPanoVisible)&&e.gotoFloor(t.floorIndex)})),this.player.on("collectIntersectMesh",(function(t){e.footIcons&&(e.setPanoVisible||e.setTagVisible)&&t.push.apply(t,H(e.footIcons))})),this.player.on("judgeIntersect",(function(t,n){(n.getConsumed()||e.setPanoVisible||e.setTagVisible)&&(t&&"FootIcon"==t.object.type?Wr.add("hoverFootMarker"):Wr.remove("hoverFootMarker"),n.consume())})),this.inited=!0)}},{key:"enterSet",value:function(e){var t=this;if(this.init(),this.player.$app.gui.toast({event:"DialogList3D.WalkManger.enter",content:Gs.WalkManger.enter,showClose:!0}),"floorplan"==this.player.mode&&this.player.model.setModelDisplay(!0,"hideOnfloorplan"),"panoVisible"==e){if(!this.player.modeTran)return void(this.player.afterCModeFuc=function(){t.enterSet(e)});this.setPanoVisible=!0,this.player.flyoutType="beginSetPanoVisible",this.beginSetPanoVisible(),setTimeout((function(){t.player.flyToMode("floorplan",(function(){t.updateFootIconSize(),t.focusFloor()}))}),10)}else this.beginSetTagVisible(),this.player.flyToMode("floorplan",(function(){t.focusFloor()}))}},{key:"toggle",value:function(e){var t=this,n=this.activePano;if(e){var i=De.sortByScore(Us,[function(e){return e.isAligned()}],[function(e){return-e.position.distanceTo(n.position)}]);if(1==i.length)return void console.log("仅有一个漫游点");var o=[],r=Math.max(2*-i[1].score,4);if("all"==e)(o=i.filter((function(e){return 0!=e.score&&e.item.footIcon.visible}))).forEach((function(e){return t.panoVLines[e.item.id]&&t.panoVLines[e.item.id].visible||t.dealPanoVisible(e.item.id)}));else{for(var a=function(e,t){var n=e.position.clone(),i=t.position.clone();return pt.ifIntersectChunks(n,i,{})},s=1;s<i.length;s++)if(-i[s].score<r)a(n,i[s].item)&&(i[s].block=!0),i[s].good=!0;else{if(o||(o=i.filter((function(e){return e.good&&!e.block}))),!(o.length<2))break;if(!a(n,i[s].item))if(0==o.length)o.push(i[s]);else{var l=o[0].item.position.clone().sub(n.position).setY(0),c=i[s].item.position.clone().sub(n.position).setY(0);if(l.angleTo(c)>Math.PI/2){console.log("再加一个 角度"+THREE.MathUtils.radToDeg(l.angleTo(c)));break}}}0==o.length&&o.push(i[0]),o.forEach((function(e){return t.dealPanoVisible(e.pano.id)}))}}else{if(this.player.$app.core.get("Scene").firstView.pano==this.activePano)return this.player.$app.WalkManager.emit(this.checkLinkStatus()),this.player.$app.gui.toast({event:"DialogList3D.WalkManger.firstPointLimit",content:Gs.WalkManger.firstPointLimit,showClose:!0}),!1;for(var u in this.panoVLines)this.panoVLines[u].visible&&this.dealPanoVisible(u)}return this.checkFloorLinkStatus(),!0}},{key:"setDisplay",value:function(e){if(this.player.path.currentPanoMarker.mesh.visible=!e,this.player.OverlayManager&&this.player.OverlayManager.setGroupVisible(!e),this.player.reticule.visible=!e,this.player.emit("linkEditorSetVisible",e),!e&&this.footIcons)for(var t=0;t<this.footIcons.length;t++){var n=this.footIcons[t].pano.label._oriScale;if(null==n)break;this.footIcons[t].pano.marker.add(this.footIcons[t].pano.label),this.footIcons[t].pano.label.scale.set(n,n,n),delete this.footIcons[t].pano.label._oriScale,this.footIcons[t].pano.label.sprite.material.color.set("#fff"),this.footIcons[t].pano.label.sprite.material.opacity=1}e||"floorplan"!=this.player.mode||this.player.model.showOnFloorplan||this.player.model.setModelDisplay(!1,"hideOnfloorplan")}},{key:"beginSetPanoVisible",value:function(){this.panoVTemp={},this.player.currentPano.floor!=this.player.model.currentFloor&&this.player.gotoFloor(this.player.currentPano.floor.floorIndex),this.SetOnePanoVisible(this.player.currentPano),this.setDisplay(!0),this.player.$app.WalkManager.emit(this.checkLinkStatus(),"enter")}},{key:"SetOnePanoVisible",value:function(e){this.activePano!=e&&(this.activePano=e,this.delVisibleLines(),this.showFootIcons(e,!0),this.createPanoVisiLines(e))}},{key:"checkPanoVisiChange",value:function(){if(Object.keys(this.panoVTemp).length)return!0;for(var e in this.panoVLines){var t=this.panoVLines[e];if(t.name.indexOf("new")>-1&&t.visible)return!0;if(-1==t.name.indexOf("new")&&!t.visible)return!0}return!1}},{key:"saveLastPanoVi",value:function(e){if(e=e||this.activePano){var t=[];for(var n in this.panoVLines){var i=this.panoVLines[n];i.name.indexOf("new")>-1&&i.visible?t.push({type:"add",id:n}):-1!=i.name.indexOf("new")||i.visible||t.push({type:"sub",id:n})}if(t.length){var o=e.id;this.savePanoVisiChange(o,t)}}}},{key:"savePanoVisiChange",value:function(e,t){for(var n=this.searchNeib(e),i=n.seeMarkers,o=n.neighbourUUIDs,r=n.neighbourPanos,a=0;a<t.length;a++){var s,l=this.searchNeib(t[a].id),c=l.seeMarkers,u=l.neighbourUUIDs,h=l.neighbourPanos;if("add"==t[a].type)c.push(e),u.push(e),h[e]=!0,i.push(t[a].id),o.push(t[a].id),r[t[a].id]=!0;else(s=c.indexOf(e))>-1&&c.splice(s,1),(s=u.indexOf(e))>-1&&u.splice(s,1),h[e]=!1,(s=i.indexOf(t[a].id))>-1&&i.splice(s,1),(s=o.indexOf(t[a].id))>-1&&o.splice(s,1),r[t[a].id]=!1;this.panoVTemp[t[a].id]={neighbourPanos:h,seeMarkers:c,neighbourUUIDs:u}}this.panoVTemp[e]={neighbourPanos:r,seeMarkers:i,neighbourUUIDs:o}}},{key:"pauseSetPanoVisible",value:function(e,t){var n=this;this.setPanoVisible&&("unsaved"==e?this.saveLastPanoVi():(this.panoVTemp={},this.startEditPano=null),this.delVisibleLines(),this.activePano=null,this.showFootIcons(null,!0,t),Us.forEach((function(e){return n.changeIconVisiState(e.footIcon,n.checkHasNeighbor(e))})))}},{key:"finishSetPanoVisible",value:function(){this.setPanoVisible&&(this.setPanoVisible=!1,this.hideFootIcons(),this.delVisibleLines(),this.recoverAllState2(),this.activePano=null,this.startEditPano=null,this.panoVTemp={},this.player.flyoutType=null,this.setDisplay(!1),Wr.remove("hoverFootMarker"))}},{key:"savePanoVisibles",value:function(e){this.activePano&&this.saveLastPanoVi(this.activePano);var t=[];for(var n in this.panoVTemp)t.push({panoID:n,visibles:this.turnToPanoIndex(this.panoVTemp[n].seeMarkers),visibles3:this.turnToPanoIndex(this.panoVTemp[n].neighbourUUIDs)});if(0!=t.length)return t;console.warn("PanoLink没有改变")}},{key:"afterSavePanoVisibles",value:function(){var e=this;for(var t in this.panoVTemp){var n=Ns[t];n.seeMarkers=this.panoVTemp[t].seeMarkers,n.neighbourUUIDs=this.panoVTemp[t].neighbourUUIDs,n.neighbourPanos=this.panoVTemp[t].neighbourPanos}var i=this;if(this.checkHasNeighbor(this.player.currentPano))this.noPanoHasNeighbor=!1;else{var o=De.sortByScore(Us,[function(t){return e.checkHasNeighbor(t)}],[function(e){return-e.position.distanceTo(i.player.currentPano.position)}]);o&&o.length?(this.player.currentPano=o[0].item,this.noPanoHasNeighbor=!1):this.noPanoHasNeighbor=!0}this.pauseSetPanoVisible(),this.player.$app.WalkManager.emit("walkManager.deactive"),this.updateFootIconSize()}},{key:"searchNeib",value:function(e){var t={};return this.panoVTemp[e]?(t.seeMarkers=this.panoVTemp[e].seeMarkers,t.neighbourUUIDs=this.panoVTemp[e].neighbourUUIDs,t.neighbourPanos=this.panoVTemp[e].neighbourPanos):(t.seeMarkers=Ns[e].seeMarkers.slice(0),t.neighbourUUIDs=Ns[e].neighbourUUIDs.slice(0),t.neighbourPanos=De.CloneObject(Ns[e].neighbourPanos)),t}},{key:"turnToPanoIndex",value:function(e){for(var t=[],n=0;n<e.length;n++){var i=Ns[e[n]],o=Us.indexOf(i);t.push(o)}return t}},{key:"beginSetTagVisible",value:function(){this.setTagVisible||(this.setTagVisible=!0,this.tagVTemp={},this.setDisplay(!0))}},{key:"SetOneTagVisible",value:function(e){this.tagVsetting!=e&&(this.tagVsetting&&this.saveLastTagVi(this.tagVsetting),this.tagVsetting=e,this.delVisibleLines(),this.showFootIcons(),this.createTagVisiLines(e),this.updateFootIconSize(),this.player.$app.TagManager.emit(this.checkTagLinkStatus()))}},{key:"checkTagVisiChange",value:function(){if(Object.keys(this.tagVTemp).length)return!0;for(var e in this.tagsVLines){var t=this.tagsVLines[e];if(t.name.indexOf("new")>-1&&t.visible)return!0;if(-1==t.name.indexOf("new")&&!t.visible)return!0}return!1}},{key:"checkTagLinkStatus",value:function(){var e=Object.values(this.tagsVLines).filter((function(e){return e.visible}));return this.footIcons.filter((function(e){return e.visible})).length==e.length?"tagManager.linkAll":0==e.length?"tagManager.linkNone":"tagManager.linkSome"}},{key:"saveLastTagVi",value:function(){var e=!1,t=this.tagVTemp[this.tagVsetting.sid]||this.tagVsetting.visiblePanos.slice(0);for(var n in this.tagsVLines){var i=this.tagsVLines[n];if(i.name.indexOf("new")>-1&&i.visible)t.push(Ns[n]),e=!0;else if(-1==i.name.indexOf("new")&&!i.visible){var o=t.map((function(e){return e.id})).indexOf(n);if(-1==o){console.log("visiblePanos删除error");continue}t.splice(o,1),e=!0}}e&&(this.tagVTemp[this.tagVsetting.sid]=t)}},{key:"pauseSetTagVisible",value:function(e){this.setTagVisible&&this.tagVsetting&&("unsaved"==e?this.saveLastTagVi(this.tagVsetting):this.tagVTemp={},this.delVisibleLines(),this.hideFootIcons(),this.tagVsetting=null)}},{key:"finishSetTagVisible",value:function(){this.setTagVisible&&(this.pauseSetTagVisible(),this.setTagVisible=!1,this.setDisplay(!1))}},{key:"saveTagVisibles",value:function(){this.tagVsetting&&this.saveLastTagVi(this.tagVsetting);var e=[];for(var t in this.tagVTemp)e.push({sid:t,value:this.tagVTemp[t].filter((function(e){return!!e})).map((function(e){return e.id}))});return e}},{key:"afterSaveTagVisibles",value:function(){this.finishSetTagVisible()}},{key:"createTagVisiLines",value:function(e){var t=this;(this.tagVTemp[e.sid]||e.visiblePanos).forEach((function(n){t.createTagSingleLine(n,"old",e)}))}},{key:"createTagSingleLine",value:function(e,t,n){var i=yi.createLine([e.floorPosition.clone(),n.position.clone()],{color:He.green});this.meshGroup.add(i),i.name="tagVL-"+t+"-"+e.id,this.tagsVLines[e.id]=i,i.material.opacity=e.floor.floorIndex==this.player.model.currentFloor.floorIndex?1:.4,this.changeIconLinkState(Ns[e.id].footIcon,"linked")}},{key:"dealTagVisible",value:function(e,t){this.tagsVLines[t]?(this.tagsVLines[t].visible=!this.tagsVLines[t].visible,this.changeIconLinkState(Ns[t].footIcon,!!this.tagsVLines[t].visible&&"linked"),this.tagsVLines[t].visible||this.player.$app.gui.toast({event:"DialogList3D.TagManger.unLink",content:Gs.TagManger.unLink,showClose:!0})):this.createTagSingleLine(Ns[t],"new",e),this.player.$app.TagManager.emit(this.checkTagLinkStatus())}},{key:"setTagHideAll",value:function(e){var t=this;Object.keys(this.tagsVLines).forEach((function(e){t.tagsVLines[e].visible=!1,t.changeIconLinkState(Ns[e].footIcon,!1)}))}},{key:"setTagShowAll",value:function(e){var t=this;this.footIcons.filter((function(e){return e.visible})).forEach((function(n){var i=n.pano.id;t.tagsVLines[i]?(t.tagsVLines[i].visible=!0,t.changeIconLinkState(Ns[i].footIcon,"linked")):t.createTagSingleLine(Ns[i],"new",e)}))}},{key:"delVisibleLines",value:function(){for(var e in this.tagsVLines)this.tagsVLines[e].geometry.dispose(),this.tagsVLines[e].material.dispose(),this.meshGroup.remove(this.tagsVLines[e]),delete this.tagsVLines[e];for(var e in this.panoVLines)this.panoVLines[e].geometry.dispose(),this.panoVLines[e].material.dispose(),this.meshGroup.remove(this.panoVLines[e]),delete this.panoVLines[e]}},{key:"createPanoVisiLines",value:function(e,t){var n=this.panoVTemp[e.id]&&this.panoVTemp[e.id].neighbourPanos||e.neighbourPanos;for(var i in n)n[i]&&i!=e.id&&!i.includes("view360_")&&this.createPanoSingleLine(e,"old",i)}},{key:"createPanoSingleLine",value:function(e,t,n){var i=Ns[n];if(!i.panoType){var o=i.floorPosition.clone(),r=yi.createLine([e.floorPosition.clone(),o],{color:He.green,deshed:i.floorIndex!=e.floorIndex});this.meshGroup.add(r),r.name="PanoVL-"+t+"-"+n,i.floorIndex!=e.floorIndex&&(r.material.opacity=.5),this.panoVLines[n]=r,this.activePano&&(i.floorIndex!=e.floorIndex?this.changeIconLinkState(Ns[n].footIcon,"otherFloorLink"):this.changeIconLinkState(Ns[n].footIcon,"linked"))}}},{key:"dealPanoVisible",value:function(e,t){var n=this;if(this.setMultiFloorPanoVisible){if(this.linkToFloorPano){var i=this.linkToFloorPano.footIcon;this.changeIconLinkState(i,!1),this.changeFloorIconState(i)||(i.status="visible",i.material.uniforms.map.value=this.linkToFloorPano.hasVideo?this.footTex1_v:this.footTex1)}else this.player.$app.WalkManager.emit("walkManager.multiFloorLinking",!0);this.linkToFloorPano=t.pano,this.changeIconLinkState(t,"center"),"upper"==this.setMultiFloorPanoVisible?(t.status="floor",t.material.uniforms.map.value=this.footTex6):(t.status="floor",t.material.uniforms.map.value=this.footTex5)}else if(t&&"FootIcon"==t.type)this.activePano?e==this.activePano.id?(this.startEditPano||(this.startEditPano=this.activePano),this.player.$app.WalkManager.emit("walkManager.deactive"),this.pauseSetPanoVisible("unsaved"),this.actionIcons.forEach((function(e){return e.material.map="invisible"==e.footIcon.status?n.actionVisiTex0:n.actionVisiTex1})),this.player.$app.gui.toast({event:"DialogList3D.WalkManger.deactive",content:Gs.WalkManger.deactive})):(this.lastFloorActivePano=null,this.pauseSetPanoVisible("unsaved"),this.SetOnePanoVisible(Ns[e]),this.player.$app.WalkManager.emit("walkManager.active",this.checkLinkStatus())):(this.lastFloorActivePano=null,this.SetOnePanoVisible(Ns[e]),this.player.$app.WalkManager.emit("walkManager.active",this.checkLinkStatus()));else if(!t||"ActionIcon"==t.type)if(this.activePano){var o;if(this.panoVLines[e]?(this.panoVLines[e].visible=!this.panoVLines[e].visible,o=this.panoVLines[e].visible,this.changeIconLinkState(Ns[e].footIcon,Ns[e].footIcon.visible?!!this.panoVLines[e].visible&&"linked":"otherFloorLink")):(this.createPanoSingleLine(this.activePano,"new",e),o=!0),this.startEditPano||(this.startEditPano=this.activePano),o)this.changeIconVisiState(Ns[e].footIcon,!0),this.changeIconVisiState(this.activePano.footIcon,!0),t&&"ActionIcon"==t.type&&this.player.$app.WalkManager.emit(this.checkLinkStatus());else{var r=this.player.$app.core.get("Scene").firstView.pano;if(Ns[e].floorIndex!=this.activePano.floorIndex)Ns[e].footIcon.visible=!1;else{var a=this.checkHasNeighbor(Ns[e]);this.changeIconVisiState(Ns[e].footIcon,a)}var s=this.checkHasNeighbor(this.activePano);if(this.changeIconVisiState(this.activePano.footIcon,s),t&&"ActionIcon"==t.type){if(this.player.$app.WalkManager.emit(this.checkLinkStatus()),!s&&this.activePano==r)return this.player.$app.gui.toast({event:"DialogList3D.WalkManger.firstPointLimit",content:Gs.WalkManger.firstPointLimit}),void this.dealPanoVisible(e,t);s||this.player.$app.gui.toast({event:"DialogList3D.WalkManger.hide",content:Gs.WalkManger.hide})}}}else{if("invisible"==t.footIcon.status){if(this.panoVTemp[e]){var l=Object.keys(this.panoVTemp[e].neighbourPanos).filter((function(t){return!t.includes("view360_")&&t!=e})),c=l.filter((function(e){return n.checkHasNeighbor(Ns[e])}));l=c.length?c:l.slice(0,1);var u=[];l.forEach((function(e){u.push({type:"add",id:e})})),this.savePanoVisiChange(e,u)}else{var h=pt.getVisiblePano(Ns[e].position,this.player.model).map((function(e){return e.id})).filter((function(t){return t!=e}));if(0==h.length){var d=De.sortByScore(Us,[function(e){return e.isAligned()}],[function(t){return-t.position.distanceTo(Ns[e].position)}]),p=d.map((function(e){return e.item})).find((function(e){return n.checkHasNeighbor(e)}));h=p?[p.id]:[d[0].item.id]}else{var f=h.filter((function(e){return n.checkHasNeighbor(Ns[e])}));h=f.length?f:h.slice(0,1)}var m=[];h.forEach((function(e){return m.push({type:"add",id:e})})),this.savePanoVisiChange(e,m)}this.player.$app.gui.toast({event:"DialogList3D.WalkManger.show",content:Gs.WalkManger.show})}else{if(this.player.$app.core.get("Scene").firstView.pano.footIcon==t.footIcon)return this.player.$app.gui.toast({event:"DialogList3D.WalkManger.firstPointLimit",content:Gs.WalkManger.firstPointLimit}),!1;this.createPanoVisiLines(Ns[e],!0),Object.values(this.panoVLines).forEach((function(e){e.visible=!1})),this.player.$app.gui.toast({event:"DialogList3D.WalkManger.hide",content:Gs.WalkManger.hide}),this.saveLastPanoVi(Ns[e]),this.delVisibleLines()}Us.forEach((function(e){return n.changeIconVisiState(e.footIcon,n.checkHasNeighbor(e))}))}this.updateFootIconSize()}},{key:"showFootIcons",value:function(e,t,n){var i=this;if(!this.footIcons){this.footIcons=[],this.actionIcons=[];var o=.4;o*=40/Math.sqrt(Math.min(this.player.domElement.clientWidth,this.player.domElement.clientHeight)),o=THREE.MathUtils.clamp(o,.3,.7);var r=new THREE.PlaneGeometry(o,o,1,1),a=r.clone();a.scale(.5,.5,.5),Us.forEach((function(e){var t=new qs(r,e);t.material.uniforms.map.value=e.hasVideo?i.footTex1_v:i.footTex1,t.visible=!1,e.footIcon=t;var n=new Js(t,a,e);n.material.map=i.actionLinkTex0,t.actionIcon=n,i.meshGroup.add(t),t.add(n),i.footIcons.push(t),i.actionIcons.push(n)}))}n=n||this.player.model.currentFloor,Us.forEach((function(o){if(o.label.parent!=o.footIcon){o.label._oriScale=o.label.scale.x;var r=1.65*o.label.scale.x;o.label.scale.set(r,r,r),o.footIcon.add(o.label),o.footIcon.label=o.label}if(o.floor==n)o.footIcon.visible=!0,i.changeIconLinkState(o.footIcon,!1),t&&i.changeIconVisiState(o.footIcon,i.checkHasNeighbor(Ns[o.id],"beforeCreateLine")),e&&o==e?(o.footIcon.oriScale=new THREE.Vector3(1.5,1.5,1.5),t&&i.changeIconLinkState(o.footIcon,"center")):(o.footIcon.oriScale=new THREE.Vector3(1,1,1),o.footIcon.actionIcon.visible=!0);else{var a=(i.panoVTemp&&i.panoVTemp[o.id]?i.panoVTemp[o.id].neighbourUUIDs:o.neighbourUUIDs).filter((function(t){return e&&t==e.id}));o.footIcon.oriScale=new THREE.Vector3(1,1,1),a.length>0?(t&&i.changeFloorIconState(o.footIcon),i.changeIconLinkState(o.footIcon,"otherFloorLink")):o.footIcon.visible=!1}}))}},{key:"checkHasNeighbor",value:function(e,t){var n=this.panoVTemp&&this.panoVTemp[e.id]?this.panoVTemp[e.id].neighbourPanos:e.neighbourPanos;if("beforeCreateLine"==t||e!=this.activePano){for(var i in n)if(i!=e.id&&!isNaN(parseInt(i))&&n[i]){if(this.activePano&&this.activePano.id==i&&this.panoVLines[e.id]&&!this.panoVLines[e.id].visible)continue;if(this.activePano==e&&this.panoVLines[i]&&!this.panoVLines[i].visible)continue;return!0}return!1}for(var i in this.panoVLines)if(this.panoVLines[i].visible)return!0}},{key:"getCurNeighbors",value:function(e){var t=this.panoVTemp&&this.panoVTemp[e.id]?this.panoVTemp[e.id].neighbourPanos:e.neighbourPanos,n=[];for(var i in t)if(i!=e.id&&!isNaN(parseInt(i))&&t[i]){if(this.activePano&&this.activePano.id==i&&this.panoVLines[e.id]&&!this.panoVLines[e.id].visible)continue;if(this.activePano==e&&this.panoVLines[i]&&!this.panoVLines[i].visible)continue;n.push(i)}return n}},{key:"ifAllPanoNoNeighbor",value:function(){for(var e in Ns)if(Ns[e].isAligned()&&this.checkHasNeighbor(Ns[e]))return!1;return this.noPanoHasNeighbor=!0,!0}},{key:"changeIconLinkState",value:function(e,t){if(e){var n;e.otherFloorLink=!1,"linked"==t&&(n=He.green,e.actionIcon.material.map=this.actionLinkTex1),"otherFloorLink"==t&&(n=He.yellow,e.actionIcon.visible=!1,e.material.uniforms.opacity.value=.5,e.label.sprite.material.opacity=.5,e.visible=!0,e.otherFloorLink=!0),"center"==t&&(n=He.yellow,e.actionIcon.visible=!1),0==t&&(n="#fff",e.actionIcon.material.map=this.actionLinkTex0);try{e.material.uniforms.color.value.set(n),e.label.sprite.material.color.set(n)}catch(e){console.log(e)}}}},{key:"checkLinkStatus",value:function(){this.checkFloorLinkStatus();var e=Object.values(this.panoVLines).filter((function(e){return e.visible}));return this.footIcons.filter((function(e){return e.visible})).length==e.length+1?"walkManager.linkAll":0==e.length?"walkManager.linkNone":"walkManager.linkSome"}},{key:"changeIconVisiState",value:function(e,t){e&&(e.pano==this.player.$app.core.get("Scene").firstView.pano&&(t=!0),t?(e.status="visible",e.material.uniforms.map.value=e.pano.hasVideo?this.footTex1_v:this.footTex1,this.activePano||(e.actionIcon.material.map=this.actionVisiTex1),e.otherFloorLink||(e.material.uniforms.opacity.value=1,e.label.sprite.material.opacity=1),this.changeFloorIconState(e)):(e.status="invisible",e.material.uniforms.map.value=e.pano.hasVideo?this.footTex2_v:this.footTex2,this.activePano||(e.actionIcon.material.map=this.actionVisiTex0),this.activePano&&this.activePano.id==e.name?(e.material.uniforms.opacity.value=1,e.label.sprite.material.opacity=1,this.player.$app.gui.toast({event:"DialogList3D.WalkManger.activeHidePoint",content:Gs.WalkManger.activeHidePoint})):(e.material.uniforms.opacity.value=.5,e.label.sprite.material.opacity=.5)))}},{key:"changeFloorIconState",value:function(e){var t=this;if(e){var n=Ns[e.name],i=(this.panoVTemp&&this.panoVTemp[n.id]?this.panoVTemp[n.id].neighbourUUIDs:n.neighbourUUIDs).filter((function(e){return Ns[e].floorIndex!=n.floorIndex&&(!t.activePano||!t.panoVLines[e]||t.panoVLines[e].visible)})).map((function(e){return Ns[e].floor}));return!!i.length&&(this.getFloorOrder(i[0])>this.getFloorOrder(n.floor)?(e.status="floor",e.material.uniforms.map.value=this.footTex5):this.getFloorOrder(i[0])<this.getFloorOrder(n.floor)&&(e.status="floor",e.material.uniforms.map.value=this.footTex6),!0)}}},{key:"getClosestOtherFloorPano",value:function(e,t){return this.player.model.panos.closestPanoTowardPoint({point:e.position,getAll:!0}).map((function(e){return e.pano})).filter((function(n){return"up"==t?n.floorIndex>e.floorIndex:n.floorIndex<e.floorIndex}))[0]}},{key:"checkFloorLinkStatus",value:function(){var e=this,t="walkManager.unlinkFloor",n=(this.panoVTemp[this.activePano.id]&&this.panoVTemp[this.activePano.id].neighbourUUIDs||Ns[this.activePano.id].neighbourUUIDs).map((function(e){return Ns[e]})).filter((function(t){return t.floorIndex!=e.activePano.floorIndex&&(!e.activePano||!e.panoVLines[t.id]||e.panoVLines[t.id].visible)}))[0];n&&this.getFloorOrder(n.floor)>this.getFloorOrder(this.activePano.floor)&&(t="walkManager.linkUpperFloor"),n&&this.getFloorOrder(n.floor)<this.getFloorOrder(this.activePano.floor)&&(t="walkManager.linkLowerFloor"),this.player.$app.WalkManager.emit(t)}},{key:"getFloorOrder",value:function(e){return this.player.$app.store.getValue("flooruser").floors.find((function(t){return t.subgroup==e.floorIndex})).id}},{key:"getFloor",value:function(e,t){this.player.model.floors.index[e];var n=this.player.$app.store.getValue("flooruser").floors,i=n.find((function(t){return t.subgroup==e})),o="upper"==t?i.id+1:i.id-1,r=n.find((function(e){return e.id==o}));return console.log("getFloor",t,e,r.subgroup),r.subgroup}},{key:"recoverAllState2",value:function(){for(var e=0;e<this.footIcons.length;e++)this.footIcons[e].material.uniforms.opacity.value=1,this.footIcons[e].label.sprite.material.opacity=1,this.footIcons[e].material.uniforms.map.value=this.footIcons[e].pano.hasVideo?this.footTex1_v:this.footTex1}},{key:"hideFootIcons",value:function(){if(this.footIcons)for(var e=0;e<this.footIcons.length;e++)this.footIcons[e].visible=!1,this.footIcons[e].actionIcon.visible=!0}},{key:"updateFootIconSize",value:function(){if(this.footIcons){var e=ge.getScaleForConstantSize({width2d:240,position:new THREE.Vector3,camera:this.player.camera,dom:this.player.$app.dom}),t=this.player;e=THREE.MathUtils.clamp(e,.6,2.5),this.footIcons.forEach((function(n){n.visible&&n.scale.copy(n.oriScale).multiplyScalar(e),n.quaternion.copy(t.quaternion)}))}}},{key:"resetTagVisiByModel",value:function(){var e=[];for(var t in objects.tagManager.tags){var n=objects.tagManager.tags[t];if("videoPanoFlag"!=n.state){var i=n.getVisiblePanos();e.push({sid:n.sid,value:i})}}return e}},{key:"afterResetTagVisibles",value:function(e){e.forEach((function(e){objects.tagManager.tags[e.sid].setVisiblePanos(e.value)})),"panorama"==objects.player.mode&&objects.tagManager.updateVisible("panorama")}},{key:"resetVisiblesByModel",value:function(){this.resetTagVisiByModel()}},{key:"gotoFloor",value:function(e){var t=this;if(this.player.model.currentFloor.floorIndex==e){var n=this.player.model.floors.index[e];if(this.activePano&&(this.lastFloorActivePano=this.activePano),this.setTagVisible){if(this.tagVsetting)for(var i in this.hideFootIcons(),this.showFootIcons(),this.tagsVLines)Ns[i].floor.floorIndex==this.player.model.currentFloor.floorIndex&&this.tagsVLines[i].visible?(this.tagsVLines[i].material.opacity=1,this.changeIconLinkState(Ns[i].footIcon,"linked")):this.tagsVLines[i].material.opacity=.4}else this.setPanoVisible&&(this.pauseSetPanoVisible("unsaved",n),setTimeout((function(){t.lastFloorActivePano&&t.lastFloorActivePano.floorIndex==e?(t.SetOnePanoVisible(t.lastFloorActivePano),t.player.$app.WalkManager.emit("walkManager.active",t.checkLinkStatus())):t.player.$app.WalkManager.emit("walkManager.deactive")}),1));this.focusFloor(n)}}},{key:"focusFloor",value:function(e){var t=(e=e||this.player.model.currentFloor).boundingBox.clone();this.setTagVisible&&this.player.$app.TagManager.tags.forEach((function(n){n.floorIndex==e.floorIndex&&t.expandByPoint(n.position)}));var n=t.getCenter(new THREE.Vector3),i=t.getSize(new THREE.Vector3);this.player.focusPoint({modelSize:i,aim:n})}}]),e}(),qs=function(e){f(n,THREE.Mesh);var t=js(n);function n(e,i){var r;return o(this,n),(r=t.call(this)).geometry=e,r.material=new THREE.RawShaderMaterial({vertexShader:mn.waypoint.vertexShader,fragmentShader:mn.waypoint.fragmentShader,uniforms:THREE.UniformsUtils.clone(mn.waypoint.uniforms),transparent:!0,depthWrite:!1,depthTest:!1,name:"footIcon"}),r.material.uniforms.color.value.set("#ffffff"),r.renderOrder=We,r.type="FootIcon",r.name=i.id,r.pano=i,r.status="",r.position.copy(i.floorPosition.clone()),r.position.y/=100,r.lookAt(r.position.clone().add(new THREE.Vector3(0,1,0))),r}return n}(),Js=function(e){f(n,THREE.Mesh);var t=js(n);function n(e,i,r){var a;return o(this,n),(a=t.call(this)).geometry=i,a.material=new THREE.MeshPhongMaterial({transparent:!0,depthTest:!1,name:"footIcon"}),a.footIcon=e,a.renderOrder=We+1,a.type="ActionIcon",a.name=r.id,a.pano=r,a.position.set(.2,.2,1),a}return n}();function Ys(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}var Zs=function(e){f(n,THREE.EventDispatcher);var t=Ys(n);function n(e,i){var r;return o(this,n),(r=t.call(this)).player=e,r.position=i.pos,r.sid=i.sid,r.text=i.text||"",r.toPano=i.toPano,r.clickFun=i.clickFun,r.noLine=i.noLine,r.driftDir=i.driftDir,r.floorIndex=i.floorIndex,r.elem=document.createElement("div"),r.elem.className="room-label",r.elem.style.display="none",r.elem.innerHTML="<a><p><span>".concat(r.text,"</span></p></a>"),i.container?i.container.append(r.elem):document.querySelector(".widgets-doll-labels").append(r.elem),r.player.dollLabels.push(h(r)),r.elem.addEventListener("click",r.clickFuc.bind(h(r))),r.enable=!0,r.type="doll",r.pos2d=new THREE.Vector3,r.noLine&&(r.elem.className+=" noLine"),r.visible=!0,e.on("beginShowMonitor",(function(){De.updateVisible(h(r),"showMonitor",!1)})),e.on("leavedShowMonitor",(function(){De.updateVisible(h(r),"showMonitor",!0)})),r}return u(n,[{key:"changeText",value:function(e){this.elem.querySelector("span").innerHTML=this.text=e}},{key:"update",value:function(){if("dollhouse"!==this.player.mode||!this.enable||!this.visible||!this.text||this.player.model.currentFloor.floorIndex!=this.floorIndex&&!this.player.model.allFloorsVisible||this.player.EditOverlay&&this.player.EditOverlay.editing||this.player.linkEditor&&(this.player.linkEditor.setPanoVisible||this.player.linkEditor.setTagVisible))this.elem.style.display="none";else{var e=pt.getPos2d(this.position,this.player);if(e.trueSide)if(pt.ifShelter(this.position,this.player,{x:e.vector.x,y:e.vector.y},null,this.player.model.allFloorsVisible?null:this.floorIndex))this.elem.style.display="none";else{if(this.elem.style.display="",this.driftDir){var t=pt.getPos2d(this.position.clone().add(this.driftDir),this.player),n=this.elem.children[0].getBoundingClientRect(),i=ge.getCrossPointAtRect(t.pos,e.pos,n.width,n.height,e.pos.x-n.width/2,e.pos.y-n.height/2).sub(e.pos.clone()),o=100/this.position.distanceTo(this.player.camera.position),r=e.pos.clone().add(i.multiplyScalar((o+i.length())/i.length()));this.elem.style.left=r.x+"px",this.elem.style.top=r.y+"px"}else this.elem.style.left=e.pos.x+"px",this.elem.style.top=e.pos.y+"px";this.pos2d=e.vector}else this.elem.style.display="none"}}},{key:"clickFuc",value:function(){this.toPano?this.player.flyToPano({pano:this.toPano}):this.clickFun&&this.clickFun()}},{key:"remove",value:function(){var e=this.elem.parentElement;e&&e.removeChild(this.elem);var t=this.player.dollLabels.indexOf(this);t>-1&&this.player.dollLabels.splice(t,1)}}]),n}();function Xs(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}var Ks,$s=1.6,el=.2,tl=new THREE.Vector3(0,0,-1),nl=new THREE.MeshStandardMaterial({transparent:!0,color:new THREE.Color(1,1,1),opacity:.45,metalness:1,emissive:new THREE.Color(.85,.85,.85)}),il=nl.clone();il.opacity=.9;var ol=function(e){f(n,THREE.Object3D);var t=Xs(n);function n(e,i){var r;o(this,n),(r=t.call(this)).player=e;var a=r.createArrow();r.add(a),a.oriPosition=a.position.clone();for(var s=1;s<4;s++){var l=a.clone();l.position.setZ(1.8*s),l.oriPosition=l.position.clone(),r.add(l)}return r.name="entryArrow",e.model.add(h(r)),r.scale.set(el,el,el),r.setPosition(i),r.currentHighLight=0,r.traverse((function(e){e.renderOrder=et})),console.log("create entryArrow"),r}return u(n,[{key:"createArrow",value:function(){if(!Ks){var e=[{x:0,y:0},{x:1,y:.8},{x:1,y:$s},{x:0,y:.8},{x:-1,y:$s},{x:-1,y:.8}],t=new THREE.Shape;t.moveTo(e[0].x,e[0].y);for(var n=1,i=e.length;n<i;n++)t.lineTo(e[n].x,e[n].y);t.lineTo(e[0].x,e[0].y),Ks=new THREE.ExtrudeBufferGeometry(t,{depth:.4,bevelEnabled:!1})}var o=new THREE.Mesh(Ks,nl);return o.rotation.x=Math.PI/2,o}},{key:"setPosition",value:function(e){var t=new THREE.Vector3(e.points2d[0].x,e.bottom+.4*el,-e.points2d[0].y),n=new THREE.Vector3(e.points2d[1].x,e.bottom+.4*el,-e.points2d[1].y),i=t.clone().add(n).multiplyScalar(.5),o=t.clone().sub(n).normalize(),r=new THREE.Matrix4;r.set(0,0,1,0,0,1,0,0,-1,0,0,0,0,0,0,1),o.applyMatrix4(r);var a="LEFT"==e.openSide?o.multiplyScalar(-1):o;"reverse"==e.enter&&(i.add(a.clone().multiplyScalar(t.distanceTo(n))),a.multiplyScalar(-1)),this.enterDir=a,this.position.copy(i);var s=ge.getQuaBetween2Vector(tl,a,new THREE.Vector3(0,1,0));this.quaternion.copy(s),this.addLabel(i,a,e.floorIndex),this.entryPos=i}},{key:"addLabel",value:function(e,t,n){var i=this.player.model.panos.closestPanoTowardPoint({point:e});i||console.error("what!!! no closetPano");this.dollLabelOriPos=e.clone().sub(t.clone().multiplyScalar(1.4000000000000001));var o=new Zs(this.player,{sid:"entry",pos:this.dollLabelOriPos,driftDir:t,noLine:!0,text:W.i18n("model.enter"),toPano:i,floorIndex:n});this.player.defaultRoomLabels.push(o),this.dollLabel=o}},{key:"moveCloseToWall",value:function(e){this.children.forEach((function(t){t.position.z=t.oriPosition.z+e})),this.dollLabel.position=this.dollLabelOriPos.clone().sub(this.enterDir.clone().multiplyScalar(e*el))}},{key:"reSetHeight",value:function(e){this.position.setY(e),this.dollLabel.position.y=e,this.dollLabelOriPos.y=e}},{key:"animate",value:function(){var e=this;this.children.forEach((function(t,n){n==e.currentHighLight?t.material=il:t.material=nl})),this.currentHighLight=(this.currentHighLight-1+this.children.length)%this.children.length,this.stopAnimation(),this.animation=setTimeout(this.animate.bind(this),200)}},{key:"stopAnimation",value:function(){clearTimeout(this.animation),this.animation=null}},{key:"dispose",value:function(){this.parent.remove(this),this.stopAnimation()}},{key:"show",value:function(){this.visible=!0,this.animate()}},{key:"hide",value:function(){this.visible=!1,this.stopAnimation()}}],[{key:"switchDepthTest",value:function(e){nl.depthTest=e,il.depthTest=e}}]),n}(),rl={forward:new THREE.Vector3(0,0,-1),back:new THREE.Vector3(0,0,1),left:new THREE.Vector3(-1,0,0),right:new THREE.Vector3(1,0,0)},al=function(){function e(t,n){o(this,e),this.player=t,this.position=n.pos,this.text=n.text||"",this.aim=n.aim,this.toPano=n.toPano,this.door=n.door,this.visiblePanos=n.visiblePanos,this.sameRoomPanos=n.sameRoomPanos,this.doorDir=n.doorDir,this.floorIndex=n.floorIndex,this.enable=null==n.enable||n.enable,this.elem=document.createElement("div"),this.elem.className="door show-arrow",this.elem.style.display="none",this.elem.innerHTML="<a>".concat(this.text,"</a>"),n.container?n.container.append(this.elem):document.querySelector(".widgets-doors").append(this.elem),this.player.doorLabels.push(this),this.elem.addEventListener("pointerup",this.clickFuc.bind(this)),this.type="door",this.pos2d=new THREE.Vector3,this.getDirection(),this.updateVisible()}return u(e,[{key:"updateVisible",value:function(e){e?this.sameRoomPanos.includes(e)||(this.enable=!1):this.visiblePanos.includes(this.player.currentPano)?this.enable=!0:this.enable=!1}},{key:"update",value:function(){if("panorama"!==this.player.mode||!this.enable||!this.text||at.vrEnabled&&at.vrSplitScreen||this.player.linkEditor&&(this.player.linkEditor.setPanoVisible||this.player.linkEditor.setTagVisible))this.elem.style.display="none";else{var e=pt.getPos2d(this.position,this.player);e.trueSide?(this.elem.style.left=e.pos.x+"px",this.elem.style.top=e.pos.y+"px",at.vrEnabled?this.elem.style.transform="rotate("+window.screenFaceOrient+"deg)":this.elem.style.transform="",this.elem.style.display="",this.pos2d=e.vector):this.elem.style.display="none"}}},{key:"getDirection",value:function(){var t=e.getToward(this.doorDir);this.elem.className+=" "+t}},{key:"clickFuc",value:function(e){this.toPano?(e.stopPropagation(),this.player.flyToPano({pano:this.toPano,lookAtPoint:this.aim.clone().setY(this.toPano.position.y),duration:1800})):console.error("doorlabel没有toPano")}},{key:"remove",value:function(){this.elem.parentElement.removeChild(this.elem);var e=this.player.doorLabels.indexOf(this);e>-1&&this.player.doorLabels.splice(e,1)}}],[{key:"getToward",value:function(e){for(var t in rl){var n=rl[t].clone().dot(e.setY(0).normalize());if(Math.acos(n)<Math.PI/4)return t}console.warn("没有找到朝向..")}},{key:"updateCameraDir",value:function(t){if("panorama"==t.mode&&0!=t.doorLabels.length){var n=t.getDirection(),i=e.getToward(n);document.querySelector(".widgets-doors").setAttribute("data-camera-toward",i)}}}]),e}();U('#compass {\n display: none;\n position: absolute;\n width: 90px;\n height: 90px;\n pointer-events: none;\n}\n\n#compass .north {\n color: #02a0e9;\n top: 0;\n}\n#compass .south {\n color: #ff1414;\n bottom: 0;\n}\n\n#compass .dirText {\n text-align: center;\n font-size: 10px;\n position: absolute;\n line-height: 25px;\n\n color: rgb(255, 255, 255);\n top: 50%;\n left: 50%;\n width: 45%;\n height: 0px;\n transform-origin: left center;\n}\n\n#compass #dirTextX {\n color: rgb(255, 0, 0);\n}\n\n#compass #dirTextY {\n color: rgb(0, 255, 0);\n}\n\n#compass #dirTextZ {\n color: rgb(0, 0, 255);\n}\n\n#compass .dirText span {\n display: block;\n position: absolute;\n right: 5px;\n top: 0;\n width: 20px;\n height: 20px;\n line-height: 20px;\n margin-top: -10px;\n}\n\n#compass .center {\n width: 50px;\n height: 50px;\n background-size: contain;\n background-position: center;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n position: absolute;\n}\n#compass .center canvas{\n position: relative;\n left: 0;\n top: 0;\n width: 100%;\n height: 100%;\n display: block;\n background-color: transparent;\n}\n\n.widgets-doll-labels a, .widgets-plan-labels a, .widgets-doors a {\n color: #fff;\n font-size: 14px;\n line-height: normal;\n font-family: OpenSans,sans-serif;\n user-select: none;\n}\n\n.widgets-doll-labels .room-label {\n position: absolute;\n width: 0;\n height: 0;\n -webkit-transform: translateZ(0);\n transform: translateZ(0);\n -webkit-animation: room-label 0.3s ease 0.1s;\n animation: room-label 0.3s ease 0.1s;\n -webkit-animation-fill-mode: both;\n animation-fill-mode: both;\n cursor: pointer;\n}\n\n.widgets-doll-labels .room-label:not(.noLine):after {\n content: "";\n display: block;\n position: absolute;\n width: 4px;\n height: 68px;\n background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAABQCAYAAADYxx/bAAAASElEQVQYlY2QwQoAIAhDR///x6Z2CCaGSpfHNoegcHdfAGwBCKVUMdAMK7IKm2Wh2oSOdkaUhVbG3u++x7aqPbX9lWVEdn9/AGvVUp4wTpLmAAAAAElFTkSuQmCC");\n background-size: contain;\n background-repeat: no-repeat;\n bottom: 0;\n left: 50%;\n -webkit-transform: translate(-50%);\n transform: translate(-50%);\n}\n.widgets-doll-labels .room-label a {\n display: block;\n position: absolute;\n line-height: 22px;\n top: -66px;\n transform: translate(-50%, -100%);\n text-align: center;\n white-space: nowrap;\n font-size: 12px;\n font-style: normal;\n pointer-events: auto;\n \n background-repeat: no-repeat;\n background-size: 100% 100%;\n background: rgba(210, 210, 210, 0.7);\n border: 1px solid rgba(255, 255, 255, 0.4);\n border-radius: 3px; \n text-shadow: 0px 1px 3px rgb(0,0, 0, 0.5);\n}\n .widgets-doll-labels .room-label a::before {\n content: "";\n position: absolute;\n left: -1px;\n top: -1px;\n width: 10px;\n height: 10px;\n background-image: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHN2ZyB3aWR0aD0iNnB4IiBoZWlnaHQ9IjZweCIgdmlld0JveD0iMCAwIDYgNiIgdmVyc2lvbj0iMS4xIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIj4KICAgIDx0aXRsZT5tYXBfY29ybmVyICA8L3RpdGxlPgogICAgPGcgaWQ9Iumhtemdoi0xIiBzdHJva2U9Im5vbmUiIHN0cm9rZS13aWR0aD0iMyIgZmlsbD0ibm9uZSIgZmlsbC1ydWxlPSJldmVub2RkIj4KICAgICAgICA8ZyBpZD0i5bGV56S655WM6Z2iLeS4iee7tCIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoLTU2LjAwMDAwMCwgLTI3MC4wMDAwMDApIiBmaWxsPSIjRkZGRkZGIiBmaWxsLXJ1bGU9Im5vbnplcm8iPgogICAgICAgICAgICA8ZyBpZD0i57yW57uELTE1IiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgzMS4wMDAwMDAsIDI3MC4wMDAwMDApIj4KICAgICAgICAgICAgICAgIDxnIGlkPSLlvaLnirbnu5PlkIgtKy3lvaLnirbnu5PlkIgt6JKZ54mIIiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgyNS4wMDAwMDAsIDAuMDAwMDAwKSI+CiAgICAgICAgICAgICAgICAgICAgPHBhdGggZD0iTTYsNiBMNSw2IEw1LDIuNzA1IEwzLjMwMSwxIEwwLDEgTDAsMCBMMy43MTUyMjY0MSwwIEw2LDIuMjkzNDQ3OTUgTDYsNiBaIiBpZD0ibWFwX2Nvcm5lci0tIiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgzLjAwMDAwMCwgMy4wMDAwMDApIHNjYWxlKC0xLCAxKSB0cmFuc2xhdGUoLTMuMDAwMDAwLCAtMy4wMDAwMDApICI+PC9wYXRoPgogICAgICAgICAgICAgICAgPC9nPgogICAgICAgICAgICA8L2c+CiAgICAgICAgPC9nPgogICAgPC9nPgo8L3N2Zz4=);\n background-repeat: no-repeat;\n background-position: top left;\n }\n .widgets-doll-labels .room-label a::after {\n content: "";\n position: absolute;\n left: -1px;\n bottom: -1px;\n width: 10px;\n height: 10px;\n background-image: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHN2ZyB3aWR0aD0iNnB4IiBoZWlnaHQ9IjZweCIgdmlld0JveD0iMCAwIDYgNiIgdmVyc2lvbj0iMS4xIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIj4KICAgIDx0aXRsZT5tYXBfY29ybmVyICA8L3RpdGxlPgogICAgPGcgaWQ9Iumhtemdoi0xIiBzdHJva2U9Im5vbmUiIHN0cm9rZS13aWR0aD0iMyIgZmlsbD0ibm9uZSIgZmlsbC1ydWxlPSJldmVub2RkIj4KICAgICAgICA8ZyBpZD0i5bGV56S655WM6Z2iLeS4iee7tCIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoLTU2LjAwMDAwMCwgLTI3MC4wMDAwMDApIiBmaWxsPSIjRkZGRkZGIiBmaWxsLXJ1bGU9Im5vbnplcm8iPgogICAgICAgICAgICA8ZyBpZD0i57yW57uELTE1IiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgzMS4wMDAwMDAsIDI3MC4wMDAwMDApIj4KICAgICAgICAgICAgICAgIDxnIGlkPSLlvaLnirbnu5PlkIgtKy3lvaLnirbnu5PlkIgt6JKZ54mIIiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgyNS4wMDAwMDAsIDAuMDAwMDAwKSI+CiAgICAgICAgICAgICAgICAgICAgPHBhdGggZD0iTTYsNiBMNSw2IEw1LDIuNzA1IEwzLjMwMSwxIEwwLDEgTDAsMCBMMy43MTUyMjY0MSwwIEw2LDIuMjkzNDQ3OTUgTDYsNiBaIiBpZD0ibWFwX2Nvcm5lci0tIiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgzLjAwMDAwMCwgMy4wMDAwMDApIHNjYWxlKC0xLCAxKSB0cmFuc2xhdGUoLTMuMDAwMDAwLCAtMy4wMDAwMDApICI+PC9wYXRoPgogICAgICAgICAgICAgICAgPC9nPgogICAgICAgICAgICA8L2c+CiAgICAgICAgPC9nPgogICAgPC9nPgo8L3N2Zz4=);\n background-repeat: no-repeat;\n background-position: top left;\n transform: rotate(270deg);\n }\n .widgets-doll-labels .room-label a > p {\n margin: 0;\n padding: 2px 10px;\n height: 100%;\n line-height: 1.5;\n }\n .widgets-doll-labels .room-label a > p::before {\n content: "";\n position: absolute;\n right: -1px;\n top: -1px;\n width: 10px;\n height: 10px;\n background-image: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHN2ZyB3aWR0aD0iNnB4IiBoZWlnaHQ9IjZweCIgdmlld0JveD0iMCAwIDYgNiIgdmVyc2lvbj0iMS4xIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIj4KICAgIDx0aXRsZT5tYXBfY29ybmVyICA8L3RpdGxlPgogICAgPGcgaWQ9Iumhtemdoi0xIiBzdHJva2U9Im5vbmUiIHN0cm9rZS13aWR0aD0iMyIgZmlsbD0ibm9uZSIgZmlsbC1ydWxlPSJldmVub2RkIj4KICAgICAgICA8ZyBpZD0i5bGV56S655WM6Z2iLeS4iee7tCIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoLTU2LjAwMDAwMCwgLTI3MC4wMDAwMDApIiBmaWxsPSIjRkZGRkZGIiBmaWxsLXJ1bGU9Im5vbnplcm8iPgogICAgICAgICAgICA8ZyBpZD0i57yW57uELTE1IiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgzMS4wMDAwMDAsIDI3MC4wMDAwMDApIj4KICAgICAgICAgICAgICAgIDxnIGlkPSLlvaLnirbnu5PlkIgtKy3lvaLnirbnu5PlkIgt6JKZ54mIIiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgyNS4wMDAwMDAsIDAuMDAwMDAwKSI+CiAgICAgICAgICAgICAgICAgICAgPHBhdGggZD0iTTYsNiBMNSw2IEw1LDIuNzA1IEwzLjMwMSwxIEwwLDEgTDAsMCBMMy43MTUyMjY0MSwwIEw2LDIuMjkzNDQ3OTUgTDYsNiBaIiBpZD0ibWFwX2Nvcm5lci0tIiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgzLjAwMDAwMCwgMy4wMDAwMDApIHNjYWxlKC0xLCAxKSB0cmFuc2xhdGUoLTMuMDAwMDAwLCAtMy4wMDAwMDApICI+PC9wYXRoPgogICAgICAgICAgICAgICAgPC9nPgogICAgICAgICAgICA8L2c+CiAgICAgICAgPC9nPgogICAgPC9nPgo8L3N2Zz4=);\n background-repeat: no-repeat;\n background-position: top left;\n transform: rotate(90deg);\n }\n .widgets-doll-labels .room-label a > p::after {\n content: "";\n position: absolute;\n right: -1px;\n bottom: -1px;\n width: 10px;\n height: 10px;\n background-image: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHN2ZyB3aWR0aD0iNnB4IiBoZWlnaHQ9IjZweCIgdmlld0JveD0iMCAwIDYgNiIgdmVyc2lvbj0iMS4xIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIj4KICAgIDx0aXRsZT5tYXBfY29ybmVyICA8L3RpdGxlPgogICAgPGcgaWQ9Iumhtemdoi0xIiBzdHJva2U9Im5vbmUiIHN0cm9rZS13aWR0aD0iMyIgZmlsbD0ibm9uZSIgZmlsbC1ydWxlPSJldmVub2RkIj4KICAgICAgICA8ZyBpZD0i5bGV56S655WM6Z2iLeS4iee7tCIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoLTU2LjAwMDAwMCwgLTI3MC4wMDAwMDApIiBmaWxsPSIjRkZGRkZGIiBmaWxsLXJ1bGU9Im5vbnplcm8iPgogICAgICAgICAgICA8ZyBpZD0i57yW57uELTE1IiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgzMS4wMDAwMDAsIDI3MC4wMDAwMDApIj4KICAgICAgICAgICAgICAgIDxnIGlkPSLlvaLnirbnu5PlkIgtKy3lvaLnirbnu5PlkIgt6JKZ54mIIiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgyNS4wMDAwMDAsIDAuMDAwMDAwKSI+CiAgICAgICAgICAgICAgICAgICAgPHBhdGggZD0iTTYsNiBMNSw2IEw1LDIuNzA1IEwzLjMwMSwxIEwwLDEgTDAsMCBMMy43MTUyMjY0MSwwIEw2LDIuMjkzNDQ3OTUgTDYsNiBaIiBpZD0ibWFwX2Nvcm5lci0tIiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgzLjAwMDAwMCwgMy4wMDAwMDApIHNjYWxlKC0xLCAxKSB0cmFuc2xhdGUoLTMuMDAwMDAwLCAtMy4wMDAwMDApICI+PC9wYXRoPgogICAgICAgICAgICAgICAgPC9nPgogICAgICAgICAgICA8L2c+CiAgICAgICAgPC9nPgogICAgPC9nPgo8L3N2Zz4=);\n background-repeat: no-repeat;\n background-position: top left;\n transform: rotate(180deg);\n }\n\n.widgets-doll-labels .room-label.noLine a {\n top: 16px;\n}\n\n.widgets-doll-labels .room-label a span {\n white-space: nowrap;\n user-select: none;\n}\n\n.widgets-doll-labels .room-label.with-entrance:after {\n display: none;\n}\n\n.widgets-doll-labels .room-label.with-entrance a {\n top: 50%;\n width: 38.5px;\n height: 15.75px;\n background-size: 38.5px 15.75px;\n -webkit-transform: translate(-50%, -50%);\n transform: translate(-50%, -50%);\n}\n\n.widgets-doll-labels .room-label.with-entrance a span {\n margin-left: -0.875px;\n margin-top: -0.875px;\n}\n\n.widgets-plan-labels .room-label {\n position: absolute;\n -webkit-animation: room-label 0.3s ease 0.1s;\n animation: room-label 0.3s ease 0.1s;\n -webkit-animation-fill-mode: both;\n animation-fill-mode: both;\n}\n\n.widgets-plan-labels .room-label a {\n display: block;\n position: absolute;\n line-height: 24px;\n -webkit-transform: translate(-50%);\n transform: translate(-50%, -50%);\n text-align: center;\n white-space: nowrap;\n font-size: 14px;\n font-style: normal;\n}\n\n.widgets-doors {\n position: absolute;\n pointer-events: none;\n top: 0;\n left: 0;\n bottom: 0;\n right: 0;\n}\n\n.widgets-doors[data-camera-toward=right] .door.show-arrow.right a:before,\n.widgets-doors[data-camera-toward=forward] .door.show-arrow.right a:before {\n margin-right: 3.5px;\n -webkit-transform: rotate(180deg);\n transform: rotate(180deg);\n}\n\n.widgets-doors[data-camera-toward=right] .door.show-arrow.right a:before,\n.widgets-doors[data-camera-toward=forward] .door.show-arrow.forward a:before,\n.widgets-doors[data-camera-toward=forward] .door.show-arrow.left a:after,\n.widgets-doors[data-camera-toward=forward] .door.show-arrow.right a:before {\n content: "";\n position: relative;\n display: inline-block;\n width: 10.5px;\n height: 10.5px;\n background: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxNCIgaGVpZ2h0PSIxMCIgdmlld0JveD0iMCAwIDE0IDEwIj4KICA8ZyBpZD0iaW1nX2Fycm93IiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgtNzIxIC01OTMpIj4KICAgIDxwYXRoIGlkPSLot6/lvoRfMTQ0NSIgZGF0YS1uYW1lPSLot6/lvoQgMTQ0NSIgZD0iTTUyNS41OCw1MTAuNzczbC00LjczOC00LjU4OGEuNjIyLjYyMiwwLDAsMC0uNDM0LS4xNzNINTE3LjdhLjYyNS42MjUsMCwwLDEsLjQzNS4xNzNsNC43MzgsNC41ODhhLjM3LjM3LDAsMCwxLDAsLjU0bC00LjczOSw0LjUzMmEuNjIxLjYyMSwwLDAsMS0uNDMyLjE2N2gyLjcxMWEuNjIxLjYyMSwwLDAsMCwuNDMxLS4xNjdsNC43MzktNC41MzJBLjM3LjM3LDAsMCwwLDUyNS41OCw1MTAuNzczWiIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMjA5LjMwMyA4Ni45ODkpIiBmaWxsPSIjZmZmIi8+CiAgICA8cGF0aCBpZD0i6Lev5b6EXzE0NDYiIGRhdGEtbmFtZT0i6Lev5b6EIDE0NDYiIGQ9Ik01MjUuNTgsNTEwLjc3M2wtNC43MzgtNC41ODhhLjYyMi42MjIsMCwwLDAtLjQzNC0uMTczSDUxNy43YS42MjUuNjI1LDAsMCwxLC40MzUuMTczbDQuNzM4LDQuNTg4YS4zNy4zNywwLDAsMSwwLC41NGwtNC43MzksNC41MzJhLjYyMS42MjEsMCwwLDEtLjQzMi4xNjdoMi43MTFhLjYyMS42MjEsMCwwLDAsLjQzMS0uMTY3bDQuNzM5LTQuNTMyQS4zNy4zNywwLDAsMCw1MjUuNTgsNTEwLjc3M1oiIHRyYW5zZm9ybT0idHJhbnNsYXRlKDIwMy4zMDMgODYuOTg5KSIgZmlsbD0iI2ZmZiIgb3BhY2l0eT0iMC41Ii8+CiAgPC9nPgo8L3N2Zz4K) no-repeat 50%;\n background-size: 100% 100%;\n vertical-align: middle;\n}\n\n.widgets-doors[data-camera-toward="forward"] .door.show-arrow.left a:after {\n margin-left: 4px;\n}\n\n.widgets-doors[data-camera-toward="forward"] .door.show-arrow.back a:after,\n.widgets-doors[data-camera-toward="right"] .door.show-arrow.left a:after {\n content: "";\n display: inline-block;\n vertical-align: middle;\n width: 10.5px;\n height: 10.5px;\n background: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxNCIgaGVpZ2h0PSIxMCIgdmlld0JveD0iMCAwIDE0IDEwIj4KICA8ZyBpZD0iaW1nX2Fycm93IiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgtNzIxIC01OTMpIj4KICAgIDxwYXRoIGlkPSLot6/lvoRfMTQ0NSIgZGF0YS1uYW1lPSLot6/lvoQgMTQ0NSIgZD0iTTUyNS41OCw1MTAuNzczbC00LjczOC00LjU4OGEuNjIyLjYyMiwwLDAsMC0uNDM0LS4xNzNINTE3LjdhLjYyNS42MjUsMCwwLDEsLjQzNS4xNzNsNC43MzgsNC41ODhhLjM3LjM3LDAsMCwxLDAsLjU0bC00LjczOSw0LjUzMmEuNjIxLjYyMSwwLDAsMS0uNDMyLjE2N2gyLjcxMWEuNjIxLjYyMSwwLDAsMCwuNDMxLS4xNjdsNC43MzktNC41MzJBLjM3LjM3LDAsMCwwLDUyNS41OCw1MTAuNzczWiIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMjA5LjMwMyA4Ni45ODkpIiBmaWxsPSIjZmZmIi8+CiAgICA8cGF0aCBpZD0i6Lev5b6EXzE0NDYiIGRhdGEtbmFtZT0i6Lev5b6EIDE0NDYiIGQ9Ik01MjUuNTgsNTEwLjc3M2wtNC43MzgtNC41ODhhLjYyMi42MjIsMCwwLDAtLjQzNC0uMTczSDUxNy43YS42MjUuNjI1LDAsMCwxLC40MzUuMTczbDQuNzM4LDQuNTg4YS4zNy4zNywwLDAsMSwwLC41NGwtNC43MzksNC41MzJhLjYyMS42MjEsMCwwLDEtLjQzMi4xNjdoMi43MTFhLjYyMS42MjEsMCwwLDAsLjQzMS0uMTY3bDQuNzM5LTQuNTMyQS4zNy4zNywwLDAsMCw1MjUuNTgsNTEwLjc3M1oiIHRyYW5zZm9ybT0idHJhbnNsYXRlKDIwMy4zMDMgODYuOTg5KSIgZmlsbD0iI2ZmZiIgb3BhY2l0eT0iMC41Ii8+CiAgPC9nPgo8L3N2Zz4K) no-repeat 50%;\n background-size: 100% 100%;\n margin-left: 4px;\n -webkit-transform: rotate(-90deg);\n transform: rotate(-90deg);\n}\n\n.widgets-doors[data-camera-toward=forward] .door.show-arrow.forward a:before ,\n.widgets-doors[data-camera-toward=right] .door.show-arrow.back a:before {\n margin-right: 3.5px;\n -webkit-transform: rotate(180deg);\n transform: rotate(180deg);\n}\n\n.widgets-doors[data-camera-toward="right"] .door.show-arrow.back a:before,\n.widgets-doors[data-camera-toward="right"] .door.show-arrow.forward a:after {\n content: "";\n position: relative;\n display: inline-block;\n width: 10.5px;\n height: 10.5px;\n background: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxNCIgaGVpZ2h0PSIxMCIgdmlld0JveD0iMCAwIDE0IDEwIj4KICA8ZyBpZD0iaW1nX2Fycm93IiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgtNzIxIC01OTMpIj4KICAgIDxwYXRoIGlkPSLot6/lvoRfMTQ0NSIgZGF0YS1uYW1lPSLot6/lvoQgMTQ0NSIgZD0iTTUyNS41OCw1MTAuNzczbC00LjczOC00LjU4OGEuNjIyLjYyMiwwLDAsMC0uNDM0LS4xNzNINTE3LjdhLjYyNS42MjUsMCwwLDEsLjQzNS4xNzNsNC43MzgsNC41ODhhLjM3LjM3LDAsMCwxLDAsLjU0bC00LjczOSw0LjUzMmEuNjIxLjYyMSwwLDAsMS0uNDMyLjE2N2gyLjcxMWEuNjIxLjYyMSwwLDAsMCwuNDMxLS4xNjdsNC43MzktNC41MzJBLjM3LjM3LDAsMCwwLDUyNS41OCw1MTAuNzczWiIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMjA5LjMwMyA4Ni45ODkpIiBmaWxsPSIjZmZmIi8+CiAgICA8cGF0aCBpZD0i6Lev5b6EXzE0NDYiIGRhdGEtbmFtZT0i6Lev5b6EIDE0NDYiIGQ9Ik01MjUuNTgsNTEwLjc3M2wtNC43MzgtNC41ODhhLjYyMi42MjIsMCwwLDAtLjQzNC0uMTczSDUxNy43YS42MjUuNjI1LDAsMCwxLC40MzUuMTczbDQuNzM4LDQuNTg4YS4zNy4zNywwLDAsMSwwLC41NGwtNC43MzksNC41MzJhLjYyMS42MjEsMCwwLDEtLjQzMi4xNjdoMi43MTFhLjYyMS42MjEsMCwwLDAsLjQzMS0uMTY3bDQuNzM5LTQuNTMyQS4zNy4zNywwLDAsMCw1MjUuNTgsNTEwLjc3M1oiIHRyYW5zZm9ybT0idHJhbnNsYXRlKDIwMy4zMDMgODYuOTg5KSIgZmlsbD0iI2ZmZiIgb3BhY2l0eT0iMC41Ii8+CiAgPC9nPgo8L3N2Zz4K) no-repeat 50%;\n background-size: 100% 100%;\n vertical-align: middle;\n}\n\n.widgets-doors[data-camera-toward="right"] .door.show-arrow.forward a:after {\n margin-left: 4px;\n}\n\n.widgets-doors[data-camera-toward="left"] .door.show-arrow.right a:after {\n -webkit-transform: rotate(-90deg);\n transform: rotate(-90deg);\n}\n\n.widgets-doors[data-camera-toward=back] .door.show-arrow.back a:after,\n.widgets-doors[data-camera-toward=left] .door.show-arrow.left a:after,\n.widgets-doors[data-camera-toward=left] .door.show-arrow.back a:after,\n.widgets-doors[data-camera-toward=left] .door.show-arrow.right a:after {\n content: "";\n display: inline-block;\n vertical-align: middle;\n width: 10.5px;\n height: 10.5px;\n background: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxNCIgaGVpZ2h0PSIxMCIgdmlld0JveD0iMCAwIDE0IDEwIj4KICA8ZyBpZD0iaW1nX2Fycm93IiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgtNzIxIC01OTMpIj4KICAgIDxwYXRoIGlkPSLot6/lvoRfMTQ0NSIgZGF0YS1uYW1lPSLot6/lvoQgMTQ0NSIgZD0iTTUyNS41OCw1MTAuNzczbC00LjczOC00LjU4OGEuNjIyLjYyMiwwLDAsMC0uNDM0LS4xNzNINTE3LjdhLjYyNS42MjUsMCwwLDEsLjQzNS4xNzNsNC43MzgsNC41ODhhLjM3LjM3LDAsMCwxLDAsLjU0bC00LjczOSw0LjUzMmEuNjIxLjYyMSwwLDAsMS0uNDMyLjE2N2gyLjcxMWEuNjIxLjYyMSwwLDAsMCwuNDMxLS4xNjdsNC43MzktNC41MzJBLjM3LjM3LDAsMCwwLDUyNS41OCw1MTAuNzczWiIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMjA5LjMwMyA4Ni45ODkpIiBmaWxsPSIjZmZmIi8+CiAgICA8cGF0aCBpZD0i6Lev5b6EXzE0NDYiIGRhdGEtbmFtZT0i6Lev5b6EIDE0NDYiIGQ9Ik01MjUuNTgsNTEwLjc3M2wtNC43MzgtNC41ODhhLjYyMi42MjIsMCwwLDAtLjQzNC0uMTczSDUxNy43YS42MjUuNjI1LDAsMCwxLC40MzUuMTczbDQuNzM4LDQuNTg4YS4zNy4zNywwLDAsMSwwLC41NGwtNC43MzksNC41MzJhLjYyMS42MjEsMCwwLDEtLjQzMi4xNjdoMi43MTFhLjYyMS42MjEsMCwwLDAsLjQzMS0uMTY3bDQuNzM5LTQuNTMyQS4zNy4zNywwLDAsMCw1MjUuNTgsNTEwLjc3M1oiIHRyYW5zZm9ybT0idHJhbnNsYXRlKDIwMy4zMDMgODYuOTg5KSIgZmlsbD0iI2ZmZiIgb3BhY2l0eT0iMC41Ii8+CiAgPC9nPgo8L3N2Zz4K) no-repeat 50%;\n background-size: 100% 100%;\n margin-left: 4px;\n}\n\n.widgets-doors[data-camera-toward="left"] .door.show-arrow.back a:after {\n position: relative;\n}\n\n.widgets-doors[data-camera-toward="left"] .door.show-arrow.forward a:before {\n position: relative;\n margin-right: 3.5px;\n -webkit-transform: rotate(180deg);\n transform: rotate(180deg);\n}\n\n.widgets-doors[data-camera-toward="back"] .door.show-arrow.forward a:after,\n.widgets-doors[data-camera-toward="left"] .door.show-arrow.forward a:before {\n content: "";\n display: inline-block;\n width: 10.5px;\n height: 10.5px;\n background: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxNCIgaGVpZ2h0PSIxMCIgdmlld0JveD0iMCAwIDE0IDEwIj4KICA8ZyBpZD0iaW1nX2Fycm93IiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgtNzIxIC01OTMpIj4KICAgIDxwYXRoIGlkPSLot6/lvoRfMTQ0NSIgZGF0YS1uYW1lPSLot6/lvoQgMTQ0NSIgZD0iTTUyNS41OCw1MTAuNzczbC00LjczOC00LjU4OGEuNjIyLjYyMiwwLDAsMC0uNDM0LS4xNzNINTE3LjdhLjYyNS42MjUsMCwwLDEsLjQzNS4xNzNsNC43MzgsNC41ODhhLjM3LjM3LDAsMCwxLDAsLjU0bC00LjczOSw0LjUzMmEuNjIxLjYyMSwwLDAsMS0uNDMyLjE2N2gyLjcxMWEuNjIxLjYyMSwwLDAsMCwuNDMxLS4xNjdsNC43MzktNC41MzJBLjM3LjM3LDAsMCwwLDUyNS41OCw1MTAuNzczWiIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMjA5LjMwMyA4Ni45ODkpIiBmaWxsPSIjZmZmIi8+CiAgICA8cGF0aCBpZD0i6Lev5b6EXzE0NDYiIGRhdGEtbmFtZT0i6Lev5b6EIDE0NDYiIGQ9Ik01MjUuNTgsNTEwLjc3M2wtNC43MzgtNC41ODhhLjYyMi42MjIsMCwwLDAtLjQzNC0uMTczSDUxNy43YS42MjUuNjI1LDAsMCwxLC40MzUuMTczbDQuNzM4LDQuNTg4YS4zNy4zNywwLDAsMSwwLC41NGwtNC43MzksNC41MzJhLjYyMS42MjEsMCwwLDEtLjQzMi4xNjdoMi43MTFhLjYyMS42MjEsMCwwLDAsLjQzMS0uMTY3bDQuNzM5LTQuNTMyQS4zNy4zNywwLDAsMCw1MjUuNTgsNTEwLjc3M1oiIHRyYW5zZm9ybT0idHJhbnNsYXRlKDIwMy4zMDMgODYuOTg5KSIgZmlsbD0iI2ZmZiIgb3BhY2l0eT0iMC41Ii8+CiAgPC9nPgo8L3N2Zz4K) no-repeat 50%;\n background-size: 100% 100%;\n vertical-align: middle;\n}\n\n.widgets-doors[data-camera-toward="back"] .door.show-arrow.forward a:after {\n margin-left: 4px;\n -webkit-transform: rotate(-90deg);\n transform: rotate(-90deg);\n}\n\n.widgets-doors[data-camera-toward="back"] .door.show-arrow.right a:after {\n margin-left: 4px;\n}\n\n.widgets-doors[data-camera-toward="back"] .door.show-arrow.left a:before,\n.widgets-doors[data-camera-toward="back"] .door.show-arrow.right a:after {\n content: "";\n position: relative;\n display: inline-block;\n width: 10.5px;\n height: 10.5px;\n background: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxNCIgaGVpZ2h0PSIxMCIgdmlld0JveD0iMCAwIDE0IDEwIj4KICA8ZyBpZD0iaW1nX2Fycm93IiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgtNzIxIC01OTMpIj4KICAgIDxwYXRoIGlkPSLot6/lvoRfMTQ0NSIgZGF0YS1uYW1lPSLot6/lvoQgMTQ0NSIgZD0iTTUyNS41OCw1MTAuNzczbC00LjczOC00LjU4OGEuNjIyLjYyMiwwLDAsMC0uNDM0LS4xNzNINTE3LjdhLjYyNS42MjUsMCwwLDEsLjQzNS4xNzNsNC43MzgsNC41ODhhLjM3LjM3LDAsMCwxLDAsLjU0bC00LjczOSw0LjUzMmEuNjIxLjYyMSwwLDAsMS0uNDMyLjE2N2gyLjcxMWEuNjIxLjYyMSwwLDAsMCwuNDMxLS4xNjdsNC43MzktNC41MzJBLjM3LjM3LDAsMCwwLDUyNS41OCw1MTAuNzczWiIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMjA5LjMwMyA4Ni45ODkpIiBmaWxsPSIjZmZmIi8+CiAgICA8cGF0aCBpZD0i6Lev5b6EXzE0NDYiIGRhdGEtbmFtZT0i6Lev5b6EIDE0NDYiIGQ9Ik01MjUuNTgsNTEwLjc3M2wtNC43MzgtNC41ODhhLjYyMi42MjIsMCwwLDAtLjQzNC0uMTczSDUxNy43YS42MjUuNjI1LDAsMCwxLC40MzUuMTczbDQuNzM4LDQuNTg4YS4zNy4zNywwLDAsMSwwLC41NGwtNC43MzksNC41MzJhLjYyMS42MjEsMCwwLDEtLjQzMi4xNjdoMi43MTFhLjYyMS42MjEsMCwwLDAsLjQzMS0uMTY3bDQuNzM5LTQuNTMyQS4zNy4zNywwLDAsMCw1MjUuNTgsNTEwLjc3M1oiIHRyYW5zZm9ybT0idHJhbnNsYXRlKDIwMy4zMDMgODYuOTg5KSIgZmlsbD0iI2ZmZiIgb3BhY2l0eT0iMC41Ii8+CiAgPC9nPgo8L3N2Zz4K) no-repeat 50%;\n background-size: 100% 100%;\n vertical-align: middle;\n}\n\n.widgets-doors[data-camera-toward="back"] .door.show-arrow.left a:before {\n margin-right: 3.5px;\n -webkit-transform: rotate(180deg);\n transform: rotate(180deg);\n}\n\n.widgets-doors .door {\n position: absolute;\n width: 0;\n height: 0;\n /* display: none; */\n -webkit-animation: viewport-door-label 0.3s ease 1s;\n animation: viewport-door-label 0.3s ease 1s;\n -webkit-animation-fill-mode: both;\n animation-fill-mode: both;\n -webkit-transform: translateZ(0);\n transform: translateZ(0);\n cursor: pointer;\n}\n\n.widgets-doors .door a {\n display: block;\n position: absolute;\n top: 50%;\n left: 50%;\n -webkit-transform: translate(-50%, -50%);\n transform: translate(-50%, -50%);\n border-radius: 1.75px;\n background: rgba(0, 0, 0, 0.5);\n line-height: 14px;\n padding: 8px 8px;\n border-radius: 4px;\n white-space: nowrap;\n font-size: 14px;\n font-style: normal;\n pointer-events: auto;\n -webkit-transition: background 0.3s ease, color 0.3s ease, -webkit-transform 1s ease;\n transition: background 0.3s ease, color 0.3s ease, -webkit-transform 1s ease;\n transition: transform 1s ease, background 0.3s ease, color 0.3s ease;\n transition: transform 1s ease, background 0.3s ease, color 0.3s ease, -webkit-transform 1s ease;\n}\n\n.widgets-doors .door a:after {\n -webkit-transition: opacity 0.3s ease;\n transition: opacity 0.3s ease;\n}\n\n.widgets-doors .door a:active {\n background: rgba(0, 0, 0, 0.5);\n color: hsla(0, 0%, 100%, 0.5);\n}\n\n.widgets-doors .door a:active:after {\n opacity: 0.5;\n}\n\n\n.polygonMark-label {\n position: absolute;\n max-width: 340px;\n max-height: 125px;\n min-width: 45px;\n\n -webkit-animation: mark-label 0.3s ease 0.1s;\n animation: mark-label 0.3s ease 0.1s;\n -webkit-animation-fill-mode: both;\n animation-fill-mode: both;\n}\n.polygonMark-label .line{\n width: 100%;\n height: 0px;\n background-color: rgba(255, 255, 255, 0.75);\n box-shadow: 0px 0px 4px 0px rgba(0,0,0,0.5);\n border: 1px solid rgba(255, 255, 255, 0.75);\n\n}\n.polygonMark-label .point{\n position: relative;\n top: -4px;\n left: -8px;\n opacity: 1;\n\n width: 8px;\n height: 8px;\n background-color: #ffffff; \n box-shadow: 0px 0px 4px 0px rgba(0,0,0,0.5);\n border-radius: 100%;\n}\n.polygonMark-label .name {\n margin: 0;\n padding: 0;\n max-width: 320px;\n max-height: 63px;\n min-width: auto;\n\n margin-left: 20px;\n padding-bottom: 2.5px;\n word-break:normal;\n word-break: break-all;\n\n font-family: Microsoft YaHei;\n font-weight: bold;\n font-size: 16px;\n color: #FFFFFF;\n line-height: 19px;\n text-shadow: 0px 0px 4px rgba(0,0,0,0.8);\n text-align: left;\n font-style: normal;\n}\n.polygonMark-label .type{\n margin: 0;\n padding: 0;\n max-width: 320px;\n max-height: 63px;\n min-width: auto;\n\n margin-left: 20px;\n padding-top: 2.5px;\n word-break:normal;\n word-break: break-all;\n\n\n font-family: Microsoft YaHei;\n font-weight: 400;\n font-size: 14px;\n color: #FFFFFF;\n line-height: 16px;\n text-shadow: 0px 0px 4px rgba(0,0,0,0.8);\n text-align: left;\n font-style: normal;\n\n}\n\n@-webkit-keyframes mark-label {\n 0% {\n opacity: 0;\n }\n\n to {\n opacity: 1;\n }\n}\n\n@keyframes mark-label {\n 0% {\n opacity: 0;\n }\n\n to {\n opacity: 1;\n }\n}\n\n\n@-webkit-keyframes room-label {\n 0% {\n opacity: 0;\n margin-top: 8.75px;\n }\n\n to {\n opacity: 1;\n margin-top: 0;\n }\n}\n\n@keyframes room-label {\n 0% {\n opacity: 0;\n margin-top: 8.75px;\n }\n\n to {\n opacity: 1;\n margin-top: 0;\n }\n}\n\n@-webkit-keyframes door-label {\n 0% {\n opacity: 0;\n margin-top: 8.75px;\n }\n\n to {\n opacity: 1;\n margin-top: 0;\n }\n}\n\n@keyframes door-label {\n 0% {\n opacity: 0;\n margin-top: 8.75px;\n }\n\n to {\n opacity: 1;\n margin-top: 0;\n }\n}',{});var sl=function(){function e(t){o(this,e),this.player=t;var n=document.createElement("div");n.className="widgets-doll-labels",t.domElement.append(n);var i=document.createElement("div");i.className="widgets-plan-labels",t.domElement.append(i);var r=document.createElement("div");r.className="widgets-doors",t.domElement.append(r),this.player.$app.store.getValue("flooruser")&&this.init(),this.player.$app.store.on("flooruser",this.init.bind(this))}return u(e,[{key:"init",value:function(){var e=this,t=this.player.$app.store.getValue("flooruser");De.timeMeasuring.addTimeMark("initLabels","start"),this.player.defaultRoomLabels.forEach((function(e){return e.remove()})),this.player.defaultRoomLabels=[],t.floors.forEach((function(n,i){i=e.player.model.floors.list.length>1?null!=n.subgroup?n.subgroup:n.id:i;var o=e.player.model.floors.index[i];if(o){o.entryArrow=[];var r=o.boundingBox.min.y,a=JSON.parse(JSON.stringify(n)),s=JSON.parse(JSON.stringify(e.player.model.center));if(s.z=-1*s.z,a.symbols&&Object.keys(a.symbols).forEach((function(e){var n=a.symbols[e];n.endPoint=ll(n.endPoint,t.angle,s),n.startPoint=ll(n.startPoint,t.angle,s),n.points2d=(n.points2d||[]).map((function(e){return ll(e,t.angle,s)}))})),a.tags&&Object.keys(a.tags).forEach((function(e){var n=a.tags[e];n.center=ll(n.center,t.angle,s),n.points2d=n.points2d.map((function(e){return ll(e,t.angle,s)}))})),a.rooms&&Object.keys(a.rooms).forEach((function(e){var n=a.rooms[e];n.center=ll(n.center,t.angle,s)})),a.points&&Object.keys(a.points).forEach((function(e){var n=a.points[e],i=ll({x:n.x,y:n.y},t.angle,s);n.x=i.x,n.y=i.y})),a.symbols){for(var l,c=Object.keys(a.symbols),u=0;u<c.length;u++)a.symbols[c[u]].enter&&((l=JSON.parse(JSON.stringify(a.symbols[c[u]]))).bottom=r+.1,l.floorIndex=i,o.entryArrow.push(new ol(e.player,l)),e.player.model.currentFloor.floorIndex==i?e.updateEntryVisi(!0,i):e.updateEntryVisi(!1,i));e.moveEntryArrow(i)}a.tags=a.tags||{},e.hasPlaneLabels=a.tags.length>0;var h=o.center.y;Object.keys(a.tags).forEach((function(t){var n=a.tags[t],r=n.des&&parseFloat(String(n.des).replace(",","")).toFixed(2),s=n.title,l=r+n.unit+"<sup>2</sup>",c=n.des?"约"+l:"";if(s||c){var u=s&&c?s+"<br>"+l:s||c,d="floorplan"==e.player.modeTran.split("-")[1]?new THREE.Vector3(0,-1,0):new THREE.Vector3(0,1,0),p=n.center,f=new THREE.Vector3(p.x,-999*d.y,-p.y),m=new THREE.Raycaster(f,d,.001,9999).intersectObject(o.children[0]);m[0]?(f=m[0].point).y+=.5:f.y=h;var v=e.player.model.panos.closestPanoTowardPoint({point:f,floor:o});v||console.error("what!!! no closetPano");var g=new Zs(e.player,{sid:t,pos:f.clone(),text:u,toPano:v,floorIndex:i});e.player.defaultRoomLabels.push(g),e.player.defaultRoomLabels.forEach((function(e){e.update()}))}})),e.initDoorLabels(i,JSON.parse(JSON.stringify(a)))}else ft.warn("floor[".concat(i,"] is empty"))})),this.initedLabel=!0,this.setPlanLabelVisi(),De.timeMeasuring.addTimeMark("initLabels","end",!0)}},{key:"initDoorLabels",value:function(e,t){var n=this,i=[];if(t.rooms&&t.rooms[0]&&t.rooms[0].wallPointIDs){var o=this.player.model.floors.index[e],r=o.boundingBox.min.y;Object.keys(t.tags).forEach((function(e){var n=t.tags[e];n.__panos=[],n.title||delete t.tags[e]}));var a={};Object.keys(t.symbols).forEach((function(e){var n=t.symbols[e];"SingleDoor"!=n.geoType&&"SlideDoor"!=n.geoType&&"DoubleDoor"!=n.geoType||(a[e]=n)})),t.rooms.forEach((function(e,t){e.name="",e.doors=Object.values(a).filter((function(t){return e.wallIds.indexOf(t.parent)>-1}))||[],e.taggings=[],e.panos=[]})),Object.keys(a).forEach((function(e){var n=a[e];n.doorLabels=[],i.push(n),n.center={x:(n.points2d[0].x+n.points2d[1].x)/2,y:(n.points2d[0].y+n.points2d[1].y)/2},n.atRooms=[],t.rooms.forEach((function(e){e.doors.find((function(e){return e.vectorId==n.vectorId}))&&n.atRooms.push(e)}))})),t.rooms.forEach((function(e){e.doors=e.doors.filter((function(e){return e.atRooms}))})),o.panos.forEach((function(e){e._atRoom=null})),t.rooms.forEach((function(e){e.points=e.wallPointIDs.map((function(e){return t.points[e]})),null==e.closetParent&&(o.panos.forEach((function(i){!i._atRoom&&i.isAligned()&&n.searchAtRoom(t,e,i,{x:i.position.x,y:-i.position.z},(function(e){i._atRoom=e,e.panos.push(i)}))})),Object.keys(t.tags).forEach((function(i){var o=t.tags[i];o._atRoom||n.searchAtRoom(t,e,o,{x:o.center.x,y:o.center.y},(function(e){o._atRoom=e,e.taggings.push(o),e.name+=o.title+" "}))}))),e.taggings.length&&e.panos.forEach((function(i){var o=De.sortByScore(e.taggings,[],[function(e){var t=new THREE.Vector2(i.position.x,i.position.z),n=new THREE.Vector2(e.center.x,-e.center.y);return-t.distanceTo(n)}]);o&&o.length&&(o.slice(0,3).find((function(e){var o=e.item,r=new THREE.Vector2(i.position.x,i.position.z),a=new THREE.Vector2(o.center.x,-o.center.y);return!n.isShelter(t,a,r)}))||o[0]).item.__panos.push(i)}))})),Object.keys(t.tags).forEach((function(e){var n=t.tags[e],i=n.__panos.filter((function(e){return e.neighbourUUIDs.length>0}));i.length&&(n.clickToPano=De.sortByScore(i,[],[function(e){var t=new THREE.Vector2(e.position.x,e.position.z),i=new THREE.Vector2(n.center.x,-n.center.y);return-t.distanceTo(i)}])[0].item)})),o.taggingTables=Object.values(t.tags).filter((function(e){return e.clickToPano}));var s="floor".concat(e,"(").concat(t.name||"no name",") 共有").concat(t.rooms.length,"个房间,分别是 ");t.rooms.forEach((function(e){s+="\n房间".concat(e.roomId," : ").concat(e.name," ")})),t.rooms.forEach((function(i){if(0!=i.taggings.length){var a=ge.getArea(i.points)>0;i.doors.forEach((function(s){var l=[];if(i.closetChilds){var c=s.atRooms.find((function(e){return s.startPoint&&s.endPoint}));a=ge.getArea(c.points)>0,c!=i&&(a=!a),l=c.points}else l=i.points;var u=t.walls[s.parent],h=t.points[u.start],d=t.points[u.end],p=n.order(h,d,l),f=ge.getNormal({points:[h,d]}),m=new THREE.Vector3(f.x,0,-f.y);p==a&&m.negate();var v=!1,g=i.panos.filter((function(e){return e.neighbourUUIDs.length>0}));0==g.length&&(v=!0,g=o.panos.filter((function(e){if(0!=e.neighbourUUIDs.length){var t=new THREE.Vector2(s.center.x,-s.center.y),n=new THREE.Vector2(e.position.x,e.position.z);if(!(t.distanceTo(n)>5)){var i=e.position.clone().sub(new THREE.Vector3(s.center.x,0,-s.center.y));return m.angleTo(i)<Math.PI/2||void 0}}})));var y=De.sortByScore(g,[],[function(e){var t=0;if(v){var n=e.position.clone().sub(new THREE.Vector3(s.center.x,0,-s.center.y));t=2*-m.angleTo(n)}var i=new THREE.Vector2(s.center.x,-s.center.y),o=new THREE.Vector2(e.position.x,e.position.z);return-i.distanceTo(o)+t}]);y=y.length?y[0].item:null;var A=De.sortByScore(i.taggings,[],[function(e){var t=y?new THREE.Vector2(y.position.x,y.position.z):new THREE.Vector2(s.center.x,s.center.y),n=new THREE.Vector2(e.center.x,-e.center.y);return-t.distanceTo(n)}])[0].item,E=new THREE.Vector3(s.center.x,r+.3,-s.center.y),b=s.atRooms.find((function(e){return e!=i&&e.name}));b||(b=s.atRooms.find((function(e){return e!=i})));var w=Math.PI/6,x=b?b.panos:n.player.model.panos.list.filter((function(e){return!e._atRoom})),C=x.filter((function(e){var i=e.position.clone().setY(0).distanceTo(E.clone().setY(0));if(!(i<1.5||i>15))return i>4||x.find((function(t){return so.filters.isInFanAngle(E,e.position.clone().sub(E).setY(0),w)(t.position)}))?!n.isShelter(t,E,e.position,s.parent):void 0}));if(C.length){var T=new al(n.player,{doorDir:m,text:A.title,pos:E,visiblePanos:C,sameRoomPanos:x,toPano:y,aim:new THREE.Vector3(A.center.x,0,-A.center.y),floorIndex:e});T.door=s,T.forRoom=i,T.forTag=A,s.doorLabels.push(T),n.player.defaultRoomLabels.push(T)}else console.log("因无visiblePanos取消创建doorlabel的门: ".concat(b?b.name:"(未闭合区域) ","通往 ").concat(A.title," "))}))}})),s+="\n门共有".concat(i.length,"扇: \n"),i.forEach((function(e,t){s+="门".concat(e.vectorId,"在 "),e.atRooms.forEach((function(e){s+="房间".concat(e.roomId,"(").concat(e.name,")、 ")})),s+="的边上 \n"})),console.log("%c".concat(s),"color:#13f"),this.player.doorLabels.forEach((function(e){e.update()})),this.player.updateLabelZIndex(["doorLabels"]),al.updateCameraDir(this.player)}else console.log("没有room or 数据不标准 得不到doorlabels")}},{key:"setPlanLabelVisi",value:function(e,t){if(null==(this.player.$app.store.getValue("metadata")||{}).floorPlanAngle&&this.initedLabel){null==e&&(e=this.player.model.floorplanCadImg.getVisible());var n=this.player.planLabels;null!=t&&(n=n.filter((function(e){return e.floorIndex==t}))),n.forEach((function(t){t.enable=e,t.update()}))}}},{key:"setDoorLabelVisi",value:function(e,t){if(null==(this.player.$app.store.getValue("metadata")||{}).floorPlanAngle&&this.initedLabel){var n=this.player.doorLabels;null!=t&&(n=n.filter((function(e){return e.floorIndex==t}))),n.forEach((function(t){t.enable=e,t.update()}))}}},{key:"setDollLabelVisi",value:function(e,t){if(null==(this.player.$app.store.getValue("metadata")||{}).floorPlanAngle&&this.initedLabel){var n=this.player.dollLabels;null!=t&&(n=n.filter((function(e){return e.floorIndex==t}))),n.forEach((function(t){t.enable=e,t.update()}))}}},{key:"updateEntryVisi",value:function(e,t){var n=this,i=!(this.player.model.floorplanCadImg&&this.player.model.floorplanCadImg.isEdit||this.player.linkEditor&&this.player.linkEditor.setPanoVisible),o=this.player.model.floors;null!=t&&(o=o.filter((function(e){return e.floorIndex==t}))),o.forEach((function(t){if(t.entryArrow.length){if(i)if(0==e)i=!1;else{var o=n.player.modeTran.split("-")[1];i="floorplan"==o||"panorama"!=o&&"dollhouse"==o}t.entryArrow.forEach((function(e){return i?e.show():e.hide()}))}}))}},{key:"moveEntryArrow",value:function(e){var t=this.player.model.floors.index[e];if(t.entryArrow.length&&t.cadImgRatio){var n=24*this.player.model.floors.index[e].cadImgRatio;t.entryArrow.forEach((function(e){return e.moveCloseToWall(n)}))}}},{key:"searchAtRoom",value:function(e,t,n,i,o){var r=this;if(ge.isPointInArea(t.points,i)){if(t.closetChilds)t.closetChilds.find((function(t){return r.searchAtRoom(e,e.rooms.find((function(e){return e.roomId==t})),n,i,o)}))||o(t);else o(t);return!0}}},{key:"order",value:function(e,t,n){var i=n.indexOf(e);return(n.indexOf(t)-i+n.length)%n.length==1}},{key:"isShelter",value:function(e,t,n,i,o){if(e.walls){var r=[new THREE.Vector2(t.x,-t.z),new THREE.Vector2(n.x,-n.z)];return Object.values(e.walls).find((function(t){if(null==i||null==t.vectorId||t.vectorId!==i){var n=[e.points[t.start],e.points[t.end]],a=ge.isLineIntersect(r,n);if(a&&o&&e.symbols)Object.values(e.symbols).find((function(e){if(e.geoType.includes("Door")&&e.parent==t.vectorId){var n=[e.startPoint,e.endPoint];return ge.isLineIntersect(r,n)}}))&&(a=!1);return a}}))}}},{key:"show",value:function(e){this.updateEntryVisi(!0,e),this.setPlanLabelVisi(!0,e),this.setDoorLabelVisi(!0,e),this.setDollLabelVisi(!0,e)}},{key:"hide",value:function(e){this.updateEntryVisi(!1,e),this.setPlanLabelVisi(!1,e),this.setDoorLabelVisi(!1,e),this.setDollLabelVisi(!1,e)}},{key:"reset",value:function(){this.player.defaultRoomLabels.forEach((function(e){return e.remove()})),this.player.model.floors.forEach((function(e){e.entryArrow.forEach((function(e){return e.dispose()}))}))}},{key:"gotoFloor",value:function(e){this.hide(),this.show(e)}}]),e}();function ll(e,t,n){var i=new THREE.Vector2(e.x,e.y);if(Math.abs(t)<.01||Math.abs(t-2*Math.PI)<.01)return i;var o=(i.x-n.x)*Math.cos(t)-(i.y-n.z)*Math.sin(t)+n.x,r=(i.y-n.z)*Math.cos(t)+(i.x-n.x)*Math.sin(t)+n.z;return i.x=o,i.y=r,i}var cl,ul,hl,dl,pl,fl,ml,vl,gl,yl,Al,El,bl,wl={side:null,setSide:function(e){e===THREE.FrontSide||e===THREE.BackSide||e===THREE.DoubleSide?this.side=e:this.side=null}},xl=function e(t){var n=this;o(this,e),this.tempAuto=function(){n.recoverSide=wl.side,wl.setSide(null),n.updateSide()},this.recover=function(){wl.setSide(n.recoverSide),n.recoverSide=null,n.updateSide()},this.updateSide=function(){n.player.mode===xt.FLOORPLAN?n.player.model.setMode("floorplan"):n.player.mode===xt.DOLLHOUSE&&n.player.model.setMode("dollhouse")},this.player=t,this.recoveSide=null},Cl=new THREE.Vector3(0,0,-1),Tl=function(){function e(t){o(this,e),this.angle=0,this.quar=new THREE.Quaternion,this.player=t,this.config=t.$app.config,this.init(),this.show=!1,this.force=!1,this.switch("direction")}return u(e,[{key:"switch",value:function(e){this.type=e,"direction"==e&&(this.dirTextNDiv.style.display="block",this.dirTextXDiv.style.display="none",this.dirTextYDiv.style.display="none",this.dirTextZDiv.style.display="none",this.lines.visible=!1,this.cones.visible=!0),"axis"==e&&(this.dirTextNDiv.style.display="none",this.dirTextXDiv.style.display="block",this.dirTextYDiv.style.display="block",this.dirTextZDiv.style.display="block",this.lines.visible=!0,this.cones.visible=!1),this.autoJudgeDisplay()}},{key:"init",value:function(){var e=this;if(this.dom=document.createElement("div"),this.dom.id="compass",this.dom.innerHTML='\n <div class="dirText north"> <span>N</span> </div>\n\n <div id="dirTextX" class="dirText"> <span>X</span> </div>\n <div id="dirTextY" class="dirText"> <span>Y</span> </div>\n <div id="dirTextZ" class="dirText"> <span>Z</span> </div>\n <div class="center"></div>\n ',this.player.domElement.append(this.dom),this.dirTextNDiv=this.dom.querySelector(".north"),this.dirTextXDiv=this.dom.querySelector("#dirTextX"),this.dirTextYDiv=this.dom.querySelector("#dirTextY"),this.dirTextZDiv=this.dom.querySelector("#dirTextZ"),this.centerDiv=this.dom.querySelector(".center"),this.config.view?(this.dom.style.right=this.config.mobile?"1%":"2%",this.dom.style.top=this.config.mobile?"10%":"4%"):(this.dom.style.right=this.config.mobile?"1%":"277px",this.dom.style.top=this.config.mobile?"10%":"55px"),this.centerDiv.style.width="50px",this.centerDiv.style.height="50px",this.config.mobile){var t=this.player.getSize(),n=t.clientWidth,i=t.clientHeight,o=Math.min(n,i);if(o<450){var r=Math.round(o/450*1e3)/1e3;this.dom.transform=" scale(".concat(r,")")}}try{this.renderer=new THREE.WebGLRenderer({antialias:this.config.antialias,alpha:!0}),this.renderer.autoClear=!0,this.renderer.setPixelRatio(window.devicePixelRatio?window.devicePixelRatio:1),this.renderer.domElement.setAttribute("name","compass"),this.renderer.setClearAlpha(0),this.renderer.setSize(50,50,!1,window.devicePixelRatio?window.devicePixelRatio:1)}catch(e){throw new RendererCreationException("Unable to create a WebGL rendering context")}this.centerDiv.appendChild(this.renderer.domElement),this.camera=new THREE.PerspectiveCamera,this.camera.fov=70,this.scene=new THREE.Scene,this.scene.add(this.camera),this.createCompass(),this.player.$app.store.on("flooruser",(function(e){a()}));var a=function(){var t=e.player.$app.store.getValue("flooruser");if(null!=t.compass)e.angle=(t.compass-THREE.MathUtils.radToDeg(t.angle)+360)%360||0;else{var n=e.player.$app.store.getValue("metadata");null!=n.orientation?e.angle=THREE.MathUtils.radToDeg(n.orientation):e.angle=0}};a()}},{key:"createCompass",value:function(){var e=new THREE.ConeBufferGeometry(.7,2,4,!0),t=new THREE.ConeBufferGeometry(.7,2,4,!0),n=new THREE.MeshBasicMaterial({vertexColors:!0}),i=function(e,t,n){for(var i=[],o=0,r=e.attributes.position.count;o<r;++o)i.push(1,1,1);var a=function(e,t){i[3*e+0]=t[0],i[3*e+1]=t[1],i[3*e+2]=t[2]},s=[(t[0]+n[0])/2,(t[1]+n[1])/2,(t[2]+n[2])/2];a(1,t),a(5,t),a(6,t),a(2,s),a(3,s),a(7,s),a(4,n),a(8,n),a(9,n),e.setAttribute("color",new THREE.BufferAttribute(new Float32Array(i),3))},o=[20/255,146/255,170/255];i(e,[1/255,238/255,245/255],o),i(t,o,[40/255,60/255,103/255]);var r=new THREE.Mesh(e,n);r.position.setY(1),e.computeVertexNormals(),t.computeVertexNormals();var a=new THREE.Object3D;a.add(r);var s=new THREE.Mesh(t,n);s.rotation.x=Math.PI,s.position.setY(-1),a.add(s),a.rotation.z=Math.PI/2,a.rotation.y=Math.PI/2,a.scale.set(.7,.7,.7),this.scene.add(a),this.cones=a;var l=new THREE.Object3D,c=new THREE.Line((new THREE.BufferGeometry).setFromPoints([new THREE.Vector3(0,0,0),new THREE.Vector3(0,0,10)]),new THREE.LineBasicMaterial({color:255}));l.add(c);var u=new THREE.Line((new THREE.BufferGeometry).setFromPoints([new THREE.Vector3(0,0,0),new THREE.Vector3(0,10,0)]),new THREE.LineBasicMaterial({color:65280}));l.add(u);var h=new THREE.Line((new THREE.BufferGeometry).setFromPoints([new THREE.Vector3(0,0,0),new THREE.Vector3(10,0,0)]),new THREE.LineBasicMaterial({color:16711680}));l.add(h),this.lines=l,this.scene.add(l)}},{key:"update",value:function(e){this.show&&(e||(e=this.player.camera.quaternion.clone()),this.cones.rotation.y=Math.PI/2-this.angle/180*Math.PI,this.updateCamera(e),this.updateLabel(e),this.render())}},{key:"updateLabel",value:function(e){var t,n=this.player.getDirection(),i=Cl.clone();if("transitioning"==this.player.mode){var o=new THREE.Camera;o.position.copy(this.camera.position),o.lookAt(o.position.clone().add(n)),t=o.quaternion.invert().premultiply(e)}var r=new THREE.Vector3(0,1,0);t&&r.applyQuaternion(t),n.projectOnPlane(r),i.projectOnPlane(r);var a=n.angleTo(i);n.cross(i).y>0&&(a=-a);var s=this.angle-90+THREE.MathUtils.radToDeg(a);"axis"==this.type?(this.dirTextXDiv.style.transform="rotate("+(s+90-this.angle)+"deg)",this.dirTextXDiv.querySelector("span").style.transform="rotate("+-(s+90-this.angle)+"deg)",this.dirTextYDiv.style.transform="rotate(-90deg)",this.dirTextYDiv.querySelector("span").style.transform="rotate(90deg)",this.dirTextZDiv.style.transform="rotate("+(s+90+90-this.angle)+"deg)",this.dirTextZDiv.querySelector("span").style.transform="rotate("+-(s+90+90-this.angle)+"deg)"):(this.dirTextNDiv.style.transform="rotate("+s+"deg)",this.dirTextNDiv.querySelector("span").style.transform="rotate("+-s+"deg)")}},{key:"updateCamera",value:function(e){this.camera.quaternion.copy(e);var t=this.player.getDirection();this.camera.position.copy(t.multiplyScalar(5).negate())}},{key:"render",value:function(){this.renderer.render(this.scene,this.camera)}},{key:"setDisplay",value:function(e,t){this.force&&null==t||(null!=t&&(this.force=t),this.show=!!e,this.show?(this.update(),this.dom.style.display="block"):this.dom.style.display="none")}},{key:"autoJudgeDisplay",value:function(){"panorama"!=this.player.modeTran.split("-")[1]||"axis"==this.type?this.setDisplay(!0):this.setDisplay(!1)}},{key:"setDomLeft",value:function(){this.dom.css({right:"none",left:this.config.mobile?"1%":"2%"})}}]),e}();function Il(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}var kl={},Bl=function(e,t,n){El.material.uniforms.tDiffuse.value=t;var i=(new THREE.Quaternion).setFromAxisAngle(new THREE.Vector3(0,1,0),Math.PI/2);yl.quaternion.copy((new THREE.Quaternion).multiplyQuaternions(i,n));var o=new THREE.Vector3(0,0,-8).applyQuaternion(yl.quaternion);yl.position.copy(o.clone().negate());var r=ul.renderer.autoClear;ul.renderer.autoClear=!1,ul.renderer.setRenderTarget(e),ul.renderer.render(Al,yl),ul.renderer.setRenderTarget(null),ul.renderer.autoClear=r},Pl=function(e){return console.log(e),e&&!e.includes("/")?hl.resource.getUserResourceURL(e):e},Rl=function(e){f(n,THREE.EventDispatcher);var t=Il(n);function n(e,i){var r;return o(this,n),r=t.call(this),bl=!(hl=e).config.view,cl=i,ul=hl.core.get("SceneRenderer"),r.loaded=!1,r.enabled=!0,r.views={},r.ViewLinkCircles=new THREE.Object3D,r.ViewLinkCircles.name="ViewLinkCircles",r.ViewLinkBalloons=new THREE.Object3D,r.ViewLinkBalloons.name="ViewLinkBalloons",r.ViewLinkExits=new THREE.Object3D,r.ViewLinkExits.name="ViewLinkExits",r.ViewTitles=new THREE.Object3D,r.ViewTitles.name="ViewTitles",r.addEventListener("getViewLinkEdit",(function(e){kl=e.v})),hl.Scene.on("loadeddata",(function(){var e=hl.store.getValue("links");if(e)return cl.model.builded?void r.init(e):cl.model.addEventListener("builded",r.init.bind(h(r),e));r.init()})),r}return u(n,[{key:"init",value:function(e){var t=this;Ml.init(),this.createViews(e),cl.model.add(this.ViewLinkCircles),cl.model.add(this.ViewLinkBalloons),cl.model.add(this.ViewLinkExits),cl.model.add(this.ViewTitles),this.inited=!0,cl.currentPano&&cl.currentPano.hasVideo&&(this.ViewLinkCircles.visible=!1,this.ViewLinkBalloons.visible=!1,this.ViewLinkExits.visible=!1,setTimeout((function(){t.enabled&&(t.ViewLinkCircles.visible=!0,t.ViewLinkBalloons.visible=!0,t.ViewLinkExits.visible=!0)}),1e3));var n,i=[];cl.on("collectIntersectMesh",(function(e,o){if(t.inited&&t.enabled){var r=!0;if(cl.isOutsideMode()?i=kl.markView?[kl.markView.balloon.mesh]:t.ViewLinkBalloons.children:cl.is360View(cl.mode,cl.currentPano)?(i=kl.settingEntry?[]:kl.settingVisibles?t.ViewLinkCircles.children:t.ViewLinkExits.children.concat(t.ViewLinkCircles.children),r=!1):kl.markView?(i=[kl.markView.circle.mesh],r=!1):i=t.ViewLinkCircles.children,r)e.push.apply(e,H(i));else{var a=pt.getMouseIntersect(cl.camera,i,cl.mouse);a&&i.includes(a.object)&&(n=a,t.dealwithIntersect(a),o.consume())}}})),cl.on("judgeIntersect",(function(e,o){o.getConsumed()||(e&&i.includes(e.object)?(n=e,o.consume()):n=null,t.dealwithIntersect(n))})),cl.on("click",(function(e){e.getConsumed()||t.dealWithClick()&&e.consume()})),cl.on("update",(function(e){e.hasChanged.cameraChanged&&t.update()})),cl.on("mode.changing",(function(e,n,i,o){if("panorama"==e)setTimeout((function(){for(var e in t.views)t.views[e].balloon.showOrHide(!0,o/2,"auto"),t.views[e].circle.setVisible(!1);kl.markView&&kl.markView.circle.setVisible(!0)}),o||500);else if("floorplan"==e)for(var r in t.views)t.views[r].balloon.mesh.material.depthTest=!0;if("floorplan"==n&&setTimeout((function(){for(var e in t.views)t.views[e].balloon.mesh.material.depthTest=!1}),o),"panorama"==n){for(var a in t.views)t.views[a].balloon.showOrHide(!1),t.views[a].circle.setVisible(!0);kl.cancelPos&&kl.cancelPos()}})),cl.model.on("floor.changed",(function(e,t,n){if("panorama"!=cl.mode||"panorama"==t){var i=cl.model.allFloorsVisible;cl.model.floors.forEach((function(n){n==e||i?"floorplan"!=t&&"dollhouse"!=t||n.views.forEach((function(e){e.balloon.showOrHide(!0,500)})):n.views.forEach((function(e){kl.markView!=e&&e.balloon.showOrHide(!1,500)}))}))}})),cl.$app.config.view&&cl.on(ua,(function(e){var n,i=e.currentPano;"panorama"==cl.mode&&(n=i.getVideoFilter()),t.ViewLinkCircles.children.forEach((function(e){n&&n(e.position)?De.updateVisible(e,"coveredPanoVideo",!1):De.updateVisible(e,"coveredPanoVideo",!0)}))})),hl.store.getValue("metadata").controls.showLinkTitle||this.changeTitlesShow(!1)}},{key:"createViews",value:function(e){if(e){if(De.CloneJson(e.tags||e).forEach(function(e){if(this.views[e.sid])console.log("有重复的view sid"+e.sid);else{if(void 0!==e.panoId){var t=cl.model.panos.index[e.panoId];if(!t)return;var n=t.marker.position.clone();n.y+=1;var i=t.position.clone(),o=t.quaternion.clone();!e.balloon&&(e.balloon={pos:n.toArray()}),!e.circle&&(e.circle={pos:i.toArray(),qua:o.toArray(),scale:100}),!e.enterQuaternion&&(e.enterQuaternion=[0,0,0,1]),!e.exitDirection&&(e.exitDirection=[0,0,2.4]),void 0===e.nearestPano&&(t.neighbourUUIDs&&t.neighbourUUIDs.length>=1?e.nearestPano=t.neighbourUUIDs[0]:e.nearestPano="0")}var r=new Ml(e);void 0!==e.panoId&&(r.bindPanoId=e.panoId+""),this.addView(r)}}.bind(this)),"panorama"!=cl.getToMode())for(var t in this.views)this.views[t].balloon.showOrHide(!0,0);this.dispatchEvent({type:"loaded"}),this.loaded=!0}}},{key:"dealwithIntersect",value:function(e){if(this.enabled){var t,n=e&&e.object;if(!this.hoverCircle||this.hoverCircle.mesh==n||kl.markView&&kl.markView.circle==this.hoverCircle||(this.dispatchEvent({type:"changeIntersect",hovered:null}),this.hoverCircle.setSelect(!1)),!this.hoverBalloon||this.hoverBalloon.mesh==n||kl.markView&&kl.markView.balloon==this.hoverBalloon||(this.dispatchEvent({type:"changeIntersect",hovered:null}),this.hoverBalloon.setSelect(!1)),this.hoverExit&&this.hoverExit.mesh!=n&&this.hoverExit.setSelect(!1),this.clickEnable=!1,this.hoverBalloon=null,this.hoverCircle=null,this.hoverExit=null,!e)return Wr.remove("hoverView"),Wr.remove("dragView"),!0;if(n.name.includes("balloon"))(t=this.views[n.name.split("balloon_")[1]]).balloon.setSelect(!0),this.hoverBalloon=t.balloon,this.dispatchEvent({type:"changeIntersect",hovered:t.sid});else if(n.name.includes("exit"))(t=this.views[n.name.split("circle_exitDoor")[1]]).exitDoor.setSelect(!0),this.hoverExit=t.exitDoor;else{if(!(t=this.views[n.name.split("circle_")[1]]))return console.error("找不到view?",n.name);this.hoverCircle=t.circle,t.circle.setSelect(!0),this.dispatchEvent({type:"changeIntersect",hovered:t.sid})}kl.markView==t&&(cl.currentPano!=t.pano||kl.settingExit||kl.settingVisibles)?Wr.add("dragView"):(Wr.add("hoverView"),this.clickEnable=!0)}}},{key:"dealWithClick",value:function(){if(this.clickEnable){var e=this.hoverCircle||this.hoverBalloon||this.hoverExit,t=this.views[e.sid];if(e==this.hoverExit)return t.backToPanorama(),!0;if("url"==t.linkType)if(hl.config.link&&"object"==typeof hl.config.link){var n=t.url;"function"==typeof hl.config.link.onAction&&(n=hl.config.link.onAction(n)),n&&("blank"==hl.config.link.target?window.open(n):window.location.href=n)}else t.url&&(window.location.href=t.url);else"pano"==t.linkType&&t.pano&&t.enter360Pano();return!0}}},{key:"addView",value:function(e){this.views[e.sid]=e,this.ViewLinkCircles.add(e.circle.mesh),this.ViewLinkBalloons.add(e.balloon.mesh),e.exitDoor&&this.ViewLinkExits.add(e.exitDoor.mesh),this.ViewTitles.add(e.titleLabel)}},{key:"removeView",value:function(e){this.ViewLinkCircles.remove(e.circle.mesh),this.ViewLinkBalloons.remove(e.balloon.mesh),this.ViewLinkExits.remove(e.exitDoor.mesh),delete this.views[e.sid]}},{key:"update",value:function(e){for(var t in this.views)this.views[t].update()}},{key:"showAllViews",value:function(){this.enabled||(this.ViewLinkCircles.visible=!0,this.ViewLinkBalloons.visible=!0,this.ViewLinkExits.visible=!0,this.changeTitlesShow(!0,"showAll"),this.enabled=!0)}},{key:"hideAllViews",value:function(){this.enabled&&(cl.is360View(cl.mode,cl.currentPano)?cl.currentPano.view.backToPanorama():cl.enteringView&&cl.once("flying.ended",(function(){cl.currentPano.view.backToPanorama()})),this.ViewLinkCircles.visible=!1,this.ViewLinkBalloons.visible=!1,this.ViewLinkExits.visible=!1,this.changeTitlesShow(!1,"showAll"),this.dealwithIntersect(null),this.enabled=!1)}},{key:"changeTitlesShow",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"onShow";De.updateVisible(this.ViewTitles,t,!!e),e&&this.ViewTitles.children.forEach((function(e){return e.updatePos()}))}},{key:"setViewsVisible",value:function(e,t){if(this.enabled)for(var n in this.views)this.views[n].linkType==e&&this.views[n].setVisible(t)}},{key:"focusOn",value:function(e,t){var n=this;if(cl.flying)return cl.once("flying.ended",(function(){n.focusOn(e)}));"panorama"==cl.mode||"panorama"==t?cl.flyToPano({pano:e.nearestPano,lookAtPoint:e.circle.mesh.position,checkAlone:!0}):cl.focusPoint({aim:e.balloon.mesh.position})}},{key:"updateCirclesWhenFade",value:function(e,t){if("enter"==e)for(var n in this.views)if(n in t.pano.view.visibleViews){var i={};i.viewDir=(new THREE.Vector3).fromArray(t.pano.view.visibleViews[n]),this.views[n].circle.updatePos("at360View",i),this.views[n].circle.setVisible(!0)}else this.views[n].circle.setVisible(!1);else{for(var o in this.views)this.views[o].circle.at360View&&this.views[o].circle.updatePos("normal"),t.flyOut||this.views[o].circle.setVisible(!0);t.flyOut&&kl.markView&&kl.markView.circle.setVisible(!0)}}},{key:"exitView",value:function(){var e=new oe;return cl.is360View(cl.mode,cl.currentPano)?(cl.currentPano.view.backToPanorama(),cl.once(ua,(function(){e.resolve()}))):e.resolve(),e.promise()}}]),n}(),Ml=function(e){f(n,THREE.EventDispatcher);var t=Il(n);function n(e){var i;return o(this,n),(i=t.call(this)).sid=e.sid,i.pano=null,i.balloon=new Ll(e,h(i)),i.circle=new Dl(e,h(i)),i.linkType=e.type,i.enterQuaternion=e.enterQuaternion?(new THREE.Quaternion).fromArray(e.enterQuaternion):new THREE.Quaternion,i.exitDirection=e.exitDirection?(new THREE.Vector3).fromArray(e.exitDirection):new THREE.Vector3(0,0,at.view360.circleDisToCenter),i.url=e.url,(bl||"pano"==i.linkType)&&(i.exitDoor=new Dl(Object.assign({},e,{circleType:"exitDoor",exitDirection:i.exitDirection}),h(i))),i.titleLabel=new Fl(e.title,h(i)),i.addEventListener("updatePose",(function(e){"exitDoor"!=e.target.circleType&&i.titleLabel.updatePos()})),i.circle.addEventListener("move",(function(){"circle"==i.titleLabel.bindTo&&i.titleLabel.updatePos()})),e.thumb&&(i.imgSid=e.thumb.split(".jpg")[0],e.thumb=hl.resource.getUserImagesURL("panorama/".concat(i.imgSid,"/low/").concat(e.thumb)),i.resolution=e.resolution),i.nearestPano=void 0!==e.nearestPano&&cl.model.panos.index[e.nearestPano],i.nearestPano&&(i.floor=i.nearestPano.floor,i.floor.addView(h(i))),i.setPano(e),i.visibleViews=e.visibleViews||{},i._data=e,i}return u(n,[{key:"update",value:function(e){this.balloon.update(e),this.circle.update(e),this.exitDoor&&this.exitDoor.update(e)}},{key:"dispose",value:function(){var e=this;this.balloon.dispose(),this.circle.dispose(),this.exitDoor.dispose(),this.deleteOldPano(),this.titleLabel.dispose(),cl.currentPano==this.pano?this.backToPanorama():this.entering&&cl.once("flying.ended",(function(){e.backToPanorama()})),this.floor&&this.floor.removeView(this)}},{key:"deleteOldPano",value:function(){var e=this;if(this.pano){this.pano.floor.removePano(this.pano),this.pano.exit(),delete this.pano.panoRenderer.activeRenderTargetDescriptors[this.sid],delete this.pano.panoRenderer.panoDescriptors[this.sid],this.pano.tiled&&(delete this.pano.panoRenderer.tileTrees[this.sid],delete this.pano.panoRenderer.tileDirectory[this.sid],delete this.pano.tileDownloader.downloadDescriptors[this.sid],this.pano.tileDownloader.priorityQueue=this.pano.tileDownloader.priorityQueue.filter((function(t){return t.pano!=e.pano})),this.pano.tileDownloader.activeDownloads=this.pano.tileDownloader.activeDownloads.filter((function(t){return t.pano!=e.pano})));for(var t=this.pano.panoRenderer.M,n=0;n<t.length;n++)if(t[n].pano==this.pano){t.splice(n,1);break}var i=cl.model.panos.list.indexOf(this.pano);cl.model.panos.list.splice(i,1)}}},{key:"setPano",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if("pano"==this.linkType){if(e.thumb||e.thumbPanoTex){var t=!!this.pano;this.pano&&this.deleteOldPano();var n=new so(cl.$app,this.sid,{panoType:"360view",position:new THREE.Vector3,quaternion:new THREE.Quaternion,puck:new THREE.Vector3(0,-1.6,0),seeMarkers:[],subgroup:this.nearestPano.floor.floorIndex,tiled:!e.mapSrc});if(n.mapSrc=e.mapSrc,n.attachToPanoRenderer(cl.$app.core.get("PanoRenderer")),n.qualityManager=cl.$app.core.get("QualityManager"),n.tiled&&(n.tileDownloader=cl.$app.core.get("TileDownloader")),n.build1(),n.view=this,cl.model.panos.add(n),this.panoImgVersion=e.version,t&&cl.currentPano==this.pano){var i=function e(){cl.checkAndWaitForPanoLoad(n,"high","low",cl.basePanoSize,e)||(cl.model.setProjectedPanos(n,n),n.enter())};cl.currentPano=n,i()}this.pano=n,e.thumbPanoTex?this.thumbPanoTex=e.thumbPanoTex:this.thumbPanoTex=this.renderToGetMap(e.thumb),this.circle.setMapIn(this.thumbPanoTex),this.balloon.setMapIn(this.thumbPanoTex)}this.thumbPanoTex&&(this.circle.mesh.material.uniforms.changeMap.value=1,this.balloon.mesh.material.uniforms.changeMap.value=1)}else this.circle.mesh.material.uniforms.changeMap.value=0,this.balloon.mesh.material.uniforms.changeMap.value=0}},{key:"renderToGetMap",value:function(e){var t=this,n=new THREE.WebGLRenderTarget(256,256,{stencilBuffer:!1}),i=Fe.maybeQilin()?512:1024,o=si.load(e,k(S.mark((function e(){return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,De.compressImg(o.image,i);case 2:o.image=e.sent,bl&&(t.unDealTex=o),Bl(n,o,t.enterQuaternion);case 5:case"end":return e.stop()}}),e)}))));return o.flipY=!1,o.minFilter=THREE.LinearFilter,this.renderTarget=n,n.texture}},{key:"mapChangeRot",value:function(){Bl(this.renderTarget,this.unDealTex,this.enterQuaternion)}},{key:"enter360Pano",value:function(e){cl.flyToPano({pano:this.pano},(function(){"function"==typeof e&&e()}))}},{key:"backToPanorama",value:function(){cl.flyToPano({pano:cl.lastPano||this.nearestPano,lookAtPoint:this.circle.mesh.position})}},{key:"setVisible",value:function(e){!e!=this.disabled&&(e?(this.balloon.disabled=!1,this.balloon.showOrHide(!0,0,"auto")):(this.balloon.showOrHide(!1,0),this.balloon.disabled=!0,cl.currentPano!=this.pano&&cl.enteringView!=this||this.backToPanorama()),this.disabled=!e,this.circle.disabled=!e,this.circle.setVisible())}},{key:"setSelect",value:function(e){this.selected!=e&&(this.selected=!!e,this.circle.setSelect(e),this.balloon.setSelect(e))}}]),n}();Ml.init=function(){Ml.inited||(dl=new THREE.PlaneBufferGeometry(.4,.4),pl=new THREE.PlaneBufferGeometry(1.5,1.5),fl=si.load(si.getImageURL("images/img_pamove.png")),ml=si.load(si.getImageURL("images/img_pamove_normal.png")),vl=si.load(si.getImageURL("images/img_panorama_dot.png")),gl=si.load(si.getImageURL("images/img_exit_dot.png")),ml.minFilter=THREE.LinearMipmapNearestFilter,ml.needsUpdate=!0,(yl=new THREE.PerspectiveCamera).fov=80,yl.aspect=1,yl.updateProjectionMatrix(),(Al=new THREE.Scene).add(yl),El=new THREE.Mesh(new THREE.SphereBufferGeometry(10,25,25),new THREE.RawShaderMaterial({uniforms:THREE.UniformsUtils.clone(dn.uniforms),vertexShader:dn.vertexShader,fragmentShader:dn.fragmentShader,depthWrite:!1,depthTest:!1,side:THREE.DoubleSide})),Al.add(El),Ml.inited=!0)};var Sl=function(e){f(n,THREE.EventDispatcher);var t=Il(n);function n(e,i){var r;return o(this,n),(r=t.call(this)).view=i,r.sid=e.sid,r}return u(n,[{key:"update",value:function(e){var t=!1;if("sprite"==this.state&&this.mesh.visible&&(e||!this.mesh.material.uniforms.opacity||this.mesh.material.uniforms.opacity.value>0)&&(this.mesh.quaternion.copy(cl.camera.quaternion),t=!0),this.strictScale){var n="floorplan"==cl.mode?cl.cameraControls.activeControl.camera:cl.camera,i=ge.getScaleForConstantSize({dom:cl.$app.dom,maxSize:100,minSize:40,nearBound:2,farBound:80,camera:n,position:this.mesh.position});this.mesh.scale.set(i,i,i),t=!0}t&&this.view.dispatchEvent({type:"updatePose"})}},{key:"setStrictScale",value:function(e){this.strictScale=e,e?this.update():this.mesh.scale.set(1,1,1),this.view.dispatchEvent({type:"updatePose"})}},{key:"setMapIn",value:function(e){this.mesh.material.uniforms.mapIn.value=e}},{key:"dispose",value:function(){}}]),n}(),Dl=function(e){f(n,e);var t=Il(n);function n(e,i){var r;return o(this,n),(r=t.call(this,e,i)).circleType=e.circleType,r.position=new THREE.Vector3,r.quaternion=new THREE.Quaternion,r.build(e),r}return u(n,[{key:"build",value:function(e){var t=THREE.UniformsUtils.clone(hn.uniforms),n=new THREE.Mesh(dl,new THREE.RawShaderMaterial({uniforms:t,vertexShader:hn.vertexShader,fragmentShader:hn.fragmentShader,transparent:!0,side:THREE.DoubleSide}));if(n.renderOrder=Ke,n.name="circle_"+(this.circleType?this.circleType:"")+this.sid,this.mesh=n,this.setMapOut(e),"exitDoor"==this.circleType)this.mesh.visible=!1,this.mesh.material.depthTest=!1,e.exitDirection&&this.mesh.position.copy(e.exitDirection),this.state="sprite";else{if(e.circle){e.circle.pos&&this.position.fromArray(e.circle.pos),e.circle.qua&&this.quaternion.fromArray(e.circle.qua);var i=e.circle.scale/100;e.circle.scale&&this.mesh.scale.set(i,i,i),this.state="3D",this.updatePos()}cl.isOutsideMode()&&this.setVisible(!1)}}},{key:"updatePos",value:function(e,t){if("at360View"==e){new THREE.Vector3;var n=t.viewDir.clone().normalize();this.mesh.position.copy(n.multiplyScalar(at.view360.circleDisToCenter)),this.at360View=!0,this.state="sprite"}else t&&(t.position&&this.position.copy(t.position),t.quaternion&&this.quaternion.copy(t.quaternion)),this.mesh.position.copy(this.position),this.mesh.quaternion.copy(this.quaternion),this.at360View=!1,this.state="3D",this.judgeDepthTest(),this.dispatchEvent({type:"move"})}},{key:"state",get:function(){return this._state},set:function(e){this._state=e,this.mesh&&this.update()}},{key:"judgeDepthTest",value:function(){this.mesh.material.depthTest=!("sprite"==this.state||this.selected)}},{key:"update",value:function(){Tt(w(n.prototype),"update",this).call(this),this.judgeDepthTest()}},{key:"setSelect",value:function(e){if(e!=this.selected){this.selected=e;this.judgeDepthTest(),Ae.cancelById("circlePro"),Ae.start(St.uniform(this.mesh,"progress",e?1:0),500,(function(){}),0,ye[at.transition.blendEasing],"circlePro")}}},{key:"setMapOut",value:function(e){var t;if("exitDoor"==this.circleType)if(e)if(e instanceof THREE.Texture)t=e;else if("string"==typeof e)t=si.load(e);else{var n;if(e.style)e.style.exit.name&&"custom"!=e.style.exit.name?n=hl.resource.getAppURL("images/link/exit-style-".concat(e.style.exit.name,".png")):e.style.exit.url&&(n=Pl(e.style.exit.url)),t=si.load(n);else t=gl}else t=gl;else if(e)if(e instanceof THREE.Texture)t=e;else if("string"==typeof e)t=si.load(Pl(e));else{var i;if(e.style)e.style.enter.name&&"custom"!=e.style.enter.name?i=hl.resource.getAppURL("images/link/enter-style-".concat(e.style.enter.name,".png")):e.style.enter.url&&(i=Pl(e.style.enter.url)),t=si.load(i);else t=vl}else t=vl;this.mesh.material.uniforms.mapOut.value=t}},{key:"setVisible",value:function(e){null==e&&(e=this._visible),De.updateVisible(this.mesh,"setVisible",!this.disabled&&e),this._visible=e}}]),n}(Sl),Ll=function(e){f(n,e);var t=Il(n);function n(e,i){var r;return o(this,n),(r=t.call(this,e,i)).state="sprite",r.build(e),r}return u(n,[{key:"build",value:function(e){var t=THREE.UniformsUtils.clone(un.uniforms);t.mapOut.value=fl,t.mapOut2.value=ml,t.opacity.value=0;var n=new THREE.Mesh(pl,new THREE.RawShaderMaterial({uniforms:t,vertexShader:un.vertexShader,fragmentShader:un.fragmentShader,transparent:!0,side:THREE.DoubleSide,depthTest:!1}));n.renderOrder=Ke,n.name="balloon_"+this.sid,this.mesh=n,e.balloon&&e.balloon.pos&&this.mesh.position.fromArray(e.balloon.pos),this.mesh.visible=!1}},{key:"showOrHide",value:function(e,t,n){var i=this;if(!this.disabled){"auto"==n&&(e="panorama"!=cl.getToMode()&&(cl.model.allFloorsVisible||!this.view.floor||this.view.floor==cl.model.currentFloor));t=null!=t?t:500;var o=e?1:0;Ae.cancelById("balloonOpa_"+this.sid),this.mesh.material.uniforms.opacity.value!=o&&(e&&(this.mesh.visible=!0),this.update(!0),Ae.start(St.uniform(this.mesh,"opacity",o),t,(function(t){i.mesh.material.depthTest="floorplan"!=cl.modeTran.split("-")[1],i.mesh.visible=!!e,i.view.titleLabel.switchBind(e?"balloon":"circle")}),0,ye[at.transition.blendEasing],null,"balloonOpa_"+this.sid))}}},{key:"setSelect",value:function(e){if(e!=this.selected){this.selected=e;Ae.cancelById("balloonPro"),Ae.start(St.uniform(this.mesh,"activeProgress",e?1:0),300,(function(){}),0,ye[at.transition.blendEasing],"balloonPro")}}}]),n}(Sl),Fl=function(e){f(n,e);var t=Il(n);function n(e,i){var r;return o(this,n),(r=t.call(this,{text:e,backgroundColor:{r:255,g:255,b:255,a:0},textColor:{r:255,g:255,b:255,a:1},textshadowColor:"#888",borderRadius:2,fontsize:34,renderOrder:5,margin:{x:12,y:10},player:cl,fixOrient:!0,sizeInfo:{scale:.4,nearBound:3}})).sprite.material.depthTest=r.sprite.material.depthWrite=!0,r.sprite.material.side=THREE.DoubleSide,r.view=i,r.visible=!1,setTimeout((function(){r.visible=!0,r.switchBind(i.balloon.mesh.visible?"balloon":"circle")}),1),r}return u(n,[{key:"switchBind",value:function(e){this.bindTo=e,"circle"==e?(this.fixOrient=!0,this.quaternion.copy(this.view.circle.mesh.quaternion)):(this.fixOrient=!1,this.view.balloon),this.updatePos()}},{key:"updatePos",value:function(){if(De.realVisible(this)){var e,t,n=new THREE.Vector3(0,-1,0);"circle"==this.bindTo?(e=this.view.circle.mesh,t=.08,this.quaternion.copy(this.view.circle.mesh.quaternion)):((e=this.view.balloon.mesh).scale.x,t=.2),e.updateMatrix(),n.multiplyScalar(t+Math.abs(e.geometry.attributes.position.array[0])),n.applyMatrix4(e.matrix),this.position.copy(n),this.updatePose()}}}]),n}(Ce);function Hl(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}var Vl=Fe.maybeQilin()&&Fe.detectFirefox()?"NearestFilter":"LinearFilter",Ol=function(e){f(n,e);var t=Hl(n);function n(e,i){var r;o(this,n),(r=t.call(this)).app=e,r.player=i,r.sceneRenderer=e.core.get("SceneRenderer"),r.sceneNum=e.config.num,r.painting=!1,r.pause=!1,r.mousePosition=new THREE.Vector4,r.currentPaintUrl=null;var a=e.store.getValue("metadata");return a?(r.paintData=a.mosaicList,r.width=1024*("pro"==a.sceneFrom?2:4),r.height=1024*("pro"==a.sceneFrom?1:2)):e.store.on("metadata",(function(e){r.paintData=e.mosaicList,r.width=1024*("pro"==e.sceneFrom?2:4),r.height=1024*("pro"==e.sceneFrom?1:2)})),r}return u(n,[{key:"init",value:function(){var e=this,t=new THREE.Vector3(this.width,this.height,window.devicePixelRatio);this.bufferRenderer=new _l(this.sceneRenderer.renderer,{width:this.width,height:this.height}),this.bufferShader=new Ql({iResolution:{value:t},iMouse:{value:this.mousePosition},iChannel0:{value:null},iChannel1:{value:null},iBrushType:{value:1},iBrushSize:{value:5},iAngle:{value:0},iPitch:{value:0},iIsBrush:{value:0}}),Object.assign(this.player.model.skybox.material.uniforms,this.bufferShader.uniforms),this.player.model.chunks.forEach((function(t){return Object.assign(t.materialInside.uniforms,e.bufferShader.uniforms)}))}},{key:"start",value:function(e){var t=this;this.player.reticule.visible=!1,this.player.cameraControls.activeControl.enabled=!1,this.mousePosition.setZ(0);var n=this.player.camera.getWorldDirection(new THREE.Vector3),i=n.clone().projectOnPlane(new THREE.Vector3(0,1,0)),o=n.angleTo(i)*Math.sign(-n.y),r=n.clone().setY(0),a=(new THREE.Euler).setFromQuaternion(this.player.currentPano.quaternion),s=new THREE.Vector3(1,0,0).applyEuler(a).setY(0),l=new THREE.Vector3(0,0,1).applyEuler(a).setY(0),c=r.angleTo(s)*Math.sign(r.dot(l));if(this.bufferShader.uniforms.iAngle.value=c,this.bufferShader.uniforms.iPitch.value=o,e)this.showBrush(!0),this.pause=!1;else{var u=function(e){t.bufferRenderer.readBuffer=new THREE.WebGLRenderTarget(t.width,t.height,t.bufferRenderer.bufferOptions),e&&(t.bufferRenderer.readBuffer.texture=e),t.bufferRenderer.writeBuffer=new THREE.WebGLRenderTarget(t.width,t.height,t.bufferRenderer.bufferOptions),t.setPaintTexture("paint0Map",t.bufferRenderer.readBuffer.texture),t.setPaintTexture("paint1Map",t.bufferRenderer.readBuffer.texture),t.painting=!0,t.pause&&t.cancel(!0)};this.currentPaintUrl?(new THREE.TextureLoader).load(this.currentPaintUrl,(function(e){e.minFilter=THREE[Vl],e.magFilter=THREE[Vl],e.type=THREE.FloatType,e.needsUpdate=!0,u(e)})):u(),this.player.locked=!0,this.hasEdit=!1,this.defineHasPaint(!0),si.load(this.app.resource.getViewImagesURL("pan/high/".concat(this.player.currentPano.id,".jpg")),(function(e){t.bufferShader.uniforms.iChannel1.value=e,t.showBrush(!0),t.emit("start")}));var h=this.bufferShader.material.defines;"Not_Cube"in h==this.player.currentPano.tiled&&(this.player.currentPano.tiled?delete h.Not_Cube:h.Not_Cube="",this.bufferShader.material.needsUpdate=!0)}}},{key:"cancel",value:function(e){this.player.reticule.visible=!0,this.player.cameraControls.activeControl.enabled=!0,this.showBrush(!1),e?this.pause=!0:(this.painting=!1,this.hasEdit=!1,this.player.locked=!1,this.setPaintImage(this.currentPaintUrl,this.currentPaintUrl),this.bufferRenderer.readBuffer.dispose(),this.bufferRenderer.writeBuffer.dispose())}},{key:"save",value:function(){var e=this,t=this.player.currentPano.id;return{panoId:t,data:this.bufferRenderer.save(),func:function(){e.currentPaintUrl=e.bufferRenderer.base64,e.paintData||(e.paintData=[]);var n=e.paintData.find((function(e){return e.panoId==t}));n?n.data=e.bufferRenderer.base64:e.paintData.push({panoId:t,data:e.bufferRenderer.base64})}}}},{key:"update",value:function(){this.painting&&!this.pause&&(this.bufferShader.uniforms.iChannel0.value=this.bufferRenderer.readBuffer.texture,this.bufferRenderer.render(this.bufferShader.scene,this.bufferShader.camera))}},{key:"showBrush",value:function(e){e?Wr.add("hide"):Wr.remove("hide"),this.player.model.skybox&&(this.player.model.skybox.material.uniforms.iShowBrush.value=e?1:0),this.player.model.chunks.forEach((function(t){return t.materialInside.uniforms.iShowBrush.value=e?1:0}))}},{key:"changeBrush",value:function(e){-1==parseInt(e)?this.cancel(!0):(this.pause&&this.start(!0),this.bufferShader.uniforms.iBrushType.value=parseInt(e))}},{key:"setBrushSize",value:function(e){this.bufferShader.uniforms.iBrushSize.value=parseFloat(e)}},{key:"updatePanoPaint",value:function(e,t){if(this.paintData){var n=this.paintData.find((function(t){return t.panoId==e})),i=n&&(n.data||this.app.resource.getUserResourceURL(n.fileName)),o=this.paintData.find((function(e){return e.panoId==t})),r=o&&(o.data||this.app.resource.getUserResourceURL(o.fileName));this.currentPaintUrl=null!=t?r:i,this.setPaintImage(i,r)}}},{key:"setPaintImage",value:function(e,t){var n=this;this.defineHasPaint(!!t||!!e),e?si.loadWithoutUpdate(e,(function(e){return n.setPaintTexture("paint0Map",e)}),(function(){})):this.setPaintTexture("paint0Map",null),t?si.loadWithoutUpdate(t,(function(e){return n.setPaintTexture("paint1Map",e)}),(function(){})):this.setPaintTexture("paint1Map",null)}},{key:"setPaintTexture",value:function(e,t){t&&(t.minFilter=THREE[Vl],t.magFilter=THREE[Vl]),this.app.core.get("QuickstartManager").skybox.material.uniforms[e].value=t,this.player.model.skybox&&(this.player.model.skybox.material.uniforms[e].value=t),this.player.model.chunks.forEach((function(n){return n.materialInside.uniforms[e].value=t})),this.player.model.highMapCube&&this.player.model.highMapCube.tiles.forEach((function(n){n.material.uniforms[e].value=t}))}},{key:"defineHasPaint",value:function(e){var t=[];t.push(this.app.core.get("QuickstartManager").skybox.material),this.player.model.skybox&&t.push(this.player.model.skybox.material),this.player.model.chunks.forEach((function(e){return t.push(e.materialInside)})),this.player.model.highMapCube&&t.push.apply(t,H(this.player.model.highMapCube.tiles.map((function(e){return e.material})))),e?t.forEach((function(e){return e.defines.HasPaint=!0,e.needsUpdate=!0})):t.forEach((function(e){return delete e.defines.HasPaint,e.needsUpdate=!0}))}},{key:"dealPointerDown",value:function(){this.player.locked?(this.hasEdit=!0,this.mousePosition.setZ(1)):this.once("start",this.dealPointerDown.bind(this))}},{key:"dealPointerMove",value:function(e){var t=this.sceneRenderer.renderer.domElement.clientWidth,n=this.sceneRenderer.renderer.domElement.clientHeight;e.x=(e.x-t/2)/(this.player.zoomLevel+.2*(this.player.zoomLevel-1))+t/2,e.y=(e.y-n/2)/(this.player.zoomLevel+.2*(this.player.zoomLevel-1))+n/2,this.mousePosition.setX(e.x/t*this.width),this.mousePosition.setY((1-e.y/n)*this.height)}},{key:"dealPointerUp",value:function(){this.mousePosition.setZ(0)}}]),n}(yo),Ql=function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};o(this,e),this.uniforms=t,this.material=new THREE.RawShaderMaterial({fragmentShader:mn.model.fragmentBufferShader,vertexShader:mn.model.vertexShader,uniforms:t,side:THREE.DoubleSide}),this.scene=new THREE.Scene,this.scene.add(new THREE.Mesh(new THREE.PlaneBufferGeometry(2,2),this.material)),this.camera=new THREE.PerspectiveCamera(90,1,.01,1e3),this.camera.position.set(0,0,1)},_l=function(){function e(t,n){o(this,e),this.renderer=t,this.width=n.width,this.height=n.height,this.bufferOptions={minFilter:THREE[Vl],magFilter:THREE[Vl],format:THREE.RGBAFormat,type:THREE.FloatType,stencilBuffer:!1},this.readBuffer=null,this.writeBuffer=null}return u(e,[{key:"render",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(n)this.renderer.render(e,t);else{var i=this.renderer.autoClear;this.renderer.autoClear=!1,this.renderer.setRenderTarget(this.writeBuffer),this.renderer.render(e,t),this.renderer.setRenderTarget(null),this.renderer.autoClear=i}var o=[this.writeBuffer,this.readBuffer];this.readBuffer=o[0],this.writeBuffer=o[1]}},{key:"save",value:function(){var e=new Float32Array(this.width*this.height*4);this.renderer.readRenderTargetPixels(this.readBuffer,0,0,this.width,this.height,e),this.outputCanvas=document.createElement("canvas"),this.outputCanvas.width=this.width,this.outputCanvas.height=this.height;for(var t=this.outputCanvas.getContext("2d"),n=4*this.width,i=0;i<this.height;i++){for(var o=this.height-1-i,r=t.createImageData(this.width,1),a=o*this.width*4,s=0;s<n;s++)r.data[s]=255*e[a+s];t.putImageData(r,0,i)}return this.base64=this.outputCanvas.toDataURL("image/png"),this.base64}}]),e}();function zl(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}var Ul=function(e){f(n,THREE.Group);var t=zl(n);function n(e,i){var r;if(o(this,n),(r=t.call(this)).manager=e,r.version=0,i)r.setFromInfo(i),r.updateInfo(!0);else{r.sid=De.getRandomSid(),r.panoId=r.manager.player.currentPano.id,r.isNew=!0,r.position.setY(1e3);var a=new THREE.MeshBasicMaterial({color:"#00c8af",opacity:.4,transparent:!0,polygonOffset:!0,polygonOffsetFactor:-.9,polygonOffsetUnits:-4}),s=new THREE.BoxGeometry(.5,.5,.5);s.translate(0,.25,0);var l=new THREE.Mesh(s,a);r.add(l)}return r}return u(n,[{key:"load",value:function(e,t){this.remove(),e&&(this.url=e,ms("".concat(this.manager.player.$app.resource.getUserModelResourceURL(e),"&v=").concat(this.version),function(e){this.version++;var n=e.boundingBox=new THREE.Box3;if(this.add(e.scene),e.scene.gltf=e,e.scene.traverse((function(e){t&&e.geometry&&(e.geometry.boundingBox||e.geometry.computeBoundingBox(),n.union(e.geometry.boundingBox.clone().applyMatrix4(e.matrixWorld))),e.material&&(e.renderOrder=je,e.material.transparent=!0)})),t){var i=n.getCenter(new THREE.Vector3);e.scene.position.copy(i).negate()}if(e.animations.length>0){var o=new THREE.AnimationMixer(this);o.clipAction(e.animations[0]).play(),e.scene.mixer=o}this.dispatchEvent({type:"loaded"})}.bind(this)))}},{key:"update",value:function(e){this.children.forEach((function(t){t.mixer&&t.mixer.update(e)}))}},{key:"remove",value:function(e){e&&this.removeFromParent(),this.traverse((function(e){var t,n;null===(t=e.geometry)||void 0===t||t.dispose(),null===(n=e.material)||void 0===n||n.dispose()})),this.children.length=0}},{key:"setFromInfo",value:function(e){var t=e.createTime>1737452589212;this.sid=e.sid,this.panoId=e.panoId,this.url!=e.url&&this.load(e.url,t),this.zipName=e.zipName,this.visible=e.visible,this.setTransformFromInfo(e)}},{key:"setTransformFromInfo",value:function(e){var t=e.position,n=e.rotation,i=e.scale,o=e.quaternion;this.position.set(parseFloat(t.x),parseFloat(t.y),parseFloat(t.z)),o?this.setRotationFromQuaternion(new THREE.Quaternion(o.x,o.y,o.z,o.w)):this.rotation.set(THREE.MathUtils.degToRad(n.x),THREE.MathUtils.degToRad(n.y),THREE.MathUtils.degToRad(n.z)),this.scale.set(parseFloat(i.x),parseFloat(i.y),parseFloat(i.z))}},{key:"updateInfo",value:function(e){var t={sid:this.sid,panoId:this.panoId,url:this.url,zipName:this.zipName,position:{x:parseFloat(this.position.x.toFixed(2)),y:parseFloat(this.position.y.toFixed(2)),z:parseFloat(this.position.z.toFixed(2))},rotation:{x:parseInt(THREE.MathUtils.radToDeg(this.rotation.x)),y:parseInt(THREE.MathUtils.radToDeg(this.rotation.y)),z:parseInt(THREE.MathUtils.radToDeg(this.rotation.z))},scale:{x:parseFloat(this.scale.x.toFixed(1)),y:parseFloat(this.scale.y.toFixed(1)),z:parseFloat(this.scale.z.toFixed(1))},visible:this.visible};return e&&(this.info=t),t}}]),n}(),Nl=function(){function e(t){o(this,e),this.player=t,this.editing=!1,this.adding=null,this.selecting=null,this.group=new THREE.Group,this.group.name="GLTFDecorations",t.model.add(this.group),this.bindEvents()}return u(e,[{key:"show",value:function(e,t){var n=this;this.group.children.forEach((function(i){i!==n.adding&&i!==n.selecting&&(t&&!i.info.visible||"all"!=e&&n.player.model.panos.get(i.panoId).floorIndex!=e||(i.visible=!0))}))}},{key:"hide",value:function(e){var t=this;this.group.children.forEach((function(n){n!==t.adding&&n!==t.selecting&&("all"!=e&&t.player.model.panos.get(n.panoId).floorIndex!=e||(n.visible=!1))}))}},{key:"bindEvents",value:function(){var e=this;this.player.on("pointerUp",this.onMouseUp.bind(this)),this.player.on("pointerMove",this.onMouseMove.bind(this)),this.player.model.transformControls.addEventListener("mousing",(function(t){e.selecting&&e.player.$app.Scene.Decoration.emit("Decoration.GLTF.select",e.selecting.updateInfo())})),this.player.model.transformControls.addEventListener("mouseUp",(function(){e.selecting}))}},{key:"onMouseUp",value:function(e){if(!this.player.EditOverlay.isAdding&&!this.player.EditOverlay.editPlane&&!this.selecting&&this.editing)if(this.adding)e.consume(),this.adding.updateInfo(!0),this.select(this.adding),this.adding=null;else if(this.player.mouseCouldBeClickToMove){var t=this.player.getMouseIntersect(null,this.group.children.filter((function(e){return e.visible})));if(t){e.consume();var n=t.object.parent;this.select(n),this.player.flyToPano({pano:this.player.model.panos.get(n.panoId),lookAtPoint:n.position,checkAlone:!0})}}}},{key:"onMouseMove",value:function(){if(this.adding){var e=this.player.getMouseIntersect(null,this.player.model.colliders);e&&this.adding.position.copy(e.point)}}},{key:"select",value:function(e){this.selecting=e,this.player.model.transformControls.switchEditState("decoration"),this.player.model.transformControls.attach(e),this.player.$app.Scene.Decoration.emit("Decoration.GLTF.select",e.updateInfo()),this.player.compass.switch("axis")}},{key:"unselect",value:function(){this.selecting=null,this.player.model.transformControls.detach(),this.player.compass.switch("direction")}},{key:"add",value:function(e){var t=new Ul(this,e);return this.group.add(t),e||(this.adding=t),t}},{key:"delete",value:function(e){e==this.selecting&&this.unselect(),e.remove(!0)}},{key:"save",value:function(e){return{data:this.selecting.updateInfo(),successCallBack:function(){try{this.selecting.isNew=!1,this.selecting.updateInfo(!0),this.unselect(),e&&e()}catch(e){console.error(e)}}.bind(this)}}}]),e}();function Gl(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}ct("Player",(function(){return function(e){f(n,EventEmitter);var t=Gl(n);function n(){var e,i,r,a,s,l;return o(this,n),(e=t.call(this)).setupCustomProperties=function(e){var t=e||xt.PANORAMA;Object.defineProperty(this,"mode",{get:function(){return t},set:function(e){var n=t;t=e,this.onModeUpdated(n,t)}})},e.isOutsideMode=function(e){return(e=e||this.mode)===xt.DOLLHOUSE||e===xt.FLOORPLAN},e.is360View=function(e,t){return e===xt.PANORAMA&&t&&"360view"==t.panoType},e.setScene=function(){var e=this.$app.core.get("SceneRenderer").scene;this.sceneIntersectionPlane=e.plane,this.path.setScene(e),this.moveReticuleToScene(e)},e.moveReticuleToScene=function(e){this.reticule.parent&&this.reticule.parent.remove(this.reticule),e.add(this.reticule)},e.updateModel=function(){var e=this;this.model=this.modelManager.getActiveModel(),this.model.player=this,this.paintEditor.init(),this.on(aa,(function(t,n,i){e.model.setProjectedPanos(t,n,i),e.paintEditor&&e.paintEditor.updatePanoPaint(t.id,n.id),e.$app.FilterManager&&e.$app.FilterManager.updatePanoFilters(t,n)})),this.on(ca,this.model.resetHighMap.bind(this.model))},e.updateModelDependentData=function(){this.cameraControls.setModelForControls(this.model),this.getPanoMarkersFromModel(this.model)},e.getPanoMarkersFromModel=function(e){this.panoMarkers=e.panos.list.reduce((function(e,t){return t.marker?e.concat(t.marker):e}),[])},e.handleControlMove=function(e){this.emit($r,e),this.mode===xt.PANORAMA&&this.emit(ea,{quaternion:this.cameraControls.activeControl.camera.quaternion,mode:xt.PANORAMA,currentPanoId:this.nextPano?this.nextPano.id:this.currentPano?this.currentPano.id:null,type:"rotate"})},e.handleControlInputStart=function(e){this.emit(va,e)},e.onModeUpdated=function(e,t){this.cameraControls.activateControls(t),this.emit(oa,e,t),"transitioning"==t?(e=this.modeTran.split("-")[0])==xt.PANORAMA&&(this.flyingToTag=this.flyRotate=this.flyingWithRot=!1):(t=this.modeTran.split("-")[1],this.isOutsideMode(e)&&this.isOutsideMode(t)||this.model.fadePanoMarkers(null,0),xt.PANORAMA)},e.isWarping=function(){return!1},e.isWaitingToWarp=function(){return!1},e.bindEvents=function(e){e!==document&&e.setAttribute("tabindex",-1),e.addEventListener("mousedown",this.onMouseDown.bind(this)),e.addEventListener("mousemove",this.onMouseMove.bind(this)),e.addEventListener("mouseover",this.onMouseOver.bind(this)),e.addEventListener("mouseout",this.onMouseOut.bind(this)),e.addEventListener("mouseup",this.onMouseUp.bind(this)),e.addEventListener("touchstart",this.onTouchStart.bind(this),{passive:!1}),e.addEventListener("touchmove",this.onTouchMove.bind(this),{passive:!1}),e.addEventListener("touchend",this.onTouchEnd.bind(this)),e.addEventListener("pointerdown",this.onPointerDown.bind(this)),e.addEventListener("pointermove",this.onPointerMove.bind(this)),e.addEventListener("pointerup",this.onPointerUp.bind(this)),e.addEventListener("pointerout",this.onPointerOut.bind(this)),e.addEventListener("pointercancel",this.onPointerCancel.bind(this)),document.addEventListener("keydown",this.onKeyDown.bind(this)),this.cameraControls.on(Qa,this.handleControlMove.bind(this)),this.cameraControls.on(Ua,this.handleControlInputStart.bind(this)),this.cameraControls.on(Na,this.handleControlPinch.bind(this)),this.cameraControls.on(Ga,this.handleControlScroll.bind(this))},e.onMouseDown=function(e){e.currentTarget!==document&&e.currentTarget.focus(),0===e.button&&(this.handleInputStart.call(this,e.clientX,e.clientY,!1),this.updateIntersect())},e.onMouseMove=function(e){this.isTouchEvent=!1,this.containsMouse=!0,this.handleInputMove.call(this,e.clientX,e.clientY,!1)},e.onMouseOver=function(e){this.containsMouse=!0,!this.mouseDown||0!==e.which&&0!==e.buttons||(this.mouseDown=!1)},e.onMouseOut=function(e){this.containsMouse=!1},e.onMouseUp=function(e){this.handleInputEnd.call(this,e.clientX,e.clientY,!1,e),this.emit(na,{rotationSpeed:this.cameraControls.activeControl?this.cameraControls.activeControl.rotationSpeed:null,type:"endRotation"})},e.onTouchStart=function(e){if(e.currentTarget!==document&&e.currentTarget.focus(),!this.mouseDown){this.couldBeLongTap=!0;var t=De.average(e.changedTouches,"clientX"),n=De.average(e.changedTouches,"clientY");this.handleInputStart.call(this,t,n,!0),this.mouseDownTimer=setTimeout(function(){this.updateIntersect(),this.handleInputEnd.call(this,t,n,!0,e)}.bind(this),at.input.longTapThreshold)}Fe.detectIOS()&&this.$app.core.get("PanoVideoRenderer").setMuted(!1)},e.onTouchMove=function(e){var t=De.average(e.changedTouches,"clientX"),n=De.average(e.changedTouches,"clientY");this.handleInputMove.call(this,t,n,!0)},e.onTouchEnd=function(e){if(clearTimeout(this.mouseDownTimer),this.mouseDown){this.couldBeLongTap=!1,this.updateIntersect();var t=De.average(e.changedTouches,"clientX"),n=De.average(e.changedTouches,"clientY");this.handleInputEnd.call(this,t,n,!0,e),this.emit(na,{rotationSpeed:this.cameraControls.activeControl?this.cameraControls.activeControl.rotationSpeed:null,type:"endRotation"})}},e.onPointerDown=function(e){return e.currentTarget!==document&&e.currentTarget.focus(),this.mouseDown||"mouse"===e.pointerType?this.onMouseDown(e):(this.couldBeLongTap=!0,this.handleInputStart.call(this,e.clientX,e.clientY,!0),void(this.mouseDownTimer=setTimeout(function(){this.updateIntersect(),this.handleInputEnd.call(this,e.clientX,e.clientY,!0,e)}.bind(this),at.input.longTapThreshold)))},e.onPointerMove=function(e){"mouse"!==e.pointerType?this.handleInputMove.call(this,e.clientX,e.clientY,!0):this.onMouseMove(e)},e.onPointerUp=function(e){this.mouseDown&&"mouse"!==e.pointerType?(this.mouseDownTimer&&clearTimeout(this.mouseDownTimer),this.couldBeLongTap=!1,this.updateIntersect(),this.handleInputEnd.call(this,e.clientX,e.clientY,!0,e),this.emit(na,{rotationSpeed:this.cameraControls.activeControl?this.cameraControls.activeControl.rotationSpeed:null,type:"endRotation"})):this.onMouseUp(e)},e.onPointerOut=function(e){this.mouseDown=!1},e.onPointerCancel=function(e){this.mouseDown=!1},e.onKeyDown=function(e){if(this.$app.config.useShortcutKeys){var t=function(){this.cameraControls.activeControl&&this.cameraControls.activeControl.emit(Qa,"key")}.bind(this),n=e.which;switch(n){case $a.F:t(),this.changeFloor(-1);break;case $a.R:t(),this.changeFloor(1)}if(this.mode===xt.PANORAMA)switch(n){case $a.UPARROW:case $a.W:this.flyLocalDirection(to.FORWARD.clone());break;case $a.DOWNARROW:case $a.S:this.flyLocalDirection(to.BACK.clone());break;case $a.A:this.flyLocalDirection(to.LEFT.clone());break;case $a.D:this.flyLocalDirection(to.RIGHT.clone())}if(this.started)switch(n){case $a.ONE:this.insideMode();break;case $a.TWO:this.flyToNewMode({mode:xt.DOLLHOUSE});break;case $a.THREE:this.flyToNewMode({mode:xt.FLOORPLAN})}}},e.handleScrollPinchZoom=function(e){var t=e,n=this.zoomLevel;this.zoomBy(t),this.currentPano&&this.zoomStats.addZoomAction(n,this.zoomLevel,this.currentPano.id)},e.handleControlPinch=function(e){at.zoom.enabled?this.handleScrollPinchZoom(1-e):this.$app.config.useShortcutKeys&&this.flyLocalDirection(new THREE.Vector3(0,0,e).normalize())},e.handleControlScroll=function(e){at.zoom.enabled?(e>0?e=1+this.scrollZoomSpeed:e<0&&(e=1-this.scrollZoomSpeed),0!==e&&this.handleScrollPinchZoom(e),this.emit(ta,{zoom:e,type:"zoom",zoomLevel:this.zoomLevel})):this.$app.config.useShortcutKeys&&this.flyLocalDirection(new THREE.Vector3(0,0,-e).normalize())},e.handleInputStart=function(e,t,n,i){var o,r={x:e,y:t};i||(r=ge.handelPadding(e,t,this.domElement)),ge.convertScreenPositionToNDC(r.x,r.y,this.mouse,this.domElement),ge.convertScreenPositionToNDC(r.x,r.y,this.mouseAtMouseDown,this.domElement),this.mouseCouldBeClickToMove=!0,this.mouseDown=!0,this.updateIntersect();this.emit("pointerStart",{consume:function(){o=!0},getConsumed:function(){return o}}),o||(this.EditPanoVideo&&this.EditPanoVideo.editing?this.EditPanoVideo.dealPointerDown():this.EditPanoMosaic&&this.EditPanoMosaic.editing?this.EditPanoMosaic.dealPointerDown():(this.model.transformControls&&this.model.transformControls.handleDragStart(),this.model.transformTool&&this.model.transformTool.handleDragStart()),this.paintEditor&&this.paintEditor.painting&&this.paintEditor.dealPointerDown(),this.aimQuaternion=null)},e.handleInputMove=function(e,t,n){this.isTouchEvent=n;var i,o=ge.handelPadding(e,t,this.domElement);ge.convertScreenPositionToNDC(o.x,o.y,this.mouse,this.domElement),this.mouseAtMouseDown.distanceTo(this.mouse)>.01&&(this.mouseCouldBeClickToMove=!1,this.couldBeLongTap=!1,clearTimeout(this.mouseDownTimer),this.model.transformControls&&this.model.transformControls.handleDragging(),this.model.transformTool&&this.model.transformTool.onPointerMove()),this.EditPanoMosaic&&this.EditPanoMosaic.editing&&this.EditPanoMosaic.dealPointerMove(),this.paintEditor&&this.paintEditor.painting&&this.paintEditor.dealPointerMove(o);this.emit("pointerMove",{consume:function(){i=!0},getConsumed:function(){return i}}),i||(this.mouseLastMoveTime=Date.now(),this.reticule.move(e,t,n))},e.handleInputEnd=function(e,t,n,i){var o,r=this;if(this.isTouchEvent=n,this.mouseDown=!1,this.cameraControls.controls[xt.PANORAMA].emit("interaction.direct"),!n&&this.couldBeLongTap)return!0;this.model.transformControls&&this.model.transformControls.handleDragEnd(),this.model.transformTool&&this.model.transformTool.handleDragEnd(),this.EditPanoVideo&&this.EditPanoVideo.dealPointerUp(),this.EditPanoMosaic&&this.EditPanoMosaic.dealPointerUp(),this.paintEditor&&this.paintEditor.painting&&this.paintEditor.dealPointerUp();if(this.emit("pointerUp",{consume:function(){o=!0},getConsumed:function(){return o}}),!o){if(this.handleLongTap())return!0;if(this.mouseCouldBeClickToMove){if(this.flying)return this.flyToPanoClosestToMouse();//!0; 改for panoTask
- if(this.chosenMeasureRuler&&this.chosenMeasureRuler.showOptionLabel(!1),this.linkEditor&&this.linkEditor.setPanoVisible){var a=[].concat(H(this.linkEditor.actionIcons),H(this.linkEditor.footIcons)).filter((function(e){return e.pano.floorIndex==r.model.currentFloor.floorIndex}));if(this.intersect=this.getMouseIntersect(null,a),this.intersect&&this.intersect.object.visible){var s=this.intersect.object;if("ActionIcon"!=s.type||this.linkEditor.activePano||"floor"!=s.footIcon.status)this.linkEditor.dealPanoVisible(this.intersect.object.name,this.intersect.object);else{var l=this;this.$app.WalkManager.emit("walkManager.floorPointHide",(function(){l.linkEditor.dealPanoVisible(l.intersect.object.name,l.intersect.object)}))}}return}if(this.linkEditor&&this.linkEditor.setTagVisible)return void(this.linkEditor.tagVsetting&&this.intersect&&this.intersect.object.visible&&this.linkEditor.dealTagVisible(this.linkEditor.tagVsetting,this.intersect.object.name));var c,u=this.getMouseIntersect(null,this.measureRulers.filter((function(e){return"active"==e.state})).map((function(e){return e.boldLine})));if(u&&u.object.parentRuler)return void u.object.parentRuler.showOptionLabel(!0,u.point);if(this.EditOverlay&&this.EditOverlay.isAdding)return void(this.intersect&&this.EditOverlay.addOverlay({intersect:this.intersect}));if(this.OverlayManager.hoveringPlane)return void this.OverlayManager.clickOverlay(this.OverlayManager.hoveringPlane,{event:i});if(this.intersect&&this.billboardManager&&this.billboardManager.isAdding)return this.billboardManager.startInsertion({intersect:this.intersect});if(this.emit("click",{intersect:this.intersect,consume:function(){c=!0},getConsumed:function(){return c},raycaster:this.raycaster}),c)return;if(this.currentPano&&this.is360View(this.mode,this.currentPano))return;if(this.cameraControls.activeControl&&this.cameraControls.activeControl.emit(Qa,this.isTouchEvent?"touch":"mouse"),this.history.invalidate(),this.intersect)return this.flyToPanoClosestToMouse();if(this.mode===xt.PANORAMA){var h=this.closestPanoInDirection(this.getMouseDirection());return h?this.flyToPano({pano:h}):this.bump(this.getMouseDirection())}}this.intersect&&this.closestPano&&this.closestPano.hoverOff(this.mode)}},e.handleLongTap=function(){if(this.couldBeLongTap&&(!this.isPanoHover||this.mode!==xt.PANORAMA))return this.cameraControls.activeControl&&this.cameraControls.activeControl.emit(Ja,"touch"),!0},e.start=function(e){var t=this,n=e.mode,i=e.pano,o=e.position,r=e.quaternion,a=e.tag,s=e.quickstart,l=oe();this.updateModelDependentData(),this.updateFromControls();var c=this.is360View(n,i);return!this.model.outsideAllowed()||c||s?this.startInside(i,o,r,a,l):(this.startOutside(e,l),this.once(ua,(function(e){t.emit(ha,c,e,a),t.started=!0}))),this.compass=new Tl(this),this.linkEditor=new Ws(this),this.labelManager=new sl(this),l},e.startOutside=function(e,t){var n=e.mode,i=e.pano,o=e.position,r=e.quaternion,a=e.zoom,s=e.floorVisibility,l=e.tag;this.emit(pa,at[n].transitionTime),this.isOutsideMode(n)?(this.model.warpDestFloors(s,!0),Ae.cancelById(at.freeze.FlyToViewFloor),n===xt.FLOORPLAN?this.floorplanMode(o,r,a):this.dollhouseMode(o,r),t.resolve(!1)):this.startInsideWithFlyin(i,o,r,l,t),this.beforeChangeMode(null,n)},e.startInside=function(e,t,n,i,o){o=o||oe(),this.currentPano=e;var r=e&&!e.isAligned();if(t=r?e.position:t||e.position,n=n||e.quaternion,e){var a=this.startInside.bind(this,e,t,n,i,o);if(this.checkAndWaitForPanoLoad(e,"high","low",this.basePanoSize,a))return}this.modeTran="panorama-panorama",this.beforeChangeMode(null,xt.PANORAMA,this.currentPano,0),this.afterChangeMode(null,xt.PANORAMA),e.enter(),this.mode=xt.PANORAMA,e.floor.enter(this.mode),this.emit(aa,this.currentPano,this.currentPano),this.switchCameraMode(this.mode,n),this.emit(da,r);var s=this.$app.core.get("PanoVideoRenderer");return s.setMuted(!0),s.activatePanorama(this.currentPano),o.resolve(!0),o},e.startInsideWithFlyin=function(e,t,n,i,o){if(o=o||oe(),this.dollhouseMode(),!e)return ft.warn("Player.startInsideWithFlyin() -> targetPano is invalid."),o.resolve(!1),o;t=t||e.position;var r=n||this.cameraControls.activeControl.camera.quaternion,a=e.position;return this.fitDollhouse(a,t,r),setTimeout(function(t){this.cameraControls.activeControl&&(this.cameraControls.activeControl.maxDistance=t);var i={mode:xt.PANORAMA,pano:e,quaternion:n,callback:function(){this.emit(la),o.resolve(!0)}.bind(this)};this.flyToNewMode(i)}.bind(this,this.cameraControls.activeControl.maxDistance),at.startupFlyinDelay),o},e.checkAndWaitForPanoLoad=(i={},r={},a={},function(e,t,n,o,s,l,c,u,h,d){if(function(e){if(i.hasOwnProperty(e.id)&&i[e.id]&&performance.now()-r[e.id]<5e3)return!0}(e))return e.id,a[e.id]=s,!0;var p=function(t,n,o){De.delayOneFrame(function(){i[t]=!1,a[e.id]&&a[e.id](n,o),a[e.id]=null}.bind(this))}.bind(this,e.id),f=function(e,t){De.delayOneFrame(function(){this.clearPanosTaskList(),i[e]=!1,l&&l(t)}.bind(this))}.bind(this,e.id);try{return null!=u||(u=!0),e.tiled?i[e.id]=this.checkAndWaitForTiledPanoLoad(e,o,p,f,c,u,h,d):i[e.id]=this.checkAndWaitForWholePanoLoad(e,t,n,p,u),i[e.id]&&(r[e.id]=performance.now(),a[e.id]=s),i[e.id]}catch(t){throw i[e.id]=!1,r[e.id]=performance.now()-5e3,t}}),e.checkAndWaitForWholePanoLoad=function(e,t,n,i,o){if(!e)throw new BasicException("Player.checkAndWaitForWholePanoLoad() -> Cannot load texture for null pano.");return o&&this.model.waitForLoad(e,(function(){return e.isLoaded(n)})),!e.isLoaded(t)&&(e.loadCube(t).done(i),!0)},e.checkAndWaitForTiledPanoLoad=(s=new THREE.Vector3,function(e,t,n,i,o,r,a,l){if(!e)throw new BasicException("Player.checkAndWaitForTiledPanoLoad() -> Cannot load texture for null pano.");if(s.copy(to.FORWARD),this.getDirection(s),!e.isLoaded(t))return r&&this.model.waitForLoad(e,(function(){return e.isLoaded(t)})),e.loadTiledPano(t,s,null,a,l).done(function(e,t){n&&n(e,t)}.bind(this)).fail(function(e){i&&i(e)}.bind(this)).progress(function(e,t,n){o&&o(e,t,n)}.bind(this)),!0}),e.switchCameraMode=function(e,t,n,i,o){var r,a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{},s=this.cameraControls.controls[e],l=s.camera;if(e==xt.PANORAMA)l.position.copy(this.currentPano.position),r=t?to.FORWARD.clone().applyQuaternion(t):this.getDirection().setY(0).normalize(),s.lookAt(r.add(l.position));else if(n&&s.target.copy(n),i&&l.position.copy(i),e==xt.DOLLHOUSE){if(!i&&!n){if(a.dontFitScreen&&this.mode===xt.PANORAMA)i=this.position.clone(),this.mode===xt.PANORAMA?i.add(new THREE.Vector3(0,6,0)).add(this.getDirection().multiplyScalar(-10)):i.add(to.DOWN.clone().applyQuaternion(this.quaternion).multiplyScalar(6)).setY(6);else{var c;this.mode===xt.PANORAMA?(s.target.copy(this.model.center).setY(this.model.boundingBox.min.y+2),c=this.getDirection().negate().setY(1).normalize()):(s.target.copy(this.target.clone().setY(this.model.boundingBox.min.y+2)),c=to.DOWN.clone().applyQuaternion(this.quaternion).setY(1).normalize());var u=s.suitableDistance;c.multiplyScalar(u),i=s.target.clone().add(c)}l.position.copy(i)}}else if(e==xt.FLOORPLAN){if(n||s.target.copy(this.model.center).setY(0),!i){var h="panorama"==this.mode?.7*this.cameraControls.controls.dollhouse.suitableDistance:THREE.MathUtils.clamp(this.camera.position.y,1,at.floorplan.cameraHeight);h=Math.max(h,this.model.boundingBox.max.y+_e.orthoNear+_e.planeHeightShift+1),l.position.copy(this.model.center).setY(h),s.rotateToView(this.model.size,this.getDirection())}o?s.currentScale=s.absoluteScale=o:a.fitBoundSize?s.zoomToContain(this.fitBoundSize):s.zoomToContain(this.model.size)}s.update(0)},e.update=function(){var e,t={},n=2;return function(i){if(this.updatePersistentZooming(i),this.updateFromControls(i),this.lastFrameChanged=!1,this.hasChanged(t)&&(this.lastFrameChanged=t.cameraChanged3?"level3":t.cameraChanged2?"level2":!!t.cameraChanged&&"level1",this.lastChangeTime=Date.now(),(!this.mouseDown&&this.containsMouse||t.vrHandlerMoved)&&this.updateIntersect(),this.emit(fa,t),t.cameraChanged&&(this.compass&&this.compass.update(this.quaternion),this.model.floorLogos.updateFloorlogo(this.camera&&this.camera.quaternion,this),this.linkEditor&&(this.linkEditor.setTagVisible||this.linkEditor.setPanoVisible)&&this.linkEditor.updateFootIconSize(),this.updateLabelZIndex(["dollLabels","doorLabels"]),this.chosenMeasureRuler&&this.chosenMeasureRuler.updateOptionPos(),e=!0),(t.cameraChanged||t.floorChanged||t.allFlVisiChanged)&&this.dollLabels.concat(this.planLabels).concat(this.doorLabels).concat(this.measureRulers).concat(this.polygonmarkLabels).forEach((function(e){e.update()}))),e)if(0==n--)al.updateCameraDir(this),this.setAnimateMakerPano(),n=15,e=!1;else if(n%Math.round(5)==0&&this.model.supportsTiles){var o=this.panosTaskList.length>1?this.panosTaskList.map((function(e){return e.pano})):[];this.updateTileDownloader(o),this.updatePanoRenderer(),this.updateZoomPano()}this.paintEditor&&this.paintEditor.painting&&this.paintEditor.update(),this.reticule.update(),this.cachedPanoCandidates&&at.navigation.panoScores&&this.model.panos.showPanoScores(this.cachedPanoCandidates),this.updateControlLocks(),this.emit("update",{x:this.position.x,y:this.position.z,lon:this.cameraControls.controls.panorama.lon,hasChanged:t,mode:this.mode,lastFrameChanged:this.lastFrameChanged})}}(),e.updateLabelZIndex=function(e){var t=this;e.forEach((function(e){"dollLabels"==e&&"dollhouse"!=t.mode||"doorLabels"==e&&"panorama"!=t.mode||t[e].sort((function(e,t){return t.pos2d.z-e.pos2d.z})).forEach((function(e,t){e.elem.style.zIndex=t}))}))},e.updatePersistentZooming=function(e){1===this.zooming?this.zoomBy(1+this.zoomSpeed*e):-1===this.zooming&&this.zoomBy(1-this.zoomSpeed*e)},e.updateControlLocks=function(){if(this.currentPano&&this.model.supportsTiles){var e=this.cameraControls.controls[xt.PANORAMA];e.locked=e.lockedForce||at.vrEnabled||!this.currentPano.highestFullTileRenderOpCompleted&&this.currentPano.lockUntilRenderingComplete}},e.updatePanoRenderer=function(){var e=new THREE.Vector3;return function(t){var n=this.nextPano||this.currentPano;e.copy(to.FORWARD),this.getDirection(e),this.$app.core.get("PanoRenderer").hasQueuedTiles()&&n&&this.$app.core.get("PanoRenderer").updateDirection(e)}}(),e.updatePreRendering=function(){var e={};return function(t){if(1===at.tiling.preRenderTourPanos&&this.preRenderingEnabled){var n=this.nextPano||this.currentPano;if(n&&t&&t.length>1){var i=t.findIndex((function(e){if(e.id===n.id)return!0}));if(i>=0&&i+1<t.length){var o=t[i+1];o.isLoaded(this.basePanoSize)||e[o.id]||(window.setTimeout(function(t){this.checkAndWaitForPanoLoad(t,"high","low",this.basePanoSize,null,null,null,!1,!1,!1),window.setTimeout(function(t){e[t.id]=!1}.bind(this,t),at.tiling.panoPreRenderRepeatDelay)}.bind(this,o),at.tiling.panoPreRenderDelay),e[o.id]=!0)}}}}}(),e.enablePreRendering=function(){this.preRenderingEnabled=!0},e.updateTileDownloader=function(){var e=new THREE.Vector3;return function(t){var n=this.nextPano||this.currentPano;if(n){var i=De.timeMeasuring.collection.loop.median;this.lowTile=this.$app.config.mobile&&"level1",this.lowTile&&(i>10||this.model.texSizeBlock*i>500)&&(this.lowTile="level2"),e.copy(to.FORWARD),this.getDirection(e),this.$app.core.get("TileDownloader").tilePrioritizer.updateCriteria(n,this.position,e,t.length>0?t:null),this.$app.core.get("TileDownloader").processPriorityQueue=!0}}}(),e.updateFromControls=function(e){null!=e||(e=0);var t=this.cameraControls.activeControl;t&&(t.update(e),this.VR&&this.VR.webxr.entered||this.quaternion.copy(t.camera.quaternion),this.position.copy(t.camera.position),this.target.copy(t.target),t.camera.updateProjectionMatrix(),this.camera.projectionMatrix.copy(t.camera.projectionMatrix),this.camera.projectionMatrixInverse.copy(t.camera.projectionMatrixInverse),this.emit("updateFromControls",this,e)),this.camera.position.copy(this.position),this.camera.quaternion.copy(this.quaternion),this.camera.updateMatrix(),this.camera.updateMatrixWorld()},e.updateIntersect=function(){var e=this,t=this.flying,n=this.isOutsideMode()&&this.cameraControls.controls[this.mode].isEngaged(),i=Ae.getById(at.freeze.LookTransition);if(t||n||this.isTouchEvent||i.length&&i[0].running,this.linkEditor&&this.linkEditor.footIcons&&(this.linkEditor.setPanoVisible||this.linkEditor.setTagVisible))return this.intersect=this.getMouseIntersect(null,this.linkEditor.footIcons.filter((function(e){return e.visible&&!e.otherFloorLink}))),void(this.intersect?Wr.add("hoverFootMarker"):Wr.remove("hoverFootMarker"));if(!this.$app.Camera.monitor.control.cameras.find((function(e){return e.isWatching}))){var o,r=function(){o=!0},a=function(){return o},s=[];if(this.emit("collectIntersectMesh",s,{consume:r,getConsumed:a}),!o){var l=this.panoMarkers.filter((function(t){return t.visible&&so.filters.isNeighbourPanoTo(e.currentPano)(t.pano)})),c=this.model.panos.list.filter((function(e){return e.flagSpot&&!e.flagSpot.hidden})).map((function(e){return e.flagSpot.disc}));if(this.intersect=this.getMouseIntersect(null,l.concat(c)),this.intersect||(s.push.apply(s,H(this.getColliders())),De.timeMeasuring.addTimeMark("getMouseIntersect","start"),this.intersect=this.getMouseIntersect(null,s),De.timeMeasuring.addTimeMark("getMouseIntersect","end"),this.emit("judgeIntersect",this.intersect,{consume:r,getConsumed:a}),!o)){if(this.intersect&&this.updateClosestPano(this.intersect),this.intersectLabel&&this.intersect){var u=["pos: "+ge.toPrecision(this.intersect.point.toArray(),3),"nor: "+ge.toPrecision(this.intersect.normal.toArray(),2),"dis: "+ge.toPrecision(this.intersect.distance,2)];this.intersectLabel.setText(u),this.intersectLabel.setPos(this.intersect.point)}this.emit("intersect",this.intersect),this.closestPano||this.closestPanoInDirection(this.getMouseDirection())||this.reticule.alwaysShow?(this.reticule.updatePosition(this.position,this.intersect),at.navigation.panoScores&&!at.navigation.mouseDirection&&this.closestPanoInDirection(this.getDirection())):this.reticule.hide()}}}},e.getMouseDirection=function(e){if(this.VR&&this.VR.webxr.entered)return this.VR.webxr.getHandlerDir();e=e||this.mouse;var t=new THREE.Vector3(e.x,e.y,-1).unproject(this.camera);return new THREE.Vector3(e.x,e.y,1).unproject(this.camera).sub(t).normalize()},e.getColliders=function(){var e=[];return this.is360View(this.mode,this.currentPano)||(this.$app.config.mobile&&this.mode==xt.PANORAMA||(e=this.model.floors.reduce((function(e,t){return t.hidden?e:e.concat(t.collider.children)}),[])),this.mode===xt.PANORAMA&&e.push(this.model.skybox)),e},e.getMouseIntersect=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=n.recursive,o=void 0!==i&&i,r=n.type;if(e=e||this.mouse.clone(),t||(t=this.getColliders()),this.VR&&this.VR.webxr.entered)this.VR.webxr.setRayCaster(this.raycaster);else{var a=new THREE.Vector3(e.x,e.y,-1).unproject(this.camera);this.raycaster.set(a,this.getMouseDirection(e))}this.raycaster.camera=this.camera;var s=this.raycaster.intersectObjects(t,o);if(0===s.length)return null;if("getAll"==r)return s;var l=s[0];if(l.face){l.normal=l.face.normal.applyQuaternion(l.object.quaternion);var c=this.position.clone().sub(l.point);c.dot(l.normal)<0&&l.normal.negate(),this.currentPano?l.onFloor=l.point.y<this.position.y-.5*this.currentPano.height:l.onFloor=l.point.y<this.position.y-.5,l.horizontal=l.normal.y>.8}return l},e.updateClosestPano=function(e){var t=this;if(this.mode!==xt.TRANSITIONING){var n,i=[so.filters.isPanoAligned()];if(!this.flying&&(e&&(this.panoMarkers.includes(e.object)||this.model.panos.list.find((function(t){return t.flagSpot&&t.flagSpot.disc==e.object})))&&(n=e.object.pano),!n)){if(this.mode===xt.PANORAMA){if(!this.currentPano)return;i.push(so.filters.not(this.currentPano)),i.push(so.filters.isNeighbourPanoTo(this.currentPano)),i.push(so.filters.inFloorDirection(this.currentPano.floorPosition,this.getDirection(),.25)),i.push(so.filters.isCloseEnoughTo(e.point,at.panoFloorClickRadius)),i.push(so.filters.isNotBehindNormal(e.point,e.normal))}else i.push((function(e){return t.linkEditor.checkHasNeighbor(e)||e==t.$app.core.get("Scene").firstView.pano})),i.push(so.filters.isOnVisibleFloor()),this.mode!==xt.FLOORPLAN&&i.push(so.filters.inDirection(this.position,this.getDirection(),.25));n=this.model.panos.find(i,[so.sortFunctions.floorDistanceToPoint(e.point)])}n!==this.closestPano?(n&&(this.isPanoHover=!0),this.emit(sa,this.closestPano,n,this.mode),this.closestPano=n):this.isPanoHover=!1}},e.dollhouseMode=function(e,t){this.modeTran="dollhouse-panorama",this.emit(ra,this.mode,xt.DOLLHOUSE),this.mode=xt.DOLLHOUSE,this.cameraControls.controls[xt.DOLLHOUSE].reset();var n=new THREE.Vector3(this.model.center.x,0,this.model.center.z),i=new THREE.Vector3(15,10,15);if(e&&t){var o=to.FORWARD.clone().applyQuaternion(t),r=(e=this.model.center.clone().sub(e)).dot(o);r>0?n=o.clone().multiplyScalar(r).add(e):ft.warn("Tried to initiate dollhouse mode that wasn'quaternion looking at the model",e,t)}this.cameraControls.controls[xt.DOLLHOUSE].resetRanges(0,!0),this.cameraControls.controls[xt.DOLLHOUSE].target.copy(n),this.cameraControls.cameras[xt.DOLLHOUSE].position.copy(i),this.updateFromControls(),this.model.alpha=1,this.model.skybox.material.uniforms.opacity.value=0},e.insideMode=function(e,t){var n=oe(),i=t||null;if(this.mode!==xt.PANORAMA&&this.mode!==xt.TRANSITIONING)e||((!this.currentPano||this.model.currentFloor&&this.currentPano.floor!=this.model.currentFloor)&&(e=this.getFloorPanoByScore(null,this.model.currentFloor)),e||(e=this.currentPano)),this.flyToNewMode({mode:xt.PANORAMA,pano:e,callback:i}).done(n.resolve.bind(n)).fail(n.reject.bind(n));else{var o="Cannot change mode during mode transition";this.mode===xt.PANORAMA&&(o="Already in panorama mode"),n.reject(o)}return n.promise()},e.fitDollhouse=function(e,t,n){var i=this.model.boundingBox.max.y,o=to.FORWARD.clone().applyQuaternion(n);n=o.clone().add(e),this.cameraControls.activeControl.target.copy(n),this.cameraControls.activeControl.camera.position.set(0,2.4*i,0).add(e).add(o.multiplyScalar(-10))},e.floorplanMode=function(e,t,n,i){this.mode=xt.FLOORPLAN;var o=this.cameraControls.controls[xt.FLOORPLAN];o.reset();var r=e||this.model.center;if(o.target.copy(r).setY(0),o.camera.position.copy(r).setY(at.floorplan.cameraHeight),n?(o.currentScale=n/(this.domElement.clientWidth/this.domElement.clientHeight),o.absoluteScale=o.currentScale):o.zoomToContain(this.model.size,i),t){var a=to.LEFT.clone().applyQuaternion(t);o.rotateLeft(-Math.atan2(a.x,a.z))}else o.rotateToView(this.model.size,this.getDirection());o.update(0)},e.getAimToNextPano=function(e,t,n){var i;if(!t&&!n){var o={importance:0,aim:null};this.emit("ifFocusPoint",o),o.aim&&o.importance>=3&&(t=o.aim)}if(!t)if(e.panoVideo)i=!0,t=e.position.clone().add(e.panoVideo.dir);else if(i=!t&&e.hasVideo&&this.$app.core.get("PanoVideoRenderer")&&this.$app.core.get("PanoVideoRenderer").ifEnable())if(e.videoInfo.dir)t=e.position.clone().add(e.videoInfo.dir);else{var r=(new THREE.Quaternion).setFromAxisAngle(new THREE.Vector3(0,1,0),THREE.MathUtils.degToRad(this.model.supportsTiles?90:180));t=to.FORWARD.clone().applyQuaternion(r.multiply(e.quaternion)).add(e.position)}return{aimQua:n=t?pt.getQuaByAim(t,e.position):n,hasVideo:i}},e.flyToPano=function(e,t){var n=this;if(!this.locked){"number"!=typeof e&&"string"!=typeof e||(e={pano:this.model.panos.index[e]});var i=e.pano,o=e.lookAtPoint,r=e.quaternion,a=e.duration,s=e.aimDuration,l=e.rotSpeed;e.maxDistanceOverride,e.skipWarpingCheck,e.easeType;var c=null,u=null,h=e.zoomLevel||(at.zoom.zoomToDefaultWhenToPano?1:this.zoomLevel),d=e.cancelLookFun,p=e.checkAlone;if(t=t||e.callback,e.quaOri=this.quaternion.clone(),"number"==typeof i&&(i=e.pano=this.model.panos.index[i]),!this.EditPanoMosaic||!this.EditPanoMosaic.editVideo||this.EditPanoMosaic.editVideo.pano==i){if(p&&o&&0==i.neighbourUUIDs.filter((function(e){return e!=i.id})).length){var f=this.model.panos.closestPanoTowardPoint({point:o,require:[function(e){return e.neighbourUUIDs.filter((function(t){return t!=e.id})).length>0}]});f&&(i=f,e.pano=i)}if(!e.gotQua){var m=this.getAimToNextPano(i,o,r);r=m.aimQua;m.hasVideo,e.quaternion=r,e.gotQua=!0}if(this.mode===xt.PANORAMA){var v=this.is360View(this.mode,i)||this.is360View(this.mode,this.currentPano);if(this.judgePanoTask(e,v)){if(i&&(c=De.deepExtend(e),u=function(){De.delayOneFrame(function(){this.panosTaskList[0]==c&&(c.retry=!0,this.flyToPano(c,t))}.bind(this))}.bind(this)),W.mobile?(this.$app.core.get("PanoRenderer").switchPanoQuality(i,{size:1024}),"level2"==this.lowTile&&(i.tiledPanoRenderTarget||this.$app.core.get("PanoRenderer").switchPanoQuality(this.currentPano,{size:1024}))):i.tiledPanoRenderTarget||this.$app.core.get("PanoRenderer").switchPanoQuality(i,{size:2048}),!i||!this.checkAndWaitForPanoLoad(i,"high","low",this.basePanoSize,u)){console.log("[flytopano]",i&&i.id);var g=e.finalCallback=function(n){this.nextPanoTask(e,n),t&&t(n)}.bind(this);this.currentPano||(this.currentPano=i);var y=a;if("number"!=typeof a&&(y=this.computeDuration(e)),e.duration=y,e.pano.id,this.panosTaskList.map((function(e){return e.pano.id})),this.zoomLevel!==h)switch(at.zoom.transitionStyle){case 1:this.smoothZoomLevelTo(h,y/2);break;case 2:return c=De.deepExtend(e),u=this.flyToPano.bind(this,c,t),void this.smoothZoomLevelTo(h,at.zoom.restoreTime*(this.zoomLevel-h),u)}if(r){var A=e.quaOri.clone(),E=new THREE.Vector3;if(Ae.cancelById(at.freeze.LookTransition),i===this.currentPano){var b=to.FORWARD.clone().applyQuaternion(e.quaOri),w=to.FORWARD.clone().applyQuaternion(r),x=b.angleTo(w),C=function(){g(!0),n.emit("flytopano.rotateEnd",{})};return this.flyRotate=!0,null!=s||(s=1*Math.sqrt(x)/(l||at.tags.navigate.rotateSpeedFactor)*1e3),void Ae.start(function(t){if(this.mode!=xt.PANORAMA)return Ae.cancelById(at.freeze.LookTransition),void C();A.copy(e.quaOri),St.quaternion(A,r)(t),E.copy(pt.getAimByQua(A,this.cameraControls.activeControl.camera.position)),this.cameraControls.activeControl.lookAt(E)}.bind(this),s,C,0,ye[at.transition.movementEasing],null,at.freeze.LookTransition,d)}}if(i===this.currentPano||this.flying)return this.currentPano,this.flying,void g();this.flying=!0,this.position.clone();var T=this.currentPano;if(this.nextPano=i,i.marker&&De.updateVisible(i.marker,"dontCoverFloorlogo",!1),this.emit(aa,this.currentPano,i),this.emit(ca,{panoId:i.id,quaternion:r,lastPanoId:T.id,type:"flyToPano",duration:e.duration,isTagFlying:e.isTagFlying}),this.model.currentFloor=i.floor,this.doorLabels.forEach((function(e){return e.updateVisible(i)})),this.model.fadePanoMarkers(0,0,{hideVideoFlag:!0}),v)return void this.fade360View(this.cameraControls.activeControl.camera,{pano:i,aim:o,aimQua:r},(function(){n.afterFlyToPano(e)}));this.model.floorLogos.changefloorLogoOpa({index:0,opa:0,dur:y,delay:.7}),this.model.floorLogos.secondLogo.position.copy(i.floorPosition.clone().sub(this.model.position)),De.updateVisible(this.model.floorLogos.secondLogo,"flyToPano",!0),this.model.floorLogos.changefloorLogoOpa({index:1,opa:1,dur:250}),r&&!v&&(this.flyingWithRot=!0,e.aimQua=r),e.chunkProgress=this.judgeHideWall(i),this.startTransition(e)}}else t&&t(!1)}else this.flyToNewMode({mode:xt.PANORAMA,pano:i,duration:a,quaternion:r,callback:t})}}},e.startTransition=function(e){var t=this;e.easeFun||(e.easeFun=ye.linearTween);var n=e.progress||0,i=this.$app.resource.num+at.freeze.FlyToPano;Ae.cancelById(i);var o=this.currentPano.position.distanceTo(e.pano.position),r=THREE.MathUtils.clamp(1-2/o,0,.9),a=e.quaOri.clone(),s=new THREE.Vector3;Ae.start((function(l,c){var u,h=Ae.getById(i)[0],d=n+l*(1-n);if(u=1!=l&&0!=l?e.currentSpeed=(d-e.progress)*o/c:e.currentSpeed||0,e.progress=d,l>0&&l<1&&c){if(e.easeFun==ye.linearTween&&e.flySpeed&&u>0&&!ge.closeTo(u,e.flySpeed)&&e.flySpeed){var p=e.flySpeed/u;!function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:.08;Math.abs(e-1)>n&&(e=e>1?1+n:1-n),Ae.adjustSpeed(i,e),Ae.adjustSpeed(at.freeze.LookTransition,e)}(p,"渐变匀速","constant"==e.easeType?p-1:.01)}if(d>r&&1==e.flyCount&&e.easeFun==ye.linearTween&&1==t.panosTaskList.length){e.easeFun=ye.easeOutSine;var f=(1-d)*o;e.duration=Math.PI/2*f/u,e.duration=Math.max(e.duration,at.transition.flyTime-h.duration*d),e.ignoreFirstFrame=!1,t.startTransition(e)}d>.2&&t.panosTaskList.length>1&&!t.panosTaskList[1].pano.tiledPanoRenderTarget&&(t.$app.core.get("PanoRenderer").switchPanoQuality(t.panosTaskList[1].pano,{useIdel:!0,size:"level2"==t.lowTile?512:1024}),t.checkAndWaitForPanoLoad(t.panosTaskList[1].pano,"low","low",t.basePanoSize,(function(){})))}t.model.skybox.material.uniforms.progress.value=d,t.emit("updataProgress",d),e.chunkProgress&&t.model.chunks.forEach((function(e){return e.materialInside.uniforms.progress.value=d})),isNaN(d)&&(console.error("progress isNaN",d,l,n,c,e.duration,e),Ae.cancelById(i));var m=t.currentPano.position.clone(),v=e.pano.position.clone();St.vector(m,v)(d),t.cameraControls.cameras[xt.PANORAMA].position.copy(m),e.aimQua&&(a.copy(e.quaOri),St.quaternion(a,e.aimQua)(d),s.copy(pt.getAimByQua(a,t.cameraControls.activeControl.camera.position)),t.cameraControls.activeControl.lookAt(s))}),e.duration,this.afterFlyToPano.bind(this,e),0,e.easeFun,"chunkFly",i,(function(){t.afterFlyToPano(e,!0)}),e.ignoreFirstFrame),e.flyCount++},e.nextPanoTask=function(e,t){if(e==this.panosTaskList[0]&&this.panosTaskList.splice(0,1),t&&this.panosTaskList.length){var n=this.panosTaskList[0];n.dealingTask=!0;var i=n.pano.position.distanceTo(e.pano.position),o=e.currentSpeed,r=this.computeDuration(n);o=Math.max(.002,o),n.duration=i/o,n.quaternion&&(n.duration=r),n.flySpeed=i/r,this.flyToPano(n)}},e.judgePanoTask=function(e,t){e.progress=e.progress||0,e.flyCount=0;var n=this.panosTaskList.length,i=this.panosTaskList[n-1];if(this.dontInterruptPanoTask)return!!e.dealingTask;if(!e.retry&&!e.dealingTask){var o=this.panosTaskList[0];if((e.quaternion||t)&&(e.canConstantlyWalk=!1),i&&i.pano.tileError&&(this.clearPanosTaskList(),n=0,i=void 0),0!=n&&!i.canConstantlyWalk&&e.pano!=this.currentPano)return;if(n>0){if(this.panosTaskList.some((function(t){var n;return t.pano==e.pano&&(!t.lookAtPoint&&!e.lookAtPoint||(null===(n=t.lookAtPoint)||void 0===n?void 0:n.equals(e.lookAtPoint)))})))return;if(n>1)return;if(0==o.flyCount)return}if(this.panosTaskList.push(e),n++,e.pano.id,n>1){if(o.easeFun!=ye.linearTween){var r=this.currentPano.position.distanceTo(o.pano.position),a=(1-o.progress)*r,s=Math.max(o.currentSpeed,.002),l=a/s;isNaN(l)&&console.error("newDur isNaN",s,o.progress,o),o.easeFun=ye.linearTween,o.flySpeed=r/this.computeDuration(o),o.duration=l,this.startTransition(o)}return}}return!0},e.judgeHideWall=function(e){if(this.model.chunks.forEach((function(e){return De.updateVisible(e,"isBlock",!0)})),this.currentPano.noBlockPanos.includes(e.id));else if(this.currentPano.blocks[e.id])this.hideWalls=this.currentPano.blocks[e.id],this.hideWalls.forEach((function(e){De.updateVisible(e,"isBlock",!1)}));else{var t=this.currentPano.origin.clone(),n=e.origin.clone(),i=n.clone().sub(t).normalize().multiplyScalar(.1),o=t.clone().sub(i),r=n.clone().add(i),a=pt.ifIntersectChunks(o,r,this.model,{throughWidth:.08,meshes:this.model.chunks});a?(this.hideWalls=a.map((function(e){return e.object.visible=!1,e.object})),this.currentPano.blocks[e.id]=this.hideWalls.slice(0)):this.currentPano.noBlockPanos.push(e.id)}return!0},e.afterFlyToPano=function(e,t){this.currentPano.isAligned()&&(this.lastPano=this.currentPano),this.currentPano!==e.pano&&(this.currentPano.exit(),e.pano.enter(),this.currentPano=e.pano,this.nextPano=null,this.path.placeCpm(),this.mode==xt.PANORAMA&&(this.path.fadeOutCpm(at.path.fadeOutTime),this.paintEditor&&this.paintEditor.updatePanoPaint(this.currentPano.id,this.currentPano.id)),e.pano.marker&&De.updateVisible(e.pano.marker,"dontCoverFloorlogo",!0)),t||(this.mode==xt.PANORAMA&&(this.flying=!1,this.emit(ua,{targetPosition:e.pano.position,currentPosition:e.pano.position,targetPano:e.pano,currentPano:this.currentPano}),this.model.floorLogos.firstLogo.position.copy(this.model.floorLogos.secondLogo.position),this.model.floorLogos.changefloorLogoOpa({index:0,opa:1,dur:0}),De.updateVisible(this.model.floorLogos.secondLogo,"flyToPano",!1),this.model.chunks.forEach((function(e){e.materialInside.uniforms.progress.value=1,De.updateVisible(e,"isBlock",!0)})),1==this.panosTaskList.length&&this.$app.core.get("PanoRenderer").switchPanoQuality(this.currentPano,{size:2048})),this.model.fadePanoMarkers(),this.doorLabels.forEach((function(e){return e.updateVisible()})),this.lastFlyPanoDoneTime=Date.now(),e.finalCallback&&e.finalCallback(!0))},e.fastToPano=function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!this.flying&&!this.isWarping()){var n=t.pano||this.model.panos.index[t.panoId];if(!n)return console.error("fastToPano pano 无");this.position.clone();var i=this.currentPano,o=t.duration||1500;this.path.warpDestPano=n;var r=function(){e.waitingToWarp=!1,e.fastToPano(t)};W.mobile?this.$app.core.get("PanoRenderer").switchPanoQuality(n,{size:1024}):n.tiledPanoRenderTarget||this.$app.core.get("PanoRenderer").switchPanoQuality(n,{size:2048}),this.checkAndWaitForPanoLoad(n,"high","low",this.basePanoSize,r)?this.waitingToWarp=!0:(this.emit("pano.chosen",i,n),this.emit(ca,{panoId:n.id,lastPanoId:i.id,type:"flyToPano"}),this.flying=!0,this.nextPano=n,this.path.warpDestHeroLoc={panoId:t.panoId,position:n.position,quaternion:t.quaternion||this.quaternion.clone()},ft.time("[fly to pano] ".concat(n&&n.id)),this.path.warpTravel_BLACK(null,o,1,(function(){t.finalCallback=t.callback,e.afterFlyToPano(t)})))}},e.fade360View=function(e,t,n){var i=this,o=t.transitionTime||400;if(t.pano&&t.pano.view){if(!this.viewLinkManager.views[t.pano.view.sid])return void(n&&n());if(this.enteringView)return console.log("重复进入360"),void(n&&n());if(t.pano==this.currentPano&&!t.flyIn)return console.log("已经在此360漫游点"),void(n&&n());t.pano.view.entering=!0,this.enteringView=t.pano.view}this.domElement.style.opacity=1,Ae.start(St.property(this.domElement.style,"opacity",0),o,(function(){!t.flyIn&&W.mobile&&i.$app.core.get("PanoRenderer").switchPanoQuality(i.currentPano,{size:1024}),t.pano&&i.$app.core.get("PanoRenderer").switchPanoQuality(t.pano,{size:2048}),i.model.skybox.material.uniforms.opacity.value=null!=t.skyboxOpacity?t.skyboxOpacity:1,i.model.alpha=null!=t.modelAlpha?t.modelAlpha:0,t.pano&&(e.position.copy(t.pano.position),e.quaternion.copy(t.pano.quaternion));var r=!(!t.pano||!t.pano.view),a=!!(i.is360View(i.mode,i.currentPano)&&!t.flyIn||t.flyOut);if(r){t.pano.view.exitDoor.mesh.visible=!0,i.viewLinkManager.updateCirclesWhenFade("enter",t),t.pano.view.balloon.showOrHide(!1),t.pano.view.entering=!1;var s=t.aim||new THREE.Vector3(0,0,-1).applyQuaternion(t.pano.view.enterQuaternion||t.pano.quaternion).add(e.position);i.cameraControls.controls.panorama.lookAt(s),i.cameraControls.controls.panorama.update(0),i.OverlayManager.setGroupVisible(!1),i.GLTFEditor.group.visible=!1,i.viewLinkManager.changeTitlesShow(!1,"enterView360"),i.$app.Camera.monitor.changeTitlesShow(!1,"enterView360"),i.is360View(i.mode,i.currentPano)||(i.fade360oldState={insideLookLimitUp:i.cameraControls.controls.panorama.insideLookLimitUp,insideLookLimitDown:i.cameraControls.controls.panorama.insideLookLimitDown,limitAngleIsBound:i.cameraControls.controls.panorama.limitAngleIsBound}),i.cameraControls.controls.panorama.insideLookLimitUp=89.9,i.cameraControls.controls.panorama.insideLookLimitDown=-89.9,i.cameraControls.controls.panorama.limitAngleIsBound=!1,De.updateVisible(i.model.floorLogos.firstLogo,"inView360",!1),De.updateVisible(i.model.floorLogos.secondLogo,"inView360",!1)}if(a){var l=i.currentPano.view;if(l.exitDoor.mesh.visible=!1,t.flyOut){if("dollhouse"==t.toMode){var c=(new THREE.Vector3).subVectors(l.circle.mesh.position,l.balloon.mesh.position).setY(0).normalize();i.cameraControls.controls.dollhouse.target.copy(l.circle.mesh.position),i.cameraControls.cameras.dollhouse.position.copy(l.balloon.mesh.position).add(new THREE.Vector3(0,4,0)).add(c.multiplyScalar(-10)),i.cameraControls.controls.dollhouse.update(0)}l.balloon.visible=!1,setTimeout((function(){l.balloon.visible=!0}),500)}r||(i.viewLinkManager.updateCirclesWhenFade("leave",t),i.viewLinkManager.changeTitlesShow(!0,"enterView360"),i.$app.Camera.monitor.changeTitlesShow(!0,"enterView360")),!t.aim||t.flyIn||t.flyOut||(i.cameraControls.controls.panorama.lookAt(t.aim),i.cameraControls.controls.panorama.update(0)),i.OverlayManager.setGroupVisible(!0),i.GLTFEditor.group.visible=!0,i.cameraControls.controls.panorama.insideLookLimitUp=i.fade360oldState.insideLookLimitUp,i.cameraControls.controls.panorama.insideLookLimitDown=i.fade360oldState.insideLookLimitDown,i.cameraControls.controls.panorama.limitAngleIsBound=i.fade360oldState.limitAngleIsBound,De.updateVisible(i.model.floorLogos.firstLogo,"inView360",!0),De.updateVisible(i.model.floorLogos.secondLogo,"inView360",!0)}t.pano&&(i.emit(aa,i.currentPano,t.pano),i.model.chunks.concat([i.model.skybox]).forEach((function(e){e.material.uniforms.progress.value=1})),i.model.floorLogos.changefloorLogoOpa({index:0,opa:0,dur:0,delay:0}),i.model.floorLogos.secondLogo.position.copy(t.pano.floorPosition.clone().sub(i.model.position)),r||De.updateVisible(i.model.floorLogos.secondLogo,"flyToPano",!0),r||i.model.floorLogos.changefloorLogoOpa({index:1,opa:1,dur:250})),Ae.start(St.property(i.domElement.style,"opacity",1),o,(function(){i.enteringView=null,n&&n(),i.reticule.hide(),r?i.emit("enteredView"):i.emit("leavedView")}),0,null,null,"fade360")}),0,null,null,"fade360")},e.flyToPanoClosestToMouse=function(){if(Date.now()-this.mouseLastMoveTime>50&&this.updateIntersect(),this.closestPano)return this.flyToPano({pano:this.closestPano,checkAlone:!0});var e=this.getMouseDirection();this.flyDirection(e)||this.flyToPano({pano:this.currentPano})},e.flyLocalDirection=function(e){if(!(this.panosTaskList.length>1||1==this.panosTaskList.length&&this.panosTaskList[0].progress<.3)){var t=this.getDirection(e),n=1===e.z?.4:.75,i=1===Math.abs(e.x);return this.flyDirection(t,n,i,!0)}},e.flyDirection=function(e,t,n,i){if(!this.locked){var o=oe();this.history.invalidate();var r=this.closestPanoInDirection(e,t,n);return r?this.flyToPano({pano:r,canConstantlyWalk:this.canConstantlyWalk,byKey:i},o.resolve.bind(o,!0)):0==this.panosTaskList.length&&(this.bump(e),o.resolve(!1)),o.promise()}},e.closestPanoInDirection=function(e,t,n){return this.rankedPanoInDirection(0,e,t,n)},e.rankedPanoInDirection=(l={pano:null,candidates:[]},function(e,t,n,i){e||(e=0),n=void 0!==n?n:.75;var o=i?"angle":"direction",r=this.panosTaskList.length?this.panosTaskList[this.panosTaskList.length-1].pano:this.currentPano,a=[so.filters.not(r),so.filters.isPanoAligned(),so.filters.isNeighbourPanoTo(r),so.filters.inPanoDirection(r.position,t,n)],s=[so.scoreFunctions.distanceSquared(r),so.scoreFunctions[o](r.position,t)];return this.model.panos.findRankedByScore(e,a,s,l),this.cachedPanoCandidates=l.candidates,l.pano}),e.bump=function(e){var t=this;if(this.mode===xt.PANORAMA&&!this.flying&&!this.isWarping()){var n,i,o,r=at.transition,a=(r.flytimeMaxDistanceThreshold*r.flytimeDistanceMultiplier+r.flyTime)/10,s=this.camera.getWorldDirection(new THREE.Vector3).dot(e);if(Math.abs(s)>.5)n=function(){Ae.start(St.property(this.cameraControls.cameras[xt.PANORAMA],"zoom",s>0?1.04:.96),a,i,0,ye.easeInOutSine,"bumpZStart")}.bind(this),i=function(){Ae.start(St.property(this.cameraControls.cameras[xt.PANORAMA],"zoom",1),3*a,o,0,ye.easeInOutSine,"bumpZRelax")}.bind(this);else{var l=this.camera.position.clone(),c=e.clone();this.raycaster.set(l,c);var u=this.model.floors.reduce((function(e,t){return e.concat(t.collider.children)}),[]),h=this.raycaster.intersectObjects(u),d=h.length>0?h[0].distance/25:.04,p=l.clone().add(c.multiplyScalar(d));n=function(){Ae.start(St.vector(this.cameraControls.cameras[xt.PANORAMA].position,p),a,i,0,ye.easeInOutSine,"bumpTStart")}.bind(this),i=function(){Ae.start(St.vector(this.cameraControls.cameras[xt.PANORAMA].position,l),5*a,o,0,ye.easeInOutSine,"bumpTRelax")}.bind(this)}o=function(){"panorama"==t.mode&&(t.flying=!1,t.emit(ua,{targetPano:t.currentPano,currentPano:t.currentPano}))},this.flying=!0,n()}},e.changeFloor=function(e){if(!this.is360View(this.mode,this.currentPano))if(this.mode===xt.PANORAMA){var t=this.history.reversePano(e);if(t)this.flyToPano({pano:t});else{var n=this.getFloorPanoByScore(e);n&&(this.cachedPanoCandidates=e.candidates,this.history.push(t,this.currentPano),this.flyToPano({pano:n}))}}else this.model.setFloor(this.model.nextFloor(e)||this.model.currentFloor)},e.getFloorPanoByScore=function(){var e={pano:null,candidates:[]};return function(t,n){var i=n||this.model.nextFloor(t);return i?(this.model.panos.lowestByScore([so.filters.atFloor(i),so.filters.isPanoAligned(),function(e){return e.hasNeighbor()}],[so.scoreFunctions.distance(this.currentPano),so.scoreFunctions.direction(this.position,new THREE.Vector3(0,t,0)),so.scoreFunctions.penalizeHeightDifferenceUnder(this.position,.5)],e),e.pano):void ft.debug("player.changeFloor("+t+"): no such floor")}}(),e.gotoFloor=function(e){var t=e-this.model.currentFloor.floorIndex;this.changeFloor(t)},e.getDirection=function(e){return(e=e||(new THREE.Vector3).copy(to.FORWARD)).applyQuaternion(this.camera.quaternion)},e.flyToNewMode=function(e,t){var n=this,i=(e=e||{}).mode,o=e.pano,r=e.duration;e.warpDest;var a=e.callback;e.force;var s=e.quaternion,l=e.target,c=e.position,u=e.currentScale,h=e.floor,d=e.fitBoundSize;if(t=t||oe(),this.isWarping())return ft.warn("Player.flyToNewMode() -> Cannot fly when warping"),a&&a(!1),t.reject("Cannot change mode during tour transition");if(this.mode===xt.TRANSITIONING)return a&&a(!1),t.reject("Cannot change mode during mode transition");if(i===this.mode)return a&&a(!1),t.resolve(),t;i==xt.PANORAMA&&this.model._3dTilesRuntime&&(this.model._3dTilesRuntime.pauseTilesetUpdate(!0),this.model._3dTilesRuntime.clearLoadingTiles()),ft.debug("Switching mode to "+i);var p=function(){De.delayOneFrame(function(){this.flyToNewMode(e,t)}.bind(this))}.bind(this);if(o&&this.checkAndWaitForPanoLoad(o,"low","low",this.basePanoSize,p))return t.promise();if(!this.model.mesh3dTilesLoaded&&!this.model.meshTexturesLoaded&&this.isOutsideMode(i))return ft.info("Waiting for model 3dTiles or damTextures to be loaded before going out to dollhouse"),this.model.waitForLoad(this.model,function(){return!1}.bind(this)),p(),t.promise();this.history.invalidate();var f=this.mode,m=this.cameraControls.cameras[i],v=De.deepExtend({},at[i],at[f+"-"+i]);this.modeTran=this.mode+"-"+i;var g=v.transitionTime;void 0!==r&&(g=r),this.emit(ra,f,i,o,g),o&&(this.currentPano=o),Ae.cancelById(at.freeze.LookTransition),Ae.cancelById(this.$app.resource.num+at.freeze.FlyToPano),i===xt.PANORAMA?(this.$app.core.get("PanoRenderer").switchPanoQuality(o,{size:2048}),this.emit(aa,o,o),setTimeout(function(){o.floor.enter(i)}.bind(this),g/2),this.path.fadeOutCpm(at.path.fadeOutTime)):(this.path.placeCpm(),this.path.fadeInCpm(at.path.fadeInTime),null!=h?"all"==h&&i!=xt.FLOORPLAN?this.model.toggleAllFloors(!0):"number"==typeof h&&(h=this.model.floors.list[h]).enter(i):i===xt.FLOORPLAN?this.model.currentFloor.enter(i):i==xt.DOLLHOUSE&&this.model.toggleAllFloors(!0)),this.switchCameraMode(i,s,l,c,u,{fitBoundSize:d});var y=(new THREE.Vector3).copy(this.position),A=this.currentPano,E=this.position.clone();this.emit(ca,{mode:e.mode,duration:e.duration,target:e.target,position:e.position,quaternion:e.quaternion?(new THREE.Quaternion).set(e.quaternion._x,e.quaternion._y,e.quaternion._z,e.quaternion._w):null,zoom:e.zoom,panoId:e.pano?e.pano.id:null,lastPanoId:A&&A.id,type:"flyToNewMode"}),this.flying=!0;var b=function(){n.isOutsideMode(i)&&n.is360View(f,A)?(v.blackoutStyle=At,g=at.show360Views.transitionTime,v.transitionTime=g,v.skyboxOpacity=0,v.modelAlpha=1,v.flyOut=!0,v.toMode=i,n.fade360View(m,v)):n.isOutsideMode(f)&&n.is360View(i,o)?(n.mode=i,v.pano=o,v.blackoutStyle=gt,g=at.show360Views.transitionTime,v.transitionTime=g,v.flyIn=!0,n.fade360View(m,v,n.afterchangeMode)):(Ae.start(St.property(n.model,"alpha",v.modelAlpha,null),g*v.modelAlphaLength,null,v.modelAlphaDelay,null,at.freeze.FlyToNewMode),Ae.start(St.vector(n.position,m.position),g,null,at.flydown.movementDelay,ye[at.flydown.movementEasing],null,at.freeze.FlyToNewMode),Ae.start(St.quaternion(n.quaternion,m.quaternion),g*v.rotationDuration,null,v.rotationDelay,ye[at.flydown.rotationEasing],null,at.freeze.FlyToNewMode),Ae.start(St.matrix4(n.camera.projectionMatrix,m.projectionMatrix),g*v.cameraMatrixDuration,null,v.cameraMatrixDelay,v.cameraMatrixEase,null,at.freeze.FlyToNewMode),Ae.start((function(){n.camera.projectionMatrixInverse.copy(n.camera.projectionMatrix).invert()}),g*v.cameraMatrixDuration,null,v.cameraMatrixDelay,v.cameraMatrixEase,null,at.freeze.FlyToNewMode),Ae.start(St.uniform(n.model.skybox,"opacity",v.skyboxOpacity),g*v.skyboxOpacityLength,null,v.skyboxOpacityDelay,null,at.freeze.FlyToNewMode),Ae.start(St.property(n.reticule.material.uniforms.opacity,"value",0),g,null,at.freeze.FlyToNewMode)),Ae.setTimeout(function(){this.flying=!1,f===xt.PANORAMA&&i!==xt.PANORAMA?this.currentPano.exit():f!==xt.PANORAMA&&i===xt.PANORAMA&&(this.currentPano!==A&&A.exit(),this.currentPano.enter()),f===xt.DOLLHOUSE&&this.cameraControls.controls[xt.DOLLHOUSE].resetRanges(),this.mode=i,this.afterChangeMode(f,i),this.emit(ua,{targetPosition:y,currentPosition:E,targetPano:this.currentPano,currentPano:A}),a&&a(),t.resolve()}.bind(n),g,at.freeze.FlyToNewMode),n.mode=xt.TRANSITIONING};return"panorama"!=this.mode||this.isOutsideMode(i)&&this.is360View(f,A)?b():this.$app.core.get("SceneRenderer").once(xa,(function(){b()})),this.beforeChangeMode(f,i,o,g),t.promise()},e.setSize=function(e,t){var n=e/t;this.baseFov=Aa.clampVFOV(at.insideFOV,at.insideFOVMax,e,t);var i=Aa.getHFOVFromVFOV(at.insideFOV,e,t);for(var o in i>at.insideFOVMax?this.baseFov=Aa.getVFOVFromHFOV(at.insideFOVMax,e,t):this.baseFov=at.insideFOV,this.cameraControls.cameras){var r=this.cameraControls.cameras[o];r.fov=r.staticFov?r.staticFov:this.baseFov*(1/this.zoomLevel),r.updateAspect(n)}this.emit("setSize",e,t)},e.toJSON=function(){var e={};return this.cameraControls.activeControl?((e=this.cameraControls.activeControl.toJSON()).camera_mode=xt.toInt(this.mode),this.isOutsideMode()?this.model.allFloorsVisible?e.floor_visibility=[]:e.floor_visibility=this.model.floors.list.map((function(e){return e.hidden?0:1})):xt.PANORAMA&&(e.scan_id=this.currentPano.id),e):e},e.zoomBy=function(e){this.zoomTo(this.zoomLevel*e)},e.zoomIn=function(){this.zoomBy(1+this.zoomSpeed)},e.zoomOut=function(){this.zoomBy(1-this.zoomSpeed)},e.zoomTo=function(e,t){if((t||at.zoom.enabled&&this.mode===xt.PANORAMA&&this.zoomEnabled)&&(e<at.zoom.min&&(e=at.zoom.min),e>at.zoom.max&&(e=at.zoom.max),e>this.zoomLevel?(this.emit(rs),e===at.zoom.max&&this.emit(ss)):e<this.zoomLevel&&(this.emit(as),e===at.zoom.min&&this.emit(ls)),this.cameraControls.activeControl)){var n=this.cameraControls.activeControl.camera;this.zoomLevel=e,n.fov=this.baseFov*(1/this.zoomLevel),n.updateProjectionMatrix(),this.zoomFov=n.fov,this.emit("zoomTo",e)}},e.zoomDefault=function(){this.zoomTo(1,!0)},e.smoothZoomToDefault=function(e,t){var n,i=this.zoomLevel,o=function(e){e>1&&(e=1),n=i*(1-e)+e,this.zoomTo(n,!0)}.bind(this),r=function(){this.zoomDefault(),t&&window.setTimeout(t,50)}.bind(this);Ae.start(o,e,r,null,0,ye[at.transition.blendEasing])},e.smoothZoomFovTo=function(e,t,n){var i=this.baseFov/e;this.smoothZoomLevelTo(i,t,n)},e.smoothZoomLevelTo=function(e,t,n){if(this.zoomLevel!=e){var i,o=this.zoomLevel,r=function(t){t>1&&(t=1),i=o*(1-t)+t*e,this.zoomTo(i,!0)}.bind(this);Ae.start(r,t,n,null,0,ye[at.transition.blendEasing])}},e.updateZoomPano=function(){var e=this,t=this.$app.core.get("QualityManager"),n=this.$app.core.get("PanoRenderer"),i=this.currentPano;if(!n.zoomPanoRenderingDisabled&&this.mode===xt.PANORAMA&&i.tiled&&i){var o=1.8,r="2k"==t.navTileClass&&"4k"==t.tileClass?o:at.zoom.activationThreshold,a=at.highestQualityTile||this.zoomLevel>r,s=!(this.flying&&this.nextPano&&this.nextPano!==this.currentPano)&&!this.isWarping(),l=a&&s;this.$app.core.get("TileDownloader").tilePrioritizer.setZoomingActive(l),n.setZoomingActive(l,i,!0);var c=function(e,i){n.resetRenderStatus(e.id,!1,!0,t.getMaxNavPanoSize()),n.clearAllQueuedUploadsForPano(e.id),n.renderPanoTiles(e.id,null,!1,!1),e.setZoomed(i)}.bind(this);if(l&&(!i.zoomed||t.zoomLevelResolution&&"4k"!=t.zoomLevelResolution)?(i.zoomed||c(i,!0),"1k"==t.navTileClass&&"1k"!=t.tileClass&&this.zoomLevel<2?n.enableHighQuality(function(){"4k"!=t.tileClass&&c(i,!0)}.bind(this)):n.enableUltraHighQualityMode(function(){t.useUltraHighResolutionPanos&&!at.zoom.overridemax&&(at.zoom.max=at.ultraHighQualityMaxZoom),c(i,!0)}.bind(this))):!a&&i.zoomed&&c(i,!1),l&&"1k"==t.navTileClass&&"4k"==t.tileClass){var u=function(i){t.updateMaximums(),n.setupZoomRenderTarget(),"4k"==t.zoomLevelResolution?e.model.showHighMap():e.model.hideHighMap()};t.zoomLevelResolution=this.zoomLevel>=o?"4k":this.zoomLevel>at.zoom.activationThreshold?"2k":"1k",this.oldZoomLevel<o&&this.zoomLevel>=o?(u(),c(i,a)):this.oldZoomLevel<=at.zoom.activationThreshold&&this.zoomLevel>at.zoom.activationThreshold?u():this.oldZoomLevel>o&&this.zoomLevel<=o?(u(),c(i,a)):this.oldZoomLevel>at.zoom.activationThreshold&&this.zoomLevel<=at.zoom.activationThreshold&&u(),this.oldZoomLevel=this.zoomLevel}}},e.hasChanged=function(e){if(!this.previousState)return this.previousState={allFloorsVisible:this.model.allFloorsVisible,position:this.position.clone(),quaternion:this.quaternion.clone(),mouse:this.mouse.clone(),currentFloor:this.model.currentFloor,projectionMatrix:this.camera.projectionMatrix.clone(),worldMatrix:this.camera.matrixWorld.clone(),mode:this.mode,modelPosition:this.model.position.clone(),modelCenter:this.model.center.clone(),zoomLevel:this.zoomLevel},e.cameraChanged=!0,e.cameraChanged2=!0,e.cameraChanged3=!0,!0;var t=this.position.equals(this.previousState.position)&&this.quaternion.equals(this.previousState.quaternion)&&this.camera.matrixWorld.equals(this.previousState.worldMatrix)&&this.camera.projectionMatrix.equals(this.previousState.projectionMatrix)&&this.mode===this.previousState.mode&&this.zoomLevel===this.previousState.zoomLevel&&this.model.center.equals(this.previousState.modelCenter)&&this.model.position.equals(this.previousState.modelPosition);e.vrHandlerMoved=this.VR&&this.VR.webxr.entered&&this.VR.webxr.handlerMoved();var n=t&&this.mouse.equals(this.previousState.mouse)&&!e.vrHandlerMoved&&this.model.allFloorsVisible===this.previousState.allFloorsVisible&&this.model.currentFloor===this.previousState.currentFloor&&null===this.nextPano;return e.cameraChanged=!t||e.cameraProjectionChanged,e.allFlVisiChanged=this.model.allFloorsVisible!==this.previousState.allFloorsVisible,e.moved=!this.position.equals(this.previousState.position),e.rotated=!this.quaternion.equals(this.previousState.quaternion),e.mouseMoved=!this.mouse.equals(this.previousState.mouse),e.floorChanged=this.model.currentFloor!==this.previousState.currentFloor,e.cameraProjectionChanged=!this.camera.projectionMatrix.equals(this.previousState.projectionMatrix),e.cameraWorldMatrixChanged=!this.camera.matrixWorld.equals(this.previousState.worldMatrix),e.modeChanged=this.mode!==this.previousState.mode,e.modelPositionChanged=!this.model.position.equals(this.previousState.modelPosition),e.modelCenterChanged=!this.model.center.equals(this.previousState.modelCenter),e.nextPanoActive=null!==this.nextPano,e.zoomLevel=this.zoomLevel!==this.previousState.zoomLevel,n?(e.cameraChanged2=!1,e.cameraChanged3=!1):(e.cameraChanged2=e.cameraProjectionChanged||!ht.closeTo(this.quaternion,this.previousState.quaternion,5)||!ht.closeTo(this.position,this.previousState.position,4),e.cameraChanged3=e.cameraProjectionChanged||!ht.closeTo(this.quaternion,this.previousState.quaternion,3)||!ht.closeTo(this.position,this.previousState.position,3)),this.previousState.allFloorsVisible=this.model.allFloorsVisible,this.previousState.position.copy(this.position),this.previousState.quaternion.copy(this.quaternion),this.previousState.mouse.copy(this.mouse),this.previousState.currentFloor=this.model.currentFloor,this.previousState.projectionMatrix.copy(this.camera.projectionMatrix),this.previousState.worldMatrix.copy(this.camera.matrixWorld),this.previousState.mode=this.mode,this.previousState.modelPosition.copy(this.model.position),this.previousState.modelCenter.copy(this.model.center),this.previousState.zoomLevel=this.zoomLevel,!n},e.getToMode=function(){return this.modeTran.split("-")[1]},e.flyToMode=function(e,t,n){var i=this;if(this.mode==e)t&&t();else if("transitioning"==this.mode)this.once(ua,(function(){i.flyToMode(e,t,n)}));else{t&&this.once(ua,(function(){t()}));try{this.flyToNewMode({mode:e,pano:"panorama"==e&&this.currentPano,duration:n})}catch(e){console.log("flyToMode遇到问题?",e)}}},e.vrModeChange=function(){at.vrEnabled?at.vrEnabled=!1:at.vrEnabled=!0},e.focusPoint=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(console.log("focusPoint"),"floorplan"==this.mode){var t=e.modelSize||new THREE.Vector3(5,5,5),n=(s=this.cameraControls.controls.floorplan).getDefaultAbsoluteScale(t),i=s.absoluteScale,o=s.target.clone(),r=this.model.boundingBox.max.y+_e.orthoNear+_e.planeHeightShift+1,a=e.aim.clone().setY(r);Ae.cancelById(at.freeze.outsideFocus,!0),Ae.start(function(e){s.absoluteScale=n*e+i*(1-e),s.target=a.clone().multiplyScalar(e).add(o.clone().multiplyScalar(1-e)),s.camera.position.copy(s.target.clone().add(s.offset))}.bind(this),e.dur||600,null,0,ye[at.transition.blendEasing],"outsideFocus",at.freeze.outsideFocus,null)}else if("dollhouse"==this.mode){var s=this.cameraControls.controls.dollhouse,l=e.radius||10,c=(o=s.target.clone(),s.offset.clone().normalize()),u=s.offset.length();Ae.cancelById(at.freeze.outsideFocus,!0),Ae.start(function(t){s.target=e.aim.clone().multiplyScalar(t).add(o.clone().multiplyScalar(1-t));var n=l*t+u*(1-t);s.camera.position.copy(s.target.clone().add(c.clone().multiplyScalar(n)))}.bind(this),e.dur||600,null,0,ye[at.transition.blendEasing],"outsideFocus",at.freeze.outsideFocus,null)}},e.getSnapAngleInfo=function(){var e={metadata:{}},t=this.camera.quaternion.clone();switch(this.mode){case"panorama":e.metadata.scan_id=this.currentPano.id;break;case"floorplan":var n=this.getSize(),i=n.clientWidth,o=n.clientHeight;(t=(new THREE.Quaternion).setFromAxisAngle(new THREE.Vector3(0,1,0),THREE.MathUtils.degToRad(90))).multiply(this.camera.quaternion),e.metadata.camera_mode=1,e.metadata.ortho_zoom=ge.toPrecision(this.cameraControls.activeControl.currentScale/(i/o),4);break;case"dollhouse":e.metadata.camera_mode=2}return e.metadata.camera_position=this.camera.position.clone(),e.metadata.camera_quaternion=t,e.metadata.lon=this.cameraControls.activeControl.lon,e.metadata.lat=this.cameraControls.activeControl.lat,e.sid="4dkk"+(new Date).getTime(),e.name="",e.mode=this.mode,e},e.model=new La(e.$app),e.currentPano=null,e.nextPano=null,e.camera=null,e.paused=!1,e.flying=!1,e.sceneIntersectionPlane=null,e.target=new THREE.Vector3,e.mouse=new THREE.Vector3(1.1,1.1,.5),e.mouseAtMouseDown=new THREE.Vector2,e.mouseCouldBeClickToMove=!1,e.mouseLastMoveTime=Date.now(),e.mouseDown=!1,e.mouseDownTimer=null,e.couldBeLongTap=!1,e.containsMouse=!1,//!0 //xzw改为false,否则触屏一直是true
- e.isTouchEvent=!1,e.isPanoHover=!1,e.reticule=new Oa(h(e)),e.panoMarkers=[],e.quaternion=new THREE.Quaternion,e.position=new THREE.Vector3(15,10,15),e.previousState=null,e.lastInsideView=new Ha,e.last360View=new Ha,e.raycaster=new THREE.Raycaster,e.raycaster.params.Line.threshold=.01,e.raycaster.layers.enable(Ft),e.intersect=null,e.lastChangeTime=Date.now(),e.history=new wt,e.cameraControls=null,e.domElement=null,e.cachedPanoCandidates=null,e.basePanoSize=0,e.standardPanoSize=0,e.highPanoSize=0,e.ultraHighPanoSize=0,e.zoomLevel=1,e.zooming=0,e.zoomSpeed=.5,e.scrollZoomSpeed=.06,e.zoomSpeedAdjust=.05,e.defaultZoomIncrement=.2,e.baseFov=at.insideFOV,e.zoomFov=e.baseFov,e.zoomEnabled=!0,e.measureRulers=[],e.cornerRulers=[],e.planLabels=[],e.dollLabels=[],e.doorLabels=[],e.defaultRoomLabels=[],e.polygonmarkLabels=[],e.modeTran="",e.preRenderingEnabled=!1,e.setupCustomProperties(xt.PANORAMA),e.zoomStats=new Et,e.lastFrameChanged=!0,e.cameraControls=e.$app.core.get("CameraControls"),e.modelManager=e.$app.core.get("ModelManager"),e.started=!1,e._locked=!1,e._flying=!1,e.clearPanosTaskList(),e.setPanoTaskEnable(!0),e.viewLinkManager=new Rl(e.$app,h(e)),e.paintEditor=new Ol(e.$app,h(e)),e.modelSideManager=new xl(h(e)),e}return u(n,[{key:"init",value:function(){this.domElement=this.$app.dom.querySelector(".player"),this.camera=this.$app.core.get("SceneRenderer").camera,this.path=new os(this.director,this,this.cameraControls),this.basePanoSize=this.$app.core.get("QualityManager").getPanoSize(_t),this.standardPanoSize=this.$app.core.get("QualityManager").getPanoSize(zt),this.highPanoSize=this.$app.core.get("QualityManager").getPanoSize(Ut),this.ultraHighPanoSize=this.$app.core.get("QualityManager").getPanoSize(Nt),this.$app.core.get("TileDownloader").processPriorityQueue=!1,this.$app.core.get("TileDownloader").tilePrioritizer=new Ka(this.$app.core.get("QualityManager"),this.basePanoSize,this.standardPanoSize,this.highPanoSize,this.ultraHighPanoSize),this.bindEvents(this.domElement),this.updateModel(),Wr.init(this),di.init(this.$app),this.model.createTranControl(this)}},{key:"locked",get:function(){return this._locked},set:function(e){this._locked=e,this._locked?this.model.fadePanoMarkers(0,0,{vrCustomer:!0,hideVideoFlag:!0}):this.$app.VRScreenSYNC||this.model.fadePanoMarkers(1,0,{vrCustomer:!0,hideVideoFlag:!1}),e&&this.clearPanosTaskList()}},{key:"flying",get:function(){return this._flying},set:function(e){this._flying=e}},{key:"setPanoTaskEnable",value:function(e){this.canConstantlyWalk=e,e||this.clearPanosTaskList()}},{key:"setTourPanoTask",value:function(e,t){var n=e.panoList,i=void 0===n?[]:n,o=e.flySpeed,r=e.callback;0!=i.length&&(this.panosTaskList.length=0,this.addTourPanoTask({panoList:i,flySpeed:o,callback:r},t))}},{key:"addTourPanoTask",value:function(e,t){var n=this,i=e.panoList,o=void 0===i?[]:i,r=e.flySpeed,a=void 0===r?at.transition.flySpeed:r,s=e.callback;this.dontInterruptPanoTask=!0;var l=o.map((function(e,t){var i=Object.assign({flySpeed:a,easeType:"constant",gotQua:!0},e,{sid:Math.random(),dealingTask:!0,callback:t==o.length-1?function(t){(t=t||e.pano==n.currentPano)&&(n.dontInterruptPanoTask=!1,e.callback&&e.callback(),s&&s())}:e.callback}),r=n.getAimToNextPano(e.pano,e.lookAtPoint,e.quaternion),l=r.aimQua;return r.hasVideo,i.quaternion=l,i}));console.log("addTourPanoTask",l.map((function(e){return[e.pano.id]}))+""),t&&(l[0].easeType=null),this.panosTaskList=this.panosTaskList.concat(l),this.flying||this.flyToPano(this.panosTaskList[0])}},{key:"stopTourPanoTask",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:400;if(this.panosTaskList.length){var t=this.panosTaskList[0];if(t.flyCount){var n=this.position.distanceTo(t.pano.position);if(n>0&&(t.flySpeed=Math.max(n/e,t.flySpeed||0),t.aimQua=null,t.forceStop=!0,t.easeFun!=ye.linearTween)){t.easeFun=ye.linearTween;var i=Math.max(t.currentSpeed||0,.002);t.duration=n/i,this.startTransition(t)}}}this.clearPanosTaskList(),this.dontInterruptPanoTask=!1}},{key:"clearPanosTaskList",value:function(){this.panosTaskList=[]}},{key:"computeDuration",value:function(e){var t,n=this.currentPano.position.distanceTo(e.pano.position);if(e.flySpeed&&"constant"==e.easeType)t=n/e.flySpeed;else{var i=e.maxDistanceOverride||at.transition.flytimeMaxDistanceThreshold;t=(n=Math.min(n,i))*at.transition.flytimeDistanceMultiplier+at.transition.flyTime}if(e.quaternion){var o=e.maxRotSpeed||at.transition.maxRotSpeed;e.flySpeed&&"constant"==e.easeType&&(o*=e.flySpeed/.002);var r=this.cameraControls.activeControl.camera.quaternion.clone(),a=to.FORWARD.clone().applyQuaternion(r),s=to.FORWARD.clone().applyQuaternion(e.quaternion),l=a.angleTo(s),c=Math.pow(l,.3)/o*1e3;t=Math.max(c,t),e.flySpeed&&"constant"==e.easeType&&(e.flySpeed=n/t)}return t}},{key:"getSize",value:function(){var e=this.$app.dom.querySelector('.player[name="main"]');return{clientWidth:e.clientWidth,clientHeight:e.clientHeight}}},{key:"beforeChangeMode",value:function(e,t,n,i){var o=this;e==xt.PANORAMA?(this.labelManager&&this.labelManager.updateEntryVisi(!0,this.model.currentFloor.floorIndex),this.chosenMeasureRuler&&this.chosenMeasureRuler.showOptionLabel(!1),De.updateVisible(this.model.floorLogos.firstLogo,"outside",!1),De.updateVisible(this.model.floorLogos.secondLogo,"outside",!1),this.model.skybox.material.depthTest=!1,this.model.skybox.material.transparent=!0,this.$app.core.get("PanoRenderer").disposeIdelTargets(),setTimeout((function(){if(o.panosTaskList.length){var e=o.$app.resource.num+at.freeze.FlyToPano;Ae.cancelById(e,!0),o.panosTaskList.forEach((function(e){e.pano.exit()}))}}),1)):e==xt.FLOORPLAN?(ol.switchDepthTest(!0),this.model.setModelDisplay(!0,"hideOnfloorplan")):xt.DOLLHOUSE,t==xt.PANORAMA?(this.model.floorLogos.firstLogo.position.copy(n.floorPosition.clone().sub(this.model.position)),this.model.floorLogos.secondLogo.position.copy(this.model.floorLogos.firstLogo.position),this.compass&&this.compass.autoJudgeDisplay(),this.labelManager&&this.labelManager.updateEntryVisi(!1,this.model.currentFloor.floorIndex)):t==xt.FLOORPLAN?(setTimeout(ol.switchDepthTest.bind(this,!1),.5*i),this.labelManager&&this.labelManager.setPlanLabelVisi(!0,this.model.currentFloor.floorIndex)):xt.DOLLHOUSE,this.$app.Camera.emit("mode.beforeChange",{fromMode:e,toMode:t,floorIndex:this.model.currentFloor.floorIndex,allVisible:this.model.allFloorsVisible})}},{key:"afterChangeMode",value:function(e,t,n,i){if(e==xt.PANORAMA?(this.compass&&this.compass.autoJudgeDisplay(),this.$app.core.get("PanoRenderer").disposeIdelTargets()):e==xt.FLOORPLAN?this.labelManager&&this.labelManager.setPlanLabelVisi(!1,this.model.currentFloor.floorIndex):xt.DOLLHOUSE,t==xt.PANORAMA)De.updateVisible(this.model.floorLogos.firstLogo,"outside",!0),De.updateVisible(this.model.floorLogos.secondLogo,"outside",!0),this.model.floorLogos.changefloorLogoOpa({index:0,from:0,opa:1,dur:150}),this.doorLabels.forEach((function(e){return e.updateVisible()})),this.model.skybox.material.depthTest=!0,this.model.skybox.material.transparent=!1,this.model.showLowestTile(!0);else if(t==xt.FLOORPLAN){var o,r,a=this.model.showOnFloorplan||(null===(o=this.linkEditor)||void 0===o?void 0:o.setPanoVisible)||(null===(r=this.linkEditor)||void 0===r?void 0:r.setTagVisible);this.model.setModelDisplay(a,"hideOnfloorplan"),a&&this.model.showLowestTile(!1)}else t==xt.DOLLHOUSE&&(this.model.floors.forEach((function(e){e.entryArrow.forEach((function(e){return e.dollLabel.update()}))})),this.model.showLowestTile(!1));this.$app.Camera.emit("mode.afterChange",{fromMode:e,toMode:t,floorIndex:this.model.currentFloor.floorIndex,allVisible:this.model.allFloorsVisible}),this.clearPanosTaskList()}},{key:"setAnimateMakerPano",value:function(){var e=this;if(this.currentPano){var t;if(this.mode===xt.PANORAMA&&!this.flying&&!this.enteringView&&this.currentPano.isAligned()){var n=[so.filters.isPanoAligned()],i=this.getDirection();n.push(so.filters.not(this.currentPano)),n.push(so.filters.isNeighbourPanoTo(this.currentPano)),n.push(so.filters.inFloorDirection(this.currentPano.position,i,.707)),n.push(so.filters.isClampDisSquaredTo(this.currentPano.floorPosition,.5,16));var o=De.sortByScore(this.model.panos.list,n,[so.scoreFunctions.distanceSquared(this.currentPano,-.6),so.scoreFunctions.directionFloor(this.currentPano.position,i)]);if(o.length>1){var r=o.slice(0,4).find((function(t){return pt.getPos2d(t.item.floorPosition,e).inSight}));r&&(t=r.item)}t||(t=o[0]&&o[0].item)}t&&t.id!=this.model.panos.animatePanoId?(null!=this.model.panos.animatePanoId&&this.model.panos.get(this.model.panos.animatePanoId).updateMakerStyle(),t.updateMakerStyle("animate"),this.model.panos.animatePanoId=t.id):t||null==this.model.panos.animatePanoId||(this.model.panos.get(this.model.panos.animatePanoId).updateMakerStyle(),this.model.panos.animatePanoId=null)}}},{key:"createIntersectLabel",value:function(){this.intersectLabel=new Ce({text:"intersectLabel",textColor:{r:255,g:255,b:255,a:1},backgroundColor:{r:0,g:0,b:0,a:.1},borderColor:{r:255,g:255,b:255,a:1},margin:{x:10,y:10},borderRadius:10,rectBorderThick:2,player:this,sizeInfo:{width2d:180},fontsize:25}),this.intersectLabel.sprite.position.set(0,2,0),this.model.add(this.intersectLabel)}}]),n}()})),ct("QualityManager",(function(){return function(){function e(t,n,i){o(this,e),this.maxNavPanoSize=-1,this.maxZoomPanoSize=-1,this.devicePixelDensity=t,this.deviceScreenSize=n,this.clientBandwidth=i,this.panoSizeClassMap={},this.useHighResolutionPanos=!0,this.useUltraHighResolutionPanos=!1,this.modelHasUltraHighPanos=!1,this.maxRenderTargetSize=W.mobile?2048:4096,this.maxRenderTargetSize=Math.min(De.getMAXCUBETEXTURESIZE(),this.maxRenderTargetSize)}return u(e,[{key:"init",value:function(){this.buildPanoSizeClassMap(this.devicePixelDensity,this.deviceScreenSize,this.clientBandwidth),this.ultraHighSize=this.getPanoSize(Nt),this.highSize=this.getPanoSize(Ut),this.standardSize=this.getPanoSize(zt),this.baseSize=this.getPanoSize(_t),at.tiling.maxZoomPanoQuality&&this.ultraHighSize<=at.tiling.maxZoomPanoQuality&&(at.tiling.allowUltraHighResolution=!0),this.highQualityThreshold=Fe.valueFromHash("threshold2k",_e.windowHeightHighQualityThreshold),this.updateMaximums(),this.$app.core.get("ModelManager").on(ts,this.onModelChanged.bind(this));var e=this.$app.store.getValue("metadata").sceneResolution||"2k";-1!=e.indexOf("/")?this.tileClass=e.split("/")[1]:this.tileClass=e,this.navTileClass="2k","1k"==this.tileClass&&(this.navTileClass="1k",this.useHighResolutionPanos=!1),Fe.urlHasValue("1k")&&(this.navTileClass="1k"),this.limitQuality=!0}},{key:"updateFromModel",value:function(e){this.updateUltraHighResolutionSettings(e)}},{key:"updateHighResolutionSettings",value:function(e){showcase.modelDataPromisesTiles(e.data)?this.useHighResolutionPanos=!0:this.useHighResolutionPanos=!1,this.updateMaximums()}},{key:"updateUltraHighResolutionSettings",value:function(e){at.tiling.allowUltraHighResolution&&this.modelHasUltraHighPanos?this.useUltraHighResolutionPanos=!0:this.useUltraHighResolutionPanos=!1,this.updateMaximums()}},{key:"enableUltraHighQualityMode",value:function(){this.modelHasUltraHighPanos=!0,this.updateUltraHighResolutionSettings(null)}},{key:"ultraHighQualityModeEnabled",value:function(){return this.modelHasUltraHighPanos}},{key:"onModelChanged",value:function(e){this.updateFromModel(e.model),this.updateMaximums()}},{key:"updateMaximums",value:function(){this.maxNavPanoSize=at.tiling.maxNavPanoQuality||this.detectMaxNavPanoSize(),this.maxZoomPanoSize=at.tiling.maxZoomPanoQuality||this.detectMaxZoomPanoSize(),this.maxZoomPanoSize<this.maxNavPanoSize&&(this.maxNavPanoSize=this.maxZoomPanoSize)}},{key:"buildPanoSizeClassMap",value:function(){this.panoSizeClassMap[_t]=512,this.panoSizeClassMap[zt]=1024,this.panoSizeClassMap[Ut]=2048,this.panoSizeClassMap[Nt]=4096}},{key:"getPanoSize",value:function(e){return this.panoSizeClassMap[e]}},{key:"getMaxPossiblePanoSize",value:function(){return this.getPanoSize(Nt)}},{key:"getMaxPanoSize",value:function(){return this.maxZoomPanoSize}},{key:"getMaxNavPanoSize",value:function(){return this.maxNavPanoSize}},{key:"getMaxZoomPanoSize",value:function(){return this.maxZoomPanoSize}},{key:"detectMaxNavPanoSizeClass",value:function(){switch(this.navTileClass){case"1k":return zt;case"512":return _t;case"2k":default:return Ut}}},{key:"detectMaxNavPanoSize",value:function(){var e=this.detectMaxNavPanoSizeClass();return this.getPanoSize(e)}},{key:"detectMaxZoomPanoSize",value:function(){return this.zoomLevelResolution?"4k"==this.zoomLevelResolution&&this.useUltraHighResolutionPanos?this.getPanoSize(Nt):"1k"!=this.zoomLevelResolution&&this.useHighResolutionPanos?this.getPanoSize(Ut):this.getPanoSize(zt):this.useHighResolutionPanos?this.useUltraHighResolutionPanos?this.getPanoSize(Nt):this.getPanoSize(Ut):this.getPanoSize(zt)}}]),e}()}));var jl={getCubemapUrls:function(e,t,n){return[0,1,2,3,4,5].map(function(i,o){return e.get("pan/"+n+"/"+t+"_skybox"+r(i)+".jpg")}.bind(this))},mapFaceToCubemapFace:function(e){return{0:Zi,1:Ki,2:Ji,3:$i,4:Yi,5:Xi}[e]}},Wl="tiledownloader.download.success",ql="tiledownloader.download.failure",Jl="tiledownloader.pano.download.complete";function Yl(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}function Zl(e,t){this.tree=e,this.parent=t,this.children=[],this.id=++nc}function Xl(e,t,n,i,o,r,a,s){if(e){a=a||TileTree.TraversalType.PreOrder;var l=i*ec+n;if(a===TileTree.TraversalType.PreOrder&&(o&&o(e,t,l,n,i),r&&r.push(e)),e.children&&0!==e.children.length){for(var c=i*ec,u=n*ec,h=0;h<ec;h++)for(var d=0;d<ec;d++)Xl(e.children[d*ec+h],t+1,u+h,c+d,o,r,a);a===TileTree.TraversalType.PostOrder&&(o&&o(e,t,l,n,i),r&&r.push(e))}}}function Kl(e,t,n){if(n>e.levels)return null;var i=new Zl(e,t);e.allNodes.push(i);for(var o=0;o<tc;o++)i.children[o]=Kl(e,i,n+1);return i}function $l(e,t,n,i,o){if(!e)return null;if(0===n)return e;if(!e.children||0===e.children.length)return null;var r=Math.pow(ec,n)/ec,a=i%r,s=o%r,l=Math.floor(o/r),c=Math.floor(i/r),u=l*ec+c;return $l(e.children[u],t+1,n-1,a,s)}ct("TileDownloader",(function(){var e,t;return t=e=function(e){f(n,EventEmitter);var t=Yl(n);function n(e){var i;return o(this,n),(i=t.call(this)).forceQueueTilesForPano=function(){var e=[],t=[];return function(n,i,o,r,a,s){e.length=0;for(var l=this.getTileDownloadDescriptors(n,i),c=0;c<l.length;c++){var u=l[c];u.status!==Ya.None&&u.status!==Ya.Queued||e.push(u)}if(o&&e.length>0){Ka.sortPanoTiles(e,n,o),t.length=0,eo.matchingTilesInDirection(n,i,o,r,a,t);for(var h=0,d=function(e){return e.face===p.face&&e.faceTileIndex===p.faceTileIndex};h<e.length;){var p=e[h];t.findIndex(d)<0?e.splice(h,1):h++}}for(var f=0;f<e.length;f++)this.forceQueue.push(e[f]);this.setStatusForAllDescriptors(this.forceQueue,Ya.ForceQueued),this.clearFromQueue(this.priorityQueue,Ya.ForceQueued,!1),s&&this.processQueueForDownloading(this.forceQueue,!0)}}(),i.cleanupActiveDownloads=function(){var e=[];return function(){e.length=0;for(var t=0;t<this.activeDownloads.length;t++){var n=this.activeDownloads[t];n.status!==Ya.Downloaded&&n.status!==Ya.Failed&&e.push(n)}this.activeDownloads.length=0,this.activeDownloads.push.apply(this.activeDownloads,e)}}(),i.getTileUrl=function(){var e={256:"256",512:"512",1024:"1k",2048:"2k",4096:"4k"},t={face:-1,faceTileIndex:-1,tileX:-1,tileY:-1};return function(n,i,o,r,a){eo.getTileLocation(i,r,t);var s=Math.floor(i/o),l=s*s,c=Math.floor(r/l),u="";1===at.tiling.customCompression&&at.tiling["q"+e[i]];var h=this.$app.store.getValue("metadata"),d=h.sceneKind||"tiles",p=h.sceneResolution||"2k";if(-1!=p.indexOf("/")){var f=p.split("/");d=f[0],p=f[1]}if("local"===this.$app.config.deploy||"face"===d?u="360view"==n.panoType?"tiles/"+n.view.imgSid+"/"+e[i]+"_face"+c+"_"+t.tileX+"_"+t.tileY+".jpg":"tiles/"+n.id+"/"+e[i]+"_face"+c+"_"+t.tileX+"_"+t.tileY+".jpg":(u="360view"==n.panoType?"tiles/".concat(n.view.resolution,"/").concat(n.view.imgSid):d+"/"+p+"/"+n.id,u+="_skybox"+c+".jpg?x-oss-process=","512"==e[i]?u+="image/resize,h_512":(u+="1k"==e[i]||"2k"==e[i]?"image/resize,m_lfit,w_"+i+"/crop,w_512,h_512,":"image/crop,w_512,h_512,",u+=0==t.tileX?"x_0,":"x_"+512*t.tileX+",",u+=0==t.tileY?"y_0":"y_"+512*t.tileY)),"360view"==n.panoType){if(!this.$app.core.get("Player").viewLinkManager.views[n.id])return;u=this.$app.resource.getUserImagesURL("panorama/".concat(n.view.imgSid,"/").concat(u))}else u=this.getTiles(u);return u}}(),i.panos=null,i.retryMinimumTime=1e4,i.urls=null,i.panoLoadCallbacks={},i.downloadDescriptors={},i.priorityQueue=[],i.forceQueue=[],i.activeDownloads=[],i.tilePrioritizer=null,i.refreshInterval=null,i.processPriorityQueue=!1,i.concurrentDownloads=e.concurrentDownloads||1,i.downloadTestResults={},i.freeze=Object.freeze({Testing:1,Success:2,Fail:3}),i.$app=e.$app,i.index=0,i}return u(n,[{key:"init",value:function(){}},{key:"setUrls",value:function(e){this.urls=e}},{key:"setPanoData",value:function(e,t,n){this.panos=e.clone(),this.panos.filter((function(e){return e.tiled})),this.imagePanos=t,this.panoGroupId=n}},{key:"refreshUpdateInterval",value:function(e){e||(e=0),this.refreshInterval=window.setTimeout(function(){this.update()?this.refreshUpdateInterval(n.ACTIVE_REFRESH_DELAY):this.refreshUpdateInterval(n.IDLE_REFRESH_DELAY)}.bind(this),e)}},{key:"start",value:function(){this.started=!0,this.refreshEveryFrame?this.$app.core.get("SceneRenderer").addComponent(this,!0):this.refreshUpdateInterval(0)}},{key:"useComponent",value:function(){this.refreshEveryFrame=!0,window.clearTimeout(this.refreshInterval),this.start()}},{key:"stop",value:function(){window.clearTimeout(this.refreshInterval),this.$app.core.get("SceneRenderer").removeComponent(this)}},{key:"update",value:function(){var e=this,t=this.forceQueue.length>0;return this.processQueueForDownloading(this.forceQueue),this.processPriorityQueue&&(De.intervalTool.isWaiting("processPriorityQueue_"+this.$app.resource.num+this.index,(function(){e.queuePrioritizedTilesForPanos(e.panos)}),this.$app.config.mobile?120:66),this.priorityQueue.length>0&&(t=!0),this.processQueueForDownloading(this.priorityQueue)),t}},{key:"clearForceQueue",value:function(){this.clearQueue(this.forceQueue)}},{key:"queuePrioritizedTilesForPanos",value:function(e){if(this.tilePrioritizer){var t=this.$app.core.get("Player"),n="level2"==t.lowTile?6:"level1"==t.lowTile?10:30;this.clearQueue(this.priorityQueue),this.tilePrioritizer.filterAndPrioritize(this.priorityQueue,e,this,n),this.clearFromQueue(this.priorityQueue,Ya.None,!0),this.setStatusOrRemoveForAllDescriptors(this.priorityQueue,Ya.Queued)}}},{key:"clearQueue",value:function(e){this.setStatusForAllDescriptors(e,Ya.None),e.length=0}},{key:"clearFromQueue",value:function(e,t,n){for(var i=0;i<e.length;i++){var o=e[i];o&&(t===o.status&&!n||t!==o.status&&n)&&(e[i]=null)}}},{key:"setStatusForAllDescriptors",value:function(e,t){for(var n=0;n<e.length;n++){var i=e[n];i&&(i.status=t)}}},{key:"setStatusOrRemoveForAllDescriptors",value:function(e,t){for(var n=0;n<e.length;n++){var i=e[n];i&&(i.status!==t?i.status=t:e[n]=null)}}},{key:"getTileDownloadDescriptors",value:function(e,t){var n=this.getAllTileDownloadDescriptorsForPano(e),i=n[t];return i||(i=this.buildDownloadDescriptorArray(t),n[t]=i,this.initTileDownloadDescriptors(i,e,t)),i}},{key:"getAllTileDownloadDescriptorsForPano",value:function(e){var t=this.downloadDescriptors[e.id];return t||(t={},this.downloadDescriptors[e.id]=t),t}},{key:"processQueueForDownloading",value:function(e,t){if(this.cleanupActiveDownloads(),e.length){var n=De.getBestCount({name:"concurrentDownloads",minCount:0,maxCount:6,durBound1:1,durBound2:12,ifLog:!1,maxHistory:4,isMobile:this.$app.config.mobile});if(this.activeDownloads.length<n||t)for(var i=t?e.length:n-this.activeDownloads.length,o=0,r=0;o<i&&e.length>0;r++){var a=e.shift();a&&(this.startDownload(a),o++)}}}},{key:"testDownload",value:function(e,t,n){var i=this.downloadTestResults[e];if(i)i===this.freeze.Success?n(!0):i===this.freeze.Fail&&n(!1);else{this.downloadTestResults[e]=this.freeze.Testing;var o=this.panos.list[0],r=this.getTileUrl(o,e,t,0),a=function(t){this.downloadTestResults[e]=this.freeze.Success,n(!0)}.bind(this),s=function(){this.downloadTestResults[e]=this.freeze.Fail,n(!1)}.bind(this);this.loadImage(r,0,a,s)}}},{key:"startDownload",value:function(e){e.status=Ya.Downloading;var t=this.getTileUrl(e.pano,e.panoSize,e.tileSize,e.tileIndex);this.activeDownloads.push(e),this.loadImage(t,n.DOWNLOAD_RETRIES,this.downloadComplete.bind(this,e),this.downloadFailed.bind(this,e))}},{key:"downloadFailed",value:function(e,t){e.pano.tileError=!0,console.warn(t),this.emit(ql)}},{key:"downloadComplete",value:function(e,t){if(e.panoGroupId===this.panoGroupId){var n=this.getPanoLoadCallbacks(e.pano,e.panoSize);e.status=Ya.Downloaded,n&&n.onProgress&&n.onProgress(e.pano,e.panoSize);var i={panoId:e.pano.id,image:t,tileSize:e.tileSize,panoSize:e.panoSize,tileIndex:e.tileIndex,faceTileIndex:e.faceTileIndex,totalTiles:e.totalTiles,face:e.face,tileX:e.tileX,tileY:e.tileY,direction:e.direction};e.image=t,this.emit(Wl,i),this.isPanoDownloaded(e.pano,e.panoSize)&&(i={panoId:e.pano.id,tileSize:e.tileSize,panoSize:e.panoSize},this.emit(Jl,i),n&&n.onLoad&&n.onLoad(e.pano,e.panoSize))}}},{key:"isPanoDownloaded",value:function(e,t){var n=this.getTileDownloadDescriptors(e,t);if(n.length<=0)return!1;for(var i=0;i<n.length;i++){if(n[i].status!==Ya.Downloaded)return!1}return!0}},{key:"setPanoLoadCallbacks",value:function(e,t,n,i,o){var r=e.id+":"+this.$app.core.get("QualityManager").getPanoSize(t);this.panoLoadCallbacks[r]={onLoad:n,onFail:i,onProgress:o}}},{key:"getPanoLoadCallbacks",value:function(e,t){var n=e.id+":"+t;return this.panoLoadCallbacks[n]}},{key:"buildDownloadDescriptorArray",value:function(e){for(var t=eo.getTileCountForSize(e),n=[],i=0;i<t;i++){var o=this.buildDownloadDescriptor();n.push(o)}return n}},{key:"buildDownloadDescriptor",value:function(){return{panoGroupId:null,pano:null,panoSize:-1,tileSize:-1,tileIndex:-1,totalTiles:-1,faceTileIndex:-1,status:Ya.None,url:null,image:null,direction:new THREE.Vector3,face:-1,cubeFace:-1,tileX:-1,tileY:-1}}},{key:"initTileDownloadDescriptors",value:function(e,t,n){for(var i=0;i<e.length;i++){var o=e[i];this.initTileDownloadDescriptor(o,t,n,i)}}},{key:"initTileDownloadDescriptor",value:function(e,t,n,i){var o=n>=eo.TILE_SIZE?eo.TILE_SIZE:n;e.face=eo.getFaceForTile(n,i),e.cubeFace=jl.mapFaceToCubemapFace(e.face),e.panoGroupId=this.panoGroupId,e.pano=t,e.panoSize=n,e.tileSize=o,e.tileIndex=i,e.totalTiles=eo.getTileCountForSize(n),e.status=Ya.None,e.image=null,eo.getTileLocation(e.panoSize,e.tileIndex,e),eo.getTileVector(e.panoSize,e.tileSize,e.cubeFace,e.tileX,e.tileY,eo.LocationOnTile.Center,0,e.direction)}},{key:"loadImage",value:function(e,t,n,i){ri.getImage(e,t).then((function(e){n(e)})).fail(i)}},{key:"getTiles",value:function(e){return this.urls.get(e)}}]),n}(),e.IDLE_REFRESH_DELAY=500,e.ACTIVE_REFRESH_DELAY=16,e.DOWNLOAD_RETRIES=4,t})),window.TileTree=function(e,t){this.levels=t,this.tileSize=e,this.root=null,this.allNodes=[],function(e){e.root=Kl(e,null,0)}(this)};var ec=2,tc=ec*ec;TileTree.TraversalType=Object.freeze({PreOrder:0,PostOrder:1});var nc=0;TileTree.getLevelCountForSize=function(e,t){var n=0;for(t<e&&(t=e);!((t/=ec)<e);)n++;return n},TileTree.getSizeForLevel=function(e,t){return Math.pow(ec,t)*e},TileTree.prototype.getSubNode=function(e,t,n){(!t||e<this.tileSize)&&(t=0),(!n||e<this.tileSize)&&(n=0),e<this.tileSize&&(e=this.tileSize);var i=TileTree.getLevelCountForSize(this.tileSize,e);return $l(this.root,0,i,t,n)},TileTree.prototype.breadthFirst=function(e){var t=!!(e=e||{}).nullLevelEnd,n=e.maxLevel,i=e.minLevel,o=e.callback,r=e.saveVisited,a=[],s={},l=0;for(a.push(this.root),a.push(s);a.length>0&&!(null!=n&&l>n);){var c=a.shift();if(c===s)(!i||l>=i)&&(o&&t&&o(null),r&&t&&r.push(null)),a.length>0&&a.push(s),l++;else{if(c.children)for(var u=0;u<c.children.length;u++){c.children[u]&&a.push(c.children[u])}var h=this.getFaceIndexFromNode(c);(!i||l>=i)&&(o&&o(c,l,h),r&&r.push(c))}}},TileTree.prototype.getFaceIndexFromNode=function(e){if(!e)return-1;for(var t=1,n=e,i=0,o=0;;){var r=n.parent;if(!r)break;for(var a=-1,s=0;s<r.children.length;s++)r.children[s]===n&&(a=s);i=a%ec*t+i,o=Math.floor(a/ec)*t+o,t*=ec,n=r}return o*t+i},TileTree.prototype.depthFirst=function(e,t,n){Xl(this.root,0,0,0,e,t,n,this.tileSize)};var ic=TileTree;function oc(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}function rc(e){return e.config.mobile?De.getBestCount({name:"maxTileRender",minCount:0,maxCount:4,durBound1:1,durBound2:8,ifLog:!1,maxHistory:3}):De.getBestCount({name:"maxTileRender",minCount:0,maxCount:6,durBound1:1,durBound2:6,ifLog:!1,maxHistory:2})}function ac(){if(!this.uploadIntervalCancelled){sc=!0;var e=rc(this.$app);this.updateUploadQueue(2,6,e);this.peekNextFromUploadQueue()?this.refreshUploadInterval(16):this.uploadInterval=null}}var sc=!1,lc=at.tiling.uploadIntervalDelay,cc=at.tiling.initialIntervalDelay,uc=at.tiling.maxNonBaseUploadsPerFrame,hc=at.tiling.maxBaseUploadsPerFrame,dc=0,pc=1;ct("PanoRenderer",(function(){return function(e){f(n,EventEmitter);var t=oc(n);function n(e){var i,r,a,s;return o(this,n),(i=t.call(this)).updateActivePanos=function(){var e=[];return function(t,n){e.length=0;for(var i=0;i<this.activePanos.length;i++){t&&e.length===n&&e.push(t);var o=this.activePanos[i],r=this.getActiveRenderTargetDescriptor(o.id);t&&o.id===t.id||!this.isRenderTargetDescriptorValid(r)||e.push(o)}t&&n>=e.length&&e.push(t),this.activePanos.length=0,this.activePanos.push.apply(this.activePanos,e)}}(),i.renderPanoTiles=function(){var e=[];return function(t,n,i,o,r){this.zoomRenderTarget&&this.zoomRenderTarget.width===this.$app.core.get("QualityManager").getMaxZoomPanoSize()||this.zoomPanoRenderingDisabled||this.setupZoomRenderTarget(),n=n||this.direction||Vectors.FORWARD;var a=this.getActiveRenderTargetDescriptor(t);this.isRenderTargetDescriptorValid(a)||console.error("PanoRenderer.renderPanoTiles() -> Cannot render to a pano that is not activated.");for(var s=0;s<eo.FACES_PER_PANO;s++){var l=this.getTileTree(t,s);e.length=0,l.breadthFirst({saveVisited:e,maxLevel:r?512==r?0:1024==r?1:2048==r?2:3:3});for(var c=this.$app.config.mobile&&"panorama"==this.$app.core.get("Player").mode,u=0;u<e.length;u++){var h=e[u];this.queueTileUpload(h.tile,!1,!c&&(o||0===u&&i))}}this.updateDirection(n)}}(),i.getNextFromUploadQueue=function(){var e=function(e){var t=e.shift();return t.uploadQueued=!1,t};return function(){if(this.forceQueue.length>0)return e(this.forceQueue);var t=this.getTopUploadQueue();return t&&t.length>0?e(t):null}}(),i.refreshUploadInterval=function(){var e=null;return function(t){this.uploadIntervalCancelled||(e||(e=ac.bind(this)),null!=t||(t=lc),sc||(t=cc),this.uploadInterval=window.setTimeout(e,t),this.uploadIntervalDelay=t)}}(),i.update=function(){this.uploadIntervalCancelled=!0,this.$app.core.get("Player").lastFrameChanged;var e=rc(this.$app);this.updateUploadQueue(2,6,e)},i.uploadTile=(r={},a=at.tiling.overlayStyle,s={},function(e,t){var n=this,i=1==this.index?this.sceneRenderer2:this.$app.core.get("SceneRenderer"),o=e.panoId,l=e.image,c=e.tileSize,u=e.panoSize,h=e.tileIndex,d=e.totalTiles,p=e.tileX,f=e.tileY,m=!0,v=!1,g=!1,y=(this.getPanoDescriptor(o),this.getPanoLODDescriptor(o,u)),A=this.getActiveRenderTargetDescriptor(o),E=A.renderTarget,b=A.size;this.isPanoZoomed(o)&&this.zoomRenderTarget&&(E=this.zoomRenderTarget,b=this.zoomRenderTarget.width);var w=function(){y.uploaded.includes(h)||(y.uploaded.push(h),y.uploadCount++),n.emit(Dt.TileRenderSuccess,o,u,h,d),y.uploadCount===d&&n.emit(Dt.PanoRenderComplete,o,u,d),n.setUploaded(e,!0),n.addCoverageForNode(e.node)};if(this.isRenderTargetDescriptorValid(A)||(m=!1,v=!1),t||(this.anyUploaded(e.node)&&(m=!1,v=!0,g=!0),this.isTileUploaded(e)&&(m=!1,v=!1,g=!0)),m){var x=c/u*b,C=p*c/u*b,T=f*c/u*b;if(u>this.$app.core.get("QualityManager").maxRenderTargetSize)this.$app.core.get("Player").model.getHighImage(l,e.cubeFace,p,f);else{r[c]||(r[c]=i.initSizedTexture2D(c,THREE.ClampToEdgeWrapping));var I=r[c];if(i.uploadTexture2D(l,I,0,0,c,c),1===a||2===a){var k=1===a?this.overlayTilesBasic:this.overlayTilesEnhanced;i.renderToCubeMap(I,E,c,c,0,0,c,c,C,T,x,x,e.cubeFace),i.renderToCubeMap(k[u],E,c,c,0,0,c,c,C,T,x,x,e.cubeFace,THREE.NormalBlending,!0,.5)}else i.renderToCubeMap(I,E,c,c,0,0,c,c,C,T,x,x,e.cubeFace)}w()}else g?w():(s[o+":"+u+":"+h]=!0,this.setUploaded(e,!1));return e.uploadAttempted||(y.uploadAttempts++,this.emit(Dt.TileUploadAttempted,o,u,h,d)),e.uploadAttempted=!0,y.uploadAttempts===d&&this.emit(Dt.UploadAttemptedForAllTiles,o,u,d),v}),i.tileDirectory={},i.activeRenderTargetDescriptors={},i.activePanos=[],i.panoLODDescriptors={},i.panoDescriptors={},i.tileTrees={},i.forceQueue=[],i.uploadQueues={},i.uploadInterval=null,i.uploadIntervalCancelled=!1,i.usingTileOverlay=!1,i.overlayTilesLoaded=!1,i.overlayTileBase=null,i.overlayTilesBasic={},i.overlayTilesEnhanced={},i.zoomRenderTarget=null,i.zoomPano=null,i.zoomingActive=!1,i.zoomPanoId=null,i.zoomPanoRenderingDisabled=!1,i.direction=new THREE.Vector3,i.initTime=-1,i.maxBaseUploadsPerFrame=hc,i.maxNonBaseUploadsPerFrame=uc,i.M=[],i.index=e||0,i}return u(n,[{key:"init",value:function(e,t,n){1==this.index&&(this.sceneRenderer2=e,this.tileDownloader2=t),this.initTime=performance.now(),this.bindEvents()}},{key:"getActivePanoTextures",value:function(e){e=e||[];for(var t=0;t<M.length;t++){var n=M[t];n.renderTarget&&n.renderTarget.texture&&e.push(n.renderTarget.texture)}}},{key:"hasQueuedTiles",value:function(){var e=this.peekNextFromUploadQueue();return null!=e}},{key:"getActiveRenderTargetDescriptor",value:function(e){return this.activeRenderTargetDescriptors[e]}},{key:"setActiveRenderTargetDescriptor",value:function(e,t){this.activeRenderTargetDescriptors[e]=t}},{key:"bindEvents",value:function(){1==this.index?this.tileDownloader2.on(Wl,this.onTileDownloaded.bind(this)):this.$app.core.get("TileDownloader").on(Wl,this.onTileDownloaded.bind(this))}},{key:"setupZoomRenderTarget",value:function(){var e=this.$app.core.get("QualityManager");if(2048!=e.maxRenderTargetSize||2048!=e.getMaxNavPanoSize())if(e.tileClass>e.navTileClass){var t=1==this.index?this.sceneRenderer2:this.$app.core.get("SceneRenderer");if(this.zoomRenderTarget&&this.zoomRenderTarget.width===e.getMaxZoomPanoSize())return;var n=this.zoomRenderTarget;if(e.getMaxZoomPanoSize()>e.maxRenderTargetSize)return;if(this.zoomRenderTarget=this.initTiledPano(e.getMaxZoomPanoSize(),!1),n){var i=n.width,o=this.zoomRenderTarget.width;t.copyCubeMap(n.texture,this.zoomRenderTarget,i,i,o,o),n.texture.dispose(),n.texture.loaded=!1,n.texture.version=0,t.deallocateCubeTexture(n.texture),n.texture=null}this.zoomPanoRenderingDisabled=!1}else this.zoomPanoRenderingDisabled=!0}},{key:"enableHighQuality",value:function(e){this.$app.core.get("QualityManager").highQualityModeStarted||(this.setupZoomRenderTarget(),e(),this.$app.core.get("QualityManager").highQualityModeStarted=!0)}},{key:"enableUltraHighQualityMode",value:function(e){var t=this.$app.core.get("QualityManager");if("2k"==t.tileClass||"1k"==t.tileClass)return this.enableHighQuality(e);if(!t.ultraHighQualityModeEnabled()){var n=t.getPanoSize(Nt);this.$app.core.get("TileDownloader").testDownload(n,eo.TILE_SIZE,function(t){t&&(this.$app.core.get("QualityManager").enableUltraHighQualityMode(),this.setupZoomRenderTarget(),e())}.bind(this))}}},{key:"activateTiledPano",value:function(e,t,n,i){if(n&&this.clearAllQueuedUploads(),!i){for(var o=0;o<eo.FACES_PER_PANO;o++)this.initTileTree(e.id,o,this.$app.core.get("QualityManager").getMaxPossiblePanoSize());this.linkAllTilesAndNodes(e)}var r=this.getActiveRenderTargetDescriptor(e.id),a=t;if(a>this.$app.core.get("QualityManager").getMaxNavPanoSize()&&(a=this.$app.core.get("QualityManager").getMaxNavPanoSize()),!r||a!==r.size){if(r&&this.deactiveDescripor(r.renderTarget),!(r=this.activeDescripor(a))){var s=!this.$app.config.mobile||Fe.detectVRHeadset(),l=this.initTiledPano(a,s);(r=this.initDescriptor(l.width)).renderTarget=l}r.pano=e,this.resetPanoDescriptor(e.id),i||(this.resetPanoLODDescriptors(e.id),this.resetRenderStatus(e.id,!0,!0))}this.setActiveRenderTargetDescriptor(e.id,r);var c=n?0:1;return this.updateActivePanos(e,c),r.renderTarget}},{key:"deactivateTiledPano",value:function(e){var t=this.getActiveRenderTargetDescriptor(e.id);this.isRenderTargetDescriptorValid(t)&&(this.deactiveDescripor(t.renderTarget),this.setActiveRenderTargetDescriptor(e.id,null));var n=this.getUploadQueueForPano(e.id);this.clearUploadQueue(n),this.updateActivePanos()}},{key:"getActivePanoCount",value:function(){return this.activePanos.length}},{key:"resetRenderStatus",value:function(e,t,n,i){var o=null;i&&(o=ic.getLevelCountForSize(eo.TILE_SIZE,i)+1);for(var r=function(e,i,o,r){n&&(i.tile.zoomUploaded=!1),t&&(i.tile.uploaded=!1)},a=0;a<eo.FACES_PER_PANO;a++){this.getTileTree(e,a).breadthFirst({callback:r.bind(this,a),minLevel:o})}}},{key:"copyBaseRenderStatusToZoomed",value:function(e){for(var t=ic.getLevelCountForSize(eo.TILE_SIZE,this.$app.core.get("QualityManager").getMaxNavPanoSize()),n=function(e,t,n,i){t.tile.zoomUploaded=t.tile.uploaded,t.zoomCovered=t.covered},i=0;i<eo.FACES_PER_PANO;i++){this.getTileTree(e,i).breadthFirst({callback:n.bind(this,i),maxLevel:t})}}},{key:"isRenderTargetDescriptorValid",value:function(e){return e&&e.renderTarget}},{key:"isPanoActive",value:function(e){var t=this.getActiveRenderTargetDescriptor(e);return this.isRenderTargetDescriptorValid(t)}},{key:"isPanoZoomed",value:function(e){return this.zoomingActive&&this.zoomPanoId===e}},{key:"initTileTree",value:function(e,t,n){var i=this.tileTrees[e];i||(i=[],this.tileTrees[e]=i);var o=i[t];if(!o){var r=ic.getLevelCountForSize(eo.TILE_SIZE,n);o=new ic(eo.TILE_SIZE,r),i[t]=o}}},{key:"getTileTree",value:function(e,t){var n=this.tileTrees[e];n||console.error("PanoRenderer.getTileTree() -> Tree array not yet initialized!");var i=n[t];return i||console.error("PanoRenderer.getTileTree() -> Tree not yet initialized!"),i}},{key:"initTiledPano",value:function(e,t){return new THREE.WebGLCubeRenderTarget(e,{stencilBuffer:!1,generateMipmaps:t,minFilter:t?THREE.LinearMipMapLinearFilter:THREE.LinearFilter})}},{key:"getUploadQueueForPano",value:function(e){var t=this.uploadQueues[e];return t||(t=[],this.uploadQueues[e]=t),t}},{key:"isTileUploaded",value:function(e){return this.isPanoZoomed(e.panoId)?e.zoomUploaded:e.uploaded}},{key:"setUploaded",value:function(e,t){this.isPanoZoomed(e.panoId)?e.zoomUploaded=t:e.uploaded=t}},{key:"queueTileUpload",value:function(e,t,n){var i=this.getActiveRenderTargetDescriptor(e.panoId);if(this.isRenderTargetDescriptorValid(i)&&e.downloaded&&!this.isTileUploaded(e)&&(!e.uploadQueued||n)&&(!(e.panoSize>this.$app.core.get("QualityManager").getMaxNavPanoSize())||this.zoomingActive)){var o=this.getUploadQueueForPano(e.panoId);n?this.uploadTile(e,!1):(this.shoulPushToFrontOfQueue(e)?this.forceQueue.push(e):t&&this.direction?Ka.insertSortedPanoTile(o,e,i.pano,this.direction):o.push(e),e.uploadQueued=!0,this.uploadInterval||this.uploadIntervalCancelled||this.refreshUploadInterval(0))}}},{key:"shoulPushToFrontOfQueue",value:function(e){return 0===ic.getLevelCountForSize(eo.TILE_SIZE,e.panoSize)}},{key:"getTopUploadQueue",value:function(){for(var e=null,t=null,n=dc;n<=pc;n++)for(var i=0;i<this.activePanos.length;i++)if(e=this.activePanos[i],(t=this.getUploadQueueForPano(e.id)).length>0)switch(n){case dc:if(0===t[0].level)return t;break;case pc:return t}return null}},{key:"peekNextFromUploadQueue",value:function(){if(this.forceQueue.length>0)return this.forceQueue[0];var e=this.getTopUploadQueue();return e&&e.length>0?e[0]:null}},{key:"clearAllQueuedUploads",value:function(){this.clearAllUploadQueues(null,0)}},{key:"clearAllQueuedUploadsForPano",value:function(e){this.clearAllUploadQueues(e,0)}},{key:"clearAllUploadQueues",value:function(e,t){if(e)this.clearUploadQueue(this.getUploadQueueForPano(e),t),this.clearUploadQueue(this.forceQueue,t,e);else{for(var n=0;n<this.activePanos.length;n++){var i=this.activePanos[n];this.clearUploadQueue(this.getUploadQueueForPano(i.id),t)}this.clearUploadQueue(this.forceQueue,t)}}},{key:"clearUploadQueue",value:function(e,t,n){null!=t||(t=0);for(var i=0;i<e.length;){var o=e[i];(!n||n&&n===o.panoId)&&o.level>=t?(o.uploadQueued=!1,e.splice(i,1)):i++}}},{key:"updateUploadQueue",value:function(e,t,n){for(var i=0,o=0,r=0;!(o>=t||i>=e||r>=n);){var a=this.getNextFromUploadQueue();if(!a)break;if(0!==a.level?i++:o++,r++,!(a.panoSize>this.$app.core.get("QualityManager").getMaxNavPanoSize())||this.zoomingActive){var s=this.getActiveRenderTargetDescriptor(a.panoId);this.isRenderTargetDescriptorValid(s)&&this.uploadTile(a,a.forceUpload)}}}},{key:"updateDirection",value:function(e){if(e=e||this.direction){this.direction=e;for(var t=0;t<this.activePanos.length;t++){var n=this.activePanos[t],i=this.getUploadQueueForPano(n.id);Ka.sortPanoTiles(i,n,this.direction)}}}},{key:"linkTileAndNode",value:function(e,t){t.tile=e,e.node=t}},{key:"linkAllTilesAndNodes",value:function(e){for(var t=function(t,n,i,o,r){var a=this.getTileDirectoryEntry(e.id,n,o,r);this.linkTileAndNode(a,i)},n=0;n<eo.FACES_PER_PANO;n++){var i=this.getTileTree(e.id,n);i.breadthFirst({callback:t.bind(this,i,n)})}}},{key:"anyUploaded",value:function(e){if(!e)return!1;if(e.tile&&this.isTileUploaded(e.tile))return!0;if(e.children)for(var t=0;t<e.children.length;t++){var n=e.children[t];if(this.anyUploaded(n))return!0}return!1}},{key:"setNodeCovered",value:function(e,t){this.isPanoZoomed(e.tile.panoId)?e.zoomCovered=t:e.covered=t}},{key:"isNodeCovered",value:function(e){return!!e&&(this.isPanoZoomed(e.tile.panoId)?e.zoomCovered:e.covered)}},{key:"addCoverageForNode",value:function(e){if(this.setNodeCovered(e,!0),e.parent&&e.covered){var t=e.parent;this.nodeSubcovered(t)&&this.addCoverageForNode(t,!0)}}},{key:"calcFullCoverage",value:function(e){var t=!1;if(e.children)for(var n=0;n<e.children.length;n++){var i=e.children[n];t=t||this.calcFullCoverage(i)}e.covered=e.tile.uploaded||t}},{key:"nodeSubcovered",value:function(e){if(!e.children)return!1;for(var t=0;t<e.children.length;t++)if(!e.children[t]||!this.isNodeCovered(e.children[t]))return!1;return!0}},{key:"resetPanoDescriptor",value:function(e){this.getPanoDescriptor(e)}},{key:"getPanoDescriptor",value:function(e){var t=this.panoDescriptors[e];return t||(t={},this.panoDescriptors[e]=t),t}},{key:"resetPanoLODDescriptors",value:function(e){var t=this.getPanoLODDescriptors(e);for(var n in t)if(t.hasOwnProperty(n)){var i=t[n];i.uploadCount=0,i.uploadAttempts=0,i.uploaded=[]}}},{key:"getPanoLODDescriptor",value:function(e,t){var n=this.getPanoLODDescriptors(e),i=n[t];return i||(i={uploadCount:0,uploadAttempts:0,uploaded:[]},n[t]=i),i}},{key:"getPanoLODDescriptors",value:function(e){var t=this.panoLODDescriptors[e];return t||(t={},this.panoLODDescriptors[e]=t),t}},{key:"onTileDownloaded",value:function(e){var t=ic.getLevelCountForSize(eo.TILE_SIZE,e.panoSize),n=this.getTileDirectoryEntry(e.panoId,e.face,t,e.faceTileIndex);if(n.downloaded=!0,n.image=e.image,n.panoSize=e.panoSize,n.tileX=e.tileX,n.tileY=e.tileY,n.totalTiles=e.totalTiles,n.tileIndex=e.tileIndex,n.faceTileIndex=e.faceTileIndex,n.face=e.face,n.cubeFace=jl.mapFaceToCubemapFace(e.face),n.panoId=e.panoId,n.tileSize=e.tileSize,n.direction=(new THREE.Vector3).copy(e.direction),n.node=null,n.level=ic.getLevelCountForSize(eo.TILE_SIZE,n.panoSize),this.isPanoActive(n.panoId)){var i=this.getTileTree(n.panoId,n.face).getSubNode(n.panoSize,n.tileX,n.tileY);this.linkTileAndNode(n,i),this.queueTileUpload(n,!0)}}},{key:"getTileDirectoryEntry",value:function(e,t,n,i){var o=this.tileDirectory[e];o||(o={},this.tileDirectory[e]=o);var r=16384*t+1024*n+i,a=o[r];return a||(a={downloaded:!1,uploaded:!1,zoomUploaded:!1},o[r]=a),a._key=e+":"+t+":"+n+":"+i,a._tileKey=r,a}},{key:"setZoomingActive",value:function(e,t,n){this.zoomPanoRenderingDisabled||e===this.zoomingActive&&this.zoomPanoId===t.id||(this.zoomingActive=e,this.zoomPanoId=t.id,this.zoomingActive&&(this.zoomPanoId!==t.id||n)&&this.updateZoomedPanoFromBase(t))}},{key:"updateZoomedPanoFromBase",value:function(e){if(!this.zoomPanoRenderingDisabled){var t=this.$app.core.get("QualityManager"),n=1==this.index?this.sceneRenderer2:this.$app.core.get("SceneRenderer"),i=this.getActiveRenderTargetDescriptor(e.id);if(i&&i.renderTarget){if(this.zoomRenderTarget){var o=Math.min(t.maxRenderTargetSize,t.getMaxZoomPanoSize()),r=i.renderTarget,a=i.size;n.copyCubeMap(r.texture,this.zoomRenderTarget,a,a,o,o)}this.copyBaseRenderStatusToZoomed(e.id)}}}},{key:"switchPanoQuality",value:function(e,t){var n,i=t.useIdel,o=t.size;i&&(o&&(n=this.activeDescripor(o,!0)),n||(n=this.activeDescripor(null,!0)),n&&(o=n.size));if(e.updateTileQuality(o),e.tiledPanoRenderTarget){var r=e.tiledPanoRenderTarget.width;if(o!=r){this.deactiveDescripor(this.tiledPanoRenderTarget);var a=this.activateTiledPano(e,o,!1,!0);this.$app.core.get("SceneRenderer").copyCubeMap(e.tiledPanoRenderTarget.texture,a,r,r,o,o),e.tiledPanoRenderTarget=a,this.renderPanoTiles(e.id,null,null,null,o),e.updateSkyboxForZoomLevel()}}}},{key:"add",value:function(e){this.M.push(e)}},{key:"initDescriptor",value:function(e){var t={renderTarget:null,inUse:!1,size:-1,pano:null};return t.inUse=!0,t.size=e,this.add(t),t}},{key:"activeDescripor",value:function(e,t){for(var n=0;n<this.M.length;n++){var i=this.M[n];if(!(i.inUse||e&&i.size!==e))return t||(i.inUse=!0),i}return null}},{key:"deactiveDescripor",value:function(e){for(var t=0;t<this.M.length;t++){var n=this.M[t];if(n.renderTarget===e)return n.inUse=!1,!0}return!1}},{key:"disposeIdelTargets",value:function(){for(var e=0;e<this.M.length;e++){var t=this.M[e];t.inUse||t.renderTarget.dispose()}}}]),n}()}));var fc="panorama.videorenderer.suspendrender",mc="panorama.videorenderer.resumerender",vc="panorama.videorenderer.textured",gc="panorama.videorenderer.canplayvideo",yc="panorama.videorenderer.startvideo";function Ac(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}function Ec(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}ct("ModelManager",(function(){return function(e){f(n,EventEmitter);var t=Ac(n);function n(){var e;return o(this,n),(e=t.call(this)).modelMap={},e.activeModel=null,e.modelCount=0,e}return u(n,[{key:"init",value:function(){this.bindEvents()}},{key:"bindEvents",value:function(){this.$app.core.get("PanoRenderer").on(Dt.TileRenderSuccess,this.onTileRendered.bind(this)),this.$app.core.get("PanoVideoRenderer").on(vc,this.onVideoTextureUpdate.bind(this)),this.$app.core.get("PanoVideoRenderer").on(fc,this.onSuspendVideoRender.bind(this)),this.$app.core.get("PanoVideoRenderer").on(mc,this.onResumeVideoRender.bind(this))}},{key:"onTileRendered",value:function(e,t,n,i){}},{key:"onVideoTextureUpdate",value:function(e){this.activeModel&&this.activeModel.updateVideoTexture(e)}},{key:"onSuspendVideoRender",value:function(){this.activeModel&&this.activeModel.suspendVideoRender()}},{key:"onResumeVideoRender",value:function(){this.activeModel&&this.activeModel.resumeVideoRender()}},{key:"addModel",value:function(e){this.modelMap[e.sid]=e,0===this.modelCount&&this.activateModel(e.sid),this.modelCount++,this.emit(es)}},{key:"activateModel",value:function(e){var t=this.modelMap[e];if(!t)throw new BasicException("Tried to activate invalid model!");var n=this.activeModel;this.activeModel=t,this.$app.core.get("TileDownloader").setPanoData(t.panos,[],t.sid),this.$app.core.get("TileDownloader").setUrls(t.urls),t.panos.forEach(function(e){e.attachToPanoRenderer(this.$app.core.get("PanoRenderer")),e.attachToPanoVideoRenderer(this.$app.core.get("PanoVideoRenderer")),e.tileDownloader=this.$app.core.get("TileDownloader"),e.qualityManager=this.$app.core.get("QualityManager")}.bind(this)),this.emit(ts,{oldModel:n,model:t})}},{key:"getActiveModel",value:function(){return this.activeModel}}]),n}()}));var bc=function(e){f(n,THREE.PerspectiveCamera);var t=Ec(n);function n(e){var i;return o(this,n),(i=t.call(this,Aa.clampVFOV(at.insideFOV),window.innerWidth/window.innerHeight,at.insideNear,at.insideFar)).controls=null,i}return u(n,[{key:"updateAspect",value:function(e){this.aspect=e,this.updateProjectionMatrix()}}]),n}();function wc(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}var xc=function(e){f(n,THREE.PerspectiveCamera);var t=wc(n);function n(e){var i;return o(this,n),(i=t.call(this,Aa.clampVFOV(_e.dollhouseFOV),window.innerWidth/window.innerHeight,_e.dollhouseNear,_e.dollhouseFar)).controls=null,i}return u(n,[{key:"updateAspect",value:function(e){isNaN(e)&&(e=1),this.aspect=e,this.controls.updateDistance(e),this.updateProjectionMatrix()}}]),n}();function Cc(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}var Tc=function(e){f(n,THREE.OrthographicCamera);var t=Cc(n);function n(e){var i;o(this,n),i=t.call(this);var r=window.innerWidth/window.innerHeight;return(i=t.call(this,-_e.orthoBase,_e.orthoBase,_e.orthoBase/r,-_e.orthoBase/r,_e.orthoNear,_e.orthoFar)).controls=null,i.updateAspect(r),i}return u(n,[{key:"updateAspect",value:function(e){isNaN(e)&&(e=1),this.aspect=e}}]),n}(),Ic=0,kc=1,Bc=2;function Pc(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}var Rc=function(e){f(n,EventEmitter);var t=Pc(n);function n(e,i,r){var a;return o(this,n),(a=t.call(this)).camera=e,a.camera.controls=h(a),a.player=r,a.config=r.$app.config,a.dom=i,a.target=new THREE.Vector3(0,0,0),a.lookVector=new THREE.Vector3,a.lookSpeed=.05,a.rotationAcc=new THREE.Vector2,a.rotationSpeed=new THREE.Vector2,a.speed=1,a.lat=0,a.lon=0,a.phi=0,a.theta=0,a.enabled=!1,a.locked=!1,a.pointer=new THREE.Vector2(0,0),a.pointersLimit=2,a.pointers=[],a.rotationDifference=new THREE.Vector2,a.rotationHistory=[],a.pointerDragOn=!1,a.pointerDragStart=new THREE.Vector2(0,0),a.pinchDistance=0,a.moveStart=new THREE.Vector2,a.moveTolerance=.01,a.limitAngleIsBound=!0,a.config.camera&&null!=a.config.camera.lookLimitUp&&null!=a.config.camera.lookLimitDown&&(a.limitAngleIsBound=!1,a.insideLookLimitUp=a.config.camera.lookLimitUp,a.insideLookLimitDown=a.config.camera.lookLimitDown),a}return u(n,[{key:"usable",value:function(){return this.enabled&&!this.locked}},{key:"lookAt",value:function(e,t){var n=t||this.camera.position.clone().sub(e),i=Math.atan(n.z/n.x);i+=n.x<0?Math.PI:0,i+=n.x>0&&n.z<0?2*Math.PI:0,this.lon=THREE.MathUtils.radToDeg(i)+180;var o=Math.sqrt(n.x*n.x+n.z*n.z),r=Math.atan(n.y/o);this.lat=-THREE.MathUtils.radToDeg(r)}},{key:"startRotationFrom",value:function(e,t){var n=ge.handelPadding(e,t,this.dom);ge.convertScreenPositionToNDC(n.x,n.y,this.pointer,this.dom),this.pointerDragOn=!0,this.pointerDragStart.copy(this.pointer),this.moveStart.copy(this.pointer),this.rotationHistory=[],this.rotationSpeed.set(0,0)}},{key:"onMouseOver",value:function(e){!this.pointerDragOn||0!==e.which&&0!==e.buttons||this.onMouseUp(e)}},{key:"onTouchStart",value:function(e){if(this.usable()){switch(e.preventDefault(),e.stopPropagation(),e.touches.length){case 1:this.startRotationFrom(e.touches[0].clientX,e.touches[0].clientY);break;case 2:var t=(e.touches[0].clientX-e.touches[1].clientX)/window.innerWidth,n=(e.touches[0].clientY-e.touches[1].clientY)/window.innerHeight;this.pinchDistance=Math.sqrt(t*t+n*n)}this.emit(Ua,"touch")}}},{key:"onPointerDown",value:function(e){this.usable()&&"touch"===e.pointerType&&(this.pointers.length<this.pointersLimit&&this.pointers.push({id:e.pointerId,clientX:e.clientX,clientY:e.clientY}),e.touches=this.pointers,this.onTouchStart(e),this.emit(Ua,"pointer"))}},{key:"onMouseDown",value:function(e){if(this.usable()){switch(e.preventDefault(),e.stopPropagation(),e.button){case Ic:this.startRotationFrom(e.clientX,e.clientY)}this.emit(Ua,"mouse")}}},{key:"updateRotation",value:function(){if(this.usable()&&this.pointerDragOn){this.camera.matrixWorld=new THREE.Matrix4;var e=new THREE.Vector3(this.pointerDragStart.x,this.pointerDragStart.y,-1).unproject(this.camera),t=new THREE.Vector3(this.pointer.x,this.pointer.y,-1).unproject(this.camera),n=Math.sqrt(e.x*e.x+e.z*e.z),i=Math.sqrt(t.x*t.x+t.z*t.z),o=Math.atan2(e.y,n),r=Math.atan2(t.y,i);this.camera.updateMatrix(),this.camera.updateMatrixWorld(),this.rotationDifference.y=THREE.MathUtils.radToDeg(o-r),e.y=0,t.y=0;var a=Math.acos(e.dot(t)/e.length()/t.length());isNaN(a)||(this.rotationDifference.x=THREE.MathUtils.radToDeg(a),this.pointerDragStart.x<this.pointer.x&&(this.rotationDifference.x*=-1)),this.rotationDifference.multiplyScalar(this.speed),this.pointerDragStart.copy(this.pointer)}}},{key:"onMouseMove",value:function(e){if(this.usable()){var t=ge.handelPadding(e.clientX,e.clientY,this.dom);ge.convertScreenPositionToNDC(t.x,t.y,this.pointer,this.dom),this.pointerDragOn&&(Math.abs(this.pointer.x-this.moveStart.x)>this.moveTolerance||Math.abs(this.pointer.y-this.moveStart.y)>this.moveTolerance)&&this.emit(Qa,"mouse")}}},{key:"onTouchMove",value:function(e){if(this.usable())switch(this.emit(Qa,"touch"),e.touches.length){case 1:var t=ge.handelPadding(e.touches[0].clientX,e.touches[0].clientY,this.dom);ge.convertScreenPositionToNDC(t.x,t.y,this.pointer,this.dom);break;case 2:var n=(e.touches[0].clientX-e.touches[1].clientX)/window.innerWidth,i=(e.touches[0].clientY-e.touches[1].clientY)/window.innerHeight,o=this.pinchDistance-Math.sqrt(n*n+i*i);Math.abs(o)>.01&&(this.emit(_a),this.emit(Na,o),this.pinchDistance-=o)}}},{key:"onPointerMove",value:function(e){this.usable()&&"touch"===e.pointerType&&(this.pointers.forEach((function(t){e.pointerId===t.id&&(t.clientX=e.clientX,t.clientY=e.clientY)})),e.touches=this.pointers,this.onTouchMove(e))}},{key:"endRotation",value:function(){this.pointerDragOn=!1;var e=De.averageVectors(this.rotationHistory);this.player.$app.VRScreenSYNC?this.rotationSpeed.set(e.x*at.rotationAfterMoveMultiplierX/6,e.y*at.rotationAfterMoveMultiplierY/6):this.rotationSpeed.set(e.x*at.rotationAfterMoveMultiplierX,e.y*at.rotationAfterMoveMultiplierY)}},{key:"onTouchEnd",value:function(e){this.usable()&&(e.preventDefault(),e.stopPropagation(),this.endRotation())}},{key:"onMouseUp",value:function(e){this.usable()&&(e.preventDefault(),e.stopPropagation(),this.endRotation())}},{key:"onPointerUp",value:function(e){this.usable()&&"touch"===e.pointerType&&(this.pointers.forEach(function(t,n){e.pointerId===t.id&&this.pointers.splice(n,1)}.bind(this)),e.touches=this.pointers,this.onTouchEnd(e))}},{key:"update",value:function(e){if(!this.locked){for(this.updateRotation(),this.rotationHistory.push(this.rotationDifference.clone());this.rotationHistory.length>at.rotationAfterMoveHistoryCount;)this.rotationHistory.shift();this.lon+=this.rotationDifference.x,this.lat+=this.rotationDifference.y,this.rotationDifference.set(0,0);var t,n,i=Math.min(1,at.rotationFriction*e*60);if(this.rotationSpeed.x=this.rotationSpeed.x*(1-i)+this.rotationAcc.x*at.rotationAccelerationInside,this.rotationSpeed.y=this.rotationSpeed.y*(1-i)+this.rotationAcc.y*at.rotationAccelerationInside,this.lon+=this.rotationSpeed.x*e,this.lat+=this.rotationSpeed.y*e,null==this.limitDownAngel)t=null!=this.insideLookLimitDown?this.insideLookLimitDown:at.insideLookLimitDown,n=null!=this.insideLookLimitUp?this.insideLookLimitUp:at.insideLookLimitUp,this.limitAngleIsBound&&(t=t-at.insideFOV/2+this.camera.fov/2,n=n+at.insideFOV/2-this.camera.fov/2),this.lat=Math.max(t,Math.min(n,this.lat));else this.lat=this.limitDownAngel;this.phi=THREE.MathUtils.degToRad(90-this.lat),this.theta=THREE.MathUtils.degToRad(this.lon),this.lookVector.x=Math.sin(this.phi)*Math.cos(this.theta),this.lookVector.y=Math.cos(this.phi),this.lookVector.z=Math.sin(this.phi)*Math.sin(this.theta),this.target.copy(this.lookVector).add(this.camera.position),this.camera.lookAt(this.target)}}},{key:"onMouseWheel",value:function(e){if(this.usable()){var t=e.wheelDelta||-e.detail;this.emit(_a),this.emit(Ga,t)}}},{key:"onKeyDown",value:function(e){this.player.$app.config.useShortcutKeys&&this.usable()&&(e.metaKey||e.ctrlKey||(e.preventDefault(),this.handleKeyDown(e.which)))}},{key:"handleKeyDown",value:function(e){var t=function(e,t){this.rotationAcc[e]=t}.bind(this);this.emit(za);var n=!0;switch(e){case $a.LEFTARROW:case $a.J:t("x",-1);break;case $a.RIGHTARROW:case $a.L:t("x",1);break;case $a.I:t("y",1);break;case $a.K:t("y",-1);break;default:n=!1}n&&this.emit(Qa,"key")}},{key:"onKeyUp",value:function(e){this.usable()&&(e.preventDefault(),e.stopPropagation(),this.handleKeyUp(e.which))}},{key:"handleKeyUp",value:function(e){switch(e){case $a.LEFTARROW:case $a.J:case $a.RIGHTARROW:case $a.L:this.rotationAcc.x=0;break;case $a.I:case $a.K:this.rotationAcc.y=0}}},{key:"startRotating",value:function(e,t){e&&(this.rotationAcc.x=e),t&&(this.rotationAcc.y=t)}},{key:"stopRotating",value:function(e){e&&(this.rotationSpeed.x=this.rotationSpeed.y=0),this.rotationAcc.set(0,0)}},{key:"reset",value:function(){this.pointerDragOn=!1,this.rotationAcc.set(0,0),this.rotationSpeed.set(0,0),this.pointers=[]}},{key:"toJSON",value:function(){return{camera_position:{x:ge.toPrecision(this.camera.position.x,4),y:ge.toPrecision(this.camera.position.y,4),z:ge.toPrecision(this.camera.position.z,4)},camera_quaternion:{x:ge.toPrecision(this.camera.quaternion.x,4),y:ge.toPrecision(this.camera.quaternion.y,4),z:ge.toPrecision(this.camera.quaternion.z,4),w:ge.toPrecision(this.camera.quaternion.w,4)}}}},{key:"setStateFromJSON",value:function(e){this.camera.position.copy(e.camera_position),this.camera.quaternion.copy(e.camera_quaternion)}},{key:"startLookAt",value:function(e,t,n){var i=n&&(null!=n.lon||null!=n.lat);if(!i){var o=t?t.clone().sub(e):this.camera.position.clone().sub(e),r=Math.atan(o.z/o.x);r+=o.x<0?Math.PI:0,r+=o.x>0&&o.z<0?2*Math.PI:0;var a=THREE.MathUtils.radToDeg(r)+180,s=Math.sqrt(o.x*o.x+o.z*o.z),l=Math.atan(o.y/s),c=-THREE.MathUtils.radToDeg(l),u=(a-this.lon)%360;Math.abs(u)>180&&(u>0?u-=360:u+=360),a=this.lon+u;u=(c-this.lat)%360;Math.abs(u)>180&&(u>0?u-=360:u+=360),c=this.lat+u}var h=1200,d=ye.easeInOutQuad;if(null!=n){if(n.soon)return this.lon=a,void(this.lat=c);if(n.speed){if(i)var p=(n.lon?Math.abs(n.lon-this.lon):0)+(n.lat?Math.abs(n.lat-this.lat):0);else p=Math.abs(a-this.lon)+Math.abs(c-this.lat);h=p/n.speed,n.time&&(h=Math.min(n.time,h))}else n.time&&(h=n.time);n.fuc&&setTimeout(n.fuc,h),n.constantSpeed&&(d=null)}i?(n.lon&&Ae.start(St.property(this,"lon",n.lon),h,null,0,d),n.lat&&Ae.start(St.property(this,"lat",n.lat),h,null,0,d)):(Ae.start(St.property(this,"lon",a),h,null,0,d),Ae.start(St.property(this,"lat",c),h,null,0,d))}}]),n}(),Mc=-1,Sc=0,Dc=1,Lc=2,Fc=3,Hc=4;function Vc(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}var Oc=function(e){f(n,EventEmitter);var t=Vc(n);function n(e,i,r){var a;return o(this,n),(a=t.call(this)).setAutoPanPosition=function(e,t){var n=new THREE.Vector3,i=new THREE.Vector3;return function(e,t){n.copy(this.camera.position),void 0===e&&null===e||n.setX(e),void 0===t&&null===t||n.setZ(t);var o=this.camera.position.distanceTo(this.target),r=Vector3.FORWARD.clone().applyQuaternion(this.camera.quaternion);this.targetClamped=!1,i.copy(n).addScaledVector(r,o),this.targetBounds.containsPoint(i)||(this.targetBounds.clampPoint(i,i),n.copy(i).addScaledVector(r,-o),this.targetClamped=!0),this.autoPanPosition.x=n.x,this.autoPanPosition.z=n.z,this.autoPan&&this.stopAutoPanning()}}(),a.camera=e,a.camera.controls=h(a),a.player=r,a.enabled=!1,a.target=new THREE.Vector3,a.targetBounds=new THREE.Box3,a.zoomSpeed=1,a.minDistance=0,a.maxDistance=1/0,a.scale=1,a.dollyStart=new THREE.Vector2,a.dollyEnd=new THREE.Vector2,a.dollyDelta=new THREE.Vector2,a.noRotateUpDown=!1,a.rotateSpeed=1,a.keyboardZoomSpeed=0,a.keyPanSpeed=7,a.autoRotate=!1,a.autoRotateSpeed=2,a.minPolarAngle=THREE.MathUtils.degToRad(25),a.maxPolarAngle=THREE.MathUtils.degToRad(65),a.rotationAcceleration=new THREE.Vector2,a.rotationSpeed=new THREE.Vector2,a.rotateStart=new THREE.Vector2,a.rotateEnd=new THREE.Vector2,a.rotateDelta=new THREE.Vector2,a.phiDelta=0,a.thetaDelta=0,a.rotateCenter=new THREE.Vector2,a.rotateStartVec=new THREE.Vector2,a.rotateEndVec=new THREE.Vector2,a.autoPan=!1,a.autoPanPosition=new THREE.Vector3,a.panAcceleration=new THREE.Vector2,a.panSpeed=new THREE.Vector2,a.panStart=new THREE.Vector2,a.panEnd=new THREE.Vector2,a.panDelta=new THREE.Vector2,a.panOffset=new THREE.Vector3,a.panVector=new THREE.Vector3,a.offset=new THREE.Vector3,a.lastPosition=new THREE.Vector3,a.state=Mc,a.mouseActions={},a.touchActions={},a.lastMoveTime=0,a.pointersLimit=2,a.pointers=[],a.angle=1e-6,a}return u(n,[{key:"setBounds",value:function(e){this.targetBounds=e}},{key:"isEngaged",value:function(){return this.state!==Mc}},{key:"rotateLeft",value:function(e){void 0===e&&(e=this.getAutoRotationAngle()),this.thetaDelta-=e}},{key:"rotateUp",value:function(e){this.noRotateUpDown||(void 0===e&&(e=this.getAutoRotationAngle()),this.phiDelta-=e)}},{key:"panLeft",value:function(e){isNaN(e)&&(e=0);var t=this.camera.matrix.elements;this.panOffset.set(t[0],0,t[2]).normalize(),this.panOffset.multiplyScalar(-e),this.panVector.add(this.panOffset)}},{key:"panUp",value:function(e){isNaN(e)&&(e=0);var t=this.camera.matrix.elements;this.panOffset.set(t[4],0,t[6]).normalize(),this.panOffset.multiplyScalar(-e),this.panVector.add(this.panOffset)}},{key:"stopAutoPanning",value:function(){var e=this.autoPan;this.autoPan=!1,this.emit(this.targetClamped?qa:e?ja:Wa)}},{key:"dollyIn",value:function(e){void 0===e&&(e=this.getZoomScale()),this.scale/=e}},{key:"dollyOut",value:function(e){void 0===e&&(e=this.getZoomScale()),this.scale*=e}},{key:"updatePan",value:function(e){if(this.panSpeed.multiplyScalar(1-at.panFriction).addScaledVector(this.panAcceleration,at.panAccelerationOutside*e),this.pan(-this.panSpeed.x,this.panSpeed.y),this.autoPan){var t=(new THREE.Vector3).copy(this.autoPanPosition).sub(this.camera.position);t.setY(0).clampLength(0,50*e),this.target.add(t),this.camera.position.add(t),this.autoPanPosition.x===this.camera.position.x&&this.autoPanPosition.z===this.camera.position.z&&(this.autoPan=!1,this.stopAutoPanning())}}},{key:"update",value:function(e,t){if(!this.updateForCad||this.screenshot){e||(e=1/60);var n=Math.min(1,at.rotationFriction*e*60);this.rotationSpeed.multiplyScalar(1-n).addScaledVector(this.rotationAcceleration,at.rotationAccelerationOutside*e),this.rotateLeft(-this.rotationSpeed.x),this.noRotateUpDown||this.rotateUp(this.rotationSpeed.y),this.updatePan(e);var i=this.camera.position;this.offset.copy(i).sub(this.target);var o=Math.atan2(this.offset.x,this.offset.z),r=Math.atan2(Math.sqrt(this.offset.x*this.offset.x+this.offset.z*this.offset.z),this.offset.y);this.autoRotate&&this.rotateLeft(this.getAutoRotationAngle()),o+=this.thetaDelta,r+=this.phiDelta,r=Math.max(this.minPolarAngle,Math.min(this.maxPolarAngle,r)),r=Math.max(this.angle,Math.min(Math.PI-this.angle,r)),this.lon=o,this.lat=r;var a=this.updateZoom();a=Math.max(this.minDistance,Math.min(this.maxDistance,a)),this.target.add(this.panVector),this.targetBounds.clampPoint(this.target,this.target),this.offset.x=a*Math.sin(r)*Math.sin(o),this.offset.y=a*Math.cos(r),this.offset.z=a*Math.sin(r)*Math.cos(o),i.copy(this.target).add(this.offset),this.camera.lookAt(this.target),this.thetaDelta=0,this.phiDelta=0,this.scale=1,this.panVector.set(0,0,0),this.lastPosition.distanceTo(this.camera.position)>0&&this.lastPosition.copy(this.camera.position)}}},{key:"getAutoRotationAngle",value:function(){return 2*Math.PI/60/60*this.autoRotateSpeed}},{key:"getZoomScale",value:function(){return Math.pow(.95,this.zoomSpeed)}},{key:"onMouseDown",value:function(e){if(this.enabled){switch(e.preventDefault(),this.stopAutoPanning(),this.mouseDown=!0,this.state=this.mouseActions[e.button],this.state){case Sc:this.rotateStart.set(e.clientX,e.clientY),this.rotationSpeed.set(0,0),this.noRotateUpDown&&(this.rotateCenter=pt.getPos2d(this.target,this.player).pos,this.rotateStartVec.subVectors(this.rotateStart,this.rotateCenter));break;case Dc:this.dollyStart.set(e.clientX,e.clientY);break;case Lc:this.panStart.set(e.clientX,e.clientY)}this.emit(Ua,"mouse",e)}}},{key:"onMouseMove",value:function(e){if(this.enabled&&this.mouseDown&&0!==e.buttons){switch(e.preventDefault(),this.state){case Sc:if(this.rotateEnd.set(e.clientX,e.clientY),this.noRotateUpDown){this.rotateEndVec.subVectors(this.rotateEnd,this.rotateCenter);var t=ge.getVec2Angle(this.rotateStartVec,this.rotateEndVec),n=new THREE.Vector3(this.rotateEndVec.x,this.rotateEndVec.y,0),i=new THREE.Vector3(this.rotateStartVec.x,this.rotateStartVec.y,0);n.clone().cross(i).z<0&&(t*=-1),this.rotateLeft(t),this.rotateStartVec.copy(this.rotateEndVec)}else this.rotateDelta.subVectors(this.rotateEnd,this.rotateStart),this.rotateLeft(2*Math.PI*this.rotateDelta.x/this.player.domElement.clientWidth*this.rotateSpeed),this.rotateUp(2*Math.PI*this.rotateDelta.y/this.player.domElement.clientHeight*this.rotateSpeed),this.rotateStart.copy(this.rotateEnd);break;case Dc:this.dollyEnd.set(e.clientX,e.clientY),this.dollyDelta.subVectors(this.dollyEnd,this.dollyStart),(this.dollyDelta.y>0?this.dollyIn:this.dollyOut).call(this),this.dollyStart.copy(this.dollyEnd);break;case Lc:this.panEnd.set(e.clientX,e.clientY),this.panDelta.subVectors(this.panEnd,this.panStart),this.pan(this.panDelta.x,this.panDelta.y),this.panStart.copy(this.panEnd)}this.emit(Qa,"mouse"),this.lastMoveTime=e.timeStamp,this.update();var o={};o.quaternion={_w:this.camera.quaternion._w,_x:this.camera.quaternion._x,_y:this.camera.quaternion._y,_z:this.camera.quaternion._z},o.position={x:this.camera.position.x,y:this.camera.position.y,z:this.camera.position.z},o.target={x:this.target.x,y:this.target.y,z:this.target.z},this.player.emit(ia,{info:o,mode:this.player.mode,type:"moveModel"})}}},{key:"onMouseUp",value:function(e){this.enabled&&(this.mouseDown=!1,this.state=Mc,"mouseover"!==e.type&&(e.timeStamp>this.lastMoveTime+100?(this.rotationSpeed.set(0,0),this.rotationAcceleration.set(0,0)):this.rotationAcceleration.set(-this.rotateDelta.x,this.rotateDelta.y),this.update(),this.rotationAcceleration.set(0,0),this.rotateDelta.set(0,0)))}},{key:"onMouseOver",value:function(e){0!==e.which&&0!==e.buttons||this.onMouseUp(e)}},{key:"onMouseWheel",value:function(e){if(this.enabled&&at.useWheel){this.emit(Qa,"wheel");var t=e.wheelDelta||-e.detail,n=this.dollyIn;t>0&&(n=this.dollyOut),n.call(this),this.update();var i={};this.player.mode===xt.FLOORPLAN?(i.scale=this.absoluteScale,this.player.emit(ia,{info:i,mode:xt.FLOORPLAN,type:"moveModel"})):this.player.mode===xt.DOLLHOUSE&&(i.quaternion=this.camera.quaternion,i.position=this.camera.position,i.target=this.target,this.player.emit(ia,{info:i,mode:xt.DOLLHOUSE,type:"moveModel"}))}}},{key:"onKeyDown",value:function(e){this.enabled&&(e.metaKey||e.ctrlKey||(e.preventDefault(),this.handleKeyDown(e.which)))}},{key:"navRotationAcc",value:function(e,t){"y"===e?this.noRotateUpDown?this.keyboardZoomSpeed=t:this.rotationAcceleration.y=t:this.rotationAcceleration.x=t}},{key:"navPanAcc",value:function(e,t){this.stopAutoPanning(),this.panAcceleration[e]=t}},{key:"handleKeyDown",value:function(e){var t=!0;switch(e){case $a.UPARROW:case $a.I:this.navRotationAcc("y",1);break;case $a.DOWNARROW:case $a.K:this.navRotationAcc("y",-1);break;case $a.LEFTARROW:case $a.J:this.navRotationAcc("x",-1);break;case $a.RIGHTARROW:case $a.L:this.navRotationAcc("x",1);break;case $a.W:this.navPanAcc("y",1);break;case $a.S:this.navPanAcc("y",-1);break;case $a.A:this.navPanAcc("x",-1);break;case $a.D:this.navPanAcc("x",1);break;default:t=!1}t&&this.emit(Qa,"key")}},{key:"onKeyUp",value:function(e){this.enabled&&(e.preventDefault(),e.stopPropagation(),this.handleKeyUp(e.which))}},{key:"handleKeyUp",value:function(e){switch(e){case $a.I:case $a.K:case $a.UPARROW:case $a.DOWNARROW:this.keyboardZoomSpeed=0,this.rotationAcceleration.y=0;break;case $a.J:case $a.L:case $a.LEFTARROW:case $a.RIGHTARROW:this.rotationAcceleration.x=0;break;case $a.S:case $a.W:this.panAcceleration.y=0;break;case $a.A:case $a.D:this.panAcceleration.x=0}}},{key:"onTouchStart",value:function(e){if(this.enabled||this.state===Mc){e.preventDefault(),e.stopPropagation(),this.stopAutoPanning();var t=function(){if(2===e.touches.length){var t=e.touches[0].pageX-e.touches[1].pageX,n=e.touches[0].pageY-e.touches[1].pageY;this.dollyStart.set(t,n)}}.bind(this),n=function(){this.panStart.set(De.average(e.touches,"pageX"),De.average(e.touches,"pageY"))}.bind(this),i=function(){if(this.noRotateUpDown){e.touches[1]||console.error("!pointerEvent.touches[0]11");var t=new THREE.Vector2(e.touches[0].pageX,e.touches[0].pageY),n=new THREE.Vector2(e.touches[1].pageX,e.touches[1].pageY);this.rotateStartVec.subVectors(t,n),this.rotateStart=t,this.rotateCenter=pt.getPos2d(this.target,this.player).pos}else this.rotateStart.set(De.average(e.touches,"pageX"),De.average(e.touches,"pageY"))}.bind(this);switch(this.state=this.touchActions[e.touches.length],this.state){case Hc:t();case Lc:n();break;case Fc:t();case Sc:i()}this.rotationSpeed.set(0,0),this.emit(Ua,"touch",e)}}},{key:"onTouchMove",value:function(e){if(e.changedTouches&&this.enabled&&this.state!==Mc){if(this.touchActions[e.touches.length]!=this.state)return;e.preventDefault(),e.stopPropagation();var t=function(){var t=e.touches[0].pageX-e.touches[1].pageX,n=e.touches[0].pageY-e.touches[1].pageY;this.dollyEnd.set(t,n);var i=this.dollyEnd.length()/this.dollyStart.length();return i>1?this.dollyIn(i):this.dollyOut(1/i),this.dollyStart.copy(this.dollyEnd),i}.bind(this),n=function(){0!=e.touches.length&&(this.panEnd.set(De.average(e.touches,"pageX"),De.average(e.touches,"pageY")),this.panDelta.subVectors(this.panEnd,this.panStart),window.logEnable&&console.log("delta",Array.from(e.touches).map((function(e){return[e.pageX.toFixed(1),e.pageY.toFixed(1)]})),e.touches instanceof Array,e.currentTarget.className+e.currentTarget.nodeName),this.pan(this.panDelta.x,this.panDelta.y),this.panStart.copy(this.panEnd),this.rotateDelta.set(0,0))}.bind(this),i=function(t,n){var i=new THREE.Vector2(e.touches[0].pageX,e.touches[0].pageY),o=i.clone().rotateAround(this.rotateCenter,n).clone().sub(this.rotateCenter).multiplyScalar(1/t),r=this.rotateCenter.clone().sub(this.rotateStart);this.panDelta.addVectors(o,r),this.pan(this.panDelta.x,this.panDelta.y),this.rotateStart=i}.bind(this),o=function(){if(this.noRotateUpDown){var t=new THREE.Vector2(e.touches[0].pageX,e.touches[0].pageY),n=new THREE.Vector2(e.touches[1].pageX,e.touches[1].pageY);this.rotateEndVec.subVectors(t,n);var i=ge.getVec2Angle(this.rotateStartVec,this.rotateEndVec),o=new THREE.Vector3(this.rotateEndVec.x,this.rotateEndVec.y,0),r=new THREE.Vector3(this.rotateStartVec.x,this.rotateStartVec.y,0);return o.clone().cross(r).z<0&&(i*=-1),this.rotateLeft(i),this.rotateStartVec.copy(this.rotateEndVec),i}this.rotateEnd.set(De.average(e.touches,"pageX"),De.average(e.touches,"pageY")),this.rotateDelta.subVectors(this.rotateEnd,this.rotateStart),this.rotateLeft(2*Math.PI*this.rotateDelta.x/this.player.domElement.clientWidth*this.rotateSpeed),this.rotateUp(2*Math.PI*this.rotateDelta.y/this.player.domElement.clientHeight*this.rotateSpeed),this.rotateStart.copy(this.rotateEnd)}.bind(this);switch(this.state){case Hc:t();case Lc:n();break;case Fc:i(t(),o());break;case Dc:t();break;case Sc:o();break;default:this.state=Mc}this.lastMoveTime=e.timeStamp,this.emit(Qa,"touch");var r={scale:this.absoluteScale};r.quaternion={_w:this.camera.quaternion._w,_x:this.camera.quaternion._x,_y:this.camera.quaternion._y,_z:this.camera.quaternion._z},r.position={x:this.camera.position.x,y:this.camera.position.y,z:this.camera.position.z},r.target={x:this.target.x,y:this.target.y,z:this.target.z},this.player.emit(ia,{info:r,mode:this.player.mode,type:"moveModel"})}}},{key:"onTouchEnd",value:function(e){this.enabled&&(this.state===Sc&&(e.timeStamp>this.lastMoveTime+100?(this.rotationSpeed.set(0,0),this.rotationAcceleration.set(0,0)):this.rotationAcceleration.set(-this.rotateDelta.x,this.rotateDelta.y)),this.state=Mc,this.update(),this.rotationAcceleration.set(0,0),this.rotateDelta.set(0,0))}},{key:"onPointerDown",value:function(e){this.enabled&&("touch"===e.pointerType&&(this.pointers.length<this.pointersLimit&&!this.pointers.find((function(t){return t.id==e.pointerId}))&&this.pointers.push({id:e.pointerId,pageX:e.pageX,pageY:e.pageY}),e.touches=this.pointers,this.onTouchStart(e)),this.emit(Ua,"pointer",e))}},{key:"onPointerMove",value:function(e){this.enabled&&"touch"===e.pointerType&&(this.pointers.forEach((function(t){e.pointerId===t.id&&(t.pageX=e.pageX,t.pageY=e.pageY,t.pressed=e.pressed)})),e.touches=this.pointers,this.onTouchMove(e))}},{key:"onPointerUp",value:function(e){this.enabled&&"touch"===e.pointerType&&(this.pointers=this.pointers.filter((function(t){return t.id!=e.pointerId})),e.touches=this.pointers,this.onTouchEnd(e))}},{key:"reset",value:function(){this.state=Mc,this.stopAutoPanning(),this.rotationSpeed.set(0,0),this.rotationAcceleration.set(0,0),this.panSpeed.set(0,0),this.panAcceleration.set(0,0)}},{key:"toJSON",value:function(){return{camera_position:{x:ge.toPrecision(this.camera.position.x,4),y:ge.toPrecision(this.camera.position.y,4),z:ge.toPrecision(this.camera.position.z,4)},camera_quaternion:{x:ge.toPrecision(this.camera.quaternion.x,4),y:ge.toPrecision(this.camera.quaternion.y,4),z:ge.toPrecision(this.camera.quaternion.z,4),w:ge.toPrecision(this.camera.quaternion.w,4)}}}}]),n}();function Qc(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}var _c=function(e){f(n,e);var t=Qc(n);function n(e,i,r){var a,s;return o(this,n),(a=t.call(this,e,i,r)).minPolarAngle=at.dollhouseDefault.minPolarAngle,a.maxPolarAngle=at.dollhouseDefault.maxPolarAngle,a.minDistance=at.dollhouseDefault.minDistance,a.maxDistance=at.dollhouseDefault.maxDistance,a.adjustedMinDistance=a.minDistance,a.adjustedMaxDistance=a.maxDistance,a.dom=i,a.mode="model",a.mouseActions[Ic]=Sc,a.mouseActions[kc]=Dc,a.mouseActions[Bc]=Lc,a.touchActions[1]=Sc,a.touchActions[2]=Hc,r.on("intersect",(function(e){a.enabled&&(s=null==e?void 0:e.point)})),a.on(Ua,(function(e,t){if("mouse"==e&&2==t.button||("pointer"==e||"touch"==e)&&2==t.touches.length)if(s){var n=(new THREE.Vector3).subVectors(s,a.camera.position);a.dragDis=n.projectOnVector(r.getDirection()).length()}else a.dragDis=a.offset.length()})),a}return u(n,[{key:"pan",value:function(e,t){this.camera.updateMatrix();var n=2*this.dragDis*Math.tan(this.camera.fov/2*Math.PI/180);this.panLeft(e*n/this.player.domElement.clientHeight),this.panUp(-t*n/this.player.domElement.clientHeight)}},{key:"updateZoom",value:function(){return this.offset.length()*this.scale}},{key:"setZoomBounds",value:function(e){e.min.distanceTo(e.max);var t=e.min.distanceTo(e.max.clone().setY(e.min.y)),n=.5*(e.max.y-e.min.y)+.5*t;this.camera.suitModelAspect=t/n,this.distanceHorizon=t,this.distanceVerti=n,this.updateDistance(this.camera.aspect)}},{key:"updateDistance",value:function(e){var t=this.suitableDistance;if(this.player.model&&!isNaN(this.camera.suitModelAspect)&&!this.forbitSetRanges){var n=this.player.model.boundingBox;if(e<=this.camera.suitModelAspect){var i=Aa.getHFOVFromVFOV(this.camera.fov,e,1);this.suitableDistance=this.distanceHorizon/2/Math.tan(THREE.MathUtils.degToRad(i/2)),this.suitableDistance+=.5*Math.min(n.max.x-n.min.x,n.max.z-n.min.z)}else this.suitableDistance=this.distanceVerti/2/Math.tan(THREE.MathUtils.degToRad(this.camera.fov/2)),this.suitableDistance+=.5*Math.min(n.max.x-n.min.x,n.max.z-n.min.z);this.adjustedMaxDistance=10*this.suitableDistance,this.adjustedMinDistance=.1*this.suitableDistance,this.resetRanges(),this.enabled&&(this.scale=this.suitableDistance/t)}}},{key:"resetRanges",value:function(e,t){this.forbitSetRanges||(e?(this.minDistance=Math.min(e,this.minDistance),this.maxDistance=Math.max(e,this.maxDistance)):(this.minDistance=this.adjustedMinDistance,this.maxDistance=this.adjustedMaxDistance),t?(this.minPolarAngle=THREE.MathUtils.degToRad(-15),this.maxPolarAngle=THREE.MathUtils.degToRad(89.9)):(this.minPolarAngle=at.dollhouseDefault.minPolarAngle,this.maxPolarAngle=at.dollhouseDefault.maxPolarAngle))}},{key:"toJSON",value:function(){return Oc.prototype.toJSON.call(this)}}]),n}(Oc);function zc(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}var Uc=function(e){f(n,e);var t=zc(n);function n(e,i,r){var a;return o(this,n),(a=t.call(this,e,i,r)).minDistance=5,a.maxDistance=100,a.noRotateUpDown=!0,a.minPolarAngle=0,a.maxPolarAngle=0,a.absoluteScale=1,a.currentScale=1,a.dom=i,a.$app=r.$app,a.plane=null,a.cadSize=null,a.floorTexture=null,a.mouseActions[Ic]=Lc,a.mouseActions[kc]=Dc,a.mouseActions[Bc]=Sc,a.touchActions[1]=Lc,a.touchActions[2]=Fc,a}return u(n,[{key:"zoomToContain",value:function(e,t){var n=this.getDefaultAbsoluteScale(e,t);this.absoluteScale=n,this.currentScale=this.absoluteScale}},{key:"getDefaultAbsoluteScale",value:function(e,t,n){null!=n&&void 0!==n||(void 0===(n=this.$app.store.getValue("metadata").floorPlanAngle)&&(n=0),n=parseFloat(n)),e=e.clone().applyEuler(new THREE.Euler(0,n,0));var i=Math.max(Math.abs(e.x),Math.abs(e.z)*this.camera.aspect),o=this.$app.core.get("Player"),r=Math.min(o.domElement.clientWidth-400,o.domElement.clientHeight-200),a=o.linkEditor&&(o.linkEditor.setTagVisible||o.linkEditor.setPanoVisible)?1.2:2;return t=null!=t?t:Math.max(r*a/800,a),i/2/at.orthoBase*t}},{key:"rotateToView",value:function(e,t){var n=0,i=Fe.aspectRatio()<1,o=e.x<e.z,r=this.$app.store.getValue("metadata");n=void 0!==r.floorPlanAngle?2*Math.PI-1*parseFloat(r.floorPlanAngle):i===o?0:Math.PI/2,this.rotateLeft(n),this.update(0)}},{key:"pan",value:function(e,t){this.camera.updateMatrix(),this.panLeft(e*(this.camera.right-this.camera.left)/this.player.domElement.clientWidth),this.panUp(-t*(this.camera.top-this.camera.bottom)/this.player.domElement.clientHeight)}},{key:"updateZoom",value:function(){this.absoluteScale*=this.scale-.03*this.keyboardZoomSpeed,this.absoluteScale=Math.max(at.zoomNearLimit,Math.min(this.absoluteScale,at.zoomFarLimit)),this.currentScale=.8*this.currentScale+.2*this.absoluteScale;var e=this.snapshotTopAspect?this.camera.aspect/this.snapshotTopAspect:1;return this.camera.left=-at.orthoBase*this.currentScale*e,this.camera.right=at.orthoBase*this.currentScale*e,this.camera.top=at.orthoBase*this.currentScale*e/this.camera.aspect,this.camera.bottom=-at.orthoBase*this.currentScale*e/this.camera.aspect,this.camera.updateProjectionMatrix(),this.offset.length()}},{key:"updateDirect",value:function(e){e.floorPlanAngle||(e.floorPlanAngle=0),this.camera.left=-e.width/2,this.camera.right=e.width/2,this.camera.top=e.height/2,this.camera.bottom=-e.height/2,this.camera.updateProjectionMatrix(),this.camera.rotation.set(-Math.PI/2,0,e.floorPlanAngle);var t=new THREE.Vector2(e.center.x,-e.center.y),n=(new THREE.Vector2).copy(t).rotateAround(new THREE.Vector2(e.defaultCenter.x,-e.defaultCenter.y),-e.floorPlanAngle);this.camera.position.setX(n.x),this.camera.position.setZ(n.y),this.updateForCad=!0}},{key:"updateForRotateCad",value:function(e){e.floorPlanAngle||(e.floorPlanAngle=0),this.camera.rotation.set(-Math.PI/2,0,e.floorPlanAngle);var t=new THREE.Vector2(e.center.x,-e.center.y),n=(new THREE.Vector2).copy(t).rotateAround(new THREE.Vector2(e.defaultCenter.x,-e.defaultCenter.y),-e.floorPlanAngle);this.camera.position.setX(n.x),this.camera.position.setZ(n.y);var i=this.$app.core.get("Player").model;this.absoluteScale=this.getDefaultAbsoluteScale(i.size,null,e.floorPlanAngle),this.currentScale=this.absoluteScale;var o=this.snapshotTopAspect?this.camera.aspect/this.snapshotTopAspect:1;this.camera.left=-at.orthoBase*this.currentScale*o,this.camera.right=at.orthoBase*this.currentScale*o,this.camera.top=at.orthoBase*this.currentScale*o/this.camera.aspect,this.camera.bottom=-at.orthoBase*this.currentScale*o/this.camera.aspect,this.camera.updateProjectionMatrix(),this.updateForCad=!0}},{key:"recoverToUpdate",value:function(){this.updateForCad=!1,this.target.copy(this.camera.position);var e=this.$app.store.getValue("metadata"),t=parseFloat(e.floorPlanAngle||0);this.thetaDelta=t,this.absoluteScale=this.currentScale=this.camera.right/at.orthoBase,this.update(1)}},{key:"toJSON",value:function(){var e=new THREE.Quaternion,t=(new THREE.Quaternion).setFromAxisAngle(new THREE.Vector3(0,1,0),THREE.MathUtils.degToRad(90)),n=new THREE.Quaternion;return function(){var i=Oc.prototype.toJSON.call(this);return e.copy(i.camera_quaternion),n.copy(t),n.multiply(e),i.camera_quaternion.x=math.toPrecision(n.x,4),i.camera_quaternion.y=math.toPrecision(n.y,4),i.camera_quaternion.z=math.toPrecision(n.z,4),i.camera_quaternion.w=math.toPrecision(n.w,4),i.ortho_zoom=math.toPrecision(this.currentScale*this.camera.aspect,4),i}}},{key:"setZoomBounds",value:function(e){var t=e.getSize(new THREE.Vector3),n=Math.max(t.x,t.z)/2/at.orthoBase;n=Math.max(.1,n),at.zoomFarLimit=parseInt(10*n),at.zoomNearLimit=at.zoomFarLimit/100,at.floorplan.cameraHeight=THREE.MathUtils.clamp(Math.ceil(2.4*t.length()),5,5e3),this.maxDistance=Math.max(at.floorplan.cameraHeight+1,this.maxDistance)}}]),n}(Oc);function Nc(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}ct("CameraControls",(function(){return function(e){f(n,EventEmitter);var t=Nc(n);function n(){var e;return o(this,n),(e=t.call(this)).activeControl=null,e.controls={},e.cameras={},e}return u(n,[{key:"init",value:function(e,t){this.setUpControls(e,t),this.bindEvents(e)}},{key:"activateControls",value:function(e){this.activeControl&&(this.activeControl.reset(),this.activeControl.enabled=!1),this.controls[e]&&(this.controls[e].enabled=!0),this.activeControl=this.controls[e]}},{key:"setUpControls",value:function(e,t){var n={},i={},o=(t=t||[xt.PANORAMA,xt.DOLLHOUSE,xt.FLOORPLAN],[bc,xc,Tc]),r=[Rc,_c,Uc];t.forEach(function(t,a){n[t]=new o[a](e),i[t]=new r[a](n[t],e,this.$app.core.get("Player")),i[t].on(Qa,this.emit.bind(this,Qa)),i[t].on(Ua,this.emit.bind(this,Ua)),i[t].on(_a,this.emit.bind(this,_a)),i[t].on(za,this.emit.bind(this,za)),i[t].on(Na,this.emit.bind(this,Na)),i[t].on(Ga,this.emit.bind(this,Ga))}.bind(this)),this.controls=i,this.cameras=n}},{key:"bindEvents",value:function(e){var t=this;e.addEventListener("mousemove",this.onMouseMove.bind(this)),e.addEventListener("mousedown",this.onMouseDown.bind(this)),e.addEventListener("mouseup",this.onMouseUp.bind(this)),e.addEventListener("mouseover",this.onMouseOver.bind(this)),at.useWheel&&(e.addEventListener("mousewheel",this.onMouseWheel.bind(this),{passive:!1}),e.addEventListener("DOMMouseScroll",this.onMouseWheel.bind(this),{passive:!1})),e.addEventListener("touchstart",this.onTouchStart.bind(this),{passive:!1}),e.addEventListener("touchmove",this.onTouchMove.bind(this),{passive:!1}),e.addEventListener("touchend",this.onTouchEnd.bind(this)),e.addEventListener("contextmenu",(function(e){e.preventDefault()})),e.addEventListener("pointerdown",this.onPointerDown.bind(this)),e.addEventListener("pointermove",this.onPointerMove.bind(this)),e.addEventListener("pointerup",this.onPointerUp.bind(this)),e.addEventListener("pointerout",this.onPointerCancel.bind(this)),e.addEventListener("pointercancel",this.onPointerCancel.bind(this)),document.addEventListener("keydown",this.onKeyDown.bind(this)),document.addEventListener("keyup",this.onKeyUp.bind(this)),this.$app.core.get("ModelManager").on(ts,function(e){this.setModelForControls(e.model)}.bind(this)),this.on("syncCadAnd3D",(function(e){t.controls[xt.FLOORPLAN].updateDirect(e)})),this.on("syncCadAnd3DForRotate",(function(e){t.controls[xt.FLOORPLAN].updateForRotateCad(e)}))}},{key:"setModelForControls",value:function(e){var t=e.boundingBox.clone().expandByScalar(at.modelBoundsPadding);[xt.DOLLHOUSE,xt.FLOORPLAN].forEach(function(n){this.controls[n].setZoomBounds(e.boundingBox),this.controls[n].setBounds(t)}.bind(this))}},{key:"onMouseDown",value:function(e){e.preventDefault(),this.activeControl&&this.activeControl.onMouseDown(e)}},{key:"onMouseMove",value:function(e){e.preventDefault(),this.activeControl&&this.activeControl.onMouseMove(e)}},{key:"onMouseUp",value:function(e){e.preventDefault(),this.activeControl&&this.activeControl.onMouseUp(e)}},{key:"onMouseOver",value:function(e){e.preventDefault(),this.activeControl&&this.activeControl.onMouseOver(e)}},{key:"onMouseWheel",value:function(e){e.preventDefault(),this.activeControl&&this.activeControl.onMouseWheel(e)}},{key:"onTouchStart",value:function(e){e.preventDefault(),this.activeControl&&this.activeControl.onTouchStart(e)}},{key:"onTouchMove",value:function(e){var t=this,n=function(){e.preventDefault(),t.activeControl&&t.activeControl.onTouchMove(e)};this.$app.VRScreenSYNC?De.debounce(n,1e3/60,!0)():n()}},{key:"onTouchEnd",value:function(e){e.preventDefault(),this.activeControl&&this.activeControl.onTouchEnd(e)}},{key:"onPointerDown",value:function(e){if(e.preventDefault(),this.activeControl)switch(e.pointerType){case"mouse":this.activeControl.onMouseDown(e);break;default:this.activeControl.onPointerDown(e)}}},{key:"onPointerMove",value:function(e){var t=this,n=function(){if(e.preventDefault(),t.activeControl)switch(e.pointerType){case"mouse":t.activeControl.onMouseMove(e);break;default:t.activeControl.onPointerMove(e)}};this.$app.VRScreenSYNC?De.debounce(n,1e3/60,!0)():n()}},{key:"onPointerUp",value:function(e){if(e.preventDefault(),this.activeControl){switch(e.pointerType){case"mouse":this.activeControl.onMouseUp(e);break;default:this.activeControl.onPointerUp(e)}this.emit("pointerUp")}}},{key:"onPointerCancel",value:function(e){e.preventDefault(),this.activeControl&&"mouse"!==e.pointerType&&this.activeControl.onPointerUp(e)}},{key:"onKeyDown",value:function(e){this.$app.config.useShortcutKeys&&(e.metaKey||e.ctrlKey||(e.preventDefault(),this.activeControl&&this.activeControl.onKeyDown(e)))}},{key:"onKeyUp",value:function(e){e.preventDefault(),this.activeControl&&this.activeControl.onKeyUp(e)}}]),n}()}));var Gc="panovideo.canplay",jc="panovideo.start",Wc="panovideo.resume",qc="panovideo.pause",Jc="panovideo.stop",Yc="panovideo.switch";function Zc(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return Xc(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Xc(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var i=0,o=function(){};return{s:o,n:function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var r,a=!0,s=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return a=e.done,e},e:function(e){s=!0,r=e},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw r}}}}function Xc(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);n<t;n++)i[n]=e[n];return i}function Kc(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}var $c=function(e){f(n,EventEmitter);var t=Kc(n);function n(e,i){var r;return o(this,n),(r=t.call(this)).domElement=e,r.os="",r.environment="",r._resource=new Map,i.forEach((function(e,t){var n=r._createVideoElement(e.mp4.url,0==r._resource.size);r._resource.set(t,{url:e.mp4.url,video:n,texture:r._createTexture(n),loaded:!0})})),r.video=null,r.isFirstPlay=!0,r.isMuted=!0,r.events={onDomElementTouchStart:function(){r.shouldPlay&&(r.video.muted=r.isMuted,r.video.play(),console.log("onDomElementTouchStart muted",r.video.muted,"paused",r.video.paused),r.domElement.removeEventListener("touchstart",r.events.onDomElementTouchStart,!0))},onDomElementTouchEnd:function(){r.shouldPlay&&(r.video.muted=r.isMuted,r.domElement.removeEventListener("touchend",r.events.onDomElementTouchEnd,!0))},onDomElementMouseDown:function(){r.shouldPlay&&(r.video.muted=r.isMuted,r.domElement.removeEventListener("mousedown",r.events.onDomElementMouseDown,!0))}},r}return u(n,[{key:"_createTexture",value:function(e){var t=new THREE.VideoTexture(e);return t.minFilter=THREE.LinearFilter,t.uploaded=!1,t}},{key:"_createVideoElement",value:function(e){var t;return(t=document.createElement("video")).setAttribute("crossOrigin","anonymous"),t.setAttribute("playsinline","true"),t.setAttribute("x5-playsinline","true"),t.setAttribute("webkit-playsinline","true"),t.setAttribute("x5-video-player-type","h5"),t.setAttribute("controls","true"),t.autoplay=!1,t.muted=this.isMuted,t.loop=!0,t.src=e,t.style.position="fixed",t.style.left="0",t.style.top="0",t.style.width=Fe.urlHasValue("debug")?"300px":"1px",t.style.height=Fe.urlHasValue("debug")?"300px":"1px",t.style.display="block",t.style.zIndex=Fe.urlHasValue("debug")?"1000":"0",t.style.opacity=Fe.urlHasValue("debug")?"1":"0",t}},{key:"_onCanPlay",value:function(){this.emit(Gc)}},{key:"_onPlaying",value:function(){var e=this;this.emit(Yc,this.texture),this.video.ontimeupdate=function(t){e.video.currentTime>.5&&(e.emit(Wc),e.video.ontimeupdate=null,e.isFirstPlay=!1)},this.isFirstPlay&&this.emit(jc)}},{key:"_onPause",value:function(e){this.video&&(this.video._isPaused=!0),this.emit(qc)}},{key:"preload",value:function(e){var t=this;if(e!=this.video&&!e._isPrepload){e.muted=!0;try{top.WeixinJSBridge&&top.WeixinJSBridge.invoke("getNetworkType",{},(function(t){e.play()}),!1)}catch(t){e.play()}e.onplaying=function(){e.pause(),e._isPrepload=!0,t.video&&!t.video._isPaused&&t.video.play()}}}},{key:"preloadAll",value:function(){this.video&&(this.video._isPaused=this.video.paused);var e,t=Zc(this._resource.values());try{for(t.s();!(e=t.n()).done;){var n=e.value;this.preload(n.video)}}catch(e){t.e(e)}finally{t.f()}}},{key:"preloadPano",value:function(e){var t=this._resource.get(e.id);t&&this.preload(t.video)}},{key:"startVideo",value:function(e,t){var n=this._resource.get(e);n&&(n.video.autoplay=!0,n.video.onplaying=this._onPlaying.bind(this),n.video.onpause=this._onPause.bind(this),n.video.oncanplay=this._onCanPlay.bind(this),this.video=n.video,this.texture=n.texture,this.video.paused?this.play(this.video):this._onPlaying())}},{key:"play",value:function(e){var t=this;if(this.shouldPlay=e,this.isFirstPlay||!e._isCanplay)if(Fe.detectWeixin())try{top.WeixinJSBridge&&top.WeixinJSBridge.invoke("getNetworkType",{},(function(n){t.shouldPlay==e&&(console.log("play",e.src.split("/").pop()),e.play(),e._isCanplay=!0)}),!1)}catch(t){e.play(),e._isCanplay=!0}else e.play(),e._isCanplay=!0,Fe.detectAndroidMobile()?this.domElement.addEventListener("touchend",this.events.onDomElementTouchEnd,!0):Fe.detectIOS()?this.domElement.addEventListener("touchstart",this.events.onDomElementTouchStart,!0):this.domElement.addEventListener("mousedown",this.events.onDomElementMouseDown,!0);else e.play()}},{key:"pauseVideo",value:function(e){var t=this._resource.get(e);t&&(t.video.pause(),t.video.muted=!0,t.video.onplaying=null,this.shouldPlay==t.video&&(this.shouldPlay=!1))}},{key:"pause",value:function(){this.video&&(this.video._isPaused=!0,this.video.pause(),this.shouldPlay=!1)}},{key:"resume",value:function(){this.video?(this.play(this.video),this.video.onplaying=this._onPlaying.bind(this)):console.warn("PanoVideoRenderer: 没有可播放的视频")}},{key:"setMuted",value:function(e){var t,n=Zc(this._resource.values());try{for(n.s();!(t=n.n()).done;){t.value.video.muted=e}}catch(e){n.e(e)}finally{n.f()}this.isMuted=e}}]),n}();function eu(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return tu(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return tu(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var i=0,o=function(){};return{s:o,n:function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var r,a=!0,s=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return a=e.done,e},e:function(e){s=!0,r=e},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw r}}}}function tu(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);n<t;n++)i[n]=e[n];return i}function nu(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}$c.videoReady=!1;var iu=function(e){f(n,EventEmitter);var t=nu(n);function n(e,r){var a;return o(this,n),(a=t.call(this)).domElement=e,a.instances=new Map,a.instanceTextures=new Map,r.forEach((function(e,t){a.instances.set(t,a._createVideo(e.flv.url));var n=new i.VideoTexture(a.instances.get(t).videoElement);n.minFilter=i.LinearFilter,a.instanceTextures.set(t,n)})),a.video=null,a.texture=null,a.isFirstPlay=!0,a.isMuted=!0,a.events={onDomElementTouchStart:function(){a.video.muted=a.isMuted,a.domElement.removeEventListener("touchstart",a.events.onDomElementTouchStart,!0)},onDomElementTouchEnd:function(){a.video.muted=a.isMuted,a.domElement.removeEventListener("touchend",a.events.onDomElementTouchEnd,!0)},onDomElementMouseDown:function(){a.video.muted=a.isMuted,a.domElement.removeEventListener("mousedown",a.events.onDomElementMouseDown,!0)}},a}return u(n,[{key:"_createVideo",value:function(e){var t=document.createElement("video");t.setAttribute("crossOrigin","anonymous"),t.setAttribute("playsinline","true"),t.setAttribute("webkit-playsinline","true"),t.setAttribute("controls","true"),t.setAttribute("unfullscreen","true"),t.autoplay=!1,t.muted=!0,t.loop=!0,t.style.position="fixed",t.style.left="0",t.style.top="0",t.style.width=Fe.urlHasValue("debug")?"200px":"1px",t.style.display="block",t.style.zIndex=Fe.urlHasValue("debug")?"1000":"0",t.style.opacity=Fe.urlHasValue("debug")?"1":"0",this.domElement.appendChild(t);var n=flvjs.createPlayer({type:"flv",url:e},{lazyLoad:!0,lazyLoadMaxDuration:5});return n.videoElement=t,n.attachMediaElement(t),n.on(flvjs.Events.ERROR,this._onPlayerError.bind(this)),n}},{key:"_onPlayerError",value:function(e){console.warn("球幕视频资源加载错误:",e)}},{key:"_onPlaying",value:function(){var e=this;this.emit(Yc,this.texture),this.video.ontimeupdate=function(t){e.video.currentTime>.2&&(e.emit(Wc),e.isFirstPlay&&e.emit(jc),e.isFirstPlay=!1,e.video.ontimeupdate=null)}}},{key:"_onPause",value:function(){this.emit(qc),this.state=0}},{key:"preloadPano",value:function(e){var t=this.instances.get(e.id);t&&0==t.buffered.length&&t.load()}},{key:"startVideo",value:function(e){var t=this.instances.get(e);t&&(0==t.buffered.length&&t.load(),this.video=t.videoElement,this.video.onplaying=this._onPlaying.bind(this),this.video.onpause=this._onPause.bind(this),this.texture=this.instanceTextures.get(e),this.video.paused?this.play(this.video):this._onPlaying())}},{key:"pauseVideo",value:function(e){var t=this.instances.get(e);t&&(t.videoElement.pause(),t.videoElement.onplaying=null)}},{key:"play",value:function(e){this.isFirstPlay?(e.play(),Fe.detectAndroidMobile()?this.domElement.addEventListener("touchend",this.events.onDomElementTouchEnd,!0):Fe.detectIOS()?this.domElement.addEventListener("touchstart",this.events.onDomElementTouchStart,!0):this.domElement.addEventListener("mousedown",this.events.onDomElementMouseDown,!0)):e.play()}},{key:"pause",value:function(){this.video&&this.video.pause()}},{key:"resume",value:function(){this.video?this.play(this.video):console.warn("FlvVideoPlayer: 没有可播放的视频")}},{key:"setMuted",value:function(e){var t,n=eu(this.instances.values());try{for(n.s();!(t=n.n()).done;){t.value.videoElement.muted=e}}catch(e){n.e(e)}finally{n.f()}this.isMuted=e}}]),n}(),ou=0,ru=1;function au(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}function su(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}ct("PanoVideoRenderer",(function(){return function(e){f(n,EventEmitter);var t=au(n);function n(){var e;o(this,n),e=t.call(this),window.panoVideoRenderer=h(e),e.version=1,e.videoPlayer=null,e.activePanorama=null,e.nearestPano=null,e.ready=!1,e._state=ou,e.texture=null,e.isGuiding=!1,e.isRecording=!1,e.isSoundRecording=!1,e.loadingAnimEnable=!0,e.loadingTimeStamp=0,e.loadingUITimer=0,e.loadingUIAnimHandler=0;var i=THREE.UniformsUtils.clone(mn.videoLoading.uniforms);return i.uColor.value=new THREE.Vector4(0,.7843137254901961,.6862745098039216,.7),e.loadingUI=new THREE.Mesh(new THREE.PlaneBufferGeometry(.4,.4),new THREE.RawShaderMaterial({uniforms:i,vertexShader:mn.videoLoading.vertexShader,fragmentShader:mn.videoLoading.fragmentShader,transparent:!0})),e.loadingUI.visible=!1,e}return u(n,[{key:"init",value:function(e){var t=this,n=this.$app.core.get("Player");if(this.videosInfo=e,e){this.version=e.version,n.on("guide/play/start",(function(e){t.isGuiding=!0,t.setMuted(!0)})),n.on("guide/play/pause",(function(e){t.isGuiding=!1,t.setMuted(!1)})),this.$app.core.get("Player").on("guide/play/stop",(function(e){t.isGuiding=!1,t.setMuted(!1)})),this.ready=!0,(Fe.detectIE()||navigator.userAgent.match("JSN-AL00"))&&(this.ready=!1,console.warn("浏览器不支持球幕视频",navigator.userAgent)),this.$app.core.get("SceneRenderer").scene.add(this.loadingUI);n.on("linkEditorSetVisible",(function(e){!function(){if("floorplan"==n.mode){var e=t.canShowMarker("floorplan");console.log("updateVideoMarkerDisplay",e),n.model.panos.forEach((function(t){var i=e&&(n.model.allFloorsVisible||!t.floor.hidden);t.flagSpot&&(t.marker.material.opacity=i?1:0)}))}}()}));n.on("editViewStateChange",(function(e){0==e&&n.model.panos.forEach((function(e){var t=n.model.allFloorsVisible||!e.floor.hidden;e.flagSpot&&(e.marker.material.opacity=t?1:0)}))}))}else ft.warn("PanoVideoRenderer初始化失败,数据为空")}},{key:"initVideoPlayer",value:function(e,t){var n=Hs.getEnvironment(),i=n.os,o=n.environment;!window.MediaSource||"Android"!=i&&"WeChat"!=o?this.videoPlayer=new $c(e,t):this.videoPlayer=new iu(e,t),this.videoPlayer.on(Gc,this.onVideoCanPlay.bind(this)),this.videoPlayer.on(jc,this.onVideoStartPlay.bind(this)),this.videoPlayer.on(Yc,this.onVideoSwitch.bind(this)),this.videoPlayer.on(Wc,this.onVideoResume.bind(this)),this.videoPlayer.on(qc,this.onVideoPause.bind(this)),this.videoPlayer.on(Jc,this.onVideoStop.bind(this))}},{key:"activatePanorama",value:function(e,t){var n=this;e.hasVideo&&this.ready&&(this.activePanorama=e,this.started=!0,this.videoPlayer.startVideo(e.id,t),this.loadingUITimer=setTimeout((function(){n.showLoading(e),window.clearTimeout(n.loadingUITimer)}),500))}},{key:"deactivePanorama",value:function(e){null!=e&&null!=e.id&&this.videoPlayer.pauseVideo(e.id),this.activePanorama=null}},{key:"preActivatePanorama",value:function(e){this.videoPlayer.startVideo(e.id,!0)}},{key:"getActivePanorama",value:function(){return this.activePanorama}},{key:"showLoading",value:function(e){if(this.loadingAnimEnable){var t=(new THREE.Vector3).copy(e.position),n=(new THREE.Quaternion).setFromAxisAngle(new THREE.Vector3(0,1,0),THREE.MathUtils.degToRad(this.$app.core.get("Player").model.supportsTiles?90:180)),i=new THREE.Vector3(0,0,-1).applyQuaternion(n.multiply(e.quaternion));this.loadingUI.position.copy(t).add(i),this.loadingUI.lookAt(t),this.loadingTimeStamp=performance.now(),this.loadingAnimte(0)}}},{key:"hideLoading",value:function(){this.loadingUI.visible=!1,window.cancelAnimationFrame(this.loadingUIAnimHandler),window.clearTimeout(this.loadingUITimer)}},{key:"loadingAnimte",value:function(e){this.loadingUI.material.uniforms.uTime.value=performance.now()-this.loadingTimeStamp,this.loadingUIAnimHandler=window.requestAnimationFrame(this.loadingAnimte.bind(this))}},{key:"suspend",value:function(){if(!this.ready)return!1;this.videoPlayer.pause(),this.emit(fc)}},{key:"resume",value:function(){if(!this.ready)return!1;this.videoPlayer.resume()}},{key:"canPhonate",value:function(){return 0==this.isGuiding&&0==this.isRecording&&0==this.isSoundRecording}},{key:"setMuted",value:function(e){this.videoPlayer&&(this.canPhonate()||(e=!0),this.videoPlayer.setMuted(e))}},{key:"getState",value:function(){return this._state}},{key:"onVideoPanoramasEnter",value:function(e,t){}},{key:"onVideoPanoramasExit",value:function(e){}},{key:"onVideoCanPlay",value:function(){this.emit(gc)}},{key:"onVideoStartPlay",value:function(){this.emit(yc)}},{key:"onVideoSwitch",value:function(e){this.texture&&this.texture.dispose(),this.texture=e,this.emit(vc,e)}},{key:"onVideoResume",value:function(){this._state=ru,this.emit(mc),this.hideLoading()}},{key:"onVideoPause",value:function(){this._state=ou,this.emit(fc)}},{key:"onVideoStop",value:function(){this._state=ou,this.emit(fc)}},{key:"ifEnable",value:function(){return this.ready}},{key:"canShowMarker",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"floorplan",t=this.$app.core.get("Player");if("floorplan"==e)return!(this.$app.Plugins.EditCAD&&this.$app.Plugins.EditCAD.display||t.linkEditor&&(t.linkEditor.setPanoVisible||t.linkEditor.setTagVisible))}}]),n}()})),ct("DisplayController",(function(){return function(e){f(n,EventEmitter);var t=su(n);function n(e){var i;return o(this,n),(i=t.call(this)).fadeInSpeed=e,null!==i.fadeInSpeed&&void 0!==i.fadeInSpeed||(i.fadeInSpeed=0),i.panoVideoRenderer=null,i}return u(n,[{key:"init",value:function(){this.container=this.$app.core.get("Player").domElement,this.panoVideoRenderer=this.$app.core.get("PanoVideoRenderer"),this.updateModel(),this.bindEvents()}},{key:"bindEvents",value:function(){this.$app.core.get("Player").on(ca,this.handlePlayerFlyingStarted.bind(this)),this.$app.core.get("Player").on(ua,this.handlePlayerFlyingEnded.bind(this)),this.$app.core.get("Player").on(ra,this.handlePlayerModeChanging.bind(this)),this.$app.core.get("Player").on(oa,this.handlePlayerModeChanged.bind(this)),this.$app.core.get("Player").on(sa,this.handleClosestPanoChanging.bind(this)),this.$app.core.get("Player").on(da,this.handleStartInside.bind(this)),this.$app.core.get("Player").on(pa,this.handleStartOutside.bind(this))}},{key:"updateModel",value:function(){this.model=this.$app.core.get("ModelManager").getActiveModel()}},{key:"handlePlayerFlyingStarted",value:function(e){var t=this.model.panos.index[e.lastPanoId];this.panoVideoRenderer.deactivePanorama(t),this.panoVideoRenderer.setMuted(!0)}},{key:"handlePlayerFlyingEnded",value:function(e){var t=e.targetPano;t&&this.model.mode==xt.PANORAMA&&this.panoVideoRenderer.activatePanorama(t),this.panoVideoRenderer.setMuted(!1)}},{key:"handlePlayerModeChanging",value:function(e,t,n){var i,o=this.$app.core.get("ModelManager").getActiveModel();i=this.$app.core.get("Player").is360View(t,n)?0:at[t].markerOpacity,o.fadePanoMarkers(i,0,{mode:t})}},{key:"handlePlayerModeChanged",value:function(e,t){var n=this.$app.core.get("ModelManager").getActiveModel(),i=t===xt.PANORAMA?THREE.DoubleSide:THREE.FrontSide;n.setSide(i),n.setMode(t)}},{key:"handleClosestPanoChanging",value:function(e,t,n){n!==xt.TRANSITIONING&&(e&&e.hoverOff(n),t&&t.hoverOn(n))}},{key:"handleStartInside",value:function(e){var t=at[this.$app.core.get("Player").mode],n=e?0:t.transitionTime*t.skyboxOpacityLength;this.fadeIn(this.fadeInSpeed),this.model.alpha=0,this.model.skybox.material.uniforms.opacity.value=1,this.model.fadePanoMarkers(null,null,{player:this.$app.core.get("Player")});var i=this.$app.core.get("Player").reticule;Ae.start(St.property(i.material,"opacity",0),n,null,0,null,"retReOpac")}},{key:"handleStartOutside",value:function(e){this.fadeIn(e)}},{key:"fadeIn",value:function(e){null!=e||(e=2e3,logger.warn("DisplayController.fadeIn -> no transition time specified, defaulting to 2000 ms.")),this.model&&this.model.panos.forEach((function(e){return e.updateMakerStyle()}))}}]),n}()})),ct("QuickstartManager",(function(){return function(){function e(t,n,i,r,a){o(this,e),this.locked=!1,this.qualityManager=t,this.scene=n,this.camera=i,this.controls=r,this.quickStartcamera=r.camera,this.view=null,this.panoVideoRenderer=a,this.unlockDom=null,this.unlockHanlde=null,this.loadPromise=null,this.ready=!1,this.touchStartPosition=new THREE.Vector2(0,0),this.touchMoveDelta=new THREE.Vector2(0,0),this.touchPrevPosition=new THREE.Vector2(0,0),this.touchMoveOffset=new THREE.Vector2(0,0),this.enter=!1,this.canEnter=!1,this.animFov=null,this.animRotation=null,this.initTarget=new THREE.Vector3(0,0,0),this.enterView={pano:null,quaternion:new THREE.Quaternion,position:new THREE.Vector3,fov:at.insideFOV}}return u(e,[{key:"init",value:function(e,t){if(this.dom=this.$app.core.get("Player").domElement,this.pano=e.pano,this.setSize(window.innerWidth,window.innerHeight),this.initView(e),this.skybox=new THREE.Mesh(new THREE.BoxBufferGeometry(1,1,1),new fo({side:THREE.DoubleSide})),this.skybox.material.uniforms.map.value=e.pano.getSkyboxTexture(),this.skybox.quaternion.copy(e.quaternion),this.scene.add(this.skybox),this.skybox.material.depthTest=!1,this.skybox.material.depthWrite=!1,this.skybox.renderOrder=1e3,this.skybox.name="quickStartSkyBox",this.skybox.material.uniforms.modelAlpha.value=0,this.skybox.position.copy(this.pano.position),this.skybox.visible=!0,this.scene.add(this.skybox),this.pano.attachToPanoVideoRenderer(this.$app.core.get("PanoVideoRenderer")),this.$app.core.get("PanoVideoRenderer").on(yc,this.onVideoStartPlay.bind(this)),this.$app.core.get("PanoVideoRenderer").on(vc,this.onVideoTextureUpdate.bind(this)),this.$app.core.get("PanoVideoRenderer").on(mc,this.onVideoRenderResume.bind(this)),this.$app.core.get("PanoVideoRenderer").on(fc,this.onVideoRenderSuspend.bind(this)),this.$app.core.get("PanoVideoRenderer").videosInfo){var n=this.$app.core.get("PanoVideoRenderer").videosInfo.parameters;this.skybox.material.uniforms.parameters.value.set(n.inputWidth,n.inputHeight,n.outputWidth,n.outputHeight,n.focal,n.pixel,n.centerX,n.centerY,n.translateX,n.translateY,n.translateZ,0,n.lenOffsetX,n.lenOffsetY,n.videoWidth,n.videoHeight),8==n.cameraType?this.skybox.material.defines.HasVideo=8:2==n.cameraType&&(this.skybox.material.defines.HasVideo=2),this.skybox.material.defines.VideoMapping=n.mapping,this.skybox.material.uniforms.videoReady.value=0,this.skybox.material.uniforms.progress.value=1}}},{key:"initView",value:function(e){this.view=e;var t=e.pano;e.mode,e.zoom,e.position,e.quaternion,this.controls.locked=!1,this.controls.camera.position.copy(t.position),this.initTarget.copy(new THREE.Vector3(0,0,-1).applyQuaternion(e.quaternion)).add(e.position),this.controls.lookAt(this.initTarget),this.quickStartcamera.fov=this.view.fov,this.quickStartcamera.aspect=window.innerWidth/window.innerHeight,this.quickStartcamera.updateProjectionMatrix(),this.camera.fov=this.view.fov,this.camera.aspect=window.innerWidth/window.innerHeight,this.camera.position.copy(this.quickStartcamera.position),this.camera.quaternion.copy(this.quickStartcamera.quaternion),this.enterView.pano=t,this.enterView.position.copy(this.view.position),this.enterView.quaternion.copy(this.view.quaternion),this.enterView.fov=this.view.fov,this.controls.update(.016),this.view.position.copy(this.quickStartcamera.position),this.view.quaternion.copy(this.quickStartcamera.quaternion)}},{key:"load",value:function(e){var t=this;if(this.loadPromise)return this.loadPromise;var n=this.$app.store.__store.metadata;if(this.view=e,this.view.pano.shouldRedrawOnBaseLoaded=!0,this.view.pano.tiled){this.init(e,n);var i=document.querySelector(".player[name=main]"),o=this.qualityManager.getPanoSize(_t),r=this.qualityManager.getPanoSize(zt),a=Aa.getHFOVForCamera(this.quickStartcamera,i.clientWidth,i.clientHeight),s=this.quickStartcamera.fov,l=to.FORWARD.clone().applyQuaternion(this.view.quaternion),c=this.view.pano.loadTiledPano(r,l,{hFov:a,vFov:s},!1,!1,!0),u=this.view.pano.loadTiledPano(o,l.clone().negate(),null,!1,!1,!0);this.loadPromise=new Promise((function(e){(t.view.pano.hasVideo||t.qualityManager.getMaxNavPanoSize()<1024?u:c).then(e)}))}else this.init(e,n),this.loadPromise=new Promise((function(e){t.view.pano.hasVideo?t.view.pano.loadCube("low").then((function(){return e()})):t.view.pano.loadCube("high").then((function(){return e()}))}));return this.loadPromise.then((function(){t.ready=!0,t.skybox.material.setProjectedPanos(t.view.pano,t.view.pano),t.$app.core.get("Player").paintEditor.updatePanoPaint(t.view.pano.id,t.view.pano.id),t.$app.FilterManager.updatePanoFilters(t.view.pano,t.view.pano)})),this.loadPromise}},{key:"onVideoStartPlay",value:function(){}},{key:"onVideoTextureUpdate",value:function(e){this.skybox.material.uniforms.videoTexture.value=e}},{key:"onVideoRenderResume",value:function(){this.skybox.material.uniforms.videoReady.value=1,this.$app.Scene.emit("panorama.videorenderer.resumerender")}},{key:"onVideoRenderSuspend",value:function(){this.$app.Scene.emit("panorama.videorenderer.suspendrender")}},{key:"watingUnlock",value:function(){var e=this;return this.locked=!0,this.controls.locked=!0,new Promise((function(t){e.unlockHanlde=t}))}},{key:"autoUnlock",value:function(){return this.locked=!1,this.app.active=!0,this.controls.locked=!1,this.controls.limitDownAngel=null,this.pano.hasVideo&&Fe.detectIOS()?this.panoVideoRenderer.setMuted(!1):this.panoVideoRenderer.setMuted(!0),this.panoVideoRenderer.activatePanorama(this.pano),Promise.resolve(!0)}},{key:"activate",value:function(){this.panoVideoRenderer.setMuted("0"==Fe.urlQueryValue("sound")),this.panoVideoRenderer.activatePanorama(this.pano)}},{key:"unlock",value:function(e){var t=this;if(this.enter)this.controls.rotationAcc.set(0,0);else{this.enter=!0,this.app.emit("unlock"),this.controls.locked=!1,this.controls.rotationAcc.set(e.x>0?.3:-.3,0),this.controls.limitDownAngel=null,this.animFov&&Ae.cancel(this.animFov);try{parent.postMessage({num:config.projectNum,cmd:"unlocking",isParent:top==self},"*")}catch(e){console.error("跨域",e)}this.animFov=Ae.start(St.property(this.quickStartcamera,"fov",70),3e3,(function(){t.unlockHanlde&&t.unlockHanlde(),t.locked=!1,t.enter=!0,t.controls.locked=!1,t.controls.rotationAcc.set(0,0),t.controls.limitDownAngel=null;try{parent.postMessage({num:config.projectNum,cmd:"unlocked",isParent:top==self},"*")}catch(e){console.error("跨域",e)}}),0,ye.easeOutCubic)}}},{key:"exit",value:function(){this.enter=!1,this.pano.enter(),this.controls.rotationAcc.set(0,0),this.controls.limitDownAngel=null,this.animFov&&Ae.cancel(this.animFov),this.app.player.model?this.app.player.flyToPano({pano:this.pano}):this.smoothLookAt(this.initTarget,1e3)}},{key:"smoothLookAt",value:function(e,t){var n=this;t=t||1e3;var i=e.clone().sub(this.controls.camera.position).normalize(),o=this.controls.lookVector.clone(),r=new THREE.Vector3;new THREE.Vector3;this.animFov=Ae.start((function(e){r.lerpVectors(o,i,e),n.controls.lookAt(r.add(n.controls.camera.position))}),t)}},{key:"cancelRotate",value:function(){this.enter&&this.app.startOption.needUnlock&&this.controls.rotationAcc.set(0,0)}},{key:"update",value:function(e){this.locked,this.controls.update(e),this.camera.position.copy(this.quickStartcamera.position),this.camera.quaternion.copy(this.quickStartcamera.quaternion),this.camera.fov=this.quickStartcamera.fov,this.camera.updateProjectionMatrix(),this.view.position.copy(this.quickStartcamera.position),this.view.quaternion.copy(this.quickStartcamera.quaternion),this.view.fov=this.quickStartcamera.fov}},{key:"setSize",value:function(e,t){this.camera.aspect=e/t,this.camera.updateProjectionMatrix()}},{key:"destroy",value:function(){this.scene.remove(this.skybox),this.controls.rotationAcc.set(0,0)}},{key:"attachDom",value:function(e){e.addEventListener("touchstart",this.onTouchStart.bind(this)),e.addEventListener("touchmove",this.onTouchMove.bind(this)),e.addEventListener("touchend",this.onTouchEnd.bind(this))}},{key:"onTouchEvent",value:function(e,t){"touchstart"==t.type?this.onTouchStart(t):"touchmove"==t.type?this.onTouchMove(t):"touchend"==t.type&&this.onTouchEnd(t)}},{key:"onTouchStart",value:function(e){this.touchStartPosition.set(e.touches[0].clientX,e.touches[0].clientY),this.touchPrevPosition.set(e.touches[0].clientX,e.touches[0].clientY),this.touchMoveDelta.set(0,0),this.touchMoveOffset.set(0,0),this.enter||0==this.app.needUnlock?(this.controls.rotationAcc.set(0,0),this.controls.onTouchStart(e)):this.canEnter=!1,this._start={x:e.touches[0].clientX,y:e.touches[0].clientY}}},{key:"onTouchMove",value:function(e){if(this._move={x:e.touches[0].clientX,y:e.touches[0].clientY},this.touchMoveDelta.set(e.touches[0].clientX-this.touchPrevPosition.x,e.touches[0].clientY-this.touchPrevPosition.y),this.touchPrevPosition.set(e.touches[0].clientX,e.touches[0].clientY),this.touchMoveOffset.set(e.touches[0].clientX-this.touchStartPosition.x,e.touches[0].clientY-this.touchStartPosition.y),this.enter||0==this.app.needUnlock)this.controls.onTouchMove(e);else{var t=-this.touchMoveDelta.x;Math.abs(this.getAngle(this._start,this._move))<15&&0==this.enter&&this.unlock(new THREE.Vector2(t,0))}}},{key:"onTouchEnd",value:function(e){(this.enter||0==this.app.needUnlock)&&this.controls.onTouchEnd(e)}},{key:"getAngle",value:function(e,t){var n=t.x-e.x,i=t.y-e.y;return 360*Math.atan(i/n)/(2*Math.PI)}}]),e}()}));var lu={currentBlur:0,aspect:at.aspect,blurStrength:1,hblurPass:at.HorizontalBlurShader,vblurPass:at.VerticalBlurShader,bindEvents(e){e.on(oa,(function(e,t){e===xt.PANORAMA&&(Ae.cancel(lu.blur),Ae.cancel(lu.addBlur),Ae.start(lu.removeBlur,500,null,0,null,"deblur"))}))},blur(e){lu.currentBlur=e;var t=e*lu.blurStrength;at.VerticalBlurShader.uniforms.v.value=t/512*lu.aspect,at.HorizontalBlurShader.uniforms.h.value=t/512},addBlur(e){e=Math.max(e,lu.currentBlur),lu.blur(e)},removeBlur(e){e=Math.min(1-e,lu.currentBlur),lu.blur(e)}};lu.blur(0);var cu=function e(t){o(this,e),this.message=t};function uu(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}var hu,du,pu,fu,mu=function(e){f(n,e);var t=uu(n);function n(e){return o(this,n),t.call(this,e)}return n}(cu);function vu(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}window.screenFaceOrient=0;var gu,yu={},Au=function(e,t){"reset"==e?yu={}:(yu[e]=t,2!=Object.keys(yu).length||"granted"==yu.deviceMotion&&"granted"==yu.deviceOrientation||console.error("运动和方向访问失败"))},Eu=function(e){f(n,THREE.EventDispatcher);var t=vu(n);function n(){return o(this,n),t.call(this)}return u(n,[{key:"Init",value:function(e,t){if(hu=e,(du=t).VR=this,hu.renderer&&!hu.newRenderer&&!pu){var n=De.loadTextureFromCache(si.getImageURL("images/circleMarker.png"));if(du.model.panos.list.forEach((function(e){e.createVrMarker(n,du)})),hu.newRenderer=new xu(hu.renderer,hu,hu.camera),hu.isHuawei5X=Fe.detectHUAWEI5X(),hu.oldRenderer=hu.renderer,Iu.init(hu.renderer),function(){for(var e=[{name:"nova 10z",words:["CHA-AL80","537.36"],threshold:{min:.005,max:.7},useRatio:.2}],t=window.navigator.userAgent,n=0,i=e.length;n<i;n++){var o=e[n];if(!o.words.some((function(e){return!t.includes(e)}))){fu=o;break}}fu||(fu={name:"default",threshold:{min:.01,max:.3},useRatio:.5})}(),null!=du.$app.config.vr.markerHeight&&!isNaN(du.$app.config.vr.markerHeight)){var i=du.$app.config.vr.markerHeight;du.model.panos.forEach((function(e){e.vrMarker&&(e.vrMarker.position.y=e.floorPosition.y+i)}))}var o=!1,r=!1,a={setSize:function(e,t){hu.camera.aspect=e/t}};bu(.5,!0,1,16777215,0),Object.defineProperty(at,"vrEnabled",{get:function(){return o},set:function(e){if(e=!!e,du.cameraControls.controls.panorama.locked=e,du.model.chunks.forEach((function(t){return t.visible=!(e&&(Iu.xrType||at.vrSplitScreen))})),"portrait"!=window.VRScreenType&&(De.updateVisible(gu.cursor,"vr",e),hu.updateScreenSize({forceUpdateSize:!0}),du.model.updateVrMarker(e,du)),o=e,Iu.xrType)return e?Iu.enterVR():Iu.leaveVR();if(e&&at.vrSplitScreen?(hu.renderer=hu.newRenderer,du.cameraControls.cameras.panorama.staticFov=70):(hu.renderer=hu.oldRenderer,du.cameraControls.cameras.panorama.staticFov=null),window.VRScreenNotFull||(e?Fe.requestFullscreen(document.body):Fe.exitFullscreen()),hu.updateScreenSize({forceUpdateSize:!0}),e)du.viewLinkManager.hideAllViews(),hu.resizeListeners.push(a),setTimeout((function(){if(console.log("是否检测到陀螺仪 "+window.orientEnable),at.vrEnabled&&!window.orientEnable&&Fe.detectIOS()){var e=Fe.iosVersion();if(12==e.major&&e.minor>=2)window.VRScreenNotFull||(Fe.detectSafari()?$alert({content:i18n.t("modules.base.vr_fail_safari_tips")}):$alert({content:i18n.t("modules.base.vr_fail_app_tips")}));else if(e.major>=13){var t=window.vrPermission&&("granted"!=window.vrPermission.deviceMotion||"granted"!=window.vrPermission.deviceOrientation);setTimeout((function(){at.vrEnabled&&!window.orientEnable&&(Au("reset"),window.DeviceMotionEvent&&window.DeviceMotionEvent.requestPermission&&"function"==typeof window.DeviceMotionEvent.requestPermission?(console.log("开始获取权限1"),window.DeviceMotionEvent.requestPermission().then((function(e){console.log("permissionState1: "+e),Au("deviceMotion",e)})).catch((function(e){Au("deviceMotion",!1),console.log(e)}))):(console.log("window.DeviceMotionEvent undefined"),Au("deviceMotion",!1)),window.DeviceOrientationEvent&&window.DeviceOrientationEvent.requestPermission&&"function"==typeof window.DeviceOrientationEvent.requestPermission?(console.log("开始获取权限2"),window.DeviceOrientationEvent.requestPermission().then((function(e){console.log("permissionState2: "+e),Au("deviceOrientation",e)})).catch((function(e){Au("deviceOrientation",!1),console.log(e)}))):(console.log("window.DeviceOrientationEvent undefined"),Au("deviceOrientation",!1)))}),t?0:150)}else console.log("陀螺仪似乎未能启用 ios "+e.major+"."+e.minor)}}),200);else{var t=du.position,n=(new THREE.Quaternion).copy(du.camera.quaternion),i=new THREE.Vector3(0,0,-1).applyQuaternion(n).add(t);i.x==t.x&&i.z==t.z?console.log("看向正地面时无法lookAt,无法更新camera转向,直接退出vr"):du.cameraControls.activeControl.lookAt(i),du.viewLinkManager.showAllViews(),gu.shiftQuaternion=null;var r=hu.resizeListeners.indexOf(a);hu.resizeListeners.splice(r,1)}du.emit("vrStateChanged")}}),Object.defineProperty(at,"vrSplitScreen",{get:function(){return r},set:function(e){r==(e=!!e)||Iu.xrType||(r=e,at.vrEnabled&&"portrait"!=window.VRScreenType&&(e?(hu.renderer=hu.newRenderer,du.cameraControls.cameras.panorama.staticFov=70):(hu.renderer=hu.oldRenderer,du.cameraControls.cameras.panorama.staticFov=null),du.model.chunks.forEach((function(t){return t.visible=!e})),hu.updateScreenSize({forceUpdateSize:!0}),du.emit("vrStateChanged")))}}),90!=window.orientation&&270!=window.orientation||(at.vrSplitScreen=!0),window.addEventListener("orientationchange",(function(e){console.log("vr orientation ".concat(window.orientation)),0==window.orientation||180==window.orientation?at.vrSplitScreen=!1:at.vrSplitScreen=!0})),pu=!0}}},{key:"isSupportXR",value:function(){return!!Iu.xrType}}]),n}();window.VR=gu=new Eu;var bu=function(e,t,n,i,o){var r,a=new THREE.SpriteMaterial({opacity:n,color:i,transparent:t,map:Tu(si.getImageURL("images/vrCursor.png")),side:THREE.DoubleSide});a.map.offset=new THREE.Vector2(1/17*o,0),a.map.repeat=new THREE.Vector2(1/17,1),a.depthTest=!1,a.blending=THREE.AdditiveBlending,(r=new THREE.Sprite(a)).scale.set(e,e,e),r.position.z=-5,r.visible=!1,r.name="cursor",r.renderOrder=Ge,hu.camera.add(r),hu.scene.add(hu.camera),gu.cursor=r;var s=new wu(hu.scene,r,hu.camera);gu.cursor.triggerTargetEvent=s.triggerTargetEvent.bind(s),hu.updateListeners=[s].concat(hu.updateListeners)};window.orientEnable=0;var wu=function(e,t,n){var i=this;this.cursor=t,this.raycaster=new THREE.Raycaster,this.targetEventObj={},this.type=1,this.canStartAnimation=!0;var o=this;this.target=n,this.euler=new THREE.Euler,this.q0=new THREE.Quaternion,this.q1=new THREE.Quaternion(-Math.sqrt(.5),0,0,Math.sqrt(.5)),this.zee=new THREE.Vector3(0,0,1),this.alpha=-1e3,this.beta=-1e3,this.gamma=-1e3,this.lastQua=new THREE.Quaternion,this.orient=THREE.MathUtils.degToRad(window.orientation||0),window.addEventListener("orientationchange",(function(){o.orient=THREE.MathUtils.degToRad(window.orientation||0)})),window.addEventListener("deviceorientation",(function(e){if(at.vrEnabled||!window.orientEnable){window.orientEnable||(window.orientEnable=1);var t=THREE.MathUtils.degToRad(e.alpha),n=THREE.MathUtils.degToRad(e.beta),o=THREE.MathUtils.degToRad(e.gamma);i.isHuawei5X?(-1e3===i.alpha&&(i.alpha=t),-1e3===i.beta&&(i.beta=n),-1e3===i.gamma&&(i.gamma=o),Math.abs(t-i.alpha)>.06&&(i.alpha=t),Math.abs(n-i.beta)>.006&&(i.beta=n),Math.abs(o-i.gamma)>.006&&(i.gamma=o)):(i.alpha=t,i.beta=n,i.gamma=o)}})),this.setObjectQuaternion=function(e,t,n,i,r){if(-1e3!=t){var a=e.clone();o.euler.set(n,t,-i,"YXZ"),a.setFromEuler(o.euler),a.multiply(o.q1),a.multiply(o.q0.setFromAxisAngle(o.zee,-r));var s=this.lastQua.angleTo(a);if(!(s<1e-7)){if(fu&&gu.shiftQuaternion){e.copy(this.lastQua);var l=ge.linearClamp(s,fu.threshold.min,fu.threshold.max,fu.useRatio,.9);St.quaternion(e,a)(l)}else e.copy(a);if(this.lastQua.copy(e),null==gu.shiftQuaternion){var c=new THREE.Vector3(0,0,-1).applyQuaternion(du.camera.quaternion);c.setY(0).normalize();var u=(new THREE.Matrix4).lookAt(new THREE.Vector3,c,new THREE.Vector3(0,1,0)),h=(new THREE.Quaternion).setFromRotationMatrix(u),d=new THREE.Vector3(0,0,-1).applyQuaternion(e);d.setY(0).normalize();var p=(new THREE.Matrix4).lookAt(new THREE.Vector3,d,new THREE.Vector3(0,1,0)),f=(new THREE.Quaternion).setFromRotationMatrix(p).invert();gu.shiftQuaternion=h.clone().premultiply(f)}e.premultiply(gu.shiftQuaternion),function(e){if(!at.vrSplitScreen){var t=new THREE.Vector3(0,0,-1).applyQuaternion(e);du.camera.lookAt(du.camera.position.clone().add(t));var n=new THREE.Vector3(1,0,0).applyQuaternion(e),i=new THREE.Vector3(1,0,0).applyQuaternion(du.camera.quaternion);window.screenFaceOrient=THREE.MathUtils.radToDeg(n.angleTo(i)),n.clone().cross(i).dot(t)<0&&(window.screenFaceOrient*=-1)}}(e)}}},parent!==window&&window.addEventListener("message",(function(e){if(e.data&&!(e.data&&e.data.type&&e.data.type.indexOf("webpack")>-1)){var t="string"==typeof e.data?JSON.parse(e.data):e.data,n=-1!==window.navigator.userAgent.indexOf("KIW-TL00H");t&&t.alpha&&t.beta&&t.gamma&&function(e){var n=THREE.MathUtils.degToRad(t.alpha),i=THREE.MathUtils.degToRad(t.beta),r=THREE.MathUtils.degToRad(t.gamma);e?(-1e3===o.alpha&&(o.alpha=n),-1e3===o.beta&&(o.beta=i),-1e3===o.gamma&&(o.gamma=r),Math.abs(n-o.alpha)>.06&&(o.alpha=n),Math.abs(i-o.beta)>.006&&(o.beta=i),Math.abs(r-o.gamma)>.006&&(o.gamma=r)):(o.alpha=n,o.beta=i,o.gamma=r)}(n)}})),this.update=function(e){TWEEN.update(),at.vrEnabled&&(window.ifTest||Iu.xrType||this.setObjectQuaternion(du.cameraControls.activeControl.camera.quaternion,this.alpha,this.beta,this.gamma,this.orient),this.triggerTargetEvent())},this.triggerTargetEvent=function(){if(!Iu.hasHandel){var e=this.choseObj(),t=e?e.object:void 0;this.targetEventObj.currentObj=t,t!==this.targetEventObj.lastObj&&(t&&this.autoCursorPosition(e),1===this.type?(this.cursorAnimate&&this.cursorAnimate.stop(),t&&t.enabled&&this.startAnimate(function(){this.clickCallback(t)}.bind(this))):this.type,this.targetEventObj.lastObj=t)}},this.choseObj=function(){this.raycaster.setFromCamera({x:0,y:0},n);var e=this.raycaster.intersectObjects(du.model.vrMarkers.filter((function(e){return e.visible})));if(e.length>0)return e[0]},this.clickCallback=function(e){this.runTHREEAction(e,"onclick")},this.runTHREEAction=function(e,t){switch(t){case"onclick":e._listeners&&e._listeners.click&&e._listeners.click.forEach((function(e){e()}));break;case"onhover":e._listeners&&e._listeners.hover&&e._listeners.hover.forEach((function(e){e()}));break;case"onout":e._listeners&&e._listeners.out&&e._listeners.out.forEach((function(e){e()}))}},this.startAnimate=function(e){this.canStartAnimation&&this.initAnimation(e)},this.initAnimation=function(e){var t=this,n=this.cursor.material.map.offset;t.canStartAnimation=!1,this.cursorAnimate=new TWEEN.Tween(n).to({x:1},1e3).onStart((function(){t.canStartAnimation=!1})).onStop((function(){t.canStartAnimation=!0,this.x=0,n.x=0})).onUpdate((function(){})).onComplete((function(){e(),n.x=0,setTimeout((function(){t.canStartAnimation=!0}),1500)})),this.cursorAnimate.easing((function(e){return Math.floor(17*e)/17})),this.cursorAnimate.start()},this.autoCursorPosition=function(e){var t=Math.abs(e.distance-10);this.cursor.position.z=-t,t/=10,this.cursor.scale.set(t,t,t)}},xu=function(e,t,n){var i=new Cu(n);window.VRCamera=i,i.bananaAspect=.8,this.width,this.height,this.name="vrRenderer";var o=this;this.setSize=function(t,n){e.setSize.call(this,t,n),o.width=t,o.height=n},this.render=function(t,n,o,r){var a,s;if(n.__RESS__SKIP__STEREO__){var l=e.autoClear;return e.autoClear=!1,e.setRenderTarget(o),r&&e.clear(),e.render(t,n),e.setRenderTarget(null),void(e.autoClear=l)}if("PerspectiveCamera"===n.type)a=i.cameraL,s=i.cameraR,t.updateMatrixWorld(),null===n.parent&&n.updateMatrixWorld(),i.vrCameraUpdate(n);else{if("OrthographicCamera"!==n.type)return DEBUG&&console.error("Unsupported renderer: ",n.type);a=s=n}e.setScissorTest(!0),e.setScissor(0,0,this.width/2,this.height),e.setViewport(0,0,this.width/2,this.height),e.render.call(this,t,a,o,r),e.setScissor(this.width/2,0,this.width/2,this.height),e.setViewport(this.width/2,0,this.width/2,this.height),e.render.call(this,t,s,o,r),e.setScissorTest(!1)},this.__proto__={__proto__:e}},Cu=function(e){this.type="StereoCamera",this._aspect=1,this._overlap=.064,this.cameraL=new THREE.PerspectiveCamera,this.cameraL.layers.enable(0),this.cameraL.near=.01,this.cameraL.matrixAutoUpdate=!1,this.cameraR=new THREE.PerspectiveCamera,this.cameraR.layers.enable(0),this.cameraR.near=.01,this.cameraR.matrixAutoUpdate=!1,this.eyeRight=new THREE.Matrix4,this.eyeLeft=new THREE.Matrix4,this.vrCameraNeedsUpdate=!0,Object.defineProperty(this,"bananaAspect",{get:function(){return this._aspect},set:function(e){this._aspect!==e&&(this.vrCameraNeedsUpdate=!0),this._aspect=e}}),Object.defineProperty(this,"overlap",{get:function(){return this._overlap},set:function(e){this._overlap!==e&&(this.vrCameraNeedsUpdate=!0),this._overlap=e}}),this.vrCameraUpdate=function(e){if(this.vrCameraNeedsUpdate=this.vrCameraNeedsUpdate||this.bananaFov!==e.fov||this.bananaReal_aspect!==e.aspect*this.bananaAspect||this.bananaNear!==e.near||this.bananaFar!==e.far,this.vrCameraNeedsUpdate){this.vrCameraNeedsUpdate=!1,this.bananaFocus=e.focus,this.bananaFov=50,this.bananaReal_aspect=e.aspect*this.bananaAspect,this.bananaNear=e.near,this.bananaFar=e.far,this.bananaFocus=10;var t,n,i=e.projectionMatrix.clone(),o=this.overlap/2,r=o*this.bananaNear/this.bananaFocus,a=this.bananaNear*Math.tan(Math.PI/180*this.bananaFov*.5);this.eyeLeft.elements[12]=-o,this.eyeRight.elements[12]=o,t=-a*this.bananaReal_aspect+r,n=a*this.bananaReal_aspect+r,i.elements[0]=2*this.bananaNear/(n-t),i.elements[8]=(n+t)/(n-t),this.cameraL.projectionMatrix.copy(i),t=-a*this.bananaReal_aspect-r,n=a*this.bananaReal_aspect-r,i.elements[0]=2*this.bananaNear/(n-t),i.elements[8]=(n+t)/(n-t),this.cameraR.projectionMatrix.copy(i)}this.cameraL.matrixWorld.copy(e.matrixWorld).multiply(this.eyeLeft),this.cameraR.matrixWorld.copy(e.matrixWorld).multiply(this.eyeRight)}},Tu=function(e){var t=new THREE.TextureLoader;return t.crossOrigin="anonymous",t.load(e)},Iu={init(e){var t=this;this.renderer=e,e.xr.enabled=!0;var n=this.renderer.xr,i=n.getCamera(),o=function(){gu.cursor.parent.remove(gu.cursor),i.add(gu.cursor),hu.scene.add(i),t.initHandler(),du.on("update",(function(e){t.entered&&t.hasHandel&&(e.hasChanged.cameraChanged2||e.hasChanged.vrHandlerMoved)&&(t.setHandlerLength(du.intersect),du.reticule.move(null,null,!1))}))};if("xr"in navigator&&"isSessionSupported"in navigator.xr){navigator.xr.isSessionSupported("immersive-vr").then((function(e){e?(t.xrType="xr",o()):t.xrNotFound("isSessionSupported not supported")})).catch(this.xrNotFound.bind(this,"isSessionSupported error"))}else if("getVRDisplays"in navigator){console.log("\n getVRDisplays!!!!!!!!!\n \n \n ");var r=function(e){t.xrType="vr",t.device=e,t.renderer.xr.setDevice(e),o()};window.addEventListener("vrdisplayconnect",(function(e){r(e.display)}),!1),window.addEventListener("vrdisplaydisconnect",(function(){console.log("vrdisplaydisconnect")}),!1),window.addEventListener("vrdisplaypresentchange",(function(e){console.log("vrdisplaypresentchange",e.display.isPresenting?"EXIT VR":"ENTER VR"),t.callback(!!e.display.isPresenting)}),!1),window.addEventListener("vrdisplayactivate",(function(e){e.display.requestPresent([{source:this.renderer.domElement}])}),!1),navigator.getVRDisplays().then((function(e){e.length>0?r(e[0]):this.xrNotFound("no displays")})).catch(this.xrNotFound.bind(this,"getVRDisplays error"))}else this.xrNotFound("xr not supported");var a=n.updateCamera,s=this;n.updateCamera=function(e){a(e),s.getShiftPosMat(i.position),s.getTranCamMatrix(i.position,i.quaternion),i.cameras[0].matrix.premultiply(s.tranCamMatrix),i.cameras[1].matrix.premultiply(s.tranCamMatrix),i.cameras.concat([i]).forEach((function(e){e.layers.mask=du.camera.layers.mask})),a(e),e.quaternion.copy(i.quaternion),du.quaternion.copy(i.quaternion),e.updateMatrixWorld()},du.on("update",(function(e){t.entered&&e.hasChanged.moved&&t.devicePos&&(t.getShiftPosMat(t.devicePos),t.getTranCamMatrix())}))},enterVR(){var e=this;if(this.xrType)if(console.log("enterVR",this.xrType),Fe.exitFullscreen(),"vr"==this.xrType)this.device.isPresenting?this.device.exitPresent():this.device.requestPresent([{source:renderer.domElement}]);else if("xr"==this.xrType)if(null==this.currentSession){var t=function t(){console.log("onSessionEnded"),e.currentSession.removeEventListener("end",t),setTimeout((function(){e.renderer.xr.setSession(null),e.currentSession=null,e.callback(!1)}),1)},n=function(){console.log("onReset")},i="immersive-vr",o=function(e,t){var n=(t||{}).referenceSpaceType||"local-floor",i=t&&t.sessionInit||{};if("viewer"==n)return i;if("local"==n&&e.startsWith("immersive"))return i;if(i.optionalFeatures&&i.optionalFeatures.includes(n))return i;if(i.requiredFeatures&&i.requiredFeatures.includes(n))return i;var o=Object.assign({},i);return o.requiredFeatures=[n],i.requiredFeatures&&(o.requiredFeatures=o.requiredFeatures.concat(i.requiredFeatures)),o}(i);navigator.xr.requestSession(i,o).then((function(i){console.log("onSessionStarted"),i.addEventListener("end",t),i.addEventListener("reset",n),e.renderer.xr.setSession(i),e.currentSession=i,e.callback(!0)}))}else console.log("this.currentSession.end()",this.currentSession),this.currentSession.end()},leaveVR(){"xr"==this.xrType?this.currentSession&&this.currentSession.end():this.xrType},switchRender(e){e?(console.log("switchRender",e),this.renderer.setAnimationLoop((function(){hu.animate({byOther:!0})})),hu.started=!1):(this.renderer.setAnimationLoop(null),hu.started=!0,hu.animate())},callback(e){(e=!!e)||(at.vrEnabled=!1,this.tranCamMatrix=this.shiftQuaMat=this.shiftPosMat=null),this.switchRender(e),De.updateVisible(this.handler,"enterXR",e),this.entered=e,console.log("webxrEntered",e),du.$app.Scene.emit("webxrEntered",e)},xrNotFound(e,t){console.error("xrNotFound:",e,t)},getShiftQuaMat(e){var t=new THREE.Vector3(0,0,-1).applyQuaternion(du.quaternion);t.setY(0).normalize();var n=(new THREE.Matrix4).lookAt(new THREE.Vector3,t,new THREE.Vector3(0,1,0)),i=new THREE.Vector3(0,0,-1).applyQuaternion(e);i.setY(0).normalize();var o=(new THREE.Matrix4).lookAt(new THREE.Vector3,i,new THREE.Vector3(0,1,0));this.shiftQuaMat=n.clone().premultiply(o.clone().invert())},getShiftPosMat(e){this.shiftPosMat1=(new THREE.Matrix4).setPosition(e.clone().negate()),this.shiftPosMat2=(new THREE.Matrix4).setPosition(du.position.clone()),this.devicePos=e.clone()},getTranCamMatrix(e,t,n){(this.shiftQuaMat||t)&&(this.shiftPosMat1||e)&&(this.shiftQuaMat||this.getShiftQuaMat(t),this.shiftPosMat1||this.getShiftPosMat(e),this.tranCamMatrix=(new THREE.Matrix4).multiplyMatrices(this.shiftQuaMat,this.shiftPosMat1),this.tranCamMatrix=(new THREE.Matrix4).multiplyMatrices(this.shiftPosMat2,this.tranCamMatrix))},initHandler(){var e=this;console.log("initHandler");var t=/Chrome/i.test(navigator.userAgent),n=THREE.MathUtils.degToRad(5),i=this.renderer.xr.getController(0),o=this.renderer.xr.getController(1);i.name="controller0-right",o.name="controller1-left";var r=new THREE.MeshBasicMaterial({color:"#ffffff",opacity:.5,transparent:!0,depthTest:!1,depthWrite:!1}),a=new THREE.Mesh(new THREE.BoxBufferGeometry(.01,.01,1),r),s=(new THREE.Matrix4).makeTranslation(0,0,-.5);a.geometry.applyMatrix4(s);var l=new THREE.Mesh(new THREE.SphereBufferGeometry(.03,6,5),r);l.position.set(0,0,-1);var c=new THREE.Object3D;c.add(a),c.add(l),c.matrixAutoUpdate=!1,c.name="handler",De.updateVisible(c,"enterXR",!1),t&&De.updateVisible(c,"supportHandler",!1),hu.scene.add(c),this.handler=c,this.handler.lastMatrix=this.handler.matrix.clone();var u=i,h=function(t){var i,o;t.addEventListener("selectstart",(function(n){u!=t&&(u=t,console.log("切换control",t.name)),e.hasHandel||(De.updateVisible(c,"supportHandler",!0),du.model.panos.forEach((function(e){return e.vrMarker&&De.updateVisible(e.vrMarker,"supportHandler",!1)})),De.updateVisible(gu.cursor,"supportHandler",!1),e.hasHandel=!0),i=t.quaternion.clone(),o=Date.now()})),t.addEventListener("selectend",(function(e){var r=t.quaternion.clone();if(Date.now()-o<1e3&&r.angleTo(i)<n)return du.flyToPanoClosestToMouse()})),t.addEventListener("connected",(function(e){console.log("connected",t.name)})),t.addEventListener("disconnected",(function(e){console.log("disconnected",t.name)}));var r=function(){u==t&&(e.handler.lastMatrix=e.handler.matrix.clone(),e.tranCamMatrix||new THREE.Matrix4,e.tranCamMatrix&&e.handler.matrix.copy(t.matrix).premultiply(e.tranCamMatrix),e.handler.matrix.decompose(e.handler.position,e.handler.quaternion,new THREE.Vector3))};t.addEventListener("move",r),r()};h(i),h(o)},handlerMoved(){return this.hasHandel&&!this.handler.lastMatrix.equals(this.handler.matrix)},setRayCaster(e){e.set(this.handler.position,this.getHandlerDir())},getHandlerDir(){return new THREE.Vector3(0,0,-1).applyQuaternion(this.handler.quaternion)},setHandlerLength(e){e&&(this.handler.children[0].scale.z=e.distance,this.handler.children[1].position.set(0,0,-e.distance))}};gu.webxr=Iu;var ku=gu;function Bu(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}new THREE.RawShaderMaterial({fragmentShader:mn.skysphere.fragmentShader,vertexShader:mn.skysphere.vertexShader,uniforms:THREE.UniformsUtils.clone(mn.skysphere.uniforms),side:THREE.BackSide,name:"skysphereBG"}),window.requestAnimationFrame=window.requestAnimationFrame||window.webkitRequestAnimationFrame;var Pu=0;function Ru(e){var t,n,i,o,r,a=Math.floor,s=new Array(64),l=new Array(64),c=new Array(64),u=new Array(64),h=new Array(65535),d=new Array(65535),p=new Array(64),f=new Array(64),m=[],v=0,g=7,y=new Array(64),A=new Array(64),E=new Array(64),b=new Array(256),w=new Array(2048),x=[0,1,5,6,14,15,27,28,2,4,7,13,16,26,29,42,3,8,12,17,25,30,41,43,9,11,18,24,31,40,44,53,10,19,23,32,39,45,52,54,20,22,33,38,46,51,55,60,21,34,37,47,50,56,59,61,35,36,48,49,57,58,62,63],C=[0,0,1,5,1,1,1,1,1,1,0,0,0,0,0,0,0],T=[0,1,2,3,4,5,6,7,8,9,10,11],I=[0,0,2,1,3,3,2,4,3,5,5,4,4,0,0,1,125],k=[1,2,3,0,4,17,5,18,33,49,65,6,19,81,97,7,34,113,20,50,129,145,161,8,35,66,177,193,21,82,209,240,36,51,98,114,130,9,10,22,23,24,25,26,37,38,39,40,41,42,52,53,54,55,56,57,58,67,68,69,70,71,72,73,74,83,84,85,86,87,88,89,90,99,100,101,102,103,104,105,106,115,116,117,118,119,120,121,122,131,132,133,134,135,136,137,138,146,147,148,149,150,151,152,153,154,162,163,164,165,166,167,168,169,170,178,179,180,181,182,183,184,185,186,194,195,196,197,198,199,200,201,202,210,211,212,213,214,215,216,217,218,225,226,227,228,229,230,231,232,233,234,241,242,243,244,245,246,247,248,249,250],B=[0,0,3,1,1,1,1,1,1,1,1,1,0,0,0,0,0],P=[0,1,2,3,4,5,6,7,8,9,10,11],R=[0,0,2,1,2,4,4,3,4,7,5,4,4,0,1,2,119],M=[0,1,2,3,17,4,5,33,49,6,18,65,81,7,97,113,19,34,50,129,8,20,66,145,161,177,193,9,35,51,82,240,21,98,114,209,10,22,36,52,225,37,241,23,24,25,26,38,39,40,41,42,53,54,55,56,57,58,67,68,69,70,71,72,73,74,83,84,85,86,87,88,89,90,99,100,101,102,103,104,105,106,115,116,117,118,119,120,121,122,130,131,132,133,134,135,136,137,138,146,147,148,149,150,151,152,153,154,162,163,164,165,166,167,168,169,170,178,179,180,181,182,183,184,185,186,194,195,196,197,198,199,200,201,202,210,211,212,213,214,215,216,217,218,226,227,228,229,230,231,232,233,234,242,243,244,245,246,247,248,249,250];function S(e,t){for(var n=0,i=0,o=new Array,r=1;r<=16;r++){for(var a=1;a<=e[r];a++)o[t[i]]=[],o[t[i]][0]=n,o[t[i]][1]=r,i++,n++;n*=2}return o}function D(e){for(var t=e[0],n=e[1]-1;n>=0;)t&1<<n&&(v|=1<<g),n--,--g<0&&(255==v?(L(255),L(0)):L(v),g=7,v=0)}function L(e){m.push(e),m.length}function F(e){L(e>>8&255),L(255&e)}function H(e,t,n,i,o){for(var r,a=o[0],s=o[240],l=function(e,t){var n,i,o,r,a,s,l,c,u,h,d=0;for(u=0;u<8;++u){n=e[d],i=e[d+1],o=e[d+2],r=e[d+3],a=e[d+4],s=e[d+5],l=e[d+6];var f=n+(c=e[d+7]),m=n-c,v=i+l,g=i-l,y=o+s,A=o-s,E=r+a,b=r-a,w=f+E,x=f-E,C=v+y,T=v-y;e[d]=w+C,e[d+4]=w-C;var I=.707106781*(T+x);e[d+2]=x+I,e[d+6]=x-I;var k=.382683433*((w=b+A)-(T=g+m)),B=.5411961*w+k,P=1.306562965*T+k,R=.707106781*(C=A+g),M=m+R,S=m-R;e[d+5]=S+B,e[d+3]=S-B,e[d+1]=M+P,e[d+7]=M-P,d+=8}for(d=0,u=0;u<8;++u){n=e[d],i=e[d+8],o=e[d+16],r=e[d+24],a=e[d+32],s=e[d+40],l=e[d+48];var D=n+(c=e[d+56]),L=n-c,F=i+l,H=i-l,V=o+s,O=o-s,Q=r+a,_=r-a,z=D+Q,U=D-Q,N=F+V,G=F-V;e[d]=z+N,e[d+32]=z-N;var j=.707106781*(G+U);e[d+16]=U+j,e[d+48]=U-j;var W=.382683433*((z=_+O)-(G=H+L)),q=.5411961*z+W,J=1.306562965*G+W,Y=.707106781*(N=O+H),Z=L+Y,X=L-Y;e[d+40]=X+q,e[d+24]=X-q,e[d+8]=Z+J,e[d+56]=Z-J,d++}for(u=0;u<64;++u)h=e[u]*t[u],p[u]=h>0?h+.5|0:h-.5|0;return p}(e,t),c=0;c<64;++c)f[x[c]]=l[c];var u=f[0]-n;n=f[0],0==u?D(i[0]):(D(i[d[r=32767+u]]),D(h[r]));for(var m=63;m>0&&0==f[m];m--);if(0==m)return D(a),n;for(var v,g=1;g<=m;){for(var y=g;0==f[g]&&g<=m;++g);var A=g-y;if(A>=16){v=A>>4;for(var E=1;E<=v;++E)D(s);A&=15}r=32767+f[g],D(o[(A<<4)+d[r]]),D(h[r]),g++}return 63!=m&&D(a),n}function V(e){if(e<=0&&(e=1),e>100&&(e=100),r!=e){(function(e){for(var t=[16,11,10,16,24,40,51,61,12,12,14,19,26,58,60,55,14,13,16,24,40,57,69,56,14,17,22,29,51,87,80,62,18,22,37,56,68,109,103,77,24,35,55,64,81,104,113,92,49,64,78,87,103,121,120,101,72,92,95,98,112,100,103,99],n=0;n<64;n++){var i=a((t[n]*e+50)/100);i<1?i=1:i>255&&(i=255),s[x[n]]=i}for(var o=[17,18,24,47,99,99,99,99,18,21,26,66,99,99,99,99,24,26,56,99,99,99,99,99,47,66,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99],r=0;r<64;r++){var h=a((o[r]*e+50)/100);h<1?h=1:h>255&&(h=255),l[x[r]]=h}for(var d=[1,1.387039845,1.306562965,1.175875602,1,.785694958,.5411961,.275899379],p=0,f=0;f<8;f++)for(var m=0;m<8;m++)c[p]=1/(s[x[p]]*d[f]*d[m]*8),u[p]=1/(l[x[p]]*d[f]*d[m]*8),p++})(e<50?Math.floor(5e3/e):Math.floor(200-2*e)),r=e}}this.encode=function(e,r){(new Date).getTime(),r&&V(r),m=[],v=0,g=7,F(65496),F(65504),F(16),L(74),L(70),L(73),L(70),L(0),L(1),L(1),L(0),F(1),F(1),L(0),L(0),function(){F(65499),F(132),L(0);for(var e=0;e<64;e++)L(s[e]);L(1);for(var t=0;t<64;t++)L(l[t])}(),function(e,t){F(65472),F(17),L(8),F(t),F(e),L(3),L(1),L(17),L(0),L(2),L(17),L(1),L(3),L(17),L(1)}(e.width,e.height),function(){F(65476),F(418),L(0);for(var e=0;e<16;e++)L(C[e+1]);for(var t=0;t<=11;t++)L(T[t]);L(16);for(var n=0;n<16;n++)L(I[n+1]);for(var i=0;i<=161;i++)L(k[i]);L(1);for(var o=0;o<16;o++)L(B[o+1]);for(var r=0;r<=11;r++)L(P[r]);L(17);for(var a=0;a<16;a++)L(R[a+1]);for(var s=0;s<=161;s++)L(M[s])}(),F(65498),F(12),L(3),L(1),L(0),L(2),L(17),L(3),L(17),L(0),L(63),L(0);var a=0,h=0,d=0;v=0,g=7,this.encode.displayName="_encode_";for(var p,f,b,x,S,O,Q,_,z,U=e.data,N=e.width,G=e.height,j=4*N,W=0;W<G;){for(p=0;p<j;){for(O=S=j*W+p,Q=-1,_=0,z=0;z<64;z++)O=S+(_=z>>3)*j+(Q=4*(7&z)),W+_>=G&&(O-=j*(W+1+_-G)),p+Q>=j&&(O-=p+Q-j+4),f=U[O++],b=U[O++],x=U[O++],y[z]=(w[f]+w[b+256>>0]+w[x+512>>0]>>16)-128,A[z]=(w[f+768>>0]+w[b+1024>>0]+w[x+1280>>0]>>16)-128,E[z]=(w[f+1280>>0]+w[b+1536>>0]+w[x+1792>>0]>>16)-128;a=H(y,c,a,t,i),h=H(A,u,h,n,o),d=H(E,u,d,n,o),p+=32}W+=8}if(g>=0){var q=[];q[1]=g+1,q[0]=(1<<g+1)-1,D(q)}return F(65497),"undefined"==typeof module?new Uint8Array(m):Buffer.from(m)},(new Date).getTime(),e||(e=50),function(){for(var e=String.fromCharCode,t=0;t<256;t++)b[t]=e(t)}(),t=S(C,T),n=S(B,P),i=S(I,k),o=S(R,M),function(){for(var e=1,t=2,n=1;n<=15;n++){for(var i=e;i<t;i++)d[32767+i]=n,h[32767+i]=[],h[32767+i][1]=n,h[32767+i][0]=i;for(var o=-(t-1);o<=-e;o++)d[32767+o]=n,h[32767+o]=[],h[32767+o][1]=n,h[32767+o][0]=t-1+o;e<<=1,t<<=1}}(),function(){for(var e=0;e<256;e++)w[e]=19595*e,w[e+256>>0]=38470*e,w[e+512>>0]=7471*e+32768,w[e+768>>0]=-11059*e,w[e+1024>>0]=-21709*e,w[e+1280>>0]=32768*e+8421375,w[e+1536>>0]=-27439*e,w[e+1792>>0]=-5329*e}(),V(e),(new Date).getTime()}ct("SceneRenderer",(function(){return function(e){f(n,EventEmitter);var t=Bu(n);function n(){var e,i,r,a;return o(this,n),(e=t.call(this)).createScene=function(e){this.camera=new THREE.PerspectiveCamera,this.camera.layers.enable(Ft),this.camera.layers.enable(Ht),this.scene=new THREE.Scene,this.light=new THREE.AmbientLight(16777215),this.scene.add(this.light);var t=new THREE.DirectionalLight(16777215,1);t.position.set(1,10,1).normalize(),this.scene.add(t)},e.addComponent=function(e,t){this.components.push(e),e.update&&(t?this.updateLisAfter.push(e):this.updateListeners.push(e)),e.setSize&&(this.resizeListeners.push(e),this.forceUpdateSize=!0)},e.removeComponent=function(e){var t=function(t){return t!==e};this.components=this.components.filter(t),this.updateListeners=this.updateListeners.filter(t),this.resizeListeners=this.resizeListeners.filter(t)},e.start=function(e){if(this.started)throw new cu("Can't start SceneRenderer, already started");this.createContext(e),this.initComposer(),this.started=!0;try{ku.Init(this,this.$app.core.get("Player"))}catch(e){console.error(e)}(this.animate=this.animate.bind(this))()},e.createContext=function(e){try{this.renderer=new THREE.WebGLRenderer({antialias:!0,alpha:!0}),this.renderer.autoClear=!0,this.renderer.setPixelRatio(window.devicePixelRatio?window.devicePixelRatio:1),this.renderer.setSize(window.innerWidth,window.innerHeight),this.renderer.setClearColor("#292929",1),this.emit(wa)}catch(e){throw new mu("Unable to create a WebGL rendering context")}e.appendChild(this.renderer.domElement)},e.initComposer=function(){this.composer=new THREE.EffectComposer(this.renderer),this.composer.addPass(new THREE.RenderPass(this.scene,this.camera)),this.composer.addPass(this.effects.hblurPass),this.composer.addPass(this.effects.vblurPass)},e.setSize=function(e,t){this.renderWidth=e,this.renderHeight=t,this.effects.aspect=e/t,this.renderer.setSize(e,t),this.composer.setSize(e,t),this.css3dRenderer&&this.css3dRenderer.setSize(e,t);for(var n=0;n<this.resizeListeners.length;n++)this.resizeListeners[n].setSize(e,t);this.emit("resize",e,t)},e.render=function(){var e=this.renderer.getSize(new THREE.Vector2);0!=e.x&&0!=e.y&&(this.emit("render",this.updateClock2.getDelta()),this.update3dTiles(),this.effects.currentBlur>0?this.composer.render():this.renderer.render(this.scene,this.camera),this.css3dRenderer&&this.css3dRenderer.render(this.scene,this.camera))},e.updateScreenSize=function(){var e,t,n,o=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},s=!1;o.forceUpdateSize&&(this.forceUpdateSize=!0),o.resize||null==o.width||null==o.height?(t=this.renderer.domElement.parentElement.clientWidth,n=this.renderer.domElement.parentElement.clientHeight,o.resize&&(i=this.renderWidth,r=this.renderHeight),(t!==i||n!==r||this.forceUpdateSize||a!=window.devicePixelRatio)&&(i=t,r=n,s=!0,a=window.devicePixelRatio,e=window.devicePixelRatio)):(t=o.width,n=o.height,s=!0,e=1),s&&(this.setSize(t,n,e),this.forceUpdateSize=!1)},e.updateComponents=function(){for(var e=this.updateClock.getDelta(),t=Math.min(1,e),n=0;n<this.updateListeners.length;n++)this.updateListeners[n].update(t)},e.updateAfterRender=function(){for(var e=0;e<this.updateLisAfter.length;e++)this.updateLisAfter[e].update()},e.suspend=function(){this.started=!1,this.suspendedObjects=this.scene.children.map(function(e){return this.scene.remove(e),e}.bind(this)),this.render()},e.resume=function(){this.suspendedObjects.forEach(function(e){this.scene.add(e)}.bind(this)),this.suspendedObjects=[],this.started=!0,this.animate()},e.animate=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.byOther;(this.started||t)&&(De.timeMeasuring.addTimeMark("loop","start"),t||window.requestAnimationFrame(this.animate),this.updateScreenSize(),this.updateComponents(),this.render(),this.updateAfterRender(),this.emit(xa),De.timeMeasuring.addTimeMark("loop","end"),De.timeMeasuring.report(performance.now()))},e.getImageData=function(){var e=document.createElement("canvas"),t=e.getContext("2d");return function(n,i,o){return e.width===i&&e.height===o||(e.width=i,e.height=o),t.drawImage(n,0,0,i,o),t.getImageData(0,0,i,o)}}(),e.initSizedTexture2D=function(e,t,n){var i=this.renderer,o=i.getContext(),r=i.state,a=new THREE.Texture;a.flipY=!1,a.wrapS=t,a.wrapT=t,!0!==n&&(n=!1),a.generateMipmaps=n;var s=i.paramThreeToGL(a.format),l=i.paramThreeToGL(a.type),c=i.properties.get(a),u=o.createTexture();r.bindTexture(o.TEXTURE_2D,u),o.pixelStorei(o.UNPACK_FLIP_Y_WEBGL,a.flipY),o.texImage2D(o.TEXTURE_2D,0,s,e,e,0,s,l,null);var h=i.paramThreeToGL(t);return o.texParameteri(o.TEXTURE_2D,o.TEXTURE_WRAP_S,h),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_WRAP_T,h),n?(a.magFilter=THREE.LinearFilter,a.minFilter=THREE.LinearMipMapLinearFilter,o.texParameteri(o.TEXTURE_2D,o.TEXTURE_MAG_FILTER,o.LINEAR),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_MIN_FILTER,o.LINEAR_MIPMAP_NEAREST),o.generateMipmap(o.TEXTURE_2D)):(a.magFilter=THREE.LinearFilter,a.minFilter=THREE.LinearFilter,o.texParameteri(o.TEXTURE_2D,o.TEXTURE_MAG_FILTER,o.LINEAR),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_MIN_FILTER,o.LINEAR)),r.bindTexture(o.TEXTURE_2D,null),c.__webglTexture=u,a},e.deallocateCubeTexture=function(e){var t=this.renderer;t.getContext(),t.properties.get(e),e.dispose()},e.renderToCubeMap=function(){var e=!1,t=null,n=null,i=null,o=null,r=null;return function(a,s,l,c,u,h,d,p,f,m,v,g,y,A,E,b){var w=this.oldRenderer||this.renderer;e||(t=new THREE.Scene,r=new THREE.CubeCamera(.1,1e3,s),t.add(r),n=new THREE.ShaderMaterial({uniforms:{tDiffuse:{type:"scene",value:null},alpha:{type:"startYinTile",value:1}},vertexShader:mn.basicTextured.vertexShader,fragmentShader:mn.basicTextured.fragmentShader,depthWrite:!1,depthTest:!1,side:THREE.DoubleSide}),i=new THREE.PlaneGeometry(1,1),o=new THREE.Mesh(i,n),t.add(o),e=!0),r.renderTarget=s;var x=i.getAttribute("uv");x.setUsage(THREE.DynamicDrawUsage),x.needsUpdate=!0;var C=x.array,T=u/l,I=h/c,k=d/l,B=p/c;C[0]=T,C[1]=I+B,C[2]=T+k,C[3]=I+B,C[4]=T,C[5]=I,C[6]=T+k,C[7]=I;var P=i.getAttribute("position");P.setUsage(THREE.DynamicDrawUsage),P.needsUpdate=!0;var R=P.array,M=f/s.width-.5,S=m/s.height-.5,D=v/s.width,L=g/s.height;R[0]=M,R[1]=S+L,R[3]=M+D,R[4]=S+L,R[6]=M,R[7]=S,R[9]=M+D,R[10]=S,w.properties.get(t),n.uniforms.tDiffuse.value=a,n.blending=A||THREE.NoBlending,n.transparent=!!E,null!=b||(b=1),n.uniforms.alpha.value=b,n.needUpdate=!0,0==y&&(o.scale.set(-1,-1,1),o.position.set(.5,0,0)),1==y&&(o.scale.set(-1,-1,1),o.position.set(-.5,0,0)),2==y&&(o.scale.set(1,1,1),o.position.set(0,.5,0)),3==y&&(o.scale.set(1,1,1),o.position.set(0,-.5,0)),4==y&&(o.scale.set(-1,-1,1),o.position.set(0,0,.5)),5==y&&(o.scale.set(-1,-1,1),o.position.set(0,0,-.5)),o.lookAt(r.position),s.viewport.set(0,0,s.width,s.height);var F=w.autoClear;w.autoClear=!1,r.update(w,t),w.autoClear=F}}(),e.copyCubeMap=function(){var e=!1,t=null,n=null,i=null,o=null,r=null,a=new THREE.Euler;return function(s,l,c,u,h,d,p,f,m){if(!e){t=new THREE.Scene,n=new THREE.CubeCamera(.1,1e3,l),t.add(n),i=new THREE.ShaderMaterial({uniforms:{tDiffuse:{type:"t",value:null},alpha:{type:"f",value:1}},vertexShader:mn.copyCubeMap.vertexShader,fragmentShader:mn.copyCubeMap.fragmentShader,depthWrite:!1,depthTest:!1,side:THREE.DoubleSide}),o=new THREE.BoxGeometry(2,2,2),(r=new THREE.Mesh(o,i)).scale.set(-1,-1,1),t.add(r),e=!0}var v=this.oldRenderer||this.renderer;n.renderTarget=l;for(var g=0;g<6;g++){this.getCubeOrientationForCubeFace(g,a),r.rotation.copy(a),r.matrixWorldNeedsUpdate=!0,r.updateMatrixWorld(),i.uniforms.tDiffuse.value=s,i.blending=p||THREE.NoBlending,i.transparent=!!f,null!=m||(m=1),i.uniforms.alpha.value=m,i.needUpdate=!0,l.viewport.set(0,0,h,d);var y=v.autoClear;v.autoClear=!1,n.update(v,t),v.autoClear=y}}}(),e.getCubeOrientationForCubeFace=function(e,t){switch(e){case Ji:t.set(0,-Math.PI/2,0);break;case Yi:t.set(0,Math.PI/2,0);break;case Zi:t.set(Math.PI/2,Math.PI,0);break;case Xi:t.set(-Math.PI/2,Math.PI,0);break;case Ki:t.set(0,-Math.PI,0);break;case $i:t.set(0,0,0)}},e.index=Pu++,e.scene=null,e.camera=null,e.light=null,e.renderer=null,e.effects=lu,e.css3dRenderer=null,e.animateCallback=null,e.composer=null,e.qualityManager=null,e.updateClock=new THREE.Clock,e.updateClock2=new THREE.Clock,e.components=[],e.updateListeners=[],e.resizeListeners=[],e.updateLisAfter=[],e.forceUpdateSize=!1,e.started=!1,e.textures={},e.suspendedObjects=[],e.vrMode=!1,e.autoUpdate3dTiles=!1,De.timeMeasuring.reportTimings=Fe.urlHasValue("logTimeMeasure"),De.timeMeasuring.registerCollect("loop",{minCount:120,median:3,refreshTime:5e3}),window.addEventListener("unfocusPage",(function(t){console.log("unfocusPage",document.title),e.suspend(),e.$app.core.get("PanoRenderer").disposeIdelTargets()})),window.addEventListener("focusPage",(function(t){console.log("focusPage",document.title),e.resume()})),e}return u(n,[{key:"update3dTiles",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=this.$app.core.get("Player"),n=t.model._3dTilesRuntime;if(n){var i=this.updateClock2.getDelta();if(t.mode!==xt.PANORAMA&&n.getTileset().tiles.forEach((function(e){var o=n.getRenderMap()[e.id];o&&"remove"!==o.modified&&(i=9999,e.isVisibleAndInRequestVolume?t.model.floors.get(e.floorIndex).add(o):(o.removeFromParent(),o.traverse((function(e){e.isChunk&&e.geometry&&(e.geometry.dispose(),e.material.dispose(),e.material.uniforms.map&&e.material.uniforms.map.value.dispose())}))))})),(this.autoUpdate3dTiles||e.force)&&(t.lastFrameChanged||e.force)){var o=t.cameraControls.activeControl?t.cameraControls.activeControl.camera:this.camera;n.update(i,this.renderer,o,e.force),n.stats&&n.stats.update()}}}},{key:"uploadTexture2D",value:function(e,t,n,i,o,r){var a=this.renderer,s=a.getContext(),l=a.state,c=a.properties.get(t);l.bindTexture(s.TEXTURE_2D,c.__webglTexture),s.pixelStorei(s.UNPACK_FLIP_Y_WEBGL,t.flipY),s.pixelStorei(s.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t.premultiplyAlpha),s.pixelStorei(s.UNPACK_ALIGNMENT,t.unpackAlignment),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_WRAP_S,a.paramThreeToGL(t.wrapS)),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_WRAP_T,a.paramThreeToGL(t.wrapT)),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_MAG_FILTER,a.paramThreeToGL(t.magFilter)),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_MIN_FILTER,a.paramThreeToGL(t.minFilter)),s.texSubImage2D(s.TEXTURE_2D,0,n,i,s.RGBA,s.UNSIGNED_BYTE,e),t.generateMipmaps&&s.generateMipmap(s.TEXTURE_2D),l.bindTexture(s.TEXTURE_2D,null)}},{key:"setBg",value:function(e,t){e&&this.renderer.setClearColor(e),null!=t&&this.renderer.setClearAlpha(t)}}]),n}()}));var Mu=function(){var e=new Int32Array([0,1,8,16,9,2,3,10,17,24,32,25,18,11,4,5,12,19,26,33,40,48,41,34,27,20,13,6,7,14,21,28,35,42,49,56,57,50,43,36,29,22,15,23,30,37,44,51,58,59,52,45,38,31,39,46,53,60,61,54,47,55,62,63]),t=4017,n=799,i=3406,o=2276,r=1567,a=3784,s=5793,l=2896;function c(){}function u(e,t){for(var n,i,o=0,r=[],a=16;a>0&&!e[a-1];)a--;r.push({children:[],index:0});var s,l=r[0];for(n=0;n<a;n++){for(i=0;i<e[n];i++){for((l=r.pop()).children[l.index]=t[o];l.index>0;){if(0===r.length)throw new Error("Could not recreate Huffman Table");l=r.pop()}for(l.index++,r.push(l);r.length<=n;)r.push(s={children:[],index:0}),l.children[l.index]=s.children,l=s;o++}n+1<a&&(r.push(s={children:[],index:0}),l.children[l.index]=s.children,l=s)}return r[0].children}function h(t,n,i,o,r,a,s,l,c){i.precision,i.samplesPerLine,i.scanLines;var u=i.mcusPerLine,h=i.progressive;i.maxH,i.maxV;var d=n,p=0,f=0;function m(){if(f>0)return f--,p>>f&1;if(255==(p=t[n++])){var e=t[n++];if(e)throw new Error("unexpected marker: "+(p<<8|e).toString(16))}return f=7,p>>>7}function v(e){for(var t,n=e;null!==(t=m());){if("number"==typeof(n=n[t]))return n;if("object"!=typeof n)throw new Error("invalid huffman sequence")}return null}function g(e){for(var t=0;e>0;){var n=m();if(null===n)return;t=t<<1|n,e--}return t}function y(e){var t=g(e);return t>=1<<e-1?t:t+(-1<<e)+1}var A=0;var E,b=0;function w(e,t,n,i,o){var r=n%u,a=(n/u|0)*e.v+i,s=r*e.h+o;t(e,e.blocks[a][s])}function x(e,t,n){var i=n/e.blocksPerLine|0,o=n%e.blocksPerLine;t(e,e.blocks[i][o])}var C,T,I,k,B,P,R=o.length;P=h?0===a?0===l?function(e,t){var n=v(e.huffmanTableDC),i=0===n?0:y(n)<<c;t[0]=e.pred+=i}:function(e,t){t[0]|=m()<<c}:0===l?function(t,n){if(A>0)A--;else for(var i=a,o=s;i<=o;){var r=v(t.huffmanTableAC),l=15&r,u=r>>4;if(0!==l)n[e[i+=u]]=y(l)*(1<<c),i++;else{if(u<15){A=g(u)+(1<<u)-1;break}i+=16}}}:function(t,n){for(var i=a,o=s,r=0;i<=o;){var l=e[i],u=n[l]<0?-1:1;switch(b){case 0:var h=v(t.huffmanTableAC),d=15&h;if(r=h>>4,0===d)r<15?(A=g(r)+(1<<r),b=4):(r=16,b=1);else{if(1!==d)throw new Error("invalid ACn encoding");E=y(d),b=r?2:3}continue;case 1:case 2:n[l]?n[l]+=(m()<<c)*u:0==--r&&(b=2==b?3:0);break;case 3:n[l]?n[l]+=(m()<<c)*u:(n[l]=E<<c,b=0);break;case 4:n[l]&&(n[l]+=(m()<<c)*u)}i++}4===b&&0==--A&&(b=0)}:function(t,n){var i=v(t.huffmanTableDC),o=0===i?0:y(i);n[0]=t.pred+=o;for(var r=1;r<64;){var a=v(t.huffmanTableAC),s=15&a,l=a>>4;if(0!==s)n[e[r+=l]]=y(s),r++;else{if(l<15)break;r+=16}}};var M,S,D,L,F=0;for(S=1==R?o[0].blocksPerLine*o[0].blocksPerColumn:u*i.mcusPerColumn,r||(r=S);F<S;){for(T=0;T<R;T++)o[T].pred=0;if(A=0,1==R)for(C=o[0],B=0;B<r;B++)x(C,P,F),F++;else for(B=0;B<r;B++){for(T=0;T<R;T++)for(D=(C=o[T]).h,L=C.v,I=0;I<L;I++)for(k=0;k<D;k++)w(C,P,F,I,k);if(++F===S)break}if(f=0,(M=t[n]<<8|t[n+1])<65280)throw new Error("marker was not found");if(!(M>=65488&&M<=65495))break;n+=2}return n-d}function d(e,c){var u,h,d=[],p=c.blocksPerLine,f=c.blocksPerColumn,m=p<<3,v=new Int32Array(64),g=new Uint8Array(64);function y(e,u,h){var d,p,f,m,v,g,y,A,E,b,w=c.quantizationTable,x=h;for(b=0;b<64;b++)x[b]=e[b]*w[b];for(b=0;b<8;++b){var C=8*b;0!=x[1+C]||0!=x[2+C]||0!=x[3+C]||0!=x[4+C]||0!=x[5+C]||0!=x[6+C]||0!=x[7+C]?(d=s*x[0+C]+128>>8,p=s*x[4+C]+128>>8,f=x[2+C],m=x[6+C],v=l*(x[1+C]-x[7+C])+128>>8,A=l*(x[1+C]+x[7+C])+128>>8,g=x[3+C]<<4,y=x[5+C]<<4,E=d-p+1>>1,d=d+p+1>>1,p=E,E=f*a+m*r+128>>8,f=f*r-m*a+128>>8,m=E,E=v-y+1>>1,v=v+y+1>>1,y=E,E=A+g+1>>1,g=A-g+1>>1,A=E,E=d-m+1>>1,d=d+m+1>>1,m=E,E=p-f+1>>1,p=p+f+1>>1,f=E,E=v*o+A*i+2048>>12,v=v*i-A*o+2048>>12,A=E,E=g*n+y*t+2048>>12,g=g*t-y*n+2048>>12,y=E,x[0+C]=d+A,x[7+C]=d-A,x[1+C]=p+y,x[6+C]=p-y,x[2+C]=f+g,x[5+C]=f-g,x[3+C]=m+v,x[4+C]=m-v):(E=s*x[0+C]+512>>10,x[0+C]=E,x[1+C]=E,x[2+C]=E,x[3+C]=E,x[4+C]=E,x[5+C]=E,x[6+C]=E,x[7+C]=E)}for(b=0;b<8;++b){var T=b;0!=x[8+T]||0!=x[16+T]||0!=x[24+T]||0!=x[32+T]||0!=x[40+T]||0!=x[48+T]||0!=x[56+T]?(d=s*x[0+T]+2048>>12,p=s*x[32+T]+2048>>12,f=x[16+T],m=x[48+T],v=l*(x[8+T]-x[56+T])+2048>>12,A=l*(x[8+T]+x[56+T])+2048>>12,g=x[24+T],y=x[40+T],E=d-p+1>>1,d=d+p+1>>1,p=E,E=f*a+m*r+2048>>12,f=f*r-m*a+2048>>12,m=E,E=v-y+1>>1,v=v+y+1>>1,y=E,E=A+g+1>>1,g=A-g+1>>1,A=E,E=d-m+1>>1,d=d+m+1>>1,m=E,E=p-f+1>>1,p=p+f+1>>1,f=E,E=v*o+A*i+2048>>12,v=v*i-A*o+2048>>12,A=E,E=g*n+y*t+2048>>12,g=g*t-y*n+2048>>12,y=E,x[0+T]=d+A,x[56+T]=d-A,x[8+T]=p+y,x[48+T]=p-y,x[16+T]=f+g,x[40+T]=f-g,x[24+T]=m+v,x[32+T]=m-v):(E=s*h[b+0]+8192>>14,x[0+T]=E,x[8+T]=E,x[16+T]=E,x[24+T]=E,x[32+T]=E,x[40+T]=E,x[48+T]=E,x[56+T]=E)}for(b=0;b<64;++b){var I=128+(x[b]+8>>4);u[b]=I<0?0:I>255?255:I}}for(var A=0;A<f;A++){var E=A<<3;for(u=0;u<8;u++)d.push(new Uint8Array(m));for(var b=0;b<p;b++){y(c.blocks[A][b],g,v);var w=0,x=b<<3;for(h=0;h<8;h++){var C=d[E+h];for(u=0;u<8;u++)C[x+u]=g[w++]}}}return d}function p(e){return e<0?0:e>255?255:e}return c.prototype={load:function(e){var t=new XMLHttpRequest;t.open("GET",e,!0),t.responseType="arraybuffer",t.onload=function(){var e=new Uint8Array(t.response||t.mozResponseArrayBuffer);this.parse(e),this.onload&&this.onload()}.bind(this),t.send(null)},parse:function(t){var n=0;function i(){var e=t[n]<<8|t[n+1];return n+=2,e}function o(){var e=i(),o=t.subarray(n,n+e-2);return n+=o.length,o}function r(e){var t,n,i=0,o=0;for(n in e.components)e.components.hasOwnProperty(n)&&(i<(t=e.components[n]).h&&(i=t.h),o<t.v&&(o=t.v));var r=Math.ceil(e.samplesPerLine/8/i),a=Math.ceil(e.scanLines/8/o);for(n in e.components)if(e.components.hasOwnProperty(n)){t=e.components[n];for(var s=Math.ceil(Math.ceil(e.samplesPerLine/8)*t.h/i),l=Math.ceil(Math.ceil(e.scanLines/8)*t.v/o),c=r*t.h,u=a*t.v,h=[],d=0;d<u;d++){for(var p=[],f=0;f<c;f++)p.push(new Int32Array(64));h.push(p)}t.blocksPerLine=s,t.blocksPerColumn=l,t.blocks=h}e.maxH=i,e.maxV=o,e.mcusPerLine=r,e.mcusPerColumn=a}t.length;var a,s,l=null,c=null,p=[],f=[],m=[],v=[],g=i();if(65496!=g)throw new Error("SOI not found");for(g=i();65497!=g;){switch(g){case 65280:break;case 65504:case 65505:case 65506:case 65507:case 65508:case 65509:case 65510:case 65511:case 65512:case 65513:case 65514:case 65515:case 65516:case 65517:case 65518:case 65519:case 65534:var y=o();65504===g&&74===y[0]&&70===y[1]&&73===y[2]&&70===y[3]&&0===y[4]&&(l={version:{major:y[5],minor:y[6]},densityUnits:y[7],xDensity:y[8]<<8|y[9],yDensity:y[10]<<8|y[11],thumbWidth:y[12],thumbHeight:y[13],thumbData:y.subarray(14,14+3*y[12]*y[13])}),65518===g&&65===y[0]&&100===y[1]&&111===y[2]&&98===y[3]&&101===y[4]&&0===y[5]&&(c={version:y[6],flags0:y[7]<<8|y[8],flags1:y[9]<<8|y[10],transformCode:y[11]});break;case 65499:for(var A=i()+n-2;n<A;){var E=t[n++],b=new Int32Array(64);if(E>>4==0)for(z=0;z<64;z++){b[e[z]]=t[n++]}else{if(E>>4!=1)throw new Error("DQT: invalid table spec");for(z=0;z<64;z++){b[e[z]]=i()}}p[15&E]=b}break;case 65472:case 65473:case 65474:i(),(a={}).extended=65473===g,a.progressive=65474===g,a.precision=t[n++],a.scanLines=i(),a.samplesPerLine=i(),a.components={},a.componentsOrder=[];var w,x=t[n++];for(Q=0;Q<x;Q++){w=t[n];var C=t[n+1]>>4,T=15&t[n+1],I=t[n+2];a.componentsOrder.push(w),a.components[w]={h:C,v:T,quantizationIdx:I},n+=3}r(a),f.push(a);break;case 65476:var k=i();for(Q=2;Q<k;){var B=t[n++],P=new Uint8Array(16),R=0;for(z=0;z<16;z++,n++)R+=P[z]=t[n];var M=new Uint8Array(R);for(z=0;z<R;z++,n++)M[z]=t[n];Q+=17+R,(B>>4==0?v:m)[15&B]=u(P,M)}break;case 65501:i(),s=i();break;case 65498:i();var S=t[n++],D=[];for(Q=0;Q<S;Q++){U=a.components[t[n++]];var L=t[n++];U.huffmanTableDC=v[L>>4],U.huffmanTableAC=m[15&L],D.push(U)}var F=t[n++],H=t[n++],V=t[n++],O=h(t,n,a,D,s,F,H,V>>4,15&V);n+=O;break;case 65535:255!==t[n]&&n--;break;default:if(255==t[n-3]&&t[n-2]>=192&&t[n-2]<=254){n-=3;break}throw new Error("unknown JPEG marker "+g.toString(16))}g=i()}if(1!=f.length)throw new Error("only single frame JPEGs supported");for(var Q=0;Q<f.length;Q++){var _=f[Q].components;for(var z in _)_[z].quantizationTable=p[_[z].quantizationIdx],delete _[z].quantizationIdx}this.width=a.samplesPerLine,this.height=a.scanLines,this.jfif=l,this.adobe=c,this.components=[];for(Q=0;Q<a.componentsOrder.length;Q++){var U=a.components[a.componentsOrder[Q]];this.components.push({lines:d(0,U),scaleX:U.h/a.maxH,scaleY:U.v/a.maxV})}},getData:function(e,t){var n,i,o,r,a,s,l,c,u,h,d,f,m,v,g,y,A,E,b,w,x,C=this.width/e,T=this.height/t,I=0,k=e*t*this.components.length,B=new Uint8Array(k);switch(this.components.length){case 1:for(n=this.components[0],h=0;h<t;h++)for(a=n.lines[0|h*n.scaleY*T],u=0;u<e;u++)d=a[0|u*n.scaleX*C],B[I++]=d;break;case 2:for(n=this.components[0],i=this.components[1],h=0;h<t;h++)for(a=n.lines[0|h*n.scaleY*T],s=i.lines[0|h*i.scaleY*T],u=0;u<e;u++)d=a[0|u*n.scaleX*C],B[I++]=d,d=s[0|u*i.scaleX*C],B[I++]=d;break;case 3:for(x=!0,this.adobe&&this.adobe.transformCode?x=!0:void 0!==this.colorTransform&&(x=!!this.colorTransform),n=this.components[0],i=this.components[1],o=this.components[2],h=0;h<t;h++)for(a=n.lines[0|h*n.scaleY*T],s=i.lines[0|h*i.scaleY*T],l=o.lines[0|h*o.scaleY*T],u=0;u<e;u++)x?(d=a[0|u*n.scaleX*C],f=s[0|u*i.scaleX*C],E=p(d+1.402*((m=l[0|u*o.scaleX*C])-128)),b=p(d-.3441363*(f-128)-.71413636*(m-128)),w=p(d+1.772*(f-128))):(E=a[0|u*n.scaleX*C],b=s[0|u*i.scaleX*C],w=l[0|u*o.scaleX*C]),B[I++]=E,B[I++]=b,B[I++]=w;break;case 4:if(!this.adobe)throw new Error("Unsupported color mode (4 components)");for(x=!1,this.adobe&&this.adobe.transformCode?x=!0:void 0!==this.colorTransform&&(x=!!this.colorTransform),n=this.components[0],i=this.components[1],o=this.components[2],r=this.components[3],h=0;h<t;h++)for(a=n.lines[0|h*n.scaleY*T],s=i.lines[0|h*i.scaleY*T],l=o.lines[0|h*o.scaleY*T],c=r.lines[0|h*r.scaleY*T],u=0;u<e;u++)x?(d=a[0|u*n.scaleX*C],f=s[0|u*i.scaleX*C],m=l[0|u*o.scaleX*C],v=c[0|u*r.scaleX*C],g=255-p(d+1.402*(m-128)),y=255-p(d-.3441363*(f-128)-.71413636*(m-128)),A=255-p(d+1.772*(f-128))):(g=a[0|u*n.scaleX*C],y=s[0|u*i.scaleX*C],A=l[0|u*o.scaleX*C],v=c[0|u*r.scaleX*C]),B[I++]=255-g,B[I++]=255-y,B[I++]=255-A,B[I++]=255-v;break;default:throw new Error("Unsupported color mode")}return B},copyToImageData:function(e,t){var n,i,o,r,a,s,l,c,u,h=e.width,d=e.height,f=e.data,m=this.getData(h,d),v=0,g=0;switch(this.components.length){case 1:for(i=0;i<d;i++)for(n=0;n<h;n++)o=m[v++],f[g++]=o,f[g++]=o,f[g++]=o,t&&(f[g++]=255);break;case 3:for(i=0;i<d;i++)for(n=0;n<h;n++)l=m[v++],c=m[v++],u=m[v++],f[g++]=l,f[g++]=c,f[g++]=u,t&&(f[g++]=255);break;case 4:for(i=0;i<d;i++)for(n=0;n<h;n++)a=m[v++],s=m[v++],o=m[v++],l=255-p(a*(1-(r=m[v++])/255)+r),c=255-p(s*(1-r/255)+r),u=255-p(o*(1-r/255)+r),f[g++]=l,f[g++]=c,f[g++]=u,t&&(f[g++]=255);break;default:throw new Error("Unsupported color mode")}}},c}();var Su={encode:function(e,t){return void 0===t&&(t=50),{data:new Ru(t).encode(e,t),width:e.width,height:e.height}},decode:function(e,t){var n={useTArray:!1,colorTransform:void 0,formatAsRGBA:!0};t?"object"==typeof t?t={useTArray:void 0===t.useTArray?n.useTArray:t.useTArray,colorTransform:void 0===t.colorTransform?n.colorTransform:t.colorTransform,formatAsRGBA:void 0===t.formatAsRGBA?n.formatAsRGBA:t.formatAsRGBA}:(t=n).useTArray=!0:t=n;var i=new Uint8Array(e),o=new Mu;o.parse(i),o.colorTransform=t.colorTransform;var r=t.formatAsRGBA?4:3,a=o.width*o.height*r;try{var s={width:o.width,height:o.height,data:t.useTArray?new Uint8Array(a):new Buffer(a)}}catch(e){throw e instanceof RangeError?new Error("Could not allocate enough memory for the image. Required: "+a):e}return o.copyToImageData(s,t.formatAsRGBA),s}};function Du(e,t,n){e&&(e=e.toLowerCase().trim());var i=new I.UP.clone,o=Math.PI/3,r=Math.PI/2;switch(e){case"left":n.copy(t),n.applyAxisAngle(i,r);break;case"right":n.copy(t),n.applyAxisAngle(i,-r);break;case"forwardleft":n.copy(t),n.applyAxisAngle(i,o);break;case"forwardright":n.copy(t),n.applyAxisAngle(i,-o);break;case"forward":default:n.copy(t)}return n}function Lu(e,t){if(e){var n={pano:e,lookAtPoint:null,duration:null,maxDistanceOverride:null,skipWarpingCheck:!1};this.player.flyToPano(n,(function(){t&&t({success:!0,message:"Transition complete."})}))}else R.warn("Showcase -> clickPanoObject: Unable to find pano."),t&&t({success:!1,error:"Unable to find pano."})}function Fu(e,t){var n=this.findRankedPano(e,t);return n>=0?this.handleToObject[n]:(R.warn("Showcase -> findRankedPanoObject: Unable to find nearby pano."),null)}function Hu(e,t){var n=this.findRankedtag(e,t);return n>=0?this.handleToObject[n]:(R.warn("Showcase -> findRankedtagObject: Unable to find nearby tag."),null)}function Vu(e,t){t.copy(I.FORWARD),e.getDirection(t)}var Ou={director:null,player:null,controls:null,sceneRenderer:null,model:null,init:function(e,t,n,i){this.director=e,this.player=n,this.controls=t,this.sceneRenderer=i},handleToObject:{},objectToHandle:{},handleCount:0,onMessageReceive:function(e){if(e){var t=e.targetFunction,n=e.params,i=e.onDone;t&&this[t]&&this[t](n,i)}},waitForInit:function(e,t){F.then(t.bind({success:!0,message:"Init complete."}))},moveToPano:function(e,t){var n=new THREE.Euler(0,0,0,"YXZ"),i=new THREE.Quaternion;return function(e,t){var o=e.pano,r=e.rotation,a=e.transition;if(!this.model)return t({success:!1,error:"The model has not been loaded yet"});var s=this.model.panos.get(o);if(!s)return t({success:!1,error:o+" does not exist in this model"});if(!r)return t({sucess:!1,erorr:r+" is not a valid rotation"});n.set(c.Math.degToRad(r.x||0),c.Math.degToRad(r.y||0),c.Math.degToRad(r.z||0),"YXZ"),ft.info(r.z);var l={success:!0,message:o};if(a===A.FADEOUT)i.setFromEuler(n),this.player.warpToPano(s,i,null,null,b.BLACK,null,null,t.bind(this,l));else{var u,h;a===A.INSTANT&&(u=0,h=0);var d=I.FORWARD.clone().applyEuler(n).add(s.position);this.player.flyToPano({pano:s,lookAtPoint:d,duration:u,aimDuration:h},t.bind(this,l))}}}(),moveInDirection:function(e,t){var n=e.direction;return void 0===v[n]?(R.warn("Showcase -> moveInDirection: Cannot move in invalid direction."),void(t&&t({success:!1,error:"Invalid direction."}))):void this.player.flyLocalDirection(I[n].clone()).then((function(e){t(e?{success:!0,message:"moved "+n}:{success:!1,error:"Cannot move in direction: "+n})}))},getPose:function(e,t){return this.player.camera.position,(new THREE.Euler).setFromQuaternion(this.player.camera.quaternion,"YXZ"),t({success:!0,message:B(this.player)})},takeScreenShot:function(){var e=new THREE.PerspectiveCamera,t=new THREE.WebGLRenderTarget;return function(n,i){if(!n.resolution)return i({success:!1,error:"An invalid resolution was specified"});if(-1===n.resolution.width||-1===n.resolution.height){var o=this.sceneRenderer.renderer.getSize();n.resolution.width=o.width,n.resolution.height=o.height}e.layers.set(Lt),n.visibleObjects&&(n.visibleObjects.showPucks&&e.layers.enable(Ft),n.visibleObjects.showReticule&&e.layers.enable(Ht));var r=n.resolution.width,a=n.resolution.height,s=r/a;e.position.copy(this.sceneRenderer.camera.position),e.quaternion.copy(this.sceneRenderer.camera.quaternion),e.projectionMatrix.copy(this.player.camera.projectionMatrix),e.projectionMatrix.elements[0]=this.player.camera.projectionMatrix.elements[5]/s,e.projectionMatrix.elements[5]=-e.projectionMatrix.elements[5],t.setSize(r,a),this.sceneRenderer.renderer.setRenderTarget(t),null!=n.bgOpacity&&(n.bgOpacityOld=this.sceneRenderer.renderer.getClearAlpha(),this.sceneRenderer.setBg(null,n.bgOpacity));var l=this.sceneRenderer.renderer.getClearAlpha();if(this.sceneRenderer.renderer.render(this.sceneRenderer.scene,e),this.sceneRenderer.renderer.setRenderTarget(null),null!=n.bgOpacity&&this.sceneRenderer.setBg(null,n.bgOpacityOld),l<1||n.png)var c=De.renderTargetToDataUrl(t,t.width,t.height,this.sceneRenderer.renderer,n.quality?n.quality/100:void 0,!0);else{var u=new Uint8Array(r*a*4);this.sceneRenderer.renderer.readRenderTargetPixels(t,0,0,r,a,u);var h=Su.encode({data:u,width:r,height:a,heading:180,pitch:0},n.quality);c="data:image/jpg;base64,"+De.uint8ToBase64(h.data)}i({success:!0,message:c,camera:e})}}(),findRankedPano:function(e,t){var n=new THREE.Vector3,i=new THREE.Vector3;return function(e,t){Vu(this.player,i),Du(t,i,n);var o=this.player.rankedPanoInDirection(e,n);if(o){var r=this.objectToHandle[o.id];return r||(this.objectToHandle[o.id]=r=this.handleCount++,this.handleToObject[r]=o),r}return R.warn("Showcase -> findRankedPano: Unable to find nearby pano."),-1}}(),findRankedtag:function(e,t){var n=new THREE.Vector3,i=new THREE.Vector3;return function(e,t){Vu(this.player,i),Du(t,i,n);var o=this.player.rankedtagInDirection(e,n);if(o){var r=this.objectToHandle[o.sid];return r||(this.objectToHandle[o.sid]=r=this.handleCount++,this.handleToObject[r]=o),r}return R.warn("Showcase -> findRankedtag: Unable to find nearby tag."),-1}}(),clickNearesttag:function(e){this.clickRankedtag(0,e)},clickRankedtag:function(e,t){var n=Hu.call(this,e,t);n&&O.call(this,n)},clickNearestPano:function(e,t){this.clickRankedPano(0,e,t)},clickRankedPano:function(e,t,n){var i=Fu.call(this,e,t);i?Lu.call(this,i,n):n(null)},clickPano:function(e,t){var n=this.handleTable[e];n?Lu.call(this,n,t):t(null)},rotateDirection:function(e,t){var n=e.direction,i=e.angle;if(!P.active){var o=0,r=0,a=0,s=0;if(!i||isNaN(i))return R.warn("Showcase -> rotateDirection: Invalid rotation angle."),void(t&&t({success:!1,error:"Invalid rotation angle."}));if(this.player.mode===E.TRANSITIONING)return R.warn("Automation -> rotateDirection: Cannot rotate while transitioning"),void(t&&t({success:!1,error:"Cannot rotate while transitioning"}));if(n===v.RIGHT||n===v.LEFT)n===v.RIGHT&&(i=-i),o=i>0?-1:1,a=i;else{if(n!==v.UP&&n!==v.DOWN)return R.warn("Showcase -> rotateDirection: Invalid direction for rotation: "+n),void(t&&t({success:!1,error:"Invalid direction for rotation."}));if(this.player.mode===E.FLOORPLAN)return R.warn("Showcase -> rotateDirection: Cannot rotate "+n+" in floorplan mode"),void(t&&t({success:!1,error:"Cannot rotate "+n+" in floorplan mode"}));if(n===v.DOWN&&(i=-i),0===(i=N.call(this,i)))return R.warn("Showcase -> rotateDirection: Already at maximum rotation in direction: "+n),void(t&&t({success:!1,error:"Already at maximum rotation in direction: "+n}));r=i>0?1:-1,s=i}var l=i;i=c.Math.degToRad(i),a=c.Math.degToRad(a),s=c.Math.degToRad(s);var u=this.controls.activeControl;u.startRotating(o,r),P.start(a,s,this.player,(function(){u.stopRotating(!0),t&&t({success:!0,message:"Rotated "+l.toFixed(2)+"° in direction: "+e.direction})}))}},rotate:function(){var e=new THREE.Vector3,t=new THREE.Vector3;return function(n,i){var o=n.xAngle,r=n.yAngle;if(!P.active){if(o=o||0,r=r||0,isNaN(o)||isNaN(r))return R.warn("Showcase -> rotate: Invalid rotation angle."),void(i&&i({success:!1,error:"Invalid rotation angle."}));if(this.player.mode===E.TRANSITIONING)return R.warn("Automation -> rotate: Cannot rotate while transitioning"),void(i&&i({success:!1,error:"Cannot rotate while transitioning"}));Math.abs(o)<.01&&(o=0),Math.abs(r)<.01&&(r=0);var a=r;r=N.call(this,r);var s=a>0?"UP":"DOWN";if(!(o=-o)&&a&&!r)return R.warn("Showcase -> rotate: Already at maximum rotation in direction: "+s),void(i&&i({success:!1,error:"Already at maximum rotation in direction: "+s}));a>r&&R.warn("Showcase -> rotate: Reached maximum rotation in direction: "+s);var l=r;r=c.Math.degToRad(r),o=c.Math.degToRad(o),e.copy(this.player.mode===E.FLOORPLAN?I.UP:I.FORWARD),this.player.getDirection(e),t.copy(e).applyAxisAngle(I.UP,o),t.applyAxisAngle(I.RIGHT,r);var u=(e.angleTo(t),o>0?-1:o<0?1:0),h=r>0?1:r<0?-1:0;Math.abs(o)>Math.abs(r)?h*=Math.abs(r/o):Math.abs(r)>Math.abs(o)&&(u*=Math.abs(o/r));var d=this.controls.activeControl;d.startRotating(u,h),P.start(o,r,this.player,(function(){d.stopRotating(!0),i&&i({success:!0,message:"Rotated "+n.xAngle.toFixed(2)+"° horizontally, "+l.toFixed(2)+"° vertically"})}))}}}(),panCamera:function(e,t){function n(e){switch(o.removeAllListeners(T.AutoPanComplete),o.removeAllListeners(T.AutoPanInterrupt),o.removeAllListeners(T.AutoPanClamped),e){case T.AutoPanInterrupt:t({success:!0,message:"Camera panning interrupted."});break;case T.AutoPanClamped:if(o.autoPanPosition.x!==i.x||o.autoPanPosition.z!==i.z){if(Math.abs(this.player.position.x-o.autoPanPosition.x)<.01&&Math.abs(this.player.position.z-o.autoPanPosition.z)<.01)return void t({success:!1,error:"Already at edge of current model bounds."});var n="The view point is outside the bounds for the current model. ";n+="The view point was clamped to "+r(o.target.x,o.target.z),console.warn(n)}case T.AutoPanComplete:t({success:!0,message:"Panned camera to position "+r(o.autoPanPosition.x,o.autoPanPosition.z)})}}if(this.player.mode!==E.DOLLHOUSE&&this.player.mode!==E.FLOORPLAN)return t({success:!1,error:"Camera panning is not available in the current mode: "+this.player.mode});var i=e.position,o=this.player.control;o.setAutoPanPosition(i.x,i.z),o.autoPan=!0;var r=function(e,t){return"("+e.toFixed(2)+", "+t.toFixed(2)+")"};o.on(T.AutoPanComplete,n.bind(this,T.AutoPanComplete)),o.on(T.AutoPanInterrupt,n.bind(this,T.AutoPanInterrupt)),o.on(T.AutoPanClamped,n.bind(this,T.AutoPanClamped))},click:function(e,t){var n=e.x,i=e.y;!0===e.percentage&&(n=n/100*$("#player").width(),i=i/100*$("#player").height()),this.player.handleInputStart(n,i),this.player.updateIntersect(),this.player.handleInputEnd(n,i)},mouseOver:function(e,t){var n=e.x,i=e.y;!0===e.percentage&&(n=n/100*$("#player").width(),i=i/100*$("#player").height()),this.player.handleInputMove(n,i),this.player.updateIntersect()},moveToMode:function(e,t){function n(e){t(e?{success:!1,error:"Failed to load new mode: "+e}:{success:!0,message:"Moved to new mode: "+i})}var i=e.mode;i===E.PANORAMA||i===E.DOLLHOUSE||i===E.FLOORPLAN?this.director.changeMode(i).then((function(){n()}),(function(e){n(e)})):t({success:!1,error:"Invalid mode selection"})}},Qu=function(e,t,n,i,o){Ou.init(e,t,n,o)},_u=function(e,t){Ou.takeScreenShot(e,t)};ct("Screenshot",(function(){var e,t,n,i;return e=K("execute"),t=K("recover"),n=K("toFish"),i=K("unFish"),function(){function a(){o(this,a),Object.defineProperty(this,e,{value:r}),Object.defineProperty(this,t,{writable:!0,value:function(e){if(this.player.reticule.visible=!0,this.player.model.floorLogos.firstLogo.visible=e.fL0,this.player.model.floorLogos.secondLogo.visible=e.fL1,this.player.path.currentPanoMarker.mesh.visible=!0,this.player.model.panos.list.forEach((function(e){e.isAligned()&&(e.marker.visible=e.marker.forceHide)})),this.$app.core.get("CameraControls").controls.floorplan.snapshotTopAspect=null,this.player.mode!=xt.PANORAMA){null===wl.side&&this.player.model.chunks.forEach((function(e){e.material.side=THREE.FrontSide}));var t=this.$app.core.get("SceneRenderer").scene.skyboxBG;t&&(t.material.side=THREE.BackSide)}this.player.model.skybox.material.side=THREE.BackSide,this.player.OverlayManager.show("all",!0),this.player.GLTFEditor.show("all",!0),e.notHideMonitors||this.player.$app.Camera.monitor.control.showAll()}}),Object.defineProperty(this,n,{writable:!0,value:function(e){this.player.model.fishSkybox||(this.player.model.fishSkybox=new THREE.Mesh(new THREE.SphereGeometry(_e.skyRadius,80,50),this.player.model.skybox.material),this.core.get("SceneRenderer").scene.add(this.player.model.fishSkybox)),this.player.model.fishSkybox.position.copy(this.player.position),this.player.model.fishSkybox.visible=!0,this.player.model.skybox.visible=!1;for(var t=0;t<this.player.model.chunks.length;t++)this.player.model.chunks[t].visible=!1;e.cameraPosOld=this.player.camera.position.clone(),this.player.cameraControls.activeControl.fishState=!0,this.player.cameraControls.activeControl.camera.fov=at.fish.insideFOV,this.player.cameraControls.activeControl.target.copy(this.player.position),this.player.updateFromControls()}}),Object.defineProperty(this,i,{writable:!0,value:function(e){if(this.player.mode==xt.PANORAMA){this.player.cameraControls.activeControl.camera.position.copy(e.cameraPosOld),this.player.cameraControls.activeControl.fishState=!1,this.player.model.fishSkybox.visible=!1,this.player.model.skybox.visible=!0;for(var t=0;t<this.player.model.chunks.length;t++)this.player.model.chunks[t].visible=!0;this.player.cameraControls.activeControl.camera.fov=at.insideFOV}this.player.updateFromControls()}})}return u(a,[{key:"capture",value:function(t){this.player=this.$app.core.get("Player"),(this.player.flying||this.player.isWarping()||this.player.mode==xt.TRANSITIONING)&&ft.warn("you take a screenshot on flying or transitioning mode!!");var n=this.player.getSize(),i=n.clientWidth,o=n.clientHeight,r=this.player.model.floorLogos.firstLogo.visible,a=this.player.model.floorLogos.secondLogo.visible;this.player.model.panos.list.forEach((function(e){e.isAligned()&&(e.marker.forceHide=e.marker.visible,e.marker.visible=!1)})),this.player.reticule.visible=!1,this.player.model.floorLogos.firstLogo.visible=!1,this.player.model.floorLogos.secondLogo.visible=!1,this.player.path.currentPanoMarker.mesh.visible=!1,this.player.mode!=xt.PANORAMA&&null===wl.side&&this.player.model.chunks.forEach((function(e){e.material.side=THREE.BackSide})),this.player.model.skybox.material.side=THREE.DoubleSide,this.player.OverlayManager.hide("all"),this.player.GLTFEditor.hide("all"),t.notHideMonitors||this.player.$app.Camera.monitor.control.hideAll(),t.snapshotTopview&&this.player.mode==xt.FLOORPLAN&&(this.$app.core.get("CameraControls").controls.floorplan.snapshotTopAspect=i/o),t.changeBefore=Object.assign({},t,{fL0:r,fL1:a}),Z(this,e)[e](t)}}]),a}();function r(o,r){var a,s,l=this;o.tasks.unFish&&o.tasks.unFish.length?(a=o.tasks.unFish.splice(0,1)[0],s="unFish"):o.tasks.fish&&o.tasks.fish.length?(a=o.tasks.fish.splice(0,1)[0],s="fish"):s="finish","unFish"==r&&"fish"==s?Z(this,n)[n](o.changeBefore):"fish"==r&&"finish"==s?(Z(this,i)[i](o.changeBefore),Z(this,t)[t](o.changeBefore)):"finish"==s?Z(this,t)[t](o.changeBefore):ft.info("other state:"+r+"|"+s),"finish"!=s&&_u({resolution:{width:a.width,height:a.height},bgOpacity:a.bgOpacity,quality:o.quality||(at.isSafari?50:65),png:"PNG"==a.type},(function(t){o.done&&o.done(t.message,a.name,t),Z(l,e)[e](o,s)}))}}));var zu=Object.freeze({Show:0,Hide:1,Retain:2}),Uu=Object.freeze({Standard:0,Slow:1,Retain:2});function Nu(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}ct("Director",(function(){return function(e){f(n,EventEmitter);var t=Nu(n);function n(){var e;return o(this,n),(e=t.call(this)).endlessLoop=at.warp.loop,e.clock=new THREE.Clock(!0),e.currentItem=null,e.destinationItem=null,e.tourIsPlaying=!1,e.nextFunc=null,e.onTheBus=!1,e.reachSource=null,e.interrupted=!1,e.nItems=0,e.currentScript=0,e.walkingSectionPaused=!1,e.C=Object.freeze({None:0,Moving:1,Aiming:2,Interlude:3}),e.I=Object.freeze({Forward:1,NoChange:0,Backwards:-1}),e.transitionStage=e.C.None,e.player=e.$app.core.get("Player"),e}return u(n,[{key:"init",value:function(){this.updateModel(),this.resetAll(),this.bindEvents()}},{key:"resetAll",value:function(){if(this.currentItem=null,this.destinationItem=null,this.tourIsPlaying=!1,this.transitionStage=this.C.None,this.nextFunc=null,this.onTheBus=!1,this.reachSource=null,this.interrupted=!1,this.player.model)switch(this.player.model.switch_scene_type){case 1:this.defaultWarpStyle=Ve;break;case 2:this.defaultWarpStyle=Qe;break;case 3:this.defaultWarpStyle=Oe;break;default:this.defaultWarpStyle=Ve}else this.defaultWarpStyle=Ve,ft.warn('No model yet, choosing "'+this.defaultWarpStyle+'" transitions');this.resetSpecialTransition()}},{key:"updateModel",value:function(){this.player.model=this.modelManager.getActiveModel(),this.nItems=0}},{key:"bindEvents",value:function(){this.modelManager.on(ts,this.updateModel.bind(this)),this.player.on(ma,this.handleFlyToWarpInterruption.bind(this)),this.player.on($r,this.handlePlayerMove.bind(this)),this.player.on(aa,this.handlePlayerPanoChosen.bind(this)),this.player.on(oa,this.handlePlayerModeChanged.bind(this)),this.player.on(va,this.handlePlayerInputStart.bind(this)),this.player.on(ca,this.handlePlayerFlyingStarted.bind(this))}},{key:"handleFlyToWarpInterruption",value:function(e,t){e===Qe?(this.interrupt(BlackoutStyle.NONE),this.pauseWalkingSection(),this.player.fastForwardActivePanoFlight()):this.transitionStage===this.C.Interlude&&(this.interrupt(BlackoutStyle.NONE),t&&t())}},{key:"handlePlayerMove",value:function(e){this.transitionStage===this.C.Interlude&&this.interrupt(BlackoutStyle.NONE)}},{key:"handlePlayerPanoChosen",value:function(e,t){this.intermediateState()||e.id===t.id||(this.onTheBus=!1,this.emit("update.controls"))}},{key:"handlePlayerModeChanged",value:function(e,t){this.intermediateState()||e===t||(this.onTheBus=!1,this.emit("update.controls"))}},{key:"handlePlayerInputStart",value:function(e){this.transitionStage===this.C.Interlude&&this.interrupt(BlackoutStyle.NONE)}},{key:"handlePlayerFlyingStarted",value:function(){this.clearWalkingSectionPaused()}},{key:"describe",value:function(){return{nItems:this.nItems,currentItem:this.currentItem,destinationItem:this.destinationItem,tourIsPlaying:this.tourIsPlaying,onTheBus:this.onTheBus,endlessLoop:this.endlessLoop,viewMode:this.player.mode,inTransition:this._inTransition(),transitionStage:this.transitionStage,tourInProgress:this.tourInProgress}}},{key:"_inTransition",value:function(){return this.player.flying||this.player.isWarping()||this.player.isWaitingToWarp()||this.player.mode===Viewmode.TRANSITIONING||this.tourIsPlaying}},{key:"bounceable",value:function(){var e=this.clock.getDelta();return this.isInterrupted()||e<.9&&e>.01||this.player.flying&&!this.player.isWarping()}},{key:"currentMoveDirection",value:function(){return null===this.currentItem||void 0===this.currentItem?this.I.Forward:this.destinationItem===this.currentItem?this.I.NoChange:this.destinationItem>this.currentItem?this.I.Forward:I.Backwards}},{key:"clearPath",value:function(){this._inTransition()||this.player.path.discardPathObject()}},{key:"allFloors",value:function(){this.player.model.toggleAllFloors()}},{key:"actionComplete",value:function(e){var t=this.transitionStage;if(this.interrupted=!1,this.transitionStage=this.C.None,this.resetSpecialTransition(),null!==this.destinationItem&&this.setCurrentItem(this.destinationItem),this.tourIsPlaying||this.player.mode===xt.PANORAMA&&this.player.currentPano.isAligned()&&this.player.model.fadePanoMarkers(),this.emit("update.controls"),this.currentScript&&(this.player.model.enableTagMovie&&t===this.C.Interlude||this.player.model.enableTagMovie&&t===this.C.Aiming&&null===this.nextFunc))this.openTag();else if(this.nextFunc){var n=this.nextFunc;this.nextFunc=null,n()}}},{key:"awaitCompletion",value:function(e,t){this.nextFunc=t,e()}},{key:"updateSuccessFunction",value:function(e){this.nextFunc=e}},{key:"interrupt",value:function(e,t){return!!this.wouldInterrupt()&&(this.tourIsPlaying&&(this.player.zoomEnabled=this.wasZoomEnabled),this.tourIsPlaying=!1,this.interrupted=!0,this.nextFunc=null,this.emit(DirectorEvents.ActionInterrupted),null!=e||(e=BlackoutStyle.BEGINNING),this.player.interruptAndFastForward(e,t),!0)}},{key:"wouldInterrupt",value:function(){return this.transitionStage!==this.C.None}},{key:"intermediateState",value:function(){return this.transitionStage!==this.C.None}},{key:"isInterrupted",value:function(){return this.interrupted}},{key:"pauseWalkingSection",value:function(){this.walkingSectionPaused=!0}},{key:"clearWalkingSectionPaused",value:function(){this.walkingSectionPaused=!1}},{key:"autoTour",value:function(){at.nestscenes&&at.nestscenes.scenes&&at.nestscenes.scenes.length&&!at.nestscenes.scenes[0].script&&(at.basic.menu.scene_autoplay&&(at.warp.auto=0,$("#play").removeClass("play").addClass("pause"),G.playing=!0,$(".gui-floor").hide(),$(".rightbar").hide(),$("#userlogo").hide(),$("#page-view").hide(),$("#back-url").hide(),$(".indoordir, .indoorscale").hide(),$("#virgule, #barrageShow, #barrageCon").hide()),at.warp.auto>=0&&transitions.trigger({duration:1e3*Math.min(300,at.warp.auto),done:function(){this.playTour()}.bind(this),name:"_atr"}))}},{key:"atDestinationPano",value:function(){if(!this.player.currentPano||null===this.destinationItem)return!1;var e=this.player.currentPano.id;if(void 0===e)return!1;var t=this.player.model.heroLocations;return null!==this.destinationItem&&void 0!==t[this.destinationItem]&&e==t[this.destinationItem].panoId}},{key:"redirectToItem",value:function(e,t){if(null!=e)if(this.wouldInterrupt())if(this.player.mode!==xt.TRANSITIONING){ft.debug("Director.redirectToItem() -> Redirecting to "+e+" via "+t);var n=function(){transitions.setTimeout(function(){this.setDestinationItem(e),ft.info("from redirectToItem"),this.goToDestination(!0,BlackoutStyle.BEGINNING,at.warp.warpInterruptionRedirectTime,!1)}.bind(this),0)}.bind(this);this.interrupt(BlackoutStyle.END,0),this.updateSuccessFunction(n)}else ft.debug("Director.redirectToItem() -> Cannot redirect while transitioning.");else ft.warn("Director.redirectToItem() -> Director cannot redirect if there is nothing to interrupt.");else ft.warn("Director.redirectToItem() -> Redirecting to null item.")}},{key:"useSpecialTransition",value:function(e){void 0!==e&&this.defaultWarpStyle!==Ve&&ft.debug("useSpecialTransition(): "+e),this.nextWarpStyle=this.defaultWarpStyle}},{key:"resetSpecialTransition",value:function(){this.nextWarpStyle=this.defaultWarpStyle}},{key:"arrivedAtDestination",value:function(e){if(this.player.flying||this.player.isWarping())ft.warn("Cannot advance to interlude or aiming while player is flying or warping.");else{this.transitionStage=this.C.Aiming;var t=this.tourIsPlaying?this.tourInterlude.bind(this,this.nextItem(this.currentItem)):null;this.player.model.fadePanoMarkers(0),this.awaitCompletion(function(){this.resetSpecialTransition(),e?this.player.aimTourCamera(this.destinationItem,zu.Retain,zu.Slow,this.actionComplete.bind(this)):this.actionComplete()}.bind(this),t)}this.play.control.canPlay||(this.play.control.canPlay=!0),this.play.control.wait&&this.play.control.isPlaying&&(this.record.updateFragmentUI(this.play.control.currentIndex),this.play.control.wait=!1)}},{key:"toast",value:function(e){setTimeout((function(){document.getElementsByClassName("toast-wrap")[0].getElementsByClassName("toast-msg")[0].innerHTML=e;var t=document.getElementsByClassName("toast-wrap")[0];t.className=t.className.replace("toastAnimate",""),setTimeout((function(){t.className=t.className+" toastAnimate"}),10)}),10)}},{key:"tour360view",value:function(){if(this.player.currentPano&&2===this.player.currentPano.alignmentType){var e=this.player.model.language;this.toast(e.watchPr)}else $("#play").hasClass("play")}},{key:"goToDestination",value:function(e,t,n,i){if(this.destinationItem=objects.play.control.currentIndex,this.onTheBus=!0,this.emit("update.controls"),i||!this.atDestinationPano())if(this.player.flying||this.player.isWarping())ft.warn("Cannot go to new destination while player is flying or warping.");else{var o=this.player.model.getHeroDescriptorByIndex(this.destinationItem),r=null,a=null;if(null!=o.pano&&void 0!==o.pano){var s=0===this.destinationItem||e?Ve:this.nextWarpStyle;a=this.player.warpToPanoByHeroIndex.bind(this.player,this.destinationItem,zu.Show,Uu.Slow,s,t,n,this.actionComplete.bind(this)),r=this.arrivedAtDestination.bind(this,!0)}else a=this.player.warpToNonPanoByHeroIndex.bind(this.player,this.destinationItem,this.actionComplete.bind(this)),r=this.arrivedAtDestination.bind(this,!1);this.transitionStage=this.C.Moving,this.player.model.fadePanoMarkers(0,null,{hideVideoFlag:!0}),this.awaitCompletion(function(){a()}.bind(this),r),this.emit("update.controls")}else this.arrivedAtDestination(!0)}},{key:"tourInterlude",value:function(){if(this.player.model.fadePanoMarkers(0),this.emit("update.controls"),this.tourIsPlaying)return this.atEndOfTour()&&!this.endlessLoop?(this.tourInProgress=!1,this.stopTour(),this.emit(DirectorEvents.TourEnd),void(this.player.mode===Viewmode.PANORAMA&&this.player.model.fadePanoMarkers(at.panorama.markerOpacity))):void this.awaitCompletion(function(){this.transitionStage=this.C.Interlude,this.player.tourInterlude(this.nextItem(this.currentItem),this.actionComplete.bind(this))}.bind(this),this.goNext.bind(this))}},{key:"playTour",value:function(){if(!this.bounceable())return this.tourIsPlaying?void ft.info("tour is already playing"):void(this.wouldInterrupt()||(this.player.emit("tour_auto",this.defaultWarpStyle),this.tourInProgress=!0,this.reachSource="play",this.tourIsPlaying=!0,this.wasZoomEnabled=this.player.zoomEnabled,this.player.zoomEnabled=!1,this.resetSpecialTransition(),this.emit("update.controls"),this.emit(DirectorEvents.TourStart),this.player.enablePreRendering(),this.walkingSectionPaused?(this.clearWalkingSectionPaused(),this.goToDestination()):this.goNext()))}},{key:"hideTourBar",value:function(){browser.isMobile()?$(".btn-cat-play").removeClass("cat-mob-pause").addClass("cat-mob-play"):$(".btn-cat-play").removeClass("cat-pc-pause").addClass("cat-pc-play"),$("#gui").show()}},{key:"stopTour",value:function(){this.isInterrupted()||this.transitionStage===this.C.Moving&&this.checkAndHandleWalkingtourInterruption(this.nextWarpStyle)||(this.tourIsPlaying&&(this.player.zoomEnabled=this.wasZoomEnabled),this.tourIsPlaying=!1,this.interrupt(),this.clearWalkingSectionPaused(),this.resetSpecialTransition(),this.emit("update.controls"))}},{key:"endTourProgress",value:function(){this.tourInProgress=!1,this.emit("update.controls"),this.emit(DirectorEvents.TourEnd)}},{key:"goToHighlight",value:function(e){this.clearWalkingSectionPaused(),this.destinationItem=e,this.useSpecialTransition("Hilight"),this.goToDestination()}},{key:"goToHighlightByLocation",value:function(e){var t=this.player.model.heroLocations.findIndex((function(t){return!(!t.panoId||t.panoId!=e)}));if(!this.wouldInterrupt()){if(ft.debug("<tour.goto "+t+">"),this.wouldInterrupt()&&(t===this.destinationItem?this.interrupt():this.redirectToItem(t,"goToHighlight")),this.isInterrupted())return;this.clearWalkingSectionPaused(),this.setDestinationItem(t),this.useSpecialTransition("Hilight"),this.goToDestination()}}},{key:"prevHighlight",value:function(){this.bounceable()||(this.player.emit("tour_manual","prev"),this.interrupt(BlackoutStyle.BEGINNING)||this.isInterrupted()||(this.clearWalkingSectionPaused(),this.reachSource="prev",this.goPrev()))}},{key:"nextHighlight",value:function(){this.bounceable()||(this.player.emit("tour_manual","next"),this.interrupt(BlackoutStyle.BEGINNING)||this.isInterrupted()||(this.clearWalkingSectionPaused(),this.reachSource="next",this.goNext()))}},{key:"changeMode",value:function(e,t){var n=t||"gui";switch(this.wouldInterrupt()&&this.interrupt(),this.player.controls[e].emit("interaction."+n),this.clearWalkingSectionPaused(),e){case xt.PANORAMA:this.player.insideMode();break;case xt.DOLLHOUSE:case xt.FLOORPLAN:this.player.flyToNewMode({mode:e})}}},{key:"atEndOfTour",value:function(){return this.currentItem>=this.nItems-1}},{key:"firstDestination",value:function(){if(this.nItems<=0)return null;for(var e=0;e<this.nItems;e++)if(this.player.model.images.list[e].script===this.currentScript)return e;return 0}},{key:"finalDestination",value:function(){if(this.nItems<=0)return null;for(var e=this.nItems-1;e>=0;e--)if(this.player.model.images.list[e].script===this.currentScript)return e;return 0}},{key:"goPrev",value:function(){this.tourAdvance(-1)}},{key:"goNext",value:function(){this.tourAdvance(1)}},{key:"setDestinationItem",value:function(e){e>this.nItems&&(e=this.firstDestination()),this.destinationItem=e,this.emit("update.controls")}},{key:"setCurrentItem",value:function(e){this.currentItem=e,this.emit("update.controls")}},{key:"nextItem",value:function(e){return null===e?this.firstDestination():e>=this.nItems-1?this.endlessLoop?this.firstDestination():null:e+1}},{key:"prevItem",value:function(e){return null===e?this.firstDestination():e<0?this.endlessLoop?this.lastDestination():null:e-1}},{key:"tourAdvance",value:function(e){ft.debug("tourAdvance("+e+")"),null===this.currentItem||void 0===this.currentItem?this.setDestinationItem(this.firstDestination()):this.setDestinationItem(this.currentItem+e),this.destinationItem<0?(this.setDestinationItem(this.finalDestination()),this.useSpecialTransition("reverse-looping to end")):this.destinationItem>=this.nItems&&(this.setDestinationItem(this.firstDestination()),this.useSpecialTransition("looping back to start")),this.goToDestination()}}]),n}()}));var Gu=function(e){this.elem=e.elem,this.domParent=e.domParent,this.elem.addEventListener("mousedown",this.beginMove.bind(this)),this.elem.addEventListener("touchstart",this.beginMove.bind(this)),this.elem.addEventListener("pointerdown",this.beginMove.bind(this)),document.addEventListener("mousedown",this.move.bind(this)),document.addEventListener("touchmove",this.move.bind(this)),document.addEventListener("pointermove",this.move.bind(this)),e.cameraControls.on("pointerUp",this.moveDone.bind(this)),document.addEventListener("pointerup",this.moveDone.bind(this)),document.addEventListener("mouseup",this.moveDone.bind(this)),document.addEventListener("touchend",this.moveDone.bind(this)),document.addEventListener("touchcancel",this.moveDone.bind(this)),this.beginMoveFuc=e.beginMoveFuc,this.moveDoneFuc=e.moveDoneFuc,this.hasBound=e.hasBound,this.useTransform=e.useTransform,e.hasBound&&(this.needGetBound=1,window.addEventListener("resize",function(){this.needGetBound=1}.bind(this))),this.recover()};function ju(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}Gu.prototype.beginMove=function(e){if(e.preventDefault(),e.stopPropagation(),this.hasBound&&this.getMoveBound(),!this.moving){var t=(e=e.originalEvent||e).type.indexOf("touch")>-1;if(this.moving=!0,this.useTransform){var n,i,o=this.elem.style.transform;if(o){var r=o.indexOf("("),a=o.indexOf(")");o=o.slice(r+1,a).split(","),n=parseFloat(o[0]),i=parseFloat(o[1])}else n=i=0;this.dragInfo={startElem:{x:n,y:i},endElem:{x:n,y:i}}}else this.dragInfo={startElem:{x:parseFloat(this.elem[0].style.left),y:parseFloat(this.elem[0].style.top)}};this.dragInfo.startMouse={x:t?e.changedTouches[0].clientX:e.clientX,y:t?e.changedTouches[0].clientY:e.clientY},this.beginMoveFuc&&this.beginMoveFuc()}},Gu.prototype.move=function(e){if(this.moving){var t=(e=e.originalEvent||e).type.indexOf("touch")>-1,n=t?e.changedTouches[0].clientX:e.clientX,i=t?e.changedTouches[0].clientY:e.clientY;this.dragInfo.vector={x:n-this.dragInfo.startMouse.x,y:i-this.dragInfo.startMouse.y},this.dragInfo.endElem={x:this.dragInfo.startElem.x+this.dragInfo.vector.x,y:this.dragInfo.startElem.y+this.dragInfo.vector.y},this.hasBound&&(this.dragInfo.endElem.x=Math.max(this.bound.left,this.dragInfo.endElem.x),this.dragInfo.endElem.x=Math.min(this.bound.right,this.dragInfo.endElem.x),this.dragInfo.endElem.y=Math.max(this.bound.top,this.dragInfo.endElem.y),this.dragInfo.endElem.y=Math.min(this.bound.bottom,this.dragInfo.endElem.y)),this.useTransform?this.elem.style.transform="translate("+this.dragInfo.endElem.x+"px,"+this.dragInfo.endElem.y+"px)":(this.elem.style.left=this.dragInfo.endElem.x+"px",this.elem.style.top=this.dragInfo.endElem.y+"px")}},Gu.prototype.moveDone=function(e){this.moving&&(this.getMoveBound(),this.moving=!1,this.move(e),this.moveDoneFuc&&this.moveDoneFuc(this.reportPos()),this.dragInfo.startElem=this.dragInfo.endElem,this.dragInfo.vector={x:0,y:0})},Gu.prototype.getMoveBound=function(){if(this.needGetBound){var e=isMobile?68:100,t=isMobile?32:60,n=($("#player").width()-e)/2;isMobile?this.bound={left:-n,right:n,top:-($("#player").height()/2-$("header")[0].offsetTop-$("header").height()-t/2),bottom:$("#player").height()/2-$("footer").height()-t/2}:this.bound={left:-n,right:n,top:-($("#player").height()/2-50-t/2),bottom:$("#player").height()/2-t/2},console.log(this.bound),this.needGetBound=0}},Gu.prototype.reportPos=function(){return{x:this.dragInfo.endElem.x+this.domParent.clientWidth/2,y:this.dragInfo.endElem.y+this.domParent.clientHeight/2}},Gu.prototype.recover=function(){this.dragInfo={startElem:{x:0,y:0},endElem:{x:0,y:0}},this.useTransform?this.elem.style.transform="":(this.elem.style.left=0,this.elem.style.top=0)};var Wu,qu,Ju=function(e){f(n,EventEmitter);var t=ju(n);function n(){var e,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1?arguments[1]:void 0;return o(this,n),e=t.call(this),i.pos3d&&(e.pos3d=(new THREE.Vector3).copy(i.pos3d)),i.pos2d&&(e.pos2d=(new THREE.Vector2).copy(i.pos2d),e.setElemPos()),e.name=i.name,e.elem=i.elem,e.camera=i.camera,e.domParent=i.domParent,e.player=r,e.useTransform=i.useTransform,e.mayShelter=i.mayShelter,e}return u(n,[{key:"update",value:function(){if(this.pos3d&&!this.dragging){var e=pt.getPos2d(this.pos3d,this.player,this.camera,this.domParent);if(e.trueSide)if(this.mayShelter&&pt.ifShelter(this.pos3d,this.player,{x:e.vector.x,y:e.vector.y},this.camera))this.elem.style.display="none";else{if(this.elem.style.display="block",this.driftDir){var t=pt.getPos2d(this.pos3d.clone().add(this.driftDir)),n=this.elem[0].children[0].getBoundingClientRect(),i=ge.getCrossPointAtRect(t.pos,e.pos,n.width,n.height,e.pos.x-n.width/2,e.pos.y-n.height/2).sub(e.pos.clone()),o=100/this.pos3d.distanceTo(this.camera.position);this.pos2d=e.pos.clone().add(i.multiplyScalar((o+i.length())/i.length()))}else this.pos2d=(new THREE.Vector2).copy(e.vector);this.setElemPos()}else this.elem.style.display="none"}}},{key:"setElemPos",value:function(){if(this.useTransform){var e=this.pos2d.x/2*this.domParent.clientWidth,t=-this.pos2d.y/2*this.domParent.clientHeight;this.elem.style.transform="translate("+Math.round(e)+"px,"+Math.round(t)+"px)"}else this.elem.style.left=this.pos2d.x+"px",this.elem.style.top=this.pos2d.y+"px"}}]),n}();function Yu(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}var Zu,Xu,Ku,$u,eh=new THREE.Vector2,th={},nh={};function ih(e){eh=oh(e)}function oh(e){var t=(e=e.originalEvent||e).type.indexOf("touch")>-1;return{x:t?e.changedTouches[0].clientX:e.offsetX,y:t?qu?e.changedTouches[0].clientY-Wu.domElement.clientHeight:e.changedTouches[0].clientY:e.offsetY}}ct("TagEditManager",(function(){return function(e){f(n,e);var t=Yu(n);function n(e){var i,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return o(this,n),(i=t.call(this)).splitView=e,i.panoA,i.paonB,i.markTagPos,i.init(r),i}return u(n,[{key:"init",value:function(e){var t=this;this.inited||(Zu=this.$app.dom.querySelector('.player[name="copy"]'),Wu=this.$app.core.get("Player"),this.$app.core.get("TagManager"),qu=this.$app.config.mobile,this.panosHistory=[],this.markSpotA=new Ju({name:"markSpotA",elem:e.spotA,domParent:Wu.domElement,camera:Wu.camera,useTransform:!0},Wu),this.markSpotB=new Ju({name:"markSpotB",elem:e.spotB,domParent:Zu,camera:this.splitView.panoramaCam,useTransform:!0},Wu),this.markSpotA.name="markSpotA",this.markSpotB.name="markSpotB",new Gu({elem:this.markSpotA.elem,domParent:Wu.domElement,useTransform:!0,cameraControls:Wu.cameraControls,beginMoveFuc:function(){t.editing&&(t.markSpotA.dragging=!0,Wu.cameraControls.controls.panorama.locked=!0,t.splitView.panoramaCtl.locked=!0)},moveDoneFuc:function(e){t.editing&&(t.markSpotA.dragging=!1,Wu.cameraControls.controls.panorama.locked=!1,t.splitView.panoramaCtl.locked=!1,e&&t.moveToReGetA(e),Wu.mouseCouldBeClickToMove=!1)}}),Xu=new Gu({elem:this.markSpotB.elem,domParent:Zu,useTransform:!0,cameraControls:Wu.cameraControls,beginMoveFuc:function(){t.markSpotB.dragging=!0,t.splitView.panoramaCtl.locked=!0,Wu.cameraControls.controls.panorama.locked=!0},moveDoneFuc:function(e){t.markSpotB.dragging=!1,t.splitView.panoramaCtl.locked=!1,Wu.cameraControls.controls.panorama.locked=!1,e&&t.moveToReGetB(e)}}),Zu.addEventListener("pointerdown",ih),Zu.addEventListener("touchstart",ih),Zu.addEventListener("pointerup",this.clickToReGetB.bind(this)),Zu.addEventListener("touchend",this.clickToReGetB.bind(this)),Wu.on("update",(function(e){t.editing&&(e.hasChanged.cameraChanged2&&t.markSpotA.update(),t.splitView.changed()&&t.markSpotB.update())})),Wu.on("pano.chosen",(function(e,n){t.changePano(n)})),Wu.on("click",(function(e){t.editing&&!t.clickA&&(e.intersect&&t.getA(e.intersect),e.consume())})),Wu.on("ifFocusPoint",(function(e){if(t.editing&&t.markTagPos){e.importance<3&&(e.importance=3,e.aim=t.markTagPos.clone())}})),this.inited=!0)}},{key:"enter",value:function(){var e=this;Wu.viewLinkManager.exitView().then((function(){if(Wu.flying||Wu.flyingToTag)return Wu.flyingToTag,void Wu.once(ua,(function(){e.enter()}));Wu.flyToMode("panorama",(function(){!function t(){Wu.currentPano?(e.editing=!0,e.setSpotPos||Wu.flying||(e.splitView.enter(),e.panosHistory=[],e.panoB=e.splitView.panoB,e.markSpotA.elem.style.display="none",e.markSpotB.elem.style.display="none",e.markSpotA.pos3d=e.clickA=null,e.markSpotB.pos3d=e.clickB=null,e.markTagPos=null,Wu.reticule.visible=!1,Wu.locked=!0,null==Ku&&(Ku=at.insideLookLimitDown,$u=at.insideLookLimitUp,at.insideLookLimitDown=-35,at.insideLookLimitUp=35))):setTimeout(t,50)}()}))}))}},{key:"reSetPos",value:function(e){var t=this;this.markTagPos=(new THREE.Vector3).copy(e),Wu.viewLinkManager.exitView().then((function(){return Wu.flying||Wu.flyingToTag?(Wu.flyingToTag,void Wu.once(ua,(function(){t.reSetPos(e)}))):(t.editing=!0,t.panosHistory=[],t.hotRePos=!0,t.markSpotA.pos3d=t.clickA=t.markTagPos.clone(),t.markSpotA.enable=!0,t.markSpotB.pos3d=t.clickB=t.markTagPos.clone(),t.markSpotA.elem.style.display="block",t.markSpotB.elem.style.display="block",t.markSpotB.enable=!0,setTimeout((function(){t.markSpotA.update(),t.markSpotB.update()}),300),t.splitView.enter(),t.panoA=t.splitView.panoA,t.panoB=t.splitView.panoB,null==Ku&&(Ku=at.insideLookLimitDown,$u=at.insideLookLimitUp,at.insideLookLimitDown=-35,at.insideLookLimitUp=35),Wu.flyToPano({pano:Wu.currentPano,aimDuration:500,lookAtPoint:t.markTagPos}),!0)}))}},{key:"confirmPos",value:function(e){if(this.editing){var t=De.getRandomSid(),n=this.computeHotPos();return e&&Wu.model.add(new e(t,{position:n})),this.panoA?{sid:t,position:n,panoId:this.panoA.id}:{}}}},{key:"exit",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};e.cancel,this.clickA=this.clickB=null,this.markSpotA.pos3d=this.markSpotB.pos3d=null,this.splitView.leave(),this.markSpotA.elem.style.display="none",this.markSpotB.elem.style.display="none",this.markSpotA.pos2d=new THREE.Vector2,this.markSpotB.pos2d=new THREE.Vector2,this.markSpotA.setElemPos(),this.markSpotB.setElemPos(),Wu.reticule.visible=!0,this.hideMarker&&(editSpot.hideMarker.visible=!0,editSpot.hideMarker=null),this.hotRePos=!1,this.editing=!1,Wu.locked=!1,null!=Ku&&(at.insideLookLimitDown=Ku,at.insideLookLimitUp=$u,Ku=$u=null)}},{key:"changePano",value:function(e){this.editing&&(this.splitView.changePano(e),this.markTagPos&&(this.markSpotA.pos3d=this.markTagPos.clone(),this.panosHistory.push(e)),e.assistPano==this.splitView.panoB||e==this.splitView.panoB?this.splitView.pauseCameraBind=!1:this.splitView.pauseCameraBind||(this.splitView.pauseCameraBind=!0,this.markSpotB.pos3d&&this.splitView.panoramaCtl.startLookAt(this.markSpotB.pos3d)))}},{key:"getA",value:function(e){var t=this;if(!Wu.flying&&this.editing){if(this.panoA=Wu.currentPano,Wu.locked=!1,2!=at.visions&&this.panoA==this.panoB){var n=Wu.model.matrixWorld.clone().invert(),i=e.point.clone().applyMatrix4(n);if(!this.clickA){this.clickA=this.clickB=i;var o=Wu.model.panos.find([function(e){return Wu.currentPano.neighbourPanos[e.id]&&Wu.currentPano!=e&&e.isAligned()}],[so.sortFunctions.distanceToPoint(Wu.currentPano.position)]);o?Wu.flyToPano({pano:o,lookAtPoint:i.clone()}):console.log("当前场景只有一个pano,所以不走到下一个点")}this.clickA=this.clickB=i}else{if(Wu.currentPano.assistPano!=this.splitView.panoB||this.panosHistory.length>0){if(this.clickA){this.panoA=Wu.currentPano;n=Wu.model.matrixWorld.clone().invert();return this.clickA=e.point.clone().applyMatrix4(n),this.markSpotA.pos3d=this.clickA,this.markSpotA.update(),void this.computeHotPos()}if(this.splitView.setSceneB(),this.panoB=this.splitView.panoB,this.splitView.pauseCameraBind=!1,2!=at.visions)return this.splitView.panoramaCtl.startLookAt(e.point),this.getA(e)}if(2!=at.visions&&console.warn("settings.visions != 2 ???"),!this.getMatchData()){var r=this.panoA.id+"_"+this.panoB.id;if(th[r]=(th[r]||0)+1,!(th[r]>5))return void setTimeout((function(){t.getA(e)}),200);console.error("获取不到matchdata 放弃使用: "+r)}n=Wu.model.matrixWorld.clone().invert();if(this.clickA=e.point.clone().applyMatrix4(n),this.dirA=ge.getNormalDir(this.clickA,Wu.model.supportsTiles,Wu.currentPano),this.UVa=ge.getUVfromDir(this.dirA),this.UVb=this.searchPointAtLeft(this.UVa),this.UVb)this.UVb.x=this.UVb.x.toFixed(3)-0,this.UVb.y=this.UVb.y.toFixed(3)-0;else{console.log("找不到UVb,假设一个");this.UVb={x:this.UVa.x,y:this.UVa.y+-.02}}this.dirB=ge.getDirFromUV(this.UVb),this.clickB=function(e,t){e=e.clone();var n=t.matrixWorld.clone();return n.invert(),e=ge.crossRight(e,n),t.position.clone().add(e)}(this.dirB,this.splitView.panoB)}this.markSpotA.pos3d=this.clickA,this.markSpotB.pos3d=this.clickB,this.markSpotA.elem.style.display="block",this.markSpotB.elem.style.display="block",this.markSpotA.enable=!0,this.markSpotB.enable=!0,this.markSpotA.update(),this.markSpotB.update(),2!=at.visions&&this.panoA==this.panoB?this.markTagPos=this.markSpotA.pos3d.clone():this.computeHotPos(),this.$app.TagManager.emit("tagManager.markTagPos")}}},{key:"getB",value:function(e){var t=pt.getMouseIntersect(this.splitView.panoramaCam,[this.splitView.cube],e),n=Wu.model.matrixWorld.clone().invert();this.clickB=t.point.clone().applyMatrix4(n),this.markSpotB.pos3d=this.clickB,this.markSpotB.update(),this.computeHotPos()}},{key:"moveToReGetA",value:function(e){Wu.handleInputStart(e.x,e.y,!0,!0),Wu.updateIntersect({}),Wu.intersect?this.getA(Wu.intersect):this.markSpotA.update(),Wu.mouseDown=!1}},{key:"moveToReGetB",value:function(e){var t=new THREE.Vector2;ge.convertScreenPositionToNDC(e.x,e.y,t,Zu),this.getB(t)}},{key:"clickToReGetB",value:function(e){if(!Xu.moving){var t=oh(e);if(!(Math.abs(eh.x-t.x)>3||Math.abs(eh.y-t.y)>3)){if(!this.clickA&&!this.hotRePos)return console.log("..?.."),void this.$app.TagManager.emit("tagManager.firstMarkTagPosB");var n=new THREE.Vector2;ge.convertScreenPositionToNDC(t.x,t.y,n,Zu),this.getB(n)}}}},{key:"restricPosAtRoom",value:function(e){var t=Wu.currentPano.position,n=e,i=n.clone().sub(t).normalize(),o=new THREE.Raycaster(t,i,0,t.distanceTo(n)).intersectObjects(Wu.model.skyBoxTight);return o&&o.length&&(console.log("热点飘出skyBoxTight外,矫正:"+e.toArray()+" --\x3e "+o[0].point.toArray()),e.copy(o[0].point).sub(i.clone().multiplyScalar(.001))),e}},{key:"computeHotPos",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!this.panoA||!this.clickA)return null;var t=this.panoA.position.clone(),n=this.panoB.position.clone(),i=this.clickA,o=this.clickB,r=ge.getLineIntersect({A:t,B:n,p1:i,p2:o}),a=r.pos3d;return e.dontRestric||this.restricPosAtRoom(a),this.markTagPos=a,console.log("markTagPos: ",a.toArray()),a}},{key:"getMatchData",value:function(){var e=this.panoA.id+"_"+this.panoB.id;if(nh[e])return nh[e];ri.get(this.$app.resource.getEditDataURL("mapping/".concat(e,".json"))).then((function(t){nh[e]=t}))}},{key:"searchPointAtLeft",value:function(e){var t=this.getMatchData();if(e||console.log("!!!"),!t||!t["view pair"]||!t["view pair"].uv)return null;var n,i=e.x,o=e.y,r={},a={},s={},l={},c={leftTop:r,rightTop:a,leftBot:s,rightBot:l};function u(e,t){var n=t[0],r=t[1],a=(n-i)*(n-i)+(r-o)*(r-o);(null==e.dis||e.dis>a)&&(e.dis=a,e.pair=t)}t["view pair"].uv.forEach((function(e){e[0]<i&&e[1]<=o?u(r,e):e[0]>=i&&e[1]<=o?u(a,e):e[0]<i&&e[1]>=o?u(s,e):u(l,e)}));var h=0;for(var d in c)c[d].pair&&h++;var p={};function f(e,t){return e.pair?t.pair?e.dis<t.dis?e:t:e:t}function m(){var e=f(r,s),t=f(a,l),n=f(r,a),c=f(s,l);return p.x=(i-e.pair[0])/(t.pair[0]-e.pair[0]),p.y=(o-n.pair[1])/(c.pair[1]-n.pair[1]),{x:e.pair[2]+(t.pair[2]-e.pair[2])*p.x,y:n.pair[3]+(c.pair[3]-n.pair[3])*p.y}}return(h>=3||2==h&&(r.pair&&l.pair||s.pair&&a.pair))&&(n=m()),n}}]),n}(yo)}));var rh,ah,sh,lh=function(){function e(t,n){o(this,e),this.quickstart=!0,this.mode=xt.PANORAMA,this.zoom=-1,this.fov=Fe.urlHasValue("fov")?Number(Fe.urlQueryValue("fov")):at.insideFOV,this.pano=null,this.position=new THREE.Vector3,this.quaternion=new THREE.Quaternion,this.init(t,n)}return u(e,[{key:"init",value:function(e,t){var n=Fe.urlHasValue("pose",!0);if(n)try{n=De.replaceAll(n,"pano",'"pano"'),n="{"+(n=De.replaceAll(n,"qua:",'"qua":['))+"]}";var i=JSON.parse(n);this.pano=t.get(i.pano),this.pano?(this.quaternion=(new THREE.Quaternion).fromArray(i.qua),this.zoom=-1,this.setByUrl=!0):(n=!1,console.error("检测到firstView但是 找不到该pano"))}catch(e){n=!1,console.error("检测到firstView但是解析出错"+e)}else if(e&&e.entry){var o=e.entry;this.updateByEntry(o,t)}else this.pano=t.list[0],this.quaternion.copy(this.pano.quaternion);this.position.copy(this.pano.position),this.quaternion.equals(new THREE.Quaternion(-.5,.5,.5,.5))&&(this.quaternion.set(0,0,0,1),console.log("检测到初始画面quaternion为-0.5,0.5,0.5,0.5,强制更改为0,0,0,1"))}},{key:"updateByEntry",value:function(e,t){"string"==typeof e&&(e=JSON.parse(e)),e.pano&&(this.pano=t.get(e.pano)),null==this.pano&&(this.pano=t.list[0]),this.quaternion.copy(this.pano.quaternion),e.camera&&(this.quaternion=(new THREE.Quaternion).fromArray(e.camera.quaternion),this.zoom=e.camera.zoom)}},{key:"fromGuideView",value:function(e,t){this.mode=e.value.mode,this.zoom=e.value.zoom,this.position.copy(e.value.pos),this.quaternion.set(e.value.qua._x,e.value.qua._y,e.value.qua._z,e.value.qua._w),this.pano=t.get(e.value.pano)}}]),e}();function ch(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}var uh,hh={},dh=function(e){f(n,EventEmitter);var t=ch(n);function n(e,i){var r,a;return o(this,n),(r=t.call(this)).changed=function(){var e,t=this.panoramaCam.position.clone(),n=this.panoramaCam.quaternion.clone();return a&&ht.closeTo(a.position,t,5)&&ht.closeTo(a.quaternion,n,5)||(e=!0),e&&(a={position:t,quaternion:n}),e},window.SplitView=h(r),r.$app=e,r.init(),r.editType=i,r.pauseCameraBind,r}return u(n,[{key:"init",value:function(){var e=this;sh=this.$app.core.get("Player"),ah=this.$app.dom.querySelector('.player[name="copy"]'),(rh=new THREE.WebGLRenderer({antialias:!0})).setPixelRatio(window.devicePixelRatio),rh.setSize(300,300,!1),ah.appendChild(rh.domElement);var t=this.$app.withNewComponent("CameraControls");if(t.init(ah,["panorama"]),t.activateControls("panorama"),this.panoramaCtl=t.activeControl,this.panoramaCam=t.activeControl.camera,this.panoramaCam.fov=60,this.panoramaCam.name="splitViewCam",this.panoramaCam.layers.toggle(Lt),this.panoramaCam.layers.enable(Ft),this.panoramaCam.layers.enable(Vt),this.panoramaCam.layers.enable(Ot),2!=at.visions||sh.model.panos.list[0].assistPano||(at.visions=1,console.warn("自动更改 visions = 1")),2!=at.visions&&sh.model.supportsTiles){var n=this.$app.withNewComponent("SceneRenderer",1),i=this.$app.withNewComponent("PanoRenderer",1),o=this.$app.withNewComponent("TileDownloader",{$app:this.$app});o.index=1,n.renderer=rh,o.processPriorityQueue=!0,i.init(n,o),(uh=new co).extend(sh.model.panos.list.map((function(t){var n=new so(e.$app,t.id,t);return n.floorPosition=t.floorPosition,n.copyForSplitView=!0,n.attachToPanoRenderer(i),n.tileDownloader=o,n.qualityManager=e.$app.core.get("QualityManager"),n}))),o.setPanoData(uh,[],this.$app.core.get("ModelManager").projectNum),o.setUrls(sh.model.urls),o.useComponent(),this.tileDownloader=o,o.tilePrioritizer=new Ka(this.$app.core.get("QualityManager"),sh.basePanoSize,sh.standardPanoSize,sh.highPanoSize,sh.ultraHighPanoSize),o.tilePrioritizer.name="forSplitView"}this.cube=new THREE.Mesh(new THREE.BoxGeometry(10,10,10),new fo({side:THREE.BackSide,transparent:!1,name:"splitViewCubeMat",not_Cube:2==at.visions||!sh.model.supportsTiles},"skybox")),this.cube.name="splitView-cube",this.cube.layers.set(Ot),this.$app.core.get("SceneRenderer").scene.add(this.cube),sh.on("updateFromControls",(function(t,n){var i;e.editing&&(e.pauseCameraBind?e.panoramaCtl.update(n):(e.panoramaCtl.lon=t.cameraControls.controls.panorama.lon,e.panoramaCtl.lat=t.cameraControls.controls.panorama.lat,e.panoramaCtl.update(n),t.cameraControls.controls.panorama.lon=e.panoramaCtl.lon,t.cameraControls.controls.panorama.lat=e.panoramaCtl.lat),null===(i=e.tileDownloader)||void 0===i||i.tilePrioritizer.updateCriteria(e.panoB,e.panoB.position,new THREE.Vector3(0,0,-1).applyQuaternion(e.panoramaCtl.camera.quaternion)))}))}},{key:"enter",value:function(){var e;if(!this.editing){this.editing=!0,this.$app.core.get("SceneRenderer").addComponent(this),null===(e=this.tileDownloader2)||void 0===e||e.start();var t=sh.cameraControls.cameras.panorama;t.fov=t.staticFov=60,this.zoomEnabled=at.zoom.enabled,at.zoom.enabled=!1,this.pauseCameraBind=!1,this.panoA=sh.currentPano,this.setSize(),this.setSceneB(),this.emit("enter"),sh.OverlayManager.hide("all"),sh.GLTFEditor.hide("all")}}},{key:"leave",value:function(){var e;this.editing&&(this.$app.core.get("SceneRenderer").removeComponent(this),this.emit("leave"),this.editing=!1,at.zoom.enabled=this.zoomEnabled,sh.OverlayManager.show("all",!0),sh.GLTFEditor.show("all",!0),sh.cameraControls.cameras.panorama.staticFov=null,this.panoB&&this.panoB!=this.panoA&&(this.panoB.exit(),this.panoB.useAtScreenB=!1),null===(e=this.tileDownloader2)||void 0===e||e.stop())}},{key:"setSceneB",value:function(){var e=this.panoB;2!=at.visions?(this.panoB=this.panoA,this.cube.position.copy(this.panoB.position),this.panoramaCam.position.copy(this.panoB.position)):this.panoB!=this.panoA.assistPano&&(this.panoB=this.panoA.assistPano,this.cube.position.copy(this.panoB.position),this.panoramaCam.position.copy(this.panoB.position),this.hideMarker&&(this.hideMarker.visible=!0),this.hideMarker=this.panoA.marker,this.hideMarker.visible=!1),this.getTextureForCube(this.panoB),this.panoB.useAtScreenB=!0,e&&e!=this.panoB&&(e.exit(),e.useAtScreenB=!1)}},{key:"getTextureForCube",value:function(e){var t=this;console.log("getTextureForCube",e.id);e=e||this.panoB;2!=at.visions&&sh.model.supportsTiles&&(e=uh.index[e.id]);var n=function(){if(hh[t.panoB.id]&&(clearTimeout(hh[t.panoB.id]),delete hh[t.panoB.id]),e&&t.panoB.id!=e.id)console.log("getTextureForCube退出");else{console.log("texGetted",e.id),e.ensureSkyboxReadyForRender();var n=e.getSkyboxTexture();t.cube.material.uniforms.pano1Map.value=n,t.cube.material.uniforms.pano1Matrix.value.copy(t.panoB.matrixWorld)}};e.tiled?sh.checkAndWaitForPanoLoad(e,"high","high",512,(function(){n()})):sh.checkAndWaitForPanoLoad(e,"high","high",2048,(function(){n()}))}},{key:"update",value:function(){this.editing&&rh.render(this.$app.core.get("SceneRenderer").scene,this.panoramaCam)}},{key:"setSize",value:function(){this.editing&&(rh.setSize(ah.clientWidth,ah.clientHeight,!0,Math.min(window.devicePixelRatio,2)),this.panoramaCam.updateAspect(ah.clientWidth/ah.clientHeight))}},{key:"changePano",value:function(e){this.panoA=e}}]),n}(),ph=function(){function e(t,n){o(this,e),this.model=t,this.panos=t.panos,this.player=n,this.retryMinimumTime=1e4}return u(e,[{key:"start",value:function(){this.loadNextPano(function(e){e?this.start():(ft.debug("No suitable pano loaded, waiting a little while before looking again"),setTimeout(function(){this.start()}.bind(this),1e3))}.bind(this))}},{key:"validLoadTarget",value:function(e){return e&&!e.isLoaded("high")&&Date.now()-e.failedLoadingAt>this.retryMinimumTime}},{key:"listImagePanos",value:function(){var e=[],t=this;return this.model.images.forEach((function(n){if(n.metadata&&n.metadata.scan_id){var i=t.model.panos.get(n.metadata.scan_id);i&&!i.isLoaded("high")&&e.push(i)}})),e}},{key:"loadNextPano",value:function(e){var t,n,i=this.model.waitQueue.filter((function(e){return e.object instanceof so}));i.length>0?(t=i[0].object,ft.debug("Overrode pano selection: Flying to an unloaded pano "+t.id)):this.validLoadTarget(this.player.currentPano)?(t=this.player.currentPano,ft.debug("Overrode pano selection: Currently at an unloaded pano "+t.id)):this.validLoadTarget(this.player.closestPano)?(t=this.player.closestPano,ft.debug("Overrode pano selection: Hovering over an unloaded pano "+t.id)):this.player.mode===xt.PANORAMA&&(t=this.panos.lowestByScore([this.validLoadTarget.bind(this),so.filters.isNeighbourPanoTo(this.player.currentPano)],[so.scoreFunctions.distance(this.player.currentPano),so.scoreFunctions.direction(this.player.position,this.player.getDirection()),so.scoreFunctions.inFieldOfView(this.player.position,this.player.getDirection())]))&&ft.debug("Normal pano selection: neighbor "+t.id),t?(n=n||t.isLoaded("low")?"high":"low",ft.debug("Preloading "+n+"-res pano "+t.id),console.log("Preloading "+n+"-res pano "+t.id),t.loadCube(n).done(e).fail((function(){ft.warn("Failed preloading pano",t.id,", marking it as failed and forgetting it for a while"),e()}))):e&&e(null)}}]),e}();function fh(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return mh(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return mh(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var i=0,o=function(){};return{s:o,n:function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var r,a=!0,s=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return a=e.done,e},e:function(e){s=!0,r=e},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw r}}}}function mh(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);n<t;n++)i[n]=e[n];return i}function vh(e){var t=e.core.get("Player"),n=e.TagManager.tags.length,i=t.model.chunks.length,o=t.model.chunks.reduce((function(e,t){return e+t.geometry.attributes.position.count}),0),r=t.model.texSizeBlock,a=t.model.panos.list.length,s=t.model.panos.list.filter((function(e){return e.hasVideo})).length,l=t.OverlayManager.group.children.length,c=t.OverlayManager.group.children.filter((function(e){return"video"==e.info.type})).length,u=Object.keys(t.viewLinkManager.views),h=u.length,d=u.filter((function(e){return"pano"==t.viewLinkManager.views[e].linkType})).length;console.log("%c".concat("共有初始chunk ".concat(i," 个 ( 顶点数 ").concat(o," )\n 模型贴图尺寸是512的 ").concat(r," 倍数 \n 热点 ").concat(n," 个 \n 漫游点 ").concat(a," 个 ( 视频漫游点 ").concat(s," 个 )\n overlay ").concat(l," 个 ( 视频类型 ").concat(c," 个 )\n viewLink ").concat(h," 个 ( pano类型 ").concat(d," 个 )\n ")),"color:#FF4399")}ct("Scene",(function(){return function(){function e(){o(this,e),this.ready=!1,this.loaded=!1,this.tilegen=!0,this.quickstart=!1,this.position=new THREE.Vector3(15,10,15),this.splitViews=[]}var t,n,i,r,a;return u(e,[{key:"beforeLoad",value:function(){this.$app.withComponent("Screenshot"),this.$app.withComponent("SceneRenderer"),this.$app.withComponent("PanoRenderer"),this.$app.withComponent("PanoVideoRenderer"),this.$app.withComponent("QualityManager"),this.$app.withComponent("ModelManager"),this.$app.withComponent("CameraControls"),this.$app.withComponent("DisplayController"),this.$app.withComponent("TileDownloader",{concurrentDownloads:this.tilegen?6:2,$app:this.$app}),this.$app.withComponent("Player"),this.$app.withComponent("Director"),this.$app.core.get("SceneRenderer").createScene(),this.$app.core.get("CameraControls").init(this.$app.dom.querySelector(".player")),this.$app.core.get("QualityManager").init(),this.$app.core.get("TileDownloader").init(),this.$app.core.get("PanoRenderer").init()}},{key:"start",value:(a=k(S.mark((function e(){var t,n,i,o,r,a,s=this;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.ready){e.next=2;break}return e.abrupt("return");case 2:if(!1!==this.$app.config.view||!this.$app.config.useAuth){e.next=14;break}return e.prev=3,e.next=6,this.$app.resource.auth();case 6:if(0!=e.sent.success){e.next=9;break}return e.abrupt("return");case 9:e.next=14;break;case 11:return e.prev=11,e.t0=e.catch(3),e.abrupt("return");case 14:return e.next=16,this.$app.resource.metadata();case 16:if(null!=(t=e.sent)){e.next=19;break}return e.abrupt("return");case 19:if(!t.filters||1!=t.filters){e.next=22;break}return e.next=22,this.$app.store.get("filters");case 22:if(!t.cutModel||1!=t.cutModel){e.next=25;break}return e.next=25,this.$app.store.get("cutModel");case 25:if(1===this.$app.store.getValue("metadata").controls.showAllModel?wl.setSide(2):wl.setSide(null),this.beforeLoad(),!this.$app.Scene.locked){e.next=30;break}return e.next=30,this.$app.Scene.locked;case 30:return t.sceneKind&&"pano"==t.sceneKind&&(this.$app.core.get("Player").model.supportsTiles=!1),this.$app.core.get("TileDownloader").start(),n=JSON.parse(JSON.stringify(t)),e.next=35,Hs.handle(n,this.$app);case 35:if(this.$app.core.get("PanoVideoRenderer").init(n.videos),!(t.mosaic&&t.mosaicList&&t.mosaicList.length)){e.next=56;break}i=fh(t.mosaicList),e.prev=38,i.s();case 40:if((o=i.n()).done){e.next=48;break}if(r=o.value,e.t1=r.fileName,!e.t1){e.next=46;break}return e.next=46,si.loadWithoutUpdate(this.$app.resource.getUserResourceURL(r.fileName));case 46:e.next=40;break;case 48:e.next=53;break;case 50:e.prev=50,e.t2=e.catch(38),i.e(e.t2);case 53:return e.prev=53,i.f(),e.finish(53);case 56:return e.next=58,this.$app.resource.visions();case 58:return this.initPanos(t),this.$app.FilterManager.initFilters(),e.next=62,this.isQuick(t);case 62:if(this.$app.Scene.emit("ready"),this.ready=!0,a=function(){var e=k(S.mark((function e(){return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,s.$app.resource.flooruser();case 2:return s.$app.core.get("SceneRenderer").addComponent(Ae),s.$app.core.get("Player").model.build(),s.afterLoad(),s.$app.core.get("Player").model.supportsTiles||new ph(s.$app.core.get("Player").model,s.$app.core.get("Player")).start(),e.next=8,s.loadPanos();case 8:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),"3dtiles"!==t.modelKind){e.next=71;break}return e.next=68,this.$app.resource.modelmesh3dTiles();case 68:this.$app.Scene.on("3dTilesLoaded",a),e.next=77;break;case 71:return e.next=73,this.$app.resource.modelmeshDam();case 73:return e.next=75,this.$app.resource.textures();case 75:return e.next=77,a();case 77:case"end":return e.stop()}}),e,this,[[3,11],[38,50,53,56]])}))),function(){return a.apply(this,arguments)})},{key:"isQuick",value:(r=k(S.mark((function e(t){return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.firstView.quickstart){e.next=3;break}return e.next=3,this.quickEnter(this.firstView,t);case 3:case"end":return e.stop()}}),e,this)}))),function(e){return r.apply(this,arguments)})},{key:"loadPanos",value:(i=k(S.mark((function e(){var t,n=this;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.$app.core.get("Player").start(this.firstView);case 2:if(this.firstView.quickstart&&(this.$app.core.get("SceneRenderer").removeComponent(this.$app.core.get("QuickstartManager")),this.$app.core.get("QuickstartManager").destroy()),this.loaded=!0,this.$app.Scene.emit("loaded",this.$app.core.get("Player").currentPano),this.$app.core.get("TileDownloader").useComponent(),this.$app.core.get("SceneRenderer").addComponent(this.$app.core.get("PanoRenderer"),!0),t=function(){var e=k(S.mark((function e(){return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,n.$app.store.get("tags");case 2:return e.next=4,n.$app.store.get("tours");case 4:return e.next=6,n.$app.store.get("links");case 6:return e.next=8,n.$app.store.get("cameras");case 8:return e.next=10,n.$app.store.get("billboards");case 10:return e.next=12,n.$app.store.get("cutModel");case 12:return e.next=14,n.$app.store.get("sceneDraw");case 14:n.$app.Scene.emit("loadeddata"),vh(n.$app);case 16:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),this.$app.core.get("Player").mode===xt.TRANSITIONING){e.next=13;break}return e.next=11,t();case 11:e.next=14;break;case 13:this.$app.Camera.once("mode.afterChange",t);case 14:case"end":return e.stop()}}),e,this)}))),function(){return i.apply(this,arguments)})},{key:"initPanos",value:function(e){this.startSceneRenderer();var t=this.$app.core.get("Player").model;this.$app.core.get("ModelManager").init(),this.$app.core.get("ModelManager").addModel(t),this.firstView=new lh(e,t.panos),this.firstView.quickstart=!0}},{key:"afterLoad",value:function(){this.$app.core.get("SceneRenderer").scene.add(this.$app.core.get("Player").model),this.$app.core.get("Player").init(),this.$app.core.get("Player").setScene(),this.$app.core.get("DisplayController").init(),lu.bindEvents(this.$app.core.get("Player")),this.$app.core.get("SceneRenderer").addComponent(this.$app.core.get("Player")),Qu(this.$app.core.get("Director"),this.$app.core.get("CameraControls"),this.$app.core.get("Player"),this.$app.core.get("ModelManager"),this.$app.core.get("SceneRenderer"))}},{key:"startSceneRenderer",value:function(){if(!this.$app.core.get("SceneRenderer").started){try{this.$app.core.get("SceneRenderer").start(this.$app.dom.querySelector(".player"))}catch(e){ft.error(e.message)}1==this.$app.uid&&this.$app.config.mobile&&ku.Init(this.$app.core.get("SceneRenderer"),this.$app.core.get("Player"))}}},{key:"quickEnter",value:(n=k(S.mark((function e(t,n){var i,o,r=this;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.$app.core.get("CameraControls").activateControls(xt.PANORAMA),i=this.$app.core.get("CameraControls").controls[xt.PANORAMA],this.$app.withComponent("QuickstartManager",this.$app.core.get("QualityManager"),this.$app.core.get("SceneRenderer").scene,this.$app.core.get("SceneRenderer").camera,i),o=this.$app.core.get("QuickstartManager"),e.next=6,o.load(t);case 6:this.$app.core.get("SceneRenderer").addComponent(o),this.$app.core.get("SceneRenderer").once(xa,(function(){ft.info("".concat(r.$app.config.num,"First render after quickstart load finished."))}));case 8:case"end":return e.stop()}}),e,this)}))),function(e,t){return n.apply(this,arguments)})},{key:"getSplit",value:(t=k(S.mark((function e(t,n){return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.$app.dom.classList.add("kankan-app__split"),e.prev=1,e.next=4,this.$app.resource.visions2();case 4:e.next=9;break;case 6:e.prev=6,e.t0=e.catch(1),ft.warn("".concat(this.$app.config.num,"[load visions2] fail"));case 9:return this.splitViews[t]||(this.splitViews[t]=new dh(this.$app,t)),n&&this.splitViews[t].enter(),e.abrupt("return",this.splitViews[t]);case 12:case"end":return e.stop()}}),e,this,[[1,6]])}))),function(e,n){return t.apply(this,arguments)})},{key:"restore",value:function(e){this.$app.dom.classList.remove("kankan-app__split"),this.splitViews[e].leave()}}]),e}()}));var gh={damPro:Base64.decode("bWVzc2FnZSBiaW5hcnlfbWVzaCB7CglyZXBlYXRlZCBjaHVua19zaW1wbGUgY2h1bmsgPSAxOwoJcmVwZWF0ZWQgY2h1bmtfcXVhbnRpemVkIHF1YW50aXplZF9jaHVuayA9IDI7Cn0KCi8vIERlZmluaXRpb24gb2YgdmVydGljZXM6IDNEIGNvb3JkaW5hdGVzLCBhbmQgMkQgdGV4dHVyZSBjb29yZGluYXRlcy4KbWVzc2FnZSB2ZXJ0aWNlc19zaW1wbGUgewoJcmVwZWF0ZWQgZmxvYXQgeHl6ID0gMSBbcGFja2VkPXRydWVdOyAgLy8geF8wLHlfMCx6XzAsIHhfMSx5XzEsel8xLCAuLi4KCXJlcGVhdGVkIGZsb2F0IHV2ID0gMiBbcGFja2VkPXRydWVdOyAgLy8gdV8wLHZfMCwgdV8xLHZfMSwgLi4uCn0KCi8vIEluZGV4ZXMgb2YgdmVydGljZXMgb2YgZmFjZXMKbWVzc2FnZSBmYWNlc19zaW1wbGUgewoJcmVwZWF0ZWQgdWludDMyIGZhY2VzID0gMSBbcGFja2VkPXRydWVdOyAvLyBpMDAsaTAxLGkwMiwgaTEwLGkxMSxpMTIsIC4uLgp9CgovLyBBIHNpbXBseSBlbmNvZGVkIGNodW5rLgovLyBUT0RPOiBhZGQgY2h1bmsgcHJvcGVyaXRlcyAoc3VjaCBhcyAicmVmbGVjdGl2ZSIpCm1lc3NhZ2UgY2h1bmtfc2ltcGxlIHsKCW9wdGlvbmFsIHZlcnRpY2VzX3NpbXBsZSB2ZXJ0aWNlcyA9IDE7CglvcHRpb25hbCBmYWNlc19zaW1wbGUgZmFjZXMgPSAyOwoJb3B0aW9uYWwgc3RyaW5nIGNodW5rX25hbWUgPSAzOwoJb3B0aW9uYWwgc3RyaW5nIG1hdGVyaWFsX25hbWUgPSA0Owp9CgovLyBRdWFudGl6ZWQgdmVyc2lvbnMgZm9sbG93OgptZXNzYWdlIHZlcnRpY2VzX3F1YW50aXplZCB7CglvcHRpb25hbCBmbG9hdCBxdWFudGl6YXRpb24gPSAxOwoJcmVwZWF0ZWQgZmxvYXQgdHJhbnNsYXRpb24gPSAyOwoJcmVwZWF0ZWQgc2ludDMyIHggPSAzIFtwYWNrZWQ9dHJ1ZV07CglyZXBlYXRlZCBzaW50MzIgeSA9IDQgW3BhY2tlZD10cnVlXTsKCXJlcGVhdGVkIHNpbnQzMiB6ID0gNSBbcGFja2VkPXRydWVdOwp9CgptZXNzYWdlIHV2X3F1YW50aXplZCB7CglvcHRpb25hbCBzdHJpbmcgbmFtZSA9IDE7CglvcHRpb25hbCBmbG9hdCBxdWFudGl6YXRpb24gPSAyOwoJcmVwZWF0ZWQgc2ludDMyIHUgPSAzIFtwYWNrZWQ9dHJ1ZV07CglyZXBlYXRlZCBzaW50MzIgdiA9IDQgW3BhY2tlZD10cnVlXTsKfQoKLy8gSW5kZXhlcyBvZiB2ZXJ0aWNlcyBvZiBmYWNlcwptZXNzYWdlIGZhY2VzX2NvbXByZXNzZWQgewoJcmVwZWF0ZWQgc2ludDMyIGZhY2VzID0gMSBbcGFja2VkPXRydWVdOyAvLyBpMDAsaTAxLGkwMiwgaTEwLGkxMSxpMTIsIC4uLgp9CgptZXNzYWdlIGNodW5rX3F1YW50aXplZCB7CglvcHRpb25hbCBzdHJpbmcgY2h1bmtfbmFtZSA9IDE7CglvcHRpb25hbCBzdHJpbmcgbWF0ZXJpYWxfbmFtZSA9IDI7CglvcHRpb25hbCB2ZXJ0aWNlc19xdWFudGl6ZWQgdmVydGljZXMgPSAzOwoJcmVwZWF0ZWQgdXZfcXVhbnRpemVkIHV2cyA9IDQ7CglvcHRpb25hbCBmYWNlc19zaW1wbGUgZmFjZXMgPSA1Owp9Cg=="),visionmodeldataPro:Base64.decode("Ly8KLy8gUHJvdG9jb2wgQnVmZmVyIGZvciBwdWNrIHZpc2liaWxpdHkgYW5kIHJlbGF0ZWQgZGF0YQovLwovL3BhY2thZ2UgZW9zLnN0b3JhZ2U7CgovLyBpbXBvcnQgImVvcy9pbmZyYS9jb21tb24ucHJvdG8iOwovLyBUaGUgZm9sbG93aW5nIHdlcmUgbWFudWFsbHkgZXh0cmFjdGVkIGhlcmUsIEpTIGRvZXMgbm90IGxpa2UgcHJvdG9idWYgaW1wb3J0cwoKbWVzc2FnZSBBZmZpbmUzZiB7CglvcHRpb25hbCBRdWF0ZXJuaW9uZiByb3RhdGlvbiA9IDE7CglvcHRpb25hbCBWZWN0b3IzZiB0cmFuc2xhdGlvbiA9IDI7Cn0KCm1lc3NhZ2UgUXVhdGVybmlvbmYgewoJb3B0aW9uYWwgZmxvYXQgdyA9IDE7CglvcHRpb25hbCBmbG9hdCB4ID0gMjsKCW9wdGlvbmFsIGZsb2F0IHkgPSAzOwoJb3B0aW9uYWwgZmxvYXQgeiA9IDQ7Cn0KCm1lc3NhZ2UgVmVjdG9yM2YgewoJb3B0aW9uYWwgZmxvYXQgeCA9IDE7CglvcHRpb25hbCBmbG9hdCB5ID0gMjsKCW9wdGlvbmFsIGZsb2F0IHogPSAzOwp9CgovLwovLyBPbmUgc3dlZXAgLyBwYW5vCi8vCm1lc3NhZ2UgU3dlZXBMb2NhdGlvbiB7CglvcHRpb25hbCBieXRlcyB1dWlkID0gMTsgIC8qIHV1aWQgKi8KCW9wdGlvbmFsIEFmZmluZTNmIHBvc2UgPSAyOyAgLyogY2FtZXJhIHBvc2UgKHgsIHkseikgaW4gbWV0ZXIgYW5kIGEgcXVhdGVybmlvbiovCglvcHRpb25hbCBWZWN0b3IzZiBwdWNrID0gMzsgIC8qIHB1Y2sgbG9jYXRpb24gLSB4IGFueSBpcyBnZW5lcmFsbHkgdGhlIHNhbWUgYXMgcG9zZSwgeiBpcyB0aGUgaGVpZ2h0IG9mIHRoZSBjbG9zZXN0IGZsb29yIHVuZGVyIHRoZSBjYW1lcmEgKi8KCW9wdGlvbmFsIGludDMyIGdyb3VwID0gNDsgIC8qIGZsb29yIGluZGV4ICovCglvcHRpb25hbCBpbnQzMiBzdWJncm91cCA9IDU7ICAvKiByb29tIGluZGV4ICovCglyZXBlYXRlZCBpbnQzMiB2aXNpYmxlcyA9IDY7ICAvKiBsaXN0IG9mIGluZGljZXMgdG8gYWxsIHB1Y2tzIHZpc2libGUgZnJvbSB0aGlzIHB1Y2sgKi8KCXJlcGVhdGVkIGludDMyIHZpc2libGVzMiA9IDc7IAoJcmVwZWF0ZWQgaW50MzIgdmlzaWJsZXMzID0gODsKfQoKLy8KLy8gQWxsIHB1Y2tzIGluIGEgbW9kZWwuIFB1Y2tzIGFyZSBzdG9yZWQgaW4gc2Nhbm5pbmcgb3JkZXIuCi8vCm1lc3NhZ2UgTmF2aWdhdGlvbkluZm8gewoJcmVwZWF0ZWQgU3dlZXBMb2NhdGlvbiBzd2VlcExvY2F0aW9ucyA9IDE7Cn0="),decoderMesh(){return dcodeIO.ProtoBuf.loadProto(this.damPro).build("binary_mesh")},decoderModeldata(){return dcodeIO.ProtoBuf.loadProto(this.visionmodeldataPro).build("NavigationInfo")},decompressMesh(e){var t=null;try{t=this.decoderMesh().decode(e)}catch(e){return ft.error("failed parsing proto for .dam"),null}return t},decompressModeldata(e){var t=null;try{t=this.decoderModeldata().decode(e)}catch(e){return ft.error("failed parsing proto for .modeldata"),null}return t}};function yh(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}var Ah=function(e){f(n,THREE.Mesh);var t=yh(n);function n(e){var i;o(this,n);var r=new fo({side:THREE.DoubleSide});(i=t.call(this,e.geometry,r)).materialInside=r;var a=THREE.UniformsUtils.clone(mn.modelOutside.uniforms);return i.materialOutside=new THREE.RawShaderMaterial({fragmentShader:mn.modelOutside.fragmentShader,vertexShader:mn.modelOutside.vertexShader,uniforms:a,side:THREE.FrontSide,name:"chunkOut",transparent:!0}),i.materialOutside.extraValues={},i.name=e.name||"",i.meshUrl=e.meshUrl,i.tileId=e.tileId,e.tileId&&(i.materialInside.defines.Is3dTiles=1,i.materialOutside.defines.Is3dTiles=1),e.textureName?i.textureName=e.textureName:i.setTextureMap(e.texture),i.isChunk=!0,i}return u(n,[{key:"setTextureMap",value:function(e){this.materialInside.uniforms.map.value=e,this.materialOutside.uniforms.map.value=e}},{key:"setMode",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"-";t.split("-")[0],t.split("-")[1];var n=this.materialInside;e!==xt.DOLLHOUSE&&e!==xt.FLOORPLAN||"transitioning"==e&&t.includes(xt.PANORAMA)||(n=this.materialOutside),e===xt.PANORAMA?n.side=THREE.DoubleSide:n.side=THREE.FrontSide,null!==wl.side&&(n.side=wl.side),this.material=n}}]),n}(),Eh={convertProtobufToSceneObject:function(e,t,n){if(0==t.chunk.length)return ft.warn("No chunks in damfile..."),null;var i=new THREE.Matrix4;return i.set(1,0,0,0,0,0,1,0,0,-1,0,0,0,0,0,1),t.chunk.map((function(t){var n=new THREE.BufferGeometry;n.setAttribute("position",new THREE.BufferAttribute(new Float32Array(t.vertices.xyz,0,3),3)),t.vertices.uv.length>0&&n.setAttribute("uv",new THREE.BufferAttribute(new Float32Array(t.vertices.uv,0,2),2)),n.setIndex(new THREE.BufferAttribute(new Uint32Array(t.faces.faces,0,1),1)),n.applyMatrix4(i),n.computeBoundingBox();var o=at.job+at.format;return W.model.name&&(o=W.model.name),new Ah({geometry:n,textureName:t.material_name,name:t.chunk_name,meshUrl:e.resource.getViewImagesURL(o)})}))},visionModeldata:function(e){var t;e.sweepLocations.forEach((function(e){e.visibles3=e.visibles3||[],e.visibles.forEach((function(t){-1==e.visibles3.indexOf(t)&&e.visibles3.push(t)}))}));for(var n=e.sweepLocations.length,i=0;i<n;i++){if((e.sweepLocations[i].visibles2&&e.sweepLocations[i].visibles2.length||0)>0){t=!0;break}}t||(e.sweepLocations.forEach((function(e){e.visibles2=null})),ft.info("检测到疑似没有noblock数据,应该是手动上传,block置空"));var o=e.sweepLocations.map(function(e,t){return{uuid:e.uuid.toUTF8().replace(/-/g,""),position:{x:e.pose.translation.x,y:e.pose.translation.y,z:e.pose.translation.z},quaternion:{x:e.pose.rotation.x,y:e.pose.rotation.y,z:e.pose.rotation.z,w:e.pose.rotation.w},puck:{x:e.puck.x,y:e.puck.y,z:e.puck.z},alignmentType:e.alignment_type,neighbours:e.visibles3||e.visibles,noBlocks:e.visibles2,seeMarkers:e.visibles,group:e.group,subgroup:e.subgroup,index:t}}.bind(this)).map(function(e){return e.position=this.convertVisionVector(e.position),e.quaternion=this.convertVisionQuaternion(e.quaternion),e.puck=this.convertVisionVector(e.puck),e}.bind(this));return o.forEach((function(e){e.neighbours=e.neighbours.filter((function(e){return o[e]})).map((function(e){return o[e].uuid}))})),o.forEach((function(e){e.noBlocks&&(e.noBlocks=e.noBlocks.map((function(e){return o[e].uuid})))})),o.forEach((function(e){e.seeMarkers&&(e.seeMarkers=e.seeMarkers.filter((function(e){return o[e]})).map((function(e){return o[e].uuid})))})),o},panos:function(e,t,n){var i=e.core.get("Player").model.panos,o=e.core.get("PanoVideoRenderer"),r=o.videosInfo.videos;if(e.config.view){var a=new Map;i.extend(t.map(function(t){if(t.neighbours.length){var n=r.get(t.uuid);return n&&a.set(t.uuid,n),new so(e,t.uuid,t,n)}return new so(e,t.uuid,t,null)}.bind(this)),"id"),o.initVideoPlayer(e.dom,a)}else i.extend(t.map(function(t){return new so(e,t.uuid,t,r.get(t.uuid))}.bind(this)),"id"),o.initVideoPlayer(e.dom,r);return i.forEach((function(e){e.neighbourUUIDs&&(e.neighbourUUIDs.forEach((function(t){var n=i.get(t);n&&i.setNeighbour(e,n,!0)})),e.neighbourPanos=i.getNeighbours(e)||{})})),0===i.length&&ft.warn("Model has no panos, turning off inside mode"),i},panosAssist(e,t){return e.map(function(e){return e.panoType="assistant",e.tiled=!1,new so(t,e.uuid,e)}.bind(this))},convertVisionVector:function(e){return new THREE.Vector3(e.x,e.z,-e.y)},convertVisionQuaternion:function(e){return new THREE.Quaternion(e.x,e.z,-e.y,e.w).multiply((new THREE.Quaternion).setFromAxisAngle(new THREE.Vector3(0,1,0),THREE.MathUtils.degToRad(90)))},convertWorkshopVector:function(e){return new THREE.Vector3(-e.x,e.y,e.z)},convertWorkshopQuaternion:function(e){return new THREE.Quaternion(-e.x,e.y,e.z,-e.w).multiply(new THREE.Quaternion(Math.sqrt(2)/2,Math.sqrt(2)/2,0,0))}},bh={parseIdsFromChunkName(e,t){t.floorId=this.parseFloor(e),t.roomId=this.parseRoom(e)},parseFloor(e){var t=e.match(/_group([0-9]+)/);if(!t)return 0;try{return parseInt(t[1],10)}catch(e){return logger.warn('Non-int value "'+t[1]+'" for mesh group, defaulting to floor 0'),0}},parseRoom(e){var t=e.match(/_sub([0-9]+)/);if(!t)return-1;try{return parseInt(t[1],10)}catch(e){return logger.warn('Non-int value "'+t[1]+'" for mesh subgroup, defaulting to subgroup 0'),0}}},wh={load:(e,t,n)=>new Promise((function(n){function i(e,i){e||(t.push(i),++a===o&&n())}if(!e.chunks[0]||!e.chunks[0].meshUrl)return n();var o=De.countUnique(e.chunks.map((function(e){return e.textureName})));e.chunks[0].meshUrl.indexOf("_50k");var r="low";at.minimalMemoryMode&&"high"===r&&(Fe.detectSamsungS6()?(ft.warn("Galaxy S6 cannot handle large textures, turning down quality."),r="low"):o>at.maxMobileTextures&&(ft.warn("Model probably too large for mobile, turning down quality."),r="low"));var a=0,s=e.data.job.uuid+"_50k_texture_jpg_high1/";W.model.name&&(s=W.model.name.replace(".dam","_texture/")),e.chunks.forEach((function(t){if(!t.material.map&&t.textureName){var n=e.urls.get(s+t.textureName);t.setTextureMap(si.load(n,i.bind(this,si.isLoaded(n))))}}))}))};function xh(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Ch(e){this.wrapped=e}function Th(e){return new Ch(e)}function Ih(e){var t,n;function i(t,n){try{var r=e[t](n),a=r.value,s=a instanceof Ch;Promise.resolve(s?a.wrapped:a).then((function(e){s?i("return"===t?"return":"next",e):o(r.done?"return":"normal",e)}),(function(e){i("throw",e)}))}catch(e){o("throw",e)}}function o(e,o){switch(e){case"return":t.resolve({value:o,done:!0});break;case"throw":t.reject(o);break;default:t.resolve({value:o,done:!1})}(t=t.next)?i(t.key,t.arg):n=null}this._invoke=function(e,o){return new Promise((function(r,a){var s={key:e,arg:o,resolve:r,reject:a,next:null};n?n=n.next=s:(t=n=s,i(e,o))}))},"function"!=typeof e.return&&(this.return=void 0)}function kh(e){return function(){return new Ih(e.apply(this,arguments))}}function Bh(e){var t;if("undefined"!=typeof Symbol&&(Symbol.asyncIterator&&(t=e[Symbol.asyncIterator]),null==t&&Symbol.iterator&&(t=e[Symbol.iterator])),null==t&&(t=e["@@asyncIterator"]),null==t&&(t=e["@@iterator"]),null==t)throw new TypeError("Object is not async iterable");return t.call(e)}Ih.prototype["function"==typeof Symbol&&Symbol.asyncIterator||"@@asyncIterator"]=function(){return this},Ih.prototype.next=function(e){return this._invoke("next",e)},Ih.prototype.throw=function(e){return this._invoke("throw",e)},Ih.prototype.return=function(e){return this._invoke("return",e)};var Ph,Rh,Mh,Sh=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:4;o(this,e),this.pool=t,this.queue=[],this.workers=[],this.workersResolve=[],this.workerStatus=0}return u(e,[{key:"_initWorker",value:function(e){if(!this.workers[e]){var t=this.workerCreator();t.addEventListener("message",this._onMessage.bind(this,e)),this.workers[e]=t}}},{key:"_getIdleWorker",value:function(){for(var e=0;e<this.pool;e++)if(!(this.workerStatus&1<<e))return e;return-1}},{key:"_onMessage",value:function(e,t){var n=this.workersResolve[e];if(n&&n(t),this.queue.length){var i=this.queue.shift(),o=i.resolve,r=i.msg,a=i.transfer;this.workersResolve[e]=o,this.workers[e].postMessage(r,a)}else this.workerStatus^=1<<e}},{key:"setWorkerCreator",value:function(e){this.workerCreator=e}},{key:"setWorkerLimit",value:function(e){this.pool=e}},{key:"postMessage",value:function(e,t){var n=this;return new Promise((function(i){var o=n._getIdleWorker();-1!==o?(n._initWorker(o),n.workerStatus|=1<<o,n.workersResolve[o]=i,n.workers[o].postMessage(e,t)):n.queue.push({resolve:i,msg:e,transfer:t})}))}},{key:"dispose",value:function(){this.workers.forEach((function(e){return e.terminate()})),this.workersResolve.length=0,this.workers.length=0,this.queue.length=0,this.workerStatus=0}}]),e}(),Dh=function e(){o(this,e),this.vkFormat=0,this.typeSize=1,this.pixelWidth=0,this.pixelHeight=0,this.pixelDepth=0,this.layerCount=0,this.faceCount=1,this.supercompressionScheme=0,this.levels=[],this.dataFormatDescriptor=[{vendorId:0,descriptorType:0,descriptorBlockSize:0,versionNumber:2,colorModel:0,colorPrimaries:1,transferFunction:2,flags:0,texelBlockDimension:[0,0,0,0],bytesPlane:[0,0,0,0,0,0,0,0],samples:[]}],this.keyValue={},this.globalData=null},Lh=function(){function e(t,n,i,r){o(this,e),this._dataView=new DataView(t.buffer,t.byteOffset+n,i),this._littleEndian=r,this._offset=0}return u(e,[{key:"_nextUint8",value:function(){var e=this._dataView.getUint8(this._offset);return this._offset+=1,e}},{key:"_nextUint16",value:function(){var e=this._dataView.getUint16(this._offset,this._littleEndian);return this._offset+=2,e}},{key:"_nextUint32",value:function(){var e=this._dataView.getUint32(this._offset,this._littleEndian);return this._offset+=4,e}},{key:"_nextUint64",value:function(){var e=this._dataView.getUint32(this._offset,this._littleEndian)+Math.pow(2,32)*this._dataView.getUint32(this._offset+4,this._littleEndian);return this._offset+=8,e}},{key:"_nextInt32",value:function(){var e=this._dataView.getInt32(this._offset,this._littleEndian);return this._offset+=4,e}},{key:"_skip",value:function(e){return this._offset+=e,this}},{key:"_scan",value:function(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this._offset,i=0;this._dataView.getUint8(this._offset)!==t&&i<e;)i++,this._offset++;return i<e&&this._offset++,new Uint8Array(this._dataView.buffer,this._dataView.byteOffset+n,i)}}]),e}(),Fh=[171,75,84,88,32,50,48,187,13,10,26,10];function Hh(e){return"undefined"!=typeof TextDecoder?(new TextDecoder).decode(e):Buffer.from(e).toString("utf8")}function Vh(e){var t=new Uint8Array(e.buffer,e.byteOffset,Fh.length);if(t[0]!==Fh[0]||t[1]!==Fh[1]||t[2]!==Fh[2]||t[3]!==Fh[3]||t[4]!==Fh[4]||t[5]!==Fh[5]||t[6]!==Fh[6]||t[7]!==Fh[7]||t[8]!==Fh[8]||t[9]!==Fh[9]||t[10]!==Fh[10]||t[11]!==Fh[11])throw new Error("Missing KTX 2.0 identifier.");var n=new Dh,i=17*Uint32Array.BYTES_PER_ELEMENT,o=new Lh(e,Fh.length,i,!0);n.vkFormat=o._nextUint32(),n.typeSize=o._nextUint32(),n.pixelWidth=o._nextUint32(),n.pixelHeight=o._nextUint32(),n.pixelDepth=o._nextUint32(),n.layerCount=o._nextUint32(),n.faceCount=o._nextUint32();var r=o._nextUint32();n.supercompressionScheme=o._nextUint32();for(var a=o._nextUint32(),s=o._nextUint32(),l=o._nextUint32(),c=o._nextUint32(),u=o._nextUint64(),h=o._nextUint64(),d=new Lh(e,Fh.length+i,3*r*8,!0),p=0;p<r;p++)n.levels.push({levelData:new Uint8Array(e.buffer,e.byteOffset+d._nextUint64(),d._nextUint64()),uncompressedByteLength:d._nextUint64()});for(var f=new Lh(e,a,s,!0),m={vendorId:f._skip(4)._nextUint16(),descriptorType:f._nextUint16(),versionNumber:f._nextUint16(),descriptorBlockSize:f._nextUint16(),colorModel:f._nextUint8(),colorPrimaries:f._nextUint8(),transferFunction:f._nextUint8(),flags:f._nextUint8(),texelBlockDimension:[f._nextUint8(),f._nextUint8(),f._nextUint8(),f._nextUint8()],bytesPlane:[f._nextUint8(),f._nextUint8(),f._nextUint8(),f._nextUint8(),f._nextUint8(),f._nextUint8(),f._nextUint8(),f._nextUint8()],samples:[]},v=(m.descriptorBlockSize/4-6)/4,g=0;g<v;g++){var y={bitOffset:f._nextUint16(),bitLength:f._nextUint8(),channelType:f._nextUint8(),samplePosition:[f._nextUint8(),f._nextUint8(),f._nextUint8(),f._nextUint8()],sampleLower:-1/0,sampleUpper:1/0};64&y.channelType?(y.sampleLower=f._nextInt32(),y.sampleUpper=f._nextInt32()):(y.sampleLower=f._nextUint32(),y.sampleUpper=f._nextUint32()),m.samples[g]=y}n.dataFormatDescriptor.length=0,n.dataFormatDescriptor.push(m);for(var A=new Lh(e,l,c,!0);A._offset<c;){var E=A._nextUint32(),b=A._scan(E),w=Hh(b),x=A._scan(E-b.byteLength);n.keyValue[w]=w.match(/^ktx/i)?Hh(x):x,A._offset%4&&A._skip(4-A._offset%4)}if(h<=0)return n;for(var C=new Lh(e,u,h,!0),T=C._nextUint16(),I=C._nextUint16(),k=C._nextUint32(),B=C._nextUint32(),P=C._nextUint32(),R=C._nextUint32(),M=[],S=0;S<r;S++)M.push({imageFlags:C._nextUint32(),rgbSliceByteOffset:C._nextUint32(),rgbSliceByteLength:C._nextUint32(),alphaSliceByteOffset:C._nextUint32(),alphaSliceByteLength:C._nextUint32()});var D=u+C._offset,L=D+k,F=L+B,H=F+P,V=new Uint8Array(e.buffer,e.byteOffset+D,k),O=new Uint8Array(e.buffer,e.byteOffset+L,B),Q=new Uint8Array(e.buffer,e.byteOffset+F,P),_=new Uint8Array(e.buffer,e.byteOffset+H,R);return n.globalData={endpointCount:T,selectorCount:I,imageDescs:M,endpointsData:V,selectorsData:O,tablesData:Q,extendedData:_},n}var Oh={env:{emscripten_notify_memory_growth:function(e){Mh=new Uint8Array(Rh.exports.memory.buffer)}}},Qh=function(){function e(){o(this,e)}return u(e,[{key:"init",value:function(){return Ph||(Ph="undefined"!=typeof fetch?fetch("data:application/wasm;base64,"+_h).then((function(e){return e.arrayBuffer()})).then((function(e){return WebAssembly.instantiate(e,Oh)})).then(this._init):WebAssembly.instantiate(Buffer.from(_h,"base64"),Oh).then(this._init))}},{key:"_init",value:function(e){Rh=e.instance,Oh.env.emscripten_notify_memory_growth(0)}},{key:"decode",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;if(!Rh)throw new Error("ZSTDDecoder: Await .init() before decoding.");var n=e.byteLength,i=Rh.exports.malloc(n);Mh.set(e,i),t=t||Number(Rh.exports.ZSTD_findDecompressedSize(i,n));var o=Rh.exports.malloc(t),r=Rh.exports.ZSTD_decompress(o,t,i,n),a=Mh.slice(o,o+r);return Rh.exports.free(i),Rh.exports.free(o),a}}]),e}(),_h="AGFzbQEAAAABpQEVYAF/AX9gAn9/AGADf39/AX9gBX9/f39/AX9gAX8AYAJ/fwF/YAR/f39/AX9gA39/fwBgBn9/f39/fwF/YAd/f39/f39/AX9gAn9/AX5gAn5+AX5gAABgBX9/f39/AGAGf39/f39/AGAIf39/f39/f38AYAl/f39/f39/f38AYAABf2AIf39/f39/f38Bf2ANf39/f39/f39/f39/fwF/YAF/AX4CJwEDZW52H2Vtc2NyaXB0ZW5fbm90aWZ5X21lbW9yeV9ncm93dGgABANpaAEFAAAFAgEFCwACAQABAgIFBQcAAwABDgsBAQcAEhMHAAUBDAQEAAANBwQCAgYCBAgDAwMDBgEACQkHBgICAAYGAgQUBwYGAwIGAAMCAQgBBwUGCgoEEQAEBAEIAwgDBQgDEA8IAAcABAUBcAECAgUEAQCAAgYJAX8BQaCgwAILB2AHBm1lbW9yeQIABm1hbGxvYwAoBGZyZWUAJgxaU1REX2lzRXJyb3IAaBlaU1REX2ZpbmREZWNvbXByZXNzZWRTaXplAFQPWlNURF9kZWNvbXByZXNzAEoGX3N0YXJ0ACQJBwEAQQELASQKussBaA8AIAAgACgCBCABajYCBAsZACAAKAIAIAAoAgRBH3F0QQAgAWtBH3F2CwgAIABBiH9LC34BBH9BAyEBIAAoAgQiA0EgTQRAIAAoAggiASAAKAIQTwRAIAAQDQ8LIAAoAgwiAiABRgRAQQFBAiADQSBJGw8LIAAgASABIAJrIANBA3YiBCABIARrIAJJIgEbIgJrIgQ2AgggACADIAJBA3RrNgIEIAAgBCgAADYCAAsgAQsUAQF/IAAgARACIQIgACABEAEgAgv3AQECfyACRQRAIABCADcCACAAQQA2AhAgAEIANwIIQbh/DwsgACABNgIMIAAgAUEEajYCECACQQRPBEAgACABIAJqIgFBfGoiAzYCCCAAIAMoAAA2AgAgAUF/ai0AACIBBEAgAEEIIAEQFGs2AgQgAg8LIABBADYCBEF/DwsgACABNgIIIAAgAS0AACIDNgIAIAJBfmoiBEEBTQRAIARBAWtFBEAgACABLQACQRB0IANyIgM2AgALIAAgAS0AAUEIdCADajYCAAsgASACakF/ai0AACIBRQRAIABBADYCBEFsDwsgAEEoIAEQFCACQQN0ams2AgQgAgsWACAAIAEpAAA3AAAgACABKQAINwAICy8BAX8gAUECdEGgHWooAgAgACgCAEEgIAEgACgCBGprQR9xdnEhAiAAIAEQASACCyEAIAFCz9bTvtLHq9lCfiAAfEIfiUKHla+vmLbem55/fgsdAQF/IAAoAgggACgCDEYEfyAAKAIEQSBGBUEACwuCBAEDfyACQYDAAE8EQCAAIAEgAhBnIAAPCyAAIAJqIQMCQCAAIAFzQQNxRQRAAkAgAkEBSARAIAAhAgwBCyAAQQNxRQRAIAAhAgwBCyAAIQIDQCACIAEtAAA6AAAgAUEBaiEBIAJBAWoiAiADTw0BIAJBA3ENAAsLAkAgA0F8cSIEQcAASQ0AIAIgBEFAaiIFSw0AA0AgAiABKAIANgIAIAIgASgCBDYCBCACIAEoAgg2AgggAiABKAIMNgIMIAIgASgCEDYCECACIAEoAhQ2AhQgAiABKAIYNgIYIAIgASgCHDYCHCACIAEoAiA2AiAgAiABKAIkNgIkIAIgASgCKDYCKCACIAEoAiw2AiwgAiABKAIwNgIwIAIgASgCNDYCNCACIAEoAjg2AjggAiABKAI8NgI8IAFBQGshASACQUBrIgIgBU0NAAsLIAIgBE8NAQNAIAIgASgCADYCACABQQRqIQEgAkEEaiICIARJDQALDAELIANBBEkEQCAAIQIMAQsgA0F8aiIEIABJBEAgACECDAELIAAhAgNAIAIgAS0AADoAACACIAEtAAE6AAEgAiABLQACOgACIAIgAS0AAzoAAyABQQRqIQEgAkEEaiICIARNDQALCyACIANJBEADQCACIAEtAAA6AAAgAUEBaiEBIAJBAWoiAiADRw0ACwsgAAsMACAAIAEpAAA3AAALQQECfyAAKAIIIgEgACgCEEkEQEEDDwsgACAAKAIEIgJBB3E2AgQgACABIAJBA3ZrIgE2AgggACABKAAANgIAQQALDAAgACABKAIANgAAC/cCAQJ/AkAgACABRg0AAkAgASACaiAASwRAIAAgAmoiBCABSw0BCyAAIAEgAhALDwsgACABc0EDcSEDAkACQCAAIAFJBEAgAwRAIAAhAwwDCyAAQQNxRQRAIAAhAwwCCyAAIQMDQCACRQ0EIAMgAS0AADoAACABQQFqIQEgAkF/aiECIANBAWoiA0EDcQ0ACwwBCwJAIAMNACAEQQNxBEADQCACRQ0FIAAgAkF/aiICaiIDIAEgAmotAAA6AAAgA0EDcQ0ACwsgAkEDTQ0AA0AgACACQXxqIgJqIAEgAmooAgA2AgAgAkEDSw0ACwsgAkUNAgNAIAAgAkF/aiICaiABIAJqLQAAOgAAIAINAAsMAgsgAkEDTQ0AIAIhBANAIAMgASgCADYCACABQQRqIQEgA0EEaiEDIARBfGoiBEEDSw0ACyACQQNxIQILIAJFDQADQCADIAEtAAA6AAAgA0EBaiEDIAFBAWohASACQX9qIgINAAsLIAAL8wICAn8BfgJAIAJFDQAgACACaiIDQX9qIAE6AAAgACABOgAAIAJBA0kNACADQX5qIAE6AAAgACABOgABIANBfWogAToAACAAIAE6AAIgAkEHSQ0AIANBfGogAToAACAAIAE6AAMgAkEJSQ0AIABBACAAa0EDcSIEaiIDIAFB/wFxQYGChAhsIgE2AgAgAyACIARrQXxxIgRqIgJBfGogATYCACAEQQlJDQAgAyABNgIIIAMgATYCBCACQXhqIAE2AgAgAkF0aiABNgIAIARBGUkNACADIAE2AhggAyABNgIUIAMgATYCECADIAE2AgwgAkFwaiABNgIAIAJBbGogATYCACACQWhqIAE2AgAgAkFkaiABNgIAIAQgA0EEcUEYciIEayICQSBJDQAgAa0iBUIghiAFhCEFIAMgBGohAQNAIAEgBTcDGCABIAU3AxAgASAFNwMIIAEgBTcDACABQSBqIQEgAkFgaiICQR9LDQALCyAACy8BAn8gACgCBCAAKAIAQQJ0aiICLQACIQMgACACLwEAIAEgAi0AAxAIajYCACADCy8BAn8gACgCBCAAKAIAQQJ0aiICLQACIQMgACACLwEAIAEgAi0AAxAFajYCACADCx8AIAAgASACKAIEEAg2AgAgARAEGiAAIAJBCGo2AgQLCAAgAGdBH3MLugUBDX8jAEEQayIKJAACfyAEQQNNBEAgCkEANgIMIApBDGogAyAEEAsaIAAgASACIApBDGpBBBAVIgBBbCAAEAMbIAAgACAESxsMAQsgAEEAIAEoAgBBAXRBAmoQECENQVQgAygAACIGQQ9xIgBBCksNABogAiAAQQVqNgIAIAMgBGoiAkF8aiEMIAJBeWohDiACQXtqIRAgAEEGaiELQQQhBSAGQQR2IQRBICAAdCIAQQFyIQkgASgCACEPQQAhAiADIQYCQANAIAlBAkggAiAPS3JFBEAgAiEHAkAgCARAA0AgBEH//wNxQf//A0YEQCAHQRhqIQcgBiAQSQR/IAZBAmoiBigAACAFdgUgBUEQaiEFIARBEHYLIQQMAQsLA0AgBEEDcSIIQQNGBEAgBUECaiEFIARBAnYhBCAHQQNqIQcMAQsLIAcgCGoiByAPSw0EIAVBAmohBQNAIAIgB0kEQCANIAJBAXRqQQA7AQAgAkEBaiECDAELCyAGIA5LQQAgBiAFQQN1aiIHIAxLG0UEQCAHKAAAIAVBB3EiBXYhBAwCCyAEQQJ2IQQLIAYhBwsCfyALQX9qIAQgAEF/anEiBiAAQQF0QX9qIgggCWsiEUkNABogBCAIcSIEQQAgESAEIABIG2shBiALCyEIIA0gAkEBdGogBkF/aiIEOwEAIAlBASAGayAEIAZBAUgbayEJA0AgCSAASARAIABBAXUhACALQX9qIQsMAQsLAn8gByAOS0EAIAcgBSAIaiIFQQN1aiIGIAxLG0UEQCAFQQdxDAELIAUgDCIGIAdrQQN0awshBSACQQFqIQIgBEUhCCAGKAAAIAVBH3F2IQQMAQsLQWwgCUEBRyAFQSBKcg0BGiABIAJBf2o2AgAgBiAFQQdqQQN1aiADawwBC0FQCyEAIApBEGokACAACwkAQQFBBSAAGwsMACAAIAEoAAA2AAALqgMBCn8jAEHwAGsiCiQAIAJBAWohDiAAQQhqIQtBgIAEIAVBf2p0QRB1IQxBACECQQEhBkEBIAV0IglBf2oiDyEIA0AgAiAORkUEQAJAIAEgAkEBdCINai8BACIHQf//A0YEQCALIAhBA3RqIAI2AgQgCEF/aiEIQQEhBwwBCyAGQQAgDCAHQRB0QRB1ShshBgsgCiANaiAHOwEAIAJBAWohAgwBCwsgACAFNgIEIAAgBjYCACAJQQN2IAlBAXZqQQNqIQxBACEAQQAhBkEAIQIDQCAGIA5GBEADQAJAIAAgCUYNACAKIAsgAEEDdGoiASgCBCIGQQF0aiICIAIvAQAiAkEBajsBACABIAUgAhAUayIIOgADIAEgAiAIQf8BcXQgCWs7AQAgASAEIAZBAnQiAmooAgA6AAIgASACIANqKAIANgIEIABBAWohAAwBCwsFIAEgBkEBdGouAQAhDUEAIQcDQCAHIA1ORQRAIAsgAkEDdGogBjYCBANAIAIgDGogD3EiAiAISw0ACyAHQQFqIQcMAQsLIAZBAWohBgwBCwsgCkHwAGokAAsjAEIAIAEQCSAAhUKHla+vmLbem55/fkLj3MqV/M7y9YV/fAsQACAAQn43AwggACABNgIACyQBAX8gAARAIAEoAgQiAgRAIAEoAgggACACEQEADwsgABAmCwsfACAAIAEgAi8BABAINgIAIAEQBBogACACQQRqNgIEC0oBAX9BoCAoAgAiASAAaiIAQX9MBEBBiCBBMDYCAEF/DwsCQCAAPwBBEHRNDQAgABBmDQBBiCBBMDYCAEF/DwtBoCAgADYCACABC9cBAQh/Qbp/IQoCQCACKAIEIgggAigCACIJaiIOIAEgAGtLDQBBbCEKIAkgBCADKAIAIgtrSw0AIAAgCWoiBCACKAIIIgxrIQ0gACABQWBqIg8gCyAJQQAQKSADIAkgC2o2AgACQAJAIAwgBCAFa00EQCANIQUMAQsgDCAEIAZrSw0CIAcgDSAFayIAaiIBIAhqIAdNBEAgBCABIAgQDxoMAgsgBCABQQAgAGsQDyEBIAIgACAIaiIINgIEIAEgAGshBAsgBCAPIAUgCEEBECkLIA4hCgsgCgubAgEBfyMAQYABayINJAAgDSADNgJ8AkAgAkEDSwRAQX8hCQwBCwJAAkACQAJAIAJBAWsOAwADAgELIAZFBEBBuH8hCQwEC0FsIQkgBS0AACICIANLDQMgACAHIAJBAnQiAmooAgAgAiAIaigCABA7IAEgADYCAEEBIQkMAwsgASAJNgIAQQAhCQwCCyAKRQRAQWwhCQwCC0EAIQkgC0UgDEEZSHINAUEIIAR0QQhqIQBBACECA0AgAiAATw0CIAJBQGshAgwAAAsAC0FsIQkgDSANQfwAaiANQfgAaiAFIAYQFSICEAMNACANKAJ4IgMgBEsNACAAIA0gDSgCfCAHIAggAxAYIAEgADYCACACIQkLIA1BgAFqJAAgCQsLACAAIAEgAhALGgsQACAALwAAIAAtAAJBEHRyCy8AAn9BuH8gAUEISQ0AGkFyIAAoAAQiAEF3Sw0AGkG4fyAAQQhqIgAgACABSxsLCwkAIAAgATsAAAsDAAELigYBBX8gACAAKAIAIgVBfnE2AgBBACAAIAVBAXZqQYQgKAIAIgQgAEYbIQECQAJAIAAoAgQiAkUNACACKAIAIgNBAXENACACQQhqIgUgA0EBdkF4aiIDQQggA0EISxtnQR9zQQJ0QYAfaiIDKAIARgRAIAMgAigCDDYCAAsgAigCCCIDBEAgAyACKAIMNgIECyACKAIMIgMEQCADIAIoAgg2AgALIAIgAigCACAAKAIAQX5xajYCAEGEICEAAkACQCABRQ0AIAEgAjYCBCABKAIAIgNBAXENASADQQF2QXhqIgNBCCADQQhLG2dBH3NBAnRBgB9qIgMoAgAgAUEIakYEQCADIAEoAgw2AgALIAEoAggiAwRAIAMgASgCDDYCBAsgASgCDCIDBEAgAyABKAIINgIAQYQgKAIAIQQLIAIgAigCACABKAIAQX5xajYCACABIARGDQAgASABKAIAQQF2akEEaiEACyAAIAI2AgALIAIoAgBBAXZBeGoiAEEIIABBCEsbZ0Efc0ECdEGAH2oiASgCACEAIAEgBTYCACACIAA2AgwgAkEANgIIIABFDQEgACAFNgIADwsCQCABRQ0AIAEoAgAiAkEBcQ0AIAJBAXZBeGoiAkEIIAJBCEsbZ0Efc0ECdEGAH2oiAigCACABQQhqRgRAIAIgASgCDDYCAAsgASgCCCICBEAgAiABKAIMNgIECyABKAIMIgIEQCACIAEoAgg2AgBBhCAoAgAhBAsgACAAKAIAIAEoAgBBfnFqIgI2AgACQCABIARHBEAgASABKAIAQQF2aiAANgIEIAAoAgAhAgwBC0GEICAANgIACyACQQF2QXhqIgFBCCABQQhLG2dBH3NBAnRBgB9qIgIoAgAhASACIABBCGoiAjYCACAAIAE2AgwgAEEANgIIIAFFDQEgASACNgIADwsgBUEBdkF4aiIBQQggAUEISxtnQR9zQQJ0QYAfaiICKAIAIQEgAiAAQQhqIgI2AgAgACABNgIMIABBADYCCCABRQ0AIAEgAjYCAAsLDgAgAARAIABBeGoQJQsLgAIBA38CQCAAQQ9qQXhxQYQgKAIAKAIAQQF2ayICEB1Bf0YNAAJAQYQgKAIAIgAoAgAiAUEBcQ0AIAFBAXZBeGoiAUEIIAFBCEsbZ0Efc0ECdEGAH2oiASgCACAAQQhqRgRAIAEgACgCDDYCAAsgACgCCCIBBEAgASAAKAIMNgIECyAAKAIMIgFFDQAgASAAKAIINgIAC0EBIQEgACAAKAIAIAJBAXRqIgI2AgAgAkEBcQ0AIAJBAXZBeGoiAkEIIAJBCEsbZ0Efc0ECdEGAH2oiAygCACECIAMgAEEIaiIDNgIAIAAgAjYCDCAAQQA2AgggAkUNACACIAM2AgALIAELtwIBA38CQAJAIABBASAAGyICEDgiAA0AAkACQEGEICgCACIARQ0AIAAoAgAiA0EBcQ0AIAAgA0EBcjYCACADQQF2QXhqIgFBCCABQQhLG2dBH3NBAnRBgB9qIgEoAgAgAEEIakYEQCABIAAoAgw2AgALIAAoAggiAQRAIAEgACgCDDYCBAsgACgCDCIBBEAgASAAKAIINgIACyACECchAkEAIQFBhCAoAgAhACACDQEgACAAKAIAQX5xNgIAQQAPCyACQQ9qQXhxIgMQHSICQX9GDQIgAkEHakF4cSIAIAJHBEAgACACaxAdQX9GDQMLAkBBhCAoAgAiAUUEQEGAICAANgIADAELIAAgATYCBAtBhCAgADYCACAAIANBAXRBAXI2AgAMAQsgAEUNAQsgAEEIaiEBCyABC7kDAQJ/IAAgA2ohBQJAIANBB0wEQANAIAAgBU8NAiAAIAItAAA6AAAgAEEBaiEAIAJBAWohAgwAAAsACyAEQQFGBEACQCAAIAJrIgZBB00EQCAAIAItAAA6AAAgACACLQABOgABIAAgAi0AAjoAAiAAIAItAAM6AAMgAEEEaiACIAZBAnQiBkHAHmooAgBqIgIQFyACIAZB4B5qKAIAayECDAELIAAgAhAMCyACQQhqIQIgAEEIaiEACwJAAkACQAJAIAUgAU0EQCAAIANqIQEgBEEBRyAAIAJrQQ9Kcg0BA0AgACACEAwgAkEIaiECIABBCGoiACABSQ0ACwwFCyAAIAFLBEAgACEBDAQLIARBAUcgACACa0EPSnINASAAIQMgAiEEA0AgAyAEEAwgBEEIaiEEIANBCGoiAyABSQ0ACwwCCwNAIAAgAhAHIAJBEGohAiAAQRBqIgAgAUkNAAsMAwsgACEDIAIhBANAIAMgBBAHIARBEGohBCADQRBqIgMgAUkNAAsLIAIgASAAa2ohAgsDQCABIAVPDQEgASACLQAAOgAAIAFBAWohASACQQFqIQIMAAALAAsLQQECfyAAIAAoArjgASIDNgLE4AEgACgCvOABIQQgACABNgK84AEgACABIAJqNgK44AEgACABIAQgA2tqNgLA4AELpgEBAX8gACAAKALs4QEQFjYCyOABIABCADcD+OABIABCADcDuOABIABBwOABakIANwMAIABBqNAAaiIBQYyAgOAANgIAIABBADYCmOIBIABCADcDiOEBIABCAzcDgOEBIABBrNABakHgEikCADcCACAAQbTQAWpB6BIoAgA2AgAgACABNgIMIAAgAEGYIGo2AgggACAAQaAwajYCBCAAIABBEGo2AgALYQEBf0G4fyEDAkAgAUEDSQ0AIAIgABAhIgFBA3YiADYCCCACIAFBAXE2AgQgAiABQQF2QQNxIgM2AgACQCADQX9qIgFBAksNAAJAIAFBAWsOAgEAAgtBbA8LIAAhAwsgAwsMACAAIAEgAkEAEC4LiAQCA38CfiADEBYhBCAAQQBBKBAQIQAgBCACSwRAIAQPCyABRQRAQX8PCwJAAkAgA0EBRg0AIAEoAAAiBkGo6r5pRg0AQXYhAyAGQXBxQdDUtMIBRw0BQQghAyACQQhJDQEgAEEAQSgQECEAIAEoAAQhASAAQQE2AhQgACABrTcDAEEADwsgASACIAMQLyIDIAJLDQAgACADNgIYQXIhAyABIARqIgVBf2otAAAiAkEIcQ0AIAJBIHEiBkUEQEFwIQMgBS0AACIFQacBSw0BIAVBB3GtQgEgBUEDdkEKaq2GIgdCA4h+IAd8IQggBEEBaiEECyACQQZ2IQMgAkECdiEFAkAgAkEDcUF/aiICQQJLBEBBACECDAELAkACQAJAIAJBAWsOAgECAAsgASAEai0AACECIARBAWohBAwCCyABIARqLwAAIQIgBEECaiEEDAELIAEgBGooAAAhAiAEQQRqIQQLIAVBAXEhBQJ+AkACQAJAIANBf2oiA0ECTQRAIANBAWsOAgIDAQtCfyAGRQ0DGiABIARqMQAADAMLIAEgBGovAACtQoACfAwCCyABIARqKAAArQwBCyABIARqKQAACyEHIAAgBTYCICAAIAI2AhwgACAHNwMAQQAhAyAAQQA2AhQgACAHIAggBhsiBzcDCCAAIAdCgIAIIAdCgIAIVBs+AhALIAMLWwEBf0G4fyEDIAIQFiICIAFNBH8gACACakF/ai0AACIAQQNxQQJ0QaAeaigCACACaiAAQQZ2IgFBAnRBsB5qKAIAaiAAQSBxIgBFaiABRSAAQQV2cWoFQbh/CwsdACAAKAKQ4gEQWiAAQQA2AqDiASAAQgA3A5DiAQu1AwEFfyMAQZACayIKJABBuH8hBgJAIAVFDQAgBCwAACIIQf8BcSEHAkAgCEF/TARAIAdBgn9qQQF2IgggBU8NAkFsIQYgB0GBf2oiBUGAAk8NAiAEQQFqIQdBACEGA0AgBiAFTwRAIAUhBiAIIQcMAwUgACAGaiAHIAZBAXZqIgQtAABBBHY6AAAgACAGQQFyaiAELQAAQQ9xOgAAIAZBAmohBgwBCwAACwALIAcgBU8NASAAIARBAWogByAKEFMiBhADDQELIAYhBEEAIQYgAUEAQTQQECEJQQAhBQNAIAQgBkcEQCAAIAZqIggtAAAiAUELSwRAQWwhBgwDBSAJIAFBAnRqIgEgASgCAEEBajYCACAGQQFqIQZBASAILQAAdEEBdSAFaiEFDAILAAsLQWwhBiAFRQ0AIAUQFEEBaiIBQQxLDQAgAyABNgIAQQFBASABdCAFayIDEBQiAXQgA0cNACAAIARqIAFBAWoiADoAACAJIABBAnRqIgAgACgCAEEBajYCACAJKAIEIgBBAkkgAEEBcXINACACIARBAWo2AgAgB0EBaiEGCyAKQZACaiQAIAYLxhEBDH8jAEHwAGsiBSQAQWwhCwJAIANBCkkNACACLwAAIQogAi8AAiEJIAIvAAQhByAFQQhqIAQQDgJAIAMgByAJIApqakEGaiIMSQ0AIAUtAAohCCAFQdgAaiACQQZqIgIgChAGIgsQAw0BIAVBQGsgAiAKaiICIAkQBiILEAMNASAFQShqIAIgCWoiAiAHEAYiCxADDQEgBUEQaiACIAdqIAMgDGsQBiILEAMNASAAIAFqIg9BfWohECAEQQRqIQZBASELIAAgAUEDakECdiIDaiIMIANqIgIgA2oiDiEDIAIhBCAMIQcDQCALIAMgEElxBEAgACAGIAVB2ABqIAgQAkECdGoiCS8BADsAACAFQdgAaiAJLQACEAEgCS0AAyELIAcgBiAFQUBrIAgQAkECdGoiCS8BADsAACAFQUBrIAktAAIQASAJLQADIQogBCAGIAVBKGogCBACQQJ0aiIJLwEAOwAAIAVBKGogCS0AAhABIAktAAMhCSADIAYgBUEQaiAIEAJBAnRqIg0vAQA7AAAgBUEQaiANLQACEAEgDS0AAyENIAAgC2oiCyAGIAVB2ABqIAgQAkECdGoiAC8BADsAACAFQdgAaiAALQACEAEgAC0AAyEAIAcgCmoiCiAGIAVBQGsgCBACQQJ0aiIHLwEAOwAAIAVBQGsgBy0AAhABIActAAMhByAEIAlqIgkgBiAFQShqIAgQAkECdGoiBC8BADsAACAFQShqIAQtAAIQASAELQADIQQgAyANaiIDIAYgBUEQaiAIEAJBAnRqIg0vAQA7AAAgBUEQaiANLQACEAEgACALaiEAIAcgCmohByAEIAlqIQQgAyANLQADaiEDIAVB2ABqEA0gBUFAaxANciAFQShqEA1yIAVBEGoQDXJFIQsMAQsLIAQgDksgByACS3INAEFsIQsgACAMSw0BIAxBfWohCQNAQQAgACAJSSAFQdgAahAEGwRAIAAgBiAFQdgAaiAIEAJBAnRqIgovAQA7AAAgBUHYAGogCi0AAhABIAAgCi0AA2oiACAGIAVB2ABqIAgQAkECdGoiCi8BADsAACAFQdgAaiAKLQACEAEgACAKLQADaiEADAEFIAxBfmohCgNAIAVB2ABqEAQgACAKS3JFBEAgACAGIAVB2ABqIAgQAkECdGoiCS8BADsAACAFQdgAaiAJLQACEAEgACAJLQADaiEADAELCwNAIAAgCk0EQCAAIAYgBUHYAGogCBACQQJ0aiIJLwEAOwAAIAVB2ABqIAktAAIQASAAIAktAANqIQAMAQsLAkAgACAMTw0AIAAgBiAFQdgAaiAIEAIiAEECdGoiDC0AADoAACAMLQADQQFGBEAgBUHYAGogDC0AAhABDAELIAUoAlxBH0sNACAFQdgAaiAGIABBAnRqLQACEAEgBSgCXEEhSQ0AIAVBIDYCXAsgAkF9aiEMA0BBACAHIAxJIAVBQGsQBBsEQCAHIAYgBUFAayAIEAJBAnRqIgAvAQA7AAAgBUFAayAALQACEAEgByAALQADaiIAIAYgBUFAayAIEAJBAnRqIgcvAQA7AAAgBUFAayAHLQACEAEgACAHLQADaiEHDAEFIAJBfmohDANAIAVBQGsQBCAHIAxLckUEQCAHIAYgBUFAayAIEAJBAnRqIgAvAQA7AAAgBUFAayAALQACEAEgByAALQADaiEHDAELCwNAIAcgDE0EQCAHIAYgBUFAayAIEAJBAnRqIgAvAQA7AAAgBUFAayAALQACEAEgByAALQADaiEHDAELCwJAIAcgAk8NACAHIAYgBUFAayAIEAIiAEECdGoiAi0AADoAACACLQADQQFGBEAgBUFAayACLQACEAEMAQsgBSgCREEfSw0AIAVBQGsgBiAAQQJ0ai0AAhABIAUoAkRBIUkNACAFQSA2AkQLIA5BfWohAgNAQQAgBCACSSAFQShqEAQbBEAgBCAGIAVBKGogCBACQQJ0aiIALwEAOwAAIAVBKGogAC0AAhABIAQgAC0AA2oiACAGIAVBKGogCBACQQJ0aiIELwEAOwAAIAVBKGogBC0AAhABIAAgBC0AA2ohBAwBBSAOQX5qIQIDQCAFQShqEAQgBCACS3JFBEAgBCAGIAVBKGogCBACQQJ0aiIALwEAOwAAIAVBKGogAC0AAhABIAQgAC0AA2ohBAwBCwsDQCAEIAJNBEAgBCAGIAVBKGogCBACQQJ0aiIALwEAOwAAIAVBKGogAC0AAhABIAQgAC0AA2ohBAwBCwsCQCAEIA5PDQAgBCAGIAVBKGogCBACIgBBAnRqIgItAAA6AAAgAi0AA0EBRgRAIAVBKGogAi0AAhABDAELIAUoAixBH0sNACAFQShqIAYgAEECdGotAAIQASAFKAIsQSFJDQAgBUEgNgIsCwNAQQAgAyAQSSAFQRBqEAQbBEAgAyAGIAVBEGogCBACQQJ0aiIALwEAOwAAIAVBEGogAC0AAhABIAMgAC0AA2oiACAGIAVBEGogCBACQQJ0aiICLwEAOwAAIAVBEGogAi0AAhABIAAgAi0AA2ohAwwBBSAPQX5qIQIDQCAFQRBqEAQgAyACS3JFBEAgAyAGIAVBEGogCBACQQJ0aiIALwEAOwAAIAVBEGogAC0AAhABIAMgAC0AA2ohAwwBCwsDQCADIAJNBEAgAyAGIAVBEGogCBACQQJ0aiIALwEAOwAAIAVBEGogAC0AAhABIAMgAC0AA2ohAwwBCwsCQCADIA9PDQAgAyAGIAVBEGogCBACIgBBAnRqIgItAAA6AAAgAi0AA0EBRgRAIAVBEGogAi0AAhABDAELIAUoAhRBH0sNACAFQRBqIAYgAEECdGotAAIQASAFKAIUQSFJDQAgBUEgNgIUCyABQWwgBUHYAGoQCiAFQUBrEApxIAVBKGoQCnEgBUEQahAKcRshCwwJCwAACwALAAALAAsAAAsACwAACwALQWwhCwsgBUHwAGokACALC7UEAQ5/IwBBEGsiBiQAIAZBBGogABAOQVQhBQJAIARB3AtJDQAgBi0ABCEHIANB8ARqQQBB7AAQECEIIAdBDEsNACADQdwJaiIJIAggBkEIaiAGQQxqIAEgAhAxIhAQA0UEQCAGKAIMIgQgB0sNASADQdwFaiEPIANBpAVqIREgAEEEaiESIANBqAVqIQEgBCEFA0AgBSICQX9qIQUgCCACQQJ0aigCAEUNAAsgAkEBaiEOQQEhBQNAIAUgDk9FBEAgCCAFQQJ0IgtqKAIAIQwgASALaiAKNgIAIAVBAWohBSAKIAxqIQoMAQsLIAEgCjYCAEEAIQUgBigCCCELA0AgBSALRkUEQCABIAUgCWotAAAiDEECdGoiDSANKAIAIg1BAWo2AgAgDyANQQF0aiINIAw6AAEgDSAFOgAAIAVBAWohBQwBCwtBACEBIANBADYCqAUgBEF/cyAHaiEJQQEhBQNAIAUgDk9FBEAgCCAFQQJ0IgtqKAIAIQwgAyALaiABNgIAIAwgBSAJanQgAWohASAFQQFqIQUMAQsLIAcgBEEBaiIBIAJrIgRrQQFqIQgDQEEBIQUgBCAIT0UEQANAIAUgDk9FBEAgBUECdCIJIAMgBEE0bGpqIAMgCWooAgAgBHY2AgAgBUEBaiEFDAELCyAEQQFqIQQMAQsLIBIgByAPIAogESADIAIgARBkIAZBAToABSAGIAc6AAYgACAGKAIENgIACyAQIQULIAZBEGokACAFC8ENAQt/IwBB8ABrIgUkAEFsIQkCQCADQQpJDQAgAi8AACEKIAIvAAIhDCACLwAEIQYgBUEIaiAEEA4CQCADIAYgCiAMampBBmoiDUkNACAFLQAKIQcgBUHYAGogAkEGaiICIAoQBiIJEAMNASAFQUBrIAIgCmoiAiAMEAYiCRADDQEgBUEoaiACIAxqIgIgBhAGIgkQAw0BIAVBEGogAiAGaiADIA1rEAYiCRADDQEgACABaiIOQX1qIQ8gBEEEaiEGQQEhCSAAIAFBA2pBAnYiAmoiCiACaiIMIAJqIg0hAyAMIQQgCiECA0AgCSADIA9JcQRAIAYgBUHYAGogBxACQQF0aiIILQAAIQsgBUHYAGogCC0AARABIAAgCzoAACAGIAVBQGsgBxACQQF0aiIILQAAIQsgBUFAayAILQABEAEgAiALOgAAIAYgBUEoaiAHEAJBAXRqIggtAAAhCyAFQShqIAgtAAEQASAEIAs6AAAgBiAFQRBqIAcQAkEBdGoiCC0AACELIAVBEGogCC0AARABIAMgCzoAACAGIAVB2ABqIAcQAkEBdGoiCC0AACELIAVB2ABqIAgtAAEQASAAIAs6AAEgBiAFQUBrIAcQAkEBdGoiCC0AACELIAVBQGsgCC0AARABIAIgCzoAASAGIAVBKGogBxACQQF0aiIILQAAIQsgBUEoaiAILQABEAEgBCALOgABIAYgBUEQaiAHEAJBAXRqIggtAAAhCyAFQRBqIAgtAAEQASADIAs6AAEgA0ECaiEDIARBAmohBCACQQJqIQIgAEECaiEAIAkgBUHYAGoQDUVxIAVBQGsQDUVxIAVBKGoQDUVxIAVBEGoQDUVxIQkMAQsLIAQgDUsgAiAMS3INAEFsIQkgACAKSw0BIApBfWohCQNAIAVB2ABqEAQgACAJT3JFBEAgBiAFQdgAaiAHEAJBAXRqIggtAAAhCyAFQdgAaiAILQABEAEgACALOgAAIAYgBUHYAGogBxACQQF0aiIILQAAIQsgBUHYAGogCC0AARABIAAgCzoAASAAQQJqIQAMAQsLA0AgBUHYAGoQBCAAIApPckUEQCAGIAVB2ABqIAcQAkEBdGoiCS0AACEIIAVB2ABqIAktAAEQASAAIAg6AAAgAEEBaiEADAELCwNAIAAgCkkEQCAGIAVB2ABqIAcQAkEBdGoiCS0AACEIIAVB2ABqIAktAAEQASAAIAg6AAAgAEEBaiEADAELCyAMQX1qIQADQCAFQUBrEAQgAiAAT3JFBEAgBiAFQUBrIAcQAkEBdGoiCi0AACEJIAVBQGsgCi0AARABIAIgCToAACAGIAVBQGsgBxACQQF0aiIKLQAAIQkgBUFAayAKLQABEAEgAiAJOgABIAJBAmohAgwBCwsDQCAFQUBrEAQgAiAMT3JFBEAgBiAFQUBrIAcQAkEBdGoiAC0AACEKIAVBQGsgAC0AARABIAIgCjoAACACQQFqIQIMAQsLA0AgAiAMSQRAIAYgBUFAayAHEAJBAXRqIgAtAAAhCiAFQUBrIAAtAAEQASACIAo6AAAgAkEBaiECDAELCyANQX1qIQADQCAFQShqEAQgBCAAT3JFBEAgBiAFQShqIAcQAkEBdGoiAi0AACEKIAVBKGogAi0AARABIAQgCjoAACAGIAVBKGogBxACQQF0aiICLQAAIQogBUEoaiACLQABEAEgBCAKOgABIARBAmohBAwBCwsDQCAFQShqEAQgBCANT3JFBEAgBiAFQShqIAcQAkEBdGoiAC0AACECIAVBKGogAC0AARABIAQgAjoAACAEQQFqIQQMAQsLA0AgBCANSQRAIAYgBUEoaiAHEAJBAXRqIgAtAAAhAiAFQShqIAAtAAEQASAEIAI6AAAgBEEBaiEEDAELCwNAIAVBEGoQBCADIA9PckUEQCAGIAVBEGogBxACQQF0aiIALQAAIQIgBUEQaiAALQABEAEgAyACOgAAIAYgBUEQaiAHEAJBAXRqIgAtAAAhAiAFQRBqIAAtAAEQASADIAI6AAEgA0ECaiEDDAELCwNAIAVBEGoQBCADIA5PckUEQCAGIAVBEGogBxACQQF0aiIALQAAIQIgBUEQaiAALQABEAEgAyACOgAAIANBAWohAwwBCwsDQCADIA5JBEAgBiAFQRBqIAcQAkEBdGoiAC0AACECIAVBEGogAC0AARABIAMgAjoAACADQQFqIQMMAQsLIAFBbCAFQdgAahAKIAVBQGsQCnEgBUEoahAKcSAFQRBqEApxGyEJDAELQWwhCQsgBUHwAGokACAJC8oCAQR/IwBBIGsiBSQAIAUgBBAOIAUtAAIhByAFQQhqIAIgAxAGIgIQA0UEQCAEQQRqIQIgACABaiIDQX1qIQQDQCAFQQhqEAQgACAET3JFBEAgAiAFQQhqIAcQAkEBdGoiBi0AACEIIAVBCGogBi0AARABIAAgCDoAACACIAVBCGogBxACQQF0aiIGLQAAIQggBUEIaiAGLQABEAEgACAIOgABIABBAmohAAwBCwsDQCAFQQhqEAQgACADT3JFBEAgAiAFQQhqIAcQAkEBdGoiBC0AACEGIAVBCGogBC0AARABIAAgBjoAACAAQQFqIQAMAQsLA0AgACADT0UEQCACIAVBCGogBxACQQF0aiIELQAAIQYgBUEIaiAELQABEAEgACAGOgAAIABBAWohAAwBCwsgAUFsIAVBCGoQChshAgsgBUEgaiQAIAILtgMBCX8jAEEQayIGJAAgBkEANgIMIAZBADYCCEFUIQQCQAJAIANBQGsiDCADIAZBCGogBkEMaiABIAIQMSICEAMNACAGQQRqIAAQDiAGKAIMIgcgBi0ABEEBaksNASAAQQRqIQogBkEAOgAFIAYgBzoABiAAIAYoAgQ2AgAgB0EBaiEJQQEhBANAIAQgCUkEQCADIARBAnRqIgEoAgAhACABIAU2AgAgACAEQX9qdCAFaiEFIARBAWohBAwBCwsgB0EBaiEHQQAhBSAGKAIIIQkDQCAFIAlGDQEgAyAFIAxqLQAAIgRBAnRqIgBBASAEdEEBdSILIAAoAgAiAWoiADYCACAHIARrIQhBACEEAkAgC0EDTQRAA0AgBCALRg0CIAogASAEakEBdGoiACAIOgABIAAgBToAACAEQQFqIQQMAAALAAsDQCABIABPDQEgCiABQQF0aiIEIAg6AAEgBCAFOgAAIAQgCDoAAyAEIAU6AAIgBCAIOgAFIAQgBToABCAEIAg6AAcgBCAFOgAGIAFBBGohAQwAAAsACyAFQQFqIQUMAAALAAsgAiEECyAGQRBqJAAgBAutAQECfwJAQYQgKAIAIABHIAAoAgBBAXYiAyABa0F4aiICQXhxQQhHcgR/IAIFIAMQJ0UNASACQQhqC0EQSQ0AIAAgACgCACICQQFxIAAgAWpBD2pBeHEiASAAa0EBdHI2AgAgASAANgIEIAEgASgCAEEBcSAAIAJBAXZqIAFrIgJBAXRyNgIAQYQgIAEgAkH/////B3FqQQRqQYQgKAIAIABGGyABNgIAIAEQJQsLygIBBX8CQAJAAkAgAEEIIABBCEsbZ0EfcyAAaUEBR2oiAUEESSAAIAF2cg0AIAFBAnRB/B5qKAIAIgJFDQADQCACQXhqIgMoAgBBAXZBeGoiBSAATwRAIAIgBUEIIAVBCEsbZ0Efc0ECdEGAH2oiASgCAEYEQCABIAIoAgQ2AgALDAMLIARBHksNASAEQQFqIQQgAigCBCICDQALC0EAIQMgAUEgTw0BA0AgAUECdEGAH2ooAgAiAkUEQCABQR5LIQIgAUEBaiEBIAJFDQEMAwsLIAIgAkF4aiIDKAIAQQF2QXhqIgFBCCABQQhLG2dBH3NBAnRBgB9qIgEoAgBGBEAgASACKAIENgIACwsgAigCACIBBEAgASACKAIENgIECyACKAIEIgEEQCABIAIoAgA2AgALIAMgAygCAEEBcjYCACADIAAQNwsgAwvhCwINfwV+IwBB8ABrIgckACAHIAAoAvDhASIINgJcIAEgAmohDSAIIAAoAoDiAWohDwJAAkAgBUUEQCABIQQMAQsgACgCxOABIRAgACgCwOABIREgACgCvOABIQ4gAEEBNgKM4QFBACEIA0AgCEEDRwRAIAcgCEECdCICaiAAIAJqQazQAWooAgA2AkQgCEEBaiEIDAELC0FsIQwgB0EYaiADIAQQBhADDQEgB0EsaiAHQRhqIAAoAgAQEyAHQTRqIAdBGGogACgCCBATIAdBPGogB0EYaiAAKAIEEBMgDUFgaiESIAEhBEEAIQwDQCAHKAIwIAcoAixBA3RqKQIAIhRCEIinQf8BcSEIIAcoAkAgBygCPEEDdGopAgAiFUIQiKdB/wFxIQsgBygCOCAHKAI0QQN0aikCACIWQiCIpyEJIBVCIIghFyAUQiCIpyECAkAgFkIQiKdB/wFxIgNBAk8EQAJAIAZFIANBGUlyRQRAIAkgB0EYaiADQSAgBygCHGsiCiAKIANLGyIKEAUgAyAKayIDdGohCSAHQRhqEAQaIANFDQEgB0EYaiADEAUgCWohCQwBCyAHQRhqIAMQBSAJaiEJIAdBGGoQBBoLIAcpAkQhGCAHIAk2AkQgByAYNwNIDAELAkAgA0UEQCACBEAgBygCRCEJDAMLIAcoAkghCQwBCwJAAkAgB0EYakEBEAUgCSACRWpqIgNBA0YEQCAHKAJEQX9qIgMgA0VqIQkMAQsgA0ECdCAHaigCRCIJIAlFaiEJIANBAUYNAQsgByAHKAJINgJMCwsgByAHKAJENgJIIAcgCTYCRAsgF6chAyALBEAgB0EYaiALEAUgA2ohAwsgCCALakEUTwRAIAdBGGoQBBoLIAgEQCAHQRhqIAgQBSACaiECCyAHQRhqEAQaIAcgB0EYaiAUQhiIp0H/AXEQCCAUp0H//wNxajYCLCAHIAdBGGogFUIYiKdB/wFxEAggFadB//8DcWo2AjwgB0EYahAEGiAHIAdBGGogFkIYiKdB/wFxEAggFqdB//8DcWo2AjQgByACNgJgIAcoAlwhCiAHIAk2AmggByADNgJkAkACQAJAIAQgAiADaiILaiASSw0AIAIgCmoiEyAPSw0AIA0gBGsgC0Egak8NAQsgByAHKQNoNwMQIAcgBykDYDcDCCAEIA0gB0EIaiAHQdwAaiAPIA4gESAQEB4hCwwBCyACIARqIQggBCAKEAcgAkERTwRAIARBEGohAgNAIAIgCkEQaiIKEAcgAkEQaiICIAhJDQALCyAIIAlrIQIgByATNgJcIAkgCCAOa0sEQCAJIAggEWtLBEBBbCELDAILIBAgAiAOayICaiIKIANqIBBNBEAgCCAKIAMQDxoMAgsgCCAKQQAgAmsQDyEIIAcgAiADaiIDNgJkIAggAmshCCAOIQILIAlBEE8EQCADIAhqIQMDQCAIIAIQByACQRBqIQIgCEEQaiIIIANJDQALDAELAkAgCUEHTQRAIAggAi0AADoAACAIIAItAAE6AAEgCCACLQACOgACIAggAi0AAzoAAyAIQQRqIAIgCUECdCIDQcAeaigCAGoiAhAXIAIgA0HgHmooAgBrIQIgBygCZCEDDAELIAggAhAMCyADQQlJDQAgAyAIaiEDIAhBCGoiCCACQQhqIgJrQQ9MBEADQCAIIAIQDCACQQhqIQIgCEEIaiIIIANJDQAMAgALAAsDQCAIIAIQByACQRBqIQIgCEEQaiIIIANJDQALCyAHQRhqEAQaIAsgDCALEAMiAhshDCAEIAQgC2ogAhshBCAFQX9qIgUNAAsgDBADDQFBbCEMIAdBGGoQBEECSQ0BQQAhCANAIAhBA0cEQCAAIAhBAnQiAmpBrNABaiACIAdqKAJENgIAIAhBAWohCAwBCwsgBygCXCEIC0G6fyEMIA8gCGsiACANIARrSw0AIAQEfyAEIAggABALIABqBUEACyABayEMCyAHQfAAaiQAIAwLkRcCFn8FfiMAQdABayIHJAAgByAAKALw4QEiCDYCvAEgASACaiESIAggACgCgOIBaiETAkACQCAFRQRAIAEhAwwBCyAAKALE4AEhESAAKALA4AEhFSAAKAK84AEhDyAAQQE2AozhAUEAIQgDQCAIQQNHBEAgByAIQQJ0IgJqIAAgAmpBrNABaigCADYCVCAIQQFqIQgMAQsLIAcgETYCZCAHIA82AmAgByABIA9rNgJoQWwhECAHQShqIAMgBBAGEAMNASAFQQQgBUEESBshFyAHQTxqIAdBKGogACgCABATIAdBxABqIAdBKGogACgCCBATIAdBzABqIAdBKGogACgCBBATQQAhBCAHQeAAaiEMIAdB5ABqIQoDQCAHQShqEARBAksgBCAXTnJFBEAgBygCQCAHKAI8QQN0aikCACIdQhCIp0H/AXEhCyAHKAJQIAcoAkxBA3RqKQIAIh5CEIinQf8BcSEJIAcoAkggBygCREEDdGopAgAiH0IgiKchCCAeQiCIISAgHUIgiKchAgJAIB9CEIinQf8BcSIDQQJPBEACQCAGRSADQRlJckUEQCAIIAdBKGogA0EgIAcoAixrIg0gDSADSxsiDRAFIAMgDWsiA3RqIQggB0EoahAEGiADRQ0BIAdBKGogAxAFIAhqIQgMAQsgB0EoaiADEAUgCGohCCAHQShqEAQaCyAHKQJUISEgByAINgJUIAcgITcDWAwBCwJAIANFBEAgAgRAIAcoAlQhCAwDCyAHKAJYIQgMAQsCQAJAIAdBKGpBARAFIAggAkVqaiIDQQNGBEAgBygCVEF/aiIDIANFaiEIDAELIANBAnQgB2ooAlQiCCAIRWohCCADQQFGDQELIAcgBygCWDYCXAsLIAcgBygCVDYCWCAHIAg2AlQLICCnIQMgCQRAIAdBKGogCRAFIANqIQMLIAkgC2pBFE8EQCAHQShqEAQaCyALBEAgB0EoaiALEAUgAmohAgsgB0EoahAEGiAHIAcoAmggAmoiCSADajYCaCAKIAwgCCAJSxsoAgAhDSAHIAdBKGogHUIYiKdB/wFxEAggHadB//8DcWo2AjwgByAHQShqIB5CGIinQf8BcRAIIB6nQf//A3FqNgJMIAdBKGoQBBogB0EoaiAfQhiIp0H/AXEQCCEOIAdB8ABqIARBBHRqIgsgCSANaiAIazYCDCALIAg2AgggCyADNgIEIAsgAjYCACAHIA4gH6dB//8DcWo2AkQgBEEBaiEEDAELCyAEIBdIDQEgEkFgaiEYIAdB4ABqIRogB0HkAGohGyABIQMDQCAHQShqEARBAksgBCAFTnJFBEAgBygCQCAHKAI8QQN0aikCACIdQhCIp0H/AXEhCyAHKAJQIAcoAkxBA3RqKQIAIh5CEIinQf8BcSEIIAcoAkggBygCREEDdGopAgAiH0IgiKchCSAeQiCIISAgHUIgiKchDAJAIB9CEIinQf8BcSICQQJPBEACQCAGRSACQRlJckUEQCAJIAdBKGogAkEgIAcoAixrIgogCiACSxsiChAFIAIgCmsiAnRqIQkgB0EoahAEGiACRQ0BIAdBKGogAhAFIAlqIQkMAQsgB0EoaiACEAUgCWohCSAHQShqEAQaCyAHKQJUISEgByAJNgJUIAcgITcDWAwBCwJAIAJFBEAgDARAIAcoAlQhCQwDCyAHKAJYIQkMAQsCQAJAIAdBKGpBARAFIAkgDEVqaiICQQNGBEAgBygCVEF/aiICIAJFaiEJDAELIAJBAnQgB2ooAlQiCSAJRWohCSACQQFGDQELIAcgBygCWDYCXAsLIAcgBygCVDYCWCAHIAk2AlQLICCnIRQgCARAIAdBKGogCBAFIBRqIRQLIAggC2pBFE8EQCAHQShqEAQaCyALBEAgB0EoaiALEAUgDGohDAsgB0EoahAEGiAHIAcoAmggDGoiGSAUajYCaCAbIBogCSAZSxsoAgAhHCAHIAdBKGogHUIYiKdB/wFxEAggHadB//8DcWo2AjwgByAHQShqIB5CGIinQf8BcRAIIB6nQf//A3FqNgJMIAdBKGoQBBogByAHQShqIB9CGIinQf8BcRAIIB+nQf//A3FqNgJEIAcgB0HwAGogBEEDcUEEdGoiDSkDCCIdNwPIASAHIA0pAwAiHjcDwAECQAJAAkAgBygCvAEiDiAepyICaiIWIBNLDQAgAyAHKALEASIKIAJqIgtqIBhLDQAgEiADayALQSBqTw0BCyAHIAcpA8gBNwMQIAcgBykDwAE3AwggAyASIAdBCGogB0G8AWogEyAPIBUgERAeIQsMAQsgAiADaiEIIAMgDhAHIAJBEU8EQCADQRBqIQIDQCACIA5BEGoiDhAHIAJBEGoiAiAISQ0ACwsgCCAdpyIOayECIAcgFjYCvAEgDiAIIA9rSwRAIA4gCCAVa0sEQEFsIQsMAgsgESACIA9rIgJqIhYgCmogEU0EQCAIIBYgChAPGgwCCyAIIBZBACACaxAPIQggByACIApqIgo2AsQBIAggAmshCCAPIQILIA5BEE8EQCAIIApqIQoDQCAIIAIQByACQRBqIQIgCEEQaiIIIApJDQALDAELAkAgDkEHTQRAIAggAi0AADoAACAIIAItAAE6AAEgCCACLQACOgACIAggAi0AAzoAAyAIQQRqIAIgDkECdCIKQcAeaigCAGoiAhAXIAIgCkHgHmooAgBrIQIgBygCxAEhCgwBCyAIIAIQDAsgCkEJSQ0AIAggCmohCiAIQQhqIgggAkEIaiICa0EPTARAA0AgCCACEAwgAkEIaiECIAhBCGoiCCAKSQ0ADAIACwALA0AgCCACEAcgAkEQaiECIAhBEGoiCCAKSQ0ACwsgCxADBEAgCyEQDAQFIA0gDDYCACANIBkgHGogCWs2AgwgDSAJNgIIIA0gFDYCBCAEQQFqIQQgAyALaiEDDAILAAsLIAQgBUgNASAEIBdrIQtBACEEA0AgCyAFSARAIAcgB0HwAGogC0EDcUEEdGoiAikDCCIdNwPIASAHIAIpAwAiHjcDwAECQAJAAkAgBygCvAEiDCAepyICaiIKIBNLDQAgAyAHKALEASIJIAJqIhBqIBhLDQAgEiADayAQQSBqTw0BCyAHIAcpA8gBNwMgIAcgBykDwAE3AxggAyASIAdBGGogB0G8AWogEyAPIBUgERAeIRAMAQsgAiADaiEIIAMgDBAHIAJBEU8EQCADQRBqIQIDQCACIAxBEGoiDBAHIAJBEGoiAiAISQ0ACwsgCCAdpyIGayECIAcgCjYCvAEgBiAIIA9rSwRAIAYgCCAVa0sEQEFsIRAMAgsgESACIA9rIgJqIgwgCWogEU0EQCAIIAwgCRAPGgwCCyAIIAxBACACaxAPIQggByACIAlqIgk2AsQBIAggAmshCCAPIQILIAZBEE8EQCAIIAlqIQYDQCAIIAIQByACQRBqIQIgCEEQaiIIIAZJDQALDAELAkAgBkEHTQRAIAggAi0AADoAACAIIAItAAE6AAEgCCACLQACOgACIAggAi0AAzoAAyAIQQRqIAIgBkECdCIGQcAeaigCAGoiAhAXIAIgBkHgHmooAgBrIQIgBygCxAEhCQwBCyAIIAIQDAsgCUEJSQ0AIAggCWohBiAIQQhqIgggAkEIaiICa0EPTARAA0AgCCACEAwgAkEIaiECIAhBCGoiCCAGSQ0ADAIACwALA0AgCCACEAcgAkEQaiECIAhBEGoiCCAGSQ0ACwsgEBADDQMgC0EBaiELIAMgEGohAwwBCwsDQCAEQQNHBEAgACAEQQJ0IgJqQazQAWogAiAHaigCVDYCACAEQQFqIQQMAQsLIAcoArwBIQgLQbp/IRAgEyAIayIAIBIgA2tLDQAgAwR/IAMgCCAAEAsgAGoFQQALIAFrIRALIAdB0AFqJAAgEAslACAAQgA3AgAgAEEAOwEIIABBADoACyAAIAE2AgwgACACOgAKC7QFAQN/IwBBMGsiBCQAIABB/wFqIgVBfWohBgJAIAMvAQIEQCAEQRhqIAEgAhAGIgIQAw0BIARBEGogBEEYaiADEBwgBEEIaiAEQRhqIAMQHCAAIQMDQAJAIARBGGoQBCADIAZPckUEQCADIARBEGogBEEYahASOgAAIAMgBEEIaiAEQRhqEBI6AAEgBEEYahAERQ0BIANBAmohAwsgBUF+aiEFAn8DQEG6fyECIAMiASAFSw0FIAEgBEEQaiAEQRhqEBI6AAAgAUEBaiEDIARBGGoQBEEDRgRAQQIhAiAEQQhqDAILIAMgBUsNBSABIARBCGogBEEYahASOgABIAFBAmohA0EDIQIgBEEYahAEQQNHDQALIARBEGoLIQUgAyAFIARBGGoQEjoAACABIAJqIABrIQIMAwsgAyAEQRBqIARBGGoQEjoAAiADIARBCGogBEEYahASOgADIANBBGohAwwAAAsACyAEQRhqIAEgAhAGIgIQAw0AIARBEGogBEEYaiADEBwgBEEIaiAEQRhqIAMQHCAAIQMDQAJAIARBGGoQBCADIAZPckUEQCADIARBEGogBEEYahAROgAAIAMgBEEIaiAEQRhqEBE6AAEgBEEYahAERQ0BIANBAmohAwsgBUF+aiEFAn8DQEG6fyECIAMiASAFSw0EIAEgBEEQaiAEQRhqEBE6AAAgAUEBaiEDIARBGGoQBEEDRgRAQQIhAiAEQQhqDAILIAMgBUsNBCABIARBCGogBEEYahAROgABIAFBAmohA0EDIQIgBEEYahAEQQNHDQALIARBEGoLIQUgAyAFIARBGGoQEToAACABIAJqIABrIQIMAgsgAyAEQRBqIARBGGoQEToAAiADIARBCGogBEEYahAROgADIANBBGohAwwAAAsACyAEQTBqJAAgAgtpAQF/An8CQAJAIAJBB00NACABKAAAQbfIwuF+Rw0AIAAgASgABDYCmOIBQWIgAEEQaiABIAIQPiIDEAMNAhogAEKBgICAEDcDiOEBIAAgASADaiACIANrECoMAQsgACABIAIQKgtBAAsLrQMBBn8jAEGAAWsiAyQAQWIhCAJAIAJBCUkNACAAQZjQAGogAUEIaiIEIAJBeGogAEGY0AAQMyIFEAMiBg0AIANBHzYCfCADIANB/ABqIANB+ABqIAQgBCAFaiAGGyIEIAEgAmoiAiAEaxAVIgUQAw0AIAMoAnwiBkEfSw0AIAMoAngiB0EJTw0AIABBiCBqIAMgBkGAC0GADCAHEBggA0E0NgJ8IAMgA0H8AGogA0H4AGogBCAFaiIEIAIgBGsQFSIFEAMNACADKAJ8IgZBNEsNACADKAJ4IgdBCk8NACAAQZAwaiADIAZBgA1B4A4gBxAYIANBIzYCfCADIANB/ABqIANB+ABqIAQgBWoiBCACIARrEBUiBRADDQAgAygCfCIGQSNLDQAgAygCeCIHQQpPDQAgACADIAZBwBBB0BEgBxAYIAQgBWoiBEEMaiIFIAJLDQAgAiAFayEFQQAhAgNAIAJBA0cEQCAEKAAAIgZBf2ogBU8NAiAAIAJBAnRqQZzQAWogBjYCACACQQFqIQIgBEEEaiEEDAELCyAEIAFrIQgLIANBgAFqJAAgCAtGAQN/IABBCGohAyAAKAIEIQJBACEAA0AgACACdkUEQCABIAMgAEEDdGotAAJBFktqIQEgAEEBaiEADAELCyABQQggAmt0C4YDAQV/Qbh/IQcCQCADRQ0AIAItAAAiBEUEQCABQQA2AgBBAUG4fyADQQFGGw8LAn8gAkEBaiIFIARBGHRBGHUiBkF/Sg0AGiAGQX9GBEAgA0EDSA0CIAUvAABBgP4BaiEEIAJBA2oMAQsgA0ECSA0BIAItAAEgBEEIdHJBgIB+aiEEIAJBAmoLIQUgASAENgIAIAVBAWoiASACIANqIgNLDQBBbCEHIABBEGogACAFLQAAIgVBBnZBI0EJIAEgAyABa0HAEEHQEUHwEiAAKAKM4QEgACgCnOIBIAQQHyIGEAMiCA0AIABBmCBqIABBCGogBUEEdkEDcUEfQQggASABIAZqIAgbIgEgAyABa0GAC0GADEGAFyAAKAKM4QEgACgCnOIBIAQQHyIGEAMiCA0AIABBoDBqIABBBGogBUECdkEDcUE0QQkgASABIAZqIAgbIgEgAyABa0GADUHgDkGQGSAAKAKM4QEgACgCnOIBIAQQHyIAEAMNACAAIAFqIAJrIQcLIAcLrQMBCn8jAEGABGsiCCQAAn9BUiACQf8BSw0AGkFUIANBDEsNABogAkEBaiELIABBBGohCUGAgAQgA0F/anRBEHUhCkEAIQJBASEEQQEgA3QiB0F/aiIMIQUDQCACIAtGRQRAAkAgASACQQF0Ig1qLwEAIgZB//8DRgRAIAkgBUECdGogAjoAAiAFQX9qIQVBASEGDAELIARBACAKIAZBEHRBEHVKGyEECyAIIA1qIAY7AQAgAkEBaiECDAELCyAAIAQ7AQIgACADOwEAIAdBA3YgB0EBdmpBA2ohBkEAIQRBACECA0AgBCALRkUEQCABIARBAXRqLgEAIQpBACEAA0AgACAKTkUEQCAJIAJBAnRqIAQ6AAIDQCACIAZqIAxxIgIgBUsNAAsgAEEBaiEADAELCyAEQQFqIQQMAQsLQX8gAg0AGkEAIQIDfyACIAdGBH9BAAUgCCAJIAJBAnRqIgAtAAJBAXRqIgEgAS8BACIBQQFqOwEAIAAgAyABEBRrIgU6AAMgACABIAVB/wFxdCAHazsBACACQQFqIQIMAQsLCyEFIAhBgARqJAAgBQvjBgEIf0FsIQcCQCACQQNJDQACQAJAAkACQCABLQAAIgNBA3EiCUEBaw4DAwEAAgsgACgCiOEBDQBBYg8LIAJBBUkNAkEDIQYgASgAACEFAn8CQAJAIANBAnZBA3EiCEF+aiIEQQFNBEAgBEEBaw0BDAILIAVBDnZB/wdxIQQgBUEEdkH/B3EhAyAIRQwCCyAFQRJ2IQRBBCEGIAVBBHZB//8AcSEDQQAMAQsgBUEEdkH//w9xIgNBgIAISw0DIAEtAARBCnQgBUEWdnIhBEEFIQZBAAshBSAEIAZqIgogAksNAgJAIANBgQZJDQAgACgCnOIBRQ0AQQAhAgNAIAJBg4ABSw0BIAJBQGshAgwAAAsACwJ/IAlBA0YEQCABIAZqIQEgAEHw4gFqIQIgACgCDCEGIAUEQCACIAMgASAEIAYQXwwCCyACIAMgASAEIAYQXQwBCyAAQbjQAWohAiABIAZqIQEgAEHw4gFqIQYgAEGo0ABqIQggBQRAIAggBiADIAEgBCACEF4MAQsgCCAGIAMgASAEIAIQXAsQAw0CIAAgAzYCgOIBIABBATYCiOEBIAAgAEHw4gFqNgLw4QEgCUECRgRAIAAgAEGo0ABqNgIMCyAAIANqIgBBiOMBakIANwAAIABBgOMBakIANwAAIABB+OIBakIANwAAIABB8OIBakIANwAAIAoPCwJ/AkACQAJAIANBAnZBA3FBf2oiBEECSw0AIARBAWsOAgACAQtBASEEIANBA3YMAgtBAiEEIAEvAABBBHYMAQtBAyEEIAEQIUEEdgsiAyAEaiIFQSBqIAJLBEAgBSACSw0CIABB8OIBaiABIARqIAMQCyEBIAAgAzYCgOIBIAAgATYC8OEBIAEgA2oiAEIANwAYIABCADcAECAAQgA3AAggAEIANwAAIAUPCyAAIAM2AoDiASAAIAEgBGo2AvDhASAFDwsCfwJAAkACQCADQQJ2QQNxQX9qIgRBAksNACAEQQFrDgIAAgELQQEhByADQQN2DAILQQIhByABLwAAQQR2DAELIAJBBEkgARAhIgJBj4CAAUtyDQFBAyEHIAJBBHYLIQIgAEHw4gFqIAEgB2otAAAgAkEgahAQIQEgACACNgKA4gEgACABNgLw4QEgB0EBaiEHCyAHC0sAIABC+erQ0OfJoeThADcDICAAQgA3AxggAELP1tO+0ser2UI3AxAgAELW64Lu6v2J9eAANwMIIABCADcDACAAQShqQQBBKBAQGgviAgICfwV+IABBKGoiASAAKAJIaiECAn4gACkDACIDQiBaBEAgACkDECIEQgeJIAApAwgiBUIBiXwgACkDGCIGQgyJfCAAKQMgIgdCEol8IAUQGSAEEBkgBhAZIAcQGQwBCyAAKQMYQsXP2bLx5brqJ3wLIAN8IQMDQCABQQhqIgAgAk0EQEIAIAEpAAAQCSADhUIbiUKHla+vmLbem55/fkLj3MqV/M7y9YV/fCEDIAAhAQwBCwsCQCABQQRqIgAgAksEQCABIQAMAQsgASgAAK1Ch5Wvr5i23puef34gA4VCF4lCz9bTvtLHq9lCfkL5893xmfaZqxZ8IQMLA0AgACACSQRAIAAxAABCxc/ZsvHluuonfiADhUILiUKHla+vmLbem55/fiEDIABBAWohAAwBCwsgA0IhiCADhULP1tO+0ser2UJ+IgNCHYggA4VC+fPd8Zn2masWfiIDQiCIIAOFC+8CAgJ/BH4gACAAKQMAIAKtfDcDAAJAAkAgACgCSCIDIAJqIgRBH00EQCABRQ0BIAAgA2pBKGogASACECAgACgCSCACaiEEDAELIAEgAmohAgJ/IAMEQCAAQShqIgQgA2ogAUEgIANrECAgACAAKQMIIAQpAAAQCTcDCCAAIAApAxAgACkAMBAJNwMQIAAgACkDGCAAKQA4EAk3AxggACAAKQMgIABBQGspAAAQCTcDICAAKAJIIQMgAEEANgJIIAEgA2tBIGohAQsgAUEgaiACTQsEQCACQWBqIQMgACkDICEFIAApAxghBiAAKQMQIQcgACkDCCEIA0AgCCABKQAAEAkhCCAHIAEpAAgQCSEHIAYgASkAEBAJIQYgBSABKQAYEAkhBSABQSBqIgEgA00NAAsgACAFNwMgIAAgBjcDGCAAIAc3AxAgACAINwMICyABIAJPDQEgAEEoaiABIAIgAWsiBBAgCyAAIAQ2AkgLCy8BAX8gAEUEQEG2f0EAIAMbDwtBun8hBCADIAFNBH8gACACIAMQEBogAwVBun8LCy8BAX8gAEUEQEG2f0EAIAMbDwtBun8hBCADIAFNBH8gACACIAMQCxogAwVBun8LC6gCAQZ/IwBBEGsiByQAIABB2OABaikDAEKAgIAQViEIQbh/IQUCQCAEQf//B0sNACAAIAMgBBBCIgUQAyIGDQAgACgCnOIBIQkgACAHQQxqIAMgAyAFaiAGGyIKIARBACAFIAYbayIGEEAiAxADBEAgAyEFDAELIAcoAgwhBCABRQRAQbp/IQUgBEEASg0BCyAGIANrIQUgAyAKaiEDAkAgCQRAIABBADYCnOIBDAELAkACQAJAIARBBUgNACAAQdjgAWopAwBCgICACFgNAAwBCyAAQQA2ApziAQwBCyAAKAIIED8hBiAAQQA2ApziASAGQRRPDQELIAAgASACIAMgBSAEIAgQOSEFDAELIAAgASACIAMgBSAEIAgQOiEFCyAHQRBqJAAgBQtnACAAQdDgAWogASACIAAoAuzhARAuIgEQAwRAIAEPC0G4fyECAkAgAQ0AIABB7OABaigCACIBBEBBYCECIAAoApjiASABRw0BC0EAIQIgAEHw4AFqKAIARQ0AIABBkOEBahBDCyACCycBAX8QVyIERQRAQUAPCyAEIAAgASACIAMgBBBLEE8hACAEEFYgAAs/AQF/AkACQAJAIAAoAqDiAUEBaiIBQQJLDQAgAUEBaw4CAAECCyAAEDBBAA8LIABBADYCoOIBCyAAKAKU4gELvAMCB38BfiMAQRBrIgkkAEG4fyEGAkAgBCgCACIIQQVBCSAAKALs4QEiBRtJDQAgAygCACIHQQFBBSAFGyAFEC8iBRADBEAgBSEGDAELIAggBUEDakkNACAAIAcgBRBJIgYQAw0AIAEgAmohCiAAQZDhAWohCyAIIAVrIQIgBSAHaiEHIAEhBQNAIAcgAiAJECwiBhADDQEgAkF9aiICIAZJBEBBuH8hBgwCCyAJKAIAIghBAksEQEFsIQYMAgsgB0EDaiEHAn8CQAJAAkAgCEEBaw4CAgABCyAAIAUgCiAFayAHIAYQSAwCCyAFIAogBWsgByAGEEcMAQsgBSAKIAVrIActAAAgCSgCCBBGCyIIEAMEQCAIIQYMAgsgACgC8OABBEAgCyAFIAgQRQsgAiAGayECIAYgB2ohByAFIAhqIQUgCSgCBEUNAAsgACkD0OABIgxCf1IEQEFsIQYgDCAFIAFrrFINAQsgACgC8OABBEBBaiEGIAJBBEkNASALEEQhDCAHKAAAIAynRw0BIAdBBGohByACQXxqIQILIAMgBzYCACAEIAI2AgAgBSABayEGCyAJQRBqJAAgBgsuACAAECsCf0EAQQAQAw0AGiABRSACRXJFBEBBYiAAIAEgAhA9EAMNARoLQQALCzcAIAEEQCAAIAAoAsTgASABKAIEIAEoAghqRzYCnOIBCyAAECtBABADIAFFckUEQCAAIAEQWwsL0QIBB38jAEEQayIGJAAgBiAENgIIIAYgAzYCDCAFBEAgBSgCBCEKIAUoAgghCQsgASEIAkACQANAIAAoAuzhARAWIQsCQANAIAQgC0kNASADKAAAQXBxQdDUtMIBRgRAIAMgBBAiIgcQAw0EIAQgB2shBCADIAdqIQMMAQsLIAYgAzYCDCAGIAQ2AggCQCAFBEAgACAFEE5BACEHQQAQA0UNAQwFCyAAIAogCRBNIgcQAw0ECyAAIAgQUCAMQQFHQQAgACAIIAIgBkEMaiAGQQhqEEwiByIDa0EAIAMQAxtBCkdyRQRAQbh/IQcMBAsgBxADDQMgAiAHayECIAcgCGohCEEBIQwgBigCDCEDIAYoAgghBAwBCwsgBiADNgIMIAYgBDYCCEG4fyEHIAQNASAIIAFrIQcMAQsgBiADNgIMIAYgBDYCCAsgBkEQaiQAIAcLRgECfyABIAAoArjgASICRwRAIAAgAjYCxOABIAAgATYCuOABIAAoArzgASEDIAAgATYCvOABIAAgASADIAJrajYCwOABCwutAgIEfwF+IwBBQGoiBCQAAkACQCACQQhJDQAgASgAAEFwcUHQ1LTCAUcNACABIAIQIiEBIABCADcDCCAAQQA2AgQgACABNgIADAELIARBGGogASACEC0iAxADBEAgACADEBoMAQsgAwRAIABBuH8QGgwBCyACIAQoAjAiA2shAiABIANqIQMDQAJAIAAgAyACIARBCGoQLCIFEAMEfyAFBSACIAVBA2oiBU8NAUG4fwsQGgwCCyAGQQFqIQYgAiAFayECIAMgBWohAyAEKAIMRQ0ACyAEKAI4BEAgAkEDTQRAIABBuH8QGgwCCyADQQRqIQMLIAQoAighAiAEKQMYIQcgAEEANgIEIAAgAyABazYCACAAIAIgBmytIAcgB0J/URs3AwgLIARBQGskAAslAQF/IwBBEGsiAiQAIAIgACABEFEgAigCACEAIAJBEGokACAAC30BBH8jAEGQBGsiBCQAIARB/wE2AggCQCAEQRBqIARBCGogBEEMaiABIAIQFSIGEAMEQCAGIQUMAQtBVCEFIAQoAgwiB0EGSw0AIAMgBEEQaiAEKAIIIAcQQSIFEAMNACAAIAEgBmogAiAGayADEDwhBQsgBEGQBGokACAFC4cBAgJ/An5BABAWIQMCQANAIAEgA08EQAJAIAAoAABBcHFB0NS0wgFGBEAgACABECIiAhADRQ0BQn4PCyAAIAEQVSIEQn1WDQMgBCAFfCIFIARUIQJCfiEEIAINAyAAIAEQUiICEAMNAwsgASACayEBIAAgAmohAAwBCwtCfiAFIAEbIQQLIAQLPwIBfwF+IwBBMGsiAiQAAn5CfiACQQhqIAAgARAtDQAaQgAgAigCHEEBRg0AGiACKQMICyEDIAJBMGokACADC40BAQJ/IwBBMGsiASQAAkAgAEUNACAAKAKI4gENACABIABB/OEBaigCADYCKCABIAApAvThATcDICAAEDAgACgCqOIBIQIgASABKAIoNgIYIAEgASkDIDcDECACIAFBEGoQGyAAQQA2AqjiASABIAEoAig2AgggASABKQMgNwMAIAAgARAbCyABQTBqJAALKgECfyMAQRBrIgAkACAAQQA2AgggAEIANwMAIAAQWCEBIABBEGokACABC4cBAQN/IwBBEGsiAiQAAkAgACgCAEUgACgCBEVzDQAgAiAAKAIINgIIIAIgACkCADcDAAJ/IAIoAgAiAQRAIAIoAghBqOMJIAERBQAMAQtBqOMJECgLIgFFDQAgASAAKQIANwL04QEgAUH84QFqIAAoAgg2AgAgARBZIAEhAwsgAkEQaiQAIAMLywEBAn8jAEEgayIBJAAgAEGBgIDAADYCtOIBIABBADYCiOIBIABBADYC7OEBIABCADcDkOIBIABBADYCpOMJIABBADYC3OIBIABCADcCzOIBIABBADYCvOIBIABBADYCxOABIABCADcCnOIBIABBpOIBakIANwIAIABBrOIBakEANgIAIAFCADcCECABQgA3AhggASABKQMYNwMIIAEgASkDEDcDACABKAIIQQh2QQFxIQIgAEEANgLg4gEgACACNgKM4gEgAUEgaiQAC3YBA38jAEEwayIBJAAgAARAIAEgAEHE0AFqIgIoAgA2AiggASAAKQK80AE3AyAgACgCACEDIAEgAigCADYCGCABIAApArzQATcDECADIAFBEGoQGyABIAEoAig2AgggASABKQMgNwMAIAAgARAbCyABQTBqJAALzAEBAX8gACABKAK00AE2ApjiASAAIAEoAgQiAjYCwOABIAAgAjYCvOABIAAgAiABKAIIaiICNgK44AEgACACNgLE4AEgASgCuNABBEAgAEKBgICAEDcDiOEBIAAgAUGk0ABqNgIMIAAgAUGUIGo2AgggACABQZwwajYCBCAAIAFBDGo2AgAgAEGs0AFqIAFBqNABaigCADYCACAAQbDQAWogAUGs0AFqKAIANgIAIABBtNABaiABQbDQAWooAgA2AgAPCyAAQgA3A4jhAQs7ACACRQRAQbp/DwsgBEUEQEFsDwsgAiAEEGAEQCAAIAEgAiADIAQgBRBhDwsgACABIAIgAyAEIAUQZQtGAQF/IwBBEGsiBSQAIAVBCGogBBAOAn8gBS0ACQRAIAAgASACIAMgBBAyDAELIAAgASACIAMgBBA0CyEAIAVBEGokACAACzQAIAAgAyAEIAUQNiIFEAMEQCAFDwsgBSAESQR/IAEgAiADIAVqIAQgBWsgABA1BUG4fwsLRgEBfyMAQRBrIgUkACAFQQhqIAQQDgJ/IAUtAAkEQCAAIAEgAiADIAQQYgwBCyAAIAEgAiADIAQQNQshACAFQRBqJAAgAAtZAQF/QQ8hAiABIABJBEAgAUEEdCAAbiECCyAAQQh2IgEgAkEYbCIAQYwIaigCAGwgAEGICGooAgBqIgJBA3YgAmogAEGACGooAgAgAEGECGooAgAgAWxqSQs3ACAAIAMgBCAFQYAQEDMiBRADBEAgBQ8LIAUgBEkEfyABIAIgAyAFaiAEIAVrIAAQMgVBuH8LC78DAQN/IwBBIGsiBSQAIAVBCGogAiADEAYiAhADRQRAIAAgAWoiB0F9aiEGIAUgBBAOIARBBGohAiAFLQACIQMDQEEAIAAgBkkgBUEIahAEGwRAIAAgAiAFQQhqIAMQAkECdGoiBC8BADsAACAFQQhqIAQtAAIQASAAIAQtAANqIgQgAiAFQQhqIAMQAkECdGoiAC8BADsAACAFQQhqIAAtAAIQASAEIAAtAANqIQAMAQUgB0F+aiEEA0AgBUEIahAEIAAgBEtyRQRAIAAgAiAFQQhqIAMQAkECdGoiBi8BADsAACAFQQhqIAYtAAIQASAAIAYtAANqIQAMAQsLA0AgACAES0UEQCAAIAIgBUEIaiADEAJBAnRqIgYvAQA7AAAgBUEIaiAGLQACEAEgACAGLQADaiEADAELCwJAIAAgB08NACAAIAIgBUEIaiADEAIiA0ECdGoiAC0AADoAACAALQADQQFGBEAgBUEIaiAALQACEAEMAQsgBSgCDEEfSw0AIAVBCGogAiADQQJ0ai0AAhABIAUoAgxBIUkNACAFQSA2AgwLIAFBbCAFQQhqEAobIQILCwsgBUEgaiQAIAILkgIBBH8jAEFAaiIJJAAgCSADQTQQCyEDAkAgBEECSA0AIAMgBEECdGooAgAhCSADQTxqIAgQIyADQQE6AD8gAyACOgA+QQAhBCADKAI8IQoDQCAEIAlGDQEgACAEQQJ0aiAKNgEAIARBAWohBAwAAAsAC0EAIQkDQCAGIAlGRQRAIAMgBSAJQQF0aiIKLQABIgtBAnRqIgwoAgAhBCADQTxqIAotAABBCHQgCGpB//8DcRAjIANBAjoAPyADIAcgC2siCiACajoAPiAEQQEgASAKa3RqIQogAygCPCELA0AgACAEQQJ0aiALNgEAIARBAWoiBCAKSQ0ACyAMIAo2AgAgCUEBaiEJDAELCyADQUBrJAALowIBCX8jAEHQAGsiCSQAIAlBEGogBUE0EAsaIAcgBmshDyAHIAFrIRADQAJAIAMgCkcEQEEBIAEgByACIApBAXRqIgYtAAEiDGsiCGsiC3QhDSAGLQAAIQ4gCUEQaiAMQQJ0aiIMKAIAIQYgCyAPTwRAIAAgBkECdGogCyAIIAUgCEE0bGogCCAQaiIIQQEgCEEBShsiCCACIAQgCEECdGooAgAiCEEBdGogAyAIayAHIA4QYyAGIA1qIQgMAgsgCUEMaiAOECMgCUEBOgAPIAkgCDoADiAGIA1qIQggCSgCDCELA0AgBiAITw0CIAAgBkECdGogCzYBACAGQQFqIQYMAAALAAsgCUHQAGokAA8LIAwgCDYCACAKQQFqIQoMAAALAAs0ACAAIAMgBCAFEDYiBRADBEAgBQ8LIAUgBEkEfyABIAIgAyAFaiAEIAVrIAAQNAVBuH8LCyMAIAA/AEEQdGtB//8DakEQdkAAQX9GBEBBAA8LQQAQAEEBCzsBAX8gAgRAA0AgACABIAJBgCAgAkGAIEkbIgMQCyEAIAFBgCBqIQEgAEGAIGohACACIANrIgINAAsLCwYAIAAQAwsLqBUJAEGICAsNAQAAAAEAAAACAAAAAgBBoAgLswYBAAAAAQAAAAIAAAACAAAAJgAAAIIAAAAhBQAASgAAAGcIAAAmAAAAwAEAAIAAAABJBQAASgAAAL4IAAApAAAALAIAAIAAAABJBQAASgAAAL4IAAAvAAAAygIAAIAAAACKBQAASgAAAIQJAAA1AAAAcwMAAIAAAACdBQAASgAAAKAJAAA9AAAAgQMAAIAAAADrBQAASwAAAD4KAABEAAAAngMAAIAAAABNBgAASwAAAKoKAABLAAAAswMAAIAAAADBBgAATQAAAB8NAABNAAAAUwQAAIAAAAAjCAAAUQAAAKYPAABUAAAAmQQAAIAAAABLCQAAVwAAALESAABYAAAA2gQAAIAAAABvCQAAXQAAACMUAABUAAAARQUAAIAAAABUCgAAagAAAIwUAABqAAAArwUAAIAAAAB2CQAAfAAAAE4QAAB8AAAA0gIAAIAAAABjBwAAkQAAAJAHAACSAAAAAAAAAAEAAAABAAAABQAAAA0AAAAdAAAAPQAAAH0AAAD9AAAA/QEAAP0DAAD9BwAA/Q8AAP0fAAD9PwAA/X8AAP3/AAD9/wEA/f8DAP3/BwD9/w8A/f8fAP3/PwD9/38A/f//AP3//wH9//8D/f//B/3//w/9//8f/f//P/3//38AAAAAAQAAAAIAAAADAAAABAAAAAUAAAAGAAAABwAAAAgAAAAJAAAACgAAAAsAAAAMAAAADQAAAA4AAAAPAAAAEAAAABEAAAASAAAAEwAAABQAAAAVAAAAFgAAABcAAAAYAAAAGQAAABoAAAAbAAAAHAAAAB0AAAAeAAAAHwAAAAMAAAAEAAAABQAAAAYAAAAHAAAACAAAAAkAAAAKAAAACwAAAAwAAAANAAAADgAAAA8AAAAQAAAAEQAAABIAAAATAAAAFAAAABUAAAAWAAAAFwAAABgAAAAZAAAAGgAAABsAAAAcAAAAHQAAAB4AAAAfAAAAIAAAACEAAAAiAAAAIwAAACUAAAAnAAAAKQAAACsAAAAvAAAAMwAAADsAAABDAAAAUwAAAGMAAACDAAAAAwEAAAMCAAADBAAAAwgAAAMQAAADIAAAA0AAAAOAAAADAAEAQeAPC1EBAAAAAQAAAAEAAAABAAAAAgAAAAIAAAADAAAAAwAAAAQAAAAEAAAABQAAAAcAAAAIAAAACQAAAAoAAAALAAAADAAAAA0AAAAOAAAADwAAABAAQcQQC4sBAQAAAAIAAAADAAAABAAAAAUAAAAGAAAABwAAAAgAAAAJAAAACgAAAAsAAAAMAAAADQAAAA4AAAAPAAAAEAAAABIAAAAUAAAAFgAAABgAAAAcAAAAIAAAACgAAAAwAAAAQAAAAIAAAAAAAQAAAAIAAAAEAAAACAAAABAAAAAgAAAAQAAAAIAAAAAAAQBBkBIL5gQBAAAAAQAAAAEAAAABAAAAAgAAAAIAAAADAAAAAwAAAAQAAAAGAAAABwAAAAgAAAAJAAAACgAAAAsAAAAMAAAADQAAAA4AAAAPAAAAEAAAAAEAAAAEAAAACAAAAAAAAAABAAEBBgAAAAAAAAQAAAAAEAAABAAAAAAgAAAFAQAAAAAAAAUDAAAAAAAABQQAAAAAAAAFBgAAAAAAAAUHAAAAAAAABQkAAAAAAAAFCgAAAAAAAAUMAAAAAAAABg4AAAAAAAEFEAAAAAAAAQUUAAAAAAABBRYAAAAAAAIFHAAAAAAAAwUgAAAAAAAEBTAAAAAgAAYFQAAAAAAABwWAAAAAAAAIBgABAAAAAAoGAAQAAAAADAYAEAAAIAAABAAAAAAAAAAEAQAAAAAAAAUCAAAAIAAABQQAAAAAAAAFBQAAACAAAAUHAAAAAAAABQgAAAAgAAAFCgAAAAAAAAULAAAAAAAABg0AAAAgAAEFEAAAAAAAAQUSAAAAIAABBRYAAAAAAAIFGAAAACAAAwUgAAAAAAADBSgAAAAAAAYEQAAAABAABgRAAAAAIAAHBYAAAAAAAAkGAAIAAAAACwYACAAAMAAABAAAAAAQAAAEAQAAACAAAAUCAAAAIAAABQMAAAAgAAAFBQAAACAAAAUGAAAAIAAABQgAAAAgAAAFCQAAACAAAAULAAAAIAAABQwAAAAAAAAGDwAAACAAAQUSAAAAIAABBRQAAAAgAAIFGAAAACAAAgUcAAAAIAADBSgAAAAgAAQFMAAAAAAAEAYAAAEAAAAPBgCAAAAAAA4GAEAAAAAADQYAIABBgBcLhwIBAAEBBQAAAAAAAAUAAAAAAAAGBD0AAAAAAAkF/QEAAAAADwX9fwAAAAAVBf3/HwAAAAMFBQAAAAAABwR9AAAAAAAMBf0PAAAAABIF/f8DAAAAFwX9/38AAAAFBR0AAAAAAAgE/QAAAAAADgX9PwAAAAAUBf3/DwAAAAIFAQAAABAABwR9AAAAAAALBf0HAAAAABEF/f8BAAAAFgX9/z8AAAAEBQ0AAAAQAAgE/QAAAAAADQX9HwAAAAATBf3/BwAAAAEFAQAAABAABgQ9AAAAAAAKBf0DAAAAABAF/f8AAAAAHAX9//8PAAAbBf3//wcAABoF/f//AwAAGQX9//8BAAAYBf3//wBBkBkLhgQBAAEBBgAAAAAAAAYDAAAAAAAABAQAAAAgAAAFBQAAAAAAAAUGAAAAAAAABQgAAAAAAAAFCQAAAAAAAAULAAAAAAAABg0AAAAAAAAGEAAAAAAAAAYTAAAAAAAABhYAAAAAAAAGGQAAAAAAAAYcAAAAAAAABh8AAAAAAAAGIgAAAAAAAQYlAAAAAAABBikAAAAAAAIGLwAAAAAAAwY7AAAAAAAEBlMAAAAAAAcGgwAAAAAACQYDAgAAEAAABAQAAAAAAAAEBQAAACAAAAUGAAAAAAAABQcAAAAgAAAFCQAAAAAAAAUKAAAAAAAABgwAAAAAAAAGDwAAAAAAAAYSAAAAAAAABhUAAAAAAAAGGAAAAAAAAAYbAAAAAAAABh4AAAAAAAAGIQAAAAAAAQYjAAAAAAABBicAAAAAAAIGKwAAAAAAAwYzAAAAAAAEBkMAAAAAAAUGYwAAAAAACAYDAQAAIAAABAQAAAAwAAAEBAAAABAAAAQFAAAAIAAABQcAAAAgAAAFCAAAACAAAAUKAAAAIAAABQsAAAAAAAAGDgAAAAAAAAYRAAAAAAAABhQAAAAAAAAGFwAAAAAAAAYaAAAAAAAABh0AAAAAAAAGIAAAAAAAEAYDAAEAAAAPBgOAAAAAAA4GA0AAAAAADQYDIAAAAAAMBgMQAAAAAAsGAwgAAAAACgYDBABBpB0L2QEBAAAAAwAAAAcAAAAPAAAAHwAAAD8AAAB/AAAA/wAAAP8BAAD/AwAA/wcAAP8PAAD/HwAA/z8AAP9/AAD//wAA//8BAP//AwD//wcA//8PAP//HwD//z8A//9/AP///wD///8B////A////wf///8P////H////z////9/AAAAAAEAAAACAAAABAAAAAAAAAACAAAABAAAAAgAAAAAAAAAAQAAAAIAAAABAAAABAAAAAQAAAAEAAAABAAAAAgAAAAIAAAACAAAAAcAAAAIAAAACQAAAAoAAAALAEGgIAsDwBBQ";function zh(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}var Uh,Nh=new WeakMap,Gh=0,jh=function(t){f(i,t);var n=zh(i);function i(e){var t;return o(this,i),(t=n.call(this,e)).transcoderPath="",t.transcoderBinary=null,t.transcoderPending=null,t.workerPool=new Sh,t.workerSourceURL="",t.workerConfig=null,"undefined"!=typeof MSC_TRANSCODER&&console.warn('THREE.KTX2Loader: Please update to latest "basis_transcoder". "msc_basis_transcoder" is no longer supported in three.js r125+.'),t}return u(i,[{key:"setTranscoderPath",value:function(e){return this.transcoderPath=e,this}},{key:"setWorkerLimit",value:function(e){return this.workerPool.setWorkerLimit(e),this}},{key:"detectSupport",value:function(e){return this.workerConfig={astcSupported:e.extensions.has("WEBGL_compressed_texture_astc"),etc1Supported:e.extensions.has("WEBGL_compressed_texture_etc1"),etc2Supported:e.extensions.has("WEBGL_compressed_texture_etc"),dxtSupported:e.extensions.has("WEBGL_compressed_texture_s3tc"),bptcSupported:e.extensions.has("EXT_texture_compression_bptc"),pvrtcSupported:e.extensions.has("WEBGL_compressed_texture_pvrtc")||e.extensions.has("WEBKIT_WEBGL_compressed_texture_pvrtc")},e.capabilities.isWebGL2&&(this.workerConfig.etc1Supported=!1),this}},{key:"init",value:function(){var t=this;if(!this.transcoderPending){var n=new e.FileLoader(this.manager);n.setPath(this.transcoderPath),n.setWithCredentials(this.withCredentials);var o=n.loadAsync("basis_transcoder.js"),r=new e.FileLoader(this.manager);r.setPath(this.transcoderPath),r.setResponseType("arraybuffer"),r.setWithCredentials(this.withCredentials);var a=r.loadAsync("basis_transcoder.wasm");this.transcoderPending=Promise.all([o,a]).then((function(e){var n=fe(e,2),o=n[0],r=n[1],a=i.BasisWorker.toString(),s=["/* constants */","let _EngineFormat = "+JSON.stringify(i.EngineFormat),"let _TranscoderFormat = "+JSON.stringify(i.TranscoderFormat),"let _BasisFormat = "+JSON.stringify(i.BasisFormat),"/* basis_transcoder.js */",o,"/* worker */",a.substring(a.indexOf("{")+1,a.lastIndexOf("}"))].join("\n");t.workerSourceURL=URL.createObjectURL(new Blob([s])),t.transcoderBinary=r,t.workerPool.setWorkerCreator((function(){var e=new Worker(t.workerSourceURL),n=t.transcoderBinary.slice(0);return e.postMessage({type:"init",config:t.workerConfig,transcoderBinary:n},[n]),e}))})),Gh>0&&console.warn("THREE.KTX2Loader: Multiple active KTX2 loaders may cause performance issues. Use a single KTX2Loader instance, or call .dispose() on old instances."),Gh++}return this.transcoderPending}},{key:"load",value:function(t,n,i,o){var r=this;if(null===this.workerConfig)throw new Error("THREE.KTX2Loader: Missing initialization with `.detectSupport( renderer )`.");var a=new e.FileLoader(this.manager);a.setResponseType("arraybuffer"),a.setWithCredentials(this.withCredentials),a.load(t,(function(e){if(Nh.has(e))return Nh.get(e).promise.then(n).catch(o);r._createTexture(e).then((function(e){return n?n(e):null})).catch(o)}),i,o)}},{key:"_createTextureFrom",value:function(t){var n=t.mipmaps,i=t.width,o=t.height,r=t.format,a=t.type,s=t.error,l=t.dfdTransferFn,c=t.dfdFlags;if("error"===a)return Promise.reject(s);var u=new e.CompressedTexture(n,i,o,r,e.UnsignedByteType);return u.minFilter=1===n.length?e.LinearFilter:e.LinearMipmapLinearFilter,u.magFilter=e.LinearFilter,u.generateMipmaps=!1,u.needsUpdate=!0,u.encoding=2===l?e.sRGBEncoding:e.LinearEncoding,u.premultiplyAlpha=!!(1&c),u}},{key:"_createTexture",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=Vh(new Uint8Array(e));if(0!==i.vkFormat)return Yh(i);var o=n,r=this.init().then((function(){return t.workerPool.postMessage({type:"transcode",buffer:e,taskConfig:o},[e])})).then((function(e){return t._createTextureFrom(e.data)}));return Nh.set(e,{promise:r}),r}},{key:"dispose",value:function(){return this.workerPool.dispose(),this.workerSourceURL&&URL.revokeObjectURL(this.workerSourceURL),Gh--,this}}]),i}(e.Loader);jh.BasisFormat={ETC1S:0,UASTC_4x4:1},jh.TranscoderFormat={ETC1:0,ETC2:1,BC1:2,BC3:3,BC4:4,BC5:5,BC7_M6_OPAQUE_ONLY:6,BC7_M5:7,PVRTC1_4_RGB:8,PVRTC1_4_RGBA:9,ASTC_4x4:10,ATC_RGB:11,ATC_RGBA_INTERPOLATED_ALPHA:12,RGBA32:13,RGB565:14,BGR565:15,RGBA4444:16},jh.EngineFormat={RGBAFormat:e.RGBAFormat,RGBA_ASTC_4x4_Format:e.RGBA_ASTC_4x4_Format,RGBA_BPTC_Format:e.RGBA_BPTC_Format,RGBA_ETC2_EAC_Format:e.RGBA_ETC2_EAC_Format,RGBA_PVRTC_4BPPV1_Format:e.RGBA_PVRTC_4BPPV1_Format,RGBA_S3TC_DXT5_Format:e.RGBA_S3TC_DXT5_Format,RGB_ETC1_Format:e.RGB_ETC1_Format,RGB_ETC2_Format:e.RGB_ETC2_Format,RGB_PVRTC_4BPPV1_Format:e.RGB_PVRTC_4BPPV1_Format,RGB_S3TC_DXT1_Format:e.RGB_S3TC_DXT1_Format},jh.BasisWorker=function(){var e,t,n,i=_EngineFormat,o=_TranscoderFormat,r=_BasisFormat;self.addEventListener("message",(function(a){var u,h=a.data;switch(h.type){case"init":e=h.config,u=h.transcoderBinary,t=new Promise((function(e){n={wasmBinary:u,onRuntimeInitialized:e},BASIS(n)})).then((function(){n.initializeBasis(),void 0===n.KTX2File&&console.warn("THREE.KTX2Loader: Please update Basis Universal transcoder.")}));break;case"transcode":t.then((function(){try{for(var t=function(t){var a=new n.KTX2File(new Uint8Array(t));function u(){a.close(),a.delete()}if(!a.isValid())throw u(),new Error("THREE.KTX2Loader:\tInvalid or unsupported .ktx2 file");var h=a.isUASTC()?r.UASTC_4x4:r.ETC1S,d=a.getWidth(),p=a.getHeight(),f=a.getLevels(),m=a.getHasAlpha(),v=a.getDFDTransferFunc(),g=a.getDFDFlags(),y=function(t,n,a,u){for(var h,d,p=t===r.ETC1S?s:l,f=0;f<p.length;f++){var m=p[f];if(e[m.if]&&(m.basisFormat.includes(t)&&!(u&&m.transcoderFormat.length<2)&&(!m.needsPowerOfTwo||c(n)&&c(a))))return{transcoderFormat:h=m.transcoderFormat[u?1:0],engineFormat:d=m.engineFormat[u?1:0]}}return console.warn("THREE.KTX2Loader: No suitable compressed texture format found. Decoding to RGBA32."),h=o.RGBA32,d=i.RGBAFormat,{transcoderFormat:h,engineFormat:d}}(h,d,p,m),A=y.transcoderFormat,E=y.engineFormat;if(!d||!p||!f)throw u(),new Error("THREE.KTX2Loader:\tInvalid texture");if(!a.startTranscoding())throw u(),new Error("THREE.KTX2Loader: .startTranscoding failed");for(var b=[],w=0;w<f;w++){var x=a.getImageLevelInfo(w,0,0),C=x.origWidth,T=x.origHeight,I=new Uint8Array(a.getImageTranscodedSizeInBytes(w,0,0,A));if(!a.transcodeImage(I,w,0,0,A,0,-1,-1))throw u(),new Error("THREE.KTX2Loader: .transcodeImage failed.");b.push({data:I,width:C,height:T})}return u(),{width:d,height:p,hasAlpha:m,mipmaps:b,format:E,dfdTransferFn:v,dfdFlags:g}}(h.buffer),a=t.width,u=t.height,d=t.hasAlpha,p=t.mipmaps,f=t.format,m=t.dfdTransferFn,v=t.dfdFlags,g=[],y=0;y<p.length;++y)g.push(p[y].data.buffer);self.postMessage({type:"transcode",id:h.id,width:a,height:u,hasAlpha:d,mipmaps:p,format:f,dfdTransferFn:m,dfdFlags:v},g)}catch(e){console.error(e),self.postMessage({type:"error",id:h.id,error:e.message})}}))}}));var a=[{if:"astcSupported",basisFormat:[r.UASTC_4x4],transcoderFormat:[o.ASTC_4x4,o.ASTC_4x4],engineFormat:[i.RGBA_ASTC_4x4_Format,i.RGBA_ASTC_4x4_Format],priorityETC1S:1/0,priorityUASTC:1,needsPowerOfTwo:!1},{if:"bptcSupported",basisFormat:[r.ETC1S,r.UASTC_4x4],transcoderFormat:[o.BC7_M5,o.BC7_M5],engineFormat:[i.RGBA_BPTC_Format,i.RGBA_BPTC_Format],priorityETC1S:3,priorityUASTC:2,needsPowerOfTwo:!1},{if:"dxtSupported",basisFormat:[r.ETC1S,r.UASTC_4x4],transcoderFormat:[o.BC1,o.BC3],engineFormat:[i.RGB_S3TC_DXT1_Format,i.RGBA_S3TC_DXT5_Format],priorityETC1S:4,priorityUASTC:5,needsPowerOfTwo:!1},{if:"etc2Supported",basisFormat:[r.ETC1S,r.UASTC_4x4],transcoderFormat:[o.ETC1,o.ETC2],engineFormat:[i.RGB_ETC2_Format,i.RGBA_ETC2_EAC_Format],priorityETC1S:1,priorityUASTC:3,needsPowerOfTwo:!1},{if:"etc1Supported",basisFormat:[r.ETC1S,r.UASTC_4x4],transcoderFormat:[o.ETC1],engineFormat:[i.RGB_ETC1_Format],priorityETC1S:2,priorityUASTC:4,needsPowerOfTwo:!1},{if:"pvrtcSupported",basisFormat:[r.ETC1S,r.UASTC_4x4],transcoderFormat:[o.PVRTC1_4_RGB,o.PVRTC1_4_RGBA],engineFormat:[i.RGB_PVRTC_4BPPV1_Format,i.RGBA_PVRTC_4BPPV1_Format],priorityETC1S:5,priorityUASTC:6,needsPowerOfTwo:!0}],s=a.sort((function(e,t){return e.priorityETC1S-t.priorityETC1S})),l=a.sort((function(e,t){return e.priorityUASTC-t.priorityUASTC}));function c(e){return e<=2||0==(e&e-1)&&0!==e}};var Wh={109:e.RGBAFormat,97:e.RGBAFormat,37:e.RGBAFormat,43:e.RGBAFormat,103:e.RGFormat,83:e.RGFormat,16:e.RGFormat,22:e.RGFormat,100:e.RedFormat,76:e.RedFormat,15:e.RedFormat,9:e.RedFormat},qh={109:e.FloatType,97:e.HalfFloatType,37:e.UnsignedByteType,43:e.UnsignedByteType,103:e.FloatType,83:e.HalfFloatType,16:e.UnsignedByteType,22:e.UnsignedByteType,100:e.FloatType,76:e.HalfFloatType,15:e.UnsignedByteType,9:e.UnsignedByteType},Jh={43:e.sRGBEncoding,22:e.sRGBEncoding,15:e.sRGBEncoding};function Yh(e){return Zh.apply(this,arguments)}function Zh(){return(Zh=k(S.mark((function t(n){var i,o,r,a,s,l,c,u;return S.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(i=n.vkFormat,o=n.pixelWidth,r=n.pixelHeight,a=n.pixelDepth,void 0!==Wh[i]){t.next=3;break}throw new Error("THREE.KTX2Loader: Unsupported vkFormat.");case 3:if(s=n.levels[0],0!==n.supercompressionScheme){t.next=8;break}l=s.levelData,t.next=16;break;case 8:if(2!==n.supercompressionScheme){t.next=15;break}return Uh||(Uh=new Promise(function(){var e=k(S.mark((function e(t){var n;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=new Qh,e.next=3,n.init();case 3:t(n);case 4:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}())),t.next=12,Uh;case 12:l=t.sent.decode(s.levelData,s.uncompressedByteLength),t.next=16;break;case 15:throw new Error("THREE.KTX2Loader: Unsupported supercompressionScheme.");case 16:return c=qh[i]===e.FloatType?new Float32Array(l.buffer,l.byteOffset,l.byteLength/Float32Array.BYTES_PER_ELEMENT):qh[i]===e.HalfFloatType?new Uint16Array(l.buffer,l.byteOffset,l.byteLength/Uint16Array.BYTES_PER_ELEMENT):l,(u=0===a?new e.DataTexture(c,o,r):new e.Data3DTexture(c,o,r,a)).type=qh[i],u.format=Wh[i],u.encoding=Jh[i]||e.LinearEncoding,u.needsUpdate=!0,t.abrupt("return",Promise.resolve(u));case 23:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function Xh(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}var Kh=S.mark(Of),$h=S.mark(_f),ed=S.mark(Lw);function td(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return nd(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return nd(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var i=0,o=function(){};return{s:o,n:function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var r,a=!0,s=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return a=e.done,e},e:function(e){s=!0,r=e},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw r}}}}function nd(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);n<t;n++)i[n]=e[n];return i}function id(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function od(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?id(Object(n),!0).forEach((function(t){xh(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):id(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var rd=THREE.GLTFLoader,ad=window;
- /*! *****************************************************************************
- Copyright (c) Microsoft Corporation.
- Permission to use, copy, modify, and/or distribute this software for any
- purpose with or without fee is hereby granted.
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- PERFORMANCE OF THIS SOFTWARE.
- ***************************************************************************** */function sd(e,t,n,i){return new(n||(n=Promise))((function(o,r){function a(e){try{l(i.next(e))}catch(e){r(e)}}function s(e){try{l(i.throw(e))}catch(e){r(e)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}l((i=i.apply(e,t||[])).next())}))}function ld(e,t){if(!e)throw new Error(t||"loader assertion failed.")}var cd=Boolean("object"!=typeof process||"[object process]"!==String(process)||process.browser),ud="undefined"!=typeof process&&process.version&&/v([0-9]*)/.exec(process.version);ud&&parseFloat(ud[1]);var hd="3.1.4";function dd(e,t){if(!e)throw new Error(t||"loaders.gl assertion failed.")}var pd={self:"undefined"!=typeof self&&self,window:"undefined"!=typeof window&&window,global:"undefined"!=typeof global&&global,document:"undefined"!=typeof document&&document},fd=pd.global||pd.self||pd.window||{},md="object"!=typeof process||"[object process]"!==String(process)||process.browser,vd="function"==typeof importScripts,gd="undefined"!=typeof window&&void 0!==window.orientation,yd="undefined"!=typeof process&&process.version&&/v([0-9]*)/.exec(process.version);function Ad(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}yd&&parseFloat(yd[1]);var Ed=function(){function e(t,n){var i=this;o(this,e),Ad(this,"name",void 0),Ad(this,"workerThread",void 0),Ad(this,"isRunning",void 0),Ad(this,"result",void 0),Ad(this,"_resolve",void 0),Ad(this,"_reject",void 0),this.name=t,this.workerThread=n,this.isRunning=!0,this._resolve=function(){},this._reject=function(){},this.result=new Promise((function(e,t){i._resolve=e,i._reject=t}))}return u(e,[{key:"postMessage",value:function(e,t){this.workerThread.postMessage({source:"loaders.gl",type:e,payload:t})}},{key:"done",value:function(e){dd(this.isRunning),this.isRunning=!1,this._resolve(e)}},{key:"error",value:function(e){dd(this.isRunning),this.isRunning=!1,this._reject(e)}}]),e}(),bd=new Map;function wd(e){dd(e.source&&!e.url||!e.source&&e.url);var t=bd.get(e.source||e.url);return t||(e.url&&(t=function(e){if(!e.startsWith("http"))return e;return xd((t=e,"try {\n importScripts('".concat(t,"');\n} catch (error) {\n console.error(error);\n throw error;\n}")));var t}(e.url),bd.set(e.url,t)),e.source&&(t=xd(e.source),bd.set(e.source,t))),dd(t),t}function xd(e){var t=new Blob([e],{type:"application/javascript"});return URL.createObjectURL(t)}function Cd(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=arguments.length>2?arguments[2]:void 0,i=n||new Set;if(e){if(Td(e))i.add(e);else if(Td(e.buffer))i.add(e.buffer);else if(ArrayBuffer.isView(e));else if(t&&"object"==typeof e)for(var o in e)Cd(e[o],t,i)}else;return void 0===n?Array.from(i):[]}function Td(e){return!!e&&(e instanceof ArrayBuffer||("undefined"!=typeof MessagePort&&e instanceof MessagePort||("undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap||"undefined"!=typeof OffscreenCanvas&&e instanceof OffscreenCanvas)))}var Id=function(){},kd=function(){function e(t){o(this,e),Ad(this,"name",void 0),Ad(this,"source",void 0),Ad(this,"url",void 0),Ad(this,"terminated",!1),Ad(this,"worker",void 0),Ad(this,"onMessage",void 0),Ad(this,"onError",void 0),Ad(this,"_loadableURL","");var n=t.name,i=t.source,r=t.url;dd(i||r),this.name=n,this.source=i,this.url=r,this.onMessage=Id,this.onError=function(e){return console.log(e)},this.worker=this._createBrowserWorker()}return u(e,[{key:"destroy",value:function(){this.onMessage=Id,this.onError=Id,this.worker.terminate(),this.terminated=!0}},{key:"isRunning",get:function(){return Boolean(this.onMessage)}},{key:"postMessage",value:function(e,t){t=t||Cd(e),this.worker.postMessage(e,t)}},{key:"_getErrorFromErrorEvent",value:function(e){var t="Failed to load ";return t+="worker ".concat(this.name," from ").concat(this.url,". "),e.message&&(t+="".concat(e.message," in ")),e.lineno&&(t+=":".concat(e.lineno,":").concat(e.colno)),new Error(t)}},{key:"_createBrowserWorker",value:function(){var e=this;this._loadableURL=wd({source:this.source,url:this.url});var t=new Worker(this._loadableURL,{name:this.name});return t.onmessage=function(t){t.data?e.onMessage(t.data):e.onError(new Error("No data received"))},t.onerror=function(t){e.onError(e._getErrorFromErrorEvent(t)),e.terminated=!0},t.onmessageerror=function(e){return console.error(e)},t}}],[{key:"isSupported",value:function(){return"undefined"!=typeof Worker}}]),e}(),Bd=function(){function e(t){o(this,e),Ad(this,"name","unnamed"),Ad(this,"source",void 0),Ad(this,"url",void 0),Ad(this,"maxConcurrency",1),Ad(this,"maxMobileConcurrency",1),Ad(this,"onDebug",(function(){})),Ad(this,"reuseWorkers",!0),Ad(this,"props",{}),Ad(this,"jobQueue",[]),Ad(this,"idleQueue",[]),Ad(this,"count",0),Ad(this,"isDestroyed",!1),this.source=t.source,this.url=t.url,this.setProps(t)}var t,n;return u(e,[{key:"destroy",value:function(){this.idleQueue.forEach((function(e){return e.destroy()})),this.isDestroyed=!0}},{key:"setProps",value:function(e){this.props=od(od({},this.props),e),void 0!==e.name&&(this.name=e.name),void 0!==e.maxConcurrency&&(this.maxConcurrency=e.maxConcurrency),void 0!==e.maxMobileConcurrency&&(this.maxMobileConcurrency=e.maxMobileConcurrency),void 0!==e.reuseWorkers&&(this.reuseWorkers=e.reuseWorkers),void 0!==e.onDebug&&(this.onDebug=e.onDebug)}},{key:"startJob",value:(n=k(S.mark((function e(t){var n,i,o,r=this,a=arguments;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=a.length>1&&void 0!==a[1]?a[1]:function(e,t,n){return e.done(n)},i=a.length>2&&void 0!==a[2]?a[2]:function(e,t){return e.error(t)},o=new Promise((function(e){return r.jobQueue.push({name:t,onMessage:n,onError:i,onStart:e}),r})),this._startQueuedJob(),e.next=6,o;case 6:return e.abrupt("return",e.sent);case 7:case"end":return e.stop()}}),e,this)}))),function(e){return n.apply(this,arguments)})},{key:"_startQueuedJob",value:(t=k(S.mark((function e(){var t,n,i;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.jobQueue.length){e.next=2;break}return e.abrupt("return");case 2:if(t=this._getAvailableWorker()){e.next=5;break}return e.abrupt("return");case 5:if(!(n=this.jobQueue.shift())){e.next=18;break}return this.onDebug({message:"Starting job",name:n.name,workerThread:t,backlog:this.jobQueue.length}),i=new Ed(n.name,t),t.onMessage=function(e){return n.onMessage(i,e.type,e.payload)},t.onError=function(e){return n.onError(i,e)},n.onStart(i),e.prev=12,e.next=15,i.result;case 15:return e.prev=15,this.returnWorkerToQueue(t),e.finish(15);case 18:case"end":return e.stop()}}),e,this,[[12,,15,18]])}))),function(){return t.apply(this,arguments)})},{key:"returnWorkerToQueue",value:function(e){this.isDestroyed||!this.reuseWorkers||this.count>this._getMaxConcurrency()?(e.destroy(),this.count--):this.idleQueue.push(e),this.isDestroyed||this._startQueuedJob()}},{key:"_getAvailableWorker",value:function(){if(this.idleQueue.length>0)return this.idleQueue.shift()||null;if(this.count<this._getMaxConcurrency()){this.count++;var e="".concat(this.name.toLowerCase()," (#").concat(this.count," of ").concat(this.maxConcurrency,")");return new kd({name:e,source:this.source,url:this.url})}return null}},{key:"_getMaxConcurrency",value:function(){return gd?this.maxMobileConcurrency:this.maxConcurrency}}]),e}(),Pd={maxConcurrency:3,maxMobileConcurrency:1,onDebug:function(){},reuseWorkers:!0},Rd=function(){function e(t){o(this,e),Ad(this,"props",void 0),Ad(this,"workerPools",new Map),this.props=od({},Pd),this.setProps(t),this.workerPools=new Map}return u(e,[{key:"destroy",value:function(){var e,t=td(this.workerPools.values());try{for(t.s();!(e=t.n()).done;){e.value.destroy()}}catch(e){t.e(e)}finally{t.f()}}},{key:"setProps",value:function(e){this.props=od(od({},this.props),e);var t,n=td(this.workerPools.values());try{for(n.s();!(t=n.n()).done;){t.value.setProps(this._getWorkerPoolProps())}}catch(e){n.e(e)}finally{n.f()}}},{key:"getWorkerPool",value:function(e){var t=e.name,n=e.source,i=e.url,o=this.workerPools.get(t);return o||((o=new Bd({name:t,source:n,url:i})).setProps(this._getWorkerPoolProps()),this.workerPools.set(t,o)),o}},{key:"_getWorkerPoolProps",value:function(){return{maxConcurrency:this.props.maxConcurrency,maxMobileConcurrency:this.props.maxMobileConcurrency,reuseWorkers:this.props.reuseWorkers,onDebug:this.props.onDebug}}}],[{key:"isSupported",value:function(){return kd.isSupported()}},{key:"getWorkerFarm",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return e._workerFarm=e._workerFarm||new e({}),e._workerFarm.setProps(t),e._workerFarm}}]),e}();Ad(Rd,"_workerFarm",void 0);var Md="latest";function Sd(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t[e.id]||{},i="".concat(e.id,"-worker.js"),o=n.workerUrl;if(o||"compression"!==e.id||(o=t.workerUrl),"test"===t._workerType&&(o="modules/".concat(e.module,"/dist/").concat(i)),!o){var r=e.version;"latest"===r&&(r=Md);var a=r?"@".concat(r):"";o="https://unpkg.com/@loaders.gl/".concat(e.module).concat(a,"/dist/").concat(i)}return dd(o),o}function Dd(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:hd;dd(e,"no worker provided");var n=e.version;return!(!t||!n)}var Ld={},Fd=Object.freeze(Object.assign(Object.create(null),Ld,{default:Ld})),Hd={};function Vd(e){return Od.apply(this,arguments)}function Od(){return(Od=k(S.mark((function e(t){var n,i,o=arguments;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=o.length>1&&void 0!==o[1]?o[1]:null,i=o.length>2&&void 0!==o[2]?o[2]:{},n&&(t=Qd(t,n,i)),Hd[t]=Hd[t]||_d(t),e.next=6,Hd[t];case 6:return e.abrupt("return",e.sent);case 7:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Qd(e,t,n){if(e.startsWith("http"))return e;var i=n.modules||{};return i[e]?i[e]:md?n.CDN?(dd(n.CDN.startsWith("http")),"".concat(n.CDN,"/").concat(t,"@").concat("3.1.4","/dist/libs/").concat(e)):vd?"../src/libs/".concat(e):"modules/".concat(t,"/src/libs/").concat(e):"modules/".concat(t,"/dist/libs/").concat(e)}function _d(e){return zd.apply(this,arguments)}function zd(){return(zd=k(S.mark((function e(t){var n,i,o;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!t.endsWith("wasm")){e.next=7;break}return e.next=3,fetch(t);case 3:return n=e.sent,e.next=6,n.arrayBuffer();case 6:return e.abrupt("return",e.sent);case 7:if(md){e.next=20;break}if(e.prev=8,e.t0=Fd&&Ld.requireFromFile,!e.t0){e.next=14;break}return e.next=13,Ld.requireFromFile(t);case 13:e.t0=e.sent;case 14:return e.abrupt("return",e.t0);case 17:return e.prev=17,e.t1=e.catch(8),e.abrupt("return",null);case 20:if(!vd){e.next=22;break}return e.abrupt("return",importScripts(t));case 22:return e.next=24,fetch(t);case 24:return i=e.sent,e.next=27,i.text();case 27:return o=e.sent,e.abrupt("return",Ud(o,t));case 29:case"end":return e.stop()}}),e,null,[[8,17]])})))).apply(this,arguments)}function Ud(e,t){if(!md)return Ld.requireFromString&&Ld.requireFromString(e,t);if(vd)return eval.call(fd,e),null;var n=document.createElement("script");n.id=t;try{n.appendChild(document.createTextNode(e))}catch(t){n.text=e}return document.body.appendChild(n),null}function Nd(e,t){return!!Rd.isSupported()&&(e.worker&&(null==t?void 0:t.worker))}function Gd(e,t,n,i,o){return jd.apply(this,arguments)}function jd(){return(jd=k(S.mark((function e(t,n,i,o,r){var a,s,l,c,u,h;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return a=t.id,s=Sd(t,i),l=Rd.getWorkerFarm(i),c=l.getWorkerPool({name:a,url:s}),i=JSON.parse(JSON.stringify(i)),e.next=7,c.startJob("process-on-worker",Wd.bind(null,r));case 7:return(u=e.sent).postMessage("process",{input:n,options:i}),e.next=11,u.result;case 11:return h=e.sent,e.next=14,h.result;case 14:return e.abrupt("return",e.sent);case 15:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Wd(e,t,n,i){return qd.apply(this,arguments)}function qd(){return(qd=k(S.mark((function e(t,n,i,o){var r,a,s,l,c;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:e.t0=i,e.next="done"===e.t0?3:"error"===e.t0?5:"process"===e.t0?7:20;break;case 3:return n.done(o),e.abrupt("break",21);case 5:return n.error(new Error(o.error)),e.abrupt("break",21);case 7:return r=o.id,a=o.input,s=o.options,e.prev=8,e.next=11,t(a,s);case 11:l=e.sent,n.postMessage("done",{id:r,result:l}),e.next=19;break;case 15:e.prev=15,e.t1=e.catch(8),c=e.t1 instanceof Error?e.t1.message:"unknown error",n.postMessage("error",{id:r,error:c});case 19:return e.abrupt("break",21);case 20:console.warn("parse-with-worker unknown message ".concat(i));case 21:case"end":return e.stop()}}),e,null,[[8,15]])})))).apply(this,arguments)}function Jd(e,t,n){if(e.byteLength<=t+n)return"";for(var i=new DataView(e),o="",r=0;r<n;r++)o+=String.fromCharCode(i.getUint8(t+r));return o}function Yd(e){try{return JSON.parse(e)}catch(t){throw new Error('Failed to parse JSON from data starting with "'.concat(function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:5;if("string"==typeof e)return e.slice(0,t);if(ArrayBuffer.isView(e))return Jd(e.buffer,e.byteOffset,t);if(e instanceof ArrayBuffer){return Jd(e,0,t)}return""}(e),'"'))}}function Zd(e){return e&&"object"==typeof e&&e.isBuffer}function Xd(e){if(Zd(e))return Zd(t=e)?new Uint8Array(t.buffer,t.byteOffset,t.length).slice().buffer:t;var t;if(e instanceof ArrayBuffer)return e;if(ArrayBuffer.isView(e))return 0===e.byteOffset&&e.byteLength===e.buffer.byteLength?e.buffer:e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength);if("string"==typeof e){var n=e;return(new TextEncoder).encode(n).buffer}if(e&&"object"==typeof e&&e._toArrayBuffer)return e._toArrayBuffer();throw new Error("toArrayBuffer")}function Kd(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];var i,o=t.map((function(e){return e instanceof ArrayBuffer?new Uint8Array(e):e})),r=o.reduce((function(e,t){return e+t.byteLength}),0),a=new Uint8Array(r),s=0,l=td(o);try{for(l.s();!(i=l.n()).done;){var c=i.value;a.set(c,s),s+=c.byteLength}}catch(e){l.e(e)}finally{l.f()}return a.buffer}function $d(e,t,n){var i=void 0!==n?new Uint8Array(e).subarray(t,t+n):new Uint8Array(e).subarray(t);return new Uint8Array(i).buffer}function ep(e,t){return ld(e>=0),ld(t>0),e+(t-1)&~(t-1)}function tp(e,t,n){var i;if(e instanceof ArrayBuffer)i=new Uint8Array(e);else{var o=e.byteOffset,r=e.byteLength;i=new Uint8Array(e.buffer||e.arrayBuffer,o,r)}return t.set(i,n),n+ep(i.byteLength,4)}function np(e){var t,n,i,o,r,a,s;return S.async((function(l){for(;;)switch(l.prev=l.next){case 0:t=[],n=!1,i=!1,l.prev=3,r=Bh(e);case 5:return l.next=7,S.awrap(r.next());case 7:if(!(n=!(a=l.sent).done)){l.next=13;break}s=a.value,t.push(s);case 10:n=!1,l.next=5;break;case 13:l.next=19;break;case 15:l.prev=15,l.t0=l.catch(3),i=!0,o=l.t0;case 19:if(l.prev=19,l.prev=20,!n||null==r.return){l.next=24;break}return l.next=24,S.awrap(r.return());case 24:if(l.prev=24,!i){l.next=27;break}throw o;case 27:return l.finish(24);case 28:return l.finish(19);case 29:return l.abrupt("return",Kd.apply(void 0,t));case 30:case"end":return l.stop()}}),null,null,[[3,15,19,29],[20,,24,28]],Promise)}function ip(){var e;if("undefined"!=typeof window&&window.performance)e=window.performance.now();else if("undefined"!=typeof process&&process.hrtime){var t=process.hrtime();e=1e3*t[0]+t[1]/1e6}else e=Date.now();return e}var op=function(){function e(t,n){o(this,e),Ad(this,"name",void 0),Ad(this,"type",void 0),Ad(this,"sampleSize",1),Ad(this,"time",void 0),Ad(this,"count",void 0),Ad(this,"samples",void 0),Ad(this,"lastTiming",void 0),Ad(this,"lastSampleTime",void 0),Ad(this,"lastSampleCount",void 0),Ad(this,"_count",0),Ad(this,"_time",0),Ad(this,"_samples",0),Ad(this,"_startTime",0),Ad(this,"_timerPending",!1),this.name=t,this.type=n,this.reset()}return u(e,[{key:"setSampleSize",value:function(e){return this.sampleSize=e,this}},{key:"incrementCount",value:function(){return this.addCount(1),this}},{key:"decrementCount",value:function(){return this.subtractCount(1),this}},{key:"addCount",value:function(e){return this._count+=e,this._samples++,this._checkSampling(),this}},{key:"subtractCount",value:function(e){return this._count-=e,this._samples++,this._checkSampling(),this}},{key:"addTime",value:function(e){return this._time+=e,this.lastTiming=e,this._samples++,this._checkSampling(),this}},{key:"timeStart",value:function(){return this._startTime=ip(),this._timerPending=!0,this}},{key:"timeEnd",value:function(){return this._timerPending?(this.addTime(ip()-this._startTime),this._timerPending=!1,this._checkSampling(),this):this}},{key:"getSampleAverageCount",value:function(){return this.sampleSize>0?this.lastSampleCount/this.sampleSize:0}},{key:"getSampleAverageTime",value:function(){return this.sampleSize>0?this.lastSampleTime/this.sampleSize:0}},{key:"getSampleHz",value:function(){return this.lastSampleTime>0?this.sampleSize/(this.lastSampleTime/1e3):0}},{key:"getAverageCount",value:function(){return this.samples>0?this.count/this.samples:0}},{key:"getAverageTime",value:function(){return this.samples>0?this.time/this.samples:0}},{key:"getHz",value:function(){return this.time>0?this.samples/(this.time/1e3):0}},{key:"reset",value:function(){return this.time=0,this.count=0,this.samples=0,this.lastTiming=0,this.lastSampleTime=0,this.lastSampleCount=0,this._count=0,this._time=0,this._samples=0,this._startTime=0,this._timerPending=!1,this}},{key:"_checkSampling",value:function(){this._samples===this.sampleSize&&(this.lastSampleTime=this._time,this.lastSampleCount=this._count,this.count+=this._count,this.time+=this._time,this.samples+=this._samples,this._time=0,this._count=0,this._samples=0)}}]),e}(),rp=function(){function e(t){o(this,e),Ad(this,"id",void 0),Ad(this,"stats",{}),this.id=t.id,this.stats={},this._initializeStats(t.stats),Object.seal(this)}return u(e,[{key:"get",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"count";return this._getOrCreate({name:e,type:t})}},{key:"size",get:function(){return Object.keys(this.stats).length}},{key:"reset",value:function(){for(var e in this.stats)this.stats[e].reset();return this}},{key:"forEach",value:function(e){for(var t in this.stats)e(this.stats[t])}},{key:"getTable",value:function(){var e={};return this.forEach((function(t){e[t.name]={time:t.time||0,count:t.count||0,average:t.getAverageTime()||0,hz:t.getHz()||0}})),e}},{key:"_initializeStats",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];t.forEach((function(t){return e._getOrCreate(t)}))}},{key:"_getOrCreate",value:function(e){if(!e||!e.name)return null;var t=e.name,n=e.type;return this.stats[t]||(this.stats[t]=e instanceof op?e:new op(t,n)),this.stats[t]}}]),e}(),ap="Queued Requests",sp="Active Requests",lp="Cancelled Requests",cp="Queued Requests Ever",up="Active Requests Ever",hp={id:"request-scheduler",throttleRequests:!0,maxRequests:6},dp=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};o(this,e),Ad(this,"props",void 0),Ad(this,"stats",void 0),Ad(this,"activeRequestCount",0),Ad(this,"requestQueue",[]),Ad(this,"requestMap",new Map),Ad(this,"deferredUpdate",null),this.props=od(od({},hp),t),this.stats=new rp({id:this.props.id}),this.stats.get(ap),this.stats.get(sp),this.stats.get(lp),this.stats.get(cp),this.stats.get(up)}return u(e,[{key:"scheduleRequest",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:function(){return 0};if(!this.props.throttleRequests)return Promise.resolve({done:function(){}});if(this.requestMap.has(e))return this.requestMap.get(e);var n={handle:e,priority:0,getPriority:t},i=new Promise((function(e){return n.resolve=e,n}));return this.requestQueue.push(n),this.requestMap.set(e,i),this._issueNewRequests(),i}},{key:"_issueRequest",value:function(e){var t=this,n=e.handle,i=e.resolve,o=!1,r=function(){o||(o=!0,t.requestMap.delete(n),t.activeRequestCount--,t._issueNewRequests())};return this.activeRequestCount++,i?i({done:r}):Promise.resolve({done:r})}},{key:"_issueNewRequests",value:function(){var e=this;this.deferredUpdate||(this.deferredUpdate=setTimeout((function(){return e._issueNewRequestsAsync()}),0))}},{key:"_issueNewRequestsAsync",value:function(){this.deferredUpdate=null;var e=Math.max(this.props.maxRequests-this.activeRequestCount,0);if(0!==e){this._updateAllRequests();for(var t=0;t<e;++t){var n=this.requestQueue.shift();n&&this._issueRequest(n)}}}},{key:"_updateAllRequests",value:function(){for(var e=this.requestQueue,t=0;t<e.length;++t){var n=e[t];this._updateRequest(n)||(e.splice(t,1),this.requestMap.delete(n.handle),t--)}e.sort((function(e,t){return e.priority-t.priority}))}},{key:"_updateRequest",value:function(e){return e.priority=e.getPriority(e.handle),!(e.priority<0)||(e.resolve(null),!1)}}]),e}(),pp={};function fp(e){for(var t in pp)if(e.startsWith(t)){var n=pp[t];e=e.replace(t,n)}return e.startsWith("http://")||e.startsWith("https://")||(e="".concat("").concat(e)),e}function mp(e){var t=e&&e.lastIndexOf("/");return t>=0?e.substr(0,t):""}var vp=function(e){return"function"==typeof e},gp=function(e){return null!==e&&"object"==typeof e},yp=function(e){return gp(e)&&e.constructor==={}.constructor},Ap=function(e){return e&&"function"==typeof e[Symbol.iterator]},Ep=function(e){return e&&"function"==typeof e[Symbol.asyncIterator]},bp=function(e){return"undefined"!=typeof Response&&e instanceof Response||e&&e.arrayBuffer&&e.text&&e.json},wp=function(e){return"undefined"!=typeof Blob&&e instanceof Blob},xp=function(e){return function(e){return"undefined"!=typeof ReadableStream&&e instanceof ReadableStream||gp(e)&&vp(e.tee)&&vp(e.cancel)&&vp(e.getReader)}(e)||function(e){return gp(e)&&vp(e.read)&&vp(e.pipe)&&function(e){return"boolean"==typeof e}(e.readable)}(e)},Cp=/^data:([-\w.]+\/[-\w.+]+)(;|,)/,Tp=/^([-\w.]+\/[-\w.+]+)/;function Ip(e){var t=Tp.exec(e);return t?t[1]:e}function kp(e){var t=Cp.exec(e);return t?t[1]:""}var Bp=/\?.*/;function Pp(e){if(bp(e)){var t=Mp(e.url||"");return{url:t,type:Ip(e.headers.get("content-type")||"")||kp(t)}}return wp(e)?{url:Mp(e.name||""),type:e.type||""}:"string"==typeof e?{url:Mp(e),type:kp(e)}:{url:"",type:""}}function Rp(e){return bp(e)?e.headers["content-length"]||-1:wp(e)?e.size:"string"==typeof e?e.length:e instanceof ArrayBuffer||ArrayBuffer.isView(e)?e.byteLength:-1}function Mp(e){return e.replace(Bp,"")}function Sp(e){return Dp.apply(this,arguments)}function Dp(){return(Dp=k(S.mark((function e(t){var n,i,o,r,a,s,l;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!bp(t)){e.next=2;break}return e.abrupt("return",t);case 2:return n={},(i=Rp(t))>=0&&(n["content-length"]=String(i)),o=Pp(t),r=o.url,(a=o.type)&&(n["content-type"]=a),e.next=9,Op(t);case 9:return(s=e.sent)&&(n["x-first-bytes"]=s),"string"==typeof t&&(t=(new TextEncoder).encode(t)),l=new Response(t,{headers:n}),Object.defineProperty(l,"url",{value:r}),e.abrupt("return",l);case 15:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Lp(e){return Fp.apply(this,arguments)}function Fp(){return(Fp=k(S.mark((function e(t){var n;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t.ok){e.next=5;break}return e.next=3,Hp(t);case 3:throw n=e.sent,new Error(n);case 5:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Hp(e){return Vp.apply(this,arguments)}function Vp(){return(Vp=k(S.mark((function e(t){var n,i,o;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n="Failed to fetch resource ".concat(t.url," (").concat(t.status,"): "),e.prev=1,i=t.headers.get("Content-Type"),o=t.statusText,!i.includes("application/json")){e.next=11;break}return e.t0=o,e.t1=" ",e.next=9,t.text();case 9:e.t2=e.sent,o=e.t0+=e.t1.concat.call(e.t1,e.t2);case 11:n=(n+=o).length>60?"".concat(n.slice(60),"..."):n,e.next=17;break;case 15:e.prev=15,e.t3=e.catch(1);case 17:return e.abrupt("return",n);case 18:case"end":return e.stop()}}),e,null,[[1,15]])})))).apply(this,arguments)}function Op(e){return Qp.apply(this,arguments)}function Qp(){return(Qp=k(S.mark((function e(t){var n,i,o,r;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=5,"string"!=typeof t){e.next=3;break}return e.abrupt("return","data:,".concat(t.slice(0,n)));case 3:if(!(t instanceof Blob)){e.next=8;break}return i=t.slice(0,5),e.next=7,new Promise((function(e){var t=new FileReader;t.onload=function(t){var n;return e(null==t||null===(n=t.target)||void 0===n?void 0:n.result)},t.readAsDataURL(i)}));case 7:return e.abrupt("return",e.sent);case 8:if(!(t instanceof ArrayBuffer)){e.next=12;break}return o=t.slice(0,n),r=_p(o),e.abrupt("return","data:base64,".concat(r));case 12:return e.abrupt("return",null);case 13:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function _p(e){for(var t="",n=new Uint8Array(e),i=0;i<n.byteLength;i++)t+=String.fromCharCode(n[i]);return btoa(t)}function zp(e,t){return Up.apply(this,arguments)}function Up(){return(Up=k(S.mark((function e(t,n){var i;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if("string"!=typeof t){e.next=7;break}return t=fp(t),i=n,null!=n&&n.fetch&&"function"!=typeof(null==n?void 0:n.fetch)&&(i=n.fetch),e.next=6,fetch(t,i);case 6:return e.abrupt("return",e.sent);case 7:return e.next=9,Sp(t);case 9:return e.abrupt("return",e.sent);case 10:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Np(){return!("object"==typeof process&&"[object process]"===String(process)&&!process.browser)||function(e){if("undefined"!=typeof window&&"object"==typeof window.process&&"renderer"===window.process.type)return!0;if("undefined"!=typeof process&&"object"==typeof process.versions&&Boolean(process.versions.electron))return!0;var t="object"==typeof navigator&&"string"==typeof navigator.userAgent&&navigator.userAgent,n=e||t;return!!(n&&n.indexOf("Electron")>=0)}()}var Gp={self:"undefined"!=typeof self&&self,window:"undefined"!=typeof window&&window,global:"undefined"!=typeof global&&global,document:"undefined"!=typeof document&&document,process:"object"==typeof process&&process},jp=Gp.window||Gp.self||Gp.global,Wp=Gp.process||{},qp="4.14.3";function Jp(e){try{var t=window[e],n="__storage_test__";return t.setItem(n,n),t.removeItem(n),t}catch(e){return null}}Np();var Yp,Zp=function(){function e(t){o(this,e);var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"sessionStorage";Ad(this,"storage",void 0),Ad(this,"id",void 0),Ad(this,"config",{}),this.storage=Jp(i),this.id=t,this.config={},Object.assign(this.config,n),this._loadConfiguration()}return u(e,[{key:"getConfiguration",value:function(){return this.config}},{key:"setConfiguration",value:function(e){return this.config={},this.updateConfiguration(e)}},{key:"updateConfiguration",value:function(e){if(Object.assign(this.config,e),this.storage){var t=JSON.stringify(this.config);this.storage.setItem(this.id,t)}return this}},{key:"_loadConfiguration",value:function(){var e={};if(this.storage){var t=this.storage.getItem(this.id);e=t?JSON.parse(t):{}}return Object.assign(this.config,e),this}}]),e}();function Xp(e,t,n){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:600,o=e.src.replace(/\(/g,"%28").replace(/\)/g,"%29");e.width>i&&(n=Math.min(n,i/e.width));var r=e.width*n,a=e.height*n,s=["font-size:1px;","padding:".concat(Math.floor(a/2),"px ").concat(Math.floor(r/2),"px;"),"line-height:".concat(a,"px;"),"background:url(".concat(o,");"),"background-size:".concat(r,"px ").concat(a,"px;"),"color:transparent;"].join("");return["".concat(t," %c+"),s]}function Kp(e){return"string"==typeof e?Yp[e.toUpperCase()]||Yp.WHITE:e}function $p(e){var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:["constructor"],i=Object.getPrototypeOf(e),o=Object.getOwnPropertyNames(i),r=td(o);try{var a=function(){var i=t.value;"function"==typeof e[i]&&(n.find((function(e){return i===e}))||(e[i]=e[i].bind(e)))};for(r.s();!(t=r.n()).done;)a()}catch(e){r.e(e)}finally{r.f()}}function ef(e,t){if(!e)throw new Error(t||"Assertion failed")}function tf(){var e,t,n;if(Np&&"performance"in jp)e=null==jp||null===(t=jp.performance)||void 0===t||null===(n=t.now)||void 0===n?void 0:n.call(t);else if("hrtime"in Wp){var i,o=null==Wp||null===(i=Wp.hrtime)||void 0===i?void 0:i.call(Wp);e=1e3*o[0]+o[1]/1e6}else e=Date.now();return e}!function(e){e[e.BLACK=30]="BLACK",e[e.RED=31]="RED",e[e.GREEN=32]="GREEN",e[e.YELLOW=33]="YELLOW",e[e.BLUE=34]="BLUE",e[e.MAGENTA=35]="MAGENTA",e[e.CYAN=36]="CYAN",e[e.WHITE=37]="WHITE",e[e.BRIGHT_BLACK=90]="BRIGHT_BLACK",e[e.BRIGHT_RED=91]="BRIGHT_RED",e[e.BRIGHT_GREEN=92]="BRIGHT_GREEN",e[e.BRIGHT_YELLOW=93]="BRIGHT_YELLOW",e[e.BRIGHT_BLUE=94]="BRIGHT_BLUE",e[e.BRIGHT_MAGENTA=95]="BRIGHT_MAGENTA",e[e.BRIGHT_CYAN=96]="BRIGHT_CYAN",e[e.BRIGHT_WHITE=97]="BRIGHT_WHITE"}(Yp||(Yp={}));var nf={debug:Np&&console.debug||console.log,log:console.log,info:console.info,warn:console.warn,error:console.error},of={enabled:!0,level:0};function rf(){}var af={},sf={once:!0},lf=function(){function e(){o(this,e);var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{id:""},n=t.id;Ad(this,"id",void 0),Ad(this,"VERSION",qp),Ad(this,"_startTs",tf()),Ad(this,"_deltaTs",tf()),Ad(this,"_storage",void 0),Ad(this,"userData",{}),Ad(this,"LOG_THROTTLE_TIMEOUT",0),this.id=n,this._storage=new Zp("__probe-".concat(this.id,"__"),of),this.userData={},this.timeStamp("".concat(this.id," started")),$p(this),Object.seal(this)}return u(e,[{key:"level",get:function(){return this.getLevel()},set:function(e){this.setLevel(e)}},{key:"isEnabled",value:function(){return this._storage.config.enabled}},{key:"getLevel",value:function(){return this._storage.config.level}},{key:"getTotal",value:function(){return Number((tf()-this._startTs).toPrecision(10))}},{key:"getDelta",value:function(){return Number((tf()-this._deltaTs).toPrecision(10))}},{key:"priority",get:function(){return this.level},set:function(e){this.level=e}},{key:"getPriority",value:function(){return this.level}},{key:"enable",value:function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return this._storage.updateConfiguration({enabled:e}),this}},{key:"setLevel",value:function(e){return this._storage.updateConfiguration({level:e}),this}},{key:"get",value:function(e){return this._storage.config[e]}},{key:"set",value:function(e,t){this._storage.updateConfiguration({[e]:t})}},{key:"settings",value:function(){console.table?console.table(this._storage.config):console.log(this._storage.config)}},{key:"assert",value:function(e,t){ef(e,t)}},{key:"warn",value:function(e){return this._getLogFunction(0,e,nf.warn,arguments,sf)}},{key:"error",value:function(e){return this._getLogFunction(0,e,nf.error,arguments)}},{key:"deprecated",value:function(e,t){return this.warn("`".concat(e,"` is deprecated and will be removed in a later version. Use `").concat(t,"` instead"))}},{key:"removed",value:function(e,t){return this.error("`".concat(e,"` has been removed. Use `").concat(t,"` instead"))}},{key:"probe",value:function(e,t){return this._getLogFunction(e,t,nf.log,arguments,{time:!0,once:!0})}},{key:"log",value:function(e,t){return this._getLogFunction(e,t,nf.debug,arguments)}},{key:"info",value:function(e,t){return this._getLogFunction(e,t,console.info,arguments)}},{key:"once",value:function(e,t){for(var n=arguments.length,i=new Array(n>2?n-2:0),o=2;o<n;o++)i[o-2]=arguments[o];return this._getLogFunction(e,t,nf.debug||nf.info,arguments,sf)}},{key:"table",value:function(e,t,n){return t?this._getLogFunction(e,t,console.table||rf,n&&[n],{tag:hf(t)}):rf}},{key:"image",value:function(e){var t=e.logLevel,n=e.priority,i=e.image,o=e.message,r=void 0===o?"":o,a=e.scale,s=void 0===a?1:a;return this._shouldLog(t||n)?Np?function(e){var t=e.image,n=e.message,i=void 0===n?"":n,o=e.scale,r=void 0===o?1:o;if("string"==typeof t){var a=new Image;return a.onload=function(){var e,t=Xp(a,i,r);(e=console).log.apply(e,H(t))},a.src=t,rf}var s=t.nodeName||"";if("img"===s.toLowerCase()){var l;return(l=console).log.apply(l,H(Xp(t,i,r))),rf}if("canvas"===s.toLowerCase()){var c=new Image;return c.onload=function(){var e;return(e=console).log.apply(e,H(Xp(c,i,r)))},c.src=t.toDataURL(),rf}return rf}({image:i,message:r,scale:s}):function(e){var t=e.image;e.message;var n=e.scale,i=void 0===n?1:n,o=null;try{o=module.require("asciify-image")}catch(e){}if(o)return function(){return o(t,{fit:"box",width:"".concat(Math.round(80*i),"%")}).then((function(e){return console.log(e)}))};return rf}({image:i,message:r,scale:s}):rf}},{key:"time",value:function(e,t){return this._getLogFunction(e,t,console.time?console.time:console.info)}},{key:"timeEnd",value:function(e,t){return this._getLogFunction(e,t,console.timeEnd?console.timeEnd:console.info)}},{key:"timeStamp",value:function(e,t){return this._getLogFunction(e,t,console.timeStamp||rf)}},{key:"group",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{collapsed:!1},i=uf({logLevel:e,message:t,opts:n}),o=n.collapsed;return i.method=(o?console.groupCollapsed:console.group)||console.info,this._getLogFunction(i)}},{key:"groupCollapsed",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.group(e,t,Object.assign({},n,{collapsed:!0}))}},{key:"groupEnd",value:function(e){return this._getLogFunction(e,"",console.groupEnd||rf)}},{key:"withGroup",value:function(e,t,n){this.group(e,t)();try{n()}finally{this.groupEnd(e)()}}},{key:"trace",value:function(){console.trace&&console.trace()}},{key:"_shouldLog",value:function(e){return this.isEnabled()&&this.getLevel()>=cf(e)}},{key:"_getLogFunction",value:function(e,t,n,i,o){if(this._shouldLog(e)){var r;o=uf({logLevel:e,message:t,args:i,opts:o}),ef(n=n||o.method),o.total=this.getTotal(),o.delta=this.getDelta(),this._deltaTs=tf();var a=o.tag||o.message;if(o.once){if(af[a])return rf;af[a]=tf()}return t=function(e,t,n){if("string"==typeof t){var i=n.time?function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:8,n=Math.max(t-e.length,0);return"".concat(" ".repeat(n)).concat(e)}((s=n.total)<10?"".concat(s.toFixed(2),"ms"):s<100?"".concat(s.toFixed(1),"ms"):s<1e3?"".concat(s.toFixed(0),"ms"):"".concat((s/1e3).toFixed(2),"s")):"";t=n.time?"".concat(e,": ").concat(i," ").concat(t):"".concat(e,": ").concat(t),o=t,r=n.color,a=n.background,Np||"string"!=typeof o||(r&&(r=Kp(r),o="[".concat(r,"m").concat(o,"[39m")),a&&(r=Kp(a),o="[".concat(a+10,"m").concat(o,"[49m"))),t=o}var o,r,a;var s;return t}(this.id,o.message,o),(r=n).bind.apply(r,[console,t].concat(H(o.args)))}return rf}}]),e}();function cf(e){if(!e)return 0;var t;switch(typeof e){case"number":t=e;break;case"object":t=e.logLevel||e.priority||0;break;default:return 0}return ef(Number.isFinite(t)&&t>=0),t}function uf(e){var t=e.logLevel,n=e.message;e.logLevel=cf(t);for(var i=e.args?Array.from(e.args):[];i.length&&i.shift()!==n;);switch(typeof t){case"string":case"function":void 0!==n&&i.unshift(n),e.message=t;break;case"object":Object.assign(e,t)}"function"==typeof e.message&&(e.message=e.message());var o=typeof e.message;return ef("string"===o||"object"===o),Object.assign(e,{args:i},e.opts)}function hf(e){for(var t in e)for(var n in e[t])return n||"untitled";return"empty"}Ad(lf,"VERSION",qp);var df=new lf({id:"loaders.gl"}),pf=function(){function e(){o(this,e)}return u(e,[{key:"log",value:function(){return function(){}}},{key:"info",value:function(){return function(){}}},{key:"warn",value:function(){return function(){}}},{key:"error",value:function(){return function(){}}}]),e}(),ff={fetch:null,mimeType:void 0,nothrow:!1,log:new(function(){function e(){o(this,e),Ad(this,"console",void 0),this.console=console}return u(e,[{key:"log",value:function(){for(var e,t=arguments.length,n=new Array(t),i=0;i<t;i++)n[i]=arguments[i];return(e=this.console.log).bind.apply(e,[this.console].concat(n))}},{key:"info",value:function(){for(var e,t=arguments.length,n=new Array(t),i=0;i<t;i++)n[i]=arguments[i];return(e=this.console.info).bind.apply(e,[this.console].concat(n))}},{key:"warn",value:function(){for(var e,t=arguments.length,n=new Array(t),i=0;i<t;i++)n[i]=arguments[i];return(e=this.console.warn).bind.apply(e,[this.console].concat(n))}},{key:"error",value:function(){for(var e,t=arguments.length,n=new Array(t),i=0;i<t;i++)n[i]=arguments[i];return(e=this.console.error).bind.apply(e,[this.console].concat(n))}}]),e}()),CDN:"https://unpkg.com/@loaders.gl",worker:!0,maxConcurrency:3,maxMobileConcurrency:1,reuseWorkers:!0,_workerType:"",limit:0,_limitMB:0,batchSize:"auto",batchDebounceMs:0,metadata:!1,transforms:[]},mf={throws:"nothrow",dataType:"(no longer used)",uri:"baseUri",method:"fetch.method",headers:"fetch.headers",body:"fetch.body",mode:"fetch.mode",credentials:"fetch.credentials",cache:"fetch.cache",redirect:"fetch.redirect",referrer:"fetch.referrer",referrerPolicy:"fetch.referrerPolicy",integrity:"fetch.integrity",keepalive:"fetch.keepalive",signal:"fetch.signal"};function vf(){ad.loaders=ad.loaders||{};var e=ad.loaders;return e._state=e._state||{},e._state}var gf=function(){var e=vf();return e.globalOptions=e.globalOptions||od({},ff),e.globalOptions};function yf(e,t,n,i){return n=n||[],function(e,t){Ef(e,null,ff,mf,t);var n,i=td(t);try{for(i.s();!(n=i.n()).done;){var o=n.value,r=e&&e[o.id]||{},a=o.options&&o.options[o.id]||{},s=o.deprecatedOptions&&o.deprecatedOptions[o.id]||{};Ef(r,o.id,a,s,t)}}catch(e){i.e(e)}finally{i.f()}}(e,n=Array.isArray(n)?n:[n]),function(e,t,n){var i=od({},e.options||{});(function(e,t){t&&!("baseUri"in e)&&(e.baseUri=t)})(i,n),null===i.log&&(i.log=new pf);return wf(i,gf()),wf(i,t),i}(t,e,i)}function Af(e,t){var n=gf(),i=e||n;return"function"==typeof i.fetch?i.fetch:gp(i.fetch)?function(e){return zp(e,i)}:null!=t&&t.fetch?null==t?void 0:t.fetch:zp}function Ef(e,t,n,i,o){var r=t||"Top level",a=t?"".concat(t,"."):"";for(var s in e){var l=!t&&gp(e[s]);if(!(s in n)&&!("baseUri"===s&&!t)&&!("workerUrl"===s&&t))if(s in i)df.warn("".concat(r," loader option '").concat(a).concat(s,"' no longer supported, use '").concat(i[s],"'"))();else if(!l){var c=bf(s,o);df.warn("".concat(r," loader option '").concat(a).concat(s,"' not recognized. ").concat(c))()}}}function bf(e,t){var n,i=e.toLowerCase(),o="",r=td(t);try{for(r.s();!(n=r.n()).done;){var a=n.value;for(var s in a.options){if(e===s)return"Did you mean '".concat(a.id,".").concat(s,"'?");var l=s.toLowerCase();(i.startsWith(l)||l.startsWith(i))&&(o=o||"Did you mean '".concat(a.id,".").concat(s,"'?"))}}}catch(e){r.e(e)}finally{r.f()}return o}function wf(e,t){for(var n in t)if(n in t){var i=t[n];yp(i)&&yp(e[n])?e[n]=od(od({},e[n]),t[n]):e[n]=t[n]}}function xf(e){var t;return!!e&&(Array.isArray(e)&&(e=e[0]),Array.isArray(null===(t=e)||void 0===t?void 0:t.extensions))}function Cf(e){var t,n,i;return ld(e,"null loader"),ld(xf(e),"invalid loader"),Array.isArray(e)&&(i=e[1],e=od(od({},e=e[0]),{},{options:od(od({},e.options),i)})),(null!==(t=e)&&void 0!==t&&t.parseTextSync||null!==(n=e)&&void 0!==n&&n.parseText)&&(e.text=!0),e.text||(e.binary=!0),e}function Tf(){return(e=vf()).loaderRegistry=e.loaderRegistry||[],e.loaderRegistry;var e}var If=/\.([^.]+)$/;function kf(e){return Bf.apply(this,arguments)}function Bf(){return(Bf=k(S.mark((function e(t){var n,i,o,r,a=arguments;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=a.length>1&&void 0!==a[1]?a[1]:[],i=a.length>2?a[2]:void 0,o=a.length>3?a[3]:void 0,Mf(t)){e.next=5;break}return e.abrupt("return",null);case 5:if(!(r=Pf(t,n,od(od({},i),{},{nothrow:!0}),o))){e.next=8;break}return e.abrupt("return",r);case 8:if(!wp(t)){e.next=13;break}return e.next=11,t.slice(0,10).arrayBuffer();case 11:t=e.sent,r=Pf(t,n,i,o);case 13:if(r||null!=i&&i.nothrow){e.next=15;break}throw new Error(Sf(t));case 15:return e.abrupt("return",r);case 16:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Pf(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],n=arguments.length>2?arguments[2]:void 0,i=arguments.length>3?arguments[3]:void 0;if(!Mf(e))return null;if(t&&!Array.isArray(t))return Cf(t);var o,r=[];(t&&(r=r.concat(t)),null!=n&&n.ignoreRegisteredLoaders)||(o=r).push.apply(o,H(Tf()));Df(r);var a=Rf(e,r,n,i);if(!(a||null!=n&&n.nothrow))throw new Error(Sf(e));return a}function Rf(e,t,n,i){var o=Pp(e),r=o.url,a=o.type,s=r||(null==i?void 0:i.url),l=null;return null!=n&&n.mimeType&&(l=Lf(t,null==n?void 0:n.mimeType)),l=(l=(l=(l=l||function(e,t){var n=t&&If.exec(t),i=n&&n[1];return i?function(e,t){t=t.toLowerCase();var n,i=td(e);try{for(i.s();!(n=i.n()).done;){var o,r=n.value,a=td(r.extensions);try{for(a.s();!(o=a.n()).done;){if(o.value.toLowerCase()===t)return r}}catch(e){a.e(e)}finally{a.f()}}}catch(e){i.e(e)}finally{i.f()}return null}(e,i):null}(t,s))||Lf(t,a))||function(e,t){if(!t)return null;var n,i=td(e);try{for(i.s();!(n=i.n()).done;){var o=n.value;if("string"==typeof t){if(Ff(t,o))return o}else if(ArrayBuffer.isView(t)){if(Hf(t.buffer,t.byteOffset,o))return o}else if(t instanceof ArrayBuffer){if(Hf(t,0,o))return o}}}catch(e){i.e(e)}finally{i.f()}return null}(t,e))||Lf(t,null==n?void 0:n.fallbackMimeType)}function Mf(e){return!(e instanceof Response&&204===e.status)}function Sf(e){var t=Pp(e),n=t.url,i=t.type,o="No valid loader found (";o+=n?"".concat(function(e){var t=e&&e.lastIndexOf("/");return t>=0?e.substr(t+1):""}(n),", "):"no url provided, ",o+="MIME type: ".concat(i?'"'.concat(i,'"'):"not provided",", ");var r=e?function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:5;if("string"==typeof e)return e.slice(0,t);if(ArrayBuffer.isView(e))return Vf(e.buffer,e.byteOffset,t);if(e instanceof ArrayBuffer)return Vf(e,0,t);return""}(e):"";return o+=r?' first bytes: "'.concat(r,'"'):"first bytes: not available",o+=")"}function Df(e){var t,n=td(e);try{for(n.s();!(t=n.n()).done;){Cf(t.value)}}catch(e){n.e(e)}finally{n.f()}}function Lf(e,t){var n,i=td(e);try{for(i.s();!(n=i.n()).done;){var o=n.value;if(o.mimeTypes&&o.mimeTypes.includes(t))return o;if(t==="application/x.".concat(o.id))return o}}catch(e){i.e(e)}finally{i.f()}return null}function Ff(e,t){return t.testText?t.testText(e):(Array.isArray(t.tests)?t.tests:[t.tests]).some((function(t){return e.startsWith(t)}))}function Hf(e,t,n){return(Array.isArray(n.tests)?n.tests:[n.tests]).some((function(i){return function(e,t,n,i){if(i instanceof ArrayBuffer)return function(e,t,n){if(n=n||e.byteLength,e.byteLength<n||t.byteLength<n)return!1;for(var i=new Uint8Array(e),o=new Uint8Array(t),r=0;r<i.length;++r)if(i[r]!==o[r])return!1;return!0}(i,e,i.byteLength);switch(typeof i){case"function":return i(e,n);case"string":return i===Vf(e,t,i.length);default:return!1}}(e,t,n,i)}))}function Vf(e,t,n){if(e.byteLength<t+n)return"";for(var i=new DataView(e),o="",r=0;r<n;r++)o+=String.fromCharCode(i.getUint8(t+r));return o}function Of(e,t){var n,i,o,r,a;return S.wrap((function(s){for(;;)switch(s.prev=s.next){case 0:n=(null==t?void 0:t.chunkSize)||262144,i=0,o=new TextEncoder;case 3:if(!(i<e.length)){s.next=11;break}return r=Math.min(e.length-i,n),a=e.slice(i,i+r),i+=r,s.next=9,o.encode(a);case 9:s.next=3;break;case 11:case"end":return s.stop()}}),Kh)}var Qf=262144;function _f(e){var t,n,i,o,r,a,s,l=arguments;return S.wrap((function(c){for(;;)switch(c.prev=c.next){case 0:t=l.length>1&&void 0!==l[1]?l[1]:{},n=t.chunkSize,i=void 0===n?Qf:n,o=0;case 3:if(!(o<e.byteLength)){c.next=14;break}return r=Math.min(e.byteLength-o,i),a=new ArrayBuffer(r),s=new Uint8Array(e,o,r),new Uint8Array(a).set(s),o+=r,c.next=12,a;case 12:c.next=3;break;case 14:case"end":return c.stop()}}),$h)}var zf=1048576;function Uf(){return(Uf=kh(S.mark((function e(t,n){var i,o,r,a;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:i=(null==n?void 0:n.chunkSize)||zf,o=0;case 2:if(!(o<t.size)){e.next=12;break}return r=o+i,e.next=6,Th(t.slice(o,r).arrayBuffer());case 6:return a=e.sent,o=r,e.next=10,a;case 10:e.next=2;break;case 12:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Nf(e,t){return cd?function(e,t){return Gf.apply(this,arguments)}(e,t):function(e,t){return jf.apply(this,arguments)}(e)}function Gf(){return(Gf=kh(S.mark((function e(t,n){var i,o,r,a,s,l;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:i=t.getReader(),e.prev=1;case 2:return r=o||i.read(),null!=n&&n._streamReadAhead&&(o=i.read()),e.next=7,Th(r);case 7:if(a=e.sent,s=a.done,l=a.value,!s){e.next=12;break}return e.abrupt("return");case 12:return e.next=14,Xd(l);case 14:e.next=2;break;case 16:e.next=21;break;case 18:e.prev=18,e.t0=e.catch(1),i.releaseLock();case 21:case"end":return e.stop()}}),e,null,[[1,18]])})))).apply(this,arguments)}function jf(){return(jf=kh(S.mark((function e(t,n){var i,o,r,a,s,l;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:i=!1,o=!1,e.prev=2,a=Bh(t);case 4:return e.next=6,Th(a.next());case 6:if(!(i=!(s=e.sent).done)){e.next=13;break}return l=s.value,e.next=10,Xd(l);case 10:i=!1,e.next=4;break;case 13:e.next=19;break;case 15:e.prev=15,e.t0=e.catch(2),o=!0,r=e.t0;case 19:if(e.prev=19,e.prev=20,!i||null==a.return){e.next=24;break}return e.next=24,Th(a.return());case 24:if(e.prev=24,!o){e.next=27;break}throw r;case 27:return e.finish(24);case 28:return e.finish(19);case 29:case"end":return e.stop()}}),e,null,[[2,15,19,29],[20,,24,28]])})))).apply(this,arguments)}function Wf(e,t){if("string"==typeof e)return Of(e,t);if(e instanceof ArrayBuffer)return _f(e,t);if(wp(e))return function(e,t){return Uf.apply(this,arguments)}(e,t);if(xp(e))return Nf(e,t);if(bp(e))return Nf(e.body,t);throw new Error("makeIterator")}var qf="Cannot convert supplied data type";function Jf(e,t,n){if(t.text&&"string"==typeof e)return e;if(function(e){return e&&"object"==typeof e&&e.isBuffer}(e)&&(e=e.buffer),e instanceof ArrayBuffer){var i=e;return t.text&&!t.binary?new TextDecoder("utf8").decode(i):i}if(ArrayBuffer.isView(e)){if(t.text&&!t.binary)return new TextDecoder("utf8").decode(e);var o=e.buffer,r=e.byteLength||e.length;return 0===e.byteOffset&&r===o.byteLength||(o=o.slice(e.byteOffset,e.byteOffset+r)),o}throw new Error(qf)}function Yf(e,t,n){return Zf.apply(this,arguments)}function Zf(){return(Zf=k(S.mark((function e(t,n,i){var o,r;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(o=t instanceof ArrayBuffer||ArrayBuffer.isView(t),"string"!=typeof t&&!o){e.next=3;break}return e.abrupt("return",Jf(t,n));case 3:if(!wp(t)){e.next=7;break}return e.next=6,Sp(t);case 6:t=e.sent;case 7:if(!bp(t)){e.next=21;break}return r=t,e.next=11,Lp(r);case 11:if(!n.binary){e.next=17;break}return e.next=14,r.arrayBuffer();case 14:e.t0=e.sent,e.next=20;break;case 17:return e.next=19,r.text();case 19:e.t0=e.sent;case 20:return e.abrupt("return",e.t0);case 21:if(xp(t)&&(t=Wf(t,i)),!Ap(t)&&!Ep(t)){e.next=24;break}return e.abrupt("return",np(t));case 24:throw new Error(qf);case 25:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Xf(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;if(n)return n;var i=od({fetch:Af(t,e)},e);return Array.isArray(i.loaders)||(i.loaders=null),i}function Kf(e,t){if(!t&&e&&!Array.isArray(e))return e;var n;if(e&&(n=Array.isArray(e)?e:[e]),t&&t.loaders){var i=Array.isArray(t.loaders)?t.loaders:[t.loaders];n=n?[].concat(H(n),H(i)):i}return n&&n.length?n:null}function $f(e,t,n,i){return em.apply(this,arguments)}function em(){return(em=k(S.mark((function e(t,n,i,o){var r,a,s,l;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return dd(!o||"object"==typeof o),!n||Array.isArray(n)||xf(n)||(o=void 0,i=n,n=void 0),e.next=4,t;case 4:return t=e.sent,i=i||{},r=Pp(t),a=r.url,s=Kf(n,o),e.next=11,kf(t,s,i);case 11:if(l=e.sent){e.next=14;break}return e.abrupt("return",null);case 14:return i=yf(i,l,s,a),o=Xf({url:a,parse:$f,loaders:s},i,o),e.next=18,tm(l,t,i,o);case 18:return e.abrupt("return",e.sent);case 19:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function tm(e,t,n,i){return nm.apply(this,arguments)}function nm(){return(nm=k(S.mark((function e(t,n,i,o){return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return Dd(t),e.next=3,Yf(n,t,i);case 3:if(n=e.sent,!t.parseTextSync||"string"!=typeof n){e.next=7;break}return i.dataType="text",e.abrupt("return",t.parseTextSync(n,i,o,t));case 7:if(!Nd(t,i)){e.next=11;break}return e.next=10,Gd(t,n,i,o,$f);case 10:return e.abrupt("return",e.sent);case 11:if(!t.parseText||"string"!=typeof n){e.next=15;break}return e.next=14,t.parseText(n,i,o,t);case 14:return e.abrupt("return",e.sent);case 15:if(!t.parse){e.next=19;break}return e.next=18,t.parse(n,i,o,t);case 18:return e.abrupt("return",e.sent);case 19:throw dd(!t.parseSync),new Error("".concat(t.id," loader - no parser found and worker is disabled"));case 21:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function im(e,t,n,i){return om.apply(this,arguments)}function om(){return(om=k(S.mark((function e(t,n,i,o){var r,a;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(Array.isArray(n)||xf(n)||(i=n,n=void 0),r=Af(i),a=t,"string"!=typeof t){e.next=7;break}return e.next=6,r(t);case 6:a=e.sent;case 7:if(!wp(t)){e.next=11;break}return e.next=10,r(t);case 10:a=e.sent;case 11:return e.next=13,$f(a,n,i);case 13:return e.abrupt("return",e.sent);case 14:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function rm(e,t){if(!e)throw new Error("math.gl assertion ".concat(t))}var am=1/Math.PI*180,sm=1/180*Math.PI,lm={};function cm(e){return Math.round(e/lm.EPSILON)*lm.EPSILON}function um(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.precision,i=void 0===n?lm.precision||4:n;return e=cm(e),"".concat(parseFloat(e.toPrecision(i)))}function hm(e){return Array.isArray(e)||ArrayBuffer.isView(e)&&!(e instanceof DataView)}function dm(e,t,n){if(hm(e)){n=n||((o=e).clone?o.clone():new Array(o.length));for(var i=0;i<n.length&&i<e.length;++i)n[i]=t(e[i],i,n);return n}var o;return t(e)}function pm(e){return function(e,t){return dm(e,(function(e){return e*sm}),t)}(e)}function fm(e){return mm(e)}function mm(e,t){return dm(e,(function(e){return e*am}),t)}function vm(e,t,n){return dm(e,(function(e){return Math.max(t,Math.min(n,e))}))}function gm(e,t,n){var i=lm.EPSILON;n&&(lm.EPSILON=n);try{if(e===t)return!0;if(hm(e)&&hm(t)){if(e.length!==t.length)return!1;for(var o=0;o<e.length;++o)if(!gm(e[o],t[o]))return!1;return!0}return e&&e.equals?e.equals(t):t&&t.equals?t.equals(e):!(!Number.isFinite(e)||!Number.isFinite(t))&&Math.abs(e-t)<=lm.EPSILON*Math.max(1,Math.abs(e),Math.abs(t))}finally{lm.EPSILON=i}}lm.EPSILON=1e-12,lm.debug=!1,lm.precision=4,lm.printTypes=!1,lm.printDegrees=!1,lm.printRowMajor=!0;var ym=function(e){f(n,e);var t=Xh(n);function n(){return o(this,n),t.apply(this,arguments)}return u(n,[{key:"ELEMENTS",get:function(){return rm(!1),0}},{key:"clone",value:function(){return(new this.constructor).copy(this)}},{key:"from",value:function(e){return Array.isArray(e)?this.copy(e):this.fromObject(e)}},{key:"fromArray",value:function(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=0;n<this.ELEMENTS;++n)this[n]=e[n+t];return this.check()}},{key:"to",value:function(e){return e===this?this:hm(e)?this.toArray(e):this.toObject(e)}},{key:"toTarget",value:function(e){return e?this.to(e):this}},{key:"toArray",value:function(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=0;n<this.ELEMENTS;++n)e[t+n]=this[n];return e}},{key:"toFloat32Array",value:function(){return new Float32Array(this)}},{key:"toString",value:function(){return this.formatString(lm)}},{key:"formatString",value:function(e){for(var t="",n=0;n<this.ELEMENTS;++n)t+=(n>0?", ":"")+um(this[n],e);return"".concat(e.printTypes?this.constructor.name:"","[").concat(t,"]")}},{key:"equals",value:function(e){if(!e||this.length!==e.length)return!1;for(var t=0;t<this.ELEMENTS;++t)if(!gm(this[t],e[t]))return!1;return!0}},{key:"exactEquals",value:function(e){if(!e||this.length!==e.length)return!1;for(var t=0;t<this.ELEMENTS;++t)if(this[t]!==e[t])return!1;return!0}},{key:"negate",value:function(){for(var e=0;e<this.ELEMENTS;++e)this[e]=-this[e];return this.check()}},{key:"lerp",value:function(e,t,n){void 0===n&&(n=t,t=e,e=this);for(var i=0;i<this.ELEMENTS;++i){var o=e[i];this[i]=o+n*(t[i]-o)}return this.check()}},{key:"min",value:function(e){for(var t=0;t<this.ELEMENTS;++t)this[t]=Math.min(e[t],this[t]);return this.check()}},{key:"max",value:function(e){for(var t=0;t<this.ELEMENTS;++t)this[t]=Math.max(e[t],this[t]);return this.check()}},{key:"clamp",value:function(e,t){for(var n=0;n<this.ELEMENTS;++n)this[n]=Math.min(Math.max(this[n],e[n]),t[n]);return this.check()}},{key:"add",value:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];for(var i=0,o=t;i<o.length;i++)for(var r=o[i],a=0;a<this.ELEMENTS;++a)this[a]+=r[a];return this.check()}},{key:"subtract",value:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];for(var i=0,o=t;i<o.length;i++)for(var r=o[i],a=0;a<this.ELEMENTS;++a)this[a]-=r[a];return this.check()}},{key:"scale",value:function(e){if(Array.isArray(e))return this.multiply(e);for(var t=0;t<this.ELEMENTS;++t)this[t]*=e;return this.check()}},{key:"sub",value:function(e){return this.subtract(e)}},{key:"setScalar",value:function(e){for(var t=0;t<this.ELEMENTS;++t)this[t]=e;return this.check()}},{key:"addScalar",value:function(e){for(var t=0;t<this.ELEMENTS;++t)this[t]+=e;return this.check()}},{key:"subScalar",value:function(e){return this.addScalar(-e)}},{key:"multiplyScalar",value:function(e){for(var t=0;t<this.ELEMENTS;++t)this[t]*=e;return this.check()}},{key:"divideScalar",value:function(e){return this.scale(1/e)}},{key:"clampScalar",value:function(e,t){for(var n=0;n<this.ELEMENTS;++n)this[n]=Math.min(Math.max(this[n],e),t);return this.check()}},{key:"multiplyByScalar",value:function(e){return this.scale(e)}},{key:"elements",get:function(){return this}},{key:"check",value:function(){if(lm.debug&&!this.validate())throw new Error("math.gl: ".concat(this.constructor.name," some fields set to invalid numbers'"));return this}},{key:"validate",value:function(){for(var e=this.length===this.ELEMENTS,t=0;t<this.ELEMENTS;++t)e=e&&Number.isFinite(this[t]);return e}}]),n}(function(e){function t(){var t=Reflect.construct(e,Array.from(arguments));return Object.setPrototypeOf(t,Object.getPrototypeOf(this)),t}return t.prototype=Object.create(e.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e,t}(Array));function Am(e,t){if(e.length!==t)return!1;for(var n=0;n<e.length;++n)if(!Number.isFinite(e[n]))return!1;return!0}function Em(e){if(!Number.isFinite(e))throw new Error("Invalid number ".concat(e));return e}function bm(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";if(lm.debug&&!Am(e,t))throw new Error("math.gl: ".concat(n," some fields set to invalid numbers'"));return e}var wm={};function xm(e,t){wm[e]||(wm[e]=!0,console.warn("".concat(e," has been removed in version ").concat(t,", see upgrade guide for more information")))}var Cm,Tm=function(e){f(n,e);var t=Xh(n);function n(){return o(this,n),t.apply(this,arguments)}return u(n,[{key:"ELEMENTS",get:function(){return rm(!1),0}},{key:"copy",value:function(e){return rm(!1),this}},{key:"x",get:function(){return this[0]},set:function(e){this[0]=Em(e)}},{key:"y",get:function(){return this[1]},set:function(e){this[1]=Em(e)}},{key:"len",value:function(){return Math.sqrt(this.lengthSquared())}},{key:"magnitude",value:function(){return this.len()}},{key:"lengthSquared",value:function(){for(var e=0,t=0;t<this.ELEMENTS;++t)e+=this[t]*this[t];return e}},{key:"magnitudeSquared",value:function(){return this.lengthSquared()}},{key:"distance",value:function(e){return Math.sqrt(this.distanceSquared(e))}},{key:"distanceSquared",value:function(e){for(var t=0,n=0;n<this.ELEMENTS;++n){var i=this[n]-e[n];t+=i*i}return Em(t)}},{key:"dot",value:function(e){for(var t=0,n=0;n<this.ELEMENTS;++n)t+=this[n]*e[n];return Em(t)}},{key:"normalize",value:function(){var e=this.magnitude();if(0!==e)for(var t=0;t<this.ELEMENTS;++t)this[t]/=e;return this.check()}},{key:"multiply",value:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];for(var i=0,o=t;i<o.length;i++)for(var r=o[i],a=0;a<this.ELEMENTS;++a)this[a]*=r[a];return this.check()}},{key:"divide",value:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];for(var i=0,o=t;i<o.length;i++)for(var r=o[i],a=0;a<this.ELEMENTS;++a)this[a]/=r[a];return this.check()}},{key:"lengthSq",value:function(){return this.lengthSquared()}},{key:"distanceTo",value:function(e){return this.distance(e)}},{key:"distanceToSquared",value:function(e){return this.distanceSquared(e)}},{key:"getComponent",value:function(e){return rm(e>=0&&e<this.ELEMENTS,"index is out of range"),Em(this[e])}},{key:"setComponent",value:function(e,t){return rm(e>=0&&e<this.ELEMENTS,"index is out of range"),this[e]=t,this.check()}},{key:"addVectors",value:function(e,t){return this.copy(e).add(t)}},{key:"subVectors",value:function(e,t){return this.copy(e).subtract(t)}},{key:"multiplyVectors",value:function(e,t){return this.copy(e).multiply(t)}},{key:"addScaledVector",value:function(e,t){return this.add(new this.constructor(e).multiplyScalar(t))}}]),n}(ym),Im=1e-6,km="undefined"!=typeof Float32Array?Float32Array:Array;function Bm(e,t,n){var i=t[0],o=t[1];return e[0]=n[0]*i+n[3]*o+n[6],e[1]=n[1]*i+n[4]*o+n[7],e}function Pm(e,t,n){var i=t[0],o=t[1];return e[0]=n[0]*i+n[4]*o+n[12],e[1]=n[1]*i+n[5]*o+n[13],e}function Rm(e,t,n){var i=t[0],o=t[1],r=n[3]*i+n[7]*o||1;return e[0]=(n[0]*i+n[4]*o)/r,e[1]=(n[1]*i+n[5]*o)/r,e}function Mm(e,t,n){var i=t[0],o=t[1],r=t[2],a=n[3]*i+n[7]*o+n[11]*r||1;return e[0]=(n[0]*i+n[4]*o+n[8]*r)/a,e[1]=(n[1]*i+n[5]*o+n[9]*r)/a,e[2]=(n[2]*i+n[6]*o+n[10]*r)/a,e}Math.hypot||(Math.hypot=function(){for(var e=0,t=arguments.length;t--;)e+=arguments[t]*arguments[t];return Math.sqrt(e)}),Cm=new km(2),km!=Float32Array&&(Cm[0]=0,Cm[1]=0);var Sm=function(e){f(n,e);var t=Xh(n);function n(){var e,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return o(this,n),e=t.call(this,2),hm(i)&&1===arguments.length?e.copy(i):(lm.debug&&(Em(i),Em(r)),e[0]=i,e[1]=r),e}return u(n,[{key:"set",value:function(e,t){return this[0]=e,this[1]=t,this.check()}},{key:"copy",value:function(e){return this[0]=e[0],this[1]=e[1],this.check()}},{key:"fromObject",value:function(e){return lm.debug&&(Em(e.x),Em(e.y)),this[0]=e.x,this[1]=e.y,this.check()}},{key:"toObject",value:function(e){return e.x=this[0],e.y=this[1],e}},{key:"ELEMENTS",get:function(){return 2}},{key:"horizontalAngle",value:function(){return Math.atan2(this.y,this.x)}},{key:"verticalAngle",value:function(){return Math.atan2(this.x,this.y)}},{key:"transform",value:function(e){return this.transformAsPoint(e)}},{key:"transformAsPoint",value:function(e){return Pm(this,this,e),this.check()}},{key:"transformAsVector",value:function(e){return Rm(this,this,e),this.check()}},{key:"transformByMatrix3",value:function(e){return Bm(this,this,e),this.check()}},{key:"transformByMatrix2x3",value:function(e){return function(e,t,n){var i=t[0],o=t[1];e[0]=n[0]*i+n[2]*o+n[4],e[1]=n[1]*i+n[3]*o+n[5]}(this,this,e),this.check()}},{key:"transformByMatrix2",value:function(e){return function(e,t,n){var i=t[0],o=t[1];e[0]=n[0]*i+n[2]*o,e[1]=n[1]*i+n[3]*o}(this,this,e),this.check()}}]),n}(Tm);function Dm(){var e=new km(3);return km!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e}function Lm(e){var t=e[0],n=e[1],i=e[2];return Math.hypot(t,n,i)}function Fm(e,t,n){var i=new km(3);return i[0]=e,i[1]=t,i[2]=n,i}function Hm(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function Vm(e,t,n){var i=t[0],o=t[1],r=t[2],a=n[0],s=n[1],l=n[2];return e[0]=o*l-r*s,e[1]=r*a-i*l,e[2]=i*s-o*a,e}function Om(e,t,n){var i=t[0],o=t[1],r=t[2],a=n[3]*i+n[7]*o+n[11]*r+n[15];return a=a||1,e[0]=(n[0]*i+n[4]*o+n[8]*r+n[12])/a,e[1]=(n[1]*i+n[5]*o+n[9]*r+n[13])/a,e[2]=(n[2]*i+n[6]*o+n[10]*r+n[14])/a,e}function Qm(e,t,n){var i=t[0],o=t[1],r=t[2];return e[0]=i*n[0]+o*n[3]+r*n[6],e[1]=i*n[1]+o*n[4]+r*n[7],e[2]=i*n[2]+o*n[5]+r*n[8],e}var _m=Lm;!function(){var e=Dm()}();var zm=[0,0,0],Um={},Nm=function(e){f(n,e);var t=Xh(n);function n(){var e,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return o(this,n),e=t.call(this,-0,-0,-0),1===arguments.length&&hm(i)?e.copy(i):(lm.debug&&(Em(i),Em(r),Em(a)),e[0]=i,e[1]=r,e[2]=a),e}return u(n,[{key:"set",value:function(e,t,n){return this[0]=e,this[1]=t,this[2]=n,this.check()}},{key:"copy",value:function(e){return this[0]=e[0],this[1]=e[1],this[2]=e[2],this.check()}},{key:"fromObject",value:function(e){return lm.debug&&(Em(e.x),Em(e.y),Em(e.z)),this[0]=e.x,this[1]=e.y,this[2]=e.z,this.check()}},{key:"toObject",value:function(e){return e.x=this[0],e.y=this[1],e.z=this[2],e}},{key:"ELEMENTS",get:function(){return 3}},{key:"z",get:function(){return this[2]},set:function(e){this[2]=Em(e)}},{key:"angle",value:function(e){return function(e,t){var n=e[0],i=e[1],o=e[2],r=t[0],a=t[1],s=t[2],l=Math.sqrt(n*n+i*i+o*o)*Math.sqrt(r*r+a*a+s*s),c=l&&Hm(e,t)/l;return Math.acos(Math.min(Math.max(c,-1),1))}(this,e)}},{key:"cross",value:function(e){return Vm(this,this,e),this.check()}},{key:"rotateX",value:function(e){var t=e.radians,n=e.origin;return function(e,t,n,i){var o=[],r=[];o[0]=t[0]-n[0],o[1]=t[1]-n[1],o[2]=t[2]-n[2],r[0]=o[0],r[1]=o[1]*Math.cos(i)-o[2]*Math.sin(i),r[2]=o[1]*Math.sin(i)+o[2]*Math.cos(i),e[0]=r[0]+n[0],e[1]=r[1]+n[1],e[2]=r[2]+n[2]}(this,this,void 0===n?zm:n,t),this.check()}},{key:"rotateY",value:function(e){var t=e.radians,n=e.origin;return function(e,t,n,i){var o=[],r=[];o[0]=t[0]-n[0],o[1]=t[1]-n[1],o[2]=t[2]-n[2],r[0]=o[2]*Math.sin(i)+o[0]*Math.cos(i),r[1]=o[1],r[2]=o[2]*Math.cos(i)-o[0]*Math.sin(i),e[0]=r[0]+n[0],e[1]=r[1]+n[1],e[2]=r[2]+n[2]}(this,this,void 0===n?zm:n,t),this.check()}},{key:"rotateZ",value:function(e){var t=e.radians,n=e.origin;return function(e,t,n,i){var o=[],r=[];o[0]=t[0]-n[0],o[1]=t[1]-n[1],o[2]=t[2]-n[2],r[0]=o[0]*Math.cos(i)-o[1]*Math.sin(i),r[1]=o[0]*Math.sin(i)+o[1]*Math.cos(i),r[2]=o[2],e[0]=r[0]+n[0],e[1]=r[1]+n[1],e[2]=r[2]+n[2]}(this,this,void 0===n?zm:n,t),this.check()}},{key:"transform",value:function(e){return this.transformAsPoint(e)}},{key:"transformAsPoint",value:function(e){return Om(this,this,e),this.check()}},{key:"transformAsVector",value:function(e){return Mm(this,this,e),this.check()}},{key:"transformByMatrix3",value:function(e){return Qm(this,this,e),this.check()}},{key:"transformByMatrix2",value:function(e){return function(e,t,n){var i=t[0],o=t[1];e[0]=n[0]*i+n[2]*o,e[1]=n[1]*i+n[3]*o,e[2]=t[2]}(this,this,e),this.check()}},{key:"transformByQuaternion",value:function(e){return function(e,t,n){var i=n[0],o=n[1],r=n[2],a=n[3],s=t[0],l=t[1],c=t[2],u=o*c-r*l,h=r*s-i*c,d=i*l-o*s,p=o*d-r*h,f=r*u-i*d,m=i*h-o*u,v=2*a;u*=v,h*=v,d*=v,p*=2,f*=2,m*=2,e[0]=s+u+p,e[1]=l+h+f,e[2]=c+d+m}(this,this,e),this.check()}}],[{key:"ZERO",get:function(){return Um.ZERO=Um.ZERO||Object.freeze(new n(0,0,0,0))}}]),n}(Tm),Gm=function(e){f(n,e);var t=Xh(n);function n(){return o(this,n),t.apply(this,arguments)}return u(n,[{key:"ELEMENTS",get:function(){return rm(!1),0}},{key:"RANK",get:function(){return rm(!1),0}},{key:"toString",value:function(){var e="[";if(lm.printRowMajor){e+="row-major:";for(var t=0;t<this.RANK;++t)for(var n=0;n<this.RANK;++n)e+=" ".concat(this[n*this.RANK+t])}else{e+="column-major:";for(var i=0;i<this.ELEMENTS;++i)e+=" ".concat(this[i])}return e+="]"}},{key:"getElementIndex",value:function(e,t){return t*this.RANK+e}},{key:"getElement",value:function(e,t){return this[t*this.RANK+e]}},{key:"setElement",value:function(e,t,n){return this[t*this.RANK+e]=Em(n),this}},{key:"getColumn",value:function(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Array(this.RANK).fill(-0),n=e*this.RANK,i=0;i<this.RANK;++i)t[i]=this[n+i];return t}},{key:"setColumn",value:function(e,t){for(var n=e*this.RANK,i=0;i<this.RANK;++i)this[n+i]=t[i];return this}}]),n}(ym);function jm(e,t,n){var i=t[0],o=t[1],r=t[2],a=t[3],s=t[4],l=t[5],c=t[6],u=t[7],h=t[8],d=n[0],p=n[1],f=n[2],m=n[3],v=n[4],g=n[5],y=n[6],A=n[7],E=n[8];return e[0]=d*i+p*a+f*c,e[1]=d*o+p*s+f*u,e[2]=d*r+p*l+f*h,e[3]=m*i+v*a+g*c,e[4]=m*o+v*s+g*u,e[5]=m*r+v*l+g*h,e[6]=y*i+A*a+E*c,e[7]=y*o+A*s+E*u,e[8]=y*r+A*l+E*h,e}function Wm(e,t,n){var i=n[0],o=n[1];return e[0]=i*t[0],e[1]=i*t[1],e[2]=i*t[2],e[3]=o*t[3],e[4]=o*t[4],e[5]=o*t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e}var qm=Object.freeze([1,0,0,0,1,0,0,0,1]),Jm=Object.freeze([0,0,0,0,0,0,0,0,0]),Ym=Object.freeze({COL0ROW0:0,COL0ROW1:1,COL0ROW2:2,COL1ROW0:3,COL1ROW1:4,COL1ROW2:5,COL2ROW0:6,COL2ROW1:7,COL2ROW2:8}),Zm={},Xm=function(e){f(n,e);var t=Xh(n);function n(e){var i;return o(this,n),i=t.call(this,-0,-0,-0,-0,-0,-0,-0,-0,-0),1===arguments.length&&Array.isArray(e)?i.copy(e):i.identity(),i}return u(n,[{key:"ELEMENTS",get:function(){return 9}},{key:"RANK",get:function(){return 3}},{key:"INDICES",get:function(){return Ym}},{key:"copy",value:function(e){return this[0]=e[0],this[1]=e[1],this[2]=e[2],this[3]=e[3],this[4]=e[4],this[5]=e[5],this[6]=e[6],this[7]=e[7],this[8]=e[8],this.check()}},{key:"set",value:function(e,t,n,i,o,r,a,s,l){return this[0]=e,this[1]=t,this[2]=n,this[3]=i,this[4]=o,this[5]=r,this[6]=a,this[7]=s,this[8]=l,this.check()}},{key:"setRowMajor",value:function(e,t,n,i,o,r,a,s,l){return this[0]=e,this[1]=i,this[2]=a,this[3]=t,this[4]=o,this[5]=s,this[6]=n,this[7]=r,this[8]=l,this.check()}},{key:"determinant",value:function(){return function(e){var t=e[0],n=e[1],i=e[2],o=e[3],r=e[4],a=e[5],s=e[6],l=e[7],c=e[8];return t*(c*r-a*l)+n*(-c*o+a*s)+i*(l*o-r*s)}(this)}},{key:"identity",value:function(){return this.copy(qm)}},{key:"fromQuaternion",value:function(e){return function(e,t){var n=t[0],i=t[1],o=t[2],r=t[3],a=n+n,s=i+i,l=o+o,c=n*a,u=i*a,h=i*s,d=o*a,p=o*s,f=o*l,m=r*a,v=r*s,g=r*l;e[0]=1-h-f,e[3]=u-g,e[6]=d+v,e[1]=u+g,e[4]=1-c-f,e[7]=p-m,e[2]=d-v,e[5]=p+m,e[8]=1-c-h}(this,e),this.check()}},{key:"transpose",value:function(){return function(e,t){if(e===t){var n=t[1],i=t[2],o=t[5];e[1]=t[3],e[2]=t[6],e[3]=n,e[5]=t[7],e[6]=i,e[7]=o}else e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8]}(this,this),this.check()}},{key:"invert",value:function(){return function(e,t){var n=t[0],i=t[1],o=t[2],r=t[3],a=t[4],s=t[5],l=t[6],c=t[7],u=t[8],h=u*a-s*c,d=-u*r+s*l,p=c*r-a*l,f=n*h+i*d+o*p;f&&(f=1/f,e[0]=h*f,e[1]=(-u*i+o*c)*f,e[2]=(s*i-o*a)*f,e[3]=d*f,e[4]=(u*n-o*l)*f,e[5]=(-s*n+o*r)*f,e[6]=p*f,e[7]=(-c*n+i*l)*f,e[8]=(a*n-i*r)*f)}(this,this),this.check()}},{key:"multiplyLeft",value:function(e){return jm(this,e,this),this.check()}},{key:"multiplyRight",value:function(e){return jm(this,this,e),this.check()}},{key:"rotate",value:function(e){return function(e,t,n){var i=t[0],o=t[1],r=t[2],a=t[3],s=t[4],l=t[5],c=t[6],u=t[7],h=t[8],d=Math.sin(n),p=Math.cos(n);e[0]=p*i+d*a,e[1]=p*o+d*s,e[2]=p*r+d*l,e[3]=p*a-d*i,e[4]=p*s-d*o,e[5]=p*l-d*r,e[6]=c,e[7]=u,e[8]=h}(this,this,e),this.check()}},{key:"scale",value:function(e){return Array.isArray(e)?Wm(this,this,e):Wm(this,this,[e,e,e]),this.check()}},{key:"translate",value:function(e){return function(e,t,n){var i=t[0],o=t[1],r=t[2],a=t[3],s=t[4],l=t[5],c=t[6],u=t[7],h=t[8],d=n[0],p=n[1];e[0]=i,e[1]=o,e[2]=r,e[3]=a,e[4]=s,e[5]=l,e[6]=d*i+p*a+c,e[7]=d*o+p*s+u,e[8]=d*r+p*l+h}(this,this,e),this.check()}},{key:"transform",value:function(e,t){switch(e.length){case 2:t=Bm(t||[-0,-0],e,this);break;case 3:t=Qm(t||[-0,-0,-0],e,this);break;case 4:t=function(e,t,n){var i=t[0],o=t[1],r=t[2];return e[0]=n[0]*i+n[3]*o+n[6]*r,e[1]=n[1]*i+n[4]*o+n[7]*r,e[2]=n[2]*i+n[5]*o+n[8]*r,e[3]=t[3],e}(t||[-0,-0,-0,-0],e,this);break;default:throw new Error("Illegal vector")}return bm(t,e.length),t}},{key:"transformVector",value:function(e,t){return xm("Matrix3.transformVector"),this.transform(e,t)}},{key:"transformVector2",value:function(e,t){return xm("Matrix3.transformVector"),this.transform(e,t)}},{key:"transformVector3",value:function(e,t){return xm("Matrix3.transformVector"),this.transform(e,t)}}],[{key:"IDENTITY",get:function(){return Zm.IDENTITY=Zm.IDENTITY||Object.freeze(new n(qm)),Zm.IDENTITY}},{key:"ZERO",get:function(){return Zm.ZERO=Zm.ZERO||Object.freeze(new n(Jm)),Zm.ZERO}}]),n}(Gm);function Km(e,t,n){var i=t[0],o=t[1],r=t[2],a=t[3],s=t[4],l=t[5],c=t[6],u=t[7],h=t[8],d=t[9],p=t[10],f=t[11],m=t[12],v=t[13],g=t[14],y=t[15],A=n[0],E=n[1],b=n[2],w=n[3];return e[0]=A*i+E*s+b*h+w*m,e[1]=A*o+E*l+b*d+w*v,e[2]=A*r+E*c+b*p+w*g,e[3]=A*a+E*u+b*f+w*y,A=n[4],E=n[5],b=n[6],w=n[7],e[4]=A*i+E*s+b*h+w*m,e[5]=A*o+E*l+b*d+w*v,e[6]=A*r+E*c+b*p+w*g,e[7]=A*a+E*u+b*f+w*y,A=n[8],E=n[9],b=n[10],w=n[11],e[8]=A*i+E*s+b*h+w*m,e[9]=A*o+E*l+b*d+w*v,e[10]=A*r+E*c+b*p+w*g,e[11]=A*a+E*u+b*f+w*y,A=n[12],E=n[13],b=n[14],w=n[15],e[12]=A*i+E*s+b*h+w*m,e[13]=A*o+E*l+b*d+w*v,e[14]=A*r+E*c+b*p+w*g,e[15]=A*a+E*u+b*f+w*y,e}function $m(e,t,n){var i=n[0],o=n[1],r=n[2];return e[0]=t[0]*i,e[1]=t[1]*i,e[2]=t[2]*i,e[3]=t[3]*i,e[4]=t[4]*o,e[5]=t[5]*o,e[6]=t[6]*o,e[7]=t[7]*o,e[8]=t[8]*r,e[9]=t[9]*r,e[10]=t[10]*r,e[11]=t[11]*r,e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e}function ev(e,t,n,i,o){var r,a=1/Math.tan(t/2);return e[0]=a/n,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=a,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=-1,e[12]=0,e[13]=0,e[15]=0,null!=o&&o!==1/0?(r=1/(i-o),e[10]=(o+i)*r,e[14]=2*o*i*r):(e[10]=-1,e[14]=-2*i),e}function tv(e,t,n,i){var o,r,a,s,l,c,u,h,d,p,f=t[0],m=t[1],v=t[2],g=i[0],y=i[1],A=i[2],E=n[0],b=n[1],w=n[2];return Math.abs(f-E)<Im&&Math.abs(m-b)<Im&&Math.abs(v-w)<Im?function(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}(e):(u=f-E,h=m-b,d=v-w,o=y*(d*=p=1/Math.hypot(u,h,d))-A*(h*=p),r=A*(u*=p)-g*d,a=g*h-y*u,(p=Math.hypot(o,r,a))?(o*=p=1/p,r*=p,a*=p):(o=0,r=0,a=0),s=h*a-d*r,l=d*o-u*a,c=u*r-h*o,(p=Math.hypot(s,l,c))?(s*=p=1/p,l*=p,c*=p):(s=0,l=0,c=0),e[0]=o,e[1]=s,e[2]=u,e[3]=0,e[4]=r,e[5]=l,e[6]=h,e[7]=0,e[8]=a,e[9]=c,e[10]=d,e[11]=0,e[12]=-(o*f+r*m+a*v),e[13]=-(s*f+l*m+c*v),e[14]=-(u*f+h*m+d*v),e[15]=1,e)}function nv(e,t,n){var i=t[0],o=t[1],r=t[2],a=n[0],s=n[1],l=n[2],c=n[3],u=c*i+s*r-l*o,h=c*o+l*i-a*r,d=c*r+a*o-s*i,p=-a*i-s*o-l*r;return e[0]=u*c+p*-a+h*-l-d*-s,e[1]=h*c+p*-s+d*-a-u*-l,e[2]=d*c+p*-l+u*-s-h*-a,e[3]=t[3],e}!function(){var e=function(){var e=new km(4);return km!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0,e[3]=0),e}()}();var iv=Object.freeze([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]),ov=Object.freeze([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),rv=Object.freeze({COL0ROW0:0,COL0ROW1:1,COL0ROW2:2,COL0ROW3:3,COL1ROW0:4,COL1ROW1:5,COL1ROW2:6,COL1ROW3:7,COL2ROW0:8,COL2ROW1:9,COL2ROW2:10,COL2ROW3:11,COL3ROW0:12,COL3ROW1:13,COL3ROW2:14,COL3ROW3:15}),av={},sv=function(e){f(n,e);var t=Xh(n);function n(e){var i;return o(this,n),i=t.call(this,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0),1===arguments.length&&Array.isArray(e)?i.copy(e):i.identity(),i}return u(n,[{key:"INDICES",get:function(){return rv}},{key:"ELEMENTS",get:function(){return 16}},{key:"RANK",get:function(){return 4}},{key:"copy",value:function(e){return this[0]=e[0],this[1]=e[1],this[2]=e[2],this[3]=e[3],this[4]=e[4],this[5]=e[5],this[6]=e[6],this[7]=e[7],this[8]=e[8],this[9]=e[9],this[10]=e[10],this[11]=e[11],this[12]=e[12],this[13]=e[13],this[14]=e[14],this[15]=e[15],this.check()}},{key:"set",value:function(e,t,n,i,o,r,a,s,l,c,u,h,d,p,f,m){return this[0]=e,this[1]=t,this[2]=n,this[3]=i,this[4]=o,this[5]=r,this[6]=a,this[7]=s,this[8]=l,this[9]=c,this[10]=u,this[11]=h,this[12]=d,this[13]=p,this[14]=f,this[15]=m,this.check()}},{key:"setRowMajor",value:function(e,t,n,i,o,r,a,s,l,c,u,h,d,p,f,m){return this[0]=e,this[1]=o,this[2]=l,this[3]=d,this[4]=t,this[5]=r,this[6]=c,this[7]=p,this[8]=n,this[9]=a,this[10]=u,this[11]=f,this[12]=i,this[13]=s,this[14]=h,this[15]=m,this.check()}},{key:"toRowMajor",value:function(e){return e[0]=this[0],e[1]=this[4],e[2]=this[8],e[3]=this[12],e[4]=this[1],e[5]=this[5],e[6]=this[9],e[7]=this[13],e[8]=this[2],e[9]=this[6],e[10]=this[10],e[11]=this[14],e[12]=this[3],e[13]=this[7],e[14]=this[11],e[15]=this[15],e}},{key:"identity",value:function(){return this.copy(iv)}},{key:"fromQuaternion",value:function(e){return function(e,t){var n=t[0],i=t[1],o=t[2],r=t[3],a=n+n,s=i+i,l=o+o,c=n*a,u=i*a,h=i*s,d=o*a,p=o*s,f=o*l,m=r*a,v=r*s,g=r*l;e[0]=1-h-f,e[1]=u+g,e[2]=d-v,e[3]=0,e[4]=u-g,e[5]=1-c-f,e[6]=p+m,e[7]=0,e[8]=d+v,e[9]=p-m,e[10]=1-c-h,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1}(this,e),this.check()}},{key:"frustum",value:function(e){var t=e.left,i=e.right,o=e.bottom,r=e.top,a=e.near,s=e.far;return s===1/0?n._computeInfinitePerspectiveOffCenter(this,t,i,o,r,a):function(e,t,n,i,o,r,a){var s=1/(n-t),l=1/(o-i),c=1/(r-a);e[0]=2*r*s,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=2*r*l,e[6]=0,e[7]=0,e[8]=(n+t)*s,e[9]=(o+i)*l,e[10]=(a+r)*c,e[11]=-1,e[12]=0,e[13]=0,e[14]=a*r*2*c,e[15]=0}(this,t,i,o,r,a,s),this.check()}},{key:"lookAt",value:function(e,t,n){if(1===arguments.length){var i=e;e=i.eye,t=i.center,n=i.up}return tv(this,e,t=t||[0,0,0],n=n||[0,1,0]),this.check()}},{key:"ortho",value:function(e){var t=e.left,n=e.right,i=e.bottom,o=e.top,r=e.near,a=void 0===r?.1:r,s=e.far;return function(e,t,n,i,o,r,a){var s=1/(t-n),l=1/(i-o),c=1/(r-a);e[0]=-2*s,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=-2*l,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=2*c,e[11]=0,e[12]=(t+n)*s,e[13]=(o+i)*l,e[14]=(a+r)*c,e[15]=1}(this,t,n,i,o,a,void 0===s?500:s),this.check()}},{key:"orthographic",value:function(e){var t=e.fovy,i=void 0===t?45*Math.PI/180:t,o=e.aspect,r=void 0===o?1:o,a=e.focalDistance,s=void 0===a?1:a,l=e.near,c=void 0===l?.1:l,u=e.far,h=void 0===u?500:u;if(i>2*Math.PI)throw Error("radians");var d=i/2,p=s*Math.tan(d),f=p*r;return(new n).ortho({left:-f,right:f,bottom:-p,top:p,near:c,far:h})}},{key:"perspective",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.fovy,n=void 0===t?void 0:t,i=e.fov,o=void 0===i?45*Math.PI/180:i,r=e.aspect,a=void 0===r?1:r,s=e.near,l=void 0===s?.1:s,c=e.far,u=void 0===c?500:c;if((n=n||o)>2*Math.PI)throw Error("radians");return ev(this,n,a,l,u),this.check()}},{key:"determinant",value:function(){return function(e){var t=e[0],n=e[1],i=e[2],o=e[3],r=e[4],a=e[5],s=e[6],l=e[7],c=e[8],u=e[9],h=e[10],d=e[11],p=e[12],f=e[13],m=e[14],v=e[15];return(t*a-n*r)*(h*v-d*m)-(t*s-i*r)*(u*v-d*f)+(t*l-o*r)*(u*m-h*f)+(n*s-i*a)*(c*v-d*p)-(n*l-o*a)*(c*m-h*p)+(i*l-o*s)*(c*f-u*p)}(this)}},{key:"getScale",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[-0,-0,-0];return e[0]=Math.sqrt(this[0]*this[0]+this[1]*this[1]+this[2]*this[2]),e[1]=Math.sqrt(this[4]*this[4]+this[5]*this[5]+this[6]*this[6]),e[2]=Math.sqrt(this[8]*this[8]+this[9]*this[9]+this[10]*this[10]),e}},{key:"getTranslation",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[-0,-0,-0];return e[0]=this[12],e[1]=this[13],e[2]=this[14],e}},{key:"getRotation",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=this.getScale(t||[-0,-0,-0]),i=1/n[0],o=1/n[1],r=1/n[2];return e[0]=this[0]*i,e[1]=this[1]*o,e[2]=this[2]*r,e[3]=0,e[4]=this[4]*i,e[5]=this[5]*o,e[6]=this[6]*r,e[7]=0,e[8]=this[8]*i,e[9]=this[9]*o,e[10]=this[10]*r,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}},{key:"getRotationMatrix3",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[-0,-0,-0,-0,-0,-0,-0,-0,-0],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=this.getScale(t||[-0,-0,-0]),i=1/n[0],o=1/n[1],r=1/n[2];return e[0]=this[0]*i,e[1]=this[1]*o,e[2]=this[2]*r,e[3]=this[4]*i,e[4]=this[5]*o,e[5]=this[6]*r,e[6]=this[8]*i,e[7]=this[9]*o,e[8]=this[10]*r,e}},{key:"transpose",value:function(){return function(e,t){if(e===t){var n=t[1],i=t[2],o=t[3],r=t[6],a=t[7],s=t[11];e[1]=t[4],e[2]=t[8],e[3]=t[12],e[4]=n,e[6]=t[9],e[7]=t[13],e[8]=i,e[9]=r,e[11]=t[14],e[12]=o,e[13]=a,e[14]=s}else e[0]=t[0],e[1]=t[4],e[2]=t[8],e[3]=t[12],e[4]=t[1],e[5]=t[5],e[6]=t[9],e[7]=t[13],e[8]=t[2],e[9]=t[6],e[10]=t[10],e[11]=t[14],e[12]=t[3],e[13]=t[7],e[14]=t[11],e[15]=t[15]}(this,this),this.check()}},{key:"invert",value:function(){return function(e,t){var n=t[0],i=t[1],o=t[2],r=t[3],a=t[4],s=t[5],l=t[6],c=t[7],u=t[8],h=t[9],d=t[10],p=t[11],f=t[12],m=t[13],v=t[14],g=t[15],y=n*s-i*a,A=n*l-o*a,E=n*c-r*a,b=i*l-o*s,w=i*c-r*s,x=o*c-r*l,C=u*m-h*f,T=u*v-d*f,I=u*g-p*f,k=h*v-d*m,B=h*g-p*m,P=d*g-p*v,R=y*P-A*B+E*k+b*I-w*T+x*C;R&&(R=1/R,e[0]=(s*P-l*B+c*k)*R,e[1]=(o*B-i*P-r*k)*R,e[2]=(m*x-v*w+g*b)*R,e[3]=(d*w-h*x-p*b)*R,e[4]=(l*I-a*P-c*T)*R,e[5]=(n*P-o*I+r*T)*R,e[6]=(v*E-f*x-g*A)*R,e[7]=(u*x-d*E+p*A)*R,e[8]=(a*B-s*I+c*C)*R,e[9]=(i*I-n*B-r*C)*R,e[10]=(f*w-m*E+g*y)*R,e[11]=(h*E-u*w-p*y)*R,e[12]=(s*T-a*k-l*C)*R,e[13]=(n*k-i*T+o*C)*R,e[14]=(m*A-f*b-v*y)*R,e[15]=(u*b-h*A+d*y)*R)}(this,this),this.check()}},{key:"multiplyLeft",value:function(e){return Km(this,e,this),this.check()}},{key:"multiplyRight",value:function(e){return Km(this,this,e),this.check()}},{key:"rotateX",value:function(e){return function(e,t,n){var i=Math.sin(n),o=Math.cos(n),r=t[4],a=t[5],s=t[6],l=t[7],c=t[8],u=t[9],h=t[10],d=t[11];t!==e&&(e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[4]=r*o+c*i,e[5]=a*o+u*i,e[6]=s*o+h*i,e[7]=l*o+d*i,e[8]=c*o-r*i,e[9]=u*o-a*i,e[10]=h*o-s*i,e[11]=d*o-l*i}(this,this,e),this.check()}},{key:"rotateY",value:function(e){return function(e,t,n){var i=Math.sin(n),o=Math.cos(n),r=t[0],a=t[1],s=t[2],l=t[3],c=t[8],u=t[9],h=t[10],d=t[11];t!==e&&(e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[0]=r*o-c*i,e[1]=a*o-u*i,e[2]=s*o-h*i,e[3]=l*o-d*i,e[8]=r*i+c*o,e[9]=a*i+u*o,e[10]=s*i+h*o,e[11]=l*i+d*o}(this,this,e),this.check()}},{key:"rotateZ",value:function(e){return function(e,t,n){var i=Math.sin(n),o=Math.cos(n),r=t[0],a=t[1],s=t[2],l=t[3],c=t[4],u=t[5],h=t[6],d=t[7];t!==e&&(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[0]=r*o+c*i,e[1]=a*o+u*i,e[2]=s*o+h*i,e[3]=l*o+d*i,e[4]=c*o-r*i,e[5]=u*o-a*i,e[6]=h*o-s*i,e[7]=d*o-l*i}(this,this,e),this.check()}},{key:"rotateXYZ",value:function(e){var t=fe(e,3),n=t[0],i=t[1],o=t[2];return this.rotateX(n).rotateY(i).rotateZ(o)}},{key:"rotateAxis",value:function(e,t){return function(e,t,n,i){var o,r,a,s,l,c,u,h,d,p,f,m,v,g,y,A,E,b,w,x,C,T,I,k,B=i[0],P=i[1],R=i[2],M=Math.hypot(B,P,R);M<Im||(B*=M=1/M,P*=M,R*=M,o=Math.sin(n),a=1-(r=Math.cos(n)),s=t[0],l=t[1],c=t[2],u=t[3],h=t[4],d=t[5],p=t[6],f=t[7],m=t[8],v=t[9],g=t[10],y=t[11],A=B*B*a+r,E=P*B*a+R*o,b=R*B*a-P*o,w=B*P*a-R*o,x=P*P*a+r,C=R*P*a+B*o,T=B*R*a+P*o,I=P*R*a-B*o,k=R*R*a+r,e[0]=s*A+h*E+m*b,e[1]=l*A+d*E+v*b,e[2]=c*A+p*E+g*b,e[3]=u*A+f*E+y*b,e[4]=s*w+h*x+m*C,e[5]=l*w+d*x+v*C,e[6]=c*w+p*x+g*C,e[7]=u*w+f*x+y*C,e[8]=s*T+h*I+m*k,e[9]=l*T+d*I+v*k,e[10]=c*T+p*I+g*k,e[11]=u*T+f*I+y*k,t!==e&&(e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]))}(this,this,e,t),this.check()}},{key:"scale",value:function(e){return Array.isArray(e)?$m(this,this,e):$m(this,this,[e,e,e]),this.check()}},{key:"translate",value:function(e){return function(e,t,n){var i,o,r,a,s,l,c,u,h,d,p,f,m=n[0],v=n[1],g=n[2];t===e?(e[12]=t[0]*m+t[4]*v+t[8]*g+t[12],e[13]=t[1]*m+t[5]*v+t[9]*g+t[13],e[14]=t[2]*m+t[6]*v+t[10]*g+t[14],e[15]=t[3]*m+t[7]*v+t[11]*g+t[15]):(i=t[0],o=t[1],r=t[2],a=t[3],s=t[4],l=t[5],c=t[6],u=t[7],h=t[8],d=t[9],p=t[10],f=t[11],e[0]=i,e[1]=o,e[2]=r,e[3]=a,e[4]=s,e[5]=l,e[6]=c,e[7]=u,e[8]=h,e[9]=d,e[10]=p,e[11]=f,e[12]=i*m+s*v+h*g+t[12],e[13]=o*m+l*v+d*g+t[13],e[14]=r*m+c*v+p*g+t[14],e[15]=a*m+u*v+f*g+t[15])}(this,this,e),this.check()}},{key:"transform",value:function(e,t){return 4===e.length?(bm(t=function(e,t,n){var i=t[0],o=t[1],r=t[2],a=t[3];return e[0]=n[0]*i+n[4]*o+n[8]*r+n[12]*a,e[1]=n[1]*i+n[5]*o+n[9]*r+n[13]*a,e[2]=n[2]*i+n[6]*o+n[10]*r+n[14]*a,e[3]=n[3]*i+n[7]*o+n[11]*r+n[15]*a,e}(t||[-0,-0,-0,-0],e,this),4),t):this.transformAsPoint(e,t)}},{key:"transformAsPoint",value:function(e,t){switch(e.length){case 2:t=Pm(t||[-0,-0],e,this);break;case 3:t=Om(t||[-0,-0,-0],e,this);break;default:throw new Error("Illegal vector")}return bm(t,e.length),t}},{key:"transformAsVector",value:function(e,t){switch(e.length){case 2:t=Rm(t||[-0,-0],e,this);break;case 3:t=Mm(t||[-0,-0,-0],e,this);break;default:throw new Error("Illegal vector")}return bm(t,e.length),t}},{key:"makeRotationX",value:function(e){return this.identity().rotateX(e)}},{key:"makeTranslation",value:function(e,t,n){return this.identity().translate([e,t,n])}},{key:"transformPoint",value:function(e,t){return xm("Matrix4.transformPoint","3.0"),this.transformAsPoint(e,t)}},{key:"transformVector",value:function(e,t){return xm("Matrix4.transformVector","3.0"),this.transformAsPoint(e,t)}},{key:"transformDirection",value:function(e,t){return xm("Matrix4.transformDirection","3.0"),this.transformAsVector(e,t)}}],[{key:"IDENTITY",get:function(){return av.IDENTITY=av.IDENTITY||Object.freeze(new n(iv)),av.IDENTITY}},{key:"ZERO",get:function(){return av.ZERO=av.ZERO||Object.freeze(new n(ov)),av.ZERO}},{key:"_computeInfinitePerspectiveOffCenter",value:function(e,t,n,i,o,r){var a=2*r/(n-t),s=2*r/(o-i),l=(n+t)/(n-t),c=(o+i)/(o-i),u=-2*r;return e[0]=a,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=s,e[6]=0,e[7]=0,e[8]=l,e[9]=c,e[10]=-1,e[11]=-1,e[12]=0,e[13]=0,e[14]=u,e[15]=0,e}}]),n}(Gm);function lv(){var e=new km(4);return km!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e[3]=1,e}function cv(e,t,n){n*=.5;var i=Math.sin(n);return e[0]=i*t[0],e[1]=i*t[1],e[2]=i*t[2],e[3]=Math.cos(n),e}function uv(e,t,n){var i=t[0],o=t[1],r=t[2],a=t[3],s=n[0],l=n[1],c=n[2],u=n[3];return e[0]=i*u+a*s+o*c-r*l,e[1]=o*u+a*l+r*s-i*c,e[2]=r*u+a*c+i*l-o*s,e[3]=a*u-i*s-o*l-r*c,e}function hv(e,t,n,i){var o,r,a,s,l,c=t[0],u=t[1],h=t[2],d=t[3],p=n[0],f=n[1],m=n[2],v=n[3];return(r=c*p+u*f+h*m+d*v)<0&&(r=-r,p=-p,f=-f,m=-m,v=-v),1-r>Im?(o=Math.acos(r),a=Math.sin(o),s=Math.sin((1-i)*o)/a,l=Math.sin(i*o)/a):(s=1-i,l=i),e[0]=s*c+l*p,e[1]=s*u+l*f,e[2]=s*h+l*m,e[3]=s*d+l*v,e}function dv(e,t){var n,i=t[0]+t[4]+t[8];if(i>0)n=Math.sqrt(i+1),e[3]=.5*n,n=.5/n,e[0]=(t[5]-t[7])*n,e[1]=(t[6]-t[2])*n,e[2]=(t[1]-t[3])*n;else{var o=0;t[4]>t[0]&&(o=1),t[8]>t[3*o+o]&&(o=2);var r=(o+1)%3,a=(o+2)%3;n=Math.sqrt(t[3*o+o]-t[3*r+r]-t[3*a+a]+1),e[o]=.5*n,n=.5/n,e[3]=(t[3*r+a]-t[3*a+r])*n,e[r]=(t[3*r+o]+t[3*o+r])*n,e[a]=(t[3*a+o]+t[3*o+a])*n}return e}var pv,fv,mv,vv=function(e,t,n){return e[0]=t[0]+n[0],e[1]=t[1]+n[1],e[2]=t[2]+n[2],e[3]=t[3]+n[3],e},gv=function(e,t,n){return e[0]=t[0]*n,e[1]=t[1]*n,e[2]=t[2]*n,e[3]=t[3]*n,e},yv=function(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]+e[3]*t[3]},Av=function(e,t,n,i){var o=t[0],r=t[1],a=t[2],s=t[3];return e[0]=o+i*(n[0]-o),e[1]=r+i*(n[1]-r),e[2]=a+i*(n[2]-a),e[3]=s+i*(n[3]-s),e},Ev=function(e){var t=e[0],n=e[1],i=e[2],o=e[3];return Math.hypot(t,n,i,o)},bv=function(e){var t=e[0],n=e[1],i=e[2],o=e[3];return t*t+n*n+i*i+o*o},wv=function(e,t){var n=t[0],i=t[1],o=t[2],r=t[3],a=n*n+i*i+o*o+r*r;return a>0&&(a=1/Math.sqrt(a)),e[0]=n*a,e[1]=i*a,e[2]=o*a,e[3]=r*a,e},xv=(pv=Dm(),fv=Fm(1,0,0),mv=Fm(0,1,0),function(e,t,n){var i=Hm(t,n);return i<-.999999?(Vm(pv,fv,t),_m(pv)<1e-6&&Vm(pv,mv,t),function(e,t){var n=t[0],i=t[1],o=t[2],r=n*n+i*i+o*o;r>0&&(r=1/Math.sqrt(r)),e[0]=t[0]*r,e[1]=t[1]*r,e[2]=t[2]*r}(pv,pv),cv(e,pv,Math.PI),e):i>.999999?(e[0]=0,e[1]=0,e[2]=0,e[3]=1,e):(Vm(pv,t,n),e[0]=pv[0],e[1]=pv[1],e[2]=pv[2],e[3]=1+i,wv(e,e))});lv(),lv(),function(){var e=new km(9);km!=Float32Array&&(e[1]=0,e[2]=0,e[3]=0,e[5]=0,e[6]=0,e[7]=0),e[0]=1,e[4]=1,e[8]=1}();var Cv=[0,0,0,1],Tv=function(e){f(n,e);var t=Xh(n);function n(){var e,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1;return o(this,n),e=t.call(this,-0,-0,-0,-0),Array.isArray(i)&&1===arguments.length?e.copy(i):e.set(i,r,a,s),e}return u(n,[{key:"copy",value:function(e){return this[0]=e[0],this[1]=e[1],this[2]=e[2],this[3]=e[3],this.check()}},{key:"set",value:function(e,t,n,i){return this[0]=e,this[1]=t,this[2]=n,this[3]=i,this.check()}},{key:"fromMatrix3",value:function(e){return dv(this,e),this.check()}},{key:"identity",value:function(){return function(e){e[0]=0,e[1]=0,e[2]=0,e[3]=1}(this),this.check()}},{key:"fromAxisRotation",value:function(e,t){return cv(this,e,t),this.check()}},{key:"setAxisAngle",value:function(e,t){return this.fromAxisRotation(e,t)}},{key:"ELEMENTS",get:function(){return 4}},{key:"x",get:function(){return this[0]},set:function(e){this[0]=Em(e)}},{key:"y",get:function(){return this[1]},set:function(e){this[1]=Em(e)}},{key:"z",get:function(){return this[2]},set:function(e){this[2]=Em(e)}},{key:"w",get:function(){return this[3]},set:function(e){this[3]=Em(e)}},{key:"len",value:function(){return Ev(this)}},{key:"lengthSquared",value:function(){return bv(this)}},{key:"dot",value:function(e,t){if(void 0!==t)throw new Error("Quaternion.dot only takes one argument");return yv(this,e)}},{key:"rotationTo",value:function(e,t){return xv(this,e,t),this.check()}},{key:"add",value:function(e,t){if(void 0!==t)throw new Error("Quaternion.add only takes one argument");return vv(this,this,e),this.check()}},{key:"calculateW",value:function(){return function(e,t){var n=t[0],i=t[1],o=t[2];e[0]=n,e[1]=i,e[2]=o,e[3]=Math.sqrt(Math.abs(1-n*n-i*i-o*o))}(this,this),this.check()}},{key:"conjugate",value:function(){return function(e,t){e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e[3]=t[3]}(this,this),this.check()}},{key:"invert",value:function(){return function(e,t){var n=t[0],i=t[1],o=t[2],r=t[3],a=n*n+i*i+o*o+r*r,s=a?1/a:0;e[0]=-n*s,e[1]=-i*s,e[2]=-o*s,e[3]=r*s}(this,this),this.check()}},{key:"lerp",value:function(e,t,n){return Av(this,e,t,n),this.check()}},{key:"multiplyRight",value:function(e,t){return rm(!t),uv(this,this,e),this.check()}},{key:"multiplyLeft",value:function(e,t){return rm(!t),uv(this,e,this),this.check()}},{key:"normalize",value:function(){var e=this.len(),t=e>0?1/e:0;return this[0]=this[0]*t,this[1]=this[1]*t,this[2]=this[2]*t,this[3]=this[3]*t,0===e&&(this[3]=1),this.check()}},{key:"rotateX",value:function(e){return function(e,t,n){n*=.5;var i=t[0],o=t[1],r=t[2],a=t[3],s=Math.sin(n),l=Math.cos(n);e[0]=i*l+a*s,e[1]=o*l+r*s,e[2]=r*l-o*s,e[3]=a*l-i*s}(this,this,e),this.check()}},{key:"rotateY",value:function(e){return function(e,t,n){n*=.5;var i=t[0],o=t[1],r=t[2],a=t[3],s=Math.sin(n),l=Math.cos(n);e[0]=i*l-r*s,e[1]=o*l+a*s,e[2]=r*l+i*s,e[3]=a*l-o*s}(this,this,e),this.check()}},{key:"rotateZ",value:function(e){return function(e,t,n){n*=.5;var i=t[0],o=t[1],r=t[2],a=t[3],s=Math.sin(n),l=Math.cos(n);e[0]=i*l+o*s,e[1]=o*l-i*s,e[2]=r*l+a*s,e[3]=a*l-r*s}(this,this,e),this.check()}},{key:"scale",value:function(e){return gv(this,this,e),this.check()}},{key:"slerp",value:function(e,t,n){switch(arguments.length){case 1:var i=arguments[0],o=i.start;e=void 0===o?Cv:o,t=i.target,n=i.ratio;break;case 2:var r=Array.prototype.slice.call(arguments);t=r[0],n=r[1],e=this}return hv(this,e,t,n),this.check()}},{key:"transformVector4",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e;return nv(t,e,this),bm(t,4)}},{key:"lengthSq",value:function(){return this.lengthSquared()}},{key:"setFromAxisAngle",value:function(e,t){return this.setAxisAngle(e,t)}},{key:"premultiply",value:function(e,t){return this.multiplyLeft(e,t)}},{key:"multiply",value:function(e,t){return this.multiplyRight(e,t)}}]),n}(ym),Iv=.1,kv=1e-12,Bv=1e-15,Pv=(Math.PI,Math.PI,Math.PI,Math.PI,function(e){return e}),Rv=new Nm;function Mv(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Pv;return hm(e)?(t[0]=n(e[0]),t[1]=n(e[1]),t[2]=e[2]):"longitude"in e?(t[0]=n(e.longitude),t[1]=n(e.latitude),t[2]=e.height):(t[0]=n(e.x),t[1]=n(e.y),t[2]=e.z),t}function Sv(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Rv;return Mv(e,t,lm._cartographicRadians?Pv:pm)}function Dv(e,t){return function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Pv;return hm(t)?(t[0]=n(e[0]),t[1]=n(e[1]),t[2]=e[2]):"longitude"in t?(t.longitude=n(e[0]),t.latitude=n(e[1]),t.height=e[2]):(t.x=n(e[0]),t.y=n(e[1]),t.z=e[2]),t}(e,t,lm._cartographicRadians?Pv:fm)}var Lv=new Nm,Fv=new Nm,Hv=new Nm;var Vv=new Nm,Ov={up:{south:"east",north:"west",west:"south",east:"north"},down:{south:"west",north:"east",west:"north",east:"south"},south:{up:"west",down:"east",west:"down",east:"up"},north:{up:"east",down:"west",west:"up",east:"down"},west:{up:"north",down:"south",north:"down",south:"up"},east:{up:"south",down:"north",north:"up",south:"down"}},Qv={north:[-1,0,0],east:[0,1,0],up:[0,0,1],south:[1,0,0],west:[0,-1,0],down:[0,0,-1]},_v={east:new Nm,north:new Nm,up:new Nm,west:new Nm,south:new Nm,down:new Nm},zv=new Nm,Uv=new Nm,Nv=new Nm;function Gv(e,t,n,i,o,r){var a,s,l,c=Ov[t]&&Ov[t][n];rm(c&&(!i||i===c));var u=Vv.copy(o);if(gm(u.x,0,1e-14)&&gm(u.y,0,1e-14)){var h=Math.sign(u.z);a=zv.fromArray(Qv[t]),"east"!==t&&"west"!==t&&a.scale(h),s=Uv.fromArray(Qv[n]),"east"!==n&&"west"!==n&&s.scale(h),l=Nv.fromArray(Qv[i]),"east"!==i&&"west"!==i&&l.scale(h)}else{var d=_v.up,p=_v.east,f=_v.north;p.set(-u.y,u.x,0).normalize(),e.geodeticSurfaceNormal(u,d),f.copy(d).cross(p);var m=_v.west,v=_v.south;_v.down.copy(d).scale(-1),m.copy(p).scale(-1),v.copy(f).scale(-1),a=_v[t],s=_v[n],l=_v[i]}return r[0]=a.x,r[1]=a.y,r[2]=a.z,r[3]=0,r[4]=s.x,r[5]=s.y,r[6]=s.z,r[7]=0,r[8]=l.x,r[9]=l.y,r[10]=l.z,r[11]=0,r[12]=u.x,r[13]=u.y,r[14]=u.z,r[15]=1,r}var jv,Wv=new Nm,qv=new Nm,Jv=new Nm,Yv=new Nm,Zv=new Nm,Xv=new Nm,Kv=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;o(this,e),rm(t>=0),rm(n>=0),rm(i>=0),this.radii=new Nm(t,n,i),this.radiiSquared=new Nm(t*t,n*n,i*i),this.radiiToTheFourth=new Nm(t*t*t*t,n*n*n*n,i*i*i*i),this.oneOverRadii=new Nm(0===t?0:1/t,0===n?0:1/n,0===i?0:1/i),this.oneOverRadiiSquared=new Nm(0===t?0:1/(t*t),0===n?0:1/(n*n),0===i?0:1/(i*i)),this.minimumRadius=Math.min(t,n,i),this.maximumRadius=Math.max(t,n,i),this.centerToleranceSquared=Iv,0!==this.radiiSquared.z&&(this.squaredXOverSquaredZ=this.radiiSquared.x/this.radiiSquared.z),Object.freeze(this)}return u(e,[{key:"equals",value:function(e){return this===e||Boolean(e&&this.radii.equals(e.radii))}},{key:"toString",value:function(){return this.radii.toString()}},{key:"cartographicToCartesian",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[0,0,0],n=qv,i=Jv,o=fe(e,3),r=o[2];this.geodeticSurfaceNormalCartographic(e,n),i.copy(this.radiiSquared).scale(n);var a=Math.sqrt(n.dot(i));return i.scale(1/a),n.scale(r),i.add(n),i.to(t)}},{key:"cartesianToCartographic",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[0,0,0];Xv.from(e);var n=this.scaleToGeodeticSurface(Xv,Yv);if(n){var i=this.geodeticSurfaceNormal(n,qv),o=Zv;o.copy(Xv).subtract(n);var r=Math.atan2(i.y,i.x),a=Math.asin(i.z),s=Math.sign(Hm(o,Xv))*Lm(o);return Dv([r,a,s],t)}}},{key:"eastNorthUpToFixedFrame",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new sv;return Gv(this,"east","north","up",e,t)}},{key:"localFrameToFixedFrame",value:function(e,t,n,i){var o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:new sv;return Gv(this,e,t,n,i,o)}},{key:"geocentricSurfaceNormal",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[0,0,0];return Wv.from(e).normalize().to(t)}},{key:"geodeticSurfaceNormalCartographic",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[0,0,0],n=Sv(e),i=n[0],o=n[1],r=Math.cos(o);return Wv.set(r*Math.cos(i),r*Math.sin(i),Math.sin(o)).normalize(),Wv.to(t)}},{key:"geodeticSurfaceNormal",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[0,0,0];return Wv.from(e).scale(this.oneOverRadiiSquared).normalize().to(t)}},{key:"scaleToGeodeticSurface",value:function(e,t){return function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:new Nm,i=t.oneOverRadii,o=t.oneOverRadiiSquared,r=t.centerToleranceSquared;Lv.from(e);var a=e.x,s=e.y,l=e.z,c=i.x,u=i.y,h=i.z,d=a*a*c*c,p=s*s*u*u,f=l*l*h*h,m=d+p+f,v=Math.sqrt(1/m);if(Number.isFinite(v)){var g=Fv;if(g.copy(e).scale(v),m<r)return g.to(n);var y=o.x,A=o.y,E=o.z,b=Hv;b.set(g.x*y*2,g.y*A*2,g.z*E*2);var w,x,C,T,I=(1-v)*e.len()/(.5*b.len()),k=0;do{var B=(w=1/(1+(I-=k)*y))*w,P=(x=1/(1+I*A))*x,R=(C=1/(1+I*E))*C;k=(T=d*B+p*P+f*R-1)/(-2*(d*(B*w)*y+p*(P*x)*A+f*(R*C)*E))}while(Math.abs(T)>kv);return Lv.scale([w,x,C]).to(n)}}(e,this,t)}},{key:"scaleToGeocentricSurface",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[0,0,0];Yv.from(e);var n=Yv.x,i=Yv.y,o=Yv.z,r=this.oneOverRadiiSquared,a=1/Math.sqrt(n*n*r.x+i*i*r.y+o*o*r.z);return Yv.multiplyScalar(a).to(t)}},{key:"transformPositionToScaledSpace",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[0,0,0];return Yv.from(e).scale(this.oneOverRadii).to(t)}},{key:"transformPositionFromScaledSpace",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[0,0,0];return Yv.from(e).scale(this.radii).to(t)}},{key:"getSurfaceNormalIntersectionWithZAxis",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[0,0,0];rm(gm(this.radii.x,this.radii.y,Bv)),rm(this.radii.z>0),Yv.from(e);var i=Yv.z*(1-this.squaredXOverSquaredZ);if(!(Math.abs(i)>=this.radii.z-t))return Yv.set(0,0,i).to(n)}}],[{key:"WGS84",get:function(){return jv=jv||new e(6378137,6378137,6356752.314245179)}}]),e}(),$v=function e(t,n,i){o(this,e),Ad(this,"item",void 0),Ad(this,"previous",void 0),Ad(this,"next",void 0),this.item=t,this.previous=n,this.next=i},eg=function(){function e(){o(this,e),Ad(this,"head",null),Ad(this,"tail",null),Ad(this,"_length",0)}return u(e,[{key:"length",get:function(){return this._length}},{key:"add",value:function(e){var t=new $v(e,this.tail,null);return this.tail?(this.tail.next=t,this.tail=t):(this.head=t,this.tail=t),++this._length,t}},{key:"remove",value:function(e){e&&(e.previous&&e.next?(e.previous.next=e.next,e.next.previous=e.previous):e.previous?(e.previous.next=null,this.tail=e.previous):e.next?(e.next.previous=null,this.head=e.next):(this.head=null,this.tail=null),e.next=null,e.previous=null,--this._length)}},{key:"splice",value:function(e,t){e!==t&&(this.remove(t),this._insert(e,t))}},{key:"_insert",value:function(e,t){var n=e.next;e.next=t,this.tail===e?this.tail=t:n.previous=t,t.next=n,t.previous=e,++this._length}}]),e}();function tg(e){return null!=e}var ng=function(){function e(){o(this,e),Ad(this,"_list",void 0),Ad(this,"_sentinel",void 0),Ad(this,"_trimTiles",void 0),this._list=new eg,this._sentinel=this._list.add("sentinel"),this._trimTiles=!1}return u(e,[{key:"reset",value:function(){this._list.splice(this._list.tail,this._sentinel)}},{key:"touch",value:function(e){var t=e._cacheNode;tg(t)&&this._list.splice(this._sentinel,t)}},{key:"add",value:function(e,t,n){tg(t._cacheNode)||(t._cacheNode=this._list.add(t),n&&n(e,t))}},{key:"unloadTile",value:function(e,t,n){var i=t._cacheNode;tg(i)&&(this._list.remove(i),t._cacheNode=void 0,n&&n(e,t))}},{key:"unloadTiles",value:function(e,t){var n=this._trimTiles;this._trimTiles=!1;for(var i=this._list,o=1024*e.maximumMemoryUsage*1024,r=this._sentinel,a=i.head;a!==r&&(e.gpuMemoryUsageInBytes>o||n);){var s=a.item;a=a.next,this.unloadTile(e,s,t)}}},{key:"trim",value:function(){this._trimTiles=!0}}]),e}();var ig=Object.freeze({OUTSIDE:-1,INTERSECTING:0,INSIDE:1});new Nm,new Nm;var og=new Nm,rg=new Nm,ag=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[0,0,0],n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;o(this,e),this.radius=-0,this.center=new Nm,this.fromCenterRadius(t,n)}return u(e,[{key:"fromCenterRadius",value:function(e,t){return this.center.from(e),this.radius=t,this}},{key:"fromCornerPoints",value:function(e,t){return t=og.from(t),this.center=(new Nm).from(e).add(t).scale(.5),this.radius=this.center.distance(t),this}},{key:"equals",value:function(e){return this===e||Boolean(e)&&this.center.equals(e.center)&&this.radius===e.radius}},{key:"clone",value:function(){return new e(this.center,this.radius)}},{key:"union",value:function(e){var t=this.center,n=this.radius,i=e.center,o=e.radius,r=og.copy(i).subtract(t),a=r.magnitude();if(n>=a+o)return this.clone();if(o>=a+n)return e.clone();var s=.5*(n+a+o);return rg.copy(r).scale((-n+s)/a).add(t),this.center.copy(rg),this.radius=s,this}},{key:"expand",value:function(e){var t=(e=og.from(e)).subtract(this.center).magnitude();return t>this.radius&&(this.radius=t),this}},{key:"transform",value:function(e){this.center.transform(e);var t=function(e,t){var n=t[0],i=t[1],o=t[2],r=t[4],a=t[5],s=t[6],l=t[8],c=t[9],u=t[10];return e[0]=Math.hypot(n,i,o),e[1]=Math.hypot(r,a,s),e[2]=Math.hypot(l,c,u),e}(og,e);return this.radius=Math.max(t[0],Math.max(t[1],t[2]))*this.radius,this}},{key:"distanceSquaredTo",value:function(e){var t=this.distanceTo(e);return t*t}},{key:"distanceTo",value:function(e){var t=(e=og.from(e)).subtract(this.center);return Math.max(0,t.len()-this.radius)}},{key:"intersectPlane",value:function(e){var t=this.center,n=this.radius,i=e.normal.dot(t)+e.distance;return i<-n?ig.OUTSIDE:i<n?ig.INTERSECTING:ig.INSIDE}}]),e}(),sg=new Nm,lg=new Nm,cg=new Nm,ug=new Nm,hg=new Nm,dg=new Nm,pg=new Nm,fg=0,mg=1,vg=2,gg=3,yg=4,Ag=5,Eg=6,bg=7,wg=8,xg=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[0,0,0],n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[0,0,0,0,0,0,0,0,0];o(this,e),this.center=(new Nm).from(t),this.halfAxes=new Xm(n)}return u(e,[{key:"halfSize",get:function(){var e=this.halfAxes.getColumn(0),t=this.halfAxes.getColumn(1),n=this.halfAxes.getColumn(2);return[new Nm(e).len(),new Nm(t).len(),new Nm(n).len()]}},{key:"quaternion",get:function(){var e=this.halfAxes.getColumn(0),t=this.halfAxes.getColumn(1),n=this.halfAxes.getColumn(2),i=new Nm(e).normalize(),o=new Nm(t).normalize(),r=new Nm(n).normalize();return(new Tv).fromMatrix3(new Xm([].concat(H(i),H(o),H(r))))}},{key:"fromCenterHalfSizeQuaternion",value:function(e,t,n){var i=new Tv(n),o=(new Xm).fromQuaternion(i);return o[0]=o[0]*t[0],o[1]=o[1]*t[0],o[2]=o[2]*t[0],o[3]=o[3]*t[1],o[4]=o[4]*t[1],o[5]=o[5]*t[1],o[6]=o[6]*t[2],o[7]=o[7]*t[2],o[8]=o[8]*t[2],this.center=(new Nm).from(e),this.halfAxes=o,this}},{key:"clone",value:function(){return new e(this.center,this.halfAxes)}},{key:"equals",value:function(e){return this===e||Boolean(e)&&this.center.equals(e.center)&&this.halfAxes.equals(e.halfAxes)}},{key:"getBoundingSphere",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new ag,t=this.halfAxes,n=t.getColumn(0,cg),i=t.getColumn(1,ug),o=t.getColumn(2,hg),r=sg.copy(n).add(i).add(o);return e.center.copy(this.center),e.radius=r.magnitude(),e}},{key:"intersectPlane",value:function(e){var t=this.center,n=e.normal,i=this.halfAxes,o=n.x,r=n.y,a=n.z,s=Math.abs(o*i[fg]+r*i[mg]+a*i[vg])+Math.abs(o*i[gg]+r*i[yg]+a*i[Ag])+Math.abs(o*i[Eg]+r*i[bg]+a*i[wg]),l=n.dot(t)+e.distance;return l<=-s?ig.OUTSIDE:l>=s?ig.INSIDE:ig.INTERSECTING}},{key:"distanceTo",value:function(e){return Math.sqrt(this.distanceSquaredTo(e))}},{key:"distanceSquaredTo",value:function(e){var t=lg.from(e).subtract(this.center),n=this.halfAxes,i=n.getColumn(0,cg),o=n.getColumn(1,ug),r=n.getColumn(2,hg),a=i.magnitude(),s=o.magnitude(),l=r.magnitude();i.normalize(),o.normalize(),r.normalize();var c,u=0;return(c=Math.abs(t.dot(i))-a)>0&&(u+=c*c),(c=Math.abs(t.dot(o))-s)>0&&(u+=c*c),(c=Math.abs(t.dot(r))-l)>0&&(u+=c*c),u}},{key:"computePlaneDistances",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[-0,-0],i=Number.POSITIVE_INFINITY,o=Number.NEGATIVE_INFINITY,r=this.center,a=this.halfAxes,s=a.getColumn(0,cg),l=a.getColumn(1,ug),c=a.getColumn(2,hg),u=dg.copy(s).add(l).add(c).add(r),h=pg.copy(u).subtract(e),d=t.dot(h);return i=Math.min(d,i),o=Math.max(d,o),u.copy(r).add(s).add(l).subtract(c),h.copy(u).subtract(e),d=t.dot(h),i=Math.min(d,i),o=Math.max(d,o),u.copy(r).add(s).subtract(l).add(c),h.copy(u).subtract(e),d=t.dot(h),i=Math.min(d,i),o=Math.max(d,o),u.copy(r).add(s).subtract(l).subtract(c),h.copy(u).subtract(e),d=t.dot(h),i=Math.min(d,i),o=Math.max(d,o),r.copy(u).subtract(s).add(l).add(c),h.copy(u).subtract(e),d=t.dot(h),i=Math.min(d,i),o=Math.max(d,o),r.copy(u).subtract(s).add(l).subtract(c),h.copy(u).subtract(e),d=t.dot(h),i=Math.min(d,i),o=Math.max(d,o),r.copy(u).subtract(s).subtract(l).add(c),h.copy(u).subtract(e),d=t.dot(h),i=Math.min(d,i),o=Math.max(d,o),r.copy(u).subtract(s).subtract(l).subtract(c),h.copy(u).subtract(e),d=t.dot(h),i=Math.min(d,i),o=Math.max(d,o),n[0]=i,n[1]=o,n}},{key:"transform",value:function(e){this.center.transformAsPoint(e);var t=this.halfAxes.getColumn(0,cg);t.transformAsPoint(e);var n=this.halfAxes.getColumn(1,ug);n.transformAsPoint(e);var i=this.halfAxes.getColumn(2,hg);return i.transformAsPoint(e),this.halfAxes=new Xm([].concat(H(t),H(n),H(i))),this}},{key:"getTransform",value:function(){throw new Error("not implemented")}}]),e}(),Cg=new Nm,Tg=new Nm,Ig=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[0,0,1],n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;o(this,e),this.normal=new Nm,this.distance=-0,this.fromNormalDistance(t,n)}return u(e,[{key:"fromNormalDistance",value:function(e,t){return rm(Number.isFinite(t)),this.normal.from(e).normalize(),this.distance=t,this}},{key:"fromPointNormal",value:function(e,t){e=Cg.from(e),this.normal.from(t).normalize();var n=-this.normal.dot(e);return this.distance=n,this}},{key:"fromCoefficients",value:function(e,t,n,i){return this.normal.set(e,t,n),rm(gm(this.normal.len(),1)),this.distance=i,this}},{key:"clone",value:function(t){return new e(this.normal,this.distance)}},{key:"equals",value:function(e){return gm(this.distance,e.distance)&&gm(this.normal,e.normal)}},{key:"getPointDistance",value:function(e){return this.normal.dot(e)+this.distance}},{key:"transform",value:function(e){var t=Tg.copy(this.normal).transformAsVector(e).normalize(),n=this.normal.scale(-this.distance).transform(e);return this.fromPointNormal(n,t)}},{key:"projectPointOntoPlane",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[0,0,0];e=Cg.from(e);var n=this.getPointDistance(e),i=Tg.copy(this.normal).scale(n);return e.subtract(i).to(t)}}]),e}(),kg=[new Nm([1,0,0]),new Nm([0,1,0]),new Nm([0,0,1])],Bg=new Nm,Pg=new Nm;new Ig(new Nm(1,0,0),0);var Rg=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];o(this,e),this.planes=t,rm(this.planes.every((function(e){return e instanceof Ig})))}return u(e,[{key:"fromBoundingSphere",value:function(e){this.planes.length=2*kg.length;var t,n=e.center,i=e.radius,o=0,r=td(kg);try{for(r.s();!(t=r.n()).done;){var a=t.value,s=this.planes[o],l=this.planes[o+1];s||(s=this.planes[o]=new Ig),l||(l=this.planes[o+1]=new Ig);var c=Bg.copy(a).scale(-i).add(n);a.dot(c),s.fromPointNormal(c,a);var u=Bg.copy(a).scale(i).add(n),h=Pg.copy(a).negate();h.dot(u),l.fromPointNormal(u,h),o+=2}}catch(e){r.e(e)}finally{r.f()}return this}},{key:"computeVisibility",value:function(e){rm(e);var t,n=ig.INSIDE,i=td(this.planes);try{for(i.s();!(t=i.n()).done;){var o=t.value;switch(e.intersectPlane(o)){case ig.OUTSIDE:return ig.OUTSIDE;case ig.INTERSECTING:n=ig.INTERSECTING}}}catch(e){i.e(e)}finally{i.f()}return n}},{key:"computeVisibilityWithPlaneMask",value:function(t,n){if(rm(t,"boundingVolume is required."),rm(Number.isFinite(n),"parentPlaneMask is required."),n===e.MASK_OUTSIDE||n===e.MASK_INSIDE)return n;for(var i=e.MASK_INSIDE,o=this.planes,r=0;r<this.planes.length;++r){var a=r<31?1<<r:0;if(!(r<31&&0==(n&a))){var s=o[r],l=t.intersectPlane(s);if(l===ig.OUTSIDE)return e.MASK_OUTSIDE;l===ig.INTERSECTING&&(i|=a)}}return i}}],[{key:"MASK_OUTSIDE",get:function(){return 4294967295}},{key:"MASK_INSIDE",get:function(){return 0}},{key:"MASK_INDETERMINATE",get:function(){return 2147483647}}]),e}(),Mg=new Nm,Sg=new Nm,Dg=new Nm,Lg=new Nm,Fg=new Nm,Hg=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};o(this,e),t=od({near:1,far:5e8},t),this.left=t.left,this._left=void 0,this.right=t.right,this._right=void 0,this.top=t.top,this._top=void 0,this.bottom=t.bottom,this._bottom=void 0,this.near=t.near,this._near=this.near,this.far=t.far,this._far=this.far,this._cullingVolume=new Rg([new Ig,new Ig,new Ig,new Ig,new Ig,new Ig]),this._perspectiveMatrix=new sv,this._infinitePerspective=new sv}return u(e,[{key:"clone",value:function(){return new e({right:this.right,left:this.left,top:this.top,bottom:this.bottom,near:this.near,far:this.far})}},{key:"equals",value:function(t){return t&&t instanceof e&&this.right===t.right&&this.left===t.left&&this.top===t.top&&this.bottom===t.bottom&&this.near===t.near&&this.far===t.far}},{key:"projectionMatrix",get:function(){return Vg(this),this._perspectiveMatrix}},{key:"infiniteProjectionMatrix",get:function(){return Vg(this),this._infinitePerspective}},{key:"computeCullingVolume",value:function(e,t,n){rm(e,"position is required."),rm(t,"direction is required."),rm(n,"up is required.");var i=this._cullingVolume.planes;n=Mg.copy(n).normalize();var o=Sg.copy(t).cross(n).normalize(),r=Dg.copy(t).multiplyByScalar(this.near).add(e),a=Lg.copy(t).multiplyByScalar(this.far).add(e),s=Fg;return s.copy(o).multiplyByScalar(this.left).add(r).subtract(e).cross(n),i[0].fromPointNormal(e,s),s.copy(o).multiplyByScalar(this.right).add(r).subtract(e).cross(n).negate(),i[1].fromPointNormal(e,s),s.copy(n).multiplyByScalar(this.bottom).add(r).subtract(e).cross(o).negate(),i[2].fromPointNormal(e,s),s.copy(n).multiplyByScalar(this.top).add(r).subtract(e).cross(o),i[3].fromPointNormal(e,s),s=(new Nm).copy(t),i[4].fromPointNormal(r,s),s.negate(),i[5].fromPointNormal(a,s),this._cullingVolume}},{key:"getPixelDimensions",value:function(e,t,n,i){Vg(this),rm(Number.isFinite(e)&&Number.isFinite(t)),rm(e>0),rm(t>0),rm(n>0),rm(i);var o=1/this.near,r=this.top*o,a=2*n*r/t,s=2*n*(r=this.right*o)/e;return i.x=s,i.y=a,i}}]),e}();function Vg(e){rm(Number.isFinite(e.right)&&Number.isFinite(e.left)&&Number.isFinite(e.top)&&Number.isFinite(e.bottom)&&Number.isFinite(e.near)&&Number.isFinite(e.far));var t=e.top,n=e.bottom,i=e.right,o=e.left,r=e.near,a=e.far;t===e._top&&n===e._bottom&&o===e._left&&i===e._right&&r===e._near&&a===e._far||(rm(e.near>0&&e.near<e.far,"near must be greater than zero and less than far."),e._left=o,e._right=i,e._top=t,e._bottom=n,e._near=r,e._far=a,e._perspectiveMatrix=(new sv).frustum({left:o,right:i,bottom:n,top:t,near:r,far:a}),e._infinitePerspective=(new sv).frustum({left:o,right:i,bottom:n,top:t,near:r,far:1/0}))}var Og=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};o(this,e),t=od({near:1,far:5e8,xOffset:0,yOffset:0},t),this.type=t.type,this._offCenterFrustum=new Hg,this.fov=t.fov,this._fov=void 0,this._fovy=void 0,this._sseDenominator=void 0,this.aspectRatio=t.aspectRatio,this._aspectRatio=void 0,this.near=t.near,this._near=this.near,this.far=t.far,this._far=this.far,this.xOffset=t.xOffset,this._xOffset=this.xOffset,this.yOffset=t.yOffset,this._yOffset=this.yOffset}return u(e,[{key:"clone",value:function(){return new e({aspectRatio:this.aspectRatio,fov:this.fov,near:this.near,far:this.far})}},{key:"equals",value:function(t){return null!=t&&t instanceof e&&(Qg(this),Qg(t),this.fov===t.fov&&this.aspectRatio===t.aspectRatio&&this.near===t.near&&this.far===t.far&&this._offCenterFrustum.equals(t._offCenterFrustum))}},{key:"projectionMatrix",get:function(){return Qg(this),this._offCenterFrustum.projectionMatrix}},{key:"infiniteProjectionMatrix",get:function(){return Qg(this),this._offCenterFrustum.infiniteProjectionMatrix}},{key:"fovy",get:function(){return Qg(this),this._fovy}},{key:"sseDenominator",get:function(){return Qg(this),this._sseDenominator}},{key:"computeCullingVolume",value:function(e,t,n){return Qg(this),this._offCenterFrustum.computeCullingVolume(e,t,n)}},{key:"getPixelDimensions",value:function(e,t,n,i){return Qg(this),this._offCenterFrustum.getPixelDimensions(e,t,n,i)}}]),e}();function Qg(e){rm(Number.isFinite(e.fov)&&Number.isFinite(e.aspectRatio)&&Number.isFinite(e.near)&&Number.isFinite(e.far));var t=e._offCenterFrustum;e.fov===e._fov&&e.aspectRatio===e._aspectRatio&&e.near===e._near&&e.far===e._far&&e.xOffset===e._xOffset&&e.yOffset===e._yOffset||(rm(e.fov>=0&&e.fov<Math.PI),rm(e.aspectRatio>0),rm(e.near>=0&&e.near<e.far),e._aspectRatio=e.aspectRatio,e._fov=e.fov,e._fovy=e.aspectRatio<=1?e.fov:2*Math.atan(Math.tan(.5*e.fov)/e.aspectRatio),e._near=e.near,e._far=e.far,e._sseDenominator=2*Math.tan(.5*e._fovy),e._xOffset=e.xOffset,e._yOffset=e.yOffset,t.top=e.near*Math.tan(.5*e._fovy),t.bottom=-t.top,t.right=e.aspectRatio*t.top,t.left=-t.right,t.near=e.near,t.far=e.far,t.right+=e.xOffset,t.left+=e.xOffset,t.top+=e.yOffset,t.bottom+=e.yOffset)}new Nm,new Nm,new Nm,new Nm,new Nm,new Nm,new Nm,new Nm,new Nm,new Nm,new Nm,new Nm,new Xm,new Xm,new Xm,new Xm,new Xm,new Nm,new Nm,new Nm,new Nm,new Nm,new Xm,new Xm,new Xm;var _g=new Nm,zg=new Nm,Ug=new Rg([new Ig,new Ig,new Ig,new Ig,new Ig,new Ig]);function Ng(e,t){var n=e.cameraDirection,i=e.cameraUp,o=e.height,r=e.distanceScales.metersPerUnit,a=e.unprojectPosition(e.center),s=Kv.WGS84.cartographicToCartesian(a,new Nm),l=Kv.WGS84.eastNorthUpToFixedFrame(s),c=e.unprojectPosition(e.cameraPosition),u=Kv.WGS84.cartographicToCartesian(c,new Nm),h=new Nm(l.transformAsVector(new Nm(n).scale(r))).normalize(),d=new Nm(l.transformAsVector(new Nm(i).scale(r))).normalize();return function(e,t){var n=e.getFrustumPlanes(),i=0;for(var o in n){var r=n[o],a=r.normal.dot(e.center);zg.copy(r.normal).scale(r.distance-a).add(e.center);var s=e.unprojectPosition(zg),l=Kv.WGS84.cartographicToCartesian(s,new Nm);Ug.planes[i++].fromPointNormal(l,_g.copy(t).subtract(l))}}(e,s),{camera:{position:u,direction:h,up:d},viewport:e,height:o,cullingVolume:Ug,frameNumber:t,sseDenominator:1.15}}var Gg=6356752.314245179,jg=new Nm;function Wg(e){var t=e.halfAxes,n=e.radius,i=e.width,o=e.height;if(t){var r=function(e){e.getColumn(0,jg);var t=e.getColumn(1),n=e.getColumn(2);return jg.add(t).add(n).len()}(t);return Math.log2(Gg/r)}return n?Math.log2(Gg/n):o&&i?(Math.log2(6378137/i)+Math.log2(6378137/o))/2:1}var qg=0,Jg=1,Yg=3,Zg=4,Xg=5,Kg=1,$g=2,ey="empty",ty="scenegraph",ny="pointcloud",iy="mesh",oy="I3S",ry="TILES3D",ay="geometricError",sy=1;function ly(e){return null!=e}var cy=new Nm,uy=new Nm,hy=new Nm;function dy(e,t,n){if(ld(e,"3D Tile: boundingVolume must be defined"),e.box)return function(e,t,n){var i=new Nm(e[0],e[1],-e[2]);t.transform(i,i);var o=[];if(10===e.length){var r=e.slice(3,6),a=new Tv;a.fromArray(e,6);var s=new Nm([1,0,0]),l=new Nm([0,1,0]),c=new Nm([0,0,1]);s.transformByQuaternion(a),s.scale(r[0]),l.transformByQuaternion(a),l.scale(r[1]),c.transformByQuaternion(a),c.scale(r[2]),o=[].concat(H(s.toArray()),H(l.toArray()),H(c.toArray()))}else o=[].concat(H(e.slice(3,6)),H(e.slice(6,9)),H(e.slice(9,12)));var u=t.transformAsVector(o.slice(0,3)),h=t.transformAsVector(o.slice(3,6)),d=t.transformAsVector(o.slice(6,9)),p=new Xm([u[0],u[1],u[2],h[0],h[1],h[2],d[0],d[1],d[2]]);if(ly(n))return n.center=i,n.halfAxes=p,n;return new xg(i,p)}(e.box,t,n);if(e.region){var i=fe(e.region,6),o=i[0],r=i[1],a=i[2],s=i[3],l=i[4],c=i[5],u=Kv.WGS84.cartographicToCartesian([mm(o),mm(s),l],uy),h=Kv.WGS84.cartographicToCartesian([mm(a),mm(r),c],hy),d=(new Nm).addVectors(u,h).multiplyScalar(.5),p=(new Nm).subVectors(u,h).len()/2;return py([d[0],d[1],d[2],p],new sv)}if(e.sphere)return py(e.sphere,t,n);throw new Error("3D Tile: boundingVolume must contain a sphere, region, or box")}function py(e,t,n){var i=new Nm(e[0],e[1],e[2]);t.transform(i,i);var o=t.getScale(cy),r=Math.max(Math.max(o[0],o[1]),o[2]),a=e[3]*r;return ly(n)?(n.center=i,n.radius=a,n):new ag(i,a)}function fy(e,t){if(e.dynamicScreenSpaceError&&e.dynamicScreenSpaceErrorComputedDensity){var n=e.dynamicScreenSpaceErrorComputedDensity,i=e.dynamicScreenSpaceErrorFactor;return function(e,t){var n=e*t;return 1-Math.exp(-n*n)}(t,n)*i}return 0}function my(e,t){var n=t.viewport,i=new(0,n.constructor)({longitude:n.longitude,latitude:n.latitude,height:n.height,width:n.width,bearing:n.bearing,zoom:n.zoom,pitch:0}),o=e.header.mbs[1],r=e.header.mbs[0],a=e.header.mbs[2],s=e.header.mbs[3],l=H(e.boundingVolume.center),c=i.unprojectPosition(i.cameraPosition),u=Kv.WGS84.cartographicToCartesian(c,new Nm),h=new Nm(u).subtract(l).normalize(),d=new sv;Kv.WGS84.eastNorthUpToFixedFrame(l,d);var p=new sv(d).invert(),f=new Nm(u).transform(p),m=Math.sqrt(f[0]*f[0]+f[1]*f[1]),v=m*m/f[2],g=new Nm([f[0],f[1],v]).transform(d),y=new Nm(g).subtract(l).normalize(),A=h.cross(y).normalize().scale(s),E=new Nm(l).add(A),b=Kv.WGS84.cartesianToCartographic(E),w=i.project([r,o,a]),x=i.project(b);return new Nm(w).subtract(x).magnitude()}new Nm,new Nm,new sv,new Nm,new Nm,new Nm;var vy=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;o(this,e),Ad(this,"_map",new Map),Ad(this,"_array",void 0),Ad(this,"_length",void 0),this._array=new Array(t),this._length=t}return u(e,[{key:"length",get:function(){return this._length},set:function(e){this._length=e,e>this._array.length&&(this._array.length=e)}},{key:"values",get:function(){return this._array}},{key:"get",value:function(e){return ld(e<this._array.length),this._array[e]}},{key:"set",value:function(e,t){ld(e>=0),e>=this.length&&(this.length=e+1),this._map.has(this._array[e])&&this._map.delete(this._array[e]),this._array[e]=t,this._map.set(t,e)}},{key:"delete",value:function(e){var t=this._map.get(e);t>=0&&(this._array.splice(t,1),this._map.delete(e),this.length--)}},{key:"peek",value:function(){return this._array[this._length-1]}},{key:"push",value:function(e){if(!this._map.has(e)){var t=this.length++;this._array[t]=e,this._map.set(e,t)}}},{key:"pop",value:function(){var e=this._array[--this.length];return this._map.delete(e),e}},{key:"reserve",value:function(e){ld(e>=0),e>this._array.length&&(this._array.length=e)}},{key:"resize",value:function(e){ld(e>=0),this.length=e}},{key:"trim",value:function(e){null==e&&(e=this.length),this._array.length=e}},{key:"reset",value:function(){this._array=[],this._map=new Map,this._length=0}},{key:"find",value:function(e){return this._map.has(e)}}]),e}(),gy={loadSiblings:!1,skipLevelOfDetail:!1,maximumScreenSpaceError:2,updateTransforms:!0,onTraversalEnd:function(){},viewportTraversersMap:{},basePath:""},yy=function(){function e(t){o(this,e),Ad(this,"options",void 0),Ad(this,"root",void 0),Ad(this,"requestedTiles",void 0),Ad(this,"selectedTiles",void 0),Ad(this,"emptyTiles",void 0),Ad(this,"_traversalStack",void 0),Ad(this,"_emptyTraversalStack",void 0),Ad(this,"_frameNumber",void 0),this.options=od(od({},gy),t),this._traversalStack=new vy,this._emptyTraversalStack=new vy,this._frameNumber=null,this.root=null,this.selectedTiles={},this.requestedTiles={},this.emptyTiles={}}return u(e,[{key:"traverse",value:function(e,t,n){this.root=e,this.options=od(od({},this.options),n),this.reset(),this.updateTile(e,t),this._frameNumber=t.frameNumber,this.executeTraversal(e,t)}},{key:"reset",value:function(){this.requestedTiles={},this.selectedTiles={},this.emptyTiles={},this._traversalStack.reset(),this._emptyTraversalStack.reset()}},{key:"executeTraversal",value:function(e,t){var n=this._traversalStack;for(e._selectionDepth=1,n.push(e);n.length>0;){var i=n.pop(),o=!1,r="all"==i.tileset.options.currentFloorId||null==i.floorIndex||i.floorIndex==i.tileset.options.currentFloorId;this.canTraverse(i,t)&&r&&(this.updateChildTiles(i,t),o=this.updateAndPushChildren(i,t,n,i.hasRenderContent?i._selectionDepth+1:i._selectionDepth));var a=i.parent,s=Boolean(!a||a._shouldRefine),l=!o;i.hasRenderContent?i.refine===Kg?(this.loadTile(i,t),this.selectTile(i,t)):i.refine===$g&&(this.loadTile(i,t),l&&this.selectTile(i,t)):(this.emptyTiles[i.id]=i,this.loadTile(i,t),l&&this.selectTile(i,t)),this.touchTile(i,t),i._shouldRefine=o&&s}this.options.onTraversalEnd(t)}},{key:"updateChildTiles",value:function(e,t){var n,i=td(e.children);try{for(i.s();!(n=i.n()).done;){var o=n.value;this.updateTile(o,t)}}catch(e){i.e(e)}finally{i.f()}return!0}},{key:"updateAndPushChildren",value:function(e,t,n,i){var o=this.options,r=o.loadSiblings,a=o.skipLevelOfDetail,s=e.children;s.sort(this.compareDistanceToCamera.bind(this)).reverse();var l,c=e.refine===$g&&e.hasRenderContent&&!a,u=!1,h=!0,d=td(s);try{for(d.s();!(l=d.n()).done;){var p=l.value;if(p._selectionDepth=i,n.find(p)&&n.delete(p),n.push(p),p.isVisibleAndInRequestVolume?u=!0:(c||r)&&(this.loadTile(p,t),this.touchTile(p,t)),c){var f=void 0;if(f=!!p._inRequestVolume&&(p.hasRenderContent?p.contentAvailable:this.executeEmptyTraversal(p,t)),!(h=h&&f))return!1}}}catch(e){d.e(e)}finally{d.f()}return u||(h=!1),h}},{key:"updateTile",value:function(e,t){this.updateTileVisibility(e,t)}},{key:"selectTile",value:function(e,t){this.shouldSelectTile(e)&&(e._selectedFrame=t.frameNumber,this.selectedTiles[e.id]=e)}},{key:"loadTile",value:function(e,t){this.shouldLoadTile(e)&&(e._requestedFrame=t.frameNumber,e._priority=e._getPriority(),this.requestedTiles[e.id]=e)}},{key:"touchTile",value:function(e,t){e.tileset._cache.touch(e),e._touchedFrame=t.frameNumber}},{key:"canTraverse",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(!e.hasChildren)return!1;var i=e.tileset.options.modelSize;return!(Fe.detectIOS()&&i&&i.x*i.y*i.z>1e6&&!e.children[0].hasChildren)&&(e.hasTilesetContent?!e.contentExpired:this.shouldRefine(e,t,n))}},{key:"shouldLoadTile",value:function(e){return e.hasUnloadedContent||e.contentExpired}},{key:"shouldSelectTile",value:function(e){return e.contentAvailable&&!this.options.skipLevelOfDetail}},{key:"shouldRefine",value:function(e,t,n){if(e.tileset.options.loadMaxLevelDirect)return!0;var i=e._screenSpaceError;return n&&(i=e.getScreenSpaceError(t,!0)),i>this.options.maximumScreenSpaceError}},{key:"updateTileVisibility",value:function(e,t){var n=[];if(this.options.viewportTraversersMap)for(var i in this.options.viewportTraversersMap){this.options.viewportTraversersMap[i]===t.viewport.id&&n.push(i)}else n.push(t.viewport.id);e.updateVisibility(t,n)}},{key:"compareDistanceToCamera",value:function(e,t){return e._distanceToCamera-t._distanceToCamera}},{key:"anyChildrenVisible",value:function(e,t){var n,i=!1,o=td(e.children);try{for(o.s();!(n=o.n()).done;){var r=n.value;r.updateVisibility(t),i=i||r.isVisibleAndInRequestVolume}}catch(e){o.e(e)}finally{o.f()}return i}},{key:"executeEmptyTraversal",value:function(e,t){var n=!0,i=this._emptyTraversalStack;for(i.push(e);i.length>0&&n;){var o=i.pop();if(this.updateTile(o,t),o.isVisibleAndInRequestVolume||this.loadTile(o,t),this.touchTile(o,t),!o.hasRenderContent&&this.canTraverse(o,t,!1,!0)){var r,a=td(o.children);try{for(a.s();!(r=a.n()).done;){var s=r.value;i.find(s)&&i.delete(s),i.push(s)}}catch(e){a.e(e)}finally{a.f()}}else o.contentAvailable||(n=!1)}return n}}]),e}(),Ay=new Nm;var Ey=function(){function e(t,n,i){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"";o(this,e),Ad(this,"tileset",void 0),Ad(this,"header",void 0),Ad(this,"id",void 0),Ad(this,"url",void 0),Ad(this,"parent",void 0),Ad(this,"refine",void 0),Ad(this,"type",void 0),Ad(this,"contentUrl",void 0),Ad(this,"lodMetricType",void 0),Ad(this,"lodMetricValue",void 0),Ad(this,"boundingVolume",void 0),Ad(this,"content",void 0),Ad(this,"contentState",void 0),Ad(this,"gpuMemoryUsageInBytes",void 0),Ad(this,"children",void 0),Ad(this,"depth",void 0),Ad(this,"viewportIds",void 0),Ad(this,"transform",void 0),Ad(this,"extensions",void 0),Ad(this,"userData",void 0),Ad(this,"computedTransform",void 0),Ad(this,"hasEmptyContent",void 0),Ad(this,"hasTilesetContent",void 0),Ad(this,"traverser",void 0),Ad(this,"_cacheNode",void 0),Ad(this,"_frameNumber",void 0),Ad(this,"_lodJudge",void 0),Ad(this,"_expireDate",void 0),Ad(this,"_expiredContent",void 0),Ad(this,"_shouldRefine",void 0),Ad(this,"_distanceToCamera",void 0),Ad(this,"_centerZDepth",void 0),Ad(this,"_screenSpaceError",void 0),Ad(this,"_visibilityPlaneMask",void 0),Ad(this,"_visible",void 0),Ad(this,"_inRequestVolume",void 0),Ad(this,"_stackLength",void 0),Ad(this,"_selectionDepth",void 0),Ad(this,"_touchedFrame",void 0),Ad(this,"_visitedFrame",void 0),Ad(this,"_selectedFrame",void 0),Ad(this,"_requestedFrame",void 0),Ad(this,"_priority",void 0),Ad(this,"_contentBoundingVolume",void 0),Ad(this,"_viewerRequestVolume",void 0),Ad(this,"_initialTransform",void 0),Ad(this,"floorIndex",void 0),this.header=n,this.tileset=t,this.id=r||n.id,this.url=n.url,this.parent=i,this.refine=this._getRefine(n.refine),this.type=n.type,this.contentUrl=n.contentUrl,this.lodMetricType="geometricError",this.lodMetricValue=0,this.boundingVolume=null,this.content=null,this.contentState=qg,this.gpuMemoryUsageInBytes=0,this.children=[],this.hasEmptyContent=!1,this.hasTilesetContent=!1,this.depth=0,this.viewportIds=[],this.userData={},this.extensions=null,this._priority=0,this._touchedFrame=0,this._visitedFrame=0,this._selectedFrame=0,this._requestedFrame=0,this._screenSpaceError=0,this._cacheNode=null,this._frameNumber=null,this._cacheNode=null,this.traverser=new yy({}),this._shouldRefine=!1,this._distanceToCamera=0,this._centerZDepth=0,this._visible=void 0,this._inRequestVolume=!1,this._stackLength=0,this._selectionDepth=0,this._initialTransform=new sv,this.transform=new sv,this.controller=null,this._initializeLodMetric(n),this._initializeTransforms(n),this._initializeBoundingVolumes(n),this._initializeContent(n),this._initializeRenderingState(n),this._lodJudge=null,this._expireDate=null,this._expiredContent=null,Object.seal(this)}var t;return u(e,[{key:"destroy",value:function(){this.header=null}},{key:"isDestroyed",value:function(){return null===this.header}},{key:"selected",get:function(){return this._selectedFrame===this.tileset._frameNumber}},{key:"isVisible",get:function(){return this._visible}},{key:"isVisibleAndInRequestVolume",get:function(){return this.tileset.visible&&this._visible&&this._inRequestVolume}},{key:"hasRenderContent",get:function(){return!this.hasEmptyContent&&!this.hasTilesetContent}},{key:"hasChildren",get:function(){return this.children.length>0||this.header.children&&this.header.children.length>0}},{key:"contentReady",get:function(){return this.contentState===Yg||this.hasEmptyContent}},{key:"contentAvailable",get:function(){return Boolean(this.contentReady&&this.hasRenderContent||this._expiredContent&&!this.contentFailed)}},{key:"hasUnloadedContent",get:function(){return this.hasRenderContent&&this.contentUnloaded}},{key:"contentUnloaded",get:function(){return this.contentState===qg}},{key:"contentExpired",get:function(){return this.contentState===Zg}},{key:"contentFailed",get:function(){return this.contentState===Xg}},{key:"getScreenSpaceError",value:function(e,t){switch(this.tileset.type){case oy:return my(this,e);case ry:return function(e,t,n){var i=e.tileset,o=e.parent&&e.parent.lodMetricValue||e.lodMetricValue,r=n?o:e.lodMetricValue;if(0===r)return 0;var a="OrthographicCamera"==t.camera.type?1:Math.max(e._distanceToCamera,1e-7),s=t.height,l=t.sseDenominator,c=r*s*(i.options.viewDistanceScale||1)/(a*l);return c-fy(i,a)}(this,e,t);default:throw new Error("Unsupported tileset type")}}},{key:"_getPriority",value:function(){var e=this.tileset._traverser,t=e.options.skipLevelOfDetail,n=this.refine===Kg||t;if(n&&!this.isVisible&&void 0!==this._visible)return-1;if(this.tileset._frameNumber-this._touchedFrame>=1)return-1;if(this.contentState===qg)return-1;var i=this.parent,o=i&&(!n||0===this._screenSpaceError||i.hasTilesetContent)?i._screenSpaceError:this._screenSpaceError,r=e.root?e.root._screenSpaceError:0;return Math.max(r-o,0)}},{key:"loadContent",value:(t=k(S.mark((function e(){var t,n,i,o;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.hasEmptyContent){e.next=2;break}return e.abrupt("return",!1);case 2:if(!this.content){e.next=4;break}return e.abrupt("return",!0);case 4:return this.contentExpired&&(this._expireDate=null),this.contentState=Jg,e.next=9,this.tileset._requestScheduler.scheduleRequest(this.id,this._getPriority.bind(this));case 9:if(t=e.sent){e.next=13;break}return this.contentState=qg,e.abrupt("return",!1);case 13:return e.prev=13,this.controller=new AbortController,n=this.tileset.getTileUrl(this.contentUrl)+"?_=".concat(this.tileset.options.imageVersion),i=this.tileset.loader,o=od(od({},this.tileset.loadOptions),{},{fetch:{signal:this.controller.signal},[i.id]:od(od({},this.tileset.loadOptions[i.id]),{},{isTileset:"json"===this.type},this._getLoaderSpecificOptions(i.id))}),e.next=20,im(n,i,o);case 20:if(this.content=e.sent,"glTF"==this.content.type&&(this.content.byteLength=this.content.gltf.buffers[0].byteLength),!this.tileset.options.contentLoader){e.next=25;break}return e.next=25,this.tileset.options.contentLoader(this);case 25:return this._isTileset()&&this.tileset._initializeTileHeaders(this.content,this),this.contentState=Yg,this._onContentLoaded(),e.abrupt("return",!0);case 31:if(e.prev=31,e.t0=e.catch(13),!(e.t0.message.indexOf("The user aborted a request")>-1)){e.next=36;break}return this.contentState=qg,e.abrupt("return",!1);case 36:throw this.contentState=Xg,e.t0;case 38:return e.prev=38,t.done(),e.finish(38);case 41:case"end":return e.stop()}}),e,this,[[13,31,38,41]])}))),function(){return t.apply(this,arguments)})},{key:"unloadContent",value:function(){return this.content&&this.content.destroy&&this.content.destroy(),this.content=null,this.header.content&&this.header.content.destroy&&this.header.content.destroy(),this.header.content=null,this.contentState=qg,!0}},{key:"updateVisibility",value:function(e,t){if(this._frameNumber!==e.frameNumber){var n=this.parent,i=n?n._visibilityPlaneMask:Rg.MASK_INDETERMINATE;if(this.tileset._traverser.options.updateTransforms){var o=n?n.computedTransform:this.tileset.modelMatrix;this._updateTransform(o)}this._distanceToCamera=this.distanceToTile(e),this._screenSpaceError=this.getScreenSpaceError(e,!1),this._visibilityPlaneMask=this.visibility(e,i),this._visible=this._visibilityPlaneMask!==Rg.MASK_OUTSIDE,this._inRequestVolume=this.insideViewerRequestVolume(e),this._frameNumber=e.frameNumber,this.viewportIds=t}}},{key:"visibility",value:function(e,t){var n=e.cullingVolume,i=this.boundingVolume;return n.computeVisibilityWithPlaneMask(i,t)}},{key:"contentVisibility",value:function(){return!0}},{key:"distanceToTile",value:function(e){var t=this.boundingVolume;return Math.sqrt(Math.max(t.distanceSquaredTo(e.camera.position),0))}},{key:"cameraSpaceZDepth",value:function(e){var t=e.camera,n=this.boundingVolume;return Ay.subVectors(n.center,t.position),t.direction.dot(Ay)}},{key:"insideViewerRequestVolume",value:function(e){var t=this._viewerRequestVolume;return!t||t.distanceSquaredTo(e.camera.position)<=0}},{key:"updateExpiration",value:function(){if(function(e){return null!=e}(this._expireDate)&&this.contentReady&&!this.hasEmptyContent){var e=Date.now();Date.lessThan(this._expireDate,e)&&(this.contentState=Zg,this._expiredContent=this.content)}}},{key:"extras",get:function(){return this.header.extras}},{key:"_initializeLodMetric",value:function(e){"lodMetricType"in e?this.lodMetricType=e.lodMetricType:(this.lodMetricType=this.parent&&this.parent.lodMetricType||this.tileset.lodMetricType,console.warn("3D Tile: Required prop lodMetricType is undefined. Using parent lodMetricType")),"lodMetricValue"in e?this.lodMetricValue=e.lodMetricValue:(this.lodMetricValue=this.parent&&this.parent.lodMetricValue||this.tileset.lodMetricValue,console.warn("3D Tile: Required prop lodMetricValue is undefined. Using parent lodMetricValue"))}},{key:"_initializeTransforms",value:function(e){this.transform=e.transform?new sv(e.transform):new sv;var t=this.parent,n=this.tileset,i=t&&t.computedTransform?t.computedTransform.clone():n.modelMatrix.clone();this.computedTransform=new sv(i).multiplyRight(this.transform);var o=t&&t._initialTransform?t._initialTransform.clone():new sv;this._initialTransform=new sv(o).multiplyRight(this.transform)}},{key:"_initializeBoundingVolumes",value:function(e){this._contentBoundingVolume=null,this._viewerRequestVolume=null,this._updateBoundingVolume(e)}},{key:"_initializeContent",value:function(e){this.content={_tileset:this.tileset,_tile:this},this.hasEmptyContent=!0,this.contentState=qg,this.hasTilesetContent=!1,e.contentUrl&&(this.content=null,this.hasEmptyContent=!1)}},{key:"_initializeRenderingState",value:function(e){this.depth=e.level||(this.parent?this.parent.depth+1:0),this._shouldRefine=!1,this._distanceToCamera=0,this._centerZDepth=0,this._screenSpaceError=0,this._visibilityPlaneMask=Rg.MASK_INDETERMINATE,this._visible=void 0,this._inRequestVolume=!1,this._stackLength=0,this._selectionDepth=0,this._frameNumber=0,this._touchedFrame=0,this._visitedFrame=0,this._selectedFrame=0,this._requestedFrame=0,this._priority=0}},{key:"_getRefine",value:function(e){return e||this.parent&&this.parent.refine||$g}},{key:"_isTileset",value:function(){return-1!==this.contentUrl.indexOf(".json")}},{key:"_onContentLoaded",value:function(){switch(this.content&&this.content.type){case"vctr":case"geom":this.tileset._traverser.disableSkipLevelOfDetail=!0}this._isTileset()&&(this.hasTilesetContent=!0)}},{key:"_updateBoundingVolume",value:function(e){this.boundingVolume=dy(e.boundingVolume,this.computedTransform,this.boundingVolume);var t=e.content;t&&(t.boundingVolume&&(this._contentBoundingVolume=dy(t.boundingVolume,this.computedTransform,this._contentBoundingVolume)),e.viewerRequestVolume&&(this._viewerRequestVolume=dy(e.viewerRequestVolume,this.computedTransform,this._viewerRequestVolume)))}},{key:"_updateTransform",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new sv,t=e.clone().multiplyRight(this.transform),n=!t.equals(this.computedTransform);n&&(this.computedTransform=t,this._updateBoundingVolume(this.header))}},{key:"_getLoaderSpecificOptions",value:function(e){switch(e){case"i3s":return od(od({},this.tileset.options.i3s),{},{tile:this.header,tileset:this.tileset.tileset,isTileHeader:!1});case"3d-tiles":case"cesium-ion":default:return{assetGltfUpAxis:(t=this.tileset.tileset).asset&&t.asset.gltfUpAxis||"Y"}}var t}}]),e}(),by=function(e){f(n,e);var t=Xh(n);function n(){return o(this,n),t.apply(this,arguments)}return u(n,[{key:"compareDistanceToCamera",value:function(e,t){return 0===t._distanceToCamera&&0===e._distanceToCamera?t._centerZDepth-e._centerZDepth:t._distanceToCamera-e._distanceToCamera}},{key:"updateTileVisibility",value:function(e,t){if(Tt(w(n.prototype),"updateTileVisibility",this).call(this,e,t),this.options.ingoreVisibleCompute)e._visible=!0;else if(e.isVisibleAndInRequestVolume){var i=e.children.length>0;if(e.hasTilesetContent&&i){var o=e.children[0];return this.updateTileVisibility(o,t),void(e._visible=o._visible)}if(this.meetsScreenSpaceErrorEarly(e,t))e._visible=!1;else{var r=e.refine===$g,a=e._optimChildrenWithinParent===sy;r&&a&&i&&!this.anyChildrenVisible(e,t)&&(e._visible=!1)}}}},{key:"meetsScreenSpaceErrorEarly",value:function(e,t){var n=e.parent;return!(!n||n.hasTilesetContent||n.refine!==Kg)&&!this.shouldRefine(e,t,!0)}}]),n}(yy),wy="REQUESTED",xy="COMPLETED",Cy="ERROR",Ty=function(){function e(){o(this,e),Ad(this,"_statusMap",void 0),this._statusMap={}}return u(e,[{key:"add",value:function(e,t,n,i){var o=this;this._statusMap[t]||(this._statusMap[t]={request:e,callback:n,key:t,frameState:i,status:wy},e().then((function(e){o._statusMap[t].status=xy,o._statusMap[t].callback(e,i)})).catch((function(e){o._statusMap[t].status=Cy,n(e)})))}},{key:"update",value:function(e,t){this._statusMap[e]&&(this._statusMap[e].frameState=t)}},{key:"find",value:function(e){return this._statusMap[e]}}]),e}(),Iy=function(e){f(i,e);var t,n=Xh(i);function i(e){var t;return o(this,i),Ad(h(t=n.call(this,e)),"_tileManager",void 0),t._tileManager=new Ty,t}return u(i,[{key:"shouldRefine",value:function(e,t){return e._lodJudge=function(e,t){if(0===e.lodMetricValue||isNaN(e.lodMetricValue))return"DIG";var n=2*my(e,t);return n<2?"OUT":!e.header.children||n<=e.lodMetricValue?"DRAW":e.header.children?"DIG":"OUT"}(e,t),"DIG"===e._lodJudge}},{key:"updateChildTiles",value:function(e,t){var n,i=this,o=e.header.children||[],r=e.children,a=e.tileset,s=td(o);try{var l=function(){var o=n.value,s="".concat(o.id,"-").concat(t.viewport.id),l=r&&r.find((function(e){return e.id===s}));if(l)l&&i.updateTile(l,t);else{var c=function(){return i._loadTile(o.id,a)};i._tileManager.find(s)?i._tileManager.update(s,t):(a.tileset.nodePages&&(c=function(){return a.tileset.nodePagesTile.formTileFromNodePages(o.id)}),i._tileManager.add(c,s,(function(t){return i._onTileLoad(t,e,s)}),t))}};for(s.s();!(n=s.n()).done;)l()}catch(e){s.e(e)}finally{s.f()}return!1}},{key:"_loadTile",value:(t=k(S.mark((function e(t,n){var i,o,r;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=n.loader,o=n.getTileUrl("".concat(n.url,"/nodes/").concat(t)),r=od(od({},n.loadOptions),{},{i3s:od(od({},n.loadOptions.i3s),{},{isTileHeader:!0,loadContent:!1})}),e.next=5,im(o,i,r);case 5:return e.abrupt("return",e.sent);case 6:case"end":return e.stop()}}),e)}))),function(e,n){return t.apply(this,arguments)})},{key:"_onTileLoad",value:function(e,t,n){var i=new Ey(t.tileset,e,t,n);t.children.push(i);var o=this._tileManager.find(i.id).frameState;this.updateTile(i,o),this._frameNumber===o.frameNumber&&this.executeTraversal(i,o)}}]),i}(yy),ky={description:"",ellipsoid:Kv.WGS84,modelMatrix:new sv,throttleRequests:!0,maxRequests:64,maximumMemoryUsage:32,onTileLoad:function(){},onTileUnload:function(){},onTileError:function(){},onTraversalComplete:function(e){return e},contentLoader:void 0,viewDistanceScale:1,maximumScreenSpaceError:8,loadTiles:!0,updateTransforms:!0,viewportTraversersMap:null,loadOptions:{fetch:{}},attributions:[],basePath:"",i3s:{}},By="Tiles In Tileset(s)",Py="Tiles In Memory",Ry="Tiles In View",My="Tiles To Render",Sy="Tiles Loaded",Dy="Tiles Loading",Ly="Tiles Unloaded",Fy="Failed Tile Loads",Hy="Points",Vy="Tile Memory Use",Oy=function(e){f(i,e);var t,n=Xh(i);function i(e,t){var r;o(this,i),Ad(h(r=n.call(this)),"options",void 0),Ad(h(r),"loadOptions",void 0),Ad(h(r),"type",void 0),Ad(h(r),"tileset",void 0),Ad(h(r),"loader",void 0),Ad(h(r),"url",void 0),Ad(h(r),"basePath",void 0),Ad(h(r),"modelMatrix",void 0),Ad(h(r),"ellipsoid",void 0),Ad(h(r),"lodMetricType",void 0),Ad(h(r),"lodMetricValue",void 0),Ad(h(r),"refine",void 0),Ad(h(r),"root",void 0),Ad(h(r),"roots",void 0),Ad(h(r),"asset",void 0),Ad(h(r),"description",void 0),Ad(h(r),"properties",void 0),Ad(h(r),"extras",void 0),Ad(h(r),"attributions",void 0),Ad(h(r),"credits",void 0),Ad(h(r),"stats",void 0),Ad(h(r),"traverseCounter",void 0),Ad(h(r),"geometricError",void 0),Ad(h(r),"selectedTiles",void 0),Ad(h(r),"cartographicCenter",void 0),Ad(h(r),"cartesianCenter",void 0),Ad(h(r),"zoom",void 0),Ad(h(r),"boundingVolume",void 0),Ad(h(r),"gpuMemoryUsageInBytes",void 0),Ad(h(r),"dynamicScreenSpaceErrorComputedDensity",void 0),Ad(h(r),"_traverser",void 0),Ad(h(r),"_cache",void 0),Ad(h(r),"_requestScheduler",void 0),Ad(h(r),"_frameNumber",void 0),Ad(h(r),"_queryParamsString",void 0),Ad(h(r),"_queryParams",void 0),Ad(h(r),"_extensionsUsed",void 0),Ad(h(r),"_tiles",void 0),Ad(h(r),"_pendingCount",void 0),Ad(h(r),"lastUpdatedVieports",void 0),Ad(h(r),"_requestedTiles",void 0),Ad(h(r),"_emptyTiles",void 0),Ad(h(r),"frameStateData",void 0),Ad(h(r),"maximumMemoryUsage",void 0),Ad(h(r),"loadingTiles",void 0);var a=!0;return Object.defineProperty(h(r),"visible",{get:function(){return a},set:function(e){e!=a&&(r.nextForceUpdate=!0,a=e)}}),ld(e),r.options=od(od({},ky),t),r.tileset=e,r.loader=e.loader,r.type=e.type,r.url=e.url,r.basePath=e.basePath||mp(r.url),r.modelMatrix=r.options.modelMatrix,r.ellipsoid=r.options.ellipsoid,r.lodMetricType=e.lodMetricType,r.lodMetricValue=e.lodMetricValue,r.refine=e.root.refine,r.loadOptions=r.options.loadOptions||{},r.root=null,r.roots={},r.cartographicCenter=null,r.cartesianCenter=null,r.zoom=1,r.boundingVolume=null,r.traverseCounter=0,r.geometricError=0,r._traverser=r._initializeTraverser(),r._cache=new ng,r._requestScheduler=new dp({throttleRequests:r.options.throttleRequests,maxRequests:r.options.maxRequests}),r._frameNumber=0,r._pendingCount=0,r._tiles={},r.selectedTiles=[],r._emptyTiles=[],r._requestedTiles=[],r.frameStateData={},r.lastUpdatedVieports=null,r._queryParams={},r._queryParamsString="",r.maximumMemoryUsage=r.options.maximumMemoryUsage||32,r.gpuMemoryUsageInBytes=0,r.stats=new rp({id:r.url}),r.loadingTiles=[],r._initializeStats(),r._extensionsUsed=void 0,r.dynamicScreenSpaceErrorComputedDensity=0,r.extras=null,r.asset={},r.credits={},r.description=r.options.description||"",r._initializeTileSet(e),r}return u(i,[{key:"destroy",value:function(){this._destroy()}},{key:"isLoaded",value:function(){return 0===this._pendingCount&&0!==this._frameNumber}},{key:"tiles",get:function(){return Object.values(this._tiles)}},{key:"frameNumber",get:function(){return this._frameNumber}},{key:"queryParams",get:function(){return this._queryParamsString||(this._queryParamsString=function(e){for(var t=[],n=0,i=Object.keys(e);n<i.length;n++){var o=i[n];t.push("".concat(o,"=").concat(e[o]))}switch(t.length){case 0:return"";case 1:return"?".concat(t[0]);default:return"?".concat(t.join("&"))}}(this._queryParams)),this._queryParamsString}},{key:"setProps",value:function(e){this.options=od(od({},this.options),e)}},{key:"setOptions",value:function(e){this.options=od(od({},this.options),e)}},{key:"getTileUrl",value:function(e){return e.startsWith("data:")?e:"".concat(e).concat(this.queryParams)}},{key:"hasExtension",value:function(e){return Boolean(this._extensionsUsed&&this._extensionsUsed.indexOf(e)>-1)}},{key:"update",value:function(e){if((!("loadTiles"in this.options)||this.options.loadTiles)&&!(this.traverseCounter>0)){!e&&this.lastUpdatedVieports?e=this.lastUpdatedVieports:this.lastUpdatedVieports=e,e instanceof Array||(e=[e]),this._cache.reset(),this._frameNumber++,this.traverseCounter=e.length;var t,n=[],i=td(e);try{for(i.s();!(t=i.n()).done;){var o=t.value.id;this._needTraverse(o)?n.push(o):this.traverseCounter--}}catch(e){i.e(e)}finally{i.f()}var r,a=td(e);try{for(a.s();!(r=a.n()).done;){var s=r.value,l=s.id;if(this.roots[l]||(this.roots[l]=this._initializeTileHeaders(this.tileset,null)),n.includes(l)){var c=Ng(s,this._frameNumber);this._traverser.traverse(this.roots[l],c,this.options)}}}catch(e){a.e(e)}finally{a.f()}}}},{key:"_needTraverse",value:function(e){var t=e;return this.options.viewportTraversersMap&&(t=this.options.viewportTraversersMap[e]),t===e}},{key:"_onTraversalEnd",value:function(e){var t=e.viewport.id;this.frameStateData[t]||(this.frameStateData[t]={selectedTiles:[],_requestedTiles:[],_emptyTiles:[]});var n=this.frameStateData[t],i=Object.values(this._traverser.selectedTiles);n.selectedTiles=i,n._requestedTiles=Object.values(this._traverser.requestedTiles),n._emptyTiles=Object.values(this._traverser.emptyTiles),this.traverseCounter--,this.traverseCounter>0||this._updateTiles()}},{key:"_updateTiles",value:function(){for(var e in this.selectedTiles=[],this._requestedTiles=[],this._emptyTiles=[],this.frameStateData){var t=this.frameStateData[e];this.selectedTiles=this.selectedTiles.concat(t.selectedTiles),this._requestedTiles=this._requestedTiles.concat(t._requestedTiles),this._emptyTiles=this._emptyTiles.concat(t._emptyTiles)}this.selectedTiles=this.options.onTraversalComplete(this.selectedTiles);var n,i=td(this.selectedTiles);try{for(i.s();!(n=i.n()).done;){var o=n.value;this._tiles[o.id]=o}}catch(e){i.e(e)}finally{i.f()}this._loadTiles(),this._unloadTiles(),this._updateStats()}},{key:"_tilesChanged",value:function(e,t){if(e.length!==t.length)return!0;var n=new Set(e.map((function(e){return e.id}))),i=new Set(t.map((function(e){return e.id}))),o=e.filter((function(e){return!i.has(e.id)})).length>0;return o=o||t.filter((function(e){return!n.has(e.id)})).length>0}},{key:"_loadTiles",value:function(){var e,t=td(this._requestedTiles);try{for(t.s();!(e=t.n()).done;){var n=e.value;n.contentUnloaded&&this._loadTile(n)}}catch(e){t.e(e)}finally{t.f()}}},{key:"_unloadTiles",value:function(){this._cache.unloadTiles(this,(function(e,t){return e._unloadTile(t)}))}},{key:"_updateStats",value:function(){var e,t=0,n=0,i=td(this.selectedTiles);try{for(i.s();!(e=i.n()).done;){var o=e.value;o.contentAvailable&&o.content&&(t++,o.content.pointCount&&(n+=o.content.pointCount))}}catch(e){i.e(e)}finally{i.f()}this.stats.get(Ry).count=this.selectedTiles.length,this.stats.get(My).count=t,this.stats.get(Hy).count=n}},{key:"_initializeTileSet",value:function(e){this.root=this._initializeTileHeaders(e,null),this.type===ry&&this._initializeCesiumTileset(e),this.type===oy&&this._initializeI3STileset(),this._calculateViewProps()}},{key:"_calculateViewProps",value:function(){var e=this.root;ld(e);var t=e.boundingVolume.center;if(!t)return console.warn("center was not pre-calculated for the root tile"),this.cartographicCenter=new Nm,void(this.zoom=1);this.cartographicCenter=Kv.WGS84.cartesianToCartographic(t,new Nm),this.cartesianCenter=t,this.zoom=Wg(e.boundingVolume)}},{key:"_initializeStats",value:function(){this.stats.get(By),this.stats.get(Dy),this.stats.get(Py),this.stats.get(Ry),this.stats.get(My),this.stats.get(Sy),this.stats.get(Ly),this.stats.get(Fy),this.stats.get(Hy,"memory"),this.stats.get(Vy,"memory")}},{key:"_initializeTileHeaders",value:function(e,t){var n=new Ey(this,e.root,t);if(t&&(t.children.push(n),n.depth=t.depth+1),this.type===ry){var i=[];for(i.push(n);i.length>0;){var o=i.pop();this.stats.get(By).incrementCount();var r,a=td(o.header.children||[]);try{for(a.s();!(r=a.n()).done;){var s=r.value,l=new Ey(this,s,o);o.children.push(l),l.depth=o.depth+1,i.push(l)}}catch(e){a.e(e)}finally{a.f()}}}return n}},{key:"_initializeTraverser",value:function(){var e;switch(this.type){case ry:e=by;break;case oy:e=Iy;break;default:e=yy}return new e({basePath:this.basePath,onTraversalEnd:this._onTraversalEnd.bind(this)})}},{key:"_destroyTileHeaders",value:function(e){this._destroySubtree(e)}},{key:"_loadTile",value:(t=k(S.mark((function e(t){var n;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,this._onStartTileLoading(t),e.next=4,t.loadContent();case 4:n=e.sent,e.next=10;break;case 7:e.prev=7,e.t0=e.catch(0),this._onTileLoadError(t,e.t0);case 10:return e.prev=10,this._onEndTileLoading(t),this._onTileLoad(t,n),e.finish(10);case 14:case"end":return e.stop()}}),e,this,[[0,7,10,14]])}))),function(e){return t.apply(this,arguments)})},{key:"_onTileLoadError",value:function(e,t){this.stats.get(Fy).incrementCount();var n=t.message||t.toString(),i=e.url;console.error("A 3D tile failed to load: ".concat(e.url," ").concat(n)),this.options.onTileError(e,n,i)}},{key:"_onTileLoad",value:function(e,t){t&&(e&&e.content&&function(e,t){ld(e),ld(t);var n=t.rtcCenter,i=t.gltfUpAxis,o=e.computedTransform,r=e.boundingVolume.center,a=new sv(o);switch(n&&a.translate(n),i){case"Z":break;case"Y":var s=(new sv).rotateX(Math.PI/2);a=a.multiplyRight(s);break;case"X":var l=(new sv).rotateY(-Math.PI/2);a=a.multiplyRight(l)}t.isQuantized&&a.translate(t.quantizedVolumeOffset).scale(t.quantizedVolumeScale);var c=new Nm(r);t.cartesianModelMatrix=a,t.cartesianOrigin=c;var u=Kv.WGS84.cartesianToCartographic(c,new Nm),h=Kv.WGS84.eastNorthUpToFixedFrame(c).invert();t.cartographicModelMatrix=h.multiplyRight(a),t.cartographicOrigin=u,t.coordinateSystem||(t.modelMatrix=t.cartographicModelMatrix)}(e,e.content),this._addTileToCache(e),this.options.onTileLoad(e))}},{key:"_onStartTileLoading",value:function(e){this.loadingTiles.push(e),this._pendingCount++,this.stats.get(Dy).incrementCount()}},{key:"_onEndTileLoading",value:function(e){this.loadingTiles=this.loadingTiles.filter((function(t){return t!=e})),this._pendingCount--,this.stats.get(Dy).decrementCount(),this.emit("endTileLoading",{tile:e,loadingCount:this._pendingCount})}},{key:"_addTileToCache",value:function(e){this._cache.add(this,e,(function(t){return t._updateCacheStats(e)}))}},{key:"_updateCacheStats",value:function(e){this.stats.get(Sy).incrementCount(),this.stats.get(Py).incrementCount(),this.gpuMemoryUsageInBytes+=e.content.byteLength||0,this.stats.get(Vy).count=this.gpuMemoryUsageInBytes}},{key:"_unloadTile",value:function(e){this.gpuMemoryUsageInBytes-=e.content&&e.content.byteLength||0,this.stats.get(Py).decrementCount(),this.stats.get(Ly).incrementCount(),this.stats.get(Vy).count=this.gpuMemoryUsageInBytes,this.options.onTileUnload(e),e.unloadContent()}},{key:"_destroy",value:function(){var e=[];for(this.root&&e.push(this.root);e.length>0;){var t,n=e.pop(),i=td(n.children);try{for(i.s();!(t=i.n()).done;){var o=t.value;e.push(o)}}catch(e){i.e(e)}finally{i.f()}this._destroyTile(n)}this.root=null}},{key:"_destroySubtree",value:function(e){var t=e,n=[];for(n.push(t);n.length>0;){var i,o=td((e=n.pop()).children);try{for(o.s();!(i=o.n()).done;){var r=i.value;n.push(r)}}catch(e){o.e(e)}finally{o.f()}e!==t&&this._destroyTile(e)}t.children=[]}},{key:"_destroyTile",value:function(e){this._cache.unloadTile(this,e),this._unloadTile(e),e.destroy()}},{key:"_initializeCesiumTileset",value:function(e){if(this.asset=e.asset,!this.asset)throw new Error("Tileset must have an asset property.");if("0.0"!==this.asset.version&&"1.0"!==this.asset.version)throw new Error("The tileset must be 3D Tiles version 0.0 or 1.0.");"tilesetVersion"in this.asset&&(this._queryParams.v=this.asset.tilesetVersion),this.credits={attributions:this.options.attributions||[]},this.description=this.options.description||"",this.properties=e.properties,this.geometricError=e.geometricError,this._extensionsUsed=e.extensionsUsed,this.extras=e.extras}},{key:"_initializeI3STileset",value:function(){this.loadOptions.i3s&&"token"in this.loadOptions.i3s&&(this._queryParams.token=this.loadOptions.i3s.token)}}]),i}(yo);var Qy="3.1.4",_y="cmpt",zy="pnts",Uy="b3dm",Ny="i3dm",Gy="glTF";function jy(e,t,n){ld(e instanceof ArrayBuffer);var i=new TextDecoder("utf8"),o=new Uint8Array(e,t,n);return i.decode(o)}function Wy(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=new DataView(e);return"".concat(String.fromCharCode(n.getUint8(t+0))).concat(String.fromCharCode(n.getUint8(t+1))).concat(String.fromCharCode(n.getUint8(t+2))).concat(String.fromCharCode(n.getUint8(t+3)))}var qy={name:"Draco",id:"draco",module:"draco",shapes:["mesh"],version:"3.1.4",worker:!0,extensions:["drc"],mimeTypes:["application/octet-stream"],binary:!0,tests:["DRACO"],options:{draco:{decoderType:"object"==typeof WebAssembly?"wasm":"js",libraryPath:"libs/",extraAttributes:{},attributeNameEntry:void 0}}};function Jy(e){for(var t=1/0,n=1/0,i=1/0,o=-1/0,r=-1/0,a=-1/0,s=e.POSITION?e.POSITION.value:[],l=s&&s.length,c=0;c<l;c+=3){var u=s[c],h=s[c+1],d=s[c+2];t=u<t?u:t,n=h<n?h:n,i=d<i?d:i,o=u>o?u:o,r=h>r?h:r,a=d>a?d:a}return[[t,n,i],[o,r,a]]}var Yy=function(){function e(t,n){o(this,e),Ad(this,"fields",void 0),Ad(this,"metadata",void 0),function(e,t){if(!e)throw new Error(t||"loader assertion failed.")}(Array.isArray(t)),function(e){var t,n={},i=td(e);try{for(i.s();!(t=i.n()).done;){var o=t.value;n[o.name]&&console.warn("Schema: duplicated field name",o.name,o),n[o.name]=!0}}catch(e){i.e(e)}finally{i.f()}}(t),this.fields=t,this.metadata=n||new Map}return u(e,[{key:"compareTo",value:function(e){if(this.metadata!==e.metadata)return!1;if(this.fields.length!==e.fields.length)return!1;for(var t=0;t<this.fields.length;++t)if(!this.fields[t].compareTo(e.fields[t]))return!1;return!0}},{key:"select",value:function(){for(var t=Object.create(null),n=arguments.length,i=new Array(n),o=0;o<n;o++)i[o]=arguments[o];for(var r=0,a=i;r<a.length;r++){var s=a[r];t[s]=!0}var l=this.fields.filter((function(e){return t[e.name]}));return new e(l,this.metadata)}},{key:"selectAt",value:function(){for(var t=this,n=arguments.length,i=new Array(n),o=0;o<n;o++)i[o]=arguments[o];var r=i.map((function(e){return t.fields[e]})).filter(Boolean);return new e(r,this.metadata)}},{key:"assign",value:function(t){var n,i=this.metadata;if(t instanceof e){var o=t;n=o.fields,i=Zy(Zy(new Map,this.metadata),o.metadata)}else n=t;var r,a=Object.create(null),s=td(this.fields);try{for(s.s();!(r=s.n()).done;){var l=r.value;a[l.name]=l}}catch(e){s.e(e)}finally{s.f()}var c,u=td(n);try{for(u.s();!(c=u.n()).done;){var h=c.value;a[h.name]=h}}catch(e){u.e(e)}finally{u.f()}return new e(Object.values(a),i)}}]),e}();function Zy(e,t){return new Map([].concat(H(e||new Map),H(t||new Map)))}var Xy,Ky=function(){function e(t,n){var i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:new Map;o(this,e),Ad(this,"name",void 0),Ad(this,"type",void 0),Ad(this,"nullable",void 0),Ad(this,"metadata",void 0),this.name=t,this.type=n,this.nullable=i,this.metadata=r}return u(e,[{key:"typeId",get:function(){return this.type&&this.type.typeId}},{key:"clone",value:function(){return new e(this.name,this.type,this.nullable,this.metadata)}},{key:"compareTo",value:function(e){return this.name===e.name&&this.type===e.type&&this.nullable===e.nullable&&this.metadata===e.metadata}},{key:"toString",value:function(){return"".concat(this.type).concat(this.nullable?", nullable":"").concat(this.metadata?", metadata: ".concat(this.metadata):"")}}]),e}();!function(e){e[e.NONE=0]="NONE",e[e.Null=1]="Null",e[e.Int=2]="Int",e[e.Float=3]="Float",e[e.Binary=4]="Binary",e[e.Utf8=5]="Utf8",e[e.Bool=6]="Bool",e[e.Decimal=7]="Decimal",e[e.Date=8]="Date",e[e.Time=9]="Time",e[e.Timestamp=10]="Timestamp",e[e.Interval=11]="Interval",e[e.List=12]="List",e[e.Struct=13]="Struct",e[e.Union=14]="Union",e[e.FixedSizeBinary=15]="FixedSizeBinary",e[e.FixedSizeList=16]="FixedSizeList",e[e.Map=17]="Map",e[e.Dictionary=-1]="Dictionary",e[e.Int8=-2]="Int8",e[e.Int16=-3]="Int16",e[e.Int32=-4]="Int32",e[e.Int64=-5]="Int64",e[e.Uint8=-6]="Uint8",e[e.Uint16=-7]="Uint16",e[e.Uint32=-8]="Uint32",e[e.Uint64=-9]="Uint64",e[e.Float16=-10]="Float16",e[e.Float32=-11]="Float32",e[e.Float64=-12]="Float64",e[e.DateDay=-13]="DateDay",e[e.DateMillisecond=-14]="DateMillisecond",e[e.TimestampSecond=-15]="TimestampSecond",e[e.TimestampMillisecond=-16]="TimestampMillisecond",e[e.TimestampMicrosecond=-17]="TimestampMicrosecond",e[e.TimestampNanosecond=-18]="TimestampNanosecond",e[e.TimeSecond=-19]="TimeSecond",e[e.TimeMillisecond=-20]="TimeMillisecond",e[e.TimeMicrosecond=-21]="TimeMicrosecond",e[e.TimeNanosecond=-22]="TimeNanosecond",e[e.DenseUnion=-23]="DenseUnion",e[e.SparseUnion=-24]="SparseUnion",e[e.IntervalDayTime=-25]="IntervalDayTime",e[e.IntervalYearMonth=-26]="IntervalYearMonth"}(Xy||(Xy={}));var $y=function(){function e(){o(this,e)}return u(e,[{key:"typeId",get:function(){return Xy.NONE}},{key:"compareTo",value:function(e){return this===e}}],[{key:"isNull",value:function(e){return e&&e.typeId===Xy.Null}},{key:"isInt",value:function(e){return e&&e.typeId===Xy.Int}},{key:"isFloat",value:function(e){return e&&e.typeId===Xy.Float}},{key:"isBinary",value:function(e){return e&&e.typeId===Xy.Binary}},{key:"isUtf8",value:function(e){return e&&e.typeId===Xy.Utf8}},{key:"isBool",value:function(e){return e&&e.typeId===Xy.Bool}},{key:"isDecimal",value:function(e){return e&&e.typeId===Xy.Decimal}},{key:"isDate",value:function(e){return e&&e.typeId===Xy.Date}},{key:"isTime",value:function(e){return e&&e.typeId===Xy.Time}},{key:"isTimestamp",value:function(e){return e&&e.typeId===Xy.Timestamp}},{key:"isInterval",value:function(e){return e&&e.typeId===Xy.Interval}},{key:"isList",value:function(e){return e&&e.typeId===Xy.List}},{key:"isStruct",value:function(e){return e&&e.typeId===Xy.Struct}},{key:"isUnion",value:function(e){return e&&e.typeId===Xy.Union}},{key:"isFixedSizeBinary",value:function(e){return e&&e.typeId===Xy.FixedSizeBinary}},{key:"isFixedSizeList",value:function(e){return e&&e.typeId===Xy.FixedSizeList}},{key:"isMap",value:function(e){return e&&e.typeId===Xy.Map}},{key:"isDictionary",value:function(e){return e&&e.typeId===Xy.Dictionary}}]),e}(),eA=function(e,t){f(i,e);var n=Xh(i);function i(e,t){var r;return o(this,i),Ad(h(r=n.call(this)),"isSigned",void 0),Ad(h(r),"bitWidth",void 0),r.isSigned=e,r.bitWidth=t,r}return u(i,[{key:"typeId",get:function(){return Xy.Int}},{key:t,get:function(){return"Int"}},{key:"toString",value:function(){return"".concat(this.isSigned?"I":"Ui","nt").concat(this.bitWidth)}}]),i}($y,Symbol.toStringTag),tA=function(e){f(n,e);var t=Xh(n);function n(){return o(this,n),t.call(this,!0,8)}return n}(eA),nA=function(e){f(n,e);var t=Xh(n);function n(){return o(this,n),t.call(this,!0,16)}return n}(eA),iA=function(e){f(n,e);var t=Xh(n);function n(){return o(this,n),t.call(this,!0,32)}return n}(eA),oA=function(e){f(n,e);var t=Xh(n);function n(){return o(this,n),t.call(this,!1,8)}return n}(eA),rA=function(e){f(n,e);var t=Xh(n);function n(){return o(this,n),t.call(this,!1,16)}return n}(eA),aA=function(e){f(n,e);var t=Xh(n);function n(){return o(this,n),t.call(this,!1,32)}return n}(eA),sA=32,lA=64,cA=function(e,t){f(i,e);var n=Xh(i);function i(e){var t;return o(this,i),Ad(h(t=n.call(this)),"precision",void 0),t.precision=e,t}return u(i,[{key:"typeId",get:function(){return Xy.Float}},{key:t,get:function(){return"Float"}},{key:"toString",value:function(){return"Float".concat(this.precision)}}]),i}($y,Symbol.toStringTag),uA=function(e){f(n,e);var t=Xh(n);function n(){return o(this,n),t.call(this,sA)}return n}(cA),hA=function(e){f(n,e);var t=Xh(n);function n(){return o(this,n),t.call(this,lA)}return n}(cA),dA=function(e,t){f(i,e);var n=Xh(i);function i(e,t){var r;return o(this,i),Ad(h(r=n.call(this)),"listSize",void 0),Ad(h(r),"children",void 0),r.listSize=e,r.children=[t],r}return u(i,[{key:"typeId",get:function(){return Xy.FixedSizeList}},{key:"valueType",get:function(){return this.children[0].type}},{key:"valueField",get:function(){return this.children[0]}},{key:t,get:function(){return"FixedSizeList"}},{key:"toString",value:function(){return"FixedSizeList[".concat(this.listSize,"]<").concat(this.valueType,">")}}]),i}($y,Symbol.toStringTag);function pA(e,t,n){var i=function(e){switch(e.constructor){case Int8Array:return new tA;case Uint8Array:return new oA;case Int16Array:return new nA;case Uint16Array:return new rA;case Int32Array:return new iA;case Uint32Array:return new aA;case Float32Array:return new uA;case Float64Array:return new hA;default:throw new Error("array type not supported")}}(t.value),o=n||function(e){var t=new Map;"byteOffset"in e&&t.set("byteOffset",e.byteOffset.toString(10));"byteStride"in e&&t.set("byteStride",e.byteStride.toString(10));"normalized"in e&&t.set("normalized",e.normalized.toString());return t}(t);return new Ky(e,new dA(t.size,new Ky("value",i)),!1,o)}function fA(e,t,n){var i=vA(t.metadata),o=[],r=function(e){var t={};for(var n in e){var i=e[n];t[i.name||"undefined"]=i}return t}(t.attributes);for(var a in e){var s=mA(a,e[a],r[a]);o.push(s)}if(n){var l=mA("indices",n);o.push(l)}return new Yy(o,i)}function mA(e,t,n){return pA(e,t,n?vA(n.metadata):void 0)}function vA(e){var t=new Map;for(var n in e)t.set("".concat(n,".string"),JSON.stringify(e[n]));return t}var gA={POSITION:"POSITION",NORMAL:"NORMAL",COLOR:"COLOR_0",TEX_COORD:"TEXCOORD_0"},yA={1:Int8Array,2:Uint8Array,3:Int16Array,4:Uint16Array,5:Int32Array,6:Uint32Array,9:Float32Array},AA=function(){function e(t){o(this,e),Ad(this,"draco",void 0),Ad(this,"decoder",void 0),Ad(this,"metadataQuerier",void 0),this.draco=t,this.decoder=new this.draco.Decoder,this.metadataQuerier=new this.draco.MetadataQuerier}return u(e,[{key:"destroy",value:function(){this.draco.destroy(this.decoder),this.draco.destroy(this.metadataQuerier)}},{key:"parseSync",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=new this.draco.DecoderBuffer;n.Init(new Int8Array(e),e.byteLength),this._disableAttributeTransforms(t);var i=this.decoder.GetEncodedGeometryType(n),o=i===this.draco.TRIANGULAR_MESH?new this.draco.Mesh:new this.draco.PointCloud;try{var r;switch(i){case this.draco.TRIANGULAR_MESH:r=this.decoder.DecodeBufferToMesh(n,o);break;case this.draco.POINT_CLOUD:r=this.decoder.DecodeBufferToPointCloud(n,o);break;default:throw new Error("DRACO: Unknown geometry type.")}if(!r.ok()||!o.ptr){var a="DRACO decompression failed: ".concat(r.error_msg());throw new Error(a)}var s=this._getDracoLoaderData(o,i,t),l=this._getMeshData(o,s,t),c=Jy(l.attributes),u=fA(l.attributes,s,l.indices),h=od(od({loader:"draco",loaderData:s,header:{vertexCount:o.num_points(),boundingBox:c}},l),{},{schema:u});return h}finally{this.draco.destroy(n),o&&this.draco.destroy(o)}}},{key:"_getDracoLoaderData",value:function(e,t,n){var i=this._getTopLevelMetadata(e),o=this._getDracoAttributes(e,n);return{geometry_type:t,num_attributes:e.num_attributes(),num_points:e.num_points(),num_faces:e instanceof this.draco.Mesh?e.num_faces():0,metadata:i,attributes:o}}},{key:"_getDracoAttributes",value:function(e,t){for(var n={},i=0;i<e.num_attributes();i++){var o=this.decoder.GetAttribute(e,i),r=this._getAttributeMetadata(e,i);n[o.unique_id()]={unique_id:o.unique_id(),attribute_type:o.attribute_type(),data_type:o.data_type(),num_components:o.num_components(),byte_offset:o.byte_offset(),byte_stride:o.byte_stride(),normalized:o.normalized(),attribute_index:i,metadata:r};var a=this._getQuantizationTransform(o,t);a&&(n[o.unique_id()].quantization_transform=a);var s=this._getOctahedronTransform(o,t);s&&(n[o.unique_id()].octahedron_transform=s)}return n}},{key:"_getMeshData",value:function(e,t,n){var i=this._getMeshAttributes(t,e,n);if(!i.POSITION)throw new Error("DRACO: No position attribute found.");if(e instanceof this.draco.Mesh)switch(n.topology){case"triangle-strip":return{topology:"triangle-strip",mode:4,attributes:i,indices:{value:this._getTriangleStripIndices(e),size:1}};case"triangle-list":default:return{topology:"triangle-list",mode:5,attributes:i,indices:{value:this._getTriangleListIndices(e),size:1}}}return{topology:"point-list",mode:0,attributes:i}}},{key:"_getMeshAttributes",value:function(e,t,n){for(var i={},o=0,r=Object.values(e.attributes);o<r.length;o++){var a=r[o],s=this._deduceAttributeName(a,n);a.name=s;var l=this._getAttributeValues(t,a),c=l.value,u=l.size;i[s]={value:c,size:u,byteOffset:a.byte_offset,byteStride:a.byte_stride,normalized:a.normalized}}return i}},{key:"_getTriangleListIndices",value:function(e){var t=3*e.num_faces(),n=4*t,i=this.draco._malloc(n);try{return this.decoder.GetTrianglesUInt32Array(e,n,i),new Uint32Array(this.draco.HEAPF32.buffer,i,t).slice()}finally{this.draco._free(i)}}},{key:"_getTriangleStripIndices",value:function(e){var t=new this.draco.DracoInt32Array;try{return this.decoder.GetTriangleStripsFromMesh(e,t),function(e){for(var t=e.size(),n=new Int32Array(t),i=0;i<t;i++)n[i]=e.GetValue(i);return n}(t)}finally{this.draco.destroy(t)}}},{key:"_getAttributeValues",value:function(e,t){var n,i=yA[t.data_type],o=t.num_components,r=e.num_points()*o,a=r*i.BYTES_PER_ELEMENT,s=function(e,t){switch(t){case Float32Array:return e.DT_FLOAT32;case Int8Array:return e.DT_INT8;case Int16Array:return e.DT_INT16;case Int32Array:return e.DT_INT32;case Uint8Array:return e.DT_UINT8;case Uint16Array:return e.DT_UINT16;case Uint32Array:return e.DT_UINT32;default:return e.DT_INVALID}}(this.draco,i),l=this.draco._malloc(a);try{var c=this.decoder.GetAttribute(e,t.attribute_index);this.decoder.GetAttributeDataArrayForAllPoints(e,c,s,a,l),n=new i(this.draco.HEAPF32.buffer,l,r).slice()}finally{this.draco._free(l)}return{value:n,size:o}}},{key:"_deduceAttributeName",value:function(e,t){for(var n=e.unique_id,i=0,o=Object.entries(t.extraAttributes||{});i<o.length;i++){var r=fe(o[i],2),a=r[0];if(r[1]===n)return a}var s=e.attribute_type;for(var l in gA){if(this.draco[l]===s)return gA[l]}var c=t.attributeNameEntry||"name";return e.metadata[c]?e.metadata[c].string:"CUSTOM_ATTRIBUTE_".concat(n)}},{key:"_getTopLevelMetadata",value:function(e){var t=this.decoder.GetMetadata(e);return this._getDracoMetadata(t)}},{key:"_getAttributeMetadata",value:function(e,t){var n=this.decoder.GetAttributeMetadata(e,t);return this._getDracoMetadata(n)}},{key:"_getDracoMetadata",value:function(e){if(!e||!e.ptr)return{};for(var t={},n=this.metadataQuerier.NumEntries(e),i=0;i<n;i++){var o=this.metadataQuerier.GetEntryName(e,i);t[o]=this._getDracoMetadataField(e,o)}return t}},{key:"_getDracoMetadataField",value:function(e,t){var n=new this.draco.DracoInt32Array;try{this.metadataQuerier.GetIntEntryArray(e,t,n);var i=function(e){for(var t=e.size(),n=new Int32Array(t),i=0;i<t;i++)n[i]=e.GetValue(i);return n}(n);return{int:this.metadataQuerier.GetIntEntry(e,t),string:this.metadataQuerier.GetStringEntry(e,t),double:this.metadataQuerier.GetDoubleEntry(e,t),intArray:i}}finally{this.draco.destroy(n)}}},{key:"_disableAttributeTransforms",value:function(e){var t,n=e.quantizedAttributes,i=void 0===n?[]:n,o=e.octahedronAttributes,r=void 0===o?[]:o,a=td([].concat(H(i),H(r)));try{for(a.s();!(t=a.n()).done;){var s=t.value;this.decoder.SkipAttributeTransform(this.draco[s])}}catch(e){a.e(e)}finally{a.f()}}},{key:"_getQuantizationTransform",value:function(e,t){var n=this,i=t.quantizedAttributes,o=void 0===i?[]:i,r=e.attribute_type();if(o.map((function(e){return n.decoder[e]})).includes(r)){var a=new this.draco.AttributeQuantizationTransform;try{if(a.InitFromAttribute(e))return{quantization_bits:a.quantization_bits(),range:a.range(),min_values:new Float32Array([1,2,3]).map((function(e){return a.min_value(e)}))}}finally{this.draco.destroy(a)}}return null}},{key:"_getOctahedronTransform",value:function(e,t){var n=this,i=t.octahedronAttributes,o=void 0===i?[]:i,r=e.attribute_type();if(o.map((function(e){return n.decoder[e]})).includes(r)){var a=new this.draco.AttributeQuantizationTransform;try{if(a.InitFromAttribute(e))return{quantization_bits:a.quantization_bits()}}finally{this.draco.destroy(a)}}return null}}]),e}();var EA,bA="1.4.1",wA="https://www.gstatic.com/draco/versioned/decoders/".concat(bA,"/draco_decoder.js"),xA="https://www.gstatic.com/draco/versioned/decoders/".concat(bA,"/draco_wasm_wrapper.js"),CA="https://www.gstatic.com/draco/versioned/decoders/".concat(bA,"/draco_decoder.wasm");function TA(e){return IA.apply(this,arguments)}function IA(){return(IA=k(S.mark((function e(t){var n;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.modules||{},EA=n.draco3d?EA||n.draco3d.createDecoderModule({}).then((function(e){return{draco:e}})):EA||kA(t),e.next=4,EA;case 4:return e.abrupt("return",e.sent);case 5:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function kA(e){return BA.apply(this,arguments)}function BA(){return(BA=k(S.mark((function e(t){var n,i,o,r;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:e.t0=t.draco&&t.draco.decoderType,e.next="js"===e.t0?3:(e.t0,7);break;case 3:return e.next=5,Vd(wA,"draco",t);case 5:return n=e.sent,e.abrupt("break",22);case 7:return e.t1=Promise,e.next=11,Vd(xA,"draco",t);case 11:return e.t2=e.sent,e.next=14,Vd(CA,"draco",t);case 14:return e.t3=e.sent,e.t4=[e.t2,e.t3],e.next=18,e.t1.all.call(e.t1,e.t4);case 18:o=e.sent,r=fe(o,2),n=r[0],i=r[1];case 22:return n=n||ad.DracoDecoderModule,e.next=25,PA(n,i);case 25:return e.abrupt("return",e.sent);case 26:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function PA(e,t){var n={};return t&&(n.wasmBinary=t),new Promise((function(t){e(od(od({},n),{},{onModuleLoaded:function(e){return t({draco:e})}}))}))}var RA=od(od({},qy),{},{parse:function(e,t){return MA.apply(this,arguments)}});function MA(){return(MA=k(S.mark((function e(t,n){var i,o,r;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,TA(n);case 2:return i=e.sent,o=i.draco,r=new AA(o),e.prev=5,e.abrupt("return",r.parseSync(t,null==n?void 0:n.draco));case 7:return e.prev=7,r.destroy(),e.finish(7);case 10:case"end":return e.stop()}}),e,null,[[5,,7,10]])})))).apply(this,arguments)}var SA={BYTE:5120,UNSIGNED_BYTE:5121,SHORT:5122,UNSIGNED_SHORT:5123,INT:5124,UNSIGNED_INT:5125,FLOAT:5126,DOUBLE:5130},DA=od(od({},{POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6}),SA),LA={[SA.DOUBLE]:Float64Array,[SA.FLOAT]:Float32Array,[SA.UNSIGNED_SHORT]:Uint16Array,[SA.UNSIGNED_INT]:Uint32Array,[SA.UNSIGNED_BYTE]:Uint8Array,[SA.BYTE]:Int8Array,[SA.SHORT]:Int16Array,[SA.INT]:Int32Array},FA={DOUBLE:SA.DOUBLE,FLOAT:SA.FLOAT,UNSIGNED_SHORT:SA.UNSIGNED_SHORT,UNSIGNED_INT:SA.UNSIGNED_INT,UNSIGNED_BYTE:SA.UNSIGNED_BYTE,BYTE:SA.BYTE,SHORT:SA.SHORT,INT:SA.INT},HA="Failed to convert GL type",VA=function(){function e(){o(this,e)}return u(e,null,[{key:"fromTypedArray",value:function(e){for(var t in e=ArrayBuffer.isView(e)?e.constructor:e,LA){if(LA[t]===e)return t}throw new Error(HA)}},{key:"fromName",value:function(e){var t=FA[e];if(!t)throw new Error(HA);return t}},{key:"getArrayType",value:function(e){switch(e){case SA.UNSIGNED_SHORT_5_6_5:case SA.UNSIGNED_SHORT_4_4_4_4:case SA.UNSIGNED_SHORT_5_5_5_1:return Uint16Array;default:var t=LA[e];if(!t)throw new Error(HA);return t}}},{key:"getByteSize",value:function(t){return e.getArrayType(t).BYTES_PER_ELEMENT}},{key:"validate",value:function(t){return Boolean(e.getArrayType(t))}},{key:"createTypedArray",value:function(t,n){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,o=arguments.length>3?arguments[3]:void 0;void 0===o&&(o=(n.byteLength-i)/e.getByteSize(t));var r=e.getArrayType(t);return new r(n,i,o)}}]),e}();function OA(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[0,0,0],n=e>>11&31,i=e>>5&63,o=31&e;return t[0]=n<<3,t[1]=i<<2,t[2]=o<<3,t}function QA(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:255;return vm(e,0,t)/t*2-1}function _A(e){return e<0?-1:1}function zA(e,t,n,i){if(function(e,t){if(!e)throw new Error("math.gl assertion failed. ".concat(t))}(i),e<0||e>n||t<0||t>n)throw new Error("x and y must be unsigned normalized integers between 0 and ".concat(n));if(i.x=QA(e,n),i.y=QA(t,n),i.z=1-(Math.abs(i.x)+Math.abs(i.y)),i.z<0){var o=i.x;i.x=(1-Math.abs(i.y))*_A(o),i.y=(1-Math.abs(o))*_A(i.y)}return i.normalize()}function UA(e,t,n){return zA(e,t,255,n)}new Sm,new Nm,new Sm,new Sm;var NA=function(){function e(t,n){o(this,e),Ad(this,"json",void 0),Ad(this,"buffer",void 0),Ad(this,"featuresLength",0),Ad(this,"_cachedTypedArrays",{}),this.json=t,this.buffer=n}return u(e,[{key:"getExtension",value:function(e){return this.json.extensions&&this.json.extensions[e]}},{key:"hasProperty",value:function(e){return Boolean(this.json[e])}},{key:"getGlobalProperty",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:DA.UNSIGNED_INT,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,i=this.json[e];return i&&Number.isFinite(i.byteOffset)?this._getTypedArrayFromBinary(e,t,n,1,i.byteOffset):i}},{key:"getPropertyArray",value:function(e,t,n){var i=this.json[e];return i&&Number.isFinite(i.byteOffset)?("componentType"in i&&(t=VA.fromName(i.componentType)),this._getTypedArrayFromBinary(e,t,n,this.featuresLength,i.byteOffset)):this._getTypedArrayFromArray(e,t,i)}},{key:"getProperty",value:function(e,t,n,i,o){var r=this.json[e];if(!r)return r;var a=this.getPropertyArray(e,t,n);if(1===n)return a[i];for(var s=0;s<n;++s)o[s]=a[n*i+s];return o}},{key:"_getTypedArrayFromBinary",value:function(e,t,n,i,o){var r=this._cachedTypedArrays,a=r[e];return a||(a=VA.createTypedArray(t,this.buffer.buffer,this.buffer.byteOffset+o,i*n),r[e]=a),a}},{key:"_getTypedArrayFromArray",value:function(e,t,n){var i=this._cachedTypedArrays,o=i[e];return o||(o=VA.createTypedArray(t,n),i[e]=o),o}}]),e}(),GA={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},jA={SCALAR:function(e,t){return e[t]},VEC2:function(e,t){return[e[2*t+0],e[2*t+1]]},VEC3:function(e,t){return[e[3*t+0],e[3*t+1],e[3*t+2]]},VEC4:function(e,t){return[e[4*t+0],e[4*t+1],e[4*t+2],e[4*t+3]]},MAT2:function(e,t){return[e[4*t+0],e[4*t+1],e[4*t+2],e[4*t+3]]},MAT3:function(e,t){return[e[9*t+0],e[9*t+1],e[9*t+2],e[9*t+3],e[9*t+4],e[9*t+5],e[9*t+6],e[9*t+7],e[9*t+8]]},MAT4:function(e,t){return[e[16*t+0],e[16*t+1],e[16*t+2],e[16*t+3],e[16*t+4],e[16*t+5],e[16*t+6],e[16*t+7],e[16*t+8],e[16*t+9],e[16*t+10],e[16*t+11],e[16*t+12],e[16*t+13],e[16*t+14],e[16*t+15]]}},WA={SCALAR:function(e,t,n){t[n]=e},VEC2:function(e,t,n){t[2*n+0]=e[0],t[2*n+1]=e[1]},VEC3:function(e,t,n){t[3*n+0]=e[0],t[3*n+1]=e[1],t[3*n+2]=e[2]},VEC4:function(e,t,n){t[4*n+0]=e[0],t[4*n+1]=e[1],t[4*n+2]=e[2],t[4*n+3]=e[3]},MAT2:function(e,t,n){t[4*n+0]=e[0],t[4*n+1]=e[1],t[4*n+2]=e[2],t[4*n+3]=e[3]},MAT3:function(e,t,n){t[9*n+0]=e[0],t[9*n+1]=e[1],t[9*n+2]=e[2],t[9*n+3]=e[3],t[9*n+4]=e[4],t[9*n+5]=e[5],t[9*n+6]=e[6],t[9*n+7]=e[7],t[9*n+8]=e[8],t[9*n+9]=e[9]},MAT4:function(e,t,n){t[16*n+0]=e[0],t[16*n+1]=e[1],t[16*n+2]=e[2],t[16*n+3]=e[3],t[16*n+4]=e[4],t[16*n+5]=e[5],t[16*n+6]=e[6],t[16*n+7]=e[7],t[16*n+8]=e[8],t[16*n+9]=e[9],t[16*n+10]=e[10],t[16*n+11]=e[11],t[16*n+12]=e[12],t[16*n+13]=e[13],t[16*n+14]=e[14],t[16*n+15]=e[15]}};var qA=function(e){return void 0!==e};function JA(e,t,n){if(!t)return null;var i=e.getExtension("3DTILES_batch_table_hierarchy"),o=t.HIERARCHY;return o&&(console.warn("3D Tile Parser: HIERARCHY is deprecated. Use 3DTILES_batch_table_hierarchy."),t.extensions=t.extensions||{},t.extensions["3DTILES_batch_table_hierarchy"]=o,i=o),i?function(e,t){var n,i,o,r=e.instancesLength,a=e.classes,s=e.classIds,l=e.parentCounts,c=e.parentIds,u=r;qA(s.byteOffset)&&(s.componentType=defaultValue(s.componentType,GL.UNSIGNED_SHORT),s.type=AttributeType.SCALAR,s=getBinaryAccessor(s).createArrayBufferView(t.buffer,t.byteOffset+s.byteOffset,r));if(qA(l))for(qA(l.byteOffset)&&(l.componentType=defaultValue(l.componentType,GL.UNSIGNED_SHORT),l.type=AttributeType.SCALAR,l=getBinaryAccessor(l).createArrayBufferView(t.buffer,t.byteOffset+l.byteOffset,r)),o=new Uint16Array(r),u=0,n=0;n<r;++n)o[n]=u,u+=l[n];qA(c)&&qA(c.byteOffset)&&(c.componentType=defaultValue(c.componentType,GL.UNSIGNED_SHORT),c.type=AttributeType.SCALAR,c=getBinaryAccessor(c).createArrayBufferView(t.buffer,t.byteOffset+c.byteOffset,u));var h=a.length;for(n=0;n<h;++n){var d=a[n].length,p=a[n].instances,f=getBinaryProperties(d,p,t);a[n].instances=combine(f,p)}var m=new Array(h).fill(0),v=new Uint16Array(r);for(n=0;n<r;++n)i=s[n],v[n]=m[i],++m[i];var g={classes:a,classIds:s,classIndexes:v,parentCounts:l,parentIndexes:o,parentIds:c};return function(e){for(var t=e.classIds.length,n=0;n<t;++n)ZA(e,n,stack)}(g),g}(i,n):null}function YA(e,t,n){if(e){var i=e.parentCounts;return e.parentIds?n(e,t):i>0?function(e,t,n){var i=e.classIds,o=e.parentCounts,r=e.parentIds,a=e.parentIndexes,s=i.length,l=scratchVisited;l.length=Math.max(l.length,s);var c=++marker,u=scratchStack;u.length=0,u.push(t);for(;u.length>0;)if(l[t=u.pop()]!==c){l[t]=c;var h=n(e,t);if(qA(h))return h;for(var d=o[t],p=a[t],f=0;f<d;++f){var m=r[p+f];m!==t&&u.push(m)}}return null}(e,t,n):function(e,t,n){var i=!0;for(;i;){var o=n(e,t);if(qA(o))return o;var r=e.parentIds[t];i=r!==t,t=r}throw new Error("traverseHierarchySingleParent")}(e,t,n)}}function ZA(e,t,n){var i=e.parentCounts,o=e.parentIds,r=e.parentIndexes,a=e.classIds.length;if(qA(o)){assert(t<a,"Parent index ".concat(t," exceeds the total number of instances: ").concat(a)),assert(-1===n.indexOf(t),"Circular dependency detected in the batch table hierarchy."),n.push(t);for(var s=qA(i)?i[t]:1,l=qA(i)?r[t]:t,c=0;c<s;++c){var u=o[l+c];u!==t&&ZA(e,u,n)}n.pop(t)}}function XA(e){return null!=e}var KA=function(e,t){return e},$A={HIERARCHY:!0,extensions:!0,extras:!0},eE=function(){function e(t,n,i){var r,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};for(var s in o(this,e),Ad(this,"json",void 0),Ad(this,"binary",void 0),Ad(this,"featureCount",void 0),Ad(this,"_extensions",void 0),Ad(this,"_properties",void 0),Ad(this,"_binaryProperties",void 0),Ad(this,"_hierarchy",void 0),ld(i>=0),this.json=t||{},this.binary=n,this.featureCount=i,this._extensions=(null===(r=this.json)||void 0===r?void 0:r.extensions)||{},this._properties={},this.json)$A[s]||(this._properties[s]=this.json[s]);this._binaryProperties=this._initializeBinaryProperties(),a["3DTILES_batch_table_hierarchy"]&&(this._hierarchy=JA(this,this.json,this.binary))}return u(e,[{key:"getExtension",value:function(e){return this.json&&this.json.extensions&&this.json.extensions[e]}},{key:"memorySizeInBytes",value:function(){return 0}},{key:"isClass",value:function(e,t){return this._checkBatchId(e),ld("string"==typeof t,t),!!this._hierarchy&&XA(YA(this._hierarchy,e,(function(e,n){var i=e.classIds[n];return e.classes[i].name===t})))}},{key:"isExactClass",value:function(e,t){return ld("string"==typeof t,t),this.getExactClassName(e)===t}},{key:"getExactClassName",value:function(e){if(this._checkBatchId(e),this._hierarchy){var t=this._hierarchy.classIds[e];return this._hierarchy.classes[t].name}}},{key:"hasProperty",value:function(e,t){return this._checkBatchId(e),ld("string"==typeof t,t),XA(this._properties[t])||this._hasPropertyInHierarchy(e,t)}},{key:"getPropertyNames",value:function(e,t){var n;this._checkBatchId(e),(t=XA(t)?t:[]).length=0;var i=Object.keys(this._properties);return(n=t).push.apply(n,H(i)),this._hierarchy&&this._getPropertyNamesInHierarchy(e,t),t}},{key:"getProperty",value:function(e,t){if(this._checkBatchId(e),ld("string"==typeof t,t),this._binaryProperties){var n=this._binaryProperties[t];if(XA(n))return this._getBinaryProperty(n,e)}var i=this._properties[t];if(XA(i))return KA(i[e]);if(this._hierarchy){var o=this._getHierarchyProperty(e,t);if(XA(o))return o}}},{key:"setProperty",value:function(e,t,n){var i=this.featureCount;if(this._checkBatchId(e),ld("string"==typeof t,t),this._binaryProperties){var o=this._binaryProperties[t];if(o)return void this._setBinaryProperty(o,e,n)}if(!this._hierarchy||!this._setHierarchyProperty(this,e,t,n)){var r=this._properties[t];XA(r)||(this._properties[t]=new Array(i),r=this._properties[t]),r[e]=KA(n)}}},{key:"_checkBatchId",value:function(e){if(!(e>=0&&e<this.featureCount))throw new Error("batchId not in range [0, featureCount - 1].")}},{key:"_getBinaryProperty",value:function(e,t){return e.unpack(e.typedArray,t)}},{key:"_setBinaryProperty",value:function(e,t,n){e.pack(n,e.typedArray,t)}},{key:"_initializeBinaryProperties",value:function(){var e=null;for(var t in this._properties){var n=this._properties[t],i=this._initializeBinaryProperty(t,n);i&&((e=e||{})[t]=i)}return e}},{key:"_initializeBinaryProperty",value:function(e,t){if("byteOffset"in t){var n=t;ld(this.binary,"Property ".concat(e," requires a batch table binary.")),ld(n.type,"Property ".concat(e," requires a type."));var i=function(e,t,n,i){var o=e.componentType;ld(e.componentType);var r="string"==typeof o?VA.fromName(o):o,a=GA[e.type],s=jA[e.type],l=WA[e.type];return n+=e.byteOffset,{values:VA.createTypedArray(r,t,n,a*i),type:r,size:a,unpacker:s,packer:l}}(n,this.binary.buffer,0|this.binary.byteOffset,this.featureCount);return{typedArray:i.values,componentCount:i.size,unpack:i.unpacker,pack:i.packer}}return null}},{key:"_hasPropertyInHierarchy",value:function(e,t){if(!this._hierarchy)return!1;var n=YA(this._hierarchy,e,(function(e,n){var i=e.classIds[n];return XA(e.classes[i].instances[t])}));return XA(n)}},{key:"_getPropertyNamesInHierarchy",value:function(e,t){YA(this._hierarchy,e,(function(e,n){var i=e.classIds[n],o=e.classes[i].instances;for(var r in o)o.hasOwnProperty(r)&&-1===t.indexOf(r)&&t.push(r)}))}},{key:"_getHierarchyProperty",value:function(e,t){var n=this;return YA(this._hierarchy,e,(function(e,i){var o=e.classIds[i],r=e.classes[o],a=e.classIndexes[i],s=r.instances[t];return XA(s)?XA(s.typedArray)?n._getBinaryProperty(s,a):KA(s[a]):null}))}},{key:"_setHierarchyProperty",value:function(e,t,n,i){var o=this,r=YA(this._hierarchy,t,(function(e,r){var a=e.classIds[r],s=e.classes[a],l=e.classIndexes[r],c=s.instances[n];return!!XA(c)&&(ld(r===t,'Inherited property "'.concat(n,'" is read-only.')),XA(c.typedArray)?o._setBinaryProperty(c,l,i):c[l]=KA(i),!0)}));return XA(r)}}]),e}();function tE(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=new DataView(t);if(e.magic=i.getUint32(n,!0),n+=4,e.version=i.getUint32(n,!0),n+=4,e.byteLength=i.getUint32(n,!0),n+=4,1!==e.version)throw new Error("3D Tile Version ".concat(e.version," not supported"));return n}var nE="b3dm tile in legacy format.";function iE(e,t,n){var i,o=new DataView(t);e.header=e.header||{};var r=o.getUint32(n,!0);n+=4;var a=o.getUint32(n,!0);n+=4;var s=o.getUint32(n,!0);n+=4;var l=o.getUint32(n,!0);return n+=4,s>=570425344?(n-=8,i=r,s=a,l=0,r=0,a=0,console.warn(nE)):l>=570425344&&(n-=4,i=s,s=r,l=a,r=0,a=0,console.warn(nE)),e.header.featureTableJsonByteLength=r,e.header.featureTableBinaryByteLength=a,e.header.batchTableJsonByteLength=s,e.header.batchTableBinaryByteLength=l,e.header.batchLength=i,n}function oE(e,t,n,i){return n=function(e,t,n,i){var o=e.header,r=o.featureTableJsonByteLength,a=o.featureTableBinaryByteLength,s=o.batchLength;if(e.featureTableJson={BATCH_LENGTH:s||0},r>0){var l=jy(t,n,r);e.featureTableJson=JSON.parse(l)}return n+=r,e.featureTableBinary=new Uint8Array(t,n,a),n+=a}(e,t,n),n=function(e,t,n,i){var o=e.header,r=o.batchTableJsonByteLength,a=o.batchTableBinaryByteLength;if(r>0){var s=jy(t,n,r);e.batchTableJson=JSON.parse(s),n+=r,a>0&&(e.batchTableBinary=new Uint8Array(t,n,a),e.batchTableBinary=new Uint8Array(e.batchTableBinary),n+=a)}return n}(e,t,n)}function rE(e,t,n){if(!(t||e&&e.batchIds&&n))return null;var i=e.batchIds,o=e.isRGB565,r=e.pointCount;if(i&&n){for(var a=new Uint8ClampedArray(3*r),s=0;s<r;s++){var l=i[s],c=n.getProperty(l,"dimensions").map((function(e){return 255*e}));a[3*s]=c[0],a[3*s+1]=c[1],a[3*s+2]=c[2]}return{type:DA.UNSIGNED_BYTE,value:a,size:3,normalized:!0}}if(o){for(var u=new Uint8ClampedArray(3*r),h=0;h<r;h++){var d=OA(t[h]);u[3*h]=d[0],u[3*h+1]=d[1],u[3*h+2]=d[2]}return{type:DA.UNSIGNED_BYTE,value:u,size:3,normalized:!0}}return t&&t.length===3*r?{type:DA.UNSIGNED_BYTE,value:t,size:3,normalized:!0}:{type:DA.UNSIGNED_BYTE,value:t,size:4,normalized:!0}}var aE=new Nm;function sE(e,t,n){return e.isQuantized?n["3d-tiles"]&&n["3d-tiles"].decodeQuantizedPositions?(e.isQuantized=!1,function(e,t){for(var n=new Nm,i=new Float32Array(3*e.pointCount),o=0;o<e.pointCount;o++)n.set(t[3*o],t[3*o+1],t[3*o+2]).scale(1/e.quantizedRange).multiply(e.quantizedVolumeScale).add(e.quantizedVolumeOffset).toArray(i,3*o);return i}(e,t)):{type:DA.UNSIGNED_SHORT,value:t,size:3,normalized:!0}:t}function lE(e,t,n,i,o){return cE.apply(this,arguments)}function cE(){return(cE=k(S.mark((function e(t,n,i,o,r){var a,s,l;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=tE(t,n,i),i=iE(t,n,i),i=oE(t,n,i),uE(t),a=hE(t),s=a.featureTable,l=a.batchTable,e.next=7,mE(t,s,l,o,r);case 7:return dE(t,s,o),pE(t,s,l),fE(t,s),e.abrupt("return",i);case 11:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function uE(e){e.attributes={positions:null,colors:null,normals:null,batchIds:null},e.isQuantized=!1,e.isTranslucent=!1,e.isRGB565=!1,e.isOctEncoded16P=!1}function hE(e){var t=new NA(e.featureTableJson,e.featureTableBinary),n=t.getGlobalProperty("POINTS_LENGTH");if(!Number.isFinite(n))throw new Error("POINTS_LENGTH must be defined");t.featuresLength=n,e.featuresLength=n,e.pointsLength=n,e.pointCount=n,e.rtcCenter=t.getGlobalProperty("RTC_CENTER",DA.FLOAT,3);var i=function(e,t){var n=null;if(!e.batchIds&&t.hasProperty("BATCH_ID")&&(e.batchIds=t.getPropertyArray("BATCH_ID",DA.UNSIGNED_SHORT,1),e.batchIds)){var i=t.getGlobalProperty("BATCH_LENGTH");if(!i)throw new Error("Global property: BATCH_LENGTH must be defined when BATCH_ID is defined.");var o=e.batchTableJson,r=e.batchTableBinary;n=new eE(o,r,i)}return n}(e,t);return{featureTable:t,batchTable:i}}function dE(e,t,n){if(!e.attributes.positions)if(t.hasProperty("POSITION"))e.attributes.positions=t.getPropertyArray("POSITION",DA.FLOAT,3);else if(t.hasProperty("POSITION_QUANTIZED")){var i=t.getPropertyArray("POSITION_QUANTIZED",DA.UNSIGNED_SHORT,3);if(e.isQuantized=!0,e.quantizedRange=65535,e.quantizedVolumeScale=t.getGlobalProperty("QUANTIZED_VOLUME_SCALE",DA.FLOAT,3),!e.quantizedVolumeScale)throw new Error("QUANTIZED_VOLUME_SCALE must be defined for quantized positions.");if(e.quantizedVolumeOffset=t.getGlobalProperty("QUANTIZED_VOLUME_OFFSET",DA.FLOAT,3),!e.quantizedVolumeOffset)throw new Error("QUANTIZED_VOLUME_OFFSET must be defined for quantized positions.");e.attributes.positions=sE(e,i,n)}if(!e.attributes.positions)throw new Error("Either POSITION or POSITION_QUANTIZED must be defined.")}function pE(e,t,n){if(!e.attributes.colors){var i=null;t.hasProperty("RGBA")?(i=t.getPropertyArray("RGBA",DA.UNSIGNED_BYTE,4),e.isTranslucent=!0):t.hasProperty("RGB")?i=t.getPropertyArray("RGB",DA.UNSIGNED_BYTE,3):t.hasProperty("RGB565")&&(i=t.getPropertyArray("RGB565",DA.UNSIGNED_SHORT,1),e.isRGB565=!0),e.attributes.colors=rE(e,i,n)}t.hasProperty("CONSTANT_RGBA")&&(e.constantRGBA=t.getGlobalProperty("CONSTANT_RGBA",DA.UNSIGNED_BYTE,4))}function fE(e,t){if(!e.attributes.normals){var n=null;t.hasProperty("NORMAL")?n=t.getPropertyArray("NORMAL",DA.FLOAT,3):t.hasProperty("NORMAL_OCT16P")&&(n=t.getPropertyArray("NORMAL_OCT16P",DA.UNSIGNED_BYTE,2),e.isOctEncoded16P=!0),e.attributes.normals=function(e,t){if(!t)return null;if(e.isOctEncoded16P){for(var n=new Float32Array(3*e.pointsLength),i=0;i<e.pointsLength;i++)UA(t[2*i],t[2*i+1],aE),aE.toArray(n,3*i);return{type:DA.FLOAT,size:2,value:n}}return{type:DA.FLOAT,size:2,value:t}}(e,n)}}function mE(e,t,n,i,o){return vE.apply(this,arguments)}function vE(){return(vE=k(S.mark((function e(t,n,i,o,r){var a,s,l,c,u,h,d,p;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if((c=t.batchTableJson&&t.batchTableJson.extensions&&t.batchTableJson.extensions["3DTILES_draco_point_compression"])&&(l=c.properties),!(u=n.getExtension("3DTILES_draco_point_compression"))){e.next=15;break}if(s=u.properties,h=u.byteOffset,d=u.byteLength,s&&Number.isFinite(h)&&d){e.next=9;break}throw new Error("Draco properties, byteOffset, and byteLength must be defined");case 9:a=t.featureTableBinary.slice(h,h+d),t.hasPositions=Number.isFinite(s.POSITION),t.hasColors=Number.isFinite(s.RGB)||Number.isFinite(s.RGBA),t.hasNormals=Number.isFinite(s.NORMAL),t.hasBatchIds=Number.isFinite(s.BATCH_ID),t.isTranslucent=Number.isFinite(s.RGBA);case 15:if(a){e.next=17;break}return e.abrupt("return",!0);case 17:return p={buffer:a,properties:od(od({},s),l),featureTableProperties:s,batchTableProperties:l,dequantizeInShader:!1},e.next=20,gE(t,p,o,r);case 20:return e.abrupt("return",e.sent);case 21:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function gE(e,t,n,i){return yE.apply(this,arguments)}function yE(){return(yE=k(S.mark((function e(t,n,i,o){var r,a,s,l,c,u,h,d,p,f,m,v,g,y,A;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=o.parse,delete(a=od(od({},i),{},{draco:od(od({},i.draco),{},{extraAttributes:n.batchTableProperties||{}})}))["3d-tiles"],e.next=5,r(n.buffer,RA,a);case 5:if(s=e.sent,l=s.attributes.POSITION&&s.attributes.POSITION.value,c=s.attributes.COLOR_0&&s.attributes.COLOR_0.value,u=s.attributes.NORMAL&&s.attributes.NORMAL.value,h=s.attributes.BATCH_ID&&s.attributes.BATCH_ID.value,d=l&&s.attributes.POSITION.value.quantization,p=u&&s.attributes.NORMAL.value.quantization,d&&(f=s.POSITION.data.quantization,m=f.range,t.quantizedVolumeScale=new Nm(m,m,m),t.quantizedVolumeOffset=new Nm(f.minValues),t.quantizedRange=(1<<f.quantizationBits)-1,t.isQuantizedDraco=!0),p&&(t.octEncodedRange=(1<<s.NORMAL.data.quantization.quantizationBits)-1,t.isOctEncodedDraco=!0),v={},n.batchTableProperties)for(g=0,y=Object.keys(n.batchTableProperties);g<y.length;g++)A=y[g],s.attributes[A]&&s.attributes[A].value&&(v[A.toLowerCase()]=s.attributes[A].value);t.attributes=od({positions:l,colors:rE(t,c,void 0),normals:u,batchIds:h},v);case 17:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var AE,EE,bE="3.1.4",wE="https://unpkg.com/@loaders.gl/textures@".concat(bE,"/dist/libs/basis_encoder.wasm"),xE="https://unpkg.com/@loaders.gl/textures@".concat(bE,"/dist/libs/basis_encoder.js");function CE(e){return TE.apply(this,arguments)}function TE(){return(TE=k(S.mark((function e(t){var n;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(n=t.modules||{}).basis){e.next=3;break}return e.abrupt("return",n.basis);case 3:return AE=AE||IE(t),e.next=6,AE;case 6:return e.abrupt("return",e.sent);case 7:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function IE(e){return kE.apply(this,arguments)}function kE(){return(kE=k(S.mark((function e(t){var n,i,o,r;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=null,i=null,e.t0=Promise,e.next=5,Vd("basis_transcoder.js","textures",t);case 5:return e.t1=e.sent,e.next=8,Vd("basis_transcoder.wasm","textures",t);case 8:return e.t2=e.sent,e.t3=[e.t1,e.t2],e.next=12,e.t0.all.call(e.t0,e.t3);case 12:return o=e.sent,r=fe(o,2),n=r[0],i=r[1],n=n||ad.BASIS,e.next=19,BE(n,i);case 19:return e.abrupt("return",e.sent);case 20:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function BE(e,t){var n={};return t&&(n.wasmBinary=t),new Promise((function(t){e(n).then((function(e){var n=e.BasisFile;(0,e.initializeBasis)(),t({BasisFile:n})}))}))}function PE(e){return RE.apply(this,arguments)}function RE(){return(RE=k(S.mark((function e(t){var n;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(n=t.modules||{}).basisEncoder){e.next=3;break}return e.abrupt("return",n.basisEncoder);case 3:return EE=EE||ME(t),e.next=6,EE;case 6:return e.abrupt("return",e.sent);case 7:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function ME(e){return SE.apply(this,arguments)}function SE(){return(SE=k(S.mark((function e(t){var n,i,o,r;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=null,i=null,e.t0=Promise,e.next=5,Vd(xE,"textures",t);case 5:return e.t1=e.sent,e.next=8,Vd(wE,"textures",t);case 8:return e.t2=e.sent,e.t3=[e.t1,e.t2],e.next=12,e.t0.all.call(e.t0,e.t3);case 12:return o=e.sent,r=fe(o,2),n=r[0],i=r[1],n=n||ad.BASIS,e.next=19,DE(n,i);case 19:return e.abrupt("return",e.sent);case 20:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function DE(e,t){var n={};return t&&(n.wasmBinary=t),new Promise((function(t){e(n).then((function(e){var n=e.BasisFile,i=e.KTX2File,o=e.initializeBasis,r=e.BasisEncoder;o(),t({BasisFile:n,KTX2File:i,BasisEncoder:r})}))}))}var LE,FE,HE,VE,OE,QE,_E,zE,UE=33776,NE=33779,GE=35840,jE=35842,WE=36196,qE=37808,JE=["","WEBKIT_","MOZ_"],YE={WEBGL_compressed_texture_s3tc:"dxt",WEBGL_compressed_texture_s3tc_srgb:"dxt-srgb",WEBGL_compressed_texture_etc1:"etc1",WEBGL_compressed_texture_etc:"etc2",WEBGL_compressed_texture_pvrtc:"pvrtc",WEBGL_compressed_texture_atc:"atc",WEBGL_compressed_texture_astc:"astc",EXT_texture_compression_rgtc:"rgtc"},ZE=null;function XE(e){if(!ZE){e=e||function(){try{return document.createElement("canvas").getContext("webgl")}catch(e){return null}}()||void 0,ZE=new Set;var t,n=td(JE);try{for(n.s();!(t=n.n()).done;){var i=t.value;for(var o in YE)if(e&&e.getExtension("".concat(i).concat(o))){var r=YE[o];ZE.add(r)}}}catch(e){n.e(e)}finally{n.f()}}return ZE}!function(e){e[e.NONE=0]="NONE",e[e.BASISLZ=1]="BASISLZ",e[e.ZSTD=2]="ZSTD",e[e.ZLIB=3]="ZLIB"}(LE||(LE={})),function(e){e[e.BASICFORMAT=0]="BASICFORMAT"}(FE||(FE={})),function(e){e[e.UNSPECIFIED=0]="UNSPECIFIED",e[e.ETC1S=163]="ETC1S",e[e.UASTC=166]="UASTC"}(HE||(HE={})),function(e){e[e.UNSPECIFIED=0]="UNSPECIFIED",e[e.SRGB=1]="SRGB"}(VE||(VE={})),function(e){e[e.UNSPECIFIED=0]="UNSPECIFIED",e[e.LINEAR=1]="LINEAR",e[e.SRGB=2]="SRGB",e[e.ITU=3]="ITU",e[e.NTSC=4]="NTSC",e[e.SLOG=5]="SLOG",e[e.SLOG2=6]="SLOG2"}(OE||(OE={})),function(e){e[e.ALPHA_STRAIGHT=0]="ALPHA_STRAIGHT",e[e.ALPHA_PREMULTIPLIED=1]="ALPHA_PREMULTIPLIED"}(QE||(QE={})),function(e){e[e.RGB=0]="RGB",e[e.RRR=3]="RRR",e[e.GGG=4]="GGG",e[e.AAA=15]="AAA"}(_E||(_E={})),function(e){e[e.RGB=0]="RGB",e[e.RGBA=3]="RGBA",e[e.RRR=4]="RRR",e[e.RRRG=5]="RRRG"}(zE||(zE={}));var KE=[171,75,84,88,32,50,48,187,13,10,26,10];function $E(e){var t=new Uint8Array(e);return!(t.byteLength<KE.length||t[0]!==KE[0]||t[1]!==KE[1]||t[2]!==KE[2]||t[3]!==KE[3]||t[4]!==KE[4]||t[5]!==KE[5]||t[6]!==KE[6]||t[7]!==KE[7]||t[8]!==KE[8]||t[9]!==KE[9]||t[10]!==KE[10]||t[11]!==KE[11])}var eb={etc1:{basisFormat:0,compressed:!0,format:WE},etc2:{basisFormat:1,compressed:!0},bc1:{basisFormat:2,compressed:!0,format:UE},bc3:{basisFormat:3,compressed:!0,format:NE},bc4:{basisFormat:4,compressed:!0},bc5:{basisFormat:5,compressed:!0},"bc7-m6-opaque-only":{basisFormat:6,compressed:!0},"bc7-m5":{basisFormat:7,compressed:!0},"pvrtc1-4-rgb":{basisFormat:8,compressed:!0,format:GE},"pvrtc1-4-rgba":{basisFormat:9,compressed:!0,format:jE},"astc-4x4":{basisFormat:10,compressed:!0,format:qE},"atc-rgb":{basisFormat:11,compressed:!0},"atc-rgba-interpolated-alpha":{basisFormat:12,compressed:!0},rgba32:{basisFormat:13,compressed:!1},rgb565:{basisFormat:14,compressed:!1},bgr565:{basisFormat:15,compressed:!1},rgba4444:{basisFormat:16,compressed:!1}};function tb(){return(tb=k(S.mark((function e(t,n){var i,o,r,a,s,l;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if("auto"!==n.basis.containerFormat){e.next=11;break}if(!$E(t)){e.next=6;break}return e.next=4,PE(n);case 4:return i=e.sent,e.abrupt("return",ob(i.KTX2File,t,n));case 6:return e.next=8,CE(n);case 8:return o=e.sent,r=o.BasisFile,e.abrupt("return",nb(r,t,n));case 11:e.t0=n.basis.module,e.next="encoder"===e.t0?14:(e.t0,22);break;case 14:return e.next=16,PE(n);case 16:a=e.sent,e.t1=n.basis.containerFormat,e.next="ktx2"===e.t1?20:(e.t1,21);break;case 20:return e.abrupt("return",ob(a.KTX2File,t,n));case 21:return e.abrupt("return",nb(a.BasisFile,t,n));case 22:return e.next=24,CE(n);case 24:return s=e.sent,l=s.BasisFile,e.abrupt("return",nb(l,t,n));case 27:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function nb(e,t,n){var i=new e(new Uint8Array(t));try{if(!i.startTranscoding())return null;for(var o=i.getNumImages(),r=[],a=0;a<o;a++){for(var s=i.getNumLevels(a),l=[],c=0;c<s;c++)l.push(ib(i,a,c,n));r.push(l)}return r}finally{i.close(),i.delete()}}function ib(e,t,n,i){var o=e.getImageWidth(t,n),r=e.getImageHeight(t,n),a=e.getHasAlpha(),s=ab(i,a),l=s.compressed,c=s.format,u=s.basisFormat,h=e.getImageTranscodedSizeInBytes(t,n,u),d=new Uint8Array(h);return e.transcodeImage(d,t,n,u,0,0)?{width:o,height:r,data:d,compressed:l,hasAlpha:a,format:c}:null}function ob(e,t,n){var i=new e(new Uint8Array(t));try{if(!i.startTranscoding())return null;for(var o=i.getLevels(),r=[],a=0;a<o;a++){r.push(rb(i,a,n));break}return r}finally{i.close(),i.delete()}}function rb(e,t,n){var i=e.getImageLevelInfo(t,0,0),o=i.alphaFlag,r=i.height,a=i.width,s=ab(n,o),l=s.compressed,c=s.format,u=s.basisFormat,h=e.getImageTranscodedSizeInBytes(t,0,0,u),d=new Uint8Array(h);return e.transcodeImage(d,t,0,0,u,0,-1,-1)?{width:a,height:r,data:d,compressed:l,alphaFlag:o,format:c}:null}function ab(e,t){var n=e&&e.basis&&e.basis.format;return"auto"===n&&(n=sb()),"object"==typeof n&&(n=t?n.alpha:n.noAlpha),n=n.toLowerCase(),eb[n]}function sb(){var e=XE();return e.has("astc")?"astc-4x4":e.has("dxt")?{alpha:"bc3",noAlpha:"bc1"}:e.has("pvrtc")?{alpha:"pvrtc1-4-rgba",noAlpha:"pvrtc1-4-rgb"}:e.has("etc1")?"etc1":e.has("etc2")?"etc2":"rgb565"}var lb=od(od({},{name:"Basis",id:"basis",module:"textures",version:"3.1.4",worker:!0,extensions:["basis","ktx2"],mimeTypes:["application/octet-stream","image/ktx2"],tests:["sB"],binary:!0,options:{basis:{format:"auto",libraryPath:"libs/",containerFormat:"auto",module:"transcoder"}}}),{},{parse:function(e,t){return tb.apply(this,arguments)}}),cb=ad._parseImageNode,ub="undefined"!=typeof Image,hb="undefined"!=typeof ImageBitmap,db=Boolean(cb),pb=!!cd||db;function fb(e){var t=function(e){if("undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap)return"imagebitmap";if("undefined"!=typeof Image&&e instanceof Image)return"image";if(e&&"object"==typeof e&&e.data&&e.width&&e.height)return"data";return null}(e);if(!t)throw new Error("Not an image");return t}function mb(e){switch(fb(e)){case"data":return e;case"image":case"imagebitmap":var t=document.createElement("canvas"),n=t.getContext("2d");if(!n)throw new Error("getImageData");return t.width=e.width,t.height=e.height,n.drawImage(e,0,0),n.getImageData(0,0,e.width,e.height);default:throw new Error("getImageData")}}var vb=/^data:image\/svg\+xml/,gb=/\.svg((\?|#).*)?$/;function yb(e){return e&&(vb.test(e)||gb.test(e))}function Ab(e,t){if(yb(t)){var n=(new TextDecoder).decode(e);try{"function"==typeof unescape&&"function"==typeof encodeURIComponent&&(n=unescape(encodeURIComponent(n)))}catch(e){throw new Error(e.message)}return"data:image/svg+xml;base64,".concat(btoa(n))}return Eb(e,t)}function Eb(e,t){if(yb(t))throw new Error("SVG cannot be parsed directly to imagebitmap");return new Blob([new Uint8Array(e)])}function bb(e,t,n){return wb.apply(this,arguments)}function wb(){return(wb=k(S.mark((function e(t,n,i){var o,r,a;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return o=Ab(t,i),r=self.URL||self.webkitURL,a="string"!=typeof o&&r.createObjectURL(o),e.prev=3,e.next=6,xb(a||o,n);case 6:return e.abrupt("return",e.sent);case 7:return e.prev=7,a&&r.revokeObjectURL(a),e.finish(7);case 10:case"end":return e.stop()}}),e,null,[[3,,7,10]])})))).apply(this,arguments)}function xb(e,t){return Cb.apply(this,arguments)}function Cb(){return(Cb=k(S.mark((function e(t,n){var i;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if((i=new Image).src=t,!(n.image&&n.image.decode&&i.decode)){e.next=6;break}return e.next=5,i.decode();case 5:return e.abrupt("return",i);case 6:return e.next=8,new Promise((function(e,n){try{i.onload=function(){return e(i)},i.onerror=function(e){return n(new Error("Could not load image ".concat(t,": ").concat(e)))}}catch(e){n(e)}}));case 8:return e.abrupt("return",e.sent);case 9:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var Tb={},Ib=!0;function kb(e,t,n){return Bb.apply(this,arguments)}function Bb(){return(Bb=k(S.mark((function e(t,n,i){var o,r,a;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!yb(i)){e.next=7;break}return e.next=3,bb(t,n,i);case 3:r=e.sent,o=r,e.next=8;break;case 7:o=Eb(t,i);case 8:return a=n&&n.imagebitmap,e.next=11,Pb(o,a);case 11:return e.abrupt("return",e.sent);case 12:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Pb(e){return Rb.apply(this,arguments)}function Rb(){return(Rb=k(S.mark((function e(t){var n,i=arguments;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!Mb(n=i.length>1&&void 0!==i[1]?i[1]:null)&&Ib||(n=null),!n){e.next=13;break}return e.prev=3,e.next=6,createImageBitmap(t,n);case 6:return e.abrupt("return",e.sent);case 9:e.prev=9,e.t0=e.catch(3),console.warn(e.t0),Ib=!1;case 13:return e.next=15,createImageBitmap(t);case 15:return e.abrupt("return",e.sent);case 16:case"end":return e.stop()}}),e,null,[[3,9]])})))).apply(this,arguments)}function Mb(e){for(var t in e||Tb)return!1;return!0}var Sb=!1,Db=!0;function Lb(e){var t=Fb(e);return function(e){var t=Fb(e);if(!(t.byteLength>=24&&2303741511===t.getUint32(0,Sb)))return null;return{mimeType:"image/png",width:t.getUint32(16,Sb),height:t.getUint32(20,Sb)}}(t)||function(e){var t=Fb(e);if(!(t.byteLength>=3&&65496===t.getUint16(0,Sb)&&255===t.getUint8(2)))return null;var n=function(){for(var e=new Set([65499,65476,65484,65501,65534]),t=65504;t<65520;++t)e.add(t);var n=new Set([65472,65473,65474,65475,65477,65478,65479,65481,65482,65483,65485,65486,65487,65502]);return{tableMarkers:e,sofMarkers:n}}(),i=n.tableMarkers,o=n.sofMarkers,r=2;for(;r+9<t.byteLength;){var a=t.getUint16(r,Sb);if(o.has(a))return{mimeType:"image/jpeg",height:t.getUint16(r+5,Sb),width:t.getUint16(r+7,Sb)};if(!i.has(a))return null;r+=2,r+=t.getUint16(r,Sb)}return null}(t)||function(e){var t=Fb(e);if(!(t.byteLength>=10&&1195984440===t.getUint32(0,Sb)))return null;return{mimeType:"image/gif",width:t.getUint16(6,Db),height:t.getUint16(8,Db)}}(t)||function(e){var t=Fb(e);if(!(t.byteLength>=14&&16973===t.getUint16(0,Sb)&&t.getUint32(2,Db)===t.byteLength))return null;return{mimeType:"image/bmp",width:t.getUint32(18,Db),height:t.getUint32(22,Db)}}(t)}function Fb(e){if(e instanceof DataView)return e;if(ArrayBuffer.isView(e))return new DataView(e.buffer);if(e instanceof ArrayBuffer)return new DataView(e);throw new Error("toDataView")}function Hb(e,t){return Vb.apply(this,arguments)}function Vb(){return(Vb=k(S.mark((function e(t,n){var i,o,r;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=Lb(t)||{},o=i.mimeType,ld(r=ad._parseImageNode),e.next=5,r(t,o);case 5:return e.abrupt("return",e.sent);case 6:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Ob(){return(Ob=k(S.mark((function e(t,n,i){var o,r,a,s,l;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:o=(n=n||{}).image||{},r=o.type||"auto",a=(i||{}).url,s=Qb(r),e.t0=s,e.next="imagebitmap"===e.t0?8:"image"===e.t0?12:"data"===e.t0?16:20;break;case 8:return e.next=10,kb(t,n,a);case 10:return l=e.sent,e.abrupt("break",21);case 12:return e.next=14,bb(t,n,a);case 14:return l=e.sent,e.abrupt("break",21);case 16:return e.next=18,Hb(t);case 18:return l=e.sent,e.abrupt("break",21);case 20:ld(!1);case 21:return"data"===r&&(l=mb(l)),e.abrupt("return",l);case 23:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Qb(e){switch(e){case"auto":case"data":return function(){if(hb)return"imagebitmap";if(ub)return"image";if(pb)return"data";throw new Error("Install '@loaders.gl/polyfills' to parse images under Node.js")}();default:return function(e){switch(e){case"auto":return hb||ub||pb;case"imagebitmap":return hb;case"image":return ub;case"data":return pb;default:throw new Error("@loaders.gl/images: image ".concat(e," not supported in this environment"))}}(e),e}}var _b={id:"image",module:"images",name:"Images",version:"3.1.4",mimeTypes:["image/png","image/jpeg","image/gif","image/webp","image/bmp","image/vnd.microsoft.icon","image/svg+xml"],extensions:["png","jpg","jpeg","gif","webp","bmp","ico","svg"],parse:function(e,t,n){return Ob.apply(this,arguments)},tests:[function(e){return Boolean(Lb(new DataView(e)))}],options:{image:{type:"auto",decode:!0}}},zb=["image/png","image/jpeg","image/gif"],Ub={};function Nb(e){return void 0===Ub[e]&&(Ub[e]=function(e){switch(e){case"image/webp":return function(){if(!cd)return!1;try{return 0===document.createElement("canvas").toDataURL("image/webp").indexOf("data:image/webp")}catch(e){return!1}}();case"image/svg":return cd;default:if(!cd){var t=ad._parseImageNode;return Boolean(t)&&zb.includes(e)}return!0}}(e)),Ub[e]}function Gb(e,t){if(!e)throw new Error(t||"assert failed: gltf")}function jb(e,t){if(e.startsWith("data:")||e.startsWith("http:")||e.startsWith("https:"))return e;var n=t.baseUri||t.uri;if(!n)throw new Error("'baseUri' must be provided to resolve relative url ".concat(e));return n.substr(0,n.lastIndexOf("/")+1)+e}function Wb(e,t,n){var i=e.bufferViews[n];Gb(i);var o=t[i.buffer];Gb(o);var r=(i.byteOffset||0)+o.byteOffset;return new Uint8Array(o.arrayBuffer,r,i.byteLength)}var qb=["SCALAR","VEC2","VEC3","VEC4"],Jb=[[Int8Array,5120],[Uint8Array,5121],[Int16Array,5122],[Uint16Array,5123],[Uint32Array,5125],[Float32Array,5126],[Float64Array,5130]],Yb=new Map(Jb),Zb={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},Xb={5120:1,5121:1,5122:2,5123:2,5125:4,5126:4},Kb={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array};function $b(e){return qb[e-1]||qb[0]}function ew(e){var t=Yb.get(e.constructor);if(!t)throw new Error("Illegal typed array");return t}function tw(e,t){var n=Kb[e.componentType],i=Zb[e.type],o=Xb[e.componentType],r=e.count*i,a=e.count*i*o;return Gb(a>=0&&a<=t.byteLength),{ArrayType:n,length:r,byteLength:a}}var nw,iw={asset:{version:"2.0",generator:"loaders.gl"},buffers:[]},ow=function(){function e(t){o(this,e),Ad(this,"gltf",void 0),Ad(this,"sourceBuffers",void 0),Ad(this,"byteLength",void 0),this.gltf=t||{json:od({},iw),buffers:[]},this.sourceBuffers=[],this.byteLength=0,this.gltf.buffers&&this.gltf.buffers[0]&&(this.byteLength=this.gltf.buffers[0].byteLength,this.sourceBuffers=[this.gltf.buffers[0]])}return u(e,[{key:"json",get:function(){return this.gltf.json}},{key:"getApplicationData",value:function(e){return this.json[e]}},{key:"getExtraData",value:function(e){return(this.json.extras||{})[e]}},{key:"getExtension",value:function(e){var t=this.getUsedExtensions().find((function(t){return t===e})),n=this.json.extensions||{};return t?n[e]||!0:null}},{key:"getRequiredExtension",value:function(e){return this.getRequiredExtensions().find((function(t){return t===e}))?this.getExtension(e):null}},{key:"getRequiredExtensions",value:function(){return this.json.extensionsRequired||[]}},{key:"getUsedExtensions",value:function(){return this.json.extensionsUsed||[]}},{key:"getObjectExtension",value:function(e,t){return(e.extensions||{})[t]}},{key:"getScene",value:function(e){return this.getObject("scenes",e)}},{key:"getNode",value:function(e){return this.getObject("nodes",e)}},{key:"getSkin",value:function(e){return this.getObject("skins",e)}},{key:"getMesh",value:function(e){return this.getObject("meshes",e)}},{key:"getMaterial",value:function(e){return this.getObject("materials",e)}},{key:"getAccessor",value:function(e){return this.getObject("accessors",e)}},{key:"getTexture",value:function(e){return this.getObject("textures",e)}},{key:"getSampler",value:function(e){return this.getObject("samplers",e)}},{key:"getImage",value:function(e){return this.getObject("images",e)}},{key:"getBufferView",value:function(e){return this.getObject("bufferViews",e)}},{key:"getBuffer",value:function(e){return this.getObject("buffers",e)}},{key:"getObject",value:function(e,t){if("object"==typeof t)return t;var n=this.json[e]&&this.json[e][t];if(!n)throw new Error("glTF file error: Could not find ".concat(e,"[").concat(t,"]"));return n}},{key:"getTypedArrayForBufferView",value:function(e){var t=(e=this.getBufferView(e)).buffer,n=this.gltf.buffers[t];Gb(n);var i=(e.byteOffset||0)+n.byteOffset;return new Uint8Array(n.arrayBuffer,i,e.byteLength)}},{key:"getTypedArrayForAccessor",value:function(e){e=this.getAccessor(e);var t=this.getBufferView(e.bufferView),n=this.getBuffer(t.buffer).data,i=tw(e,t),o=i.ArrayType,r=i.length;return new o(n,t.byteOffset+e.byteOffset,r)}},{key:"getTypedArrayForImageData",value:function(e){e=this.getAccessor(e);var t=this.getBufferView(e.bufferView),n=this.getBuffer(t.buffer).data,i=t.byteOffset||0;return new Uint8Array(n,i,t.byteLength)}},{key:"addApplicationData",value:function(e,t){return this.json[e]=t,this}},{key:"addExtraData",value:function(e,t){return this.json.extras=this.json.extras||{},this.json.extras[e]=t,this}},{key:"addObjectExtension",value:function(e,t,n){return e.extensions=e.extensions||{},e.extensions[t]=n,this.registerUsedExtension(t),this}},{key:"setObjectExtension",value:function(e,t,n){(e.extensions||{})[t]=n}},{key:"removeObjectExtension",value:function(e,t){var n=e.extensions||{},i=n[t];return delete n[t],i}},{key:"addExtension",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return Gb(t),this.json.extensions=this.json.extensions||{},this.json.extensions[e]=t,this.registerUsedExtension(e),t}},{key:"addRequiredExtension",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return Gb(t),this.addExtension(e,t),this.registerRequiredExtension(e),t}},{key:"registerUsedExtension",value:function(e){this.json.extensionsUsed=this.json.extensionsUsed||[],this.json.extensionsUsed.find((function(t){return t===e}))||this.json.extensionsUsed.push(e)}},{key:"registerRequiredExtension",value:function(e){this.registerUsedExtension(e),this.json.extensionsRequired=this.json.extensionsRequired||[],this.json.extensionsRequired.find((function(t){return t===e}))||this.json.extensionsRequired.push(e)}},{key:"removeExtension",value:function(e){this.json.extensionsRequired&&this._removeStringFromArray(this.json.extensionsRequired,e),this.json.extensionsUsed&&this._removeStringFromArray(this.json.extensionsUsed,e),this.json.extensions&&delete this.json.extensions[e]}},{key:"setDefaultScene",value:function(e){this.json.scene=e}},{key:"addScene",value:function(e){var t=e.nodeIndices;return this.json.scenes=this.json.scenes||[],this.json.scenes.push({nodes:t}),this.json.scenes.length-1}},{key:"addNode",value:function(e){var t=e.meshIndex,n=e.matrix;this.json.nodes=this.json.nodes||[];var i={mesh:t};return n&&(i.matrix=n),this.json.nodes.push(i),this.json.nodes.length-1}},{key:"addMesh",value:function(e){var t=e.attributes,n=e.indices,i=e.material,o=e.mode,r=void 0===o?4:o,a={primitives:[{attributes:this._addAttributes(t),mode:r}]};if(n){var s=this._addIndices(n);a.primitives[0].indices=s}return Number.isFinite(i)&&(a.primitives[0].material=i),this.json.meshes=this.json.meshes||[],this.json.meshes.push(a),this.json.meshes.length-1}},{key:"addPointCloud",value:function(e){var t={primitives:[{attributes:this._addAttributes(e),mode:0}]};return this.json.meshes=this.json.meshes||[],this.json.meshes.push(t),this.json.meshes.length-1}},{key:"addImage",value:function(e,t){var n=Lb(e),i=t||(null==n?void 0:n.mimeType),o={bufferView:this.addBufferView(e),mimeType:i};return this.json.images=this.json.images||[],this.json.images.push(o),this.json.images.length-1}},{key:"addBufferView",value:function(e){var t=e.byteLength;Gb(Number.isFinite(t)),this.sourceBuffers=this.sourceBuffers||[],this.sourceBuffers.push(e);var n={buffer:0,byteOffset:this.byteLength,byteLength:t};return this.byteLength+=ep(t,4),this.json.bufferViews=this.json.bufferViews||[],this.json.bufferViews.push(n),this.json.bufferViews.length-1}},{key:"addAccessor",value:function(e,t){var n={bufferView:e,type:$b(t.size),componentType:t.componentType,count:t.count,max:t.max,min:t.min};return this.json.accessors=this.json.accessors||[],this.json.accessors.push(n),this.json.accessors.length-1}},{key:"addBinaryBuffer",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{size:3},n=this.addBufferView(e),i={min:t.min,max:t.max};i.min&&i.max||(i=this._getAccessorMinMax(e,t.size));var o={size:t.size,componentType:ew(e),count:Math.round(e.length/t.size),min:i.min,max:i.max};return this.addAccessor(n,Object.assign(o,t))}},{key:"addTexture",value:function(e){var t={source:e.imageIndex};return this.json.textures=this.json.textures||[],this.json.textures.push(t),this.json.textures.length-1}},{key:"addMaterial",value:function(e){return this.json.materials=this.json.materials||[],this.json.materials.push(e),this.json.materials.length-1}},{key:"createBinaryChunk",value:function(){var e,t;this.gltf.buffers=[];var n,i=this.byteLength,o=new ArrayBuffer(i),r=new Uint8Array(o),a=0,s=td(this.sourceBuffers||[]);try{for(s.s();!(n=s.n()).done;){a=tp(n.value,r,a)}}catch(e){s.e(e)}finally{s.f()}null!==(e=this.json)&&void 0!==e&&null!==(t=e.buffers)&&void 0!==t&&t[0]?this.json.buffers[0].byteLength=i:this.json.buffers=[{byteLength:i}],this.gltf.binary=o,this.sourceBuffers=[o]}},{key:"_removeStringFromArray",value:function(e,t){for(var n=!0;n;){var i=e.indexOf(t);i>-1?e.splice(i,1):n=!1}}},{key:"_addAttributes",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t={};for(var n in e){var i=e[n],o=this._getGltfAttributeName(n),r=this.addBinaryBuffer(i.value,i);t[o]=r}return t}},{key:"_addIndices",value:function(e){return this.addBinaryBuffer(e,{size:1})}},{key:"_getGltfAttributeName",value:function(e){switch(e.toLowerCase()){case"position":case"positions":case"vertices":return"POSITION";case"normal":case"normals":return"NORMAL";case"color":case"colors":return"COLOR_0";case"texcoord":case"texcoords":return"TEXCOORD_0";default:return e}}},{key:"_getAccessorMinMax",value:function(e,t){var n={min:null,max:null};if(e.length<t)return n;n.min=[],n.max=[];var i,o=td(e.subarray(0,t));try{for(o.s();!(i=o.n()).done;){var r=i.value;n.min.push(r),n.max.push(r)}}catch(e){o.e(e)}finally{o.f()}for(var a=t;a<e.length;a+=t)for(var s=0;s<t;s++)n.min[0+s]=Math.min(n.min[0+s],e[a+s]),n.max[0+s]=Math.max(n.max[0+s],e[a+s]);return n}}]),e}(),rw="object"!=typeof WebAssembly,aw="B9h9z9tFBBBF8fL9gBB9gLaaaaaFa9gEaaaB9gFaFa9gEaaaFaEMcBFFFGGGEIIILF9wFFFLEFBFKNFaFCx/IFMO/LFVK9tv9t9vq95GBt9f9f939h9z9t9f9j9h9s9s9f9jW9vq9zBBp9tv9z9o9v9wW9f9kv9j9v9kv9WvqWv94h919m9mvqBF8Z9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv94h919m9mvqBGy9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv949TvZ91v9u9jvBEn9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9P9jWBIi9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9R919hWBLn9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9F949wBKI9z9iqlBOc+x8ycGBM/qQFTa8jUUUUBCU/EBlHL8kUUUUBC9+RKGXAGCFJAI9LQBCaRKAE2BBC+gF9HQBALAEAIJHOAGlAGTkUUUBRNCUoBAG9uC/wgBZHKCUGAKCUG9JyRVAECFJRICBRcGXEXAcAF9PQFAVAFAclAcAVJAF9JyRMGXGXAG9FQBAMCbJHKC9wZRSAKCIrCEJCGrRQANCUGJRfCBRbAIRTEXGXAOATlAQ9PQBCBRISEMATAQJRIGXAS9FQBCBRtCBREEXGXAOAIlCi9PQBCBRISLMANCU/CBJAEJRKGXGXGXGXGXATAECKrJ2BBAtCKZrCEZfIBFGEBMAKhB83EBAKCNJhB83EBSEMAKAI2BIAI2BBHmCKrHYAYCE6HYy86BBAKCFJAICIJAYJHY2BBAmCIrCEZHPAPCE6HPy86BBAKCGJAYAPJHY2BBAmCGrCEZHPAPCE6HPy86BBAKCEJAYAPJHY2BBAmCEZHmAmCE6Hmy86BBAKCIJAYAmJHY2BBAI2BFHmCKrHPAPCE6HPy86BBAKCLJAYAPJHY2BBAmCIrCEZHPAPCE6HPy86BBAKCKJAYAPJHY2BBAmCGrCEZHPAPCE6HPy86BBAKCOJAYAPJHY2BBAmCEZHmAmCE6Hmy86BBAKCNJAYAmJHY2BBAI2BGHmCKrHPAPCE6HPy86BBAKCVJAYAPJHY2BBAmCIrCEZHPAPCE6HPy86BBAKCcJAYAPJHY2BBAmCGrCEZHPAPCE6HPy86BBAKCMJAYAPJHY2BBAmCEZHmAmCE6Hmy86BBAKCSJAYAmJHm2BBAI2BEHICKrHYAYCE6HYy86BBAKCQJAmAYJHm2BBAICIrCEZHYAYCE6HYy86BBAKCfJAmAYJHm2BBAICGrCEZHYAYCE6HYy86BBAKCbJAmAYJHK2BBAICEZHIAICE6HIy86BBAKAIJRISGMAKAI2BNAI2BBHmCIrHYAYCb6HYy86BBAKCFJAICNJAYJHY2BBAmCbZHmAmCb6Hmy86BBAKCGJAYAmJHm2BBAI2BFHYCIrHPAPCb6HPy86BBAKCEJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCIJAmAYJHm2BBAI2BGHYCIrHPAPCb6HPy86BBAKCLJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCKJAmAYJHm2BBAI2BEHYCIrHPAPCb6HPy86BBAKCOJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCNJAmAYJHm2BBAI2BIHYCIrHPAPCb6HPy86BBAKCVJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCcJAmAYJHm2BBAI2BLHYCIrHPAPCb6HPy86BBAKCMJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCSJAmAYJHm2BBAI2BKHYCIrHPAPCb6HPy86BBAKCQJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCfJAmAYJHm2BBAI2BOHICIrHYAYCb6HYy86BBAKCbJAmAYJHK2BBAICbZHIAICb6HIy86BBAKAIJRISFMAKAI8pBB83BBAKCNJAICNJ8pBB83BBAICTJRIMAtCGJRtAECTJHEAS9JQBMMGXAIQBCBRISEMGXAM9FQBANAbJ2BBRtCBRKAfREEXAEANCU/CBJAKJ2BBHTCFrCBATCFZl9zAtJHt86BBAEAGJREAKCFJHKAM9HQBMMAfCFJRfAIRTAbCFJHbAG9HQBMMABAcAG9sJANCUGJAMAG9sTkUUUBpANANCUGJAMCaJAG9sJAGTkUUUBpMAMCBAIyAcJRcAIQBMC9+RKSFMCBC99AOAIlAGCAAGCA9Ly6yRKMALCU/EBJ8kUUUUBAKM+OmFTa8jUUUUBCoFlHL8kUUUUBC9+RKGXAFCE9uHOCtJAI9LQBCaRKAE2BBHNC/wFZC/gF9HQBANCbZHVCF9LQBALCoBJCgFCUFT+JUUUBpALC84Jha83EBALC8wJha83EBALC8oJha83EBALCAJha83EBALCiJha83EBALCTJha83EBALha83ENALha83EBAEAIJC9wJRcAECFJHNAOJRMGXAF9FQBCQCbAVCF6yRSABRECBRVCBRQCBRfCBRICBRKEXGXAMAcuQBC9+RKSEMGXGXAN2BBHOC/vF9LQBALCoBJAOCIrCa9zAKJCbZCEWJHb8oGIRTAb8oGBRtGXAOCbZHbAS9PQBALAOCa9zAIJCbZCGWJ8oGBAVAbyROAb9FRbGXGXAGCG9HQBABAt87FBABCIJAO87FBABCGJAT87FBSFMAEAtjGBAECNJAOjGBAECIJATjGBMAVAbJRVALCoBJAKCEWJHmAOjGBAmATjGIALAICGWJAOjGBALCoBJAKCFJCbZHKCEWJHTAtjGBATAOjGIAIAbJRIAKCFJRKSGMGXGXAbCb6QBAQAbJAbC989zJCFJRQSFMAM1BBHbCgFZROGXGXAbCa9MQBAMCFJRMSFMAM1BFHbCgBZCOWAOCgBZqROGXAbCa9MQBAMCGJRMSFMAM1BGHbCgBZCfWAOqROGXAbCa9MQBAMCEJRMSFMAM1BEHbCgBZCdWAOqROGXAbCa9MQBAMCIJRMSFMAM2BIC8cWAOqROAMCLJRMMAOCFrCBAOCFZl9zAQJRQMGXGXAGCG9HQBABAt87FBABCIJAQ87FBABCGJAT87FBSFMAEAtjGBAECNJAQjGBAECIJATjGBMALCoBJAKCEWJHOAQjGBAOATjGIALAICGWJAQjGBALCoBJAKCFJCbZHKCEWJHOAtjGBAOAQjGIAICFJRIAKCFJRKSFMGXAOCDF9LQBALAIAcAOCbZJ2BBHbCIrHTlCbZCGWJ8oGBAVCFJHtATyROALAIAblCbZCGWJ8oGBAtAT9FHmJHtAbCbZHTyRbAT9FRTGXGXAGCG9HQBABAV87FBABCIJAb87FBABCGJAO87FBSFMAEAVjGBAECNJAbjGBAECIJAOjGBMALAICGWJAVjGBALCoBJAKCEWJHYAOjGBAYAVjGIALAICFJHICbZCGWJAOjGBALCoBJAKCFJCbZCEWJHYAbjGBAYAOjGIALAIAmJCbZHICGWJAbjGBALCoBJAKCGJCbZHKCEWJHOAVjGBAOAbjGIAKCFJRKAIATJRIAtATJRVSFMAVCBAM2BBHYyHTAOC/+F6HPJROAYCbZRtGXGXAYCIrHmQBAOCFJRbSFMAORbALAIAmlCbZCGWJ8oGBROMGXGXAtQBAbCFJRVSFMAbRVALAIAYlCbZCGWJ8oGBRbMGXGXAP9FQBAMCFJRYSFMAM1BFHYCgFZRTGXGXAYCa9MQBAMCGJRYSFMAM1BGHYCgBZCOWATCgBZqRTGXAYCa9MQBAMCEJRYSFMAM1BEHYCgBZCfWATqRTGXAYCa9MQBAMCIJRYSFMAM1BIHYCgBZCdWATqRTGXAYCa9MQBAMCLJRYSFMAMCKJRYAM2BLC8cWATqRTMATCFrCBATCFZl9zAQJHQRTMGXGXAmCb6QBAYRPSFMAY1BBHMCgFZROGXGXAMCa9MQBAYCFJRPSFMAY1BFHMCgBZCOWAOCgBZqROGXAMCa9MQBAYCGJRPSFMAY1BGHMCgBZCfWAOqROGXAMCa9MQBAYCEJRPSFMAY1BEHMCgBZCdWAOqROGXAMCa9MQBAYCIJRPSFMAYCLJRPAY2BIC8cWAOqROMAOCFrCBAOCFZl9zAQJHQROMGXGXAtCb6QBAPRMSFMAP1BBHMCgFZRbGXGXAMCa9MQBAPCFJRMSFMAP1BFHMCgBZCOWAbCgBZqRbGXAMCa9MQBAPCGJRMSFMAP1BGHMCgBZCfWAbqRbGXAMCa9MQBAPCEJRMSFMAP1BEHMCgBZCdWAbqRbGXAMCa9MQBAPCIJRMSFMAPCLJRMAP2BIC8cWAbqRbMAbCFrCBAbCFZl9zAQJHQRbMGXGXAGCG9HQBABAT87FBABCIJAb87FBABCGJAO87FBSFMAEATjGBAECNJAbjGBAECIJAOjGBMALCoBJAKCEWJHYAOjGBAYATjGIALAICGWJATjGBALCoBJAKCFJCbZCEWJHYAbjGBAYAOjGIALAICFJHICbZCGWJAOjGBALCoBJAKCGJCbZCEWJHOATjGBAOAbjGIALAIAm9FAmCb6qJHICbZCGWJAbjGBAIAt9FAtCb6qJRIAKCEJRKMANCFJRNABCKJRBAECSJREAKCbZRKAICbZRIAfCEJHfAF9JQBMMCBC99AMAc6yRKMALCoFJ8kUUUUBAKM/tIFGa8jUUUUBCTlRLC9+RKGXAFCLJAI9LQBCaRKAE2BBC/+FZC/QF9HQBALhB83ENAECFJRKAEAIJC98JREGXAF9FQBGXAGCG6QBEXGXAKAE9JQBC9+bMAK1BBHGCgFZRIGXGXAGCa9MQBAKCFJRKSFMAK1BFHGCgBZCOWAICgBZqRIGXAGCa9MQBAKCGJRKSFMAK1BGHGCgBZCfWAIqRIGXAGCa9MQBAKCEJRKSFMAK1BEHGCgBZCdWAIqRIGXAGCa9MQBAKCIJRKSFMAK2BIC8cWAIqRIAKCLJRKMALCNJAICFZCGWqHGAICGrCBAICFrCFZl9zAG8oGBJHIjGBABAIjGBABCIJRBAFCaJHFQBSGMMEXGXAKAE9JQBC9+bMAK1BBHGCgFZRIGXGXAGCa9MQBAKCFJRKSFMAK1BFHGCgBZCOWAICgBZqRIGXAGCa9MQBAKCGJRKSFMAK1BGHGCgBZCfWAIqRIGXAGCa9MQBAKCEJRKSFMAK1BEHGCgBZCdWAIqRIGXAGCa9MQBAKCIJRKSFMAK2BIC8cWAIqRIAKCLJRKMABAICGrCBAICFrCFZl9zALCNJAICFZCGWqHI8oGBJHG87FBAIAGjGBABCGJRBAFCaJHFQBMMCBC99AKAE6yRKMAKM+lLKFaF99GaG99FaG99GXGXAGCI9HQBAF9FQFEXGXGX9DBBB8/9DBBB+/ABCGJHG1BB+yAB1BBHE+yHI+L+TABCFJHL1BBHK+yHO+L+THN9DBBBB9gHVyAN9DBB/+hANAN+U9DBBBBANAVyHcAc+MHMAECa3yAI+SHIAI+UAcAMAKCa3yAO+SHcAc+U+S+S+R+VHO+U+SHN+L9DBBB9P9d9FQBAN+oRESFMCUUUU94REMAGAE86BBGXGX9DBBB8/9DBBB+/Ac9DBBBB9gyAcAO+U+SHN+L9DBBB9P9d9FQBAN+oRGSFMCUUUU94RGMALAG86BBGXGX9DBBB8/9DBBB+/AI9DBBBB9gyAIAO+U+SHN+L9DBBB9P9d9FQBAN+oRGSFMCUUUU94RGMABAG86BBABCIJRBAFCaJHFQBSGMMAF9FQBEXGXGX9DBBB8/9DBBB+/ABCIJHG8uFB+yAB8uFBHE+yHI+L+TABCGJHL8uFBHK+yHO+L+THN9DBBBB9gHVyAN9DB/+g6ANAN+U9DBBBBANAVyHcAc+MHMAECa3yAI+SHIAI+UAcAMAKCa3yAO+SHcAc+U+S+S+R+VHO+U+SHN+L9DBBB9P9d9FQBAN+oRESFMCUUUU94REMAGAE87FBGXGX9DBBB8/9DBBB+/Ac9DBBBB9gyAcAO+U+SHN+L9DBBB9P9d9FQBAN+oRGSFMCUUUU94RGMALAG87FBGXGX9DBBB8/9DBBB+/AI9DBBBB9gyAIAO+U+SHN+L9DBBB9P9d9FQBAN+oRGSFMCUUUU94RGMABAG87FBABCNJRBAFCaJHFQBMMM/SEIEaE99EaF99GXAF9FQBCBREABRIEXGXGX9D/zI818/AICKJ8uFBHLCEq+y+VHKAI8uFB+y+UHO9DB/+g6+U9DBBB8/9DBBB+/AO9DBBBB9gy+SHN+L9DBBB9P9d9FQBAN+oRVSFMCUUUU94RVMAICIJ8uFBRcAICGJ8uFBRMABALCFJCEZAEqCFWJAV87FBGXGXAKAM+y+UHN9DB/+g6+U9DBBB8/9DBBB+/AN9DBBBB9gy+SHS+L9DBBB9P9d9FQBAS+oRMSFMCUUUU94RMMABALCGJCEZAEqCFWJAM87FBGXGXAKAc+y+UHK9DB/+g6+U9DBBB8/9DBBB+/AK9DBBBB9gy+SHS+L9DBBB9P9d9FQBAS+oRcSFMCUUUU94RcMABALCaJCEZAEqCFWJAc87FBGXGX9DBBU8/AOAO+U+TANAN+U+TAKAK+U+THO9DBBBBAO9DBBBB9gy+R9DB/+g6+U9DBBB8/+SHO+L9DBBB9P9d9FQBAO+oRcSFMCUUUU94RcMABALCEZAEqCFWJAc87FBAICNJRIAECIJREAFCaJHFQBMMM9JBGXAGCGrAF9sHF9FQBEXABAB8oGBHGCNWCN91+yAGCi91CnWCUUU/8EJ+++U84GBABCIJRBAFCaJHFQBMMM9TFEaCBCB8oGUkUUBHFABCEJC98ZJHBjGUkUUBGXGXAB8/BCTWHGuQBCaREABAGlCggEJCTrXBCa6QFMAFREMAEM/lFFFaGXGXAFABqCEZ9FQBABRESFMGXGXAGCT9PQBABRESFMABREEXAEAF8oGBjGBAECIJAFCIJ8oGBjGBAECNJAFCNJ8oGBjGBAECSJAFCSJ8oGBjGBAECTJREAFCTJRFAGC9wJHGCb9LQBMMAGCI9JQBEXAEAF8oGBjGBAFCIJRFAECIJREAGC98JHGCE9LQBMMGXAG9FQBEXAEAF2BB86BBAECFJREAFCFJRFAGCaJHGQBMMABMoFFGaGXGXABCEZ9FQBABRESFMAFCgFZC+BwsN9sRIGXGXAGCT9PQBABRESFMABREEXAEAIjGBAECSJAIjGBAECNJAIjGBAECIJAIjGBAECTJREAGC9wJHGCb9LQBMMAGCI9JQBEXAEAIjGBAECIJREAGC98JHGCE9LQBMMGXAG9FQBEXAEAF86BBAECFJREAGCaJHGQBMMABMMMFBCUNMIT9kBB",sw="B9h9z9tFBBBF8dL9gBB9gLaaaaaFa9gEaaaB9gGaaB9gFaFaEQSBBFBFFGEGEGIILF9wFFFLEFBFKNFaFCx/aFMO/LFVK9tv9t9vq95GBt9f9f939h9z9t9f9j9h9s9s9f9jW9vq9zBBp9tv9z9o9v9wW9f9kv9j9v9kv9WvqWv94h919m9mvqBG8Z9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv94h919m9mvqBIy9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv949TvZ91v9u9jvBLn9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9P9jWBKi9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9R919hWBNn9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9F949wBcI9z9iqlBMc/j9JSIBTEM9+FLa8jUUUUBCTlRBCBRFEXCBRGCBREEXABCNJAGJAECUaAFAGrCFZHIy86BBAEAIJREAGCFJHGCN9HQBMAFCx+YUUBJAE86BBAFCEWCxkUUBJAB8pEN83EBAFCFJHFCUG9HQBMMkRIbaG97FaK978jUUUUBCU/KBlHL8kUUUUBC9+RKGXAGCFJAI9LQBCaRKAE2BBC+gF9HQBALAEAIJHOAGlAG/8cBBCUoBAG9uC/wgBZHKCUGAKCUG9JyRNAECFJRKCBRVGXEXAVAF9PQFANAFAVlAVANJAF9JyRcGXGXAG9FQBAcCbJHIC9wZHMCE9sRSAMCFWRQAICIrCEJCGrRfCBRbEXAKRTCBRtGXEXGXAOATlAf9PQBCBRKSLMALCU/CBJAtAM9sJRmATAfJRKCBREGXAMCoB9JQBAOAKlC/gB9JQBCBRIEXAmAIJREGXGXGXGXGXATAICKrJ2BBHYCEZfIBFGEBMAECBDtDMIBSEMAEAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPD8dBhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBAeCx+YUUBJDBBBHnAnDQBBBBBBBBBBBBBBBBAPD8dFhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIBAKCIJAnDeBJAeCx+YUUBJ2BBJRKSGMAEAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPD8dBhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBAeCx+YUUBJDBBBHnAnDQBBBBBBBBBBBBBBBBAPD8dFhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIBAKCNJAnDeBJAeCx+YUUBJ2BBJRKSFMAEAKDBBBDMIBAKCTJRKMGXGXGXGXGXAYCGrCEZfIBFGEBMAECBDtDMITSEMAEAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPD8dBhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBAeCx+YUUBJDBBBHnAnDQBBBBBBBBBBBBBBBBAPD8dFhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMITAKCIJAnDeBJAeCx+YUUBJ2BBJRKSGMAEAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPD8dBhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBAeCx+YUUBJDBBBHnAnDQBBBBBBBBBBBBBBBBAPD8dFhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMITAKCNJAnDeBJAeCx+YUUBJ2BBJRKSFMAEAKDBBBDMITAKCTJRKMGXGXGXGXGXAYCIrCEZfIBFGEBMAECBDtDMIASEMAEAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPD8dBhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBAeCx+YUUBJDBBBHnAnDQBBBBBBBBBBBBBBBBAPD8dFhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIAAKCIJAnDeBJAeCx+YUUBJ2BBJRKSGMAEAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPD8dBhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBAeCx+YUUBJDBBBHnAnDQBBBBBBBBBBBBBBBBAPD8dFhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIAAKCNJAnDeBJAeCx+YUUBJ2BBJRKSFMAEAKDBBBDMIAAKCTJRKMGXGXGXGXGXAYCKrfIBFGEBMAECBDtDMI8wSEMAEAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPD8dBhUg/8/4/w/goB9+h84k7HYCEWCxkUUBJDBEBAYCx+YUUBJDBBBHnAnDQBBBBBBBBBBBBBBBBAPD8dFhUg/8/4/w/goB9+h84k7HYCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMI8wAKCIJAnDeBJAYCx+YUUBJ2BBJRKSGMAEAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPD8dBhUg/8/4/w/goB9+h84k7HYCEWCxkUUBJDBEBAYCx+YUUBJDBBBHnAnDQBBBBBBBBBBBBBBBBAPD8dFhUg/8/4/w/goB9+h84k7HYCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMI8wAKCNJAnDeBJAYCx+YUUBJ2BBJRKSFMAEAKDBBBDMI8wAKCTJRKMAICoBJREAICUFJAM9LQFAERIAOAKlC/fB9LQBMMGXAEAM9PQBAECErRIEXGXAOAKlCi9PQBCBRKSOMAmAEJRYGXGXGXGXGXATAECKrJ2BBAICKZrCEZfIBFGEBMAYCBDtDMIBSEMAYAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPD8dBhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBAeCx+YUUBJDBBBHnAnDQBBBBBBBBBBBBBBBBAPD8dFhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIBAKCIJAnDeBJAeCx+YUUBJ2BBJRKSGMAYAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPD8dBhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBAeCx+YUUBJDBBBHnAnDQBBBBBBBBBBBBBBBBAPD8dFhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIBAKCNJAnDeBJAeCx+YUUBJ2BBJRKSFMAYAKDBBBDMIBAKCTJRKMAICGJRIAECTJHEAM9JQBMMGXAK9FQBAKRTAtCFJHtCI6QGSFMMCBRKSEMGXAM9FQBALCUGJAbJREALAbJDBGBRnCBRYEXAEALCU/CBJAYJHIDBIBHdCFD9tAdCFDbHPD9OD9hD9RHdAIAMJDBIBHiCFD9tAiAPD9OD9hD9RHiDQBTFtGmEYIPLdKeOnH8ZAIAQJDBIBHpCFD9tApAPD9OD9hD9RHpAIASJDBIBHyCFD9tAyAPD9OD9hD9RHyDQBTFtGmEYIPLdKeOnH8cDQBFTtGEmYILPdKOenHPAPDQBFGEBFGEBFGEBFGEAnD9uHnDyBjGBAEAGJHIAnAPAPDQILKOILKOILKOILKOD9uHnDyBjGBAIAGJHIAnAPAPDQNVcMNVcMNVcMNVcMD9uHnDyBjGBAIAGJHIAnAPAPDQSQfbSQfbSQfbSQfbD9uHnDyBjGBAIAGJHIAnA8ZA8cDQNVi8ZcMpySQ8c8dfb8e8fHPAPDQBFGEBFGEBFGEBFGED9uHnDyBjGBAIAGJHIAnAPAPDQILKOILKOILKOILKOD9uHnDyBjGBAIAGJHIAnAPAPDQNVcMNVcMNVcMNVcMD9uHnDyBjGBAIAGJHIAnAPAPDQSQfbSQfbSQfbSQfbD9uHnDyBjGBAIAGJHIAnAdAiDQNiV8ZcpMyS8cQ8df8eb8fHdApAyDQNiV8ZcpMyS8cQ8df8eb8fHiDQBFTtGEmYILPdKOenHPAPDQBFGEBFGEBFGEBFGED9uHnDyBjGBAIAGJHIAnAPAPDQILKOILKOILKOILKOD9uHnDyBjGBAIAGJHIAnAPAPDQNVcMNVcMNVcMNVcMD9uHnDyBjGBAIAGJHIAnAPAPDQSQfbSQfbSQfbSQfbD9uHnDyBjGBAIAGJHIAnAdAiDQNVi8ZcMpySQ8c8dfb8e8fHPAPDQBFGEBFGEBFGEBFGED9uHnDyBjGBAIAGJHIAnAPAPDQILKOILKOILKOILKOD9uHnDyBjGBAIAGJHIAnAPAPDQNVcMNVcMNVcMNVcMD9uHnDyBjGBAIAGJHIAnAPAPDQSQfbSQfbSQfbSQfbD9uHnDyBjGBAIAGJREAYCTJHYAM9JQBMMAbCIJHbAG9JQBMMABAVAG9sJALCUGJAcAG9s/8cBBALALCUGJAcCaJAG9sJAG/8cBBMAcCBAKyAVJRVAKQBMC9+RKSFMCBC99AOAKlAGCAAGCA9Ly6yRKMALCU/KBJ8kUUUUBAKMNBT+BUUUBM+KmFTa8jUUUUBCoFlHL8kUUUUBC9+RKGXAFCE9uHOCtJAI9LQBCaRKAE2BBHNC/wFZC/gF9HQBANCbZHVCF9LQBALCoBJCgFCUF/8MBALC84Jha83EBALC8wJha83EBALC8oJha83EBALCAJha83EBALCiJha83EBALCTJha83EBALha83ENALha83EBAEAIJC9wJRcAECFJHNAOJRMGXAF9FQBCQCbAVCF6yRSABRECBRVCBRQCBRfCBRICBRKEXGXAMAcuQBC9+RKSEMGXGXAN2BBHOC/vF9LQBALCoBJAOCIrCa9zAKJCbZCEWJHb8oGIRTAb8oGBRtGXAOCbZHbAS9PQBALAOCa9zAIJCbZCGWJ8oGBAVAbyROAb9FRbGXGXAGCG9HQBABAt87FBABCIJAO87FBABCGJAT87FBSFMAEAtjGBAECNJAOjGBAECIJATjGBMAVAbJRVALCoBJAKCEWJHmAOjGBAmATjGIALAICGWJAOjGBALCoBJAKCFJCbZHKCEWJHTAtjGBATAOjGIAIAbJRIAKCFJRKSGMGXGXAbCb6QBAQAbJAbC989zJCFJRQSFMAM1BBHbCgFZROGXGXAbCa9MQBAMCFJRMSFMAM1BFHbCgBZCOWAOCgBZqROGXAbCa9MQBAMCGJRMSFMAM1BGHbCgBZCfWAOqROGXAbCa9MQBAMCEJRMSFMAM1BEHbCgBZCdWAOqROGXAbCa9MQBAMCIJRMSFMAM2BIC8cWAOqROAMCLJRMMAOCFrCBAOCFZl9zAQJRQMGXGXAGCG9HQBABAt87FBABCIJAQ87FBABCGJAT87FBSFMAEAtjGBAECNJAQjGBAECIJATjGBMALCoBJAKCEWJHOAQjGBAOATjGIALAICGWJAQjGBALCoBJAKCFJCbZHKCEWJHOAtjGBAOAQjGIAICFJRIAKCFJRKSFMGXAOCDF9LQBALAIAcAOCbZJ2BBHbCIrHTlCbZCGWJ8oGBAVCFJHtATyROALAIAblCbZCGWJ8oGBAtAT9FHmJHtAbCbZHTyRbAT9FRTGXGXAGCG9HQBABAV87FBABCIJAb87FBABCGJAO87FBSFMAEAVjGBAECNJAbjGBAECIJAOjGBMALAICGWJAVjGBALCoBJAKCEWJHYAOjGBAYAVjGIALAICFJHICbZCGWJAOjGBALCoBJAKCFJCbZCEWJHYAbjGBAYAOjGIALAIAmJCbZHICGWJAbjGBALCoBJAKCGJCbZHKCEWJHOAVjGBAOAbjGIAKCFJRKAIATJRIAtATJRVSFMAVCBAM2BBHYyHTAOC/+F6HPJROAYCbZRtGXGXAYCIrHmQBAOCFJRbSFMAORbALAIAmlCbZCGWJ8oGBROMGXGXAtQBAbCFJRVSFMAbRVALAIAYlCbZCGWJ8oGBRbMGXGXAP9FQBAMCFJRYSFMAM1BFHYCgFZRTGXGXAYCa9MQBAMCGJRYSFMAM1BGHYCgBZCOWATCgBZqRTGXAYCa9MQBAMCEJRYSFMAM1BEHYCgBZCfWATqRTGXAYCa9MQBAMCIJRYSFMAM1BIHYCgBZCdWATqRTGXAYCa9MQBAMCLJRYSFMAMCKJRYAM2BLC8cWATqRTMATCFrCBATCFZl9zAQJHQRTMGXGXAmCb6QBAYRPSFMAY1BBHMCgFZROGXGXAMCa9MQBAYCFJRPSFMAY1BFHMCgBZCOWAOCgBZqROGXAMCa9MQBAYCGJRPSFMAY1BGHMCgBZCfWAOqROGXAMCa9MQBAYCEJRPSFMAY1BEHMCgBZCdWAOqROGXAMCa9MQBAYCIJRPSFMAYCLJRPAY2BIC8cWAOqROMAOCFrCBAOCFZl9zAQJHQROMGXGXAtCb6QBAPRMSFMAP1BBHMCgFZRbGXGXAMCa9MQBAPCFJRMSFMAP1BFHMCgBZCOWAbCgBZqRbGXAMCa9MQBAPCGJRMSFMAP1BGHMCgBZCfWAbqRbGXAMCa9MQBAPCEJRMSFMAP1BEHMCgBZCdWAbqRbGXAMCa9MQBAPCIJRMSFMAPCLJRMAP2BIC8cWAbqRbMAbCFrCBAbCFZl9zAQJHQRbMGXGXAGCG9HQBABAT87FBABCIJAb87FBABCGJAO87FBSFMAEATjGBAECNJAbjGBAECIJAOjGBMALCoBJAKCEWJHYAOjGBAYATjGIALAICGWJATjGBALCoBJAKCFJCbZCEWJHYAbjGBAYAOjGIALAICFJHICbZCGWJAOjGBALCoBJAKCGJCbZCEWJHOATjGBAOAbjGIALAIAm9FAmCb6qJHICbZCGWJAbjGBAIAt9FAtCb6qJRIAKCEJRKMANCFJRNABCKJRBAECSJREAKCbZRKAICbZRIAfCEJHfAF9JQBMMCBC99AMAc6yRKMALCoFJ8kUUUUBAKM/tIFGa8jUUUUBCTlRLC9+RKGXAFCLJAI9LQBCaRKAE2BBC/+FZC/QF9HQBALhB83ENAECFJRKAEAIJC98JREGXAF9FQBGXAGCG6QBEXGXAKAE9JQBC9+bMAK1BBHGCgFZRIGXGXAGCa9MQBAKCFJRKSFMAK1BFHGCgBZCOWAICgBZqRIGXAGCa9MQBAKCGJRKSFMAK1BGHGCgBZCfWAIqRIGXAGCa9MQBAKCEJRKSFMAK1BEHGCgBZCdWAIqRIGXAGCa9MQBAKCIJRKSFMAK2BIC8cWAIqRIAKCLJRKMALCNJAICFZCGWqHGAICGrCBAICFrCFZl9zAG8oGBJHIjGBABAIjGBABCIJRBAFCaJHFQBSGMMEXGXAKAE9JQBC9+bMAK1BBHGCgFZRIGXGXAGCa9MQBAKCFJRKSFMAK1BFHGCgBZCOWAICgBZqRIGXAGCa9MQBAKCGJRKSFMAK1BGHGCgBZCfWAIqRIGXAGCa9MQBAKCEJRKSFMAK1BEHGCgBZCdWAIqRIGXAGCa9MQBAKCIJRKSFMAK2BIC8cWAIqRIAKCLJRKMABAICGrCBAICFrCFZl9zALCNJAICFZCGWqHI8oGBJHG87FBAIAGjGBABCGJRBAFCaJHFQBMMCBC99AKAE6yRKMAKM/xLGEaK978jUUUUBCAlHE8kUUUUBGXGXAGCI9HQBGXAFC98ZHI9FQBABRGCBRLEXAGAGDBBBHKCiD+rFCiD+sFD/6FHOAKCND+rFCiD+sFD/6FAOD/gFAKCTD+rFCiD+sFD/6FHND/gFD/kFD/lFHVCBDtD+2FHcAOCUUUU94DtHMD9OD9RD/kFHO9DBB/+hDYAOAOD/mFAVAVD/mFANAcANAMD9OD9RD/kFHOAOD/mFD/kFD/kFD/jFD/nFHND/mF9DBBX9LDYHcD/kFCgFDtD9OAKCUUU94DtD9OD9QAOAND/mFAcD/kFCND+rFCU/+EDtD9OD9QAVAND/mFAcD/kFCTD+rFCUU/8ODtD9OD9QDMBBAGCTJRGALCIJHLAI9JQBMMAIAF9PQFAEAFCEZHLCGWHGqCBCTAGl/8MBAEABAICGWJHIAG/8cBBGXAL9FQBAEAEDBIBHKCiD+rFCiD+sFD/6FHOAKCND+rFCiD+sFD/6FAOD/gFAKCTD+rFCiD+sFD/6FHND/gFD/kFD/lFHVCBDtD+2FHcAOCUUUU94DtHMD9OD9RD/kFHO9DBB/+hDYAOAOD/mFAVAVD/mFANAcANAMD9OD9RD/kFHOAOD/mFD/kFD/kFD/jFD/nFHND/mF9DBBX9LDYHcD/kFCgFDtD9OAKCUUU94DtD9OD9QAOAND/mFAcD/kFCND+rFCU/+EDtD9OD9QAVAND/mFAcD/kFCTD+rFCUU/8ODtD9OD9QDMIBMAIAEAG/8cBBSFMABAFC98ZHGT+HUUUBAGAF9PQBAEAFCEZHICEWHLJCBCAALl/8MBAEABAGCEWJHGAL/8cBBAEAIT+HUUUBAGAEAL/8cBBMAECAJ8kUUUUBM+yEGGaO97GXAF9FQBCBRGEXABCTJHEAEDBBBHICBDtHLCUU98D8cFCUU98D8cEHKD9OABDBBBHOAIDQILKOSQfbPden8c8d8e8fCggFDtD9OD/6FAOAIDQBFGENVcMTtmYi8ZpyHICTD+sFD/6FHND/gFAICTD+rFCTD+sFD/6FHVD/gFD/kFD/lFHI9DB/+g6DYAVAIALD+2FHLAVCUUUU94DtHcD9OD9RD/kFHVAVD/mFAIAID/mFANALANAcD9OD9RD/kFHIAID/mFD/kFD/kFD/jFD/nFHND/mF9DBBX9LDYHLD/kFCTD+rFAVAND/mFALD/kFCggEDtD9OD9QHVAIAND/mFALD/kFCaDbCBDnGCBDnECBDnKCBDnOCBDncCBDnMCBDnfCBDnbD9OHIDQNVi8ZcMpySQ8c8dfb8e8fD9QDMBBABAOAKD9OAVAIDQBFTtGEmYILPdKOenD9QDMBBABCAJRBAGCIJHGAF9JQBMMM94FEa8jUUUUBCAlHE8kUUUUBABAFC98ZHIT+JUUUBGXAIAF9PQBAEAFCEZHLCEWHFJCBCAAFl/8MBAEABAICEWJHBAF/8cBBAEALT+JUUUBABAEAF/8cBBMAECAJ8kUUUUBM/hEIGaF97FaL978jUUUUBCTlRGGXAF9FQBCBREEXAGABDBBBHIABCTJHLDBBBHKDQILKOSQfbPden8c8d8e8fHOCTD+sFHNCID+rFDMIBAB9DBBU8/DY9D/zI818/DYANCEDtD9QD/6FD/nFHNAIAKDQBFGENVcMTtmYi8ZpyHICTD+rFCTD+sFD/6FD/mFHKAKD/mFANAICTD+sFD/6FD/mFHVAVD/mFANAOCTD+rFCTD+sFD/6FD/mFHOAOD/mFD/kFD/kFD/lFCBDtD+4FD/jF9DB/+g6DYHND/mF9DBBX9LDYHID/kFCggEDtHcD9OAVAND/mFAID/kFCTD+rFD9QHVAOAND/mFAID/kFCTD+rFAKAND/mFAID/kFAcD9OD9QHNDQBFTtGEmYILPdKOenHID8dBAGDBIBDyB+t+J83EBABCNJAID8dFAGDBIBDyF+t+J83EBALAVANDQNVi8ZcMpySQ8c8dfb8e8fHND8dBAGDBIBDyG+t+J83EBABCiJAND8dFAGDBIBDyE+t+J83EBABCAJRBAECIJHEAF9JQBMMM/3FGEaF978jUUUUBCoBlREGXAGCGrAF9sHIC98ZHL9FQBCBRGABRFEXAFAFDBBBHKCND+rFCND+sFD/6FAKCiD+sFCnD+rFCUUU/8EDtD+uFD/mFDMBBAFCTJRFAGCIJHGAL9JQBMMGXALAI9PQBAEAICEZHGCGWHFqCBCoBAFl/8MBAEABALCGWJHLAF/8cBBGXAG9FQBAEAEDBIBHKCND+rFCND+sFD/6FAKCiD+sFCnD+rFCUUU/8EDtD+uFD/mFDMIBMALAEAF/8cBBMM9TFEaCBCB8oGUkUUBHFABCEJC98ZJHBjGUkUUBGXGXAB8/BCTWHGuQBCaREABAGlCggEJCTrXBCa6QFMAFREMAEMMMFBCUNMIT9tBB",lw=new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,3,2,0,0,5,3,1,0,1,12,1,0,10,22,2,12,0,65,0,65,0,65,0,252,10,0,0,11,7,0,65,0,253,15,26,11]),cw=new Uint8Array([32,0,65,253,3,1,2,34,4,106,6,5,11,8,7,20,13,33,12,16,128,9,116,64,19,113,127,15,10,21,22,14,255,66,24,54,136,107,18,23,192,26,114,118,132,17,77,101,130,144,27,87,131,44,45,74,156,154,70,167]),uw={0:"",1:"meshopt_decodeFilterOct",2:"meshopt_decodeFilterQuat",3:"meshopt_decodeFilterExp",NONE:"",OCTAHEDRAL:"meshopt_decodeFilterOct",QUATERNION:"meshopt_decodeFilterQuat",EXPONENTIAL:"meshopt_decodeFilterExp"},hw={0:"meshopt_decodeVertexBuffer",1:"meshopt_decodeIndexBuffer",2:"meshopt_decodeIndexSequence",ATTRIBUTES:"meshopt_decodeVertexBuffer",TRIANGLES:"meshopt_decodeIndexBuffer",INDICES:"meshopt_decodeIndexSequence"};function dw(e,t,n,i,o){return pw.apply(this,arguments)}function pw(){return(pw=k(S.mark((function e(t,n,i,o,r){var a,s,l=arguments;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return a=l.length>5&&void 0!==l[5]?l[5]:"NONE",e.next=3,fw();case 3:Aw(s=e.sent,s.exports[hw[r]],t,n,i,o,s.exports[uw[a||"NONE"]]);case 5:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function fw(){return mw.apply(this,arguments)}function mw(){return(mw=k(S.mark((function e(){return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return nw||(nw=vw()),e.abrupt("return",nw);case 2:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function vw(){return gw.apply(this,arguments)}function gw(){return(gw=k(S.mark((function e(){var t,n;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=aw,WebAssembly.validate(lw)&&(t=sw,console.log("Warning: meshopt_decoder is using experimental SIMD support")),e.next=4,WebAssembly.instantiate(yw(t),{});case 4:return n=e.sent,e.next=7,n.instance.exports.__wasm_call_ctors();case 7:return e.abrupt("return",n.instance);case 8:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function yw(e){for(var t=new Uint8Array(e.length),n=0;n<e.length;++n){var i=e.charCodeAt(n);t[n]=i>96?i-71:i>64?i-65:i>47?i+4:i>46?63:62}for(var o=0,r=0;r<e.length;++r)t[o++]=t[r]<60?cw[t[r]]:64*(t[r]-60)+t[++r];return t.buffer.slice(0,o)}function Aw(e,t,n,i,o,r,a){var s=e.exports.sbrk,l=i+3&-4,c=s(l*o),u=s(r.length),h=new Uint8Array(e.exports.memory.buffer);h.set(r,u);var d=t(c,i,o,u,r.length);if(0===d&&a&&a(c,l,o),n.set(h.subarray(c,c+i*o)),s(c-s(0)),0!==d)throw new Error("Malformed buffer data: ".concat(d))}var Ew="EXT_meshopt_compression";function bw(){return(bw=k(S.mark((function e(t,n){var i,o,r,a,s,l;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(o=new ow(t),null!=n&&null!==(i=n.gltf)&&void 0!==i&&i.decompressMeshes){e.next=3;break}return e.abrupt("return");case 3:r=[],a=td(t.json.bufferViews||[]);try{for(a.s();!(s=a.n()).done;)l=s.value,r.push(ww(o,l))}catch(e){a.e(e)}finally{a.f()}return e.next=8,Promise.all(r);case 8:o.removeExtension(Ew);case 9:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function ww(e,t){return xw.apply(this,arguments)}function xw(){return(xw=k(S.mark((function e(t,n){var i,o,r,a,s,l,c,u,h,d,p,f,m;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(i=t.getObjectExtension(n,Ew))){e.next=9;break}return o=n.buffer,r=i.byteOffset,a=void 0===r?0:r,s=i.byteLength,l=void 0===s?0:s,c=i.byteStride,u=i.count,h=i.mode,d=i.filter,p=void 0===d?"NONE":d,f=new Uint8Array(o,a,l),m=new ArrayBuffer(u*c),e.next=8,dw(new Uint8Array(m),u,c,f,h,p);case 8:return e.abrupt("return",m);case 9:return e.abrupt("return",null);case 10:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var Cw="EXT_texture_webp";var Tw="KHR_texture_basisu";function Iw(e){var t={};for(var n in e){var i=e[n];if("indices"!==n){var o=kw(i);t[n]=o}}return t}function kw(e){var t=function(e){var t=e,n=1,i=0;e&&e.value&&(t=e.value,n=e.size||1);t&&(ArrayBuffer.isView(t)||(t=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(!e)return null;if(Array.isArray(e))return new t(e);if(n&&!(e instanceof t))return new t(e);return e}(t,Float32Array)),i=t.length/n);return{buffer:t,size:n,count:i}}(e),n=t.buffer,i=t.size;return{value:n,size:i,byteOffset:0,count:t.count,type:$b(i),componentType:ew(n)}}var Bw="KHR_draco_mesh_compression";function Pw(){return(Pw=k(S.mark((function e(t,n,i){var o,r,a,s,l,c;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(null!=n&&null!==(o=n.gltf)&&void 0!==o&&o.decompressMeshes){e.next=2;break}return e.abrupt("return");case 2:r=new ow(t),a=[],s=td(Lw(r));try{for(s.s();!(l=s.n()).done;)c=l.value,r.getObjectExtension(c,Bw)&&a.push(Rw(r,c,n,i))}catch(e){s.e(e)}finally{s.f()}return e.next=8,Promise.all(a);case 8:r.removeExtension(Bw);case 9:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Rw(e,t,n,i){return Mw.apply(this,arguments)}function Mw(){return(Mw=k(S.mark((function e(t,n,i,o){var r,a,s,l,c,u,h,d,p,f,m,v,g,y;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=t.getObjectExtension(n,Bw)){e.next=3;break}return e.abrupt("return");case 3:return a=t.getTypedArrayForBufferView(r.bufferView),s=$d(a.buffer,a.byteOffset),l=o.parse,delete(c=od({},i))["3d-tiles"],e.next=10,l(s,RA,c,o);case 10:for(u=e.sent,h=Iw(u.attributes),d=0,p=Object.entries(h);d<p.length;d++)f=fe(p[d],2),m=f[0],v=f[1],m in n.attributes&&(g=n.attributes[m],null!=(y=t.getAccessor(g))&&y.min&&null!=y&&y.max&&(v.min=y.min,v.max=y.max));n.attributes=h,u.indices&&(n.indices=kw(u.indices)),Dw(n);case 16:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Sw(e,t){var n,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:4,o=arguments.length>3?arguments[3]:void 0,r=arguments.length>4?arguments[4]:void 0;if(!o.DracoWriter)throw new Error("options.gltf.DracoWriter not provided");var a=o.DracoWriter.encodeSync({attributes:e}),s=null==r||null===(n=r.parseSync)||void 0===n?void 0:n.call(r,{attributes:e}),l=o._addFauxAttributes(s.attributes),c=o.addBufferView(a),u={primitives:[{attributes:l,mode:i,extensions:{[Bw]:{bufferView:c,attributes:l}}}]};return u}function Dw(e){if(!e.attributes&&Object.keys(e.attributes).length>0)throw new Error("glTF: Empty primitive detected: Draco decompression failure?")}function Lw(e){var t,n,i,o,r,a;return S.wrap((function(s){for(;;)switch(s.prev=s.next){case 0:t=td(e.json.meshes||[]),s.prev=1,t.s();case 3:if((n=t.n()).done){s.next=24;break}i=n.value,o=td(i.primitives),s.prev=6,o.s();case 8:if((r=o.n()).done){s.next=14;break}return a=r.value,s.next=12,a;case 12:s.next=8;break;case 14:s.next=19;break;case 16:s.prev=16,s.t0=s.catch(6),o.e(s.t0);case 19:return s.prev=19,o.f(),s.finish(19);case 22:s.next=3;break;case 24:s.next=29;break;case 26:s.prev=26,s.t1=s.catch(1),t.e(s.t1);case 29:return s.prev=29,t.f(),s.finish(29);case 32:case"end":return s.stop()}}),ed,null,[[1,26,29,32],[6,16,19,22]])}var Fw="KHR_lights_punctual";function Hw(){return(Hw=k(S.mark((function e(t){var n,i,o,r,a,s,l;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:n=new ow(t),i=n.json,(o=n.getExtension(Fw))&&(n.json.lights=o.lights,n.removeExtension(Fw)),r=td(i.nodes||[]);try{for(r.s();!(a=r.n()).done;)s=a.value,(l=n.getObjectExtension(s,Fw))&&(s.light=l.light),n.removeObjectExtension(s,Fw)}catch(e){r.e(e)}finally{r.f()}case 6:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Vw(){return(Vw=k(S.mark((function e(t){var n,i,o,r,a,s,l;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=new ow(t),(i=n.json).lights&&(Gb(!(o=n.addExtension(Fw)).lights),o.lights=i.lights,delete i.lights),n.json.lights){r=td(n.json.lights);try{for(r.s();!(a=r.n()).done;)s=a.value,l=s.node,n.addObjectExtension(l,Fw,s)}catch(e){r.e(e)}finally{r.f()}delete n.json.lights}case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var Ow="KHR_materials_unlit";function Qw(){return(Qw=k(S.mark((function e(t){var n,i,o,r,a;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:n=new ow(t),i=n.json,n.removeExtension(Ow),o=td(i.materials||[]);try{for(o.s();!(r=o.n()).done;)a=r.value,a.extensions&&a.extensions.KHR_materials_unlit&&(a.unlit=!0),n.removeObjectExtension(a,Ow)}catch(e){o.e(e)}finally{o.f()}case 5:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var _w="KHR_techniques_webgl";function zw(){return(zw=k(S.mark((function e(t){var n,i,o,r,a,s,l,c;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=new ow(t),i=n.json,o=n.getExtension(_w)){r=Nw(o,n),a=td(i.materials||[]);try{for(a.s();!(s=a.n()).done;)l=s.value,(c=n.getObjectExtension(l,_w))&&(l.technique=Object.assign({},c,r[c.technique]),l.technique.values=Gw(l.technique,n)),n.removeObjectExtension(l,_w)}catch(e){a.e(e)}finally{a.f()}n.removeExtension(_w)}case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Uw(){return(Uw=k(S.mark((function e(t,n){return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Nw(e,t){var n=e.programs,i=void 0===n?[]:n,o=e.shaders,r=void 0===o?[]:o,a=e.techniques,s=void 0===a?[]:a,l=new TextDecoder;return r.forEach((function(e){if(!Number.isFinite(e.bufferView))throw new Error("KHR_techniques_webgl: no shader code");e.code=l.decode(t.getTypedArrayForBufferView(e.bufferView))})),i.forEach((function(e){e.fragmentShader=r[e.fragmentShader],e.vertexShader=r[e.vertexShader]})),s.forEach((function(e){e.program=i[e.program]})),s}function Gw(e,t){var n=Object.assign({},e.values);return Object.keys(e.uniforms||{}).forEach((function(t){e.uniforms[t].value&&!(t in n)&&(n[t]=e.uniforms[t].value)})),Object.keys(n).forEach((function(e){"object"==typeof n[e]&&void 0!==n[e].index&&(n[e].texture=t.getTexture(n[e].index))})),n}var jw=[Object.freeze({__proto__:null,name:"EXT_meshopt_compression",preprocess:function(e){if(new ow(e).getRequiredExtensions().includes(Ew)&&!rw)throw new Error("gltf: Required extension ".concat(Ew," not supported by browser"))},decode:function(e,t){return bw.apply(this,arguments)}}),Object.freeze({__proto__:null,name:"EXT_texture_webp",preprocess:function(e,t){var n=new ow(e);if(Nb("image/webp")){var i,o=td(n.json.textures||[]);try{for(o.s();!(i=o.n()).done;){var r=i.value,a=n.getObjectExtension(r,Cw);a&&(r.source=a.source),n.removeObjectExtension(r,Cw)}}catch(e){o.e(e)}finally{o.f()}n.removeExtension(Cw)}else if(n.getRequiredExtensions().includes(Cw))throw new Error("gltf: Required extension ".concat(Cw," not supported by browser"))}}),Object.freeze({__proto__:null,name:"KHR_texture_basisu",preprocess:function(e,t){var n,i=new ow(e),o=td(i.json.textures||[]);try{for(o.s();!(n=o.n()).done;){var r=n.value,a=i.getObjectExtension(r,Tw);a&&(r.source=a.source),i.removeObjectExtension(r,Tw)}}catch(e){o.e(e)}finally{o.f()}i.removeExtension(Tw)}}),Object.freeze({__proto__:null,name:"KHR_draco_mesh_compression",preprocess:function(e,t,n){var i,o=new ow(e),r=td(Lw(o));try{for(r.s();!(i=r.n()).done;){var a=i.value;o.getObjectExtension(a,Bw)}}catch(e){r.e(e)}finally{r.f()}},decode:function(e,t,n){return Pw.apply(this,arguments)},encode:function(e){var t,n=new ow(e),i=td(n.json.meshes||[]);try{for(i.s();!(t=i.n()).done;){Sw(t.value),n.addRequiredExtension(Bw)}}catch(e){i.e(e)}finally{i.f()}}}),Object.freeze({__proto__:null,name:"KHR_lights_punctual",decode:function(e){return Hw.apply(this,arguments)},encode:function(e){return Vw.apply(this,arguments)}}),Object.freeze({__proto__:null,name:"KHR_materials_unlit",decode:function(e){return Qw.apply(this,arguments)},encode:function(e){var t=new ow(e),n=t.json;if(t.materials){var i,o=td(n.materials||[]);try{for(o.s();!(i=o.n()).done;){var r=i.value;r.unlit&&(delete r.unlit,t.addObjectExtension(r,Ow,{}),t.addExtension(Ow))}}catch(e){o.e(e)}finally{o.f()}}}}),Object.freeze({__proto__:null,name:"KHR_techniques_webgl",decode:function(e){return zw.apply(this,arguments)},encode:function(e,t){return Uw.apply(this,arguments)}})];function Ww(e){var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=arguments.length>2?arguments[2]:void 0,o=jw.filter((function(e){return Yw(e.name,n)})),r=td(o);try{for(r.s();!(t=r.n()).done;){var a,s=t.value;null===(a=s.preprocess)||void 0===a||a.call(s,e,n,i)}}catch(e){r.e(e)}finally{r.f()}}function qw(e){return Jw.apply(this,arguments)}function Jw(){return(Jw=k(S.mark((function e(t){var n,i,o,r,a,s,l,c=arguments;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:n=c.length>1&&void 0!==c[1]?c[1]:{},i=c.length>2?c[2]:void 0,o=jw.filter((function(e){return Yw(e.name,n)})),r=td(o),e.prev=4,r.s();case 6:if((a=r.n()).done){e.next=12;break}return s=a.value,e.next=10,null===(l=s.decode)||void 0===l?void 0:l.call(s,t,n,i);case 10:e.next=6;break;case 12:e.next=17;break;case 14:e.prev=14,e.t0=e.catch(4),r.e(e.t0);case 17:return e.prev=17,r.f(),e.finish(17);case 20:case"end":return e.stop()}}),e,null,[[4,14,17,20]])})))).apply(this,arguments)}function Yw(e,t){var n,i=(null==t||null===(n=t.gltf)||void 0===n?void 0:n.excludeExtensions)||{};return!(e in i&&!i[e])}var Zw="KHR_binary_glTF";var Xw={accessors:"accessor",animations:"animation",buffers:"buffer",bufferViews:"bufferView",images:"image",materials:"material",meshes:"mesh",nodes:"node",samplers:"sampler",scenes:"scene",skins:"skin",textures:"texture"},Kw={accessor:"accessors",animations:"animation",buffer:"buffers",bufferView:"bufferViews",image:"images",material:"materials",mesh:"meshes",node:"nodes",sampler:"samplers",scene:"scenes",skin:"skins",texture:"textures"},$w=function(){function e(){o(this,e),Ad(this,"idToIndexMap",{animations:{},accessors:{},buffers:{},bufferViews:{},images:{},materials:{},meshes:{},nodes:{},samplers:{},scenes:{},skins:{},textures:{}}),Ad(this,"json",void 0)}return u(e,[{key:"normalize",value:function(e,t){this.json=e.json;var n=e.json;switch(n.asset&&n.asset.version){case"2.0":return;case void 0:case"1.0":break;default:return void console.warn("glTF: Unknown version ".concat(n.asset.version))}if(!t.normalize)throw new Error("glTF v1 is not supported.");console.warn("Converting glTF v1 to glTF v2 format. This is experimental and may fail."),this._addAsset(n),this._convertTopLevelObjectsToArrays(n),function(e){var t,n=new ow(e),i=n.json,o=td(i.images||[]);try{for(o.s();!(t=o.n()).done;){var r=t.value,a=n.getObjectExtension(r,Zw);a&&Object.assign(r,a),n.removeObjectExtension(r,Zw)}}catch(e){o.e(e)}finally{o.f()}i.buffers&&i.buffers[0]&&delete i.buffers[0].uri,n.removeExtension(Zw)}(e),this._convertObjectIdsToArrayIndices(n),this._updateObjects(n),this._updateMaterial(n)}},{key:"_addAsset",value:function(e){e.asset=e.asset||{},e.asset.version="2.0",e.asset.generator=e.asset.generator||"Normalized to glTF 2.0 by loaders.gl"}},{key:"_convertTopLevelObjectsToArrays",value:function(e){for(var t in Xw)this._convertTopLevelObjectToArray(e,t)}},{key:"_convertTopLevelObjectToArray",value:function(e,t){var n=e[t];if(n&&!Array.isArray(n))for(var i in e[t]=[],n){var o=n[i];o.id=o.id||i;var r=e[t].length;e[t].push(o),this.idToIndexMap[t][i]=r}}},{key:"_convertObjectIdsToArrayIndices",value:function(e){for(var t in Xw)this._convertIdsToIndices(e,t);"scene"in e&&(e.scene=this._convertIdToIndex(e.scene,"scene"));var n,i=td(e.textures);try{for(i.s();!(n=i.n()).done;){var o=n.value;this._convertTextureIds(o)}}catch(e){i.e(e)}finally{i.f()}var r,a=td(e.meshes);try{for(a.s();!(r=a.n()).done;){var s=r.value;this._convertMeshIds(s)}}catch(e){a.e(e)}finally{a.f()}var l,c=td(e.nodes);try{for(c.s();!(l=c.n()).done;){var u=l.value;this._convertNodeIds(u)}}catch(e){c.e(e)}finally{c.f()}var h,d=td(e.scenes);try{for(d.s();!(h=d.n()).done;){var p=h.value;this._convertSceneIds(p)}}catch(e){d.e(e)}finally{d.f()}}},{key:"_convertTextureIds",value:function(e){e.source&&(e.source=this._convertIdToIndex(e.source,"image"))}},{key:"_convertMeshIds",value:function(e){var t,n=td(e.primitives);try{for(n.s();!(t=n.n()).done;){var i=t.value,o=i.attributes,r=i.indices,a=i.material;for(var s in o)o[s]=this._convertIdToIndex(o[s],"accessor");r&&(i.indices=this._convertIdToIndex(r,"accessor")),a&&(i.material=this._convertIdToIndex(a,"material"))}}catch(e){n.e(e)}finally{n.f()}}},{key:"_convertNodeIds",value:function(e){var t=this;e.children&&(e.children=e.children.map((function(e){return t._convertIdToIndex(e,"node")}))),e.meshes&&(e.meshes=e.meshes.map((function(e){return t._convertIdToIndex(e,"mesh")})))}},{key:"_convertSceneIds",value:function(e){var t=this;e.nodes&&(e.nodes=e.nodes.map((function(e){return t._convertIdToIndex(e,"node")})))}},{key:"_convertIdsToIndices",value:function(e,t){e[t]||(console.warn("gltf v1: json doesn't contain attribute ".concat(t)),e[t]=[]);var n,i=td(e[t]);try{for(i.s();!(n=i.n()).done;){var o=n.value;for(var r in o){var a=o[r],s=this._convertIdToIndex(a,r);o[r]=s}}}catch(e){i.e(e)}finally{i.f()}}},{key:"_convertIdToIndex",value:function(e,t){var n=Kw[t];if(n in this.idToIndexMap){var i=this.idToIndexMap[n][e];if(!Number.isFinite(i))throw new Error("gltf v1: failed to resolve ".concat(t," with id ").concat(e));return i}return e}},{key:"_updateObjects",value:function(e){var t,n=td(this.json.buffers);try{for(n.s();!(t=n.n()).done;){delete t.value.type}}catch(e){n.e(e)}finally{n.f()}}},{key:"_updateMaterial",value:function(e){var t,n=td(e.materials);try{var i=function(){var n=t.value;n.pbrMetallicRoughness={baseColorFactor:[1,1,1,1],metallicFactor:1,roughnessFactor:1};var i=n.values&&n.values.tex,o=e.textures.findIndex((function(e){return e.id===i}));-1!==o&&(n.pbrMetallicRoughness.baseColorTexture={index:o})};for(n.s();!(t=n.n()).done;)i()}catch(e){n.e(e)}finally{n.f()}}}]),e}();function ex(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return(new $w).normalize(e,t)}var tx={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},nx={5120:1,5121:1,5122:2,5123:2,5125:4,5126:4},ix=10240,ox=10241,rx=10242,ax=10243,sx=10497,lx={magFilter:ix,minFilter:ox,wrapS:rx,wrapT:ax},cx={[ix]:9729,[ox]:9986,[rx]:sx,[ax]:sx};var ux=function(){function e(){o(this,e),Ad(this,"baseUri",""),Ad(this,"json",{}),Ad(this,"buffers",[]),Ad(this,"images",[])}return u(e,[{key:"postProcess",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=e.json,i=e.buffers,o=void 0===i?[]:i,r=e.images,a=void 0===r?[]:r,s=e.baseUri,l=void 0===s?"":s;return Gb(n),this.baseUri=l,this.json=n,this.buffers=o,this.images=a,this._resolveTree(this.json,t),this.json}},{key:"_resolveTree",value:function(e){var t=this;e.bufferViews&&(e.bufferViews=e.bufferViews.map((function(e,n){return t._resolveBufferView(e,n)}))),e.images&&(e.images=e.images.map((function(e,n){return t._resolveImage(e,n)}))),e.samplers&&(e.samplers=e.samplers.map((function(e,n){return t._resolveSampler(e,n)}))),e.textures&&(e.textures=e.textures.map((function(e,n){return t._resolveTexture(e,n)}))),e.accessors&&(e.accessors=e.accessors.map((function(e,n){return t._resolveAccessor(e,n)}))),e.materials&&(e.materials=e.materials.map((function(e,n){return t._resolveMaterial(e,n)}))),e.meshes&&(e.meshes=e.meshes.map((function(e,n){return t._resolveMesh(e,n)}))),e.nodes&&(e.nodes=e.nodes.map((function(e,n){return t._resolveNode(e,n)}))),e.skins&&(e.skins=e.skins.map((function(e,n){return t._resolveSkin(e,n)}))),e.scenes&&(e.scenes=e.scenes.map((function(e,n){return t._resolveScene(e,n)}))),void 0!==e.scene&&(e.scene=e.scenes[this.json.scene])}},{key:"getScene",value:function(e){return this._get("scenes",e)}},{key:"getNode",value:function(e){return this._get("nodes",e)}},{key:"getSkin",value:function(e){return this._get("skins",e)}},{key:"getMesh",value:function(e){return this._get("meshes",e)}},{key:"getMaterial",value:function(e){return this._get("materials",e)}},{key:"getAccessor",value:function(e){return this._get("accessors",e)}},{key:"getCamera",value:function(e){return null}},{key:"getTexture",value:function(e){return this._get("textures",e)}},{key:"getSampler",value:function(e){return this._get("samplers",e)}},{key:"getImage",value:function(e){return this._get("images",e)}},{key:"getBufferView",value:function(e){return this._get("bufferViews",e)}},{key:"getBuffer",value:function(e){return this._get("buffers",e)}},{key:"_get",value:function(e,t){if("object"==typeof t)return t;var n=this.json[e]&&this.json[e][t];return n||console.warn("glTF file error: Could not find ".concat(e,"[").concat(t,"]")),n}},{key:"_resolveScene",value:function(e,t){var n=this;return e.id=e.id||"scene-".concat(t),e.nodes=(e.nodes||[]).map((function(e){return n.getNode(e)})),e}},{key:"_resolveNode",value:function(e,t){var n=this;return e.id=e.id||"node-".concat(t),e.children&&(e.children=e.children.map((function(e){return n.getNode(e)}))),void 0!==e.mesh?e.mesh=this.getMesh(e.mesh):void 0!==e.meshes&&e.meshes.length&&(e.mesh=e.meshes.reduce((function(e,t){var i=n.getMesh(t);return e.id=i.id,e.primitives=e.primitives.concat(i.primitives),e}),{primitives:[]})),void 0!==e.camera&&(e.camera=this.getCamera(e.camera)),void 0!==e.skin&&(e.skin=this.getSkin(e.skin)),e}},{key:"_resolveSkin",value:function(e,t){return e.id=e.id||"skin-".concat(t),e.inverseBindMatrices=this.getAccessor(e.inverseBindMatrices),e}},{key:"_resolveMesh",value:function(e,t){var n=this;return e.id=e.id||"mesh-".concat(t),e.primitives&&(e.primitives=e.primitives.map((function(e){var t=(e=od({},e)).attributes;for(var i in e.attributes={},t)e.attributes[i]=n.getAccessor(t[i]);return void 0!==e.indices&&(e.indices=n.getAccessor(e.indices)),void 0!==e.material&&(e.material=n.getMaterial(e.material)),e}))),e}},{key:"_resolveMaterial",value:function(e,t){if(e.id=e.id||"material-".concat(t),e.normalTexture&&(e.normalTexture=od({},e.normalTexture),e.normalTexture.texture=this.getTexture(e.normalTexture.index)),e.occlusionTexture&&(e.occlustionTexture=od({},e.occlustionTexture),e.occlusionTexture.texture=this.getTexture(e.occlusionTexture.index)),e.emissiveTexture&&(e.emmisiveTexture=od({},e.emmisiveTexture),e.emissiveTexture.texture=this.getTexture(e.emissiveTexture.index)),e.emissiveFactor||(e.emissiveFactor=e.emmisiveTexture?[1,1,1]:[0,0,0]),e.pbrMetallicRoughness){e.pbrMetallicRoughness=od({},e.pbrMetallicRoughness);var n=e.pbrMetallicRoughness;n.baseColorTexture&&(n.baseColorTexture=od({},n.baseColorTexture),n.baseColorTexture.texture=this.getTexture(n.baseColorTexture.index)),n.metallicRoughnessTexture&&(n.metallicRoughnessTexture=od({},n.metallicRoughnessTexture),n.metallicRoughnessTexture.texture=this.getTexture(n.metallicRoughnessTexture.index))}return e}},{key:"_resolveAccessor",value:function(e,t){var n,i;if(e.id=e.id||"accessor-".concat(t),void 0!==e.bufferView&&(e.bufferView=this.getBufferView(e.bufferView)),e.bytesPerComponent=(n=e.componentType,nx[n]),e.components=(i=e.type,tx[i]),e.bytesPerElement=e.bytesPerComponent*e.components,e.bufferView){var o=e.bufferView.buffer,r=tw(e,e.bufferView),a=r.ArrayType,s=r.byteLength,l=(e.bufferView.byteOffset||0)+(e.byteOffset||0)+o.byteOffset,c=o.arrayBuffer.slice(l,l+s);e.bufferView.byteStride&&(c=this._getValueFromInterleavedBuffer(o,l,e.bufferView.byteStride,e.bytesPerElement,e.count)),e.value=new a(c)}return e}},{key:"_getValueFromInterleavedBuffer",value:function(e,t,n,i,o){for(var r=new Uint8Array(o*i),a=0;a<o;a++){var s=t+a*n;r.set(new Uint8Array(e.arrayBuffer.slice(s,s+i)),a*i)}return r.buffer}},{key:"_resolveTexture",value:function(e,t){return e.id=e.id||"texture-".concat(t),e.sampler="sampler"in e?this.getSampler(e.sampler):cx,e.source=this.getImage(e.source),e}},{key:"_resolveSampler",value:function(e,t){for(var n in e.id=e.id||"sampler-".concat(t),e.parameters={},e){var i=this._enumSamplerParameter(n);void 0!==i&&(e.parameters[i]=e[n])}return e}},{key:"_enumSamplerParameter",value:function(e){return lx[e]}},{key:"_resolveImage",value:function(e,t){e.id=e.id||"image-".concat(t),void 0!==e.bufferView&&(e.bufferView=this.getBufferView(e.bufferView));var n=this.images[t];return n&&(e.image=n),e}},{key:"_resolveBufferView",value:function(e,t){var n=e.buffer,i=od(od({id:"bufferView-".concat(t)},e),{},{buffer:this.buffers[n]}),o=this.buffers[n].arrayBuffer,r=this.buffers[n].byteOffset||0;return"byteOffset"in e&&(r+=e.byteOffset),i.data=new Uint8Array(o,r,e.byteLength),i}},{key:"_resolveCamera",value:function(e,t){return e.id=e.id||"camera-".concat(t),e.perspective,e.orthographic,e}}]),e}();function hx(e,t){return(new ux).postProcess(e,t)}var dx=1735152710,px=1313821514,fx=5130562,mx=!0;function vx(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return"".concat(String.fromCharCode(e.getUint8(t+0))).concat(String.fromCharCode(e.getUint8(t+1))).concat(String.fromCharCode(e.getUint8(t+2))).concat(String.fromCharCode(e.getUint8(t+3)))}function gx(e,t,n){ld(e.header.byteLength>20);var i=t.getUint32(n+0,mx),o=t.getUint32(n+4,mx);return n+=8,ld(0===o),Ax(e,t,n,i),n+=i,n+=Ex(e,t,n,e.header.byteLength)}function yx(e,t,n,i){return ld(e.header.byteLength>20),function(e,t,n,i){for(;n+8<=e.header.byteLength;){var o=t.getUint32(n+0,mx),r=t.getUint32(n+4,mx);switch(n+=8,r){case px:Ax(e,t,n,o);break;case fx:Ex(e,t,n,o);break;case 0:i.strict||Ax(e,t,n,o);break;case 1:i.strict||Ex(e,t,n,o)}n+=ep(o,4)}}(e,t,n,i),n+e.header.byteLength}function Ax(e,t,n,i){var o=new Uint8Array(t.buffer,n,i),r=new TextDecoder("utf8").decode(o);return e.json=JSON.parse(r),ep(i,4)}function Ex(e,t,n,i){return e.header.hasBinChunk=!0,e.binChunks.push({byteOffset:n,byteLength:i,arrayBuffer:t.buffer}),ep(i,4)}function bx(e,t){return wx.apply(this,arguments)}function wx(){return(wx=k(S.mark((function e(t,n){var i,o,r,a,s,l,c,u,h,d,p=arguments;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(i=p.length>2&&void 0!==p[2]?p[2]:0,o=p.length>3?p[3]:void 0,r=p.length>4?p[4]:void 0,xx(t,n,i,o),ex(t,{normalize:null==o||null===(a=o.gltf)||void 0===a?void 0:a.normalize}),Ww(t,o,r),u=[],null==o||null===(s=o.gltf)||void 0===s||!s.loadBuffers||!t.json.buffers){e.next=10;break}return e.next=10,Cx(t,o,r);case 10:return null!=o&&null!==(l=o.gltf)&&void 0!==l&&l.loadImages&&(h=Ix(t,o,r),u.push(h)),d=qw(t,o,r),u.push(d),e.next=15,Promise.all(u);case 15:return t.json.gltfArrayBuffer=n,e.abrupt("return",null!=o&&null!==(c=o.gltf)&&void 0!==c&&c.postProcess?hx(t,o):t);case 17:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function xx(e,t,n,i){(i.uri&&(e.baseUri=i.uri),t instanceof ArrayBuffer&&!function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=new DataView(e),o=n.magic,r=void 0===o?dx:o,a=i.getUint32(t,!1);return a===r||a===dx}(t,n,i))&&(t=(new TextDecoder).decode(t));if("string"==typeof t)e.json=Yd(t);else if(t instanceof ArrayBuffer){var o={};n=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=new DataView(t),o=vx(i,n+0),r=i.getUint32(n+4,mx),a=i.getUint32(n+8,mx);switch(Object.assign(e,{header:{byteOffset:n,byteLength:a,hasBinChunk:!1},type:o,version:r,json:{},binChunks:[]}),n+=12,e.version){case 1:return gx(e,i,n);case 2:return yx(e,i,n,{});default:throw new Error("Invalid GLB version ".concat(e.version,". Only supports v1 and v2."))}}(o,t,n,i.glb),Gb("glTF"===o.type,"Invalid GLB magic string ".concat(o.type)),e._glb=o,e.json=o.json}else Gb(!1,"GLTF: must be ArrayBuffer or string");var r=e.json.buffers||[];if(e.buffers=new Array(r.length).fill(null),e._glb&&e._glb.header.hasBinChunk){var a=e._glb.binChunks;e.buffers[0]={arrayBuffer:a[0].arrayBuffer,byteOffset:a[0].byteOffset,byteLength:a[0].byteLength}}var s=e.json.images||[];e.images=new Array(s.length).fill({})}function Cx(e,t,n){return Tx.apply(this,arguments)}function Tx(){return(Tx=k(S.mark((function e(t,n,i){var o,r,a,s,l,c,u,h;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:o=t.json.buffers||[],r=0;case 2:if(!(r<o.length)){e.next=19;break}if(!(a=o[r]).uri){e.next=16;break}return Gb(i.fetch),c=jb(a.uri,n),e.next=10,null==i||null===(s=i.fetch)||void 0===s?void 0:s.call(i,c);case 10:return u=e.sent,e.next=13,null==u||null===(l=u.arrayBuffer)||void 0===l?void 0:l.call(u);case 13:h=e.sent,t.buffers[r]={arrayBuffer:h,byteOffset:0,byteLength:h.byteLength},delete a.uri;case 16:++r,e.next=2;break;case 19:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Ix(e,t,n){return kx.apply(this,arguments)}function kx(){return(kx=k(S.mark((function e(t,n,i){var o,r,a,s,l,c;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:o=Bx(t),r=t.json.images||[],a=[],s=td(o);try{for(s.s();!(l=s.n()).done;)c=l.value,a.push(Px(t,r[c],c,n,i))}catch(e){s.e(e)}finally{s.f()}return e.next=7,Promise.all(a);case 7:return e.abrupt("return",e.sent);case 8:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Bx(e){var t,n=new Set,i=td(e.json.textures||[]);try{for(i.s();!(t=i.n()).done;){var o=t.value;void 0!==o.source&&n.add(o.source)}}catch(e){i.e(e)}finally{i.f()}return Array.from(n).sort()}function Px(e,t,n,i,o){return Rx.apply(this,arguments)}function Rx(){return(Rx=k(S.mark((function e(t,n,i,o,r){var a,s,l,c,u,h,d;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(a=r.fetch,s=r.parse,!n.uri){e.next=9;break}return c=jb(n.uri,o),e.next=5,a(c);case 5:return u=e.sent,e.next=8,u.arrayBuffer();case 8:l=e.sent;case 9:return Number.isFinite(n.bufferView)&&(h=Wb(t.json,t.buffers,n.bufferView),l=$d(h.buffer,h.byteOffset,h.byteLength)),Gb(l,"glTF image has no data"),e.next=13,s(l,[_b,lb],{mimeType:n.mimeType,basis:o.basis||{format:sb()}},r);case 13:(d=e.sent)&&d[0]&&(d={compressed:!0,mipmaps:!1,width:d[0].width,height:d[0].height,data:d}),t.images=t.images||[],t.images[i]=d;case 17:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var Mx={name:"glTF",id:"gltf",module:"gltf",version:"3.1.4",extensions:["gltf","glb"],mimeTypes:["model/gltf+json","model/gltf-binary"],text:!0,binary:!0,tests:["glTF"],parse:function(e){return Sx.apply(this,arguments)},options:{gltf:{normalize:!0,loadBuffers:!0,loadImages:!0,decompressMeshes:!0,postProcess:!0},log:console},deprecatedOptions:{fetchImages:"gltf.loadImages",createImages:"gltf.loadImages",decompress:"gltf.decompressMeshes",postProcess:"gltf.postProcess",gltf:{decompress:"gltf.decompressMeshes"}}};function Sx(){return(Sx=k(S.mark((function e(t){var n,i,o,r,a,s=arguments;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=s.length>1&&void 0!==s[1]?s[1]:{},i=s.length>2?s[2]:void 0,(n=od(od({},Mx.options),n)).gltf=od(od({},Mx.options.gltf),n.gltf),o=n.byteOffset,r=void 0===o?0:o,a={},e.next=8,bx(a,t,r,n,i);case 8:return e.abrupt("return",e.sent);case 9:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var Dx=0,Lx=1;function Fx(e,t,n,i){e.rotateYtoZ=!0;var o=e.byteOffset+e.byteLength-n;if(0===o)throw new Error("glTF byte length must be greater than 0.");return e.gltfUpAxis=i["3d-tiles"]&&i["3d-tiles"].assetGltfUpAxis?i["3d-tiles"].assetGltfUpAxis:"Y",e.gltfArrayBuffer=$d(t,n,o),e.gltfByteOffset=0,e.gltfByteLength=o,n%4==0||console.warn("".concat(e.type,": embedded glb is not aligned to a 4-byte boundary.")),e.byteOffset+e.byteLength}function Hx(e,t,n,i){return Vx.apply(this,arguments)}function Vx(){return(Vx=k(S.mark((function e(t,n,i,o){var r,a,s;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=i["3d-tiles"]||{},Ox(t,n),!r.loadGLTF){e.next=16;break}if(a=o.parse,s=o.fetch,!t.gltfUrl){e.next=9;break}return e.next=7,s(t.gltfUrl,i);case 7:t.gltfArrayBuffer=e.sent,t.gltfByteOffset=0;case 9:if(!t.gltfArrayBuffer){e.next=16;break}return e.next=12,a(t.gltfArrayBuffer,Mx,i,o);case 12:t.gltf=e.sent,delete t.gltfArrayBuffer,delete t.gltfByteOffset,delete t.gltfByteLength;case 16:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Ox(e,t,n){switch(t){case Dx:var i=new Uint8Array(e.gltfArrayBuffer,e.gltfByteOffset),o=(new TextDecoder).decode(i);e.gltfUrl=o.replace(/[\s\0]+$/,""),delete e.gltfArrayBuffer,delete e.gltfByteOffset,delete e.gltfByteLength;break;case Lx:break;default:throw new Error("b3dm: Illegal glTF format field")}}function Qx(e,t,n,i,o){return _x.apply(this,arguments)}function _x(){return(_x=k(S.mark((function e(t,n,i,o,r){var a,s;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=zx(t,n,i,o),e.next=3,Hx(t,Lx,o,r);case 3:return(s=null==t||null===(a=t.gltf)||void 0===a?void 0:a.extensions)&&s.CESIUM_RTC&&(t.rtcCenter=s.CESIUM_RTC.center),e.abrupt("return",i);case 6:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function zx(e,t,n,i,o){n=Fx(e,t,n=oE(e,t,n=iE(e,t,n=tE(e,t,n))),i);var r=new NA(e.featureTableJson,e.featureTableBinary);return e.rtcCenter=r.getGlobalProperty("RTC_CENTER",DA.FLOAT,3),n}function Ux(e,t,n,i,o){return Nx.apply(this,arguments)}function Nx(){return(Nx=k(S.mark((function e(t,n,i,o,r){return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=Gx(t,n,i,o),e.next=3,Hx(t,t.gltfFormat,o,r);case 3:return e.abrupt("return",i);case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Gx(e,t,n,i,o){if(n=tE(e,t,n),1!==e.version)throw new Error("Instanced 3D Model version ".concat(e.version," is not supported"));n=iE(e,t,n);var r=new DataView(t);if(e.gltfFormat=r.getUint32(n,!0),n=Fx(e,t,n=oE(e,t,n+=4),i),0===e.featureTableJsonByteLength)throw new Error("i3dm parser: featureTableJsonByteLength is zero.");var a=new NA(e.featureTableJson,e.featureTableBinary),s=a.getGlobalProperty("INSTANCES_LENGTH");if(a.featuresLength=s,!Number.isFinite(s))throw new Error("i3dm parser: INSTANCES_LENGTH must be defined");e.eastNorthUp=a.getGlobalProperty("EAST_NORTH_UP"),e.rtcCenter=a.getGlobalProperty("RTC_CENTER",DA.FLOAT,3);new eE(e.batchTableJson,e.batchTableBinary,s);return function(e,t,n,i){var o=[new Array(i),e._batchTable][0],r=new Nm;new Nm,new Nm,new Nm;for(var a=new Xm,s=new Tv,l=new Nm,c={},u=new sv,h=[],d=[],p=new Nm,f=new Nm,m=0;m<i;m++){var v=void 0;if(t.hasProperty("POSITION"))v=t.getProperty("POSITION",DA.FLOAT,3,m,r);else if(t.hasProperty("POSITION_QUANTIZED")){v=t.getProperty("POSITION_QUANTIZED",DA.UNSIGNED_SHORT,3,m,r);var g=t.getGlobalProperty("QUANTIZED_VOLUME_OFFSET",DA.FLOAT,3,p);if(!g)throw new Error("i3dm parser: QUANTIZED_VOLUME_OFFSET must be defined for quantized positions.");var y=t.getGlobalProperty("QUANTIZED_VOLUME_SCALE",DA.FLOAT,3,f);if(!y)throw new Error("i3dm parser: QUANTIZED_VOLUME_SCALE must be defined for quantized positions.");for(var A=65535,E=0;E<3;E++)v[E]=v[E]/A*y[E]+g[E]}if(!v)throw new Error("i3dm: POSITION or POSITION_QUANTIZED must be defined for each instance.");if(r.copy(v),c.translation=r,e.normalUp=t.getProperty("NORMAL_UP",DA.FLOAT,3,m,h),e.normalRight=t.getProperty("NORMAL_RIGHT",DA.FLOAT,3,m,d),e.normalUp){if(!e.normalRight)throw new Error("i3dm: Custom orientation requires both NORMAL_UP and NORMAL_RIGHT.");e.hasCustomOrientation=!0}else{if(e.octNormalUp=t.getProperty("NORMAL_UP_OCT32P",DA.UNSIGNED_SHORT,2,h),e.octNormalRight=t.getProperty("NORMAL_RIGHT_OCT32P",DA.UNSIGNED_SHORT,2,d),e.octNormalUp){if(!e.octNormalRight)throw new Error("i3dm: oct-encoded orientation requires NORMAL_UP_OCT32P and NORMAL_RIGHT_OCT32P");throw new Error("i3dm: oct-encoded orientation not implemented")}e.eastNorthUp?(Kv.WGS84.eastNorthUpToFixedFrame(r,u),u.getRotationMatrix3(a)):a.identity()}s.fromMatrix3(a),c.rotation=s,l.set(1,1,1);var b=t.getProperty("SCALE",DA.FLOAT,1,m);Number.isFinite(b)&&l.multiplyByScalar(b);var w=t.getProperty("SCALE_NON_UNIFORM",DA.FLOAT,3,m,h);w&&l.scale(w),c.scale=l;var x=t.getProperty("BATCH_ID",DA.UNSIGNED_SHORT,1,m);void 0===x&&(x=m);var C=(new sv).fromQuaternion(c.rotation);u.identity(),u.translate(c.translation),u.multiplyRight(C),u.scale(c.scale);var T=u.clone();o[m]={modelMatrix:T,batchId:x}}e.instances=o}(e,a,0,s),n}function jx(e,t,n,i,o,r){return Wx.apply(this,arguments)}function Wx(){return(Wx=k(S.mark((function e(t,n,i,o,r,a){var s,l;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:i=tE(t,n,i),s=new DataView(n),t.tilesLength=s.getUint32(i,!0),i+=4,t.tiles=[];case 5:if(!(t.tiles.length<t.tilesLength&&t.byteLength-i>12)){e.next=13;break}return l={},t.tiles.push(l),e.next=10,a(n,i,o,r,l);case 10:i=e.sent,e.next=5;break;case 13:return e.abrupt("return",i);case 14:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function qx(e,t,n,i){return Jx.apply(this,arguments)}function Jx(){return(Jx=k(S.mark((function e(t,n,i,o){var r;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t.rotateYtoZ=!0,t.gltfUpAxis=i["3d-tiles"]&&i["3d-tiles"].assetGltfUpAxis?i["3d-tiles"].assetGltfUpAxis:"Y",r=o.parse,e.next=5,r(n,Mx,i,o);case 5:t.gltf=e.sent;case 6:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Yx(e){return Zx.apply(this,arguments)}function Zx(){return(Zx=k(S.mark((function e(t){var n,i,o,r,a=arguments;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:n=a.length>1&&void 0!==a[1]?a[1]:0,i=a.length>2?a[2]:void 0,o=a.length>3?a[3]:void 0,(r=a.length>4&&void 0!==a[4]?a[4]:{}).byteOffset=n,r.type=Wy(t,n),e.t0=r.type,e.next=e.t0===_y?9:e.t0===Uy?12:e.t0===Gy?15:e.t0===Ny?18:e.t0===zy?21:24;break;case 9:return e.next=11,jx(r,t,n,i,o,Yx);case 11:return e.abrupt("return",e.sent);case 12:return e.next=14,Qx(r,t,n,i,o);case 14:return e.abrupt("return",e.sent);case 15:return e.next=17,qx(r,t,i,o);case 17:return e.abrupt("return",e.sent);case 18:return e.next=20,Ux(r,t,n,i,o);case 20:return e.abrupt("return",e.sent);case 21:return e.next=23,lE(r,t,n,i,o);case 23:return e.abrupt("return",e.sent);case 24:throw new Error("3DTileLoader: unknown type ".concat(r.type));case 25:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var Xx=1952609651;function Kx(){return(Kx=k(S.mark((function e(t){var n,i,o,r,a,s,l;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(new Uint32Array(t.slice(0,4))[0]===Xx){e.next=3;break}throw new Error("Wrong subtree file magic number");case 3:if(1===new Uint32Array(t.slice(4,8))[0]){e.next=6;break}throw new Error("Wrong subtree file verson, must be 1");case 6:if(n=tC(t.slice(8,16)),i=new Uint8Array(t,24,n),o=new TextDecoder("utf8"),r=o.decode(i),a=JSON.parse(r),s=tC(t.slice(16,24)),l=new ArrayBuffer(0),s&&(l=t.slice(24+n)),!("bufferView"in a.tileAvailability)){e.next=18;break}return e.next=17,$x(a,"tileAvailability",l);case 17:a.tileAvailability.explicitBitstream=e.sent;case 18:if(!("bufferView"in a.contentAvailability)){e.next=22;break}return e.next=21,$x(a,"contentAvailability",l);case 21:a.contentAvailability.explicitBitstream=e.sent;case 22:if(!("bufferView"in a.childSubtreeAvailability)){e.next=26;break}return e.next=25,$x(a,"childSubtreeAvailability",l);case 25:a.childSubtreeAvailability.explicitBitstream=e.sent;case 26:return e.abrupt("return",a);case 27:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function $x(e,t,n){return eC.apply(this,arguments)}function eC(){return(eC=k(S.mark((function e(t,n,i){var o,r,a,s,l;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(o=t[n].bufferView,r=t.bufferViews[o],!(a=t.buffers[r.buffer]).uri){e.next=11;break}return e.next=6,zp(a.uri);case 6:return s=e.sent,e.next=9,s.arrayBuffer();case 9:return l=e.sent,e.abrupt("return",new Uint8Array(l,r.byteOffset,r.byteLength));case 11:return e.abrupt("return",new Uint8Array(i,r.byteOffset,r.byteLength));case 12:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function tC(e){var t=new DataView(e),n=t.getUint32(0,!0),i=t.getUint32(4,!0);return n+Math.pow(2,32)*i}var nC={id:"3d-tiles-subtree",name:"3D Tiles Subtree",module:"3d-tiles",version:Qy,extensions:["subtree"],mimeTypes:["application/octet-stream"],tests:["subtree"],parse:function(e){return Kx.apply(this,arguments)},options:{}},iC={QUADTREE:4,OCTREE:8};function oC(e,t){return rC.apply(this,arguments)}function rC(){return(rC=k(S.mark((function e(t,n){var i,o,r,a,s,l,c,u,h,d,p,f,m,v,g,y,A,E,b,w,x,C,T,I,k,B,P,R,M,D,L,F,H,V,O=arguments;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(i=O.length>2&&void 0!==O[2]?O[2]:{mortonIndex:0,x:0,y:0,z:0},o=O.length>3&&void 0!==O[3]?O[3]:0,r=O.length>4&&void 0!==O[4]?O[4]:0,a=O.length>5&&void 0!==O[5]?O[5]:{level:0,mortonIndex:0,x:0,y:0,z:0},s=n.subdivisionScheme,l=n.subtreeLevels,c=n.maximumLevel,u=n.contentUrlTemplate,h=n.subtreesUriTemplate,d=n.basePath,p={children:[],lodMetricValue:0,contentUrl:""},f=iC[s],m=1&o,v=o>>1&1,g=o>>2&1,y=(Math.pow(f,r)-1)/(f-1),A=lC(i.mortonIndex,o),E=y+A,b=lC(i.x,m),w=lC(i.y,v),x=lC(i.z,g),C=!1,r+1>l&&(C=aC(t.childSubtreeAvailability,A)),T=lC(a.x,b),I=lC(a.y,w),k=lC(a.z,x),B=r+a.level,!C){e.next=40;break}return P="".concat(d,"/").concat(h),R=cC(P,B,T,I,k),e.next=27,im(R,nC);case 27:M=e.sent,t=M,a.mortonIndex=A,a.x=b,a.y=w,a.z=x,a.level=r,A=0,E=0,b=0,w=0,x=0,r=0;case 40:if(aC(t.tileAvailability,E)&&!(r>c)){e.next=43;break}return e.abrupt("return",p);case 43:aC(t.contentAvailability,E)&&(p.contentUrl=cC(u,B,T,I,k)),D=r+1,L={mortonIndex:A,x:b,y:w,z:x},F=0;case 48:if(!(F<f)){e.next=56;break}return e.next=51,oC(t,n,L,F,D,a);case 51:((H=e.sent).contentUrl||H.children.length)&&(V=sC(H,B+1,{childTileX:b,childTileY:w,childTileZ:x},n),p.children.push(V));case 53:F++,e.next=48;break;case 56:return e.abrupt("return",p);case 57:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function aC(e,t){return"constant"in e?Boolean(e.constant):!!e.explicitBitstream&&(n=t,i=e.explicitBitstream,o=Math.floor(n/8),r=n%8,1==(i[o]>>r&1));var n,i,o,r}function sC(e,t,n,i){var o=i.basePath,r=i.refine,a=i.getRefine,s=i.lodMetricType,l=i.getTileType,c=i.rootLodMetricValue,u=i.rootBoundingVolume,h=e.contentUrl&&e.contentUrl.replace("".concat(o,"/"),""),d=c/Math.pow(2,t),p=function(e,t,n){if(t.region){var i=n.childTileX,o=n.childTileY,r=n.childTileZ,a=fe(t.region,6),s=a[0],l=a[1],c=a[2],u=a[3],h=a[4],d=a[5],p=Math.pow(2,e),f=(c-s)/p,m=(u-l)/p,v=(d-h)/p;return{region:[s+f*i,l+m*o,s+f*(i+1),l+m*(o+1),h+v*r,h+v*(r+1)]}}return console.warn("Unsupported bounding volume type: ",t),null}(t,u,n);return{children:e.children,contentUrl:e.contentUrl,content:{uri:h},id:e.contentUrl,refine:a(r),type:l(e),lodMetricType:s,lodMetricValue:d,boundingVolume:p}}function lC(e,t){return parseInt(e.toString(2)+t.toString(2),2)}function cC(e,t,n,i,o){var r=function(e){var t={};for(var n in e)t["{".concat(n,"}")]=e[n];return t}({level:t,x:n,y:i,z:o});return e.replace(/{level}|{x}|{y}|{z}/gi,(function(e){return r[e]}))}function uC(e){if(!e.contentUrl)return ey;var t=e.contentUrl.split(".").pop();switch(t){case"pnts":return ny;case"i3dm":case"b3dm":case"glb":case"gltf":return ty;default:return t}}function hC(e){switch(e){case"REPLACE":case"replace":return $g;case"ADD":case"add":return Kg;default:return e}}function dC(e,t){if(!e)return null;if(e.content){var n=e.content.uri||e.content.url;e.contentUrl="".concat(t.basePath,"/").concat(n)}return e.id=e.contentUrl,e.lodMetricType=ay,e.lodMetricValue=e.geometricError,e.transformMatrix=e.transform,e.type=uC(e),e.refine=hC(e.refine),e}function pC(e){var t=e.basePath,n=dC(e.root,e),i=[];for(i.push(n);i.length>0;){var o,r=td((i.pop()||{}).children||[]);try{for(r.s();!(o=r.n()).done;){var a=o.value;dC(a,{basePath:t}),i.push(a)}}catch(e){r.e(e)}finally{r.f()}}return n}function fC(e){return mC.apply(this,arguments)}function mC(){return(mC=k(S.mark((function e(t){var n,i,o,r,a,s,l,c,u,h,d,p,f,m;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t.root){e.next=2;break}return e.abrupt("return",null);case 2:return n=t.basePath,i=t.root.extensions["3DTILES_implicit_tiling"],o=i.subdivisionScheme,r=i.maximumLevel,a=i.subtreeLevels,s=i.subtrees.uri,l=cC(s,0,0,0,0),c="".concat(n,"/").concat(l),e.next=9,im(c,nC);case 9:return u=e.sent,h="".concat(n,"/").concat(t.root.content.uri),d=t.root.refine,p=t.root.geometricError,f=t.root.boundingVolume,m={contentUrlTemplate:h,subtreesUriTemplate:s,subdivisionScheme:o,subtreeLevels:a,maximumLevel:r,refine:d,basePath:n,lodMetricType:ay,rootLodMetricValue:p,rootBoundingVolume:f,getTileType:uC,getRefine:hC},e.next=17,vC(t.root,u,m);case 17:return e.abrupt("return",e.sent);case 18:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function vC(e,t,n){return gC.apply(this,arguments)}function gC(){return(gC=k(S.mark((function e(t,n,i){var o,r,a;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t){e.next=2;break}return e.abrupt("return",null);case 2:return t.lodMetricType=ay,t.lodMetricValue=t.geometricError,t.transformMatrix=t.transform,e.next=7,oC(n,i);case 7:return o=e.sent,r=o.children,(a=o.contentUrl)&&(t.contentUrl=a,t.content={uri:a.replace("".concat(i.basePath,"/"),"")}),t.refine=hC(t.refine),t.type=uC(t),t.children=r,t.id=t.contentUrl,e.abrupt("return",t);case 16:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var yC="3DTILES_implicit_tiling",AC={id:"3d-tiles",name:"3D Tiles",module:"3d-tiles",version:Qy,extensions:["cmpt","pnts","b3dm","i3dm"],mimeTypes:["application/octet-stream"],tests:["cmpt","pnts","b3dm","i3dm"],parse:function(e,t,n){return TC.apply(this,arguments)},options:{"3d-tiles":{loadGLTF:!0,decodeQuantizedPositions:!1,isTileset:"auto",assetGltfUpAxis:null}}};function EC(e){return mp(e.url)}function bC(e,t,n){return wC.apply(this,arguments)}function wC(){return(wC=k(S.mark((function e(t,n,i){var o;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return o={content:{featureIds:null}},0,e.next=4,Yx(t,0,n,i,o.content);case 4:return e.abrupt("return",o.content);case 5:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function xC(e,t,n){return CC.apply(this,arguments)}function CC(){return(CC=k(S.mark((function e(t,n,i){var o,r;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if((r=JSON.parse((new TextDecoder).decode(t))).loader=n.loader||AC,r.url=i.url,r.basePath=EC(r),!IC(r)){e.next=10;break}return e.next=7,fC(r);case 7:e.t0=e.sent,e.next=11;break;case 10:e.t0=pC(r);case 11:return r.root=e.t0,r.type=ry,r.lodMetricType=ay,r.lodMetricValue=(null===(o=r.root)||void 0===o?void 0:o.lodMetricValue)||0,e.abrupt("return",r);case 16:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function TC(){return(TC=k(S.mark((function e(t,n,i){var o;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(o=n["3d-tiles"]||{},!("auto"===o.isTileset?i.url&&-1!==i.url.indexOf(".json"):o.isTileset)){e.next=8;break}return e.next=5,xC(t,n,i);case 5:t=e.sent,e.next=11;break;case 8:return e.next=10,bC(t,n,i);case 10:t=e.sent;case 11:return e.abrupt("return",t);case 12:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function IC(e){var t,n;return(null==e||null===(t=e.extensionsRequired)||void 0===t?void 0:t.includes(yC))&&(null==e||null===(n=e.extensionsUsed)||void 0===n?void 0:n.includes(yC))}var kC="https://api.cesium.com/v1/assets";function BC(e,t){return PC.apply(this,arguments)}function PC(){return(PC=k(S.mark((function e(t,n){var i,o,r,a,s,l,c;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n){e.next=6;break}return e.next=3,RC(t);case 3:i=e.sent,o=td(i.items);try{for(o.s();!(r=o.n()).done;)"3DTILES"===(a=r.value).type&&(n=a.id)}catch(e){o.e(e)}finally{o.f()}case 6:return e.next=8,SC(t,n);case 8:return s=e.sent,l=s.type,c=s.url,ld("3DTILES"===l&&c),s.headers={Authorization:"Bearer ".concat(s.accessToken)},e.abrupt("return",s);case 13:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function RC(e){return MC.apply(this,arguments)}function MC(){return(MC=k(S.mark((function e(t){var n,i;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return ld(t),kC,n={Authorization:"Bearer ".concat(t)},e.next=5,zp("https://api.cesium.com/v1/assets",{fetch:{headers:n}});case 5:if((i=e.sent).ok){e.next=8;break}throw new Error(i.statusText);case 8:return e.next=10,i.json();case 10:return e.abrupt("return",e.sent);case 11:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function SC(e,t){return DC.apply(this,arguments)}function DC(){return(DC=k(S.mark((function e(t,n){var i,o,r,a,s;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return ld(t,n),i={Authorization:"Bearer ".concat(t)},o="".concat(kC,"/").concat(n),e.next=5,zp("".concat(o),{fetch:{headers:i}});case 5:if((r=e.sent).ok){e.next=8;break}throw new Error(r.statusText);case 8:return e.next=10,r.json();case 10:return a=e.sent,e.next=13,zp("".concat(o,"/endpoint"),{fetch:{headers:i}});case 13:if((r=e.sent).ok){e.next=16;break}throw new Error(r.statusText);case 16:return e.next=18,r.json();case 18:return s=e.sent,a=od(od({},a),s),e.abrupt("return",a);case 21:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function LC(){return(LC=k(S.mark((function e(t){var n,i,o,r,a=arguments;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=(n=a.length>1&&void 0!==a[1]?a[1]:{})["cesium-ion"]||{},i=n.accessToken,o=n.assetId,Number.isFinite(o)||(r=t.match(/\/([0-9]+)\/tileset.json/),o=r&&r[1]),e.abrupt("return",BC(i,o));case 6:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var FC,HC=od(od({},AC),{},{id:"cesium-ion",name:"Cesium Ion",preload:function(e){return LC.apply(this,arguments)},parse:(FC=k(S.mark((function e(t,n,i){return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return(n=od({},n))["3d-tiles"]=n["cesium-ion"],n.loader=HC,e.abrupt("return",AC.parse(t,n,i));case 4:case"end":return e.stop()}}),e)}))),function(e,t,n){return FC.apply(this,arguments)}),options:{"cesium-ion":od(od({},AC.options["3d-tiles"]),{},{accessToken:null})}});function VC(t){var n=64,i=document.createElement("canvas");i.width=n,i.height=n;var o=i.getContext("2d");o.rect(0,0,n,n);for(var r=o.createLinearGradient(0,0,n,n),a=0;a<t.length;a++){var s=t[a];r.addColorStop(s[0],"#"+s[1].getHexString())}o.fillStyle=r,o.fill();var l=new e.CanvasTexture(i);return l.needsUpdate=!0,l.minFilter=e.LinearFilter,l.wrapS=e.RepeatWrapping,l.wrapT=e.RepeatWrapping,l.repeat.set(2,2),l}function OC(t){t.updateMatrix(),t.updateMatrixWorld(),t.matrixWorldInverse.copy(t.matrixWorld).invert();var n=new e.Frustum;return n.setFromProjectionMatrix((new e.Matrix4).multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse)),n}function QC(t){var n=new e.Group,i=new e.PlaneGeometry(10,5),o=Q(e.Vector3,H(t.projectPointOntoPlane([0,0,0]))),r=new e.Vector3(t.normal.x,t.normal.y,t.normal.z),a=(new e.Vector3).copy(o).add(r);i.lookAt(a),i.translate(o.x,o.y,o.z);var s=new e.MeshBasicMaterial({color:65535,side:e.DoubleSide}),l=new e.Mesh(i,s),c=new e.ArrowHelper(r,o,5,16776960);return n.add(c),n.add(l),n}function _C(t){var n=t.boundingVolume,i=0;t.content&&(i=Math.min(t.content.byteLength/5e5,1));var o=new e.Color(i,1,0),r=new e.BoxGeometry(1,1,1),a=new e.Matrix4;n.halfAxes?a.copy(zC(n.halfAxes)):n.radius&&r.scale(2*n.radius,2*n.radius,2*n.radius),r.applyMatrix4(a);var s=new e.EdgesGeometry(r),l=new e.LineSegments(s,new e.LineBasicMaterial({color:o}));return l.position.copy(Q(e.Vector3,H(n.center))),l}function zC(t){var n=t;return(new e.Matrix4).fromArray([2*n[0],2*n[1],2*n[2],0,2*n[3],2*n[4],2*n[5],0,2*n[6],2*n[7],2*n[8],0,0,0,0,1])}function UC(t,n){var i=2*Math.PI*6378137/2,o=n*i/180,r=Math.log(Math.tan((90+t)*Math.PI/360))/(Math.PI/180);return r=r*i/180,new e.Vector2(o,r)}var NC,GC,jC,WC={SPECTRAL:[[0,new e.Color(.3686,.3098,.6353)],[.1,new e.Color(.1961,.5333,.7412)],[.2,new e.Color(.4,.7608,.6471)],[.3,new e.Color(.6706,.8667,.6431)],[.4,new e.Color(.902,.9608,.5961)],[.5,new e.Color(1,1,.749)],[.6,new e.Color(.9961,.8784,.5451)],[.7,new e.Color(.9922,.6824,.3804)],[.8,new e.Color(.9569,.4275,.2627)],[.9,new e.Color(.8353,.2431,.3098)],[1,new e.Color(.6196,.0039,.2588)]],PLASMA:[[0,new e.Color(.241,.015,.61)],[.1,new e.Color(.387,.001,.654)],[.2,new e.Color(.524,.025,.653)],[.3,new e.Color(.651,.125,.596)],[.4,new e.Color(.752,.227,.513)],[.5,new e.Color(.837,.329,.431)],[.6,new e.Color(.907,.435,.353)],[.7,new e.Color(.963,.554,.272)],[.8,new e.Color(.992,.681,.195)],[.9,new e.Color(.987,.822,.144)],[1,new e.Color(.94,.975,.131)]],YELLOW_GREEN:[[0,new e.Color(.1647,.2824,.3451)],[.1,new e.Color(.1338,.3555,.4227)],[.2,new e.Color(.061,.4319,.4864)],[.3,new e.Color(0,.5099,.5319)],[.4,new e.Color(0,.5881,.5569)],[.5,new e.Color(.137,.665,.5614)],[.6,new e.Color(.2906,.7395,.5477)],[.7,new e.Color(.4453,.8099,.5201)],[.8,new e.Color(.6102,.8748,.485)],[.9,new e.Color(.7883,.9323,.4514)],[1,new e.Color(.9804,.9804,.4314)]],VIRIDIS:[[0,new e.Color(.267,.005,.329)],[.1,new e.Color(.283,.141,.458)],[.2,new e.Color(.254,.265,.53)],[.3,new e.Color(.207,.372,.553)],[.4,new e.Color(.164,.471,.558)],[.5,new e.Color(.128,.567,.551)],[.6,new e.Color(.135,.659,.518)],[.7,new e.Color(.267,.749,.441)],[.8,new e.Color(.478,.821,.318)],[.9,new e.Color(.741,.873,.15)],[1,new e.Color(.993,.906,.144)]],INFERNO:[[0,new e.Color(.077,.042,.206)],[.1,new e.Color(.225,.036,.388)],[.2,new e.Color(.373,.074,.432)],[.3,new e.Color(.522,.128,.42)],[.4,new e.Color(.665,.182,.37)],[.5,new e.Color(.797,.255,.287)],[.6,new e.Color(.902,.364,.184)],[.7,new e.Color(.969,.516,.063)],[.8,new e.Color(.988,.683,.072)],[.9,new e.Color(.961,.859,.298)],[1,new e.Color(.988,.998,.645)]],GRAYSCALE:[[0,new e.Color(0,0,0)],[1,new e.Color(1,1,1)]],TURBO:[[0,new e.Color(.18995,.07176,.23217)],[.07,new e.Color(.25107,.25237,.63374)],[.13,new e.Color(.27628,.42118,.89123)],[.2,new e.Color(.25862,.57958,.99876)],[.27,new e.Color(.15844,.73551,.92305)],[.33,new e.Color(.09267,.86554,.7623)],[.4,new e.Color(.19659,.94901,.59466)],[.47,new e.Color(.42778,.99419,.38575)],[.53,new e.Color(.64362,.98999,.23356)],[.6,new e.Color(.80473,.92452,.20459)],[.67,new e.Color(.93301,.81236,.22667)],[.73,new e.Color(.99314,.67408,.20348)],[.8,new e.Color(.9836,.49291,.12849)],[.87,new e.Color(.92105,.31489,.05475)],[.93,new e.Color(.81608,.18462,.01809)],[1,new e.Color(.66449,.08436,.00424)]],RAINBOW:[[0,new e.Color(.278,0,.714)],[1/6,new e.Color(0,0,1)],[2/6,new e.Color(0,1,1)],[.5,new e.Color(0,1,0)],[4/6,new e.Color(1,1,0)],[5/6,new e.Color(1,.64,0)],[1,new e.Color(1,0,0)]],CONTOUR:[[0,new e.Color(0,0,0)],[.03,new e.Color(0,0,0)],[.04,new e.Color(1,1,1)],[1,new e.Color(1,1,1)]]};!function(e){e[e.Intensity=1]="Intensity",e[e.Classification=2]="Classification",e[e.Elevation=3]="Elevation",e[e.RGB=4]="RGB",e[e.White=5]="White"}(NC||(NC={})),function(e){e[e.FlatTexture=1]="FlatTexture",e[e.ShadedTexture=2]="ShadedTexture",e[e.ShadedNoTexture=3]="ShadedNoTexture"}(GC||(GC={})),function(e){e[e.Reset=1]="Reset",e[e.Mercator=2]="Mercator",e[e.WGS84Cartesian=3]="WGS84Cartesian"}(jC||(jC={}));var qC="undefined"!=typeof document?VC(WC.RAINBOW):null,JC="undefined"!=typeof document?VC(WC.GRAYSCALE):null,YC={throttleRequests:!0,maxRequests:64,updateInterval:.1,maxConcurrency:1,maximumScreenSpaceError:16,maximumMemoryUsage:32,viewDistanceScale:1,skipLevelOfDetail:!1,updateTransforms:!0,shading:GC.FlatTexture,transparent:!1,pointCloudColoring:NC.White,pointSize:1,worker:!0,wireframe:!1,debug:!1,basisTranscoderPath:null,dracoDecoderPath:null,material:null,computeNormals:!1,shaderCallback:null,geoTransform:jC.Reset,preloadTilesCount:null,isLowestDepth:!1},ZC=function(){function t(){o(this,t)}return u(t,null,[{key:"load",value:function(t){return sd(this,void 0,void 0,S.mark((function n(){var i,o,r,a,s,l,c,u,h,d,p,f,m,v,g,y,A,E,b,w,x,C,T,I,k,B,P,R,M,D,L,F,V,O,_,z,U,N,G,j,W,q,J,Y,Z=this;return S.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(Y=function(n,o,r,a){if(!L&&!i.pauseTilesetUpdate){if(!N||a.aspect!=O||a.left!=z||a.top!=_){var s=new Og({fov:a.fov/180*Math.PI,aspectRatio:a.aspect,near:a.near,far:a.far});N=s.sseDenominator,"OrthographicCamera"==a.type&&(N=.25*(a.top-a.bottom)),O=a.aspect,_=a.top,z=a.left,i.debug&&console.log("Updated sse denonimator:",N)}var l=OC(a).planes.map((function(e){return new Ig(e.normal.toArray(),e.constant)})),c=new Rg(l),u=new e.Vector2;r.getSize(u);var h={camera:{position:i.isLowestDepth?[0,100,0]:U.toArray(),type:a.type,left:a.left,right:a.right,top:a.top,bottom:a.bottom},height:u.y,frameNumber:n._frameNumber,sseDenominator:N,cullingVolume:c,viewport:{id:0}};n.options.currentFloorId=void 0===v.currentFloorId?"all":v.currentFloorId,n._cache.reset(),n._traverser.traverse(n.root,h,n.options);var d,p=td(n.tiles);try{for(p.s();!(d=p.n()).done;){var y=d.value;y.selected?o[y.id]?o[y.id].visible=!0:console.error("TILE SELECTED BUT NOT LOADED!!",y.id):o[y.id]&&(o[y.id].visible=!1)}}catch(e){p.e(e)}finally{p.f()}for(;m.length>0;){var A=m.pop();o[A.id]&&A.contentState==qg&&("4dkk"==i.type?v.removeTile(o[A.id]):v.remove(o[A.id]),eT(o[A.id]),delete o[A.id]),f[A.id]&&(eT(f[A.id]),g.remove(f[A.id]),delete f[A.id])}var E=n.stats.get("Tiles Loaded").count,b=n.stats.get("Tiles Loading").count;return t.onProgress&&t.onProgress(E,E+b),t.loadingManager&&!F&&0==b&&(null==i.preloadTilesCount||E>=i.preloadTilesCount)&&(F=!0,t.loadingManager.itemEnd(t.url)),h}},J=function(){i.geoTransform!=jC.WGS84Cartesian&&(B.copy(P).invert(),B.premultiply(G),B.copy(G).multiply((new e.Matrix4).copy(P).invert()),k.modelMatrix=new sv(B.toArray()))},q=function(t){if(t.boundingVolume.halfAxes){var n=t.boundingVolume.halfAxes,i=(new e.Matrix4).extractRotation(zC(n)).premultiply((new e.Matrix4).extractRotation(j));if(!(new e.Euler).setFromRotationMatrix(i).equals(new e.Euler)){M=!0;var o=new e.Vector3(P.elements[12],P.elements[13],P.elements[14]);P.extractRotation(i),P.setPosition(o),J()}}},i=Object.assign(Object.assign({},YC),t.options),o=t.url,r=i.updateInterval,a=2,s={},!i.cesiumIONToken){n.next=14;break}return s["cesium-ion"]={accessToken:i.cesiumIONToken},n.next=12,HC.preload(o,s);case 12:l=n.sent,s.fetch={headers:l.headers};case 14:return t.loadingManager&&t.loadingManager.itemStart(o),n.next=17,im(o,AC,Object.assign({},s));case 17:for(c=n.sent,u=0,h=[0,1,2];u<h.length;u++)d=h[u],c.root.boundingVolume.box[d]=0;return p={},f={},m=[],v=t.model||new e.Group,g=new e.Group,i.debug?v.add(g):g.visible=!1,y={pointSize:{type:"f",value:i.pointSize},gradient:{type:"t",value:qC},grayscale:{type:"t",value:JC},rootCenter:{type:"vec3",value:new e.Vector3},rootNormal:{type:"vec3",value:new e.Vector3},coloring:{type:"i",value:i.pointCloudColoring},hideGround:{type:"b",value:!0},elevationRange:{type:"vec2",value:new e.Vector2(0,400)},maxIntensity:{type:"f",value:1},intensityContrast:{type:"f",value:1},alpha:{type:"f",value:1}},A=new e.ShaderMaterial({uniforms:y,vertexShader:"\n varying vec3 vColor;\n uniform sampler2D gradient;\n uniform sampler2D grayscale;\n attribute float intensity;\n attribute float classification;\n uniform vec3 rootCenter;\n uniform vec3 rootNormal;\n uniform vec2 elevationRange;\n uniform int coloring;\n uniform bool hideGround;\n uniform float maxIntensity;\n uniform float intensityContrast;\n uniform float pointSize;\n\n #ifdef USE_COLOR\n vec3 getRGB() {\n vec3 rgb = color;\n return rgb;\n }\n #endif\n\n vec3 getElevation(){\n vec4 world = modelMatrix * vec4( position, 1.0 );\n float diff = abs(dot(rootNormal, (vec3(world) - rootCenter)));\n float w = max(diff - elevationRange.x,0.0) / max(elevationRange.y - elevationRange.x,1.0);\n vec3 cElevation = texture2D(gradient, vec2(w,1.0-w)).rgb;\n\n return cElevation;\n }\n\n vec3 getIntensity(){\n // TODO: real contrast enhancement. Check https://github.com/yuki-koyama/enhancer/blob/master/shaders/enhancer.fs\n float intmod = pow(intensity, intensityContrast);\n vec3 cIntensity = texture2D(grayscale, vec2(intmod / maxIntensity ,1.0-(intmod / maxIntensity))).rgb;\n return cIntensity;\n }\n\n vec3 getClassification(){\n float classNormalized = classification / 255.0;\n vec3 cClassification = texture2D(gradient, vec2(classNormalized * 5.0,1.0-classNormalized * 5.0)).rgb;\n return cClassification;\n }\n\n vec3 getColor(){\n vec3 color;\n if (hideGround && classification == 2.0) {\n return vec3(0.0, 0.0, 0.0); \n }\n\n if (coloring == 1) {\n color = getIntensity();\n }\n else if (coloring == 2) {\n color = getClassification();\n } else if (coloring == 3) {\n color = getElevation();\n } \n #ifdef USE_COLOR\n else if (coloring == 4) {\n color = getRGB();\n }\n #endif\n else {\n color = vec3(1.0, 1.0, 1.0);\n }\n return color;\n }\n\n void main() {\n vColor = getColor();\n\n gl_PointSize = pointSize;\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n }\n",fragmentShader:"\n varying vec3 vColor;\n uniform float alpha;\n\n void main() {\n if (vColor == vec3(0.0, 0.0, 0.0)) {\n discard;\n } else {\n gl_FragColor = vec4( vColor, alpha);\n }\n }\n",transparent:i.transparent,vertexColors:!0}),E=null,b=null,w=new rd,x=void 0,C=void 0,i.basisTranscoderPath&&((x=new jh).detectSupport(t.renderer),x.setTranscoderPath(i.basisTranscoderPath+"/"),x.setWorkerLimit(2),w.setKTX2Loader(x)),i.dracoDecoderPath&&((C=new hs).setDecoderPath(i.dracoDecoderPath+"/"),C.setWorkerLimit(i.maxConcurrency),w.setDRACOLoader(C)),T=new e.MeshBasicMaterial({transparent:i.transparent}),I={maximumMemoryUsage:i.maximumMemoryUsage,maximumScreenSpaceError:i.maximumScreenSpaceError,viewDistanceScale:i.viewDistanceScale,skipLevelOfDetail:i.skipLevelOfDetail,updateTransforms:i.updateTransforms,throttleRequests:i.throttleRequests,maxRequests:i.maxRequests,type:i.type,imageVersion:i.imageVersion,ingoreVisibleCompute:!!i.ingoreVisibleCompute,contentLoader:function(e){return sd(Z,void 0,void 0,S.mark((function t(){var n,o,r;return S.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:n=null,t.t0=e.type,t.next=t.t0===ny?4:t.t0===ty||t.t0===iy?6:10;break;case 4:return n=KC(e,A,i,j),t.abrupt("break",10);case 6:return t.next=8,XC(w,e,T,i,j);case 8:return n=t.sent,t.abrupt("break",10);case 10:n&&(n.visible=!1,n.name="tileContent",p[e.id]=n,"4dkk"==i.type?(o=e.contentUrl.match(/floor_([0-9]+)./),e.floorIndex=o?parseInt(o[1]):0,v.addTile(e.floorIndex,n)):v.add(n),i.debug&&(r=_C(e),g.add(r),f[e.id]=r));case 11:case"end":return t.stop()}}),t)})))},onTileLoad:function(e){return sd(Z,void 0,void 0,S.mark((function t(){return S.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:k&&(!M&&(null==e?void 0:e.depth)<=a&&q(e),k._frameNumber++,Y(k,p,b,E));case 1:case"end":return t.stop()}}),t)})))},onTileUnload:function(e){m.push(e)},onTileError:function(e,t){console.error("Tile error",e.id,t)}},k=new Oy(c,Object.assign(Object.assign({},I),{loadOptions:Object.assign(Object.assign({},s),{maxConcurrency:i.maxConcurrency,worker:i.worker,gltf:{loadImages:!1},"3d-tiles":{loadGLTF:!1}})})),B=new e.Matrix4,P=new e.Matrix4,R=new e.Vector3,M=!1,k.root.boundingVolume?(k.root.header.boundingVolume.region&&(console.warn("Cannot apply a model matrix to bounding volumes of type region. Tileset stays in original geo-coordinates."),i.geoTransform=jC.WGS84Cartesian),P.setPosition(k.root.boundingVolume.center[0],k.root.boundingVolume.center[1],k.root.boundingVolume.center[2])):console.warn("Bounding volume not found, no transformations applied"),i.debug&&(D=_C(k.root),g.add(D),f[k.root.id]=D),L=!1,F=!1,y.rootCenter.value.copy(R),y.rootNormal.value.copy(new e.Vector3(0,0,1).normalize()),k.stats.get("Loader concurrency").count=i.maxConcurrency,k.stats.get("Maximum SSE").count=i.maximumScreenSpaceError,k.stats.get("Maximum mem usage").count=i.maximumMemoryUsage,V=r,O=null,_=null,z=null,U=new e.Vector3(1/0,1/0,1/0),N=null,v.updateMatrixWorld(!0),G=(new e.Matrix4).copy(v.matrixWorld),j=(new e.Matrix4).copy(G).invert(),q(k.root),J(),i.debug&&(f[k.root.id].applyMatrix4(B),g.matrixWorld.copy(v.matrixWorld)),i.geoTransform==jC.Mercator?(W=UC(k.cartographicCenter[1],k.cartographicCenter[0]),R.set(W.x,0,-W.y),v.position.copy(R),v.rotation.set(-Math.PI/2,0,0),v.updateMatrixWorld(!0)):i.geoTransform==jC.WGS84Cartesian&&(v.applyMatrix4(P),v.updateMatrixWorld(!0),R.copy(v.position)),n.abrupt("return",{model:v,runtime:{getTileset:function(){return k},getStats:function(){return k.stats},showTiles:function(e){g.visible=e},setWireframe:function(t){i.wireframe=t,v.traverse((function(n){n instanceof e.Mesh&&(n.material.wireframe=t)}))},setDebug:function(e){i.debug=e,g.visible=e},setShading:function(e){i.shading=e},getTileBoxes:function(){return g},setViewDistanceScale:function(e){k.options.viewDistanceScale=e,k._frameNumber++,Y(k,p,b,E)},setHideGround:function(e){y.hideGround.value=e},setPointCloudColoring:function(e){y.coloring.value=e},setElevationRange:function(e){y.elevationRange.value.set(e[0],e[1])},setMaxIntensity:function(e){y.maxIntensity.value=e},setIntensityContrast:function(e){y.intensityContrast.value=e},setPointAlpha:function(e){y.alpha.value=e},getLatLongHeightFromPosition:function(t){var n=k.ellipsoid.cartesianToCartographic((new e.Vector3).copy(t).applyMatrix4((new e.Matrix4).copy(B).invert()).toArray());return{lat:n[1],long:n[0],height:n[2]}},getPositionFromLatLongHeight:function(t){var n=k.ellipsoid.cartographicToCartesian([t.long,t.lat,t.height]);return Q(e.Vector3,H(n)).applyMatrix4(B)},getCameraFrustum:function(t){var n,i=OC(t).planes.map((function(e){return new Ig(e.normal.toArray(),e.constant)})).map((function(e){return QC(e)})),o=new e.Group,r=td(i);try{for(r.s();!(n=r.n()).done;){var a=n.value;o.add(a)}}catch(e){r.e(e)}finally{r.f()}return o},update:function(t,n,o,a){if(E=o,b=n,a||(a=k.nextForceUpdate),k.nextForceUpdate=!1,V+=a?9999:t,k&&V>=r){if(!G.equals(v.matrixWorld)){V=0,G.copy(v.matrixWorld),J();var s=(new e.Vector3).setFromMatrixPosition(G);y.rootCenter.value.copy(s),y.rootNormal.value.copy(new e.Vector3(0,0,1).applyMatrix4(G).normalize()),j.copy(G).invert(),i.debug&&(f[k.root.id].matrixWorld.copy(B),f[k.root.id].applyMatrix4(G))}V=0,k._frameNumber++,o.getWorldPosition(U),Y(k,p,n,o)}},dispose:function(){for(L=!0,k._destroy();v.children.length>0;){var e=v.children[0];eT(e),v.remove(e)}for(;g.children.length>0;){var t=g.children[0];g.remove(t),t.geometry.dispose(),t.material.dispose()}x&&x.dispose(),C&&C.dispose()},ingoreVisibleCompute:function(e){k.options.ingoreVisibleCompute=e,k._frameNumber++,Y(k,p,b,E)},pauseTilesetUpdate:function(e){i.pauseTilesetUpdate=e,e||(k._frameNumber++,Y(k,p,b,E))},limit2lowestDepth:function(e){i.isLowestDepth=!!e,E&&(k._frameNumber++,Y(k,p,b,E))},clearLoadingTiles:function(){k.loadingTiles.forEach((function(e){return e.controller&&e.controller.abort()}))},setModelSize:function(e){k.options.modelSize=e,console.error(e)},getRenderMap:function(){return p}}});case 62:case"end":return n.stop()}}),n)})))}}]),t}();function XC(t,n,i,o,r){return sd(this,void 0,void 0,S.mark((function a(){return S.wrap((function(a){for(;;)switch(a.prev=a.next){case 0:return a.abrupt("return",new Promise((function(a,s){var l=n.tileset.asset&&"Z"!==n.tileset.asset.gltfUpAxis,c=(new e.Matrix4).fromArray(n.computedTransform).premultiply(r);if(l){var u=(new e.Matrix4).makeRotationAxis(new e.Vector3(1,0,0),Math.PI/2);c.multiply(u)}t.parse("glTF"==n.content.type?n.content.gltf.gltfArrayBuffer:n.content.gltfArrayBuffer,n.contentUrl?n.contentUrl.substr(0,n.contentUrl.lastIndexOf("/")+1):"",(function(e){var t=e.scenes[0],r=[];t.traverse((function(e){"Mesh"==e.type&&r.push(e)})),t.clear(),r.forEach((function(e){var r=e.material,a=r.map;if(o.material?(e.material=o.material.clone(),r.dispose()):o.shading==GC.FlatTexture&&(e.material=i.clone(),r.dispose()),o.shading!=GC.ShadedNoTexture?"ShaderMaterial"==e.material.type?e.material.uniforms.map={value:a}:e.material.map=a:(a&&a.dispose(),e.material.map=null),o.shaderCallback&&(e.onBeforeRender=o.shaderCallback),e.material.wireframe=o.wireframe,o.computeNormals&&e.geometry.computeVertexNormals(),e.geometry.applyMatrix4(c),n.content.rtcCenter?e.geometry.translate(n.content.rtcCenter[0],n.content.rtcCenter[1],n.content.rtcCenter[2]):e.geometry.scale(1,1,-1),"4dkk"==n.tileset.options.type){e.geometry.computeBoundingBox(),e.material.dispose();var s=new Ah({geometry:e.geometry,texture:e.material.map,name:e.name,meshUrl:n.contentUrl,tileId:n.id});t.add(s)}else t.add(e)})),a(t)}),(function(e){s(new Error("error parsing gltf in tile ".concat(n.id,": ").concat(e)))}))})));case 1:case"end":return a.stop()}}),a)})))}function KC(t,n,i,o){var r={rtc_center:t.content.rtcCenter,points:t.content.attributes.positions,intensities:t.content.attributes.intensity,classifications:t.content.attributes.classification,rgb:null,rgba:null},a=t.content.attributes.colors;a&&3===a.size&&(r.rgb=a.value),a&&4===a.size&&(r.rgba=a.value);var s=new e.BufferGeometry;s.setAttribute("position",new e.Float32BufferAttribute(r.points,3));var l=(new e.Matrix4).fromArray(t.computedTransform).premultiply(o);r.rgba?s.setAttribute("color",new e.Float32BufferAttribute(r.rgba,4)):r.rgb&&s.setAttribute("color",new e.Uint8BufferAttribute(r.rgb,3,!0)),r.intensities&&s.setAttribute("intensity",new e.BufferAttribute(r.intensities,1,!0)),r.classifications&&s.setAttribute("classification",new e.Uint8BufferAttribute(r.classifications,1,!1));var c=new e.Points(s,i.material||n);if(r.rtc_center){var u=r.rtc_center;l.multiply((new e.Matrix4).makeTranslation(u[0],u[1],u[2]))}return c.applyMatrix4(l),c}function $C(e){var t,n,i,o;(null===(t=null==e?void 0:e.uniforms)||void 0===t?void 0:t.map)?null===(i=null===(n=null==e?void 0:e.uniforms)||void 0===n?void 0:n.map.value)||void 0===i||i.dispose():e.map&&(null===(o=e.map)||void 0===o||o.dispose()),e.dispose()}function eT(e){e.traverse((function(e){if(e.isMesh)if(e.geometry.dispose(),e.material.isMaterial)$C(e.material);else{var t,n=td(e.material);try{for(n.s();!(t=n.n()).done;){$C(t.value)}}catch(e){n.e(e)}finally{n.f()}}}));for(var t=e.children.length-1;t>=0;t--){var n=e.children[t];e.remove(n)}}var tT=he(),nT=function(e){return e.floors||(e={floors:[e]}),e.floors.map((function(e){return e.column=e.column||[],e.window=e.window||[],e.door=e.door||[],e.groundCase=e.groundCase||[],e.bayCase=e.bayCase||[],e.slideDoor=e.slideDoor||[],e.tagging=e.tagging||[],e.furnColumn=e.furnColumn||[],e.furnFlue=e.furnFlue||[],(e.rooms||e.room||e.points)&&(e.room=e.rooms||e.room||e.points,e.room.forEach((function(t){isNumber(t.top)||(t.top=isNumber(e.top)?e.top:1),isNumber(t.bottom)||(t.bottom=isNumber(e.bottom)?e.bottom:1),!t.ground&&t.points&&(t.ground=t.points),t.hole||(t.hole=[]),t.close=!0}))),e})),e};function iT(e,t){for(var n=Object.create(null),i=e.split(","),o=0;o<i.length;o++)n[i[o]]=!0;return t?function(e){return!!n[e.toLowerCase()]}:function(e){return!!n[e]}}ct("resource",(function(){return function(){function e(){o(this,e),this.reload=!1,this.version=Date.now(),this.nowTime=Date.now(),this.imageVersion=0,this.linkVersion=0}var t,n,i,r,a,s,l,c,h,d,p,f,m,v,g,y,A,E,b,w,x,C;return u(e,[{key:"num",get:function(){return this.$app.config.num}},{key:"mode",get:function(){return this.$app.config.view?"view":"edit"}},{key:"time",get:function(){return this.reload||this.refresh?(this.reload&&(this.reload=!1,this.refresh=Date.now()),this.refresh):this.version}},{key:"base",value:function(e){return tT+e}},{key:"auth",value:(C=k(S.mark((function e(){var t;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if("edit"==this.mode){e.next=2;break}return e.abrupt("return");case 2:return e.prev=2,e.next=5,this.$app.remote_editor.getAuth({num:this.num});case 5:return(t=e.sent).success&&(t.data.include&&t.data.include.length&&(t.data.include=t.data.include.filter((function(e){return"v4"==e.version}))),this.$app.store.set("auth",t.data)),e.abrupt("return",t);case 10:throw e.prev=10,e.t0=e.catch(2),e.t0;case 13:case"end":return e.stop()}}),e,this,[[2,10]])}))),function(){return C.apply(this,arguments)})},{key:"metadata",value:(x=k(S.mark((function e(){var t,n;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(ft.time("".concat(this.$app.config.num,"[load metadata]").concat(this.$app.uid)),t=null,n=null,!this.$app.config.view){e.next=19;break}if("local"!=this.$app.config.deploy||this.$app.config.server){e.next=10;break}return e.next=7,ri.get(this.getViewResourceURL("data/scene.json?_=".concat(this.time)));case 7:n=e.sent,e.next=17;break;case 10:if(!window.__KANKAN_DATA){e.next=14;break}n=window.__KANKAN_DATA,e.next=17;break;case 14:return e.next=16,ri.get("/service/scene/getInfo?num=".concat(this.$app.config.num,"&_=").concat(this.time));case 16:n=e.sent;case 17:e.next=22;break;case 19:return e.next=21,ri.get("/service/scene/edit/getInfo?num=".concat(this.$app.config.num,"&_=").concat(this.time));case 21:n=e.sent;case 22:if(null==n.success){e.next=30;break}if(!n.success){e.next=27;break}t=n.data,e.next=28;break;case 27:return e.abrupt("return");case 28:e.next=31;break;case 30:t=n;case 31:return t.entry&&"string"==typeof t.entry&&(t.entry=JSON.parse(t.entry)),t.boxVideos&&"string"==typeof t.boxVideos&&(t.boxVideos=JSON.parse(t.boxVideos)),t.boxPhotos&&"string"==typeof t.boxPhotos&&(t.boxPhotos=JSON.parse(t.boxPhotos)),t.boxModels&&"string"==typeof t.boxModels&&(t.boxModels=JSON.parse(t.boxModels)),t.videos&&"string"==typeof t.videos&&(t.videos=JSON.parse(t.videos)),t.version&&(this.version=t.version,this.imageVersion=t.imgVersion||0,this.linkVersion=t.linkVersion||0),null==t.sns&&(t.sns={},null==t.sns.share&&(t.sns.share={},t.sns.share={__init__:!0,title:t.title,keywords:"",description:t.description,image:t.entry?"thumb-1k.jpg":null})),ft.timeEnd("".concat(this.$app.config.num,"[load metadata]").concat(this.$app.uid)),this.$app.store.set("metadata",t),e.abrupt("return",t);case 41:case"end":return e.stop()}}),e,this)}))),function(){return x.apply(this,arguments)})},{key:"visions",value:(w=k(S.mark((function e(){var t,n,i=this;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return ft.time("".concat(this.$app.config.num,"[load visions]").concat(this.$app.uid)),e.next=3,ri.getBueffer(this.getResourceURL("scene_view_data/{num}/images/vision.modeldata?_=".concat(this.version)));case 3:return t=e.sent,e.next=6,this.$app.store.get("metadata");case 6:n=e.sent,ft.timeEnd("".concat(this.$app.config.num,"[load visions]").concat(this.$app.uid)),function(e){ft.time("".concat(i.$app.config.num,"[parse modeldata]").concat(i.$app.uid));var t=gh.decompressModeldata(e);"ajk"==n.dataSync&&i.$app.DataSYNC.use("DataAJK",{sweepLocations:t});var o=Eh.visionModeldata(t);ft.timeEnd("".concat(i.$app.config.num,"[parse modeldata]").concat(i.$app.uid)),i.$app.core.get("Player").model.panos=Eh.panos(i.$app,o,n),i.$app.core.get("Player").model.dispatchEvent({type:"gotPanos"})}(t);case 10:case"end":return e.stop()}}),e,this)}))),function(){return w.apply(this,arguments)})},{key:"visions2",value:(b=k(S.mark((function e(){var t,n,i=this;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=this.$app.core.get("Player").model,ft.time("".concat(this.$app.config.num,"[load visions2]").concat(this.$app.uid)),e.next=4,ri.getBueffer(this.getResourceURL("scene_view_data/{num}/images/vision2.modeldata?_=".concat(this.version)));case 4:n=e.sent,ft.timeEnd("".concat(this.$app.config.num,"[load visions2]").concat(this.$app.uid)),function(e){ft.time("".concat(i.$app.config.num,"[parse modeldata2]").concat(i.$app.uid));var n=gh.decompressModeldata(e),o=Eh.visionModeldata(n);ft.timeEnd("".concat(i.$app.config.num,"[parse modeldata2]").concat(i.$app.uid)),Eh.panosAssist(o,i.$app).forEach((function(e){t.panos.index[e.id-1].assistPano=e}))}(n);case 8:case"end":return e.stop()}}),e,this)}))),function(){return b.apply(this,arguments)})},{key:"modelmesh3dTiles",value:(E=k(S.mark((function e(){var t,n,i,o,r=this;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return ft.time("".concat(this.$app.config.num,"[load modelmesh]").concat(this.$app.uid)),t=this.$app.core.get("Player"),n=this.$app.core.get("SceneRenderer"),e.next=5,ZC.load({url:this.getResourceURL("scene_view_data/{num}/images/3dtiles/tileset.json?_=".concat(Date.now())),renderer:n.renderer,options:{dracoDecoderPath:si.getImageURL("images/loaders/DRACOLoader/draco"),basisTranscoderPath:si.getImageURL("images/loaders/KTX2Loader/basis"),maximumScreenSpaceError:Fe.isMobile()?5e3:40,maxConcurrency:2,isLowestDepth:!0,ingoreVisibleCompute:!0,maximumMemoryUsage:Fe.detectIOS()?.1:64,imageVersion:this.imageVersion,type:"4dkk"},model:t.model});case 5:i=e.sent,o=i.runtime,t.model._3dTilesRuntime=o,n.autoUpdate3dTiles=!0,o.getTileset().on("endTileLoading",(function(e){if(0==e.loadingCount&&!t.model.mesh3dTilesLoaded){if(t.model.mesh3dTilesLoaded=!0,t.model.floors.sort(),Fe.detectIOS()){var n=new THREE.Box3;t.model.floors.forEach((function(e){return n.union(e.boundingBox)})),t.model._3dTilesRuntime.setModelSize(n.getSize(new THREE.Vector3))}r.$app.Scene.emit("3dTilesLoaded"),t.model._3dTilesRuntime.pauseTilesetUpdate(!1),t.model._3dTilesRuntime.pauseTilesetUpdate(!0),ft.timeEnd("".concat(r.$app.config.num,"[load modelmesh]").concat(r.$app.uid))}}));case 10:case"end":return e.stop()}}),e,this)}))),function(){return E.apply(this,arguments)})},{key:"modelmeshDam",value:(A=k(S.mark((function e(){var t,n,i,o=this;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=function(e,t){if(0===e.length){ft.warn("No geometry found for model, loading faux geometry, disabling outside mode"),t.model.supportedModes[xt.DOLLHOUSE]=!1,t.model.supportedModes[xt.FLOORPLAN]=!1;var n=new Ah({geometry:new THREE.PlaneBufferGeometry(5,5,1,1)});n.material.visible=!1,n.rotateX(-Math.PI/2),n.geometry.computeBoundingBox(),e=[n]}e.forEach((function(e){var n=0;t.model.floorsEnabled&&(n=bh.parseFloor(e.name)),t.model.addChunk(n,e)})),t.model.floors.sort()},t=at.job+at.format,this.$app.config.model.name&&(t=this.$app.config.model.name),ft.time("".concat(this.$app.config.num,"[load modelmesh]").concat(this.$app.uid)),e.next=6,ri.getBueffer(this.getResourceURL("scene_view_data/{num}/images/".concat(t,"?_=").concat(this.imageVersion)));case 6:n=e.sent,ft.timeEnd("".concat(this.$app.config.num,"[load modelmesh]").concat(this.$app.uid)),function(e){ft.time("".concat(o.$app.config.num,"[parse dam]").concat(o.$app.uid));var t=gh.decompressMesh(e),n=Eh.convertProtobufToSceneObject(o.$app,t);ft.timeEnd("".concat(o.$app.config.num,"[parse dam]").concat(o.$app.uid)),i(n,o.$app.core.get("Player"))}(n);case 10:case"end":return e.stop()}}),e,this)}))),function(){return A.apply(this,arguments)})},{key:"textures",value:(y=k(S.mark((function e(){return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return ft.time("".concat(this.$app.config.num,"[load textures]").concat(this.$app.uid)),e.next=3,wh.load(this.$app.core.get("Player").model,this.$app.core.get("Player").model.meshTextures,this);case 3:ft.timeEnd("".concat(this.$app.config.num,"[load textures]").concat(this.$app.uid)),this.$app.core.get("Player").model.meshTexturesLoaded=!0;case 5:case"end":return e.stop()}}),e,this)}))),function(){return y.apply(this,arguments)})},{key:"floor",value:(g=k(S.mark((function e(){var t;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=null,e.prev=1,ft.time("".concat(this.$app.config.num,"[load floor]").concat(this.$app.uid)),e.next=5,ri.get(this.getResourceURL("scene_view_data/{num}/data/floor.json?_=".concat(this.time)));case 5:t=e.sent,ft.timeEnd("".concat(this.$app.config.num,"[load floor]").concat(this.$app.uid)),e.next=12;break;case 9:e.prev=9,e.t0=e.catch(1),ft.warn("loaded [floor] error");case 12:return e.abrupt("return",t);case 13:case"end":return e.stop()}}),e,this,[[1,9]])}))),function(){return g.apply(this,arguments)})},{key:"floorcad",value:(v=k(S.mark((function e(){var t;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=null,e.prev=1,ft.time("".concat(this.$app.config.num,"[load floorcad]").concat(this.$app.uid)),e.next=5,ri.get(this.getResourceURL("scene_view_data/{num}/data/floorplan_cad.json?_=".concat(this.time)));case 5:(t=e.sent).floors||(t=nT(t)),t&&t.floors&&(t.floors=t.floors.filter((function(e){return e.segment&&e.segment.length>0}))),ft.timeEnd("".concat(this.$app.config.num,"[load floorcad]").concat(this.$app.uid)),e.next=14;break;case 11:e.prev=11,e.t0=e.catch(1),ft.warn("loaded [floorcad] error");case 14:return this.$app.store.set("floorcad",t),e.abrupt("return",t);case 16:case"end":return e.stop()}}),e,this,[[1,11]])}))),function(){return v.apply(this,arguments)})},{key:"flooruser",value:(m=k(S.mark((function e(){var t,n;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=null,n=this.$app.store.getValue("metadata"),e.prev=2,ft.time("".concat(this.$app.config.num,"[load flooruser]").concat(this.$app.uid)),!n.floorPlanUser){e.next=10;break}return e.next=7,ri.get(this.getUserResourceURL("floorplan.json",this.reload));case 7:t=e.sent,e.next=13;break;case 10:return e.next=12,ri.get(this.getViewDataURL("floorplan.json"));case 12:t=e.sent;case 13:ft.timeEnd("".concat(this.$app.config.num,"[load flooruser]").concat(this.$app.uid)),e.next=30;break;case 16:if(e.prev=16,e.t0=e.catch(2),ft.warn("loaded [flooruser] error"),!n.floorPlanUser){e.next=29;break}return e.prev=20,e.next=23,ri.get(this.getViewDataURL("floorplan.json"));case 23:t=e.sent,e.next=29;break;case 26:e.prev=26,e.t1=e.catch(20),ft.warn("loaded [flooruser] error");case 29:t||(t={unit:"m",floors:[{walls:{Wall7:{important:!1,geoType:"Wall",children:[],start:"Point3",vectorId:"Wall7",width:.2,end:"Point0",out:!1},Wall6:{important:!1,geoType:"Wall",children:[],start:"Point2",vectorId:"Wall6",width:.2,end:"Point3",out:!1},Wall5:{important:!1,geoType:"Wall",children:[],start:"Point1",vectorId:"Wall5",width:.2,end:"Point2",out:!1},Wall4:{important:!1,geoType:"Wall",children:[],start:"Point0",vectorId:"Wall4",width:.2,end:"Point1",out:!1}},subgroup:0,name:"1楼",id:0,points:{Point1:{parent:{Wall5:"start",Wall4:"end"},geoType:"Point",vectorId:"Point1",x:5.531,y:5.777},Point0:{parent:{Wall7:"end",Wall4:"start"},geoType:"Point",vectorId:"Point0",x:5.531,y:-6.046},Point3:{parent:{Wall7:"start",Wall6:"end"},geoType:"Point",vectorId:"Point3",x:-2.663,y:-6.046},Point2:{parent:{Wall6:"start",Wall5:"end"},geoType:"Point",vectorId:"Point2",x:-2.663,y:5.777}}}],currentId:8,angle:0,type:"cad",version:"v4.0"});case 30:return this.$app.store.set("flooruser",t),e.abrupt("return",t);case 32:case"end":return e.stop()}}),e,this,[[2,16],[20,26]])}))),function(){return m.apply(this,arguments)})},{key:"billboards",value:(f=k(S.mark((function e(){var t,n;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this.$app.store.get("metadata");case 3:if(t=e.sent,n=null,"view"!==this.mode){e.next=14;break}if(t.billboards){e.next=8;break}return e.abrupt("return");case 8:return e.next=10,ri.get(this.getUserResourceURL("billboards.json"));case 10:n=e.sent,this.$app.store.set("billboards",n),e.next=18;break;case 14:return e.next=16,this.$app.remote_editor.billboards_list({num:this.num});case 16:n=e.sent,this.$app.store.set("billboards",n.data);case 18:e.next=23;break;case 20:e.prev=20,e.t0=e.catch(0),ft.error("loaded [billboards] error",e.t0);case 23:case"end":return e.stop()}}),e,this,[[0,20]])}))),function(){return f.apply(this,arguments)})},{key:"cutModel",value:(p=k(S.mark((function e(){var t,n;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this.$app.store.get("metadata");case 3:if(t=e.sent,n=null,t.cutModel){e.next=7;break}return e.abrupt("return");case 7:if("view"!==this.mode){e.next=14;break}return e.next=10,ri.get(this.getUserResourceURL("cutModel.json"));case 10:n=e.sent,this.$app.store.set("cutModel",n),e.next=18;break;case 14:return e.next=16,this.$app.remote_editor.cutModel_list({num:this.num});case 16:n=e.sent,this.$app.store.set("cutModel",n.data);case 18:e.next=23;break;case 20:e.prev=20,e.t0=e.catch(0),ft.error("loaded [cutModel] error",e.t0);case 23:case"end":return e.stop()}}),e,this,[[0,20]])}))),function(){return p.apply(this,arguments)})},{key:"tags",value:(d=k(S.mark((function e(t){var n,i,o=this;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.$app.config.isLoadTags||t){e.next=2;break}return e.abrupt("return");case 2:return n={data:{icons:[],tags:[]}},e.prev=3,e.next=6,this.$app.store.get("metadata");case 6:if(i=e.sent,ft.time("".concat(this.num,"[load tags]").concat(this.$app.uid)),"view"!=this.mode){e.next=24;break}if(i.tags){e.next=11;break}return e.abrupt("return");case 11:if(n.success=!0,!t){e.next=18;break}return e.next=15,ri.get(t);case 15:e.t0=e.sent,e.next=21;break;case 18:return e.next=20,ri.get(this.getUserResourceURL("hot.json"));case 20:e.t0=e.sent;case 21:n.data.tags=e.t0,e.next=27;break;case 24:return e.next=26,this.$app.remote_editor.tag_list({num:this.num});case 26:n=e.sent;case 27:n.success&&n.data&&n.data.tags&&n.data.tags.map((function(e){return e.position&&(e.position=new THREE.Vector3(e.position.x,e.position.y,e.position.z),e.visiblePanos?e.visiblePanos=Array.from(new Set(e.visiblePanos)).map((function(e){return o.$app.core.get("Player").model.panos.index[e]})):e.visiblePanos=o.$app.TagManager.getVisiblePano(e.position,{maxDis:5})),e})),ft.timeEnd("".concat(this.num,"[load tags]").concat(this.$app.uid)),e.next=34;break;case 31:e.prev=31,e.t1=e.catch(3),ft.error("loaded [tags] error",e.t1);case 34:return this.$app.store.set("tags",n.data),e.abrupt("return",n.data);case 36:case"end":return e.stop()}}),e,this,[[3,31]])}))),function(e){return d.apply(this,arguments)})},{key:"tours",value:(h=k(S.mark((function e(){var t;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=[],e.prev=1,e.next=4,this.$app.store.get("metadata");case 4:if(!e.sent.tours){e.next=9;break}return e.next=8,ri.get(this.getUserResourceURL("tour.json"));case 8:t=e.sent;case 9:e.next=14;break;case 11:e.prev=11,e.t0=e.catch(1),ft.error("loaded [tour] error",e.t0);case 14:return this.$app.store.set("tours",t),e.abrupt("return",t);case 16:case"end":return e.stop()}}),e,this,[[1,11]])}))),function(){return h.apply(this,arguments)})},{key:"links",value:(c=k(S.mark((function e(){var t,n,i=this;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this.$app.store.get("metadata");case 3:if(t=e.sent,n=null,"view"!==this.mode){e.next=15;break}if(t.links){e.next=8;break}return e.abrupt("return");case 8:return e.next=10,ri.get(this.getUserResourceURL("links.json"));case 10:n=(n=e.sent).filter((function(e){return void 0!==e.panoId||i.$app.core.get("Player").model.panos.get(e.nearestPano)})),this.$app.store.set("links",n),e.next=20;break;case 15:return e.next=17,this.$app.remote_editor.linkPan_list({num:this.num});case 17:(n=e.sent).data.tags=n.data.tags.filter((function(e){return void 0!==e.panoId||i.$app.core.get("Player").model.panos.get(e.nearestPano)})),this.$app.store.set("links",n.data);case 20:e.next=25;break;case 22:e.prev=22,e.t0=e.catch(0),ft.error("loaded [tour] error",e.t0);case 25:case"end":return e.stop()}}),e,this,[[0,22]])}))),function(){return c.apply(this,arguments)})},{key:"cameras",value:(l=k(S.mark((function e(){var t;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this.$app.store.get("metadata");case 3:if(e.sent.surveillances){e.next=6;break}return e.abrupt("return");case 6:if(t=null,"view"!==this.mode){e.next=14;break}return e.next=10,ri.get(this.getUserResourceURL("surveillance.json"));case 10:t=e.sent,this.$app.store.set("cameras",t),e.next=18;break;case 14:return e.next=16,this.$app.remote_editor.surveillance_list({num:this.num});case 16:t=e.sent,this.$app.store.set("cameras",t.data);case 18:e.next=23;break;case 20:e.prev=20,e.t0=e.catch(0),ft.error("loaded [cameras] error",e.t0);case 23:case"end":return e.stop()}}),e,this,[[0,20]])}))),function(){return l.apply(this,arguments)})},{key:"sceneDraw",value:(s=k(S.mark((function e(){var t;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this.$app.store.get("metadata");case 3:if(e.sent.sceneDraw){e.next=6;break}return e.abrupt("return");case 6:if(t=null,"view"!==this.mode){e.next=14;break}return e.next=10,ri.get(this.getUserResourceURL("sceneDraw.json"));case 10:t=e.sent,this.$app.store.set("sceneDraw",t),e.next=18;break;case 14:return e.next=16,this.$app.remote_editor.sceneDraw_list({num:this.num});case 16:t=e.sent,this.$app.store.set("sceneDraw",t.data);case 18:e.next=23;break;case 20:e.prev=20,e.t0=e.catch(0),ft.error("loaded [sceneDraw] error",e.t0);case 23:case"end":return e.stop()}}),e,this,[[0,20]])}))),function(){return s.apply(this,arguments)})},{key:"mosaics",value:(a=k(S.mark((function e(){var t;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this.$app.store.get("metadata");case 3:if(e.sent.mosaic){e.next=6;break}return e.abrupt("return");case 6:if(t=null,"view"!==this.mode){e.next=14;break}return e.next=10,ri.get(this.getUserResourceURL("mosaic.json"));case 10:t=e.sent,this.$app.store.set("mosaics",t),e.next=18;break;case 14:return e.next=16,this.$app.remote_editor.mosaics_list({num:this.num});case 16:t=e.sent,this.$app.store.set("mosaics",t.data);case 18:e.next=23;break;case 20:e.prev=20,e.t0=e.catch(0),ft.error("loaded [tour] error",e.t0);case 23:case"end":return e.stop()}}),e,this,[[0,20]])}))),function(){return a.apply(this,arguments)})},{key:"filters",value:(r=k(S.mark((function e(){var t;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this.$app.store.get("metadata");case 3:if(e.sent.filters){e.next=6;break}return e.abrupt("return");case 6:if(t=null,"view"!==this.mode){e.next=14;break}return e.next=10,ri.get(this.getUserResourceURL("filter.json"));case 10:t=e.sent,this.$app.store.set("filters",t),e.next=18;break;case 14:return e.next=16,this.$app.remote_editor.filter_list({num:this.num});case 16:t=e.sent,this.$app.store.set("filters",t.data);case 18:e.next=23;break;case 20:e.prev=20,e.t0=e.catch(0),ft.error("loaded [tour] error",e.t0);case 23:case"end":return e.stop()}}),e,this,[[0,20]])}))),function(){return r.apply(this,arguments)})},{key:"getImage",value:(i=k(S.mark((function e(t){var n;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,ri.getImage("".concat(this.$app.config.resource).concat(t));case 2:return n=e.sent,this.$app.store.set(t,n),e.abrupt("return",n);case 5:case"end":return e.stop()}}),e,this)}))),function(e){return i.apply(this,arguments)})},{key:"getUserImage",value:(n=k(S.mark((function e(t){var n;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=ri.getImage(this.getUserResourceURL(t)),this.$app.store.set(t,n),e.abrupt("return",n);case 3:case"end":return e.stop()}}),e,this)}))),function(e){return n.apply(this,arguments)})},{key:"getAppImage",value:(t=k(S.mark((function e(t){var n;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,ri.getImage(this.base(t));case 2:return n=e.sent,this.$app.store.set(t,n),e.abrupt("return",n);case 5:case"end":return e.stop()}}),e,this)}))),function(e){return t.apply(this,arguments)})},{key:"getAppURL",value:function(e){return this.base(e)}},{key:"getServerURL",value:function(e){return this.$app.config.server+e}},{key:"getResourceURL",value:function(e){return this.$app.config.resource+e.replace(/\{num\}/g,this.num)}},{key:"getUserResourceURL",value:function(e,t,n){if(!e||!e.trim())return e;if(0===e.indexOf("data:image")||0===e.indexOf("blob:")||0===e.indexOf("http")||0===e.indexOf("file"))return e;var i;if(t&&(this.reload=!0),-1!=e.indexOf("?t="))i=this.$app.config.resource+"scene_".concat(this.mode,"_data/").concat(this.num,"/user/").concat(e);else{i=n?this.$app.config.resource+"scene_".concat(this.mode,"_data/").concat(this.num,"/user/").concat(e,"?_=").concat(this.nowTime):this.$app.config.resource+"scene_".concat(this.mode,"_data/").concat(this.num,"/user/").concat(e,"?_=").concat(this.time);var o=e.split("?")[1];o&&(i+="&"+o)}return i}},{key:"getUserModelResourceURL",value:function(e,t){return e&&e.trim()?0===e.indexOf("blob:")||0===e.indexOf("http")||0===e.indexOf("file")?e:(t&&(this.reload=!0),this.$app.config.resource+"scene_".concat(this.mode,"_data/").concat(this.num,"/user/boxModels/").concat(e,"?_=").concat(this.time)):e}},{key:"getTourVideoURL",value:function(e,t){return t&&(this.reload=!0),this.$app.config.resource+"".concat(e,"?_=").concat(this.time)}},{key:"getViewResourceURL",value:function(e){return this.$app.config.resource+"scene_view_data/".concat(this.num,"/").concat(e)}},{key:"getViewDataURL",value:function(e){return this.$app.config.resource+"scene_view_data/".concat(this.num,"/data/").concat(e,"?_=").concat(this.version)}},{key:"getEditDataURL",value:function(e){return this.$app.config.resource+"scene_edit_data/".concat(this.num,"/data/").concat(e,"?_=").concat(this.version)}},{key:"getViewImagesURL",value:function(e){if(-1!==e.indexOf("&_="))return e;var t=-1!==e.indexOf("/panorama/")?this.linkVersion:this.imageVersion;return-1!==e.indexOf("?")?this.$app.config.resource+"scene_view_data/".concat(this.num,"/images/").concat(e,"&_=").concat(t):this.$app.config.resource+"scene_view_data/".concat(this.num,"/images/").concat(e,"?_=").concat(t)}},{key:"getUserImagesURL",value:function(e){var t;return t="view"==this.mode?"scene_view_data":"scene_edit_data",-1!==e.indexOf("&_=")?e:-1!==e.indexOf("?")?this.$app.config.resource+"".concat(t,"/").concat(this.num,"/images/").concat(e,"&_=").concat(this.version):this.$app.config.resource+"".concat(t,"/").concat(this.num,"/images/").concat(e,"?_=").concat(this.version)}}]),e}()}));var oT,rT=Object.assign,aT=Object.prototype.hasOwnProperty,sT=function(e,t){return aT.call(e,t)},lT=Array.isArray,cT=function(e){return"[object Map]"===pT(e)},uT=function(e){return"symbol"==typeof e},hT=function(e){return null!==e&&"object"==typeof e},dT=Object.prototype.toString,pT=function(e){return dT.call(e)},fT=function(e){return"string"==typeof e&&"NaN"!==e&&"-"!==e[0]&&""+parseInt(e,10)===e},mT=function(e,t){return!Object.is(e,t)};function vT(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return gT(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return gT(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var i=0,o=function(){};return{s:o,n:function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var r,a=!0,s=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return a=e.done,e},e:function(e){s=!0,r=e},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw r}}}}function gT(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);n<t;n++)i[n]=e[n];return i}function yT(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:oT;t&&t.active&&t.effects.push(e)}var AT,ET=function(e){var t=new Set(e);return t.w=0,t.n=0,t},bT=function(e){return(e.w&TT)>0},wT=function(e){return(e.n&TT)>0},xT=new WeakMap,CT=0,TT=1,IT=Symbol(""),kT=Symbol(""),BT=function(){function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,i=arguments.length>2?arguments[2]:void 0;o(this,e),this.fn=t,this.scheduler=n,this.active=!0,this.deps=[],this.parent=void 0,yT(this,i)}return u(e,[{key:"run",value:function(){if(!this.active)return this.fn();for(var e=AT,t=MT;e;){if(e===this)return;e=e.parent}try{return this.parent=AT,AT=this,MT=!0,TT=1<<++CT,CT<=30?function(e){var t=e.deps;if(t.length)for(var n=0;n<t.length;n++)t[n].w|=TT}(this):PT(this),this.fn()}finally{CT<=30&&function(e){var t=e.deps;if(t.length){for(var n=0,i=0;i<t.length;i++){var o=t[i];bT(o)&&!wT(o)?o.delete(e):t[n++]=o,o.w&=~TT,o.n&=~TT}t.length=n}}(this),TT=1<<--CT,AT=this.parent,MT=t,this.parent=void 0}}},{key:"stop",value:function(){this.active&&(PT(this),this.onStop&&this.onStop(),this.active=!1)}}]),e}();function PT(e){var t=e.deps;if(t.length){for(var n=0;n<t.length;n++)t[n].delete(e);t.length=0}}function RT(e){e.effect.stop()}var MT=!0,ST=[];function DT(){ST.push(MT),MT=!1}function LT(){var e=ST.pop();MT=void 0===e||e}function FT(e,t,n){if(MT&&AT){var i=xT.get(e);i||xT.set(e,i=new Map);var o=i.get(n);o||i.set(n,o=ET()),function(e,t){var n=!1;CT<=30?wT(e)||(e.n|=TT,n=!bT(e)):n=!e.has(AT);n&&(e.add(AT),AT.deps.push(e))}(o)}}function HT(e,t,n,i,o,r){var a=xT.get(e);if(a){var s=[];if("clear"===t)s=H(a.values());else if("length"===n&&lT(e))a.forEach((function(e,t){("length"===t||t>=i)&&s.push(e)}));else switch(void 0!==n&&s.push(a.get(n)),t){case"add":lT(e)?fT(n)&&s.push(a.get("length")):(s.push(a.get(IT)),cT(e)&&s.push(a.get(kT)));break;case"delete":lT(e)||(s.push(a.get(IT)),cT(e)&&s.push(a.get(kT)));break;case"set":cT(e)&&s.push(a.get(IT))}if(1===s.length)s[0]&&VT(s[0]);else{var l,c=[],u=vT(s);try{for(u.s();!(l=u.n()).done;){var h=l.value;h&&c.push.apply(c,H(h))}}catch(e){u.e(e)}finally{u.f()}VT(ET(c))}}}function VT(e,t){var n,i=vT(lT(e)?e:H(e));try{for(i.s();!(n=i.n()).done;){var o=n.value;(o!==AT||o.allowRecurse)&&(o.scheduler?o.scheduler():o.run())}}catch(e){i.e(e)}finally{i.f()}}var OT=iT("__proto__,__v_isRef,__isVue"),QT=new Set(Object.getOwnPropertyNames(Symbol).map((function(e){return Symbol[e]})).filter(uT)),_T=GT(),zT=GT(!0),UT=NT();function NT(){var e={};return["includes","indexOf","lastIndexOf"].forEach((function(t){e[t]=function(){for(var e=TI(this),n=0,i=this.length;n<i;n++)FT(e,0,n+"");for(var o=arguments.length,r=new Array(o),a=0;a<o;a++)r[a]=arguments[a];var s=e[t].apply(e,r);return-1===s||!1===s?e[t].apply(e,H(r.map(TI))):s}})),["push","pop","shift","unshift","splice"].forEach((function(t){e[t]=function(){DT();for(var e=arguments.length,n=new Array(e),i=0;i<e;i++)n[i]=arguments[i];var o=TI(this)[t].apply(this,n);return LT(),o}})),e}function GT(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return function(n,i,o){if("__v_isReactive"===i)return!e;if("__v_isReadonly"===i)return e;if("__v_isShallow"===i)return t;if("__v_raw"===i&&o===(e?t?yI:gI:t?vI:mI).get(n))return n;var r=lT(n);if(!e&&r&&sT(UT,i))return Reflect.get(UT,i,o);var a=Reflect.get(n,i,o);return(uT(i)?QT.has(i):OT(i))?a:(e||FT(n,0,i),t?a:BI(a)?!r||!fT(i)?a.value:a:hT(a)?e?bI(a):EI(a):a)}}function jT(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return function(t,n,i,o){var r=t[n];if(xI(r)&&BI(r)&&!BI(i))return!1;if(!e&&!xI(i)&&(CI(i)||(i=TI(i),r=TI(r)),!lT(t)&&BI(r)&&!BI(i)))return r.value=i,!0;var a=lT(t)&&fT(n)?Number(n)<t.length:sT(t,n),s=Reflect.set(t,n,i,o);return t===TI(o)&&(a?mT(i,r)&&HT(t,"set",n,i):HT(t,"add",n,i)),s}}var WT={get:_T,set:jT(),deleteProperty:function(e,t){var n=sT(e,t);e[t];var i=Reflect.deleteProperty(e,t);return i&&n&&HT(e,"delete",t,void 0),i},has:function(e,t){var n=Reflect.has(e,t);return uT(t)&&QT.has(t)||FT(e,0,t),n},ownKeys:function(e){return FT(e,0,lT(e)?"length":IT),Reflect.ownKeys(e)}},qT={get:zT,set:(e,t)=>!0,deleteProperty:(e,t)=>!0},JT=function(e){return e},YT=function(e){return Reflect.getPrototypeOf(e)};function ZT(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],i=arguments.length>3&&void 0!==arguments[3]&&arguments[3],o=TI(e=e.__v_raw),r=TI(t);t!==r&&!n&&FT(o,0,t),!n&&FT(o,0,r);var a=YT(o),s=a.has,l=i?JT:n?kI:II;return s.call(o,t)?l(e.get(t)):s.call(o,r)?l(e.get(r)):void(e!==o&&e.get(t))}function XT(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=this.__v_raw,i=TI(n),o=TI(e);return e!==o&&!t&&FT(i,0,e),!t&&FT(i,0,o),e===o?n.has(e):n.has(e)||n.has(o)}function KT(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return e=e.__v_raw,!t&&FT(TI(e),0,IT),Reflect.get(e,"size",e)}function $T(e){e=TI(e);var t=TI(this);return YT(t).has.call(t,e)||(t.add(e),HT(t,"add",e,e)),this}function eI(e,t){t=TI(t);var n=TI(this),i=YT(n),o=i.has,r=i.get,a=o.call(n,e);a||(e=TI(e),a=o.call(n,e));var s=r.call(n,e);return n.set(e,t),a?mT(t,s)&&HT(n,"set",e,t):HT(n,"add",e,t),this}function tI(e){var t=TI(this),n=YT(t),i=n.has,o=n.get,r=i.call(t,e);r||(e=TI(e),r=i.call(t,e)),o&&o.call(t,e);var a=t.delete(e);return r&&HT(t,"delete",e,void 0),a}function nI(){var e=TI(this),t=0!==e.size,n=e.clear();return t&&HT(e,"clear",void 0,void 0),n}function iI(e,t){return function(n,i){var o=this,r=o.__v_raw,a=TI(r),s=t?JT:e?kI:II;return!e&&FT(a,0,IT),r.forEach((function(e,t){return n.call(i,s(e),s(t),o)}))}}function oI(e,t,n){return function(){var i=this.__v_raw,o=TI(i),r=cT(o),a="entries"===e||e===Symbol.iterator&&r,s="keys"===e&&r,l=i[e].apply(i,arguments),c=n?JT:t?kI:II;return!t&&FT(o,0,s?kT:IT),{next(){var e=l.next(),t=e.value,n=e.done;return n?{value:t,done:n}:{value:a?[c(t[0]),c(t[1])]:c(t),done:n}},[Symbol.iterator](){return this}}}}function rI(e){return function(){return"delete"!==e&&this}}function aI(){var e={get(e){return ZT(this,e)},get size(){return KT(this)},has:XT,add:$T,set:eI,delete:tI,clear:nI,forEach:iI(!1,!1)},t={get(e){return ZT(this,e,!1,!0)},get size(){return KT(this)},has:XT,add:$T,set:eI,delete:tI,clear:nI,forEach:iI(!1,!0)},n={get(e){return ZT(this,e,!0)},get size(){return KT(this,!0)},has(e){return XT.call(this,e,!0)},add:rI("add"),set:rI("set"),delete:rI("delete"),clear:rI("clear"),forEach:iI(!0,!1)},i={get(e){return ZT(this,e,!0,!0)},get size(){return KT(this,!0)},has(e){return XT.call(this,e,!0)},add:rI("add"),set:rI("set"),delete:rI("delete"),clear:rI("clear"),forEach:iI(!0,!0)};return["keys","values","entries",Symbol.iterator].forEach((function(o){e[o]=oI(o,!1,!1),n[o]=oI(o,!0,!1),t[o]=oI(o,!1,!0),i[o]=oI(o,!0,!0)})),[e,n,t,i]}var sI=fe(aI(),4),lI=sI[0],cI=sI[1],uI=sI[2],hI=sI[3];function dI(e,t){var n=t?e?hI:uI:e?cI:lI;return function(t,i,o){return"__v_isReactive"===i?!e:"__v_isReadonly"===i?e:"__v_raw"===i?t:Reflect.get(sT(n,i)&&i in t?n:t,i,o)}}var pI={get:dI(!1,!1)},fI={get:dI(!0,!1)},mI=new WeakMap,vI=new WeakMap,gI=new WeakMap,yI=new WeakMap;function AI(e){return e.__v_skip||!Object.isExtensible(e)?0:function(e){switch(e){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}(function(e){return pT(e).slice(8,-1)}(e))}function EI(e){return xI(e)?e:wI(e,!1,WT,pI,mI)}function bI(e){return wI(e,!0,qT,fI,gI)}function wI(e,t,n,i,o){if(!hT(e))return e;if(e.__v_raw&&(!t||!e.__v_isReactive))return e;var r=o.get(e);if(r)return r;var a=AI(e);if(0===a)return e;var s=new Proxy(e,2===a?i:n);return o.set(e,s),s}function xI(e){return!(!e||!e.__v_isReadonly)}function CI(e){return!(!e||!e.__v_isShallow)}function TI(e){var t=e&&e.__v_raw;return t?TI(t):e}var II=function(e){return hT(e)?EI(e):e},kI=function(e){return hT(e)?bI(e):e};function BI(e){return!(!e||!0!==e.__v_isRef)}function PI(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return RI(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return RI(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var i=0,o=function(){};return{s:o,n:function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var r,a=!0,s=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return a=e.done,e},e:function(e){s=!0,r=e},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw r}}}}function RI(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);n<t;n++)i[n]=e[n];return i}Promise.resolve();var MI=!1,SI=[],DI=Promise.resolve(),LI=function(e){return DI.then(e)},FI=function(e){SI.includes(e)||SI.push(e),MI||(MI=!0,LI(HI))},HI=function(){var e,t=PI(SI);try{for(t.s();!(e=t.n()).done;){(0,e.value)()}}catch(e){t.e(e)}finally{t.f()}SI.length=0,MI=!1};function VI(e){if(GI(e)){for(var t={},n=0;n<e.length;n++){var i=e[n],o=WI(i)?_I(i):VI(i);if(o)for(var r in o)t[r]=o[r]}return t}return WI(e)||qI(e)?e:void 0}var OI=/;(?![^(]*\))/g,QI=/:(.+)/;function _I(e){var t={};return e.split(OI).forEach((function(e){if(e){var n=e.split(QI);n.length>1&&(t[n[0].trim()]=n[1].trim())}})),t}function zI(e){var t="";if(WI(e))t=e;else if(GI(e))for(var n=0;n<e.length;n++){var i=zI(e[n]);i&&(t+=i+" ")}else if(qI(e))for(var o in e)e[o]&&(t+=o+" ");return t.trim()}function UI(e,t){if(e===t)return!0;var n=jI(e),i=jI(t);if(n||i)return!(!n||!i)&&e.getTime()===t.getTime();if(n=GI(e),i=GI(t),n||i)return!(!n||!i)&&function(e,t){if(e.length!==t.length)return!1;for(var n=!0,i=0;n&&i<e.length;i++)n=UI(e[i],t[i]);return n}(e,t);if(n=qI(e),i=qI(t),n||i){if(!n||!i)return!1;if(Object.keys(e).length!==Object.keys(t).length)return!1;for(var o in e){var r=e.hasOwnProperty(o),a=t.hasOwnProperty(o);if(r&&!a||!r&&a||!UI(e[o],t[o]))return!1}}return String(e)===String(t)}function NI(e,t){return e.findIndex((function(e){return UI(e,t)}))}var GI=Array.isArray,jI=function(e){return e instanceof Date},WI=function(e){return"string"==typeof e},qI=function(e){return null!==e&&"object"==typeof e},JI=function(e){var t=Object.create(null);return function(n){return t[n]||(t[n]=e(n))}},YI=/-(\w)/g,ZI=JI((function(e){return e.replace(YI,(function(e,t){return t?t.toUpperCase():""}))})),XI=/\B([A-Z])/g,KI=JI((function(e){return e.replace(XI,"-$1").toLowerCase()})),$I=function(e){var t=parseFloat(e);return isNaN(t)?e:t},ek=/^(spellcheck|draggable|form|list|type)$/,tk=function(e){var t,n=e.el,i=e.get,o=e.effect,r=e.arg,a=e.modifiers;"class"===r&&(n._class=n.className),o((function(){var e=i();if(r)(null==a?void 0:a.camel)&&(r=ZI(r)),nk(n,r,e,t);else{for(var o in e)nk(n,o,e[o],t&&t[o]);for(var s in t)e&&s in e||nk(n,s,null)}t=e}))},nk=function(e,t,n,i){if("class"===t)e.setAttribute("class",zI(e._class?[e._class,n]:n)||"");else if("style"===t){n=VI(n);var o=e.style;if(n)if(WI(n))n!==i&&(o.cssText=n);else{for(var r in n)ok(o,r,n[r]);if(i&&!WI(i))for(var a in i)null==n[a]&&ok(o,a,"")}else e.removeAttribute("style")}else e instanceof SVGElement||!(t in e)||ek.test(t)?"true-value"===t?e._trueValue=n:"false-value"===t?e._falseValue=n:null!=n?e.setAttribute(t,n):e.removeAttribute(t):(e[t]=n,"value"===t&&(e._value=n))},ik=/\s*!important$/,ok=function e(t,n,i){GI(i)?i.forEach((function(i){return e(t,n,i)})):n.startsWith("--")?t.setProperty(n,i):ik.test(i)?t.setProperty(KI(n),i.replace(ik,""),"important"):t[n]=i},rk=function(e,t){var n=e.getAttribute(t);return null!=n&&e.removeAttribute(t),n},ak=function(e,t,n,i){e.addEventListener(t,n,i)},sk=/^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*|\['[^']*?']|\["[^"]*?"]|\[\d+]|\[[A-Za-z_$][\w$]*])*$/,lk=["ctrl","shift","alt","meta"],ck={stop:function(e){return e.stopPropagation()},prevent:function(e){return e.preventDefault()},self:function(e){return e.target!==e.currentTarget},ctrl:function(e){return!e.ctrlKey},shift:function(e){return!e.shiftKey},alt:function(e){return!e.altKey},meta:function(e){return!e.metaKey},left:function(e){return"button"in e&&0!==e.button},middle:function(e){return"button"in e&&1!==e.button},right:function(e){return"button"in e&&2!==e.button},exact:function(e,t){return lk.some((function(n){return e["".concat(n,"Key")]&&!t[n]}))}},uk=function(e){var t=e.el,n=e.get,i=e.exp,o=e.arg,r=e.modifiers;if(o){var a=sk.test(i)?n("(e => ".concat(i,"(e))")):n("($event => { ".concat(i," })"));if("vue:mounted"!==o){if("vue:unmounted"===o)return function(){return a()};if(r){"click"===o&&(r.right&&(o="contextmenu"),r.middle&&(o="mouseup"));var s=a;a=function(e){if(!("key"in e)||KI(e.key)in r){for(var t in r){var n=ck[t];if(n&&n(e,r))return}return s(e)}}}ak(t,o,a,r)}else LI(a)}},hk=function(e){var t=e.el,n=e.get;(0,e.effect)((function(){t.textContent=dk(n())}))},dk=function(e){return null==e?"":qI(e)?JSON.stringify(e,null,2):String(e)},pk=function(e){return"_value"in e?e._value:e.value},fk=function(e,t){var n=t?"_trueValue":"_falseValue";return n in e?e[n]:t},mk=function(e){e.target.composing=!0},vk=function(e){var t=e.target;t.composing&&(t.composing=!1,gk(t,"input"))},gk=function(e,t){var n=document.createEvent("HTMLEvents");n.initEvent(t,!0,!0),e.dispatchEvent(n)},yk=Object.create(null),Ak=function(e,t,n){return Ek(e,"return(".concat(t,")"),n)},Ek=function(e,t,n){var i=yk[t]||(yk[t]=bk(t));try{return i(e,n)}catch(e){console.error(e)}},bk=function(e){try{return new Function("$data","$el","with($data){".concat(e,"}"))}catch(t){return console.error("".concat(t.message," in expression: ").concat(e)),function(){}}},wk={bind:tk,on:uk,show:function(e){var t=e.el,n=e.get,i=e.effect,o=t.style.display;i((function(){t.style.display=n()?o:"none"}))},text:hk,html:function(e){var t=e.el,n=e.get;(0,e.effect)((function(){t.innerHTML=n()}))},model:function(e){var t=e.el,n=e.exp,i=e.get,o=e.effect,r=e.modifiers,a=t.type,s=i("(val) => { ".concat(n," = val }")),l=r||{},c=l.trim,u=l.number,h=void 0===u?"number"===a:u;if("SELECT"===t.tagName){var d=t;ak(t,"change",(function(){var e=Array.prototype.filter.call(d.options,(function(e){return e.selected})).map((function(e){return h?$I(pk(e)):pk(e)}));s(d.multiple?e:e[0])})),o((function(){for(var e=i(),t=d.multiple,n=0,o=d.options.length;n<o;n++){var r=d.options[n],a=pk(r);if(t)GI(e)?r.selected=NI(e,a)>-1:r.selected=e.has(a);else if(UI(pk(r),e))return void(d.selectedIndex!==n&&(d.selectedIndex=n))}t||-1===d.selectedIndex||(d.selectedIndex=-1)}))}else if("checkbox"===a){var p;ak(t,"change",(function(){var e=i(),n=t.checked;if(GI(e)){var o=pk(t),r=NI(e,o),a=-1!==r;if(n&&!a)s(e.concat(o));else if(!n&&a){var l=H(e);l.splice(r,1),s(l)}}else s(fk(t,n))})),o((function(){var e=i();GI(e)?t.checked=NI(e,pk(t))>-1:e!==p&&(t.checked=UI(e,fk(t,!0))),p=e}))}else if("radio"===a){ak(t,"change",(function(){s(pk(t))})),o((function(){var e=i();undefined!==e&&(t.checked=UI(e,pk(t)))}))}else{var f=function(e){return c?e.trim():h?$I(e):e};ak(t,"compositionstart",mk),ak(t,"compositionend",vk),ak(t,(null==r?void 0:r.lazy)?"change":"input",(function(){t.composing||s(f(t.value))})),c&&ak(t,"change",(function(){t.value=t.value.trim()})),o((function(){if(!t.composing){var e=t.value,n=i();document.activeElement===t&&f(e)===n||e!==n&&(t.value=n)}}))}},effect:function(e){var t=e.el,n=e.ctx,i=e.exp,o=e.effect;LI((function(){return o((function(){return Ek(n.scope,i,t)}))}))}},xk=/([\s\S]*?)\s+(?:in|of)\s+([\s\S]*)/,Ck=/,([^,\}\]]*)(?:,([^,\}\]]*))?$/,Tk=/^\(|\)$/g,Ik=/^[{[]\s*((?:[\w_$]+\s*,?\s*)+)[\]}]$/,kk=function(e,t,n){var i=t.match(xk);if(i){var o=e.nextSibling,r=e.parentElement,a=new Text("");r.insertBefore(a,e),r.removeChild(e);var s,l,c,u,h=i[2].trim(),d=i[1].trim().replace(Tk,"").trim(),p=!1,f="key",m=e.getAttribute(f)||e.getAttribute(f=":key")||e.getAttribute(f="v-bind:key");m&&(e.removeAttribute(f),"key"===f&&(m=JSON.stringify(m))),(u=d.match(Ck))&&(d=d.replace(Ck,"").trim(),l=u[1].trim(),u[2]&&(c=u[2].trim())),(u=d.match(Ik))&&(s=u[1].split(",").map((function(e){return e.trim()})),p="["===d[0]);var v,g,y,A=!1,E=function(e,t,i,o){var r={};s?s.forEach((function(e,n){return r[e]=t[p?n:e]})):r[d]=t,o?(l&&(r[l]=o),c&&(r[c]=i)):l&&(r[l]=i);var a=Ok(n,r),u=m?Ak(a.scope,m):i;return e.set(u,i),a.key=u,a},b=function(t,n){var i=new _k(e,t);return i.key=t.key,i.insert(r,n),i};return n.effect((function(){var e=Ak(n.scope,h),t=y,i=fe(function(e){var t=new Map,n=[];if(GI(e))for(var i=0;i<e.length;i++)n.push(E(t,e[i],i));else if("number"==typeof e)for(var o=0;o<e;o++)n.push(E(t,o+1,o));else if(qI(e)){var r=0;for(var a in e)n.push(E(t,e[a],r++,a))}return[n,t]}(e),2);if(g=i[0],y=i[1],A){for(var o=0;o<v.length;o++)y.has(v[o].key)||v[o].remove();for(var s,l,c=[],u=g.length;u--;){var d=g[u],p=t.get(d.key),f=void 0;null==p?f=b(d,s?s.el:a):(f=v[p],Object.assign(f.ctx.scope,d.scope),p!==u&&(v[p+1]===s&&l!==s||(l=f,f.insert(r,s?s.el:a)))),c.unshift(s=f)}v=c}else v=g.map((function(e){return b(e,a)})),A=!0})),o}},Bk=function(e){var t,n=e.el,i=e.ctx.scope.$refs,o=e.get;return(0,e.effect)((function(){var e=o();i[e]=n,t&&e!==t&&delete i[t],t=e})),function(){t&&delete i[t]}},Pk=/^(?:v-|:|@)/,Rk=/\.([\w-]+)/g,Mk=!1,Sk=function(e,t){var n=e.nodeType;if(1===n){var i,o=e;if(o.hasAttribute("v-pre"))return;if(rk(o,"v-cloak"),i=rk(o,"v-if"))return function(e,t,n){var i=e.parentElement,o=new Comment("v-if");i.insertBefore(o,e);for(var r,a,s=[{exp:t,el:e}];(r=e.nextElementSibling)&&(a=null,""===rk(r,"v-else")||(a=rk(r,"v-else-if")));)i.removeChild(r),s.push({exp:a,el:r});var l,c=e.nextSibling;i.removeChild(e);var u=-1,h=function(){l&&(i.insertBefore(o,l.el),l.remove(),l=void 0)};return n.effect((function(){for(var e=0;e<s.length;e++){var t=s[e],r=t.exp,a=t.el;if(!r||Ak(n.scope,r))return void(e!==u&&(h(),(l=new _k(a,n)).insert(i,o),i.removeChild(o),u=e))}u=-1,h()})),c}(o,i,t);if(i=rk(o,"v-for"))return kk(o,i,t);if((i=rk(o,"v-scope"))||""===i){var r=i?Ak(t.scope,i):{};t=Ok(t,r),r.$template&&Hk(o,r.$template)}var a=null!=rk(o,"v-once");a&&(Mk=!0),(i=rk(o,"ref"))&&Fk(o,Bk,'"'.concat(i,'"'),t),Dk(o,t);for(var s=[],l=0,c=H(o.attributes);l<c.length;l++){var u=c[l],h=u.name,d=u.value;Pk.test(h)&&"v-cloak"!==h&&("v-model"===h?s.unshift([h,d]):"@"===h[0]||/^v-on\b/.test(h)?s.push([h,d]):Lk(o,h,d,t))}for(var p=0,f=s;p<f.length;p++){var m=fe(f[p],2),v=m[0],g=m[1];Lk(o,v,g,t)}a&&(Mk=!1)}else if(3===n){var y=e.data;if(y.includes(t.delimiters[0])){for(var A,E=[],b=0;A=t.delimitersRE.exec(y);){var w=y.slice(b,A.index);w&&E.push(JSON.stringify(w)),E.push("$s(".concat(A[1],")")),b=A.index+A[0].length}b<y.length&&E.push(JSON.stringify(y.slice(b))),Fk(e,hk,E.join("+"),t)}}else 11===n&&Dk(e,t)},Dk=function(e,t){for(var n=e.firstChild;n;)n=Sk(n,t)||n.nextSibling},Lk=function(e,t,n,i){var o,r,a;if(":"===(t=t.replace(Rk,(function(e,t){return(a||(a={}))[t]=!0,""})))[0])o=tk,r=t.slice(1);else if("@"===t[0])o=uk,r=t.slice(1);else{var s=t.indexOf(":"),l=s>0?t.slice(2,s):t.slice(2);o=wk[l]||i.dirs[l],r=s>0?t.slice(s+1):void 0}o&&(o===tk&&"ref"===r&&(o=Bk),Fk(e,o,n,i,r,a),e.removeAttribute(t))},Fk=function(e,t,n,i,o,r){var a=t({el:e,get:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:n;return Ak(i.scope,t,e)},effect:i.effect,ctx:i,exp:n,arg:o,modifiers:r});a&&i.cleanups.push(a)},Hk=function(e,t){if("#"!==t[0])e.innerHTML=t;else{var n=document.querySelector(t);e.appendChild(n.content.cloneNode(!0))}},Vk=function(e){var t=Object.assign(Object.assign({delimiters:["{{","}}"],delimitersRE:/\{\{([^]+?)\}\}/g},e),{scope:e?e.scope:EI({}),dirs:e?e.dirs:{},effects:[],blocks:[],cleanups:[],effect:function(e){if(Mk)return FI(e),e;var n=function(e,t){e.effect&&(e=e.effect.fn);var n=new BT(e);t&&(rT(n,t),t.scope&&yT(n,t.scope)),t&&t.lazy||n.run();var i=n.run.bind(n);return i.effect=n,i}(e,{scheduler:function(){return FI(n)}});return t.effects.push(n),n}});return t},Ok=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=e.scope,i=Object.create(n);Object.defineProperties(i,Object.getOwnPropertyDescriptors(t)),i.$refs=Object.create(n.$refs);var o=EI(new Proxy(i,{set:(e,t,i,r)=>r!==o||e.hasOwnProperty(t)?Reflect.set(e,t,i,r):Reflect.set(n,t,i)}));return Qk(o),Object.assign(Object.assign({},e),{scope:o})},Qk=function(e){for(var t=0,n=Object.keys(e);t<n.length;t++){var i=n[t];"function"==typeof e[i]&&(e[i]=e[i].bind(e))}},_k=function(){function e(t,n){var i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];o(this,e),this.isFragment=t instanceof HTMLTemplateElement,i?this.template=t:this.isFragment?this.template=t.content.cloneNode(!0):this.template=t.cloneNode(!0),i?this.ctx=n:(this.parentCtx=n,n.blocks.push(this),this.ctx=Vk(n)),Sk(this.template,this.ctx)}return u(e,[{key:"el",get:function(){return this.start||this.template}},{key:"insert",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(this.isFragment)if(this.start)for(var n,i=this.start;i&&(n=i.nextSibling,e.insertBefore(i,t),i!==this.end);)i=n;else this.start=new Text(""),this.end=new Text(""),e.insertBefore(this.end,t),e.insertBefore(this.start,this.end),e.insertBefore(this.template,this.end);else e.insertBefore(this.template,t)}},{key:"remove",value:function(){if(this.parentCtx&&function(e,t){var n=e.indexOf(t);n>-1&&e.splice(n,1)}(this.parentCtx.blocks,this),this.start)for(var e,t=this.start.parentNode,n=this.start;n&&(e=n.nextSibling,t.removeChild(n),n!==this.end);)n=e;else this.template.parentNode.removeChild(this.template);this.teardown()}},{key:"teardown",value:function(){this.ctx.blocks.forEach((function(e){e.teardown()})),this.ctx.effects.forEach(RT),this.ctx.cleanups.forEach((function(e){return e()}))}}]),e}(),zk=function(e){return e.replace(/[-.*+?^${}()|[\]\/\\]/g,"\\$&")},Uk=function(e){var t,n=Vk();if(e&&(n.scope=EI(e),Qk(n.scope),e.$delimiters)){var i=fe(n.delimiters=e.$delimiters,2),o=i[0],r=i[1];n.delimitersRE=new RegExp(zk(o)+"([^]+?)"+zk(r),"g")}return n.scope.$s=dk,n.scope.$nextTick=LI,n.scope.$refs=Object.create(null),{directive(e,t){return t?(n.dirs[e]=t,this):n.dirs[e]},mount(e){var i;if("string"!=typeof e||(e=document.querySelector(e)))return(i=(e=e||document.documentElement).hasAttribute("v-scope")?[e]:H(e.querySelectorAll("[v-scope]")).filter((function(e){return!e.matches("[v-scope] [v-scope]")}))).length||(i=[e]),t=i.map((function(e){return new _k(e,n,!0)})),this},unmount(){t.forEach((function(e){return e.teardown()}))}}},Nk=document.currentScript;Nk&&Nk.hasAttribute("init")&&Uk().mount();var Gk=Object.freeze({__proto__:null,createApp:Uk,nextTick:LI,reactive:EI}),jk=function(e){for(var t=e.split(","),n=t[0].match(/:(.*?);/)[1],i=atob(t[1]),o=i.length,r=new Uint8Array(o);o--;)r[o]=i.charCodeAt(o);return new Blob([r],{type:n})};function Wk(e,t){return new File([e],t,{type:e.type})}function qk(e,t){if(e&&t){var n=window.URL.createObjectURL(e),i=document.createElement("a");i.href=n,i.download=t,i.click(),i.remove(),window.URL.revokeObjectURL(n)}}var Jk=Object.freeze({__proto__:null,base64ToBlob:jk,convertBlob2File:Wk,download:qk,downloadFromURL:function(e,t){return new Promise(function(){var n=k(S.mark((function n(i,o){var r,a;return S.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(e&&t){n.next=2;break}return n.abrupt("return",o("url or name is null"));case 2:if(!(e instanceof Blob)){n.next=7;break}qk(e,t),i(!0),n.next=19;break;case 7:if(0!==e.indexOf("data:")){n.next=12;break}qk(jk(e),t),i(!0),n.next=19;break;case 12:return n.next=14,fetch(e);case 14:return r=n.sent,n.next=17,r.blob();case 17:(a=n.sent)?(qk(a,t),i(!0)):o(!1);case 19:case"end":return n.stop()}}),n)})));return function(e,t){return n.apply(this,arguments)}}())}});function Yk(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}var Zk,Xk=new THREE.Vector3,Kk=new THREE.Vector3,$k=new THREE.Vector3,eB=new THREE.Quaternion,tB=new THREE.Quaternion,nB=new THREE.Color(1,1,1),iB=new THREE.Color(2,2,2),oB=function(e){f(n,THREE.PerspectiveCamera);var t=Yk(n);function n(e,i,r){var a,s,l,c,u;return o(this,n),(a=t.call(this,i.fov||Aa.clampVFOV(_e.dollhouseFOV),i.aspect||e.player.cameraControls.cameras.dollhouse.aspect,_e.dollhouseNear,_e.dollhouseFar)).shake=(l=Ae.getUniqueId(),c=Ae.getUniqueId(),u=h(a),function e(t){s=s&&s.equals(u.shakingRange.to)?u.shakingRange.from:u.shakingRange.to,t?(Ae.start(St.quaternion(u.quaternion,s),u.shakingDuration,null,0,null,null,l),Ae.start(St.quaternion(u.cylinder.quaternion,s),u.shakingDuration,(function(){return e(!0)}),0,null,null,c)):(Ae.cancelById(l),Ae.cancelById(c))}),a.options=i,a.control=e,a.player=a.control.player,a.videoPlayer=r,a.sid=i.sid,a.name=i.name||"",a.videoType=i.videoType,a.type="SecurityCamera",a.panoId=i.panoId,a.videoSrc=i.video,a.videoActive=!1,a.shakingDuration=i.duration||2e3,a.shakingRange={from:new THREE.Quaternion,to:(new THREE.Quaternion).setFromAxisAngle(new THREE.Vector3(1,0,0),Math.PI/2)},i.from&&a.shakingRange.from.setFromEuler(i.from),i.to&&a.shakingRange.to.setFromEuler(i.to),a.posOri=i.posOri||new THREE.Vector3,a.posOffset=i.posOffset||new THREE.Vector3,a.position.copy(a.posOri).add(a.posOffset),i.target?(a.target=i.target,a.lookAt(i.target)):(i.rotation&&a.quaternion.setFromEuler(i.rotation),a.target=new THREE.Vector3(0,0,-1).applyQuaternion(a.quaternion).add(a.position)),a.cylinderNear=i.near||.03,a.cylinderFar=i.far||3,a.roll=0,a.init(),a.layers.enable(Ft),a.layers.enable(Ht),a.player.model.add(h(a)),a}return u(n,[{key:"setRoll",value:function(e){this.roll=e%360,this.obj3d.quaternion.setFromAxisAngle(Xk.set(0,0,-1),THREE.MathUtils.degToRad(e))}},{key:"yaw",get:function(){var e=Xk.copy(this.cylinder.bottom.position).applyQuaternion(this.quaternion).setY(0),t=Kk.set(0,0,1),n=$k.set(1,0,0),i=(THREE.MathUtils.radToDeg(e.angleTo(t)*Math.sign(e.dot(n)))+180)%360;return i>180&&(i-=360),i},set:function(e){var t=this.pitch,n=Xk.set(0,1,0),i=Kk.set(1,0,0),o=eB.setFromAxisAngle(n,THREE.MathUtils.degToRad(e)),r=tB.setFromAxisAngle(i,THREE.MathUtils.degToRad(t));this.quaternion.multiplyQuaternions(o,r),this.updateTarget()}},{key:"pitch",get:function(){var e=Xk.copy(this.cylinder.bottom.position).applyQuaternion(this.quaternion),t=Kk.copy(e).projectOnPlane($k.set(0,1,0)),n=THREE.MathUtils.radToDeg(e.angleTo(t)*Math.sign(e.y))%180;return n>90&&(n=90-n),n},set:function(e){e=Math.min(Math.max(e,-89.9),89.9);var t=this.yaw<0?this.yaw+360:this.yaw,n=Xk.set(0,1,0),i=Kk.set(1,0,0),o=eB.setFromAxisAngle(n,THREE.MathUtils.degToRad(t)),r=tB.setFromAxisAngle(i,THREE.MathUtils.degToRad(e));this.quaternion.multiplyQuaternions(o,r),this.updateTarget()}},{key:"init",value:function(){var e=this;this.normalMat=new THREE.MeshBasicMaterial({color:51375,transparent:!0,opacity:.1,side:THREE.DoubleSide,depthTest:!1}),this.build(),this.options.pitch&&(this.pitch=this.options.pitch),this.options.yaw&&(this.yaw=this.options.yaw),this.options.roll&&this.setRoll(this.options.roll),this.updateInfo(!0);var t=this.createVideo();if(this.videoSrc){t.onloadedmetadata=function(){t.canPlayed=!0,t.masters.forEach((function(e){e.dispatchEvent({type:"loadedmetadata"})}))};var n=function(t){e.player.$app.Camera.emit("SecurityCamera.videoActive",e.sid),e.videoActive=!0,e.updateInfo(!0)};if(t.canPlayed?n():this.addEventListener("loadedmetadata",n),Hls.isSupported()&&2!==this.videoType){var i=new Hls;i.loadSource(this.videoSrc),i.attachMedia(t),i.on(Hls.Events.ERROR,(function(e,t){return console.log("HLS加载失败",e,t)})),this.hlsVideoPlayer=i}this.play(),this.pause()}this.videoMat=new THREE.MeshBasicMaterial({map:new THREE.VideoTexture(t),side:THREE.DoubleSide,depthTest:!1,transparent:!0}),this.events={setSize:function(t,n){e.isWatching&&e.updateAspect()}},this.player.on("setSize",this.events.setSize)}},{key:"updateAspect",value:function(){var e=this.player.cameraControls.cameras.dollhouse.aspect;e!=this.aspect&&(this.aspect=e,this.updateMesh())}},{key:"updateMesh",value:function(){var e,t,n,i;t=(e=Math.tan(THREE.MathUtils.degToRad(this.fov/2))*this.cylinderNear)*this.aspect,i=(n=Math.tan(THREE.MathUtils.degToRad(this.fov/2))*this.cylinderFar)*this.aspect;var o=[],r=[];o.push(-t,e,-this.cylinderNear),o.push(t,e,-this.cylinderNear),o.push(t,-e,-this.cylinderNear),o.push(-t,-e,-this.cylinderNear),r.push(-i,n,-this.cylinderFar),r.push(i,n,-this.cylinderFar),r.push(i,-n,-this.cylinderFar),r.push(-i,-n,-this.cylinderFar),o=o.concat(r);var a=!this.cylinder;if(a){var s=[];s.push(0,1,1,1,1,0,0,0),s.push(0,1,1,1,1,0,0,0);var l=[];l.push(0,1,3,2,3,1),l.push(0,1,4,5,4,1),l.push(1,2,5,6,5,2),l.push(2,3,6,7,6,3),l.push(3,0,7,4,7,0);var c=new THREE.BufferGeometry;c.setAttribute("uv",new THREE.BufferAttribute(new Float32Array(s),2)),c.setIndex(new THREE.BufferAttribute(new Uint16Array(l),1)),this.cylinder=new THREE.Mesh(c,this.normalMat),this.obj3d.add(this.cylinder)}this.cylinder.geometry.setAttribute("position",new THREE.BufferAttribute(new Float32Array(o),3));var u=new THREE.PlaneGeometry(2*i,2*n);a?(this.cylinder.bottom=new THREE.Mesh(u,this.normalMat),this.cylinder.add(this.cylinder.bottom)):(this.cylinder.bottom.geometry.dispose(),this.cylinder.bottom.geometry=u),this.cylinder.bottom.position.set(0,0,this.cylinderNear-this.cylinderFar),a?(this.cylinder.line=new THREE.LineSegments(new THREE.EdgesGeometry(this.cylinder.geometry),new THREE.LineBasicMaterial({color:16777215,opacity:.6,transparent:!0})),this.cylinder.add(this.cylinder.line)):(this.cylinder.line.geometry.dispose(),this.cylinder.line.geometry=new THREE.EdgesGeometry(this.cylinder.geometry))}},{key:"createVideo",value:function(e){e&&(this.videoSrc=e);var t=this.videoPlayer.getVideo(this.videoSrc,this);return this.video=t,t}},{key:"build",value:function(){if(this.obj3d=new THREE.Group,this.obj3d.camera=this,this.add(this.obj3d),Zk)this.tag=Zk.clone(),this.obj3d.add(this.tag);else{var e=this;ms(si.getImageURL("images/camera.glb"),(function(t){e.tag=t.scene.children[0].children[0],e.tag.geometry.translate(30,50,-10),e.tag.quaternion.setFromEuler(new THREE.Euler(Math.PI/2,Math.PI,0)),e.obj3d.add(e.tag),Zk=e.tag.clone()}))}this.updateMesh(),this.titleLabel=new Ce({text:this.name,backgroundColor:{r:255,g:255,b:255,a:0},textColor:{r:255,g:255,b:255,a:1},textshadowColor:"#888",borderRadius:2,fontsize:34,renderOrder:5,margin:{x:12,y:10},player:this.player,sizeInfo:{scale:.4,nearBound:3}}),this.titleLabel.sprite.material.depthTest=this.titleLabel.sprite.material.depthWrite=!0,this.titleLabel.position.set(0,-.2,.1),this.add(this.titleLabel),this.dispatchEvent({type:"build"})}},{key:"showVideo",value:function(e){this.player.cameraControls.activeControl&&(this.player.cameraControls.activeControl.enabled=!e||this.control.isEdit),this.videoActive&&(e?(this.play(),this.normalMat.opacity=0,De.updateVisible(this.cylinder,"watch",!0,1,"add"),this.cylinder.bottom.material=this.videoMat,this.cylinder.bottom.renderOrder=tt):(this.pause(),this.normalMat.opacity=.08,De.updateVisible(this.cylinder,"watch",!1,1,"cancel"),this.cylinder.bottom.material=this.normalMat,this.cylinder.bottom.renderOrder=Ue))}},{key:"play",value:function(){var e=this;if(this.shouldPlay=!0,Fe.detectWeixin())try{top.WeixinJSBridge&&top.WeixinJSBridge.invoke("getNetworkType",{},(function(t){e.video.play()}),!1)}catch(e){this.video.play()}else this.video.play(),this.video.paused&&console.log("播放不了")}},{key:"pause",value:function(){this.shouldPlay=!1,this.video.pause()}},{key:"watch",value:function(e){var t=this;this.player.compass.setDisplay(!1,!0),this.player.$app.config.view||this.player.compass.switch("axis"),this.updateAspect(),this.isWatching=!0;var n=this.player.cameraControls.controls.dollhouse;n.minDistance=0,n.minPolarAngle=-Math.PI,n.maxPolarAngle=Math.PI,n.mode="security",n.forbitSetRanges=!0,this.target.set(0,0,-1).applyQuaternion(this.quaternion).add(this.position),this.videoActive||this.isNew||this.player.$app.Camera.emit("SecurityCamera.cannotWatchVideo",this.sid);var i=function(){if(t.player.model.panos.get(t.panoId)){var e=t.player.model.panos.get(t.panoId).floorIndex;t.player.model.currentFloorId!=e&&t.player.$app.Scene.emit("Scene.gotoFloor",e)}};if(Ae.cancelById("leaveMonitor"),this.player.mode==xt.DOLLHOUSE){i();var o=this.player.cameraControls.activeControl;Ae.start(St.property(n.camera,"fov",this.fov,(function(e){n.camera.staticFov=e})),1e3),Ae.start(St.vector(o.target,this.target),1e3,null,0,ye[at.flydown.rotationEasing],null,at.freeze.LookRotationForPlay),Ae.start(St.vector(o.camera.position,e||this.position),1e3,(function(){t.player.mode==xt.DOLLHOUSE&&(t.showVideo(!0),t.tag.material.color.copy(iB),n.camera.near=.09)}),0,ye[at.flydown.movementEasing],null,at.freeze.LookRotationForPlay)}else n.camera.staticFov=n.camera.fov=this.fov,n.camera.updateProjectionMatrix(),this.player.flyToNewMode({mode:xt.DOLLHOUSE,position:e||this.position,target:this.target,callback:function(){i(),t.showVideo(!0),t.tag.material.color.copy(iB),n.camera.near=.09}});this.player.emit("beginShowMonitor")}},{key:"leave",value:function(){var e=this;this.player.compass.setDisplay(!0,!1),this.player.$app.config.view||this.player.compass.switch("direction"),this.showVideo(!1),this.isWatching=!1,this.tag.material.color.copy(nB);var t=this.player.cameraControls.controls.dollhouse;t.camera.near=1,t.minPolarAngle=25/180*Math.PI,t.maxPolarAngle=Math.PI/2,t.mode="model",Ae.cancelById("leaveMonitor"),Ae.cancelById(at.freeze.LookRotationForPlay);var n=this.player.baseFov*(1/this.player.zoomLevel);Ae.start(St.property(t.camera,"fov",n,(function(e){t.camera.staticFov=e})),1e3,(function(){t.camera.staticFov=null,t.camera.fov=n,t.camera.updateProjectionMatrix(),t.forbitSetRanges=!1,t.updateDistance(t.camera.aspect),e.player.emit("leavedShowMonitor")}),null,null,null,"leaveMonitor")}},{key:"updatePosition",value:function(e){this.position.set(e.x,e.y,e.z),this.updateTarget()}},{key:"updateRotation",value:function(e){this.rotation.set(e.x,e.y,e.z),this.updateTarget()}},{key:"updateTarget",value:function(e){e?(this.target.set(e.x,e.y,e.z),this.lookAt(this.target)):this.target.set(0,0,-1).applyQuaternion(this.quaternion).add(this.position)}},{key:"updateInfo",value:function(e){var t={sid:this.sid,name:this.name,panoId:this.panoId,posOri:{x:this.posOri.x,y:this.posOri.y,z:this.posOri.z},posOffset:{x:this.posOffset.x,y:this.posOffset.y,z:this.posOffset.z},fov:this.fov,aspect:this.aspect,far:this.cylinderFar,roll:Math.round(this.roll),pitch:Math.round(this.pitch),yaw:Math.round(this.yaw),video:this.videoSrc,videoType:this.videoType};return e&&(this.info=t),t}},{key:"dispose",value:function(){this.parent.remove(this),Ae.cancelById("cameraHighlight"+this.sid),this.tag.geometry.dispose(),this.tag.material.dispose(),this.cylinder.line.geometry.dispose(),this.cylinder.line.material.dispose(),this.cylinder.geometry.dispose(),this.normalMat.dispose(),this.videoMat.dispose(),this.player.off("setSize",this.events.setSize),this.titleLabel.dispose(),this.hlsVideoPlayer&&this.hlsVideoPlayer.destroy()}},{key:"highlight",value:function(e){this.hightlighted!=e&&(this.hightlighted=e,Ae.cancelById("cameraHighlight"+this.sid),Ae.start(St.color(this.tag.material.color,e?iB:nB),100,null,null,null,null,"cameraHighlight"+this.sid))}}]),n}(),rB=function(){function e(t){var n=this;o(this,e),this.onModeChange=function(e,t){if(null==e&&null==t){var i=n.player.modeTran.split("-");e=i[0],t=i[1]}e===xt.FLOORPLAN&&(n.isFloorplan=!1,n.isEdit||n.cameras.forEach((function(e){return De.updateVisible(e,"mode",!0)}))),t===xt.FLOORPLAN&&(n.isFloorplan=!0,n.isEdit||n.cameras.forEach((function(e){return De.updateVisible(e,"mode",!1)})))},this.app=t.$app,this.player=t,this.isEdit=!1,this.unbindDollhouse=!1,this.cameras=[],this.hoverCamera=null,this.watchingCamera=null,this.editingCamera=null,this.selectType=null,this.transformType=0,this.hideCylinder=!0,this.isFloorplan=t.mode===xt.FLOORPLAN,this.maxVisiAngle=Math.PI/6,this.maxVisiZoom=2,this.maxVisiDistance=1,this.bindEvents()}var t;return u(e,[{key:"currentCamera",get:function(){return this.isEdit?this.editingCamera:this.watchingCamera}},{key:"editingCamera",get:function(){return this._editingCamera},set:function(e){e!=this._editingCamera&&(this._editingCamera&&De.updateVisible(this._editingCamera,"edit",!1,2,"cancel"),e&&De.updateVisible(e,"edit",!0,2,"add"),this._editingCamera=e)}},{key:"addCamera",value:function(e){this.cameras.push(e)}},{key:"removeCamera",value:function(e){e.isWatching&&this.stopWatch(),this.cameras=this.cameras.filter((function(t){return t!=e})),e.dispose()}},{key:"watch",value:(t=k(S.mark((function e(t,n){return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if("transitioning"!=this.player.mode){e.next=2;break}return e.abrupt("return");case 2:if(!this.app.Camera.monitor.locked||!this.app.Camera.monitor.locked.then){e.next=5;break}return e.next=5,this.app.Camera.monitor.locked;case 5:this.watchingCamera?this.watchingCamera!=t&&this.stopWatch():this.lastViewState={mode:this.player.mode,floorIndex:this.player.model.allFloorsVisible?"all":this.player.model.currentFloorId,quaternion:this.player.quaternion.clone(),position:this.player.position.clone(),target:this.player.cameraControls.activeControl.target.clone(),currentScale:this.player.cameraControls.activeControl.currentScale},t.watch(n),this.watchingCamera=t,this.player.$app.Camera.emit("SecurityCamera.watch",{sid:t.sid,supportPlay:Hls.isSupported()||t.videoActive}),this.isEdit&&(this.unbindDollhouse=!!n,this.editingCamera=t,this.selectType="camera",this.player.$app.Camera.emit("SecurityCamera.select",this.currentCamera.updateInfo()));case 10:case"end":return e.stop()}}),e,this)}))),function(e,n){return t.apply(this,arguments)})},{key:"stopWatch",value:function(){this.watchingCamera&&(this.watchingCamera.isWatching&&this.watchingCamera.leave(),this.player.$app.Camera.emit("SecurityCamera.stopWatch",this.watchingCamera.sid),this.watchingCamera=null,this.isEdit&&(this.editingCamera=null,this.selectType=null,this.player.$app.Camera.emit("SecurityCamera.unselect")))}},{key:"hideAll",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"common",i=arguments.length>2?arguments[2]:void 0,o=arguments.length>3?arguments[3]:void 0;this.cameras.forEach((function(r){(null==e||t.player.model.panos.get(r.panoId)&&t.player.model.panos.get(r.panoId).floorIndex===e)&&De.updateVisible(r,n,!1,i,o)}))}},{key:"showAll",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"common",i=arguments.length>2?arguments[2]:void 0,o=arguments.length>3?arguments[3]:void 0;this.isFloorplan||this.cameras.forEach((function(r){(null==e||t.player.model.panos.get(r.panoId)&&t.player.model.panos.get(r.panoId).floorIndex===e)&&De.updateVisible(r,n,!0,i,o)}))}},{key:"bindEvents",value:function(){var e=this;this.player.on("pointerUp",this.onMouseUp.bind(this)),this.player.on("touchend",this.onMouseUp.bind(this)),this.player.on("pointerMove",this.onMouseMove.bind(this)),this.player.domElement.addEventListener("mousewheel",this.onMouseWheel.bind(this));var t=[];this.player.on("collectIntersectMesh",(function(n,i){t=e.cameras.filter((function(e){return e.tag&&e.obj3d.visible})).map((function(e){return e.tag})),n.push.apply(n,H(t))})),this.player.on("judgeIntersect",(function(n,i){i.getConsumed()||(n&&t.includes(n.object)?(e.hoverCamera=n.object.parent.camera,e.player.$app.Camera.emit("SecurityCamera.hover",e.hoverCamera.sid),e.hoverCamera.highlight(!0),Wr.add("hoverMonitor"),i.consume()):e.hoverCamera&&(e.hoverCamera.highlight(!1),e.hoverCamera=null,e.player.$app.Camera.emit("SecurityCamera.nothover"),Wr.remove("hoverMonitor")))})),this.player.on(aa,(function(){e.isEdit||e.stopWatch()})),this.player.on(ra,(function(t,n){e.isEdit||e.stopWatch(),e.onModeChange(t,n)}))}},{key:"onMouseUp",value:function(e){if(this.hoverCamera||this.onMouseMove(),this.hoverCamera&&!0===this.hoverCamera.visible){if(e.consume(),!this.hoverCamera.videoActive&&!this.hoverCamera.isNew&&1==this.app.config.view)return void this.player.$app.Camera.emit("SecurityCamera.cannotWatchVideo",this.hoverCamera.sid);this.watch(this.hoverCamera)}}},{key:"onMouseMove",value:function(){this.watchingCamera&&this.watchingCamera.isWatching&&this.isEdit&&this.player.mouseDown&&(this.unbindDollhouse=!0)}},{key:"onMouseWheel",value:function(){this.watchingCamera&&this.watchingCamera.isWatching&&this.isEdit&&(this.unbindDollhouse=!0)}}]),e}();function aB(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}var sB=function(e){f(n,THREE.Group);var t=aB(n);function n(e){var i;return o(this,n),(i=t.call(this)).player=e,i.renderOrder=qe,i.name="TagSpot3d",i.visible=!1,i.height=new THREE.Vector3(0,0,.12),e.model.add(h(i)),i.build(),i}return u(n,[{key:"build",value:function(){var e=new THREE.Mesh(new THREE.PlaneBufferGeometry(.15,.15,1,1),new THREE.MeshLambertMaterial({transparent:!0,depthTest:!1,map:De.loadTextureFromCache(si.getImageURL("images/tag_icon_default.svg"))}));e.renderOrder=Je,e.position.copy(this.height),this.topMesh=e,this.add(e);var t=yi.createLine([this.height,new THREE.Vector3(0,0,0)],{width:2,color:"#eee"});this.line=t,this.add(t);var n=new THREE.Mesh(new THREE.PlaneBufferGeometry(.35,.35,1,1),new THREE.MeshLambertMaterial({transparent:!0,depthTest:!1,map:De.loadTextureFromCache(si.getImageURL("images/tag_pointer.png"))}));this.bottomMesh=n,this.add(n)}},{key:"updateSize",value:function(){var e=ge.getScaleForConstantSize({width2d:500,position:this.position,camera:this.player.camera,dom:this.player.$app.dom});this.topMesh.scale.set(e,e,e)}}]),n}();function lB(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}var cB=function(){function e(t){var n,i,r=this;o(this,e),this.app=t,this.edit={},this.isSingleView=!1,this.locked=null,this.deferred=oe(),Hls.isSupported()||console.error("Hls is not Supported, 部分监控视频可能不支持"),this.app.Scene.on("loaded",(function(){var e=r.app.core.get("Player");r.control=new rB(e),!r.app.config.view&&r.app.config.mobile;var n=window.MediaSource&&Fe.detectAndroidMobile();r.videoPlayer=n?new uB(e):new hB(e);var i=function(e){r.control.hideCylinder=!r.app.store.getValue("metadata").controls.showSurveilScope,e.forEach((function(e){var i={sid:e.sid,name:e.name,panoId:e.panoId,video:2===e.urlType?t.resource.getUserResourceURL(e.fileName):e.playUrl,posOri:new THREE.Vector3(parseFloat(e.data["posOri-x"]),parseFloat(e.data["posOri-y"]),parseFloat(e.data["posOri-z"])),posOffset:new THREE.Vector3(parseFloat(e.data["posOffset-x"]),parseFloat(e.data["posOffset-y"]),parseFloat(e.data["posOffset-z"])),fov:parseInt(e.data.fov),far:parseFloat(e.data.far),yaw:parseInt(e.data.yaw),roll:parseInt(e.data.roll),pitch:parseInt(e.data.pitch),videoType:e.urlType};n&&2===e.urlType&&(i.video=i.video.replace(".mp4",".flv"));var o=new oB(r.control,i,r.videoPlayer);r.control.addCamera(o)})),r.app.store.getValue("metadata").controls.showCameraTitle||r.changeTitlesShow(!1),r.control.hideCylinder&&r.edit.hideCylinder(!0),r.control.onModeChange(),r.deferred&&r.deferred.resolve()},o=r.app.store.getValue("cameras");o?i(o):r.app.store.on("cameras",(function(e){return i(e)}));var a=r.app.store.getValue("metadata");if(a?r.isSingleView="laser"==a.sceneFrom:r.app.store.on("metadata",(function(e){return r.isSingleView="laser"==e.sceneFrom})),r.isSingleView){var s;r.spot3d=new sB(e),r.spot3d.visible=!1;var l=new THREE.Vector3;e.on("pointerStart",(function(t){r.isSingleView&&r.editingCamera&&s&&(r.updateTagPos=!0,e.cameraControls.activeControl.enabled=!1)})),e.on("pointerMove",(function(t){if(r.isSingleView&&(r.editingCamera||r.updateTagPos)&&((s=e.getMouseIntersect(null,[r.spot3d.topMesh,r.spot3d.bottomMesh]))?e.domElement.style.cursor="move":r.editingCamera&&!r.updateTagPos&&(e.domElement.style.cursor="default"),r.updateTagPos)){var n=e.getMouseIntersect(null,e.OverlayManager.group.children.concat(e.model.colliders));n?(r.spot3d.visible=!0,r.spot3d.position.copy(n.point),r.spot3d.lookAt(l.addVectors(n.point,n.normal)),r.spot3d.topMesh.lookAt(e.camera.position),r.spot3d.updateSize()):r.spot3d.visible=!1}})),e.on("pointerUp",(function(t){r.isSingleView&&r.spot3d&&r.spot3d.visible&&(e.cameraControls.activeControl.enabled=!0,e.cameraControls.activeControl.pointerDragOn=!1,r.updateTagPos=!1,r.editingCamera||(r.editingCamera={position:r.spot3d.position,sid:De.getRandomSid()}))}))}e.on("update",(function(){r.camPosChosing||r.control.isEdit||r.app.TagManager.tagPosChosing||r.app.TagManager.tagInfoEditing||r.app.TourManager.editing||r.app.ViewLinkEdit.markView||"360view"==e.currentPano.panoType||e.paintEditor&&e.paintEditor.painting||e.linkEditor&&e.linkEditor.setPanoVisible||e.linkEditor&&e.linkEditor.setTagVisible?r.control.cameras.forEach((function(e){De.updateVisible(e,"hideAtSomePage",!!e.isWatching)})):r.control.cameras.forEach((function(e){De.updateVisible(e,"hideAtSomePage",!0)}))}))})),this.edit.enterModule=function(){r.control?setTimeout((function(){r.control.cameras.forEach((function(e){e.videoActive&&r.app.Camera.emit("SecurityCamera.videoActive",e.sid)}))}),1):r.deferred.then((function(){return r.edit.enterModule()}))},this.edit.leaveModule=function(){r.control||(r.deferred=null)},this.edit.enter=function(e){if(r.editingCamera=e,r.camPosChosing=!0,r.isSingleView){r.app.TagManager.hideAll();var t=r.app.core.get("Player");t.reticule.visible=!1,e?t.flyToPano({pano:t.model.panos.get(e.panoId),lookAtPoint:e.position.clone(),aimDuration:500,checkAlone:!0},(function(){t.locked=!0,r.updateTagPos=!1,r.spot3d.position.set(e.position.x,e.position.y,e.position.z),r.spot3d.updateSize(),setTimeout((function(){var n=new THREE.Vector3(0,0,0),i=new THREE.Vector3(0,0,.5);ge.projectPositionToCanvas(e.position,t.camera,n,t.domElement),ge.convertScreenPositionToNDC(n.x,n.y,i,t.domElement);var o=t.getMouseIntersect(i,t.OverlayManager.group.children.concat(t.model.colliders));o&&(r.spot3d.lookAt(o.normal.add(r.spot3d.position)),r.spot3d.topMesh.lookAt(t.camera.position)),r.spot3d.visible=!0}),10)})):(r.edit.cancelWatching(),t.locked=!0,r.updateTagPos=!0,r.spot3d.position.set(0,1e3,0),r.spot3d.updateSize(),r.spot3d.visible=!0)}else r.app.core.get("Scene").getSplit("TAG").then((function(t){null==r.editHandle&&(r.editHandle=r.app.withNewComponent("TagEditManager",t,{spotA:r.app.dom.querySelector('.player[name="main"] .player-mark'),spotB:r.app.dom.querySelector('.player[name="copy"] .player-mark')})),e?r.editHandle.reSetPos(e.position):r.editHandle.enter()}));e&&De.updateVisible(e.titleLabel,"editPos",!1)},this.edit.modify=function(e){r.checkMonitorExist(e,(function(e){r.edit.enter(e)}))},this.edit.exit=function(){var e=r.app.core.get("Player");if(r.isSingleView)e.domElement.style.cursor="default",e.locked=!1,e.reticule.visible=!0,r.spot3d.visible=!1,r.updateTagPos=!1,r.app.TagManager.showAll();else{if(!r.editHandle)return;t.core.get("Scene").restore("TAG"),r.editHandle.exit({cancel:!0}),setTimeout((function(){e.cameraControls.activeControl.camera.fov=70,e.camera.fov=e.baseFov*(1/e.zoomLevel)}),50)}r.editingCamera&&r.editingCamera.titleLabel&&De.updateVisible(r.editingCamera.titleLabel,"editPos",!0),r.editingCamera=null,r.camPosChosing=!1},this.edit.confirm=function(e){var t=r.app.core.get("Player");if(r.isSingleView){if(!r.editingCamera)return;if(!r.spot3d.visible)return r.edit.exit(),null;var n=r.editingCamera.sid,i=r.spot3d.position;if("SecurityCamera"!=r.editingCamera.type){var o=t.currentPano.id,a=new oB(r.control,{sid:n,posOri:i,panoId:o,target:t.currentPano.position.clone()},r.videoPlayer);a.isNew=!0,r.control.addCamera(a),r.control.editingCamera=a}else r.editingCamera.updatePosition(i),r.editingCamera.posOri.copy(i),r.editingCamera.posOffset.set(0,0,0);return r.edit.exit(),r.edit.watch(n,!0,!0),n}if(!r.editHandle)return null;var s=r.editHandle.confirmPos(),l=s.position,c=s.sid;if(!l)return e||r.edit.exit(),null;if(r.editingCamera)c=r.editingCamera.sid,r.editingCamera.updatePosition(l),r.editingCamera.posOri.copy(l),r.editingCamera.posOffset.set(0,0,0),r.control.editingCamera=r.editingCamera;else{var u=t.currentPano.id,h=new oB(r.control,{sid:c,posOri:l,panoId:u,target:t.currentPano.position.clone()},r.videoPlayer);h.isNew=!0,r.control.addCamera(h),r.control.editingCamera=h}return r.edit.exit(),setTimeout((function(){r.edit.watch(c,!0,!0)}),100),c},this.edit.watch=(n=new THREE.Vector3,function(e,t,i){r.checkMonitorExist(e,(function(e){r.control.isEdit=!!t,t&&(r.app.core.get("Player").locked=!0,r.app.core.get("Player").cameraControls.activeControl.enabled=!0,De.updateVisible(e.cylinder,"enterEdit",!0,1,"add")),i?(n.set(-1.5,0,.2).applyQuaternion(e.quaternion).add(e.position),r.control.watch(e,n)):r.control.watch(e)})),(t||i)&&r.app.core.get("Player").modelSideManager.tempAuto()}),this.edit.save=function(){return r.control.currentCamera.isNew=!1,r.control.currentCamera.updateInfo(!0)},this.edit.cancel=function(){var e=r.app.core.get("Player");r.control.editingCamera&&(De.updateVisible(r.control.editingCamera.cylinder,"enterEdit",!1,1,"cancel"),e.modelSideManager.recover()),r.control.editingCamera||r.edit.cancelWatching(),r.control.isEdit=!1,r.control.editingCamera=null,r.control.selectType=null,e.locked=!1,r.control.watchingCamera&&r.control.watch(r.control.watchingCamera)},this.edit.cancelWatching=function(){var e=r.app.core.get("Player");if(r.control.watchingCamera){r.control.stopWatch();var t=r.control.lastViewState,n=t.mode,i=t.floorIndex,o=t.target,a=t.quaternion,s=t.position,l=t.currentScale;if(n==xt.DOLLHOUSE&&e.mode==xt.DOLLHOUSE){(e.model.allFloorsVisible?"all":e.model.currentFloorId)!=i&&e.$app.Scene.gotoFloor(i);var c=e.cameraControls.activeControl;Ae.start(St.vector(c.target,o),1e3,null,0,ye[at.flydown.rotationEasing],null,at.freeze.LookRotationForPlay),Ae.start(St.vector(c.camera.position,s),1e3,(function(){}),0,ye[at.flydown.movementEasing],null,at.freeze.LookRotationForPlay)}else n==xt.PANORAMA?e.flyToNewMode({mode:xt.PANORAMA,pano:e.currentPano,quaternion:a,callback:function(){}}):e.flyToNewMode({mode:n,quaternion:a,target:o,position:s,currentScale:l,floor:i,callback:function(){}})}},this.edit.delete=function(e){r.checkMonitorExist(e,(function(e){e.isWatching&&r.edit.cancelWatching(),r.control.removeCamera(e)}))},this.edit.hideCylinder=function(e){r.control.hideCylinder=e,r.control.cameras.forEach((function(t){De.updateVisible(t.cylinder,"force",!e)}))},this.edit.setName=function(e){r.control.currentCamera.name=e,r.control.currentCamera.titleLabel.setText(e)},this.edit.setPosition=function(e){if(r.control.currentCamera.updatePosition(e),!r.control.unbindDollhouse){var t=r.app.core.get("Player").cameraControls.controls.dollhouse;t.camera.position.copy(r.control.currentCamera.position),t.target.copy(r.control.currentCamera.target)}},this.edit.setSeparatePosition=(i=new THREE.Vector3,function(e,t){isNaN(parseFloat(t))||(r.control.currentCamera.posOffset[e]=parseFloat(t),i.copy(r.control.currentCamera.posOri).add(r.control.currentCamera.posOffset),r.edit.setPosition(i))}),this.edit.setFov=function(e){r.control.currentCamera.isWatching&&!r.control.unbindDollhouse&&(r.app.core.get("Player").cameraControls.cameras.dollhouse.fov=e),r.control.currentCamera.fov=e,r.control.currentCamera.updateProjectionMatrix(),r.control.currentCamera.updateMesh()},this.edit.setAspect=function(e){r.control.currentCamera.updateAspect(e)},this.edit.setOpacity=function(e){r.control.currentCamera.videoMat.opacity=e/100},this.edit.setRoll=function(e){r.control.currentCamera.setRoll(e)},this.edit.setYaw=function(e){(r.control.currentCamera.yaw=e,r.control.watchingCamera&&!r.control.unbindDollhouse)&&r.app.core.get("Player").cameraControls.controls.dollhouse.target.copy(r.control.currentCamera.target)},this.edit.setPitch=function(e){(r.control.currentCamera.pitch=e,r.control.watchingCamera&&!r.control.unbindDollhouse)&&r.app.core.get("Player").cameraControls.controls.dollhouse.target.copy(r.control.currentCamera.target)},this.edit.setVideoSrc=function(e,t){var n=r.control.currentCamera;n.videoActive=!1,n.showVideo(!1);var i=setTimeout((function(){t||(console.error("reload"),r.edit.setVideoSrc(e,!0))}),1e3),o=n.createVideo(e.src);if(o.onloadedmetadata=function(){clearTimeout(i),r.app.Camera.emit("SecurityCamera.videoActive",n.sid),n.videoActive=!0,n.showVideo(!0)},n.hlsVideoPlayer&&n.hlsVideoPlayer.destroy(),n.videoType=e.urlType,Hls.isSupported()&&1===n.videoType){var a=new Hls;a.loadSource(e.src),a.attachMedia(o),a.on(Hls.Events.ERROR,(function(e,t){return console.log("HLS加载失败",e,t)})),n.hlsVideoPlayer=a}else o.src=e.src;n.play(),n.videoMat.map=new THREE.VideoTexture(n.video)},this.edit.setCylinderFar=function(e){r.control.currentCamera.cylinderFar=e,r.control.currentCamera.cylinder.bottom.position.set(0,0,-e),r.control.currentCamera.updateMesh()},this.edit.undoTransform=function(){r.edit.setRoll(0),r.edit.setPitch(0),r.edit.setYaw(0),r.app.Camera.emit("SecurityCamera.select",r.control.currentCamera.updateInfo())},this.edit.undoScope=function(){r.edit.setCylinderFar(3),r.edit.setFov(70),r.app.Camera.emit("SecurityCamera.select",r.control.currentCamera.updateInfo())},this.edit.undoEdit=function(){var e=r.control.currentCamera;if(e.isNew)r.control.removeCamera(e);else{var t=e.info;t.far!=e.cylinderFar&&r.edit.setCylinderFar(t.far),e.posOri.x=t.posOri.x,e.posOri.y=t.posOri.y,e.posOri.z=t.posOri.z,r.edit.setSeparatePosition("x",t.posOffset.x),r.edit.setSeparatePosition("y",t.posOffset.y),r.edit.setSeparatePosition("z",t.posOffset.z),t.fov!=e.fov&&r.edit.setFov(t.fov),t.roll!=e.roll&&r.edit.setRoll(t.roll),t.pitch!=e.pitch&&r.edit.setPitch(t.pitch),t.yaw!=e.yaw&&r.edit.setYaw(t.yaw),t.video!=e.videoSrc&&r.edit.setVideoSrc({src:t.video,urlType:t.videoType}),r.app.Camera.emit("SecurityCamera.select",r.control.currentCamera.updateInfo())}}}return u(e,[{key:"showAll",value:function(e,t,n){var i=this;this.waitSecurityControls((function(){i.control.showAll(null,e,t,n)}),this.showAll.bind(this))}},{key:"hideAll",value:function(e,t,n){var i=this;this.waitSecurityControls((function(){i.control.hideAll(null,e,t,n)}),this.hideAll.bind(this))}},{key:"showRange",value:function(e){this.edit.hideCylinder(!e)}},{key:"changeTitlesShow",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"onShow";this.control.showTitles=!!e,this.control.cameras.forEach((function(n){De.updateVisible(n.titleLabel,t,!!e)}))}},{key:"waitSecurityControls",value:function(e,t){this.control?e&&e():this.deferred.then((function(){return t()}))}},{key:"checkMonitorExist",value:function(e,t){var n=this.control.cameras.find((function(t){return t.sid==e}));n?t(n):console.error("监控sid不存在!")}},{key:"watch",value:function(e){var t=this.app.store.getValue("cameras");null!=t&&t.length&&(null!=t.find((function(t){return t.sid==e}))&&this.edit.watch(e))}},{key:"lock",value:function(){this.locked=oe()}},{key:"unlock",value:function(){this.locked&&this.locked.resolve&&this.locked.resolve(),this.locked=null}},{key:"highlight",value:function(e){var t=this.control.cameras.find((function(t){return t.sid==e}));this.control.cameras.forEach((function(e){return e.highlight(!1)})),t&&t.highlight(!0)}}]),e}(),uB=function(e){f(n,e);var t=lB(n);function n(e){return o(this,n),t.call(this,e)}return u(n,[{key:"_getVideoPath",value:function(e){return e}}]),n}(Cs),hB=function(e){f(n,e);var t=lB(n);function n(e){return o(this,n),t.call(this,e)}return u(n,[{key:"_getVideoPath",value:function(e){return e}}]),n}(Bs);function dB(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}var pB=function(e){f(n,e);var t=dB(n);function n(e){var i;return o(this,n),(i=t.call(this)).app=e,i.state={scale:1.78,range:{min:.7,max:3,current:0},defaults:{zoomMax:0,zoomMin:0,zoomEnabled:0,zoomToDefaultWhenToPano:0},options:{padding:{},beforeExport:null,afterExport:null}},i.player=null,i.__is_enter=!1,i.__on_zoom=function(e){return i.emit("zoom",e)},i.__on_size=function(){var e=i.player.domElement,t=i.state.options.padding.top||0,n=i.state.options.padding.bottom||0,o=(i.state.options.padding.left||0)+(i.state.options.padding.right||0),r=t+n,a=window.innerWidth-o,s=window.innerHeight-r;if(a/s<i.state.scale){var l=a/i.state.scale;e.style.height="".concat(l,"px"),e.style.top=(s-l)/2+r+"px"}else e.style.top="".concat(r,"px"),e.style.height="calc(100% - ".concat(r,"px)")},i.__on_update=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.hasChanged,n=void 0!==t&&t,o=arguments.length>1?arguments[1]:void 0;if(i.__is_enter&&(i.player.lastFrameChanged||o)){var r=i.player.cameraControls.activeControl;if("dollhouse"==i.player.mode){var a=r.camera.position.distanceTo(r.target),s=ge.linearClamp(a,r.minDistance,Math.max(r.maxDistance/2,r.minDistance+3),i.state.range.max,i.state.range.min);i.emit("zoom",s)}else if("floorplan"==i.player.mode&&n.cameraProjectionChanged){var l=r.getDefaultAbsoluteScale(i.player.model.size),c=Math.max(at.zoomNearLimit,.5*l),u=Math.min(at.zoomFarLimit,2.5*l),h=ge.linearClamp(r.absoluteScale,c,u,i.state.range.max,i.state.range.min);i.emit("zoom",h)}}},i}return u(n,[{key:"options",value:function(e){return this.state.options=Object.assign(this.state.options,e||{}),this}},{key:"enter",value:function(){if(!this.__is_enter)return null===this.player&&(this.player=this.app.core.get("Player")),this.__is_enter=!0,this.__on_size(),this.state.defaults.zoomMax=at.zoom.max,this.state.defaults.zoomMin=at.zoom.min,this.state.defaults.zoomEnabled=at.zoom.enabled,this.state.defaults.zoomToDefaultWhenToPano=at.zoom.zoomToDefaultWhenToPano,at.zoom.max=this.state.range.max,at.zoom.min=this.state.range.min,at.zoom.enabled=!0,at.zoom.zoomToDefaultWhenToPano=!1,at.highestQualityTile=!0,this.player.on("zoomTo",this.__on_zoom),this.player.on("setSize",this.__on_size),this.player.on("update",this.__on_update),this.__on_zoom(this.player.zoomLevel),this.__on_update(0,!0),this}},{key:"leave",value:function(){if(!1!==this.__is_enter)return this.__is_enter=!1,this.player.zoomTo(1),at.zoom.max=this.state.defaults.zoomMax,at.zoom.min=this.state.defaults.zoomMin,at.zoom.enabled=this.state.defaults.zoomEnabled,at.zoom.zoomToDefaultWhenToPano=this.state.defaults.zoomToDefaultWhenToPano,at.highestQualityTile=!1,this.player.off("zoomTo",this.__on_zoom),this.player.off("setSize",this.__on_size),this.player.off("update",this.__on_update),this.player.domElement.style.top=0,this.player.domElement.style.height="100%",this}},{key:"reset",value:function(e){var t=this;if(!this.__is_enter)return this;if("camera"===e)"panorama"==this.player.mode&&(this.player.cameraControls.activeControl.lat=0);else if("scale"==e){var n=this.player.cameraControls.activeControl;if("transitioning"==this.player.mode)return player.once("mode.changed",(function(n,i){t.__is_enter&&t.reset(e)}));"panorama"==this.player.mode?this.player.zoomTo(1):"dollhouse"==this.player.mode?n.target.copy(this.player.model.center):"floorplan"==this.player.mode&&(n.target.setX(this.player.model.center.x),n.target.setZ(this.player.model.center.z),n.camera.position.setX(this.player.model.center.x),n.camera.position.setZ(this.player.model.center.z),n.rotateToView(this.player.model.size,this.player.getDirection()),n.zoomToContain(this.player.model.size))}return this}},{key:"scale",value:function(e){if(!this.__is_enter)return this;(e=e>1?parseInt(e)/100:e)<this.state.range.min?e=this.state.range.min:e>this.state.range.max&&(e=this.state.range.max),this.state.range.current=e;var t=this.player.cameraControls.activeControl,n=e;if("panorama"==this.player.mode)at.zoom.enabled=!0,this.player.zoomTo(n);else if("dollhouse"==this.player.mode){var i=ge.linearClamp(n,this.state.range.min,this.state.range.max,Math.max(t.maxDistance/2,t.minDistance+3),t.minDistance);t.camera.position.copy(t.target).add(this.player.getDirection().multiplyScalar(-i))}else if("floorplan"==this.player.mode){var o=t.getDefaultAbsoluteScale(this.player.model.size),r=Math.max(at.zoomNearLimit,.5*o),a=Math.min(at.zoomFarLimit,2.5*o);t.absoluteScale=ge.linearClamp(n,this.state.range.min,this.state.range.max,a,r)}return this}},{key:"ready",value:function(){var e=this,t=oe();if(0==this.__is_enter)t.reject("please call enter before");else if("panorama"==this.player.mode)var n=setInterval((function(){if(e.player.currentPano&&!e.player.flying){clearInterval(n),"function"==typeof e.state.options.beforeExport&&e.state.options.beforeExport();var i=e.getTileSize(),o=new THREE.Vector3(0,0,-1).applyQuaternion(e.player.quaternion),r=e.player.cameraControls.activeControl.camera,a=r.fov,s=Aa.getHFOVForCamera(r,r.aspect,1);e.player.currentPano.loadTiledPano(i,o,{hFov:s,vFov:a},!1,!1,!0).done((function(){return t.resolve()})).fail((function(){return t.resolve()}))}}),200);else t.resolve();return t}},{key:"export",value:function(e){var t=this;return"function"!=typeof e||this.ready().done(k(S.mark((function n(){var i,o,r,a;return S.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return i=t.getViewSize(),o=i.width,r=i.height,n.next=3,t.app.Camera.screenshot([{width:o,height:r,name:"capture"}]);case 3:(a=n.sent).length?e(a[0]):e(null),"function"==typeof t.state.options.afterExport&&t.state.options.afterExport();case 6:case"end":return n.stop()}}),n)})))).fail((function(){e(null),"function"==typeof t.state.options.afterExport&&t.state.options.afterExport()})),this}},{key:"exportFile",value:function(e){return this.export((function(t){var n=window.URL.createObjectURL(t.data),i=document.createElement("a");i.href=n,i.download=e,i.click()})),this}},{key:"getMaxHeight",value:function(){return"2k"==this.app.core.get("QualityManager").tileClass?4096:"4k"==this.app.core.get("QualityManager").tileClass?8192:1024}},{key:"getTileSize",value:function(){return"2k"==this.app.core.get("QualityManager").tileClass?2048:"4k"==this.app.core.get("QualityManager").tileClass?4096:512}},{key:"getViewSize",value:function(){if("panorama"!=this.player.mode)return{width:1780,height:1e3};var e=this.getMaxHeight(),t=this.player.cameraControls.activeControl.camera.fov/180*e,n=t*this.state.scale;return{width:Math.round(n),height:Math.round(t)}}}]),n}(yo);function fB(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}var mB=function(e){f(n,e);var t=fB(n);function n(e){var i;return o(this,n),(i=t.call(this)).adjustControlAngel=function(e,t){var n=this.app.core.get("Player");if("panorama"==n.mode){var i=new THREE.Vector3(0,0,-1).applyQuaternion(t||n.quaternion).add(n.position);this.cameraControls.activeControl.lookAt(i)}else{if(!e)return;this.cameraControls.activeControl&&n.cameraControls.activeControl.target.copy(e)}},i.app=e,i.app.Scene.on("loaded",(function(){var e=i.app.core.get("Player");e.on(aa,(function(e){i.emit(aa,e)})),e.on(ca,(function(e){i.emit(ca,e)})),e.on(ua,(function(e){i.emit(ua,e)})),e.on(ea,(function(e){i.emit(ea,e)})),e.on(na,(function(e){i.emit(na,e)})),e.on(ta,(function(e){i.emit(ta,e)})),e.on(ia,(function(e){i.emit(ia,e)})),e.on(ra,(function(e,t){return i.emit(ra,{fromMode:e,toMode:t})}));var t=i.app.core.get("Player").model;t.on("floor.changed",(function(e,n,o){i.emit("floor.changed",{toMode:n,floorIndex:e.floorIndex,allVisible:t.allFloorsVisible})}))})),i.monitor=new cB(e),i.extract=new pB(e),i}return u(n,[{key:"mode",get:function(){return this.app.core.get("Player").mode}},{key:"locked",get:function(){return this.app.core.get("Player").locked}},{key:"isCurrentPanoHasVideo",get:function(){return this.app.core.get("Player").currentPano.hasVideo}},{key:"panorama",value:function(){return this.app.Scene.ready?this.app.core.get("Player").insideMode():Promise.resolve()}},{key:"floorplan",value:function(){var e=oe();return this.app.core.get("Player").flyToNewMode({mode:xt.FLOORPLAN},e),e}},{key:"dollhouse",value:function(){var e=oe();return this.app.core.get("Player").flyToNewMode({mode:xt.DOLLHOUSE},e)}},{key:"vr",value:function(){var e=this.app.core.get("Player");return e.vrEnabled=!e.vrEnabled,e.flyToMode("panorama",(function(){return e.vrModeChange()}))}},{key:"zoom",value:function(e){this.app.core.get("Player").zoomTo(e)}},{key:"rotate",value:function(e){var t=this,n=this.app.core.get("Player");if(function(e,t){return e.mode==t.mode&&e.mode==xt.PANORAMA&&e.currentPanoId==t.currentPano.id}(e,n)){n.cameraControls.activeControl.locked=!0,n.cameraControls.activeControl.camera.quaternion.set(e.quaternion._x,e.quaternion._y,e.quaternion._z,e.quaternion._w);var i=new THREE.Vector3(0,0,-1).applyQuaternion(n.cameraControls.activeControl.camera.quaternion).add(n.cameraControls.activeControl.camera.position);n.cameraControls.activeControl.lookAt(i),e.rotationSpeed&&setTimeout((function(){t.rotateEnd(e)}),100)}}},{key:"rotateEnd",value:function(e){var t=this.app.core.get("Player");t.cameraControls.activeControl.locked=!1,e.rotationSpeed&&(t.cameraControls.activeControl.rotationSpeed=new THREE.Vector2(e.rotationSpeed.x,e.rotationSpeed.y))}},{key:"getPose",value:function(){var e=this.app.core.get("Player");return JSON.parse(JSON.stringify({mode:e.mode,position:e.position,quaternion:e.quaternion,zoomLevel:e.zoomLevel,panoId:e.currentPano&&e.currentPano.id,currentScale:e.cameraControls.controls.floorplan.currentScale,modeTran:e.modeTran,flying:e.flying,nextPano:null}))}},{key:"getPoseUrlParams",value:function(){return function(e){return"pose=pano:".concat(e.metadata.scan_id,",qua:").concat(ge.toPrecision(e.metadata.camera_quaternion.toArray(),4))}(this.app.core.get("Player").getSnapAngleInfo())}},{key:"setPose",value:function(e){var t=this.app.core.get("Player");if(!t.flying&&!e.flying){e.position&&e.position instanceof THREE.Vector3==!1&&(e.position=new THREE.Vector3(e.position.x,e.position.y,e.position.z)),e.quaternion&&e.quaternion instanceof THREE.Quaternion==!1&&(e.quaternion.hasOwnProperty("_x")?e.quaternion=new THREE.Quaternion(e.quaternion._x,e.quaternion._y,e.quaternion._z,e.quaternion._w):e.quaternion=new THREE.Quaternion(e.quaternion.x,e.quaternion.y,e.quaternion.z,e.quaternion.w));var n=t.model.panos.index[e.panoId],i={mode:e.mode,pano:n,quaternion:e.quaternion,zoomLevel:e.zoomLevel,position:e.position,currentScale:e.currentScale,duration:e.duration,aimDuration:e.duration};if(t.mode!=e.mode)t.flyToNewMode(i);else if("panorama"==e.mode)n&&t.flyToPano(i);else{var o=t.cameraControls.controls[e.mode],r=o.camera;e.target&&o.target.copy(e.target),e.position&&r.position.copy(e.position),o.offset.copy(r.position).sub(o.target),"floorplan"==e.mode&&(e.zoom&&(e.currentScale=ht.convertWorkshopOrthoZoom(e.zoom)),e.currentScale&&(o.currentScale=o.absoluteScale=e.currentScale,o.updateZoom()))}}}},{key:"flyToMode",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};n.mode=t,this.mode==t?e&&e():("panorama"!=t||n.pano||(n.pano=this.currentPano),"transitioning"==this.mode&&this.modeTran.split("-")[1]!=t?this.afterCModeFuc.unique=function(){this.afterCModeFuc.unique=e,this.flyToNewMode(n)}.bind(this):(this.afterCModeFuc.unique=e,this.flyToNewMode(n)))}},{key:"flyToPano",value:function(e,t,n){var i=oe(),o=this.app.core.get("Player").model.panos.index[e];return o?this.app.core.get("Player").flyToPano({mode:"panorama",pano:o,lookAtPoint:t,duration:n,aimDuration:n,callback:function(){return i.resolve()}}):i.resolve(),i}},{key:"flyToTag",value:function(e,t){objects.tagManager.activeTag&&objects.tagManager.activeTag!=e&&this.tagManager.dismissActiveTag(),objects.tagManager.navigatingViaTag=!0,objects.tagManager.activateTag(e,"examine"),e.updateBoardOrient=!0,e.examine(this,t,function(){this.following&&(this.play.control.noFly=!0)}.bind(this))}},{key:"flyToPoint",value:function(e,t){var n;t.dealDistance&&this.app.core.get("Player").position.distanceTo(e)<t.dealDistance&&(n=this.app.core.get("Player").currentPano),n||(n=this.app.core.get("Player").model.panos.closestPanoTowardPoint({point:e,require:t&&t.require,rank:t&&t.rank})||this.currentPano||this.app.core.get("Player").currentPano),this.app.core.get("Player").flyToPano({pano:n,lookAtPoint:e,duration:t&&t.dur,aimDuration:t&&t.aimDur},t&&t.done)}},{key:"setCompassDisplay",value:function(e,t){this.app.core.get("Player").compass.setDisplay(e,t)}},{key:"getScreenshotInfo",value:function(){var e=function(e){return{camera:{quaternion:ge.toPrecision(e.metadata.camera_quaternion.toArray(),4),zoom:e.metadata.ortho_zoom||-1},mode:e.metadata.camera_mode||0,pano:e.metadata.scan_id||"",lon:e.metadata.lon,lat:e.metadata.lat}}(this.app.core.get("Player").getSnapAngleInfo());return this.app.core.get("Scene").firstView.updateByEntry(e,this.app.core.get("Player").model.panos),e}},{key:"lock",value:function(){this.app.core.get("Player").locked=!0}},{key:"unlock",value:function(){this.app.core.get("Player").locked=!1}},{key:"autoRotate",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.1,n=this.app.core.get("Player").cameraControls.activeControl,i=this.app.core.get("Player").mode;e?("dollhouse"==i&&(n.autoRotateSpeed=10*t,n.autoRotate=!0),"panorama"==i&&n.startRotating(t,0)):("dollhouse"==i&&(n.autoRotate=!1),"panorama"==i&&n.stopRotating(!0))}},{key:"screenshot",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return t.length||(t=[{width:2048,height:1024,name:"2k"},{width:1024,height:512,name:"1k"},{width:128,height:128,name:"128"}]),new Promise((function(o){var r=t.length,a=[],s=e.app.core.get("Player"),l=setInterval((function(){s.path&&s.path.currentPanoMarker&&(clearInterval(l),e.app.core.get("Screenshot").capture(Object.assign({tasks:{unFish:t},snapshotTopview:!0,notHideTags:!0,done:function(e,t,i){n?a.push({data:jk(e),name:t,type:"blob"}):a.push({data:e,name:t,type:"base64"}),a.length==r&&(a.name=t,a.o=i,o(a))}},i)))}),50)}))}},{key:"screenshot2",value:function(){var e=this.app.core.get("SceneRenderer"),t=document.createElement("a"),n=e.renderer.domElement;e.render(),t.href=n.toDataURL().replace("image/png","image/octet-stream"),t.download="screenshot2.png",t.click()}},{key:"setFastTransition",value:function(e){this.app.core.get("Player").setPanoTaskEnable(e)}},{key:"checkXRSupport",value:function(){return ku.isSupportXR()}},{key:"setModelSide",value:function(e){0===e?wl.setSide(null):1===e?wl.setSide(2):wl.setSide(e),this.app.core.get("Player").model.setMode("dollhouse")}}]),n}(yo);function vB(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}mB.MODE=xt;var gB=function(e){f(n,e);var t=vB(n);function n(e){var i,r;return o(this,n),(i=t.call(this)).app=e.app,i.edit={},i.deferred=oe(),e.on("loaded",(function(){(r=i.app.core.get("Player")).GLTFEditor=new Nl(r);var e=function(e){e.boxModels&&e.boxModels.forEach((function(e){r.GLTFEditor.add(e)}))},t=i.app.store.getValue("metadata");t?e(t):i.app.store.on("metadata",e),i.deferred.resolve()})),i.edit.enterModule=function(){i.waitGLTFEditor((function(){r.GLTFEditor.editing=!0}),i.edit.enterModule.bind(h(i)))},i.edit.leaveModule=function(){r.GLTFEditor.editing=!1},i.edit.addGLTF=function(){r.GLTFEditor.add(),r.modelSideManager.tempAuto(),r.mode===xt.FLOORPLAN&&r.model.floorplanCadImg.hideCadPlane()},i.edit.deleteGLTF=function(e){var t=r.GLTFEditor.group.children.find((function(t){return t.sid===e}));r.GLTFEditor.delete(t)},i.edit.focusGLTF=function(e,t){var n=r.GLTFEditor.group.children.find((function(t){return t.sid===e}));t&&(r.modelSideManager.tempAuto(),r.GLTFEditor.select(n),r.mode===xt.FLOORPLAN&&r.model.floorplanCadImg.hideCadPlane()),r.flyToPano({pano:r.model.panos.get(n.panoId),lookAtPoint:n.position,checkAlone:!0})},i.edit.confirmGLTFEdit=function(){return r.GLTFEditor.save((function(){r.modelSideManager.recover(),r.mode===xt.FLOORPLAN&&r.model.floorplanCadImg.showCadPlane()}))},i.edit.cancelGLTFEdit=function(){r.GLTFEditor.unselect(),r.GLTFEditor.group.children.forEach((function(e){e.isNew?r.GLTFEditor.delete(e):e.setFromInfo(e.info)})),r.modelSideManager.recover(),r.mode===xt.FLOORPLAN&&r.model.floorplanCadImg.showCadPlane()},i.edit.resetGLTFTranform=function(){r.GLTFEditor.selecting.rotation.set(0,0,0),r.GLTFEditor.selecting.scale.set(1,1,1),i.emit("Decoration.GLTF.select",r.GLTFEditor.selecting.updateInfo())},i.edit.setGLTFUrl=function(e){r.GLTFEditor.selecting.zipName=e.zipName,r.GLTFEditor.selecting.load(e.url,!0)},i.edit.setGLTFPosition=function(e,t){r.GLTFEditor.selecting.position[e]=t},i.edit.setGLTFScale=function(e,t){r.GLTFEditor.selecting.scale[e]=t},i.edit.setGLTFRotation=function(e,t){r.GLTFEditor.selecting.rotation[e]=THREE.MathUtils.degToRad(t)},i.edit.setGLTFVisible=function(e){r.GLTFEditor.selecting.visible=!!e,e?r.model.transformControls.attach(r.GLTFEditor.selecting):r.model.transformControls.detach()},i.edit.switchTransformControlsMode=function(e){0==parseInt(e)&&(e="translate"),1==parseInt(e)&&(e="rotate"),2==parseInt(e)&&(e="scale"),r.model.transformControls.mode=e},i}return u(n,[{key:"showAll",value:function(){var e=this;this.waitGLTFEditor((function(){e.app.core.get("Player").GLTFEditor.group.visible=!0}),this.showAll.bind(this))}},{key:"hideAll",value:function(){var e=this;this.waitGLTFEditor((function(){e.app.core.get("Player").GLTFEditor.group.visible=!1}),this.hideAll.bind(this))}},{key:"waitGLTFEditor",value:function(e,t){var n=this.app.core.get("Player");n&&n.GLTFEditor?e&&e():this.deferred.then((function(){return t()}))}}]),n}(yo);function yB(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}var AB,EB,bB,wB,xB,CB,TB,IB,kB,BB=window,PB=new THREE.Box3,RB=new THREE.Raycaster,MB=new THREE.Plane,SB=[],DB=!0,LB={yellow:new THREE.Color(238/255,217/255,35/255),green:new THREE.Color(39/255,160/255,146/255),labelYellow:{r:238,g:217,b:35,a:.5},labelGreen:{r:39,g:160,b:146,a:.5}},FB={cabinet:{widthNormal:{min:.55,max:1.05},height:{min:.3,max:2.5,standard:2},closeRatio:.7},fire:{widthNormal:{min:.12,max:.16},height:{min:.4,max:.58},widthSame:!0,closeRatio:4,tinyXZ:!0},air:{widthNormal:{min:.35,max:.7},width:{min:.48,max:.75},thick:{min:.33,max:.5},height:{min:1.2,max:2.2,standard:1.8},atWall:.8,closeRatio:1.1},airSmart:{widthNormal:{min:.35,max:.7},width:{min:.48,max:.75},thick:{min:.33,max:.5},height:{min:1.2,max:2.2,standard:1.8},atWall:.8,closeRatio:1.1},"air-hanging":{widthNormal:{min:.3,max:1},width:{min:.8,max:1.1},thick:{min:.2,max:.3},height:{min:.3,max:.5,standard:.4},bottom:{min:.8,max:2},atWall:1,closeRatio:1.5},battery:{widthNormal:{min:.45,max:1.35},width:{min:.7,max:1.4},thick:{min:.35,max:.5},height:{min:.3,max:2.5},atWall:.9,closeRatio:.9},groundBar:{widthNormal:{min:.06,max:.4},width:{min:.3,max:.5},thick:{min:.05,max:.08},height:{min:.1,max:.2},bottom:{min:1.2,max:3},atWall:1,closeRatio:2},hlkcWindow:{widthNormal:{min:.08,max:.5},width:{min:.35,max:.5},thick:{min:.03,max:.06},height:{min:.35,max:.5},bottom:{min:1.2,max:3},atWall:1,closeRatio:2},electric:{widthNormal:{min:.2,max:.7},width:{min:.5,max:.65},thick:{min:.2,max:.3},height:{min:.5,max:1},bottom:{min:.8,max:1.8},atWall:1,closeRatio:2},monitor:{widthNormal:{min:.08,max:.11},height:{min:.1,max:.2,standard:.15},bottom:{min:1.2,max:3},atWall:1,closeRatio:4,tiny:!0},rowBigBox:{widthNormal:{min:.55,max:1/0},height:{min:.7,max:2.4,standard:2}}},HB={fire:"extinguisher",monitor:"surveillance_camera",hlkcWindow:"hlkc",groundBar:"grounding_bar",cabinet:"equipment_cabinet",battery:"accumulator",electric:["ac_switchboard","dc_distribution"],air:"sdkt",airSmart:"ventilation_installation"},VB=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=n.bgcolor,o=n.a;new THREE.Vector3(0,-.2,0),i=i?new THREE.Color(i):{r:1,g:1,b:1},t instanceof Array||(t=[t]);for(var r=Math.round(6*Math.random())+1,a=[];r-- >0;)a.push("|");t=[].concat(H(t),a,["o"]);var s=new Ce({text:t,textColor:{r:0,g:0,b:0,a:1},backgroundColor:{r:255*i.r,g:255*i.g,b:250*i.b,a:o||0},textBorderColor:{r:255*i.r,g:255*i.g,b:250*i.b,a:o||.9},textBorderThick:2,margin:{x:0,y:0},borderRadius:0,player:AB,sizeInfo:{minSize:90,maxSize:300,nearBound:1,farBound:7}});return s.position.copy(e),bB.add(s),s.sprite.position.y+=.4*s.sprite.scale.y,s},OB=function(e){var t=$B(e);return FB[e.boxType].bottom?t:t.clone().setY(wB+e.size.y/2)},QB=new THREE.BoxBufferGeometry,_B=new THREE.MeshBasicMaterial({color:LB.yellow,opacity:.3,transparent:!0,depthTest:!1}),zB=[new THREE.Vector3(-1,1,-1),new THREE.Vector3(1,1,-1),new THREE.Vector3(1,1,1),new THREE.Vector3(-1,1,1),new THREE.Vector3(-1,-1,-1),new THREE.Vector3(1,-1,-1),new THREE.Vector3(1,-1,1),new THREE.Vector3(-1,-1,1)],UB=function e(t,n){n(t),t.list&&t.list.forEach((function(t){return e(t,n)})),t.mixedFrom&&t.mixedFrom.forEach((function(t){return e(t,n)}))},NB=function(){function e(t){o(this,e),this.setFromInfo(t),this.buildFromData||(this.name=this.boxType+"-"+this.name),(this.buildFromData||CB)&&this.draw(),SB.push(this)}return u(e,[{key:"setFromInfo",value:function(e){for(var t in e)this[t]=e[t];this.position=this.buildFromData?this.center:OB(this);var n=(new THREE.Box3).setFromCenterAndSize(this.position,this.size);this.bound=n}},{key:"draw",value:function(){var e=LB.yellow;this.boxHelper=new THREE.Box3Helper(this.bound,e),this.boxHelper.material.depthTest=!1,this.boxHelper.material.transparent=!0,this.boxHelper.renderOrder=30,this.label=new Ce({text:this.external?[this.external.eqpName||"",this.external.eqpType||""]:this.name,backgroundColor:Object.assign(LB.labelYellow),textColor:{r:255,g:255,b:255,a:1},borderRadius:15,renderOrder:10,fontSize:20,player:AB}),bB.add(this.label),this.label.position.copy(this.position),this.label.position.y+=.3;this.label.scale.set(.2,.2,.2);var t=new THREE.Mesh(QB,_B);t.position.copy(this.position),t.scale.copy(this.size),t.masterBox=this,t.name=this.name,t.renderOrder=20,bB.add(t),this.boxMesh=t,bB.add(this.boxHelper),kB&&this.updateVisible(!1,"unhover")}},{key:"updateVisible",value:function(e,t){De.updateVisible(this.boxHelper,t,e),De.updateVisible(this.label,t,e),De.updateVisible(this.boxMesh,t,e)}},{key:"dispose",value:function(){var e=SB.indexOf(this);e>-1&&(SB.splice(e,1),CB&&(this.label.sprite.material.opacity=.3,this.boxHelper.material.opacity=.2,this.boxMesh.removeFromParent()))}},{key:"traversePair",value:function(e){UB(this,e)}},{key:"getDirection",value:function(){var e,t=this.xProp;if("cabinet"==this.boxType&&this.name.includes("row"))if(this.infos.rowboxs.length>1){t=this.infos.reduce((function(e,t){return e+t.k}),0)>1?"width":"thick"}else{var n=SB.filter((function(e){return"cabinet"==e.boxType&&e.name.includes("row")&&e.dirQua}));n.sort((function(e,t){return t.infos.rowboxs.length-e.infos.rowboxs.length}));var i=n[0];if(i)return this.dirQua=i.dirQua}if(!t){var o=iP(this,!0);o.xWidthPossible,o.yWidthPossible,t=this.xProp}return t&&(this.panosDir||nP(this),e="width"==t?Math.abs(this.panosDir["z+"])<Math.abs(this.panosDir["z-"])?new THREE.Vector3(0,1,0):new THREE.Vector3(0,-1,0):Math.abs(this.panosDir["x+"])<Math.abs(this.panosDir["x-"])?new THREE.Vector3(-1,0,0):new THREE.Vector3(1,0,0)),this.dirQua=pt.getQuaByAim(e,new THREE.Vector3,new THREE.Vector3(0,1,0)),this.dirQua}},{key:"toJson",value:function(){var e=this,t=HB[this.boxType];if(t instanceof Array){var n=new Map;(t=t.slice(0)).forEach((function(e){return n.set(e,0)}));var i=function(e){if(e){var t=n.get(e.category)+e.score;n.set(e.category,t)}};this.traversePair((function(e){i(e.box0),i(e.box1)})),t=(t=t.sort((function(e,t){return n.get(t)-n.get(e)})))[0]}return this.getDirection(),{points:zB.map((function(t){return ge.toPrecision(convert.invertVisionVector((new THREE.Vector3).addVectors(e.position,e.size.clone().multiply(t).multiplyScalar(.5))).toArray(),4)})),category:t,type:this.boxType,sid:this.name,quaternion:this.dirQua.toArray()}}}]),e}(),GB=function(e,t){var n=-e.x*(2*Math.PI),i=Math.PI/2-e.y*Math.PI,o=new THREE.Vector3;return o.copy(to.RIGHT).applyAxisAngle(to.BACK,i).applyAxisAngle(to.UP,n).applyQuaternion(t.quaternion),o},jB=function(e){if(!e.centerDir){var t=e.bbox2,n={x:YB(t[0],t[2]),y:(t[1]+t[3])/2};e.bbox2CenterX=n.x;var i=GB(n,e.pano);e.centerDir=i;var o={x:n.x,y:t[1]};e.centerTopDir=GB(o,e.pano);var r={x:n.x,y:t[3]};e.centerBtmDir=GB(r,e.pano);var a={x:t[0],y:t[3]};e.leftBtmDir=GB(a,e.pano);var s={x:t[2],y:t[3]};e.rightBtmDir=GB(s,e.pano)}},WB=function(e,t,n){e.bbox2||(t||(t=BB.boxFrame.datas[e.pano.id].imageWidth,n=BB.boxFrame.datas[e.pano.id].imageHeight),t==t&&n==n||console.log(t,n),e.bbox2=e.bbox.map((function(e,i){return i%2==0?e/t:e/n})))},qB=function(e,t,n){tP(e),WB(e,t,n),jB(e),function(e){if(e.boxType){var t=FB[e.boxType];if(CB){if(!e.posAtWall&&t.atWall>0){var n=t.thick?t.thick.min:t.widthNormal.min;RB.set(e.pano.position,e.centerDir);var i=RB.intersectObjects([EB]);i[0]&&(e.posAtWall=(new THREE.Vector3).addVectors(e.pano.position,e.centerDir.clone().multiplyScalar(i[0].distance-n)))}e.btmPos||XB(e),e.topPos||ZB(e)}else if(!t.bottom&&(RB.set(e.pano.position,e.centerBtmDir),e.btmPosPredict=RB.ray.intersectPlane(MB,new THREE.Vector3),e.btmPosPredict)){var o=new THREE.Vector2(e.centerBtmDir.x,e.centerBtmDir.z).normalize(),r=FB[e.boxType].widthNormal,a=r.min,s=r.max;a*=.4,s*=.4;var l=Math.min(Math.abs(o.x),Math.abs(o.y)),c=ge.linearClamp(l,0,1,a,s);o=o.clone().multiplyScalar(c),e.btmPosPredict.x+=o.x,e.btmPosPredict.z+=o.y}}}(e)},JB=function(e,t){return Math.abs(e-t)<.5||(e>t?e-=1:t-=1),e-t},YB=function(e,t){return Math.abs(e-t)>.5?(e+t+1)/2:(e+t)/2},ZB=function(e){if(e.box1){var t=KB(e.box0.pano.position,e.box0.centerTopDir,e.box1.pano.position,e.box1.centerTopDir);e.topPos=t.pos3d,e.diffHeight=t.mid2?t.mid2.distanceTo(t.mid1):1,e.box0.topPos&&e.box1.topPos&&(e.topPos.y=(e.box0.topPos.y+e.box1.topPos.y)/2)}else{var n=e.box0||e,i=n.btmPos;i||(i=XB(e)),n.topPos=i.clone();var o,r=i.x-n.pano.position.x,a=i.z-n.pano.position.z;o=Math.abs(r)<Math.abs(a)?a*n.centerTopDir.y/n.centerTopDir.z:r*n.centerTopDir.y/n.centerTopDir.x,n.topPos.y=o+n.pano.position.y;var s=FB[tP(n)].height.min,l=Math.max(n.topPos.y-i.y,s);n.topPos.y=i.y+l,e.topPos=n.topPos}return e.topPos},XB=function(e){if(e.box1){var t=KB(e.box0.pano.position,e.box0.centerBtmDir,e.box1.pano.position,e.box1.centerBtmDir);e.btmPos=t.pos3d}else{var n=e.box0||e;if(!n.btmPos){if(!CB)return n.btmPosPredict;RB.set(n.pano.position,n.centerBtmDir);var i,o=RB.intersectObjects([EB]);n.btmPosOri=o[0].point.clone(),tP(n);var r=new THREE.Vector2(n.centerBtmDir.x,n.centerBtmDir.z).normalize();if(FB[n.boxType].thick&&FB[n.boxType].atWall){var a=FB[n.boxType].widthNormal,s=a.min,l=a.max;s*=.3,l*=.5,n.xProp||iP(n),i="width"==n.xProp?ge.linearClamp(Math.abs(r.x),0,1,s,l):ge.linearClamp(Math.abs(r.y),0,1,s,l)}else{var c=FB[n.boxType].thick||FB[n.boxType].widthNormal,u=(c.min+c.max)/2,h=.5*u,d=.8*u,p=Math.min(Math.abs(n.centerBtmDir.x),Math.abs(n.centerBtmDir.z));i=ge.linearClamp(p,0,.707,h,d)}Math.abs(o[0].face.normal.y)<.9&&(FB[n.boxType].atWall||o[0].point.y-wB>.3)&&(i*=-1);var f=r.clone().multiplyScalar(i);n.btmPos=o[0].point.clone(),n.btmPos.x+=f.x,n.btmPos.z+=f.y}e.btmPos=n.btmPos}return e.btmPos},KB=function(e,t,n,i){var o=(new THREE.Vector3).addVectors(e,t),r=(new THREE.Vector3).addVectors(n,i),a=ge.getLineIntersect2({A:e.clone(),B:n.clone(),p1:o,p2:r,dir0:t,dir1:i});return a.pos3d||console.error("getIntersect2 no result? ?"),a},$B=function(e){var t=tP(e);return e.preDealRes&&e.preDealRes.position||e.center||t&&(FB[t].atWall>.5&&FB[t].bottom?e.posAtWall:e.btmPos||e.btmPosPredict)||e.posAtWall},eP=function(e,t){return t==e||HB[t]instanceof Array?HB[t].includes(e):HB[t]==e},tP=function(e){if(e.boxType)return e.boxType;var t=e.category||e.box0.category;if("rowBigBox"==t)e.boxType="rowBigBox";else{var n;for(var i in"ac_switchboard"==t&&console.log(1),HB)if(eP(t,i)){n=i;break}e.boxType=n}return e.boxType},nP=function(e,t){t=t||$B(e);var n={"x+":0,"x-":0,"z+":0,"z-":0,got:!1};return!n.got&&t&&(AB.model.panos.list.forEach((function(e){var i=(new THREE.Vector3).subVectors(e.position,t);i.x>0?n["x+"]+=i.x:n["x-"]+=i.x,i.z>0?n["z+"]+=i.z:n["z-"]+=i.z})),n.got=!0),e.panosDir&&console.error("already has dir"),e.panosDir=n,n},iP=function(e,t){var n,i;if("pano10-8&pano12-6"==e.name&&console.log(4),FB[e.boxType].atWall&&FB[e.boxType].thick||t){var o=$B(e),r=xB,a=Math.min(o.x-r.min.x,r.max.x-o.x),s=Math.min(o.z-r.min.z,r.max.z-o.z),l=nP(e,o),c=0==l["x+"]||0==l["x-"],u=0==l["z+"]||0==l["z-"];0==l["x+"]&&0!=l["x-"]?a=r.max.x-o.x:0==l["x-"]&&0!=l["x+"]&&(a=o.x-r.min.x),0==l["z+"]&&0!=l["z-"]?s=r.max.z-o.z:0==l["z-"]&&0!=l["z+"]&&(s=o.z-r.min.z);var h=u?1:0,d=c?1:0;return h+=a-s,!ge.closeTo(h,d,.2)&&(a<.7||s<.7)&&(h<d?(n="thick",i="width"):(n="width",i="thick")),n||(t||(e.category?(e.pose||(e.pose=rP(e,o)),h+=e.pose.xWidthPossible,d+=e.pose.yWidthPossible):UB(e,(function(e){e.boxposes&&e.boxposes.forEach((function(e){h+=e.xWidthPossible,d+=e.yWidthPossible}))}))),h>d?(n="width",i="thick"):(n="thick",i="width")),n&&(e.xProp=n,e.yProp=i),{xWidthPossible:h,yWidthPossible:d}}},oP=function(e){if(!e.preDealRes&&e.center){e.preDealRes={},e.boxType||tP(e);var t,n=FB[e.boxType];n.widthNormal.min;var i=xB.distanceToPoint(e.center);if("pano2-5"==e.name&&console.log(4),i>.3&&!n.tiny&&!n.tinyXZ){var o=e.center.clone().clamp(xB.min,xB.max);e.preDealRes.position=o,tP(e),t=!0}var r=$B(e);!t&&e.boxposes||(e.boxposes=[],[e.box0,e.box1].forEach((function(t){t&&e.boxposes.push(rP(t,r))}))),iP(e)}},rP=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=FB[e.boxType],o=JB(e.bbox2[2],e.bbox2[0])*Math.PI,r=(new THREE.Vector3).subVectors(e.pano.position,t).setY(0).length()+n,a=2*Math.tan(o)*r,s=e.centerDir.clone().setY(0).normalize(),l=ge.getNormal({points:[{x:0,y:0},{x:s.x,y:s.z}]});l.x=Math.abs(l.x),l.y=Math.abs(l.y);var c,u,h,d,p,f,m=i.widthNormal.max,v=i.widthNormal.min;if(FB[e.boxType].thick){var g=i.thick.min,y=i.width.min,A=i.thick.max,E=i.width.max,b=l.x*E+l.y*A,w=l.x*A+l.y*E,x=l.x*y+l.y*g,C=l.x*g+l.y*y;c=Math.min(x,C),u=Math.max(b,w),l.x,l.y,h=THREE.MathUtils.clamp((a-g*l.y)/l.x,g,E),d=THREE.MathUtils.clamp((a-g*l.x)/l.y,g,E),p=THREE.MathUtils.clamp((a-E*l.y)/l.x,g,E),f=THREE.MathUtils.clamp((a-E*l.x)/l.y,g,E)}else c=(l.x+l.y)*v,u=(l.x+l.y)*m,h=THREE.MathUtils.clamp((a-v*l.y)/l.x,v,m),d=THREE.MathUtils.clamp((a-v*l.x)/l.y,v,m),p=THREE.MathUtils.clamp((a-m*l.y)/l.x,v,m),f=THREE.MathUtils.clamp((a-m*l.x)/l.y,v,m);var T={box:e,projectWidth:a,camTangent:l,maxProjectWidth:u,minProjectWidth:c,dis:r,maxX:h,maxY:d,minX:p,minY:f};return i.atWall>0&&(T.xWidthPossible=-Math.abs(a-l.x*m-l.y*v),T.yWidthPossible=-Math.abs(a-l.x*v-l.y*m)),T},aP=function(e,t){var n=0;if(e.forEach((function(i){i.lowR=i.dis<1.5?Math.pow(i.dis/1.5,1.4):1,i.projectWidth>i.maxProjectWidth?n+=500*Math.pow((i.projectWidth/i.maxProjectWidth-1)*i.lowR,2):i.projectWidth<i.minProjectWidth&&(n+=500*Math.pow((i.minProjectWidth/i.projectWidth-1)*i.lowR,2));var o=FB[t].widthNormal,r=o.min;if(o.max,1==FB[t].atWall&&r<.3||2==e.length&&"battery"==t){var a=FB[t].widthNormal,s=a.min,l=a.max-s,c=ge.linearClamp(i.projectWidth,s,s+.5*l,600,0);n+=c}})),n=Math.min(n,1300),2==e.length){var i=new THREE.Vector2(Math.abs(e[0].camTangent.x),Math.abs(e[0].camTangent.y)),o=new THREE.Vector2(Math.abs(e[1].camTangent.x),Math.abs(e[1].camTangent.y)),r=i.dot(o);if(r>.8){var a=Math.abs(e[0].projectWidth-e[1].projectWidth);e.score2=r*a*1300*e[0].lowR*e[1].lowR,n+=e.score2}e.camTangentCos=r}return-(n=Math.min(n,1200))},sP=function(e){if("groundBar"==e.boxType&&console.log(1),!e.size){var t,n,i="",o="";"pano6-13&pano4-13"==e.name&&console.log(6);var r,a,s,l=$B(e);if(e.predictSize)t=r=e.predictSize.x,n=a=e.predictSize.y;else if(e.box1){var c=e.boxposes[0].camTangent.x,u=e.boxposes[1].camTangent.x,h=e.boxposes[0].camTangent.y,d=e.boxposes[1].camTangent.y,p=THREE.MathUtils.clamp(e.boxposes[0].projectWidth,e.boxposes[0].minProjectWidth,1.1*e.boxposes[0].maxProjectWidth),f=THREE.MathUtils.clamp(e.boxposes[1].projectWidth,e.boxposes[1].minProjectWidth,1.1*e.boxposes[1].maxProjectWidth);((t=0==c?(f-d*(n=p))/u:(p-h*(n=(f-u/c*p)/(d-u/c*h)))/c)<.3||t>1.4)&&(i+=" x:"+ge.toPrecision(t,2)),(n<.3||n>1.4)&&(i+=" y:"+ge.toPrecision(n,2)),(n<0||t<0)&&(o=t<0?"x<0!":"y<0!"),r=t,a=n}else if(e.xProp){var m,v,g,y,A=FB[e.boxType].width,E=FB[e.boxType].thick;"width"==e.xProp?(m=THREE.MathUtils.clamp(e.boxposes[0].maxX,A.min,A.max),v=THREE.MathUtils.clamp(e.boxposes[0].maxY,E.min,E.max),g=THREE.MathUtils.clamp(e.boxposes[0].minX,A.min,A.max),y=THREE.MathUtils.clamp(e.boxposes[0].minY,E.min,E.max)):(m=THREE.MathUtils.clamp(e.boxposes[0].maxX,E.min,E.max),v=THREE.MathUtils.clamp(e.boxposes[0].maxY,A.min,A.max),g=THREE.MathUtils.clamp(e.boxposes[0].minX,E.min,E.max),y=THREE.MathUtils.clamp(e.boxposes[0].minY,A.min,A.max)),t=r=(m+g)/2,n=a=(v+y)/2}else{var b=FB[e.boxType].widthNormal;t=r=THREE.MathUtils.clamp(e.boxposes[0].maxX,b.min,b.max),n=a=THREE.MathUtils.clamp(e.boxposes[0].maxY,b.min,b.max)}if(FB[e.boxType].bottom)if(s=FB[e.boxType].height.standard,XB(e),s){var w=l.y-e.btmPos.y;l.y-=THREE.MathUtils.clamp((w-s/2)/2,-.1,.1)}else{var x=e.btmPos.y;s=2*(l.y-x)}else e.topPos||ZB(e),e.btmPos||XB(e),s=e.topPos.y-wB;var C=lP(t,s,n,e);t=C.x,s=C.y,n=C.z,FB[e.boxType].widthSame&&(t=n=(t+n)/2),e.size=new THREE.Vector3(t,s,n),e.sizeAdjust=Math.pow(Math.abs(t-r),1.3)+Math.pow(Math.abs(n-a),1.3),e.sizeAdjust&&(e.score=(e.score||0)-Math.min(100*e.sizeAdjust,400)),e.size.oriX=r,e.size.oriY=a,e.exStr=i,e.warnStr=o}},lP=function(e,t,n,i){var o,r=i.xProp,a=i.yProp;if(null!=r){var s=FB[i.boxType][r],l=s.min,c=s.max;e=THREE.MathUtils.clamp(e,l,c);var u=FB[i.boxType][a];l=u.min,c=u.max;n=THREE.MathUtils.clamp(n,l,c),o=!0}if(!o){var h=FB[i.boxType].widthNormal;l=h.min,c=h.max;e=THREE.MathUtils.clamp(e,l,c),n=THREE.MathUtils.clamp(n,l,c)}var d=FB[i.boxType].height;l=d.min,c=d.max;return{x:e,y:t=THREE.MathUtils.clamp(t,l,c),z:n}},cP=function(e,t){var n=new THREE.Box2;return n.min.set(Math.max(e.min.x,t.min.x),Math.max(e.min.y,t.min.y)),n.max.set(Math.min(e.max.x,t.max.x),Math.min(e.max.y,t.max.y)),n},uP=function(e){var t=e.map((function(e){return e.bbox2[0]})),n=e.map((function(e){return e.bbox2[2]}));return t.sort((function(e,t){return JB(e,t)})),n.sort((function(e,t){return JB(t,e)})),{leftX:t[0],rightX:n[0]}};BB.searchCount1=0,BB.escapeCount1=0;var hP=function e(t,n,i,o,r,a,s){var l=[],c=!!o,u=function(){if(c){var e=r.indexOf(o);r.splice(e,1),c=!1}};if(!o){if(0==n.length||0==i.length)return;if(n.length>i.length){var h=n;n=i,i=h}t=n[0];var d=Object.keys(BB.boxFrame.datas).length;d<10?a=null:s=ge.linearClamp(d,10,80,-4e3,-500)}searchCount1++;for(var p=0;p<i.length;p++){l=[t,i[p]];var f=void 0;if(a&&(null==(f=a(l[0],l[1]))||f.score<=s))escapeCount1++;else{var m=void 0;o?(u(),(m=o.slice(0)).push(l)):m=[l],r.push(m);var v=n.slice(0),g=i.slice(0),y=v.indexOf(l[0]);v.splice(y,1),y=g.indexOf(l[1]),g.splice(y,1),v.length>0&&g.length>0&&e(v[0],v,g,m,r,a,s)}}},dP=function(e){f(i,THREE.Group);var t,n=yB(i);function i(e,t,r){var a;return o(this,i),(a=n.call(this)).clear(),(AB=e).model.add(h(a)),BB.boxFrame=h(a),Fe.urlHasValue("ext")&&(kB=(IB=!0)&&!Fe.urlHasValue("ctrl")),a.ifAnalyze=t,a.wireframes=new THREE.Object3D,a.wireframes.name="wireframes",a.add(a.wireframes),a.matchScoreMap={},a.bindEvents(),(bB=new THREE.Object3D).name="testBox",a.add(bB),a.visiInfos={},a.compute(r),a}return u(i,[{key:"compute",value:(t=k(S.mark((function e(t){var n,i,o,r,a=this;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:r=function(){return(r=k(S.mark((function e(){var t,n=this;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,ri.post("/service/shapes/sceneMarkShape/getInfos",{num:AB.$app.config.num});case 2:if((t=e.sent).data&&t.success){e.next=5;break}return e.abrupt("return");case 5:IB&&((t.data.box8.dataSet.boxes||t.data.box8.dataSet).forEach((function(e){var t=ge.convertVisionVector((new THREE.Vector3).fromArray(e.points[0])),n=ge.convertVisionVector((new THREE.Vector3).fromArray(e.points[1])),i=ge.convertVisionVector((new THREE.Vector3).fromArray(e.points[2])),o=ge.convertVisionVector((new THREE.Vector3).fromArray(e.points[4])),r=new THREE.Vector3(t.distanceTo(n),t.y-o.y,i.distanceTo(n)),a=(new THREE.Vector3).addVectors(i,o).multiplyScalar(.5);new NB({buildFromData:!0,center:a,size:r,boxType:e.type,name:e.sid,external:e.external})})),this.ifAnalyze=!1,this.visible=!1),IB&&!Fe.urlHasValue("ctrl")||((Array.isArray(t.data)?t.data:t.data.box4).forEach((function(e){var t=e.imagePath.split(".jpg")[0];n.datas[t]=e})),this.visible=!0),i();case 8:case"end":return e.stop()}}),e,this)})))).apply(this,arguments)},o=function(){return r.apply(this,arguments)},TB=Date.now(),this.datas={},this.datasMixed={},this.boxesSolid=SB,n=function(){var e=function(e,t){var n,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},o=i.isSingle,r=i.center,s=i.onlyGet,l=i.dontCheckDis,c=e.sid+"&"+t.sid,u=t.sid+"&"+e.sid,h=tP(e),d=a.matchScoreMap[h].get(c),p=a.matchScoreMap[h].get(u),f=d||p;if(s)return f;if(f)return f;f={name:n=c,box0:e,box1:t,center:r},a.matchScoreMap[h].set(n,f),"pano120-20&pano130-17"==n&&console.log(5),qB(e),qB(t);var m=e.pano.position.clone(),v=t.pano.position.clone(),g=(new THREE.Vector3).subVectors(v,m),y=new THREE.Vector2(g.x,g.z).normalize(),A=r?new THREE.Vector2(r.x-m.x,r.z-m.z).normalize():new THREE.Vector2(e.centerDir.x,e.centerDir.z).normalize(),E=r?new THREE.Vector2(r.x-v.x,r.z-v.z).normalize():new THREE.Vector2(t.centerDir.x,t.centerDir.z).normalize(),b=Math.acos(y.dot(A)),w=Math.PI-Math.acos(y.dot(E)),x=100,C=[];if(b+w>Math.PI+.2)return Object.assign(f,{score:-5e3,str:["angle>180"]});if(e.type!=t.type)return Object.assign(f,{score:-5e3,str:["typeNotSame"]});if(null==f.dirAngleXZ&&(f.dirAngleXZ=THREE.MathUtils.radToDeg(Math.acos(A.dot(E))),f.minAng=Math.min(180-f.dirAngleXZ,f.dirAngleXZ),o)){var T=2;x+=300*Math.sin(THREE.MathUtils.degToRad(f.dirAngleXZ)),x+=f.dirAngleXZ,x-=10*Math.abs($B(e).distanceToSquared(e.pano.position)-T),x-=10*Math.abs($B(t).distanceToSquared(t.pano.position)-T)}var I=1,k=e.btmPos||e.btmPosPredict,B=t.btmPos||t.btmPosPredict;if(!l){var P=THREE.MathUtils.clamp(.8/FB[h].widthNormal.max,.6,2);if(!FB[h].bottom&&k&&B){var R=k.distanceToSquared(B);if(f.btmPosPreDis=R,x-=1300*R*P*I,t.topPos){var M=e.topPos.distanceToSquared(t.topPos);f.topPosPreDis=M;var S=700*M*P*I,D=new THREE.Vector2(k.x-m.x,k.z-m.z).lengthSq(),L=new THREE.Vector2(B.x-v.x,B.z-v.z).lengthSq();(D<.4||L<.4)&&(S*=.3),x-=S}}else if(e.posAtWall&&t.posAtWall){var F=e.posAtWall.distanceToSquared(t.posAtWall);f.wallPosPreDis=F,x-=200*F*P,F=e.btmPosOri.distanceToSquared(t.btmPosOri),f.btmPosPreDis=F,x-=200*F*P*I}}if(!f.center){var H=KB(m,e.centerDir,v,t.centerDir);f.center=H.pos3d.clone();var V,O=(new THREE.Vector3).subVectors(H.pos3d,m).normalize(),Q=(new THREE.Vector3).subVectors(H.pos3d,v).normalize(),_=O.dot(e.centerDir)+Q.dot(t.centerDir),z=_<1.95;if(x-=1e4*(2-_),z)return C.push("wrongDir"),Object.assign(f,{score:x-5e3,str:C});if(!l&&!FB[h].bottom&&e.btmPos&&t.btmPos){var U=new THREE.Vector2(e.btmPos.x,e.btmPos.z),N=new THREE.Vector2(t.btmPos.x,t.btmPos.z),G=new THREE.Vector2(f.center.x,f.center.z),j=U.distanceToSquared(G)+N.distanceToSquared(G),W=ge.linearClamp(f.minAng,0,20,0,1);x-=1500*j*W,f.centerDrift=j}XB(f),V=1==FB[e.boxType].atWall?ge.linearClamp(f.minAng,2,15,0,1):ge.linearClamp(f.minAng,2,20,0,.4);var q=!FB[h].bottom&&e.btmPos||e.posAtWall||f.topPos,J=!FB[h].bottom&&t.btmPos||t.posAtWall||f.topPos,Y=.5,Z=(new THREE.Vector3).addVectors(f.center.clone().multiplyScalar(1-Y),f.btmPos.clone().multiplyScalar(Y)).setY(H.pos3d.y);f.center=q&&J?(new THREE.Vector3).addVectors(Z.clone().multiplyScalar(V),q.clone().add(J).multiplyScalar(.5*(1-V))).setY(H.pos3d.y):Z,f.cIntersect=Z}tP(f);var X,K=(new THREE.Vector3).subVectors(e.pano.position,f.center),$=(new THREE.Vector3).subVectors(t.pano.position,f.center);if(K.x*$.x>0&&K.z*$.z>0&&(x-=200),!xB.containsPoint(f.center)){var ee=xB.distanceToPoint(f.center);if(x-=1e3*ee*ee,C.push("outsideBound"),Object.assign(f,{score:x,str:C,center:f.center,disToBound:ee}),ee>.5)return f}var te=function(){X=[],[e,t].forEach((function(e){var t=rP(e,f.center);X.push(t)}))};return te(),x+=aP(X,h),Object.assign(f,{score:x,str:C,boxposes:X})};a.rows={};var t=function(e){var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=n.reason,o=void 0===i?"row":i,r=e[0].pano,s=e[0].category,l=s+"|"+o;if(a.rows[l]||(a.rows[l]={}),a.rows[l][r.id])return a.rows[l][r.id];for(var c={sid:"pano"+r.id+("mix"==o?"-mix":"-row"),pano:r,category:"mix"==o?s:"rowBigBox",boxType:"mix"==o?e[0].boxType:"rowBigBox"},u=[],h=0;h<e.length;h++){var d=e[h];qB(d);for(var p=[d.bbox2[0],d.bbox2[2]],f=p[0],m=p[1],v=h+1;v<e.length;v++){var g=e[v];if(qB(g),d.boxType==d.boxType){var y=[g.bbox2[0],g.bbox2[2]],A=y[0],E=y[1],b=JB(A,m),w=JB(A,f),x=JB(f,E);"pano2-4"==d.sid&&"pano2-5"==g.sid&&console.log(9);var C="mix"==o?.004:.003;if(b<=C&&w>=C||x<=C&&w<=C){var T=A<.002&&m>.998?[A,m]:f<.002&&E>.998?[f,E]:null;if("mix"==o&&!T)continue;var I=FB[d.boxType].widthNormal.max,k=I*I*("mix"==o?.7:1.8),B=1==FB[d.boxType].atWall?d.posAtWall:"mix"==o?d.btmPosOri||d.btmPosPredict:d.btmPos,P=1==FB[g.boxType].atWall?g.posAtWall:"mix"==o?g.btmPosOri||g.btmPosPredict:g.btmPos,R=B.distanceToSquared(P);if("mix"==o){var M=d.bbox2[3]-d.bbox2[1]+(g.bbox2[3]-g.bbox2[1]),S=Math.max(d.bbox2[3],g.bbox2[3])-Math.min(d.bbox2[1],g.bbox2[1]),D=M-S,L=4*(1-D/S+3*(S-D))*k;R+=L;var F=T?.002/(T[0]+(1-T[1])):0;R-=(F=Math.min(6,F))*k}R<k&&De.pushToGroupAuto([d,g],u)}}}}return u.forEach((function(e){e.sort((function(e,t){return JB(e.bbox2CenterX,t.bbox2CenterX)}))})),"row"==o&&(u.slice(0).forEach((function(e){if(e.length>=2){for(var t=[],n=new THREE.Box2,i=new THREE.Vector2,o=0,r=e.length;o<r;o++){var a=e[o],s=new THREE.Vector2(a.btmPos.x,a.btmPos.z);n.expandByPoint(s),n.getSize(i),Math.min(i.x,i.y)>.6&&(t.push([e[o],e[o-1]]),(n=new THREE.Box2).expandByPoint(s))}t.length&&De.disconnectGroup(t,u).newGroups}})),u.forEach((function(e){e.sort((function(e,t){return JB(e.bbox2CenterX,t.bbox2CenterX)}))}))),u.sort((function(e,t){return t.length-e.length})),t=u.map((function(e,t){var n=uP(e),i=n.leftX,o=n.rightX,r=e.slice().sort((function(e,t){return e.bbox2[1]-t.bbox2[1]}))[0].bbox2[1],a=e.slice().sort((function(e,t){return t.bbox2[3]-e.bbox2[3]}))[0].bbox2[3],s=Object.assign({},c,{boxes:e,bbox2:[i,r,o,a],left:e.find((function(e){return e.bbox2[0]==i})),right:e.find((function(e){return e.bbox2[2]==o}))}),l=$B(s.left),u=$B(s.right),h=new THREE.Vector2(l.x-u.x,l.z-u.z);return s.k=Math.abs(h.x/h.y),s.predictLen=(s.k>1?Math.abs(h.x):Math.abs(h.y))+.6,s})),"mix"!=o&&e.forEach((function(e){if(!u.some((function(t){return t.includes(e)}))){var n=Object.assign({},c,{bbox2:e.bbox2,boxes:[e],left:e,right:e});t.push(n)}})),t.forEach((function(e){e.sid+="-"+e.boxes.map((function(e){return e.index})).join(","),"row"==o&&(e.boxes[0].btmPos&&(e.btmPos=e.boxes.reduce((function(e,t){return e.add(t.btmPos)}),new THREE.Vector3).multiplyScalar(1/e.boxes.length)),e.boxes[0].topPos&&(e.topPos=e.boxes.reduce((function(e,t){return e.add(t.topPos)}),new THREE.Vector3).multiplyScalar(1/e.boxes.length)),e.boxes[0].posAtWall&&(e.posAtWall=e.boxes.reduce((function(e,t){return e.add(t.posAtWall)}),new THREE.Vector3).multiplyScalar(1/e.boxes.length)))})),a.rows[l][r.id]=t,t},n=function(n,i){a.matchScoreMap.rowBigBox=new Map;var o=new Map,r=function(t,n,i){var r=t.sid+"&"+n.sid,a=o.get(r);if(a)return a;if(t.boxes.length==n.boxes.length||i){var s;if(t.boxes.length>1&&n.boxes.length>1){var l,c,u=[t.left,n.left],h=[t.right,n.right],d=function(e,t){var n,i,o=!1,r=[e.left,t.left],a=[e.right,t.right];r[0].btmPos.distanceToSquared(r[1].btmPos)+a[0].btmPos.distanceToSquared(a[1].btmPos)>r[0].btmPos.distanceToSquared(a[1].btmPos)+a[0].btmPos.distanceToSquared(r[1].btmPos)?(o=!0,n=(new THREE.Vector3).addVectors(r[0].btmPos,a[1].btmPos).multiplyScalar(.5),i=(new THREE.Vector3).addVectors(a[0].btmPos,r[1].btmPos).multiplyScalar(.5)):(n=(new THREE.Vector3).addVectors(r[0].btmPos,r[1].btmPos).multiplyScalar(.5),i=(new THREE.Vector3).addVectors(a[0].btmPos,a[1].btmPos).multiplyScalar(.5));var s=new THREE.Vector2(n.x-i.x,n.z-i.z);return{reversed:o,k:Math.abs(s.x/s.y)}}(t,n),p=t.predictLen,f=n.predictLen,m=Math.abs(p-f);if(m>1)return D();d.reversed?(l=e(u[0],h[1],{isSingle:!0}),c=e(h[0],u[1],{isSingle:!0})):(l=e(u[0],u[1],{isSingle:!0}),c=e(h[0],h[1],{isSingle:!0}));var v=$B(l),g=$B(c);if(!v||!g||l.score<-4e3||c.score<-4e3)return D();oP(l),oP(c),v=$B(l),g=$B(c);var y=new THREE.Vector2(v.x-g.x,v.z-g.z),A=Math.abs(y.x/y.y);if(d.k>1&&A<1||d.k<1&&A>1)return console.error("请检查!info2.k > 1 && k < 1 || info2.k < 1 && k > 1",t.sid,"和",n.sid),D();var E=0;if((t.k>1&&n.k<1||t.k<1&&n.k>1)&&(E=t.k/n.k)<1&&(E=1/E),A<1&&v.z>g.z||A>1&&v.x>g.x){var b=g;g=v,v=b}var w=(new THREE.Vector3).addVectors(v,g).multiplyScalar(.5);w.add(t.btmPos).add(n.btmPos).multiplyScalar(1/3);var x=e(t,n,{isSingle:!0,center:w}),C=x.score-1e3*m-100*E+l.score+c.score;if(C<-4e3)return D();s={rowBigBox0:t,rowBigBox1:n,match:x,k:A,posLeft:v,posRight:g,score:C/3+500,reversed:d.reversed}}else if(1==t.boxes.length&&1==n.boxes.length)s=e(t.boxes[0],n.boxes[0]);else{var T=t.boxes.length>1?t:n,I=1==t.boxes.length?t:n;(s=e(t,n,{dontCheckDis:!0})).k=T.k,s.center&&s.center.add($B(T)).multiplyScalar(.5),"pano0-row-14&pano4-row-8,11"==s.name&&VB(s.center,"c"),s.predictSize=s.k>1?{x:T.predictLen,y:.6}:{y:T.predictLen,x:.6};var k=$B(T.left).distanceToSquared(I.pano.position)<$B(T.right).distanceToSquared(I.pano.position)?T.left:T.right,B=$B(I),P=$B(k).distanceToSquared(B);s.score-=1e3*P;var R=$B(T),M=new THREE.Vector2(R.x-I.pano.position.x,R.z-I.pano.position.z).normalize(),S=new THREE.Vector2(I.centerDir.x,I.centerDir.z).normalize();s.score+=1e3*(M.dot(S)-1)}return D(s),s}function D(e){o.set(r,e)}},s=[],l=1==n.filter((function(e){return e.length>1})).length,c=CB?-2e3:-800,u=function(e){"second"==e&&(l=!0);for(var i=0;i<n.length-1;i++){var a=t(n[i]),u=n[i][0].pano;"second"==e&&(a=a.filter((function(e){return!s.some((function(t){return t.includes(e)}))})));for(var h=function(i){var h=t(n[i]);"second"==e&&(h=h.filter((function(e){return!s.some((function(t){return t.includes(e)}))})));var d=n[i][0].pano;54==u.id&&56==d.id&&console.log(2);var p=[];hP(null,a.slice(),h.slice(),null,p,(function(e,t){return r(e,t,l)})),(p=p.map((function(e){var t=e.map((function(e){return e.some((function(e){return"void"==e.sid}))?null:r(e[0],e[1],l)})),n=t.reduce((function(e,t){return e+(t&&t.score>c?t.score:c/2)}),0);return{pairs:e,infos:t,score:n,name:e.map((function(e){return e.map((function(e){return e.sid})).join(" & ")}))}}))).sort((function(e,t){return t.score-e.score})),p[0]&&p[0].pairs.forEach((function(e,t){var n=p[0].infos[t];if(n&&n.score>c){var i=e.filter((function(e){return"void"!=e.sid}));De.pushToGroupAuto(i,s,null,(function(e){if(!n.k)return!0;var t=e.relationships[0],i=t[0].sid+"&"+t[1].sid;return!o.get(i).k||o.get(i).k<1&&n.k<1||o.get(i).k>1&&n.k>1||void console.log("k不一致无法匹配",n,e)}))}}))},d=i+1;d<n.length;d++)h(d)}};u(),l||u("second");var h=[],d=function e(t){var n=new THREE.Vector3,i=new THREE.Vector3,r=0,a=[],l={};if(t.relationships.forEach((function(e){var t=e[0].sid+"&"+e[1].sid,s=o.get(t);s.posLeft?(n.add(s.posLeft),i.add(s.posRight),r++):(a.push(s),oP(s),sP(s))})),r>0){n.multiplyScalar(1/r),i.multiplyScalar(1/r);var c=(new THREE.Vector3).addVectors(n,i).multiplyScalar(.5);l.left=n,l.right=i,l.center=c,l.pointsLen=r}if(a.length>0){var u=function(e){var t=new THREE.Vector3,o=new THREE.Vector3;if(e.forEach((function(e){var n=$B(e);t.add(n),o.add(e.size)})),r>0){var a=new THREE.Vector3(Math.abs(n.x-i.x),o.y,Math.abs(n.z-i.z));o.add(a.multiplyScalar(r)).multiplyScalar(1/(r+e.length)),t.add(l.center.clone().multiplyScalar(r)).multiplyScalar(1/(r+e.length))}else o.multiplyScalar(1/e.length),t.multiplyScalar(1/e.length);return{center1:t,size:o}},d=function(e,t){a.forEach((function(e){e.sc=-e.center.distanceToSquared(f)-.5*t.distanceToSquared(e.size)}))},p=u(a),f=p.center1;d(0,p.size),a.sort((function(e,t){return t.sc-e.sc}));var m=a[Math.floor(a.length/2)];d(m.center,m.size);var v=a.filter((function(e){return e.sc<-8}));if(v.length){var g=De.disconnectGroup(v.map((function(e){return[e.box0,e.box1]})),s).newGroups;if(console.log("去除错误数据",v),g.length>1)return void g.forEach((function(t){e(t)}));a=a.filter((function(e){return e.sc>=-8}))}if(a.length){var y=u(a);l.center=y.center1,l.size=y.size}}l.k=function(e){var t;if(e.left){var n=new THREE.Vector2(e.left.x-e.right.x,e.left.z-e.right.z);t=Math.abs(n.x/n.y)}else t=Math.abs(Math.max(e.size.x,.6)/Math.max(e.size.z,.6));return t}(l),l.bigBoxes=a,l.group=t,h.push(l)};s.slice(0).forEach((function(e){d(e)}));var p=function(e){return e.size?e.k>1?e.size.x:e.size.z:e.k>1?e.right.x-e.left.x:e.right.z-e.left.z+.6},f=function(){for(var e=[],t=function(e,t){var n=[];e.forEach((function(e){n.push.apply(n,H(e.group.map((function(e){return e.boxes.length}))))})),n.sort((function(e,t){return e-t}));var i=[];n.slice(Math.floor(.3*n.length),Math.floor(.7*n.length)+1).forEach((function(e){i.includes(e)||i.push(e)}));var o=FB.cabinet.widthNormal,r=o.min,a=o.max,s=(r+a)/2,l=i.map((function(e){return{aveW:t/e,count:e}}));l.sort((function(e,t){return Math.abs(e.aveW-s)-Math.abs(t.aveW-s)}));var c=l[0].aveW,u=l[0].count;return(c>a||c<r)&&(c=THREE.MathUtils.clamp(c,r,a)),{aveW:c,count:u}},n=function(e,t,n,i){var o=new THREE.Box2;o.expandByPoint(new THREE.Vector2(e.x,e.z));var r=i>1?new THREE.Vector2(t/2,n/2):new THREE.Vector2(n/2,t/2);return o.expandByVector(r),o},i=function(i){for(var o=h[i],r=function(i){var r,a,s=h[i];if("pano4-row-4&pano6-row-5,1"==(null===(r=s.bigBoxes[0])||void 0===r?void 0:r.name)&&"pano4-row-2,5&pano6-row-3"==(null===(a=o.bigBoxes[0])||void 0===a?void 0:a.name)&&console.log(4),(o.k>1&&s.k<1||o.k<1&&s.k>1)&&p(o)>1.5&&p(s)>1.5)return"continue";var l=(o.k+s.k)/2>1?"z":"x";if(Math.abs(o.center[l]-s.center[l])>.6*1.5)return"continue";var c=t([o],p(o)),u=t([s],p(s)),d=o.predictLen=c.aveW*c.count,f=s.predictLen=u.aveW*u.count,m=o.area=d*c.aveW,v=s.area=f*u.aveW,g=function(e,t){var i=n(o.center,d+e,c.aveW+t,o.k),r=n(s.center,f+e,u.aveW+t,s.k),a=cP(i,r).getSize(new THREE.Vector2);return{box0:i,box1:r,areaMix:Math.max(0,a.x)*Math.max(0,a.y)}}(.1,.3).areaMix;if(g/m<.65&&g/v<.65)return"continue";De.pushToGroupAuto([o,s],e)},a=i+1;a<h.length;a++)r(a)},o=0;o<h.length-1;o++)i(o);return h.forEach((function(t){e.some((function(e){return e.includes(t)}))||e.push([t])})),e.forEach((function(e,n){var i,o=e.reduce((function(e,t){return e+(t.pointsLen||t.bigBoxes.length)}),0),r={"<1":{count:0,sum:0},">1":{count:0,sum:0}};e.forEach((function(e){e.k<1?(r["<1"].count++,r["<1"].sum+=1/e.k):(r[">1"].count++,r[">1"].sum+=e.k)})),r["<1"].count&&(r["<1"].ave=r["<1"].sum/r["<1"].count),r[">1"].count&&(r[">1"].ave=r[">1"].sum/r[">1"].count),i=r["<1"].ave>r[">1"].ave?1/r["<1"].ave:r[">1"].ave;var a=e.reduce((function(e,t){return e.add(t.center.clone().multiplyScalar(t.pointsLen||t.bigBoxes.length))}),new THREE.Vector3).multiplyScalar(1/o),s=e.map((function(e){return function(e,t){var n=(t||e.k)>1?"x":"z";return e.left?e.left[n]-.3:e.center[n]-e.size[n]/2}(e,i)})).sort((function(e,t){return e-t})).filter((function(e){return e<a[i>1?"x":"z"]})).slice(0,3),l=e.map((function(e){return function(e,t){var n=(t||e.k)>1?"x":"z";return e.right?e.right[n]+.3:e.center[n]+e.size[n]/2}(e,i)})).sort((function(e,t){return t-e})).filter((function(e){return e>a[i>1?"x":"z"]})).slice(0,3),c=0,u=0,h=(s.length+1)*s.length/2;s.forEach((function(e,t){c+=e*((s.length-t)/h)})),h=(l.length+1)*l.length/2,l.forEach((function(e,t){u+=e*((l.length-t)/h)})),a[i>1?"x":"z"]=(c+u)/2;var d=u-c,p=e.filter((function(e){return!e.predictLen||e.predictLen/d>.7}));0==p.length&&(p=e.sort((function(e,t){return t.predictLen-e.predictLen})).slice(0,1));var f,m=t(p,d),v=m.aveW,g=m.count,y=[],A=[];e.forEach((function(e){A.push.apply(A,H(e.group.filter((function(e){return!A.includes(e)&&e.boxes.length==g}))))})),(f=A.map((function(e){var t=e.boxes.map((function(e){var t={box0:e};return ZB(t),t.topPos}));return(i<1&&t[0].z>t[g-1].z||i>1&&t[0].x>t[g-1].x)&&t.reverse(),t.map((function(e){return e.y-wB}))}))).forEach((function(e){for(var t=0;t<g;t++)y[t]=(y[t]||0)+e[t]})),y=y.map((function(e){return e/f.length}));var E=new THREE.Vector3(v,2,v),b=0;for(e.rowboxs=[];b<g;){var w=void 0;if(i>1){var x=a.x-(g-1)/2*v;w=new THREE.Vector3(x+b*v,a.y,a.z)}else{var C=a.z-(g-1)/2*v;w=new THREE.Vector3(a.x,a.y,C+b*v)}var T=y[b]?E.clone().setY(y[b]):E,I=new NB({name:"row"+n+"-"+b,center:w,size:T,boxType:"cabinet",infos:e});b++,e.rowboxs.push(I)}})),{v:e.length>0}}();if("object"==typeof f)return f.v},i=[],o=function(o){console.error("开始search",o);var r=a.matchScoreMap[o]=new Map,s={},c=[];for(var u in a.datas)a.datas[u]&&(s[u]=a.datas[u].shapes.filter((function(e){return eP(e.category,o)})),s[u].length&&c.push(u));var p=function(e){if(!a.datas[e])return"continue";(function(e){var t=e.length;if(!(t<2)){for(var n=0;n<t-1;n++){var i=e[n];qB(i),i.contains=i.contains||[];for(var o=n+1;o<t;o++){var r=e[o];if(qB(r),r.contains=r.contains||[],!(Math.abs(r.bbox2CenterX-i.bbox2CenterX)>.4)){var a=JB(r.bbox2[0],i.bbox2[0]),s=JB(i.bbox2[2],r.bbox2[2]),l=JB(i.bbox2[2],i.bbox2[0]),c=JB(r.bbox2[2],r.bbox2[0]),u=Math.min(.005,.2*Math.min(l,c));s>=0&&Math.abs(a)<u||a>=0&&Math.abs(s)<u||s>=0&&a>=0?i.contains.push(r):(a<=0&&Math.abs(s)<u||s<=0&&Math.abs(a)<u||s<=0&&a<=0)&&r.contains.push(i)}}}var h=function(e,t){var n=rP(e,$B(e),.1),i=n.projectWidth,o=(n.maxProjectWidth+n.minProjectWidth)/2,r="out"==t?i-o:o-i;return 10*-Math.pow(r,2)},d="battery"==e[0].boxType?1:2;e.slice().forEach((function(t){if(t.contains.length>=d){var n=uP(t.contains),i=n.leftX,o=n.rightX;if(t.contains.length>1&&(Math.abs(JB(t.bbox2[0],i))>.005||Math.abs(JB(t.bbox2[2],o))>.005))return;var r=!0;if(1==t.contains.length)r=!1;else{var a=h(t,"out"),s=t.contains.map((function(e){return h(e,"in")})),l=s.reduce((function(e,t){return e+t}),0)/s.length;l<-4&&(r=l>a)}r?(t.state="因嵌套其他被删除",console.log("因嵌套其他被删除",t),e.splice(e.indexOf(t),1)):t.contains.forEach((function(n){var i;n.state="因被嵌套被删除",n.containBy=t,e.splice(e.indexOf(n),1),(i=console).log.apply(i,["因被嵌套被删除"].concat(H(t.contains)))}))}}))}})(s[e]),s[e].length&&t(s[e],{reason:"mix"}).forEach((function(t){if(t.boxes.length>1){t.boxes.forEach((function(n){n.state="被删除",n.mixTo=t;var i=s[e].indexOf(n);s[e].splice(i,1),i=a.datasMixed[e].shapes.findIndex((function(e){return e.sid==n.sid})),a.datasMixed[e].shapes.splice(i,1)})),s[e].push(t),a.datasMixed[e].shapes.push(t);var n=a.datas[e].shapes;t.index=n.length>1?n[n.length-1].index+1:0;var i=t.sid.split("mix-");t.sid=i[0]+t.index+"(mix"+i[1]+")"}}))};for(var f in a.datas)p(f);if(0!=c.length){c.sort((function(e,t){return s[t].length-s[e].length}));var m=c.map((function(e){return s[e]})),v=m[0],g=v.length;if(1==m.length)return FB[o].tinyXZ&&a.expandModelBound(o),v.forEach((function(e){return d(e)})),h(o);var y=function(e){i.push({type:o,args:[e]}),FB[o].tinyXZ&&a.confirmGroundY(o),FB[o].tiny&&a.expandModelBound2(o)};if(1==g){c.forEach((function(e){return qB(s[e][0])}));for(var A=0;A<c.length;A++)for(var E=s[c[A]][0],b=A+1;b<c.length;b++){var w=s[c[b]][0];e(E,w,{isSingle:!0})}var x=Array.from(r).map((function(e){return e[1]})).sort((function(e,t){return t.score-e.score})),C=x[0];if(oP(C),C.score>-100&&(sP(C),C.score>0&&C.sizeAdjust<.1))return new NB(C),void y(m);var T=[];x.forEach((function(e){T.includes(e.box0.pano.id)||T.push(e.box0.pano.id),T.includes(e.box1.pano.id)||T.push(e.box1.pano.id)}));var I=T.map((function(e){return s[e]}));return l([C],I),void y(I)}var k={};m.forEach((function(e){e.forEach((function(e){return qB(e)})),k[e.length]||(k[e.length]=[]),k[e.length].push(e)})),m=[],FB[o].atWall;var B=Object.keys(k);if(B.reverse(),B.forEach((function(e){var t,n=k[e];n.length>1&&(n.forEach((function(e){e.disSc=e.reduce((function(e,t){var n=$B(t);return e+Math.abs(t.pano.position.distanceToSquared(n)-2)}),0)})),n.sort((function(e,t){return e.disSc-t.disSc}))),(t=m).push.apply(t,H(n))})),g=(v=m[0]).length,"cabinet"==o&&n(m))i.push({type:o,args:[m,0]});else{var P=function(t,n){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},o=i.fake;t.length,n.length;var r=[],s=t.slice(0),c=n.slice(0),u=e.bind(a);hP(null,s,c,null,r,u),r=r.map((function(t){var n=t.map((function(t){return e(t[0],t[1])})),i=n.reduce((function(e,t){return e+(t?t.score:0)}),0);return{infos:n,score:i,pairs:t,name:t.map((function(e){return e.map((function(e){return e.sid})).join(" & ")}))}})),console.log("resultPairs按分数高低",r.sort((function(e,t){return t.score-e.score})));var h=CB?-2e3:-800,d=[],p=[];r[0]&&r[0].infos.forEach((function(e,t){if(e)if(e.score<h||FB[e.boxType].bottom&&e.minAng<5)p.push(e);else if(oP(e),sP(e),e.sizeAdjust&&FB[e.boxType].tiny||e.sizeAdjust>.2)p.push(e);else{if(e.box0.category==HB.battery&&e.size.x<1&&e.size.z<1){var n=(new THREE.Vector3).subVectors(e.box0.pano.position,$B(e)),i=(new THREE.Vector3).subVectors(e.box1.pano.position,$B(e));if(n.x*i.x>0&&n.z*i.z>0)return void p.push(e)}e.fake=o,new NB(e)}else d.push(r[0].pairs[t].find((function(e){return"void"!=e.sid})))})),d.length&&l(d.map((function(e){return{box0:e}})),m,{fake:o}),l(p,m,{fake:o})};if(FB[o].tinyXZ)for(var R=0;R<m.length-1&&(P(m[R],m[R+1],{fake:R>0}),!(m[R+1].length<2));R++);else{for(var M=[],S=0;S<m.length-1;S++){var D=m[S][0].pano.position.distanceToSquared(m[S+1][0].pano.position),L=ge.linearClamp(D,[0,.4,2,6,100],[-10,0,10,5,-100])+(m[S].length+m[S+1].length);M.push({score:L,i:S,disSqure:D,length1:m[S].length,length2:m[S+1].length})}M.sort((function(e,t){return t.score-e.score})),P(m[M[0].i],m[M[0].i+1])}y(m)}}else FB[o].tinyXZ&&a.expandModelBound()};function r(e){var t=.1,n=.5,i=[],o=new Map;e.forEach((function(e){var t;(t=i).push.apply(t,H(e))})),(i=i.filter((function(e){return!s(e)}))).forEach((function(e){qB(e);var t=new THREE.Vector2(e.pano.position.x,e.pano.position.z),n=new THREE.Vector2(e.btmPos.x,e.btmPos.z),i=t.distanceToSquared(n),r=-Math.abs(i-2);e.pose||(e.pose=rP(e,$B(e)));var a=aP([e.pose],e.boxType)+7*THREE.MathUtils.clamp(e.pose.projectWidth,e.pose.minProjectWidth,e.pose.maxProjectWidth);o.set(e,{s1:r,s2:a,sum:r+a})})),(i=i.sort((function(e,t){return o.get(t).sum-o.get(e).sum}))).forEach((function(i){"pano0-4"==i.sid&&console.log(3),s(i)||function(e){if(!FB[e.boxType].bottom){e.blocked||(e.blocked={centerBtmDir:null,leftBtmDir:null,rightBtmDir:null});var t=function(t){if(!e.blocked[t]){var n=SB.find((function(n){if(RB.set(e.pano.position,e[t]),RB.ray.intersectsBox(n.bound))return!0}));if(!n)return e.blocked[t]=!1,{v:!1};e.blocked[t]=n}};for(var n in e.blocked){var i=t(n);if("object"==typeof i)return i.v}return!0}var o=SB.find((function(t){if(t.boxType==e.boxType)return RB.set(e.pano.position,e.centerDir),!!RB.ray.intersectsBox(t.bound)||void 0}));if(o)return e.blocked=o,!0}(i)||SB.find((function(e){if("air-pano16-7&pano14-13"==e.name&&console.log(3),e.boxType==i.boxType||"air-hanging"!=e.boxType&&"air-hanging"!=i.boxType){var o=$B(e),r=$B(i);new THREE.Vector2(o.x,o.z),new THREE.Vector2(r.x,r.z);var a=FB[i.boxType].widthNormal.max/2;a=THREE.MathUtils.clamp(a,t,n);var s=e.bound.distanceToPoint(r),l=FB[i.boxType].closeRatio,c=ge.linearClamp(i.pano.position.distanceTo(r),3,20,1,5);return a*((e.boxType==i.boxType?1:.5)*l*c)-1.3*s>0}}))||l([{box0:i,log:"findRest"}],e,{startIndex:0})}))}function s(e){var t=function t(n){return function(t){return t.box0==e||t.box1==e}(n)||n.list&&n.list.some((function(e){return t(e)}))||n.mixedFrom&&n.mixedFrom.some((function(e){return t(e)}))||n.infos&&n.infos.some((function(t){return t.group.some((function(t){return t.boxes.some((function(t){return t==e}))}))}))};return SB.some((function(e){return t(e)}))}function l(t,n){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},o=i.startIndex,r=void 0===o?2:o,a=i.fake,l=[],h=CB?-2e3:-800,p=function(t,n){var i=function(t,n){if(t!=n)return t.pano==n.pano||e(t,n,{isSingle:!0,restMatch:!0}).score<h||void 0};if(!(i(t.box0,n.box0)||i(t.box1,n.box1)||i(t.box0,n.box1)||i(t.box1,n.box0)))return!0};t.length&&(t[0].box1&&t.sort((function(e,t){return e.score-t.score})),t.forEach((function(i){var o=i.box0,f=i.box1,m=[];f&&m.push(i);for(var v=function(t){var i=n[t],r=[],a=[];i.forEach((function(t){if(!s(t)){if(t.pano!=o.pano&&t!=f){var n=e(o,t,{isSingle:!0,restMatch:!0});n.score>1.5*h&&r.push(n)}if(f&&t.pano!=f.pano&&t!=o){var i=e(f,t,{isSingle:!0,restMatch:!0});i.score>1.5*h&&a.push(i)}}})),r.sort((function(e,t){return t.score-e.score})),a.sort((function(e,t){return t.score-e.score})),r[0]&&m.push(r[0]),a[0]&&m.push(a[0])},g=r;g<n.length;g++)v(g);m.sort((function(e,t){return t.score-e.score}));var y=m.slice(0,10).map((function(e){return $B(e)?(oP(e),sP(e),e):e})).sort((function(e,t){return t.score-e.score})).slice(0,3);if(0==y.length)return a||d(o,.6);if(!(y[0].score>.65*h))return f?l.push(y[0]):void(("findRest"==i.log||$B(o).distanceTo(o.pano.position)<2.5)&&(a||d(o)));if((y=y.filter((function(e){return e.score>.65*h}))).length){for(var A=[],E=[],b=function(e,t){var n=y[e];if(A.some((function(e){return e.includes(n)})))return"continue";for(var i=[n],o=e+1;o<t;o++){var r=y[o];p(n,r)&&i.push(r)}A.push(i)},w=0,x=y.length;w<x;w++)b(w,x);A.forEach((function(e){E.push(c(e,t[0].log,a))})),a||u(E)}})))}function c(e,t,n){var i=new THREE.Vector3,o=new THREE.Vector3,r=new THREE.Box3;e.forEach((function(e){var t=(new THREE.Box3).setFromCenterAndSize(OB(e),e.size);r.union(t)})),r.getSize(o),e.forEach((function(e){return i.add(e.center)})),i.multiplyScalar(1/e.length);var a=e.find((function(e){return e.xProp}))||{},s=a.xProp,l=a.yProp;s&&e.find((function(e){return e.xProp&&e.xProp!=s}))&&(s=l=null);var c={name:("findRest"==t?"rest:":"low:")+e.map((function(e){return e.name})),boxType:e[0].boxType,center:i,size:o,list:e,xProp:s,yProp:l};s||iP(c);var u=lP(o.x,o.y,o.z,c);return o.x=u.x,o.y=u.y,o.z=u.z,c.fake=n,new NB(c)}function u(e,t){var n=[];if(e.length>1){var i=e[0].boxType,o=FB[i].widthNormal;o.min;for(var r=o.max,a=0,s=e.length;a<s-1;a++){var l=e[a];if(!l.fake)for(var c=a+1;c<s;c++){var u=e[c];if(!u.fake){var h=l.bound.clone().union(u.bound).getSize(new THREE.Vector3),d=l.bound.intersectsBox(u.bound);"electric"==l.boxType&&console.log(1);var p=r,f=r,m=FB[i].height.max;l.xProp&&u.xProp&&l.xProp==u.xProp&&(p=FB[i][l.xProp].max,f=FB[i][l.yProp].max,l.boxType!=u.boxType&&(p=Math.max(p,FB[u.boxType][u.xProp].max),f=Math.max(f,FB[u.boxType][u.yProp].max))),p=Math.max(p,l.size.x,u.size.x),f=Math.max(f,l.size.z,u.size.z),m=Math.max(m,l.size.y,u.size.y);var v=d?1.5:1.3;"battery"==l.boxType&&(v*=1.3);var g=.4,y=.4,A=v,E=v;1==FB[l.boxType].atWall&&("width"==l.yProp?(g*=4,A*=4):"width"==l.xProp&&(y*=4,E*=4)),h.x-p<g&&h.x<p*A&&h.z<f*E&&h.z-f<y&&h.y<m*v&&h.y-m<.4&&De.pushToGroupAuto([l,u],n)}}}n.length&&n.forEach((function(e){var n=[],o=new THREE.Box3;e.forEach((function(e){if(o.union(e.bound),e.dispose(),t>1){var i=n.find((function(t){return t.boxType==e.boxType})),r=0,a=function(e){e&&(r+=e.score)};e.traversePair((function(e){a(e.box0),a(e.box1)})),i?i.score+=r:n.push({score:r,boxType:e.boxType})}})),t>1&&(n.sort((function(e,t){return t.score-e.score})),i=n[0].boxType);var r=o.getSize(new THREE.Vector3),a=o.getCenter(new THREE.Vector3),s=e.find((function(e){return e.xProp}))||{},l=s.xProp,c=s.yProp;l&&e.find((function(e){return e.xProp&&e.xProp!=l}))&&(l=c=null);var u={name:"mix:"+e.map((function(e){return" "+e.name})),mixedFrom:e,boxType:i,center:a,size:r,xProp:l,yProp:c};l||iP(u);var h=lP(r.x,r.y,r.z,u);r.x=h.x,r.y=h.y,r.z=h.z;var d=new NB(u);console.error("混合",i,e,d)}))}}function h(e){e instanceof Array||(e=[e]),u(SB.filter((function(t){return e.includes(t.boxType)})),e.length)}var d=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;if(e.score<.68)return console.error("取消createSinglePano: 线框识别分数低,可能错误",e.sid,e);qB(e);var n=$B(e);if(xB.distanceToPoint(n)>0)return console.log("取消createSinglePano:超出safebound",e);var i={name:e.sid,box0:e,center:n,topPos:e.topPos,btmPos:e.btmPos};oP(i);var o=-500*t,r=aP(i.boxposes,e.boxType);!FB[e.boxType].bottom&&e.btmPos&&(r-=3e3*(e.btmPos.y-wB));var a=r<o;console.log("createSinglePano",a?"失败":"成功","pose score:",r,e.sid,e),a||(i.score=r,sP(i),new NB(i))};a.removedDatas={};for(var p=Object.keys(a.datas).filter((function(e){return!!AB.model.panos.index[e]||(a.removedDatas[e]=a.datas[e],delete a.datas[e],void console.log("???",e))})),f=p.length,m=0;m<f;m++)for(var v=AB.model.panos.index[p[m]],g=m+1;g<f;g++){var y=AB.model.panos.index[p[g]];if(v.position.distanceToSquared(y.position)<.01){var A=void 0;A=a.datas[p[m]].shapes.length>a.datas[p[g]].shapes.length?p[g]:p[m],console.log("删除pano".concat(A,"的data,因pano").concat(p[m],"和pano").concat(p[g],"很近")),a.removedDatas[A]=a.datas[A],delete a.datas[A]}}for(var E in a.datasMixed=De.CloneObject(a.datas,null,void 0,(function(e){return e.category})),HB)o(E);console.log("----FindRest----"),i.forEach((function(e){r.apply(void 0,H(e.args)),"air"!=e.type&&"airSmart"!=e.type&&"cabinet"!=e.type&&h(e.type)})),h(["air","airSmart"]),console.log("cost:",Date.now()-TB,"ms, boxSolid:",a.boxesSolid,"共"+a.boxesSolid.length+"个")},i=function(){var e=function(e){if(!a.datas[e])return"continue";a.datas[e].shapes=a.datas[e].shapes.map((function(t,n){return Object.assign({sid:"pano"+e+"-"+n,category:t.category,pano:AB.model.panos.index[e],index:n},t)}))};for(var t in a.datas)e(t);a.panoBound=new THREE.Box3,AB.model.chunks.forEach((function(e){PB.union(e.geometry.boundingBox)}));var i=1/0,o=[];AB.model.panos.list.filter((function(e){return e.isAligned()})).forEach((function(e){var t=(new THREE.Box3).setFromCenterAndSize(e.position,new THREE.Vector3(.1,.1,.1));PB.union(t),a.panoBound.union(t),i=Math.min(e.floorPosition.y,i),o.push(e.floorPosition.y)})),wB=PB.min.y,o.sort((function(e,t){return e-t}));var r=o[Math.floor(o.length/2)];console.error("minY",i,"midFloorY",r,"原groundY",wB),a.minY=i,wB=PB.min.y=r,xB=a.safeBound=PB,MB.setFromNormalAndCoplanarPoint(new THREE.Vector3(0,1,0),new THREE.Vector3(0,wB,0)),a.ifAnalyze&&n(),a.load(AB.currentPano.id),a.boxesSolid.forEach((function(e){return e.boxMesh.updateMatrixWorld()})),a.updateBoxVisiInPano()},t?(t.forEach((function(e){var t=e.imagePath.split(".jpg")[0];a.datas[t]=e})),i()):o.bind(this)();case 13:case"end":return e.stop()}}),e,this)}))),function(e){return t.apply(this,arguments)})},{key:"expandModelBound",value:function(){var e=this,t=PB.clone(),n=[],i=function(t){if(!e.datas[t])return"continue";var i=e.datas[t],o=i.imageWidth,r=i.imageHeight;e.datas[t].shapes.forEach((function(e){if(qB(e,o,r),"pano2-10"==e.sid&&console.log(4),e.btmPosPredict){if(e.pano.position.distanceToSquared(e.btmPosPredict)>20)return;var t=PB.distanceToPoint(e.btmPosPredict);t>0&&t<3&&n.push({box:e,dis:t})}}))};for(var o in this.datas)i(o);n.sort((function(e,t){return e.dis-t.dis}));for(var r=n.length,a=0;a<r;a++){var s=n[a].box.btmPosPredict;if(n[a].dis>1){var l=s.clone().clamp(PB.min,PB.max),c=(new THREE.Vector3).subVectors(s,l).normalize().multiplyScalar(1);s=(new THREE.Vector3).addVectors(l,c)}var u=(new THREE.Box3).setFromCenterAndSize(s,new THREE.Vector3(.2,0,.2));t.union(u)}(EB=new ho(t,new THREE.MeshBasicMaterial({side:THREE.DoubleSide,wireframe:!0,transparent:!0,opacity:.05}),0)).updateMatrixWorld(),bB.add(EB),this.skyBoxTight=EB,this.safeBound=this.safeBoundFirstVer=xB=t,CB=!0,console.log("bound1:",this.safeBound.min.toArray(),this.safeBound.max.toArray())}},{key:"expandModelBound2",value:function(e){var t=this,n=EB.material;EB.geometry.dispose(),SB.forEach((function(n){n.boxType==e&&t.safeBound.union(n.bound)})),(EB=new ho(this.safeBound,n,0)).updateMatrixWorld(),bB.add(EB),this.skyBoxTight=EB,console.log("bound2:",this.safeBound.min.toArray(),this.safeBound.max.toArray())}},{key:"updateBoxVisiInPano",value:function(){var e=this;if("panorama"==AB.mode&&DB){var t=this.visiInfos[AB.currentPano.id];t||(t=this.boxesSolid.filter((function(t){return[new THREE.Vector3(-t.size.x/2,0,0),new THREE.Vector3(t.size.x/2,0,0),new THREE.Vector3(0,0,t.size.z/2),new THREE.Vector3(0,0,-t.size.z/2)].some((function(n){var i=(new THREE.Vector3).addVectors(t.position,n),o=(new THREE.Vector3).subVectors(i,AB.position).normalize();if(o.dot(n)>=0)return!1;RB.set(AB.position,o);var r=AB.position.distanceTo(i);RB.far=r;var a=RB.intersectObjects(e.boxesSolid.filter((function(e){return e!=t})).map((function(e){return e.boxMesh})));return!(a&&a.length)}))})),this.visiInfos[AB.currentPano.id]=t),this.boxesSolid.forEach((function(e){e.updateVisible(t.includes(e),"panoVisi")}))}else this.boxesSolid.forEach((function(e){return e.updateVisible(!0,"panoVisi")}))}},{key:"confirmGroundY",value:function(e){if(!CB){var t=[],n=[],i=0,o=function(e){e.btmPos&&e.box1&&n.push(e)};SB.forEach((function(t){t.boxType==e&&t.traversePair(o)}));var r=n;if(n.length>5){var a=new Map;n.forEach((function(e){a.set(e,Math.max(e.box0.pano.position.distanceTo(e.box0.btmPosPredict),e.box1.pano.position.distanceTo(e.box1.btmPosPredict)))})),n.sort((function(e,t){return a.get(e)-a.get(t)})),r=n.slice(0,5);for(var s=5;s<n.length;s++)a.get(n[s])<3&&r.push(n[s])}r.forEach((function(e){var n=e.btmPos.y,o=e.size.x/2,r=o/Math.tan(Math.acos(-e.box0.centerBtmDir.y)),a=o/Math.tan(Math.acos(-e.box1.centerBtmDir.y));n+=Math.min(r,a)*ge.linearClamp(e.minAng,0,90,0,1),t.push(n),i+=n})),i/=t.length,t.length&&(console.error("confirmGroundY",i,t,r.map((function(e){return e.name})),n),wB=this.safeBound.min.y=this.panoBound.min.y=i,MB.setFromNormalAndCoplanarPoint(new THREE.Vector3(0,1,0),new THREE.Vector3(0,wB,0)));var l=FB[e].height,c=l.min,u=l.max;SB.slice().forEach((function(t){if(t.boxType==e)if(t.fake)t.dispose();else{var n=t.topPos?t.topPos.y:t.list.reduce((function(e,t){return e+t.topPos.y}),0)/t.list.length;t.size.y=THREE.MathUtils.clamp(n-wB,c,u),t.setFromInfo(t),t.draw()}})),this.panoBound,this.expandModelBound()}}},{key:"bindEvents",value:function(){var e=this;AB.on(ca,(function(t){e.traverse((function(e){e.isMesh&&(e.geometry.dispose(),e.material.dispose())})),e.wireframes.clear(),e.currentId=null})),AB.on(ua,(function(){e.updateBoxVisiInPano(),AB.mode==xt.PANORAMA&&e.load(AB.currentPano.id)}));var t=[];AB.on("collectIntersectMesh",(function(n,i){kB&&(t=e.boxesSolid.filter((function(e){return De.getObjVisiByReason(e.label,"panoVisi")})).map((function(e){return e.boxMesh})))})),AB.on("judgeIntersect",(function(n,i){if(!i.getConsumed()&&kB){var o=AB.getMouseIntersect(null,t,{}),r=o&&t.includes(o.object)?o.object.masterBox:null;r!=e.hoveredBox&&(e.hoveredBox,r?Wr.add("hoverMonitor"):Wr.remove("hoverMonitor"),e.hoveredBox=r),r&&i.consume()}})),AB.on("click",(function(t){!t.getConsumed()&&kB&&e.hoveredBox&&(AB.$app.Scene.emit("box-frame-click",e.hoveredBox),t.consume())})),this.ifAnalyze&&!kB&&setTimeout((function(){var t,n=document.createElement("button");n.innerHTML="点击切换box显示",n.onclick=function(){t=!t,e.boxesSolid.forEach((function(e){return e.updateVisible(t,"whole")})),e.showBoxes=t},document.querySelector("#app").appendChild(n),n.id="boxWire",n.style.position="fixed",n.style["z-index"]="100",n.style.background="#e00472",n.style.padding="10px",n.style.bottom="80px";var i=document.createElement("button");i.innerHTML="点击切换矩形框显示",i.onclick=function(){e.wireframes.visible=!e.wireframes.visible},document.querySelector("#app").appendChild(i),i.id="wireframes",i.style.position="fixed",i.style["z-index"]="100",i.style.background="#419aff",i.style.padding="10px",i.style.bottom="130px";var o=document.createElement("button");o.innerHTML="点击切换遮挡状态",o.onclick=function(){DB=!DB,e.updateBoxVisiInPano()},document.querySelector("#app").appendChild(o),o.id="shelterFilterEnable",o.style.position="fixed",o.style["z-index"]="100",o.style.background="#3e9",o.style.padding="10px",o.style.bottom="180px"}),1e3)}},{key:"load",value:function(e){var t=this,n=this.datasMixed[e]||this.datas[e];if(n){if(AB.currentPano.id==e&&!AB.flying&&this.currentId!=e){this.currentId=e;var i=n.shapes,o=n.imageHeight,r=n.imageWidth,a=i.slice();i.forEach((function(e){e.boxes&&a.push.apply(a,H(e.boxes))})),a.forEach((function(e){WB(e),jB(e,AB.currentPano);var n=e.fill_color,i=e.color,a=[].concat(H(void 0===i?[56,56,255]:i),[255]);n||(n=[255,255,255,0]),a||(a=[255,0,0,255]),e.boxes&&(a=[20,205,255,255]);var s=$B(e)?e.pano.position.distanceTo($B(e)):1,l=("fire"==e.boxType?0:-.2)/s,c=e.category+"-"+e.sid;c=[c,"sc: "+ge.toPrecision(e.score,3)],t.showSignalFrom2d(c,e.bbox2,r,o,{fill:{color:(new THREE.Color).setRGB(n[0]/255,n[1]/255,n[2]/255),opacity:n[3]/255},line:{color:(new THREE.Color).setRGB(a[0]/255,a[1]/255,a[2]/255),opacity:"cabling_rack"==e.category?.4:a[3]/255}},e.centerDir,l,"被删除"==e.state,e)}))}}else e in this.datas||setTimeout((function(){t.load(e)}),100)}},{key:"showSignalFrom2d",value:function(e,t,n,i,o,r,a,s,l){for(var c=[new THREE.Vector2(t[0],t[1]),new THREE.Vector2(t[2],t[1]),new THREE.Vector2(t[2],t[3]),new THREE.Vector2(t[0],t[3])],u=[],h=0;h<c.length;h++){var d=c[h];u.push(d)}var p=[];u.forEach((function(e){var t=GB(e,AB.currentPano);p.push(t)}));var f=(new THREE.BufferGeometry).setFromPoints(p),m=new THREE.LineBasicMaterial({color:o.line.color,opacity:o.line.opacity,transparent:!0,depthTest:!1}),v=new THREE.LineLoop(f,m);v.renderOrder=100;var g=f.clone().setIndex(new THREE.BufferAttribute(new Uint16Array([0,1,3,2,3,1]),1)),y=new THREE.MeshBasicMaterial({color:o.fill.color,opacity:o.fill.opacity,transparent:!0,side:THREE.DoubleSide,depthTest:!1}),A=new THREE.Mesh(g,y);A.renderOrder=v.renderOrder-1,v.add(A),A.visible=!1;var E=new Ce({text:e,backgroundColor:{r:255*o.line.color.r,g:255*o.line.color.g,b:255*o.line.color.b,a:.5*o.line.opacity},textColor:{r:255,g:255,b:255,a:1.1*o.line.opacity},borderRadius:15,renderOrder:v.renderOrder+1,player:AB});E.position.copy(r),E.lookAt(0,0,0),E.scale.set(.12,.12,.12);var b=new THREE.Group;b.name="rectInPano",b.position.copy(AB.currentPano.position),b.add(v),b.add(E),this.wireframes.add(b),b.label=E,b.wireframe=v,b.plane=A,s&&(E.sprite.material.opacity=.4,m.opacity*=.6,m.color.set("#efe")),b.data=l}},{key:"clear",value:function(){EB=null,bB=null,PB=new THREE.Box3,wB=null,xB=null,CB=null,SB=[]}}]),i}();function pP(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}var fP,mP,vP,gP,yP,AP,EP,bP,wP=window,xP=new THREE.Box3,CP=new THREE.Raycaster,TP=new THREE.Plane,IP=!0,kP=[],BP=null,PP=location.href.includes("192.168.0.59:")||location.href.includes("localhost:"),RP=1==Fe.valueFromUrl("showrect"),MP={yellow:new THREE.Color(238/255,217/255,35/255),green:new THREE.Color(39/255,160/255,146/255),labelYellow:{r:238,g:217,b:35,a:.5},labelGreen:{r:39,g:160,b:146,a:.5}},SP={cabinet:{widthNormal:{min:.55,max:1.05},height:{min:.3,max:2.5,standard:2},closeRatio:.7},sofa:{widthNormal:{min:.8,max:3},width:{min:1.2,max:3},thick:{min:.6,max:1.19},height:{min:.5,max:1.2,standard:1},closeRatio:.1,atWall:.3},desk:{widthNormal:{min:.55,max:3},width:{min:1,max:3},thick:{min:.5,max:.9},height:{min:.7,max:1.2,standard:1},closeRatio:2},bed:{widthNormal:{min:.9,max:2},width:{min:1.85,max:2.1},thick:{min:.8,max:1.5},height:{min:.3,max:.9,standard:.4},closeRatio:2},tv:{widthNormal:{min:.2,max:1.2},width:{min:.5,max:1.1},thick:{min:.05,max:.2},height:{min:.5,max:1.2,standard:.7},bottom:{min:.3,max:.7},atWall:.8,closeRatio:2}},DP={sofa:"CombinationSofa",desk:"Desk",bed:"DoubleBed",tv:"TV"},LP={sofa:"组合沙发",desk:"书桌",bed:"双人床",tv:"电视"},FP=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=n.bgcolor,o=n.a;new THREE.Vector3(0,-.2,0),i=i?new THREE.Color(i):{r:1,g:1,b:1},t instanceof Array||(t=[t]);for(var r=Math.round(6*Math.random())+1,a=[];r-- >0;)a.push("|");t=[].concat(H(t),a,["o"]);var s=new Ce({text:t,textColor:{r:0,g:0,b:0,a:1},backgroundColor:{r:255*i.r,g:255*i.g,b:250*i.b,a:o||0},textBorderColor:{r:255*i.r,g:255*i.g,b:250*i.b,a:o||.9},textBorderThick:2,margin:{x:0,y:0},borderRadius:0,player:fP,sizeInfo:{minSize:90,maxSize:300,nearBound:1,farBound:7}});return s.position.copy(e),vP.add(s),s.sprite.position.y+=.4*s.sprite.scale.y,s},HP=function(e){var t,n=KP(e);if(SP[e.boxType].bottom)t=n;else{var i=gP,o=[];_P(e,(function(e){e.btmPos&&o.push(e.btmPos.y)})),i=o.reduce((function(e,t){return e+t}),0),i/=o.length,t=n.clone().setY(i+e.size.y/2)}return t},VP=new THREE.BoxBufferGeometry,OP=new THREE.MeshBasicMaterial({color:MP.yellow,opacity:.3,transparent:!0,depthTest:!1}),QP=[new THREE.Vector3(-1,1,-1),new THREE.Vector3(1,1,-1),new THREE.Vector3(1,1,1),new THREE.Vector3(-1,1,1),new THREE.Vector3(-1,-1,-1),new THREE.Vector3(1,-1,-1),new THREE.Vector3(1,-1,1),new THREE.Vector3(-1,-1,1)],_P=function e(t,n){n(t),t.list&&t.list.forEach((function(t){return e(t,n)})),t.mixedFrom&&t.mixedFrom.forEach((function(t){return e(t,n)}))},zP=function(){function e(t){o(this,e),this.setFromInfo(t),this.buildFromData||(this.name=this.boxType+"-"+this.name),(this.buildFromData||IP)&&this.draw(),kP.push(this)}return u(e,[{key:"setFromInfo",value:function(e){for(var t in e)this[t]=e[t];this.position=this.buildFromData?this.center:HP(this);var n=(new THREE.Box3).setFromCenterAndSize(this.position,this.size);this.bound=n}},{key:"draw",value:function(){var e=MP.yellow;this.boxHelper=new THREE.Box3Helper(this.bound,e),this.boxHelper.material.depthTest=!1,this.boxHelper.material.transparent=!0,this.boxHelper.renderOrder=10,this.label=new Ce({text:("zh"==fP.$app.config.lang?LP[this.boxType]:DP[this.boxType])+"-"+(kP.length+1),backgroundColor:Object.assign(MP.labelYellow),textColor:{r:255,g:255,b:255,a:1},borderRadius:15,renderOrder:10,fontSize:20,player:fP,sizeInfo:{minSize:50,maxSize:200,nearBound:1,farBound:20}}),vP.add(this.label),this.label.position.copy(this.position),this.label.position.y+=.3;this.label.scale.set(.2,.2,.2);var t=new THREE.Mesh(VP,OP);t.position.copy(this.position),t.scale.copy(this.size),t.masterBox=this,t.name=this.name,t.renderOrder=20,vP.add(t),this.boxMesh=t,vP.add(this.boxHelper),bP&&this.updateVisible(!1,"unhover")}},{key:"updateVisible",value:function(e,t){De.updateVisible(this.boxHelper,t,e),De.updateVisible(this.label,t,e),De.updateVisible(this.boxMesh,t,e)}},{key:"dispose",value:function(){var e=kP.indexOf(this);e>-1&&(kP.splice(e,1),IP&&(PP?(this.label.sprite.material.opacity=.3,this.boxHelper.material.opacity=.2):(this.boxHelper.removeFromParent(),this.label.removeFromParent()),this.boxMesh.removeFromParent()))}},{key:"traversePair",value:function(e){_P(this,e)}},{key:"getDirection",value:function(){var e,t=this.xProp;if("cabinet"==this.boxType&&this.name.includes("row"))if(this.infos.rowboxs.length>1){t=this.infos.reduce((function(e,t){return e+t.k}),0)>1?"width":"thick"}else{var n=kP.filter((function(e){return"cabinet"==e.boxType&&e.name.includes("row")&&e.dirQua}));n.sort((function(e,t){return t.infos.rowboxs.length-e.infos.rowboxs.length}));var i=n[0];if(i)return this.dirQua=i.dirQua}if(!t){var o=nR();o.xWidthPossible,o.yWidthPossible,t=this.xProp}return t&&(this.panosDir||tR(this),e="width"==t?Math.abs(this.panosDir["z+"])<Math.abs(this.panosDir["z-"])?new THREE.Vector3(0,1,0):new THREE.Vector3(0,-1,0):Math.abs(this.panosDir["x+"])<Math.abs(this.panosDir["x-"])?new THREE.Vector3(-1,0,0):new THREE.Vector3(1,0,0)),this.dirQua=pt.getQuaByAim(e,new THREE.Vector3,new THREE.Vector3(0,1,0)),this.dirQua}},{key:"toJson",value:function(){var e=this,t=DP[this.boxType];if(t instanceof Array){var n=new Map;(t=t.slice(0)).forEach((function(e){return n.set(e,0)}));var i=function(e){if(e){var t=n.get(e.category)+e.score;n.set(e.category,t)}};this.traversePair((function(e){i(e.box0),i(e.box1)})),t=(t=t.sort((function(e,t){return n.get(t)-n.get(e)})))[0]}return this.getDirection(),{points:QP.map((function(t){return ge.toPrecision(convert.invertVisionVector((new THREE.Vector3).addVectors(e.position,e.size.clone().multiply(t).multiplyScalar(.5))).toArray(),4)})),category:t,type:this.boxType,sid:this.name,quaternion:this.dirQua.toArray()}}},{key:"getClosetPano",value:function(){var e=this;if(this.closetPano)return this.closetPano;this.visiPanos=fP.model.panos.list.filter((function(t){return wP.aiBox.visiInfos[t.id]?wP.aiBox.visiInfos[t.id].includes(e):e.cptVisiAtPano(t)}));var t=this.size.length(),n=De.sortByScore(this.visiPanos,[so.filters.isPanoAligned()],[function(n){return-Math.abs(t-e.position.distanceToSquared(n.position))}]).map((function(e){return e.item}));return this.closetPano=n[0],this.closetPano||(this.traversePair((function(t){var n;e.closetPano||(e.closetPano=null===(n=t.box0)||void 0===n?void 0:n.pano)})),console.log("box没找到可见的closetPano,使用了自身的一个pano",this.closetPano.id),wP.aiBox.visiInfos[this.closetPano.id]?wP.aiBox.visiInfos[this.closetPano.id].push(this):this.visiPanos.push(this.closetPano)),this.closetPano}},{key:"cptVisiAtPano",value:function(e){var t=this;6==e.id&&console.log(1);var n,i=this.bound;return n=new THREE.Box2(new THREE.Vector2(i.min.x,i.min.z),new THREE.Vector2(t.bound.max.x,t.bound.max.z)).containsPoint(new THREE.Vector2(e.position.x,e.position.z)),[new THREE.Vector3(-t.size.x/2,0,0),new THREE.Vector3(t.size.x/2,0,0),new THREE.Vector3(0,0,t.size.z/2),new THREE.Vector3(0,0,-t.size.z/2),new THREE.Vector3(0,0,t.size.y/2)].some((function(i){var o=(new THREE.Vector3).addVectors(t.position,i),r=(new THREE.Vector3).subVectors(o,e.position).normalize();if(!n&&r.dot(i)>=0)return!1;CP.set(e.position,r);var a=e.position.distanceTo(o);CP.far=a;var s=CP.intersectObjects(wP.aiBox.boxesSolid.filter((function(e){return e!=t})).map((function(e){return e.boxMesh})));return!(s&&s.length)}))&&function(){var t=[new THREE.Vector3(i.min.x,i.min.y,i.min.z),new THREE.Vector3(i.min.x,i.min.y,i.max.z),new THREE.Vector3(i.max.x,i.min.y,i.max.z),new THREE.Vector3(i.max.x,i.min.y,i.min.z),new THREE.Vector3(i.max.x,i.max.y,i.min.z),new THREE.Vector3(i.min.x,i.max.y,i.min.z),new THREE.Vector3(i.min.x,i.max.y,i.max.z),new THREE.Vector3(i.max.x,i.max.y,i.max.z)],n=t.some((function(t){return!pt.ifIntersectChunks(e.position,t,fP.model,{extLen:0})}));if(n){var o,r=null===(o=fP.$app.store.getValue("flooruser"))||void 0===o?void 0:o.floors,a=null==r?void 0:r.find((function(t,n){return(n=fP.model.floors.list.length>1?null!=t.subgroup?t.subgroup:t.id:n)==e.floorIndex}));a&&(n=t.slice(0,4).some((function(t){return!fP.labelManager.isShelter(a,t,e.position,!1,!0)})))}return n}()}}]),e}(),UP=function(e,t){var n=-e.x*(2*Math.PI),i=Math.PI/2-e.y*Math.PI,o=new THREE.Vector3;return o.copy(to.RIGHT).applyAxisAngle(to.BACK,i).applyAxisAngle(to.UP,n).applyQuaternion(t.quaternion),o},NP=function(e){if(!e.centerDir){var t=e.bbox2,n={x:JP(t[0],t[2]),y:(t[1]+t[3])/2};e.bbox2CenterX=n.x;var i=UP(n,e.pano);e.centerDir=i;var o={x:n.x,y:t[1]};e.centerTopDir=UP(o,e.pano);var r={x:n.x,y:t[3]};e.centerBtmDir=UP(r,e.pano);var a={x:t[0],y:t[3]};e.leftBtmDir=UP(a,e.pano);var s={x:t[2],y:t[3]};e.rightBtmDir=UP(s,e.pano)}},GP=function(e){if(e.boxType){var t=SP[e.boxType];if(IP){if(!e.posAtWall&&t.atWall>0){var n=t.thick?(t.thick.min+t.thick.max)/2:t.widthNormal.min;CP.set(e.pano.position,e.centerDir);var i=CP.intersectObjects(fP.model.colliders);if(i[0]&&t.atWall>.6){e.posAtWall=(new THREE.Vector3).addVectors(e.pano.position,e.centerDir.clone().multiplyScalar(i[0].distance-n));var o,r=null===(o=i[0].face.normal)||void 0===o?void 0:o.clone().applyMatrix4(i[0].object.matrixWorld);r&&(Math.abs(r.z)>.8?(e.xProp="width",e.yProp="thick"):Math.abs(r.x)>.8&&(e.xProp="thick",e.yProp="width"))}}e.btmPos||ZP(e),e.topPos||YP(e)}else if(!t.bottom&&(CP.set(e.pano.position,e.centerBtmDir),e.btmPosPredict=CP.ray.intersectPlane(TP,new THREE.Vector3),e.btmPosPredict)){var a=new THREE.Vector2(e.centerBtmDir.x,e.centerBtmDir.z).normalize(),s=SP[e.boxType].widthNormal,l=s.min,c=s.max;l*=.4,c*=.4;var u=Math.min(Math.abs(a.x),Math.abs(a.y)),h=ge.linearClamp(u,0,1,l,c);a=a.clone().multiplyScalar(h),e.btmPosPredict.x+=a.x,e.btmPosPredict.z+=a.y}}},jP=function(e,t,n){e.bbox2||(t||(t=wP.aiBox.datas[e.pano.id].imageWidth,n=wP.aiBox.datas[e.pano.id].imageHeight),t==t&&n==n||console.log(t,n),e.bbox2=e.bbox.map((function(e,i){return i%2==0?e/t:e/n})))},WP=function(e,t,n){eR(e),jP(e,t,n),NP(e),GP(e)},qP=function(e,t){return Math.abs(e-t)<.5||(e>t?e-=1:t-=1),e-t},JP=function(e,t){return Math.abs(e-t)>.5?(e+t+1)/2:(e+t)/2},YP=function(e){if(e.box1){var t=XP(e.box0.pano.position,e.box0.centerTopDir,e.box1.pano.position,e.box1.centerTopDir);e.topPos=t.pos3d,e.diffHeight=t.mid2?t.mid2.distanceTo(t.mid1):1,e.box0.topPos&&e.box1.topPos&&(e.topPos.y=(e.box0.topPos.y+e.box1.topPos.y)/2)}else{var n=e.box0||e,i=n.btmPos;i||(i=ZP(e)),n.topPos=i.clone();var o,r=i.x-n.pano.position.x,a=i.z-n.pano.position.z;o=Math.abs(r)<Math.abs(a)?a*n.centerTopDir.y/n.centerTopDir.z:r*n.centerTopDir.y/n.centerTopDir.x,n.topPos.y=o+n.pano.position.y;var s=SP[eR(n)].height.min,l=Math.max(n.topPos.y-i.y,s);n.topPos.y=i.y+l,e.topPos=n.topPos}return e.topPos},ZP=function(e){if(e.box1)e.btmPos=(new THREE.Vector3).addVectors(e.box0.btmPos,e.box1.btmPos).multiplyScalar(.5);else{var t=e.box0||e;if(!t.btmPos){if("pano23-0"==t.sid&&(console.log(3),t.pano.position,t.centerBtmDir),!IP)return t.btmPosPredict;var n=[t.centerBtmDir];n.push(t.leftBtmDir,t.rightBtmDir);var i=fP.model.colliders.concat([mP]),o=1/0;if(n.forEach((function(e,n){CP.set(t.pano.position,e);var r=CP.intersectObjects(i);0==n&&(t.btmPosOri=r[0].point.clone()),o=Math.min(r[0].point.y,o)})),t.btmPosOri.y-o>.01){var r=t.pano.position,a=(r.y-o)/(r.y-t.btmPosOri.y),s=(new THREE.Vector3).subVectors(t.btmPosOri,r).multiplyScalar(a);t.btmPosOri=(new THREE.Vector3).addVectors(r,s)}t.btmPosOri.y=o,t.pose=oR(t,t.btmPosOri);var l=0;eR(t);var c,u=new THREE.Vector2(t.centerBtmDir.x,t.centerBtmDir.z).normalize();if(SP[t.boxType].thick&&t.pose.predict){var h=SP[t.boxType].widthNormal,d=h.min,p=h.max;d*=.24,p*=.4,t.pose.predict&&!t.xProp?(t.xProp=t.pose.predict.x>=t.pose.predict.y?"width":"thick",t.yProp=t.pose.predict.x<t.pose.predict.y?"width":"thick"):t.xProp,t.xProp&&(l="width"==t.xProp?ge.linearClamp(Math.abs(u.x),0,1,d,p):ge.linearClamp(Math.abs(u.y),0,1,d,p))}else{var f=SP[t.boxType].thick||SP[t.boxType].widthNormal,m=(f.min+f.max)/2,v=.5*m,g=.8*m,y=Math.min(Math.abs(t.centerBtmDir.x),Math.abs(t.centerBtmDir.z));l=ge.linearClamp(y,0,.707,v,g)}c||(c=u.clone().multiplyScalar(l)),t.btmPos=t.btmPosOri.clone(),t.btmPos.x+=c.x,t.btmPos.z+=c.y}e.btmPos=t.btmPos}return e.btmPos},XP=function(e,t,n,i){var o=(new THREE.Vector3).addVectors(e,t),r=(new THREE.Vector3).addVectors(n,i),a=ge.getLineIntersect2({A:e.clone(),B:n.clone(),p1:o,p2:r,dir0:t,dir1:i});return a.pos3d||console.error("getIntersect2 no result? ?"),a},KP=function(e){var t=eR(e),n=e.preDealRes&&e.preDealRes.position||e.center;return!n&&t&&(e.category&&GP(e),SP[t].atWall>.5&&SP[t].bottom&&(n=e.posAtWall),n||(n=e.btmPos||e.btmPosPredict||e.posAtWall)),n},$P=function(e,t){return t==e||DP[t]instanceof Array?DP[t].includes(e):DP[t]==e},eR=function(e){if(e.boxType)return e.boxType;var t=e.category||e.box0.category;if("rowBigBox"==t)e.boxType="rowBigBox";else{var n;for(var i in"ac_switchboard"==t&&console.log(1),DP)if($P(t,i)){n=i;break}e.boxType=n}return e.boxType},tR=function(e,t){t=t||KP(e);var n={"x+":0,"x-":0,"z+":0,"z-":0,got:!1};return!n.got&&t&&(fP.model.panos.list.forEach((function(e){var i=(new THREE.Vector3).subVectors(e.position,t);i.x>0?n["x+"]+=i.x:n["x-"]+=i.x,i.z>0?n["z+"]+=i.z:n["z-"]+=i.z})),n.got=!0),e.panosDir&&console.error("already has dir"),e.panosDir=n,n},nR=function(e,t){},iR=function(e){if(!e.preDealRes&&e.center){e.preDealRes={},e.boxType||eR(e);var t,n=SP[e.boxType];n.widthNormal.min;var i=yP.distanceToPoint(e.center);if("pano2-5"==e.name&&console.log(4),i>.3&&!n.tiny&&!n.tinyXZ){var o=e.center.clone().clamp(yP.min,yP.max);e.preDealRes.position=o,eR(e),t=!0}var r=KP(e);!t&&e.boxposes||(e.boxposes=[],[e.box0,e.box1].forEach((function(t){t&&e.boxposes.push(oR(t,r))})))}},oR=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=SP[e.boxType],o=qP(e.bbox2[2],e.bbox2[0])*Math.PI,r=(new THREE.Vector3).subVectors(e.pano.position,t).setY(0).length()+n,a=2*Math.tan(o)*r,s=e.centerDir.clone().setY(0).normalize(),l=ge.getNormal({points:[{x:0,y:0},{x:s.x,y:s.z}]});l.x=Math.abs(l.x),l.y=Math.abs(l.y),"pano27-0"==e.sid&&console.log(7);var c,u,h,d,p,f,m,v=i.widthNormal.max,g=i.widthNormal.min;if(SP[e.boxType].thick){var y=i.thick.min,A=i.width.min,E=i.thick.max,b=i.width.max,w=Math.max(l.x,l.y);if(Math.min(l.x,l.y),w>.8){m={};var x=["x","y"],C=l.x>l.y?0:1,T=THREE.MathUtils.clamp(a,y,b),I=(T-y)/(b-y),k=ge.linearClamp(1-I,0,1,y,b);T<E&&T<A?k=Math.max(A,k):T>A&&T>E&&(k=Math.min(E,k)),m[x[C]]=T,m[x[(C+1)%2]]=k}var B=l.x*b+l.y*E,P=l.x*E+l.y*b,R=l.x*A+l.y*y,M=l.x*y+l.y*A;c=Math.min(R,M),u=Math.max(B,P),l.x,l.y,h=THREE.MathUtils.clamp((a-y*l.y)/l.x,y,b),d=THREE.MathUtils.clamp((a-y*l.x)/l.y,y,b),p=THREE.MathUtils.clamp((a-b*l.y)/l.x,y,b),f=THREE.MathUtils.clamp((a-b*l.x)/l.y,y,b)}else c=(l.x+l.y)*g,u=(l.x+l.y)*v,h=THREE.MathUtils.clamp((a-g*l.y)/l.x,g,v),d=THREE.MathUtils.clamp((a-g*l.x)/l.y,g,v),p=THREE.MathUtils.clamp((a-v*l.y)/l.x,g,v),f=THREE.MathUtils.clamp((a-v*l.x)/l.y,g,v);var S={predict:m,box:e,projectWidth:a,camTangent:l,maxProjectWidth:u,minProjectWidth:c,dis:r,maxX:h,maxY:d,minX:p,minY:f};return i.atWall,S},rR=function(e,t){var n=0;if(2==e.length&&e[0].predict&&e[1].predict)return 100*-(n=Math.abs(e[0].predict.x-e[1].predict.x)+Math.abs(e[0].predict.y-e[1].predict.y));if(e.forEach((function(i){i.lowR=i.dis<1.5?Math.pow(i.dis/1.5,1.4):1,i.projectWidth>i.maxProjectWidth?n+=500*Math.pow((i.projectWidth/i.maxProjectWidth-1)*i.lowR,2):i.projectWidth<i.minProjectWidth&&(n+=500*Math.pow((i.minProjectWidth/i.projectWidth-1)*i.lowR,2));var o=SP[t].widthNormal,r=o.min;if(o.max,1==SP[t].atWall&&r<.3||2==e.length&&"battery"==t){var a=SP[t].widthNormal,s=a.min,l=a.max-s,c=ge.linearClamp(i.projectWidth,s,s+.5*l,600,0);n+=c}})),n=Math.min(n,1300),2==e.length){var i=new THREE.Vector2(Math.abs(e[0].camTangent.x),Math.abs(e[0].camTangent.y)),o=new THREE.Vector2(Math.abs(e[1].camTangent.x),Math.abs(e[1].camTangent.y)),r=i.dot(o);if(r>.8){var a=Math.abs(e[0].projectWidth-e[1].projectWidth);e.score2=r*a*1300*e[0].lowR*e[1].lowR,n+=e.score2}e.camTangentCos=r}return-(n=Math.min(n,1200))},aR=function(e){if(!e.size){var t,n,i="",o="";"pano6-0&pano5-0"==e.name&&console.log(6);var r,a,s,l=KP(e);if(e.predictSize)t=r=e.predictSize.x,n=a=e.predictSize.y;else{var c=function(t){var n,i,o,s,l=SP[e.boxType].width,c=SP[e.boxType].thick;return"width"==e.xProp?(n=THREE.MathUtils.clamp(e.boxposes[0].maxX,l.min,l.max),i=THREE.MathUtils.clamp(e.boxposes[0].maxY,c.min,c.max),o=THREE.MathUtils.clamp(e.boxposes[0].minX,l.min,l.max),s=THREE.MathUtils.clamp(e.boxposes[0].minY,c.min,c.max)):(n=THREE.MathUtils.clamp(e.boxposes[0].maxX,c.min,c.max),i=THREE.MathUtils.clamp(e.boxposes[0].maxY,l.min,l.max),o=THREE.MathUtils.clamp(e.boxposes[0].minX,c.min,c.max),s=THREE.MathUtils.clamp(e.boxposes[0].minY,l.min,l.max)),{x:r=(n+o)/2,y:a=(i+s)/2}};if(e.box1)if(e.box0.xProp&&e.box0.xProp==e.box1.xProp){e.xProp=e.box0.xProp,e.yProp=e.box0.yProp;var u=c(e.box0),h=c(e.box1);t=(u.x+h.x)/2,n=(u.y+h.y)/2}else{var d=e.boxposes[0].camTangent.x,p=e.boxposes[1].camTangent.x,f=e.boxposes[0].camTangent.y,m=e.boxposes[1].camTangent.y,v=THREE.MathUtils.clamp(e.boxposes[0].projectWidth,e.boxposes[0].minProjectWidth,1.1*e.boxposes[0].maxProjectWidth),g=THREE.MathUtils.clamp(e.boxposes[1].projectWidth,e.boxposes[1].minProjectWidth,1.1*e.boxposes[1].maxProjectWidth);((t=0==d?(g-m*(n=v))/p:(v-f*(n=(g-p/d*v)/(m-p/d*f)))/d)<.3||t>1.4)&&(i+=" x:"+ge.toPrecision(t,2)),(n<.3||n>1.4)&&(i+=" y:"+ge.toPrecision(n,2)),(n<0||t<0)&&(o=t<0?"x<0!":"y<0!"),r=t,a=n}else if(e.xProp){var y=c();t=y.x,n=y.y}else if(e.boxposes[0].predict)t=e.boxposes[0].predict.x,n=e.boxposes[0].predict.y;else{var A=SP[e.boxType].widthNormal;t=r=THREE.MathUtils.clamp((e.boxposes[0].maxX+e.boxposes[0].minX)/2,A.min,A.max),n=a=THREE.MathUtils.clamp((e.boxposes[0].maxY+e.boxposes[0].minY)/2,A.min,A.max)}}if(SP[e.boxType].bottom)if(s=SP[e.boxType].height.standard,ZP(e),s){var E=l.y-e.btmPos.y;l.y-=THREE.MathUtils.clamp((E-s/2)/2,-.1,.1)}else{var b=e.btmPos.y;s=2*(l.y-b)}else{e.topPos||YP(e),e.btmPos||ZP(e);var w=e.btmPos.y;s=e.topPos.y-w}var x=sR(t,s,n,e);t=x.x,s=x.y,n=x.z,SP[e.boxType].widthSame&&(t=n=(t+n)/2),e.size=new THREE.Vector3(t,s,n),e.sizeAdjust=Math.pow(Math.abs(t-r),1.3)+Math.pow(Math.abs(n-a),1.3),e.sizeAdjust&&(e.score=(e.score||0)-Math.min(100*e.sizeAdjust,400)),e.size.oriX=r,e.size.oriY=a,e.exStr=i,e.warnStr=o}},sR=function(e,t,n,i){var o,r=i.xProp,a=i.yProp;if(null!=r){var s=SP[i.boxType][r],l=s.min,c=s.max;e=THREE.MathUtils.clamp(e,l,c);var u=SP[i.boxType][a];l=u.min,c=u.max;n=THREE.MathUtils.clamp(n,l,c),o=!0}if(!o){var h=SP[i.boxType].widthNormal;l=h.min,c=h.max;e=THREE.MathUtils.clamp(e,l,c),n=THREE.MathUtils.clamp(n,l,c)}var d=SP[i.boxType].height;l=d.min,c=d.max;return{x:e,y:t=THREE.MathUtils.clamp(t,l,c),z:n}},lR=function(e,t){var n=new THREE.Box2;return n.min.set(Math.max(e.min.x,t.min.x),Math.max(e.min.y,t.min.y)),n.max.set(Math.min(e.max.x,t.max.x),Math.min(e.max.y,t.max.y)),n},cR=function(e){var t=e.map((function(e){return e.bbox2[0]})),n=e.map((function(e){return e.bbox2[2]}));return t.sort((function(e,t){return qP(e,t)})),n.sort((function(e,t){return qP(t,e)})),{leftX:t[0],rightX:n[0]}};wP.searchCount1=0,wP.escapeCount1=0;var uR=function e(t,n,i,o,r,a,s){var l=[],c=!!o,u=function(){if(c){var e=r.indexOf(o);r.splice(e,1),c=!1}};if(!o){if(0==n.length||0==i.length)return;if(n.length>i.length){var h=n;n=i,i=h}t=n[0];var d=Object.keys(wP.aiBox.datas).length;d<10?a=null:s=ge.linearClamp(d,10,80,-4e3,-500)}searchCount1++;for(var p=0;p<i.length;p++){l=[t,i[p]];var f=void 0;if(a&&(null==(f=a(l[0],l[1]))||f.score<=s))escapeCount1++;else{var m=void 0;o?(u(),(m=o.slice(0)).push(l)):m=[l],r.push(m);var v=n.slice(0),g=i.slice(0),y=v.indexOf(l[0]);v.splice(y,1),y=g.indexOf(l[1]),g.splice(y,1),v.length>0&&g.length>0&&e(v[0],v,g,m,r,a,s)}}},hR=function(e){f(i,THREE.Group);var t,n=pP(i);function i(e,t,r){var a;return o(this,i),(a=n.call(this)).clear(),(fP=e).model.add(h(a)),Fe.urlHasValue("ext")&&(bP=(EP=!0)&&!Fe.urlHasValue("ctrl")),a.ifAnalyze=!0,a.wireframes=new THREE.Object3D,a.wireframes.name="wireframes",a.add(a.wireframes),a.matchScoreMap={},a.bindEvents(),(vP=new THREE.Object3D).name="testBox",a.add(vP),a.visiInfos={},t&&a.compute(r),wP.aiBox=h(a),a}return u(i,[{key:"compute",value:(t=k(S.mark((function e(t){var n,i,o,r,a=this;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:r=function(){return(r=k(S.mark((function e(){var t,n=this;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if("local"!=fP.$app.config.deploy||fP.$app.config.server){e.next=7;break}return e.next=3,ri.get(fP.$app.resource.getViewResourceURL("images/ai.json?".concat((new Date).getTime())));case 3:t={data:t=e.sent,success:!0},e.next=10;break;case 7:return e.next=9,ri.post("/service/shapes/sceneMarkShape/box4/getInfos",{num:fP.$app.config.num,type:1});case 9:t=e.sent;case 10:if(t.data&&t.success){e.next=12;break}return e.abrupt("return");case 12:EP&&((t.data.box8.dataSet.boxes||t.data.box8.dataSet).forEach((function(e){var t=ge.convertVisionVector((new THREE.Vector3).fromArray(e.points[0])),n=ge.convertVisionVector((new THREE.Vector3).fromArray(e.points[1])),i=ge.convertVisionVector((new THREE.Vector3).fromArray(e.points[2])),o=ge.convertVisionVector((new THREE.Vector3).fromArray(e.points[4])),r=new THREE.Vector3(t.distanceTo(n),t.y-o.y,i.distanceTo(n)),a=(new THREE.Vector3).addVectors(i,o).multiplyScalar(.5);new zP({buildFromData:!0,center:a,size:r,boxType:e.type,name:e.sid,external:e.external})})),this.ifAnalyze=!1,this.visible=!1),EP&&!Fe.urlHasValue("ctrl")||((Array.isArray(t.data)?t.data:t.data.box4).forEach((function(e){var t=e.imagePath.split(".jpg")[0];n.datas[t]=e})),this.visible=!0),i();case 15:case"end":return e.stop()}}),e,this)})))).apply(this,arguments)},o=function(){return r.apply(this,arguments)},AP=Date.now(),this.startToCompute=!0,this.datas={},this.datasMixed={},this.boxesSolid=kP,n=function(){var e=function(e,t){var n,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},o=i.isSingle,r=i.center,s=i.onlyGet,l=i.dontCheckDis,c=e.sid+"&"+t.sid,u=t.sid+"&"+e.sid,h=eR(e),d=a.matchScoreMap[h].get(c),p=a.matchScoreMap[h].get(u),f=d||p;if(s)return f;if(f)return f;f={name:n=c,box0:e,box1:t,center:r},a.matchScoreMap[h].set(n,f),n.includes("pano6-2&pano5-3")&&console.log(5),WP(e),WP(t);var m=e.pano.position.clone(),v=t.pano.position.clone(),g=(new THREE.Vector3).subVectors(v,m),y=new THREE.Vector2(g.x,g.z).normalize(),A=r?new THREE.Vector2(r.x-m.x,r.z-m.z).normalize():new THREE.Vector2(e.centerDir.x,e.centerDir.z).normalize(),E=r?new THREE.Vector2(r.x-v.x,r.z-v.z).normalize():new THREE.Vector2(t.centerDir.x,t.centerDir.z).normalize(),b=Math.acos(y.dot(A)),w=Math.PI-Math.acos(y.dot(E)),x=100,C=[];if(b+w>Math.PI+.2)return Object.assign(f,{score:-5e3,str:["angle>180"]});if(e.type!=t.type)return Object.assign(f,{score:-5e3,str:["typeNotSame"]});if(null==f.dirAngleXZ&&(f.dirAngleXZ=THREE.MathUtils.radToDeg(Math.acos(A.dot(E))),f.minAng=Math.min(180-f.dirAngleXZ,f.dirAngleXZ),o)){var T=2;x+=300*Math.sin(THREE.MathUtils.degToRad(f.dirAngleXZ)),x+=f.dirAngleXZ,x-=10*Math.abs(KP(e).distanceToSquared(e.pano.position)-T),x-=10*Math.abs(KP(t).distanceToSquared(t.pano.position)-T)}var I=1,k=e.btmPos||e.btmPosPredict,B=t.btmPos||t.btmPosPredict;if(!l){var P=THREE.MathUtils.clamp(.8/SP[h].widthNormal.max,.6,2);if(!SP[h].bottom&&k&&B){var R=k.distanceToSquared(B);if(f.btmPosPreDis=R,x-=1300*R*P*I,t.topPos){var M=e.topPos.distanceToSquared(t.topPos);f.topPosPreDis=M;var S=700*M*P*I,D=new THREE.Vector2(k.x-m.x,k.z-m.z).lengthSq(),L=new THREE.Vector2(B.x-v.x,B.z-v.z).lengthSq();(D<.4||L<.4)&&(S*=.3),x-=S}}else if(e.posAtWall&&t.posAtWall){var F=e.posAtWall.distanceToSquared(t.posAtWall);f.wallPosPreDis=F,x-=200*F*P,F=e.btmPosOri.distanceToSquared(t.btmPosOri),f.btmPosPreDis=F,x-=200*F*P*I}}if(!f.center){var H=XP(m,e.centerDir,v,t.centerDir);f.center=H.pos3d.clone();var V,O=(new THREE.Vector3).subVectors(H.pos3d,m).normalize(),Q=(new THREE.Vector3).subVectors(H.pos3d,v).normalize(),_=O.dot(e.centerDir)+Q.dot(t.centerDir),z=_<1.95;if(x-=1e4*(2-_),z)return C.push("wrongDir"),Object.assign(f,{score:x-5e3,str:C});if(!l&&!SP[h].bottom&&e.btmPos&&t.btmPos){var U=new THREE.Vector2(e.btmPos.x,e.btmPos.z),N=new THREE.Vector2(t.btmPos.x,t.btmPos.z),G=new THREE.Vector2(f.center.x,f.center.z),j=U.distanceToSquared(G)+N.distanceToSquared(G),W=ge.linearClamp(f.minAng,0,20,0,1);x-=1500*j*W,f.centerDrift=j}ZP(f);var q=SP[e.boxType].atWall;V=q?ge.linearClamp(f.minAng,2,15,0,Math.min(1,.1/q)):1==q?ge.linearClamp(f.minAng,2,15,0,1):ge.linearClamp(f.minAng,2,20,0,.4);var J=!SP[h].bottom&&e.btmPos||e.posAtWall||f.topPos,Y=!SP[h].bottom&&t.btmPos||t.posAtWall||f.topPos,Z=.5,X=(new THREE.Vector3).addVectors(f.center.clone().multiplyScalar(1-Z),f.btmPos.clone().multiplyScalar(Z)).setY(H.pos3d.y);f.center=J&&Y?(new THREE.Vector3).addVectors(X.clone().multiplyScalar(V),J.clone().add(Y).multiplyScalar(.5*(1-V))).setY(H.pos3d.y):X,f.cIntersect=X}eR(f);var K,$=(new THREE.Vector3).subVectors(e.pano.position,f.center),ee=(new THREE.Vector3).subVectors(t.pano.position,f.center);if($.x*ee.x>0&&$.z*ee.z>0&&(x-=200),!yP.containsPoint(f.center)){var te=yP.distanceToPoint(f.center);if(x-=1e3*te*te,C.push("outsideBound"),Object.assign(f,{score:x,str:C,center:f.center,disToBound:te}),te>.5)return f}var ne=function(){K=[],[e,t].forEach((function(e){var t=oR(e,f.center);K.push(t)}))};return ne(),x+=rR(K,h),Object.assign(f,{score:x,str:C,boxposes:K})};a.rows={};var t=function(e){var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=n.reason,o=void 0===i?"row":i,r=e[0].pano,s=e[0].category,l=s+"|"+o;if(a.rows[l]||(a.rows[l]={}),a.rows[l][r.id])return a.rows[l][r.id];for(var c={sid:"pano"+r.id+("mix"==o?"-mix":"-row"),pano:r,category:"mix"==o?s:"rowBigBox",boxType:"mix"==o?e[0].boxType:"rowBigBox"},u=[],h=0;h<e.length;h++){var d=e[h];WP(d);for(var p=[d.bbox2[0],d.bbox2[2]],f=p[0],m=p[1],v=h+1;v<e.length;v++){var g=e[v];if(WP(g),d.boxType==d.boxType){var y=[g.bbox2[0],g.bbox2[2]],A=y[0],E=y[1],b=qP(A,m),w=qP(A,f),x=qP(f,E);"pano2-4"==d.sid&&"pano2-5"==g.sid&&console.log(9);var C="mix"==o?.004:.003;if(b<=C&&w>=C||x<=C&&w<=C){var T=A<.002&&m>.998?[A,m]:f<.002&&E>.998?[f,E]:null;if("mix"==o&&!T)continue;var I=SP[d.boxType].widthNormal.max,k=I*I*("mix"==o?.7:1.8),B=1==SP[d.boxType].atWall?d.posAtWall:"mix"==o?d.btmPosOri||d.btmPosPredict:d.btmPos,P=1==SP[g.boxType].atWall?g.posAtWall:"mix"==o?g.btmPosOri||g.btmPosPredict:g.btmPos,R=B.distanceToSquared(P);if("mix"==o){var M=d.bbox2[3]-d.bbox2[1]+(g.bbox2[3]-g.bbox2[1]),S=Math.max(d.bbox2[3],g.bbox2[3])-Math.min(d.bbox2[1],g.bbox2[1]),D=M-S,L=4*(1-D/S+3*(S-D))*k;R+=L;var F=T?.002/(T[0]+(1-T[1])):0;R-=(F=Math.min(6,F))*k}R<k&&De.pushToGroupAuto([d,g],u)}}}}return u.forEach((function(e){e.sort((function(e,t){return qP(e.bbox2CenterX,t.bbox2CenterX)}))})),"row"==o&&(u.slice(0).forEach((function(e){if(e.length>=2){for(var t=[],n=new THREE.Box2,i=new THREE.Vector2,o=0,r=e.length;o<r;o++){var a=e[o],s=new THREE.Vector2(a.btmPos.x,a.btmPos.z);n.expandByPoint(s),n.getSize(i),Math.min(i.x,i.y)>.6&&(t.push([e[o],e[o-1]]),(n=new THREE.Box2).expandByPoint(s))}t.length&&De.disconnectGroup(t,u).newGroups}})),u.forEach((function(e){e.sort((function(e,t){return qP(e.bbox2CenterX,t.bbox2CenterX)}))}))),u.sort((function(e,t){return t.length-e.length})),t=u.map((function(e,t){var n=cR(e),i=n.leftX,o=n.rightX,r=e.slice().sort((function(e,t){return e.bbox2[1]-t.bbox2[1]}))[0].bbox2[1],a=e.slice().sort((function(e,t){return t.bbox2[3]-e.bbox2[3]}))[0].bbox2[3],s=Object.assign({},c,{boxes:e,bbox2:[i,r,o,a],left:e.find((function(e){return e.bbox2[0]==i})),right:e.find((function(e){return e.bbox2[2]==o}))}),l=KP(s.left),u=KP(s.right),h=new THREE.Vector2(l.x-u.x,l.z-u.z);return s.k=Math.abs(h.x/h.y),s.predictLen=(s.k>1?Math.abs(h.x):Math.abs(h.y))+.6,s})),"mix"!=o&&e.forEach((function(e){if(!u.some((function(t){return t.includes(e)}))){var n=Object.assign({},c,{bbox2:e.bbox2,boxes:[e],left:e,right:e});t.push(n)}})),t.forEach((function(e){e.sid+="-"+e.boxes.map((function(e){return e.index})).join(","),"row"==o&&(e.boxes[0].btmPos&&(e.btmPos=e.boxes.reduce((function(e,t){return e.add(t.btmPos)}),new THREE.Vector3).multiplyScalar(1/e.boxes.length)),e.boxes[0].topPos&&(e.topPos=e.boxes.reduce((function(e,t){return e.add(t.topPos)}),new THREE.Vector3).multiplyScalar(1/e.boxes.length)),e.boxes[0].posAtWall&&(e.posAtWall=e.boxes.reduce((function(e,t){return e.add(t.posAtWall)}),new THREE.Vector3).multiplyScalar(1/e.boxes.length)))})),a.rows[l][r.id]=t,t},n=function(n,i){a.matchScoreMap.rowBigBox=new Map;var o=new Map,r=function(t,n,i){var r=t.sid+"&"+n.sid,a=o.get(r);if(a)return a;if(t.boxes.length==n.boxes.length||i){var s;if(t.boxes.length>1&&n.boxes.length>1){var l,c,u=[t.left,n.left],h=[t.right,n.right],d=function(e,t){var n,i,o=!1,r=[e.left,t.left],a=[e.right,t.right];r[0].btmPos.distanceToSquared(r[1].btmPos)+a[0].btmPos.distanceToSquared(a[1].btmPos)>r[0].btmPos.distanceToSquared(a[1].btmPos)+a[0].btmPos.distanceToSquared(r[1].btmPos)?(o=!0,n=(new THREE.Vector3).addVectors(r[0].btmPos,a[1].btmPos).multiplyScalar(.5),i=(new THREE.Vector3).addVectors(a[0].btmPos,r[1].btmPos).multiplyScalar(.5)):(n=(new THREE.Vector3).addVectors(r[0].btmPos,r[1].btmPos).multiplyScalar(.5),i=(new THREE.Vector3).addVectors(a[0].btmPos,a[1].btmPos).multiplyScalar(.5));var s=new THREE.Vector2(n.x-i.x,n.z-i.z);return{reversed:o,k:Math.abs(s.x/s.y)}}(t,n),p=t.predictLen,f=n.predictLen,m=Math.abs(p-f);if(m>1)return D();d.reversed?(l=e(u[0],h[1],{isSingle:!0}),c=e(h[0],u[1],{isSingle:!0})):(l=e(u[0],u[1],{isSingle:!0}),c=e(h[0],h[1],{isSingle:!0}));var v=KP(l),g=KP(c);if(!v||!g||l.score<-4e3||c.score<-4e3)return D();iR(l),iR(c),v=KP(l),g=KP(c);var y=new THREE.Vector2(v.x-g.x,v.z-g.z),A=Math.abs(y.x/y.y);if(d.k>1&&A<1||d.k<1&&A>1)return console.error("请检查!info2.k > 1 && k < 1 || info2.k < 1 && k > 1",t.sid,"和",n.sid),D();var E=0;if((t.k>1&&n.k<1||t.k<1&&n.k>1)&&(E=t.k/n.k)<1&&(E=1/E),A<1&&v.z>g.z||A>1&&v.x>g.x){var b=g;g=v,v=b}var w=(new THREE.Vector3).addVectors(v,g).multiplyScalar(.5);w.add(t.btmPos).add(n.btmPos).multiplyScalar(1/3);var x=e(t,n,{isSingle:!0,center:w}),C=x.score-1e3*m-100*E+l.score+c.score;if(C<-4e3)return D();s={rowBigBox0:t,rowBigBox1:n,match:x,k:A,posLeft:v,posRight:g,score:C/3+500,reversed:d.reversed}}else if(1==t.boxes.length&&1==n.boxes.length)s=e(t.boxes[0],n.boxes[0]);else{var T=t.boxes.length>1?t:n,I=1==t.boxes.length?t:n;(s=e(t,n,{dontCheckDis:!0})).k=T.k,s.center&&s.center.add(KP(T)).multiplyScalar(.5),"pano0-row-14&pano4-row-8,11"==s.name&&FP(s.center,"c"),s.predictSize=s.k>1?{x:T.predictLen,y:.6}:{y:T.predictLen,x:.6};var k=KP(T.left).distanceToSquared(I.pano.position)<KP(T.right).distanceToSquared(I.pano.position)?T.left:T.right,B=KP(I),P=KP(k).distanceToSquared(B);s.score-=1e3*P;var R=KP(T),M=new THREE.Vector2(R.x-I.pano.position.x,R.z-I.pano.position.z).normalize(),S=new THREE.Vector2(I.centerDir.x,I.centerDir.z).normalize();s.score+=1e3*(M.dot(S)-1)}return D(s),s}function D(e){o.set(r,e)}},s=[],l=1==n.filter((function(e){return e.length>1})).length,c=IP?-2e3:-800,u=function(e){"second"==e&&(l=!0);for(var i=0;i<n.length-1;i++){var a=t(n[i]),u=n[i][0].pano;"second"==e&&(a=a.filter((function(e){return!s.some((function(t){return t.includes(e)}))})));for(var h=function(i){var h=t(n[i]);"second"==e&&(h=h.filter((function(e){return!s.some((function(t){return t.includes(e)}))})));var d=n[i][0].pano;54==u.id&&56==d.id&&console.log(2);var p=[];uR(null,a.slice(),h.slice(),null,p,(function(e,t){return r(e,t,l)})),(p=p.map((function(e){var t=e.map((function(e){return e.some((function(e){return"void"==e.sid}))?null:r(e[0],e[1],l)})),n=t.reduce((function(e,t){return e+(t&&t.score>c?t.score:c/2)}),0);return{pairs:e,infos:t,score:n,name:e.map((function(e){return e.map((function(e){return e.sid})).join(" & ")}))}}))).sort((function(e,t){return t.score-e.score})),p[0]&&p[0].pairs.forEach((function(e,t){var n=p[0].infos[t];if(n&&n.score>c){var i=e.filter((function(e){return"void"!=e.sid}));De.pushToGroupAuto(i,s,null,(function(e){if(!n.k)return!0;var t=e.relationships[0],i=t[0].sid+"&"+t[1].sid;return!o.get(i).k||o.get(i).k<1&&n.k<1||o.get(i).k>1&&n.k>1||void console.log("k不一致无法匹配",n,e)}))}}))},d=i+1;d<n.length;d++)h(d)}};u(),l||u("second");var h=[],d=function e(t){var n=new THREE.Vector3,i=new THREE.Vector3,r=0,a=[],l={};if(t.relationships.forEach((function(e){var t=e[0].sid+"&"+e[1].sid,s=o.get(t);s.posLeft?(n.add(s.posLeft),i.add(s.posRight),r++):(a.push(s),iR(s),aR(s))})),r>0){n.multiplyScalar(1/r),i.multiplyScalar(1/r);var c=(new THREE.Vector3).addVectors(n,i).multiplyScalar(.5);l.left=n,l.right=i,l.center=c,l.pointsLen=r}if(a.length>0){var u=function(e){var t=new THREE.Vector3,o=new THREE.Vector3;if(e.forEach((function(e){var n=KP(e);t.add(n),o.add(e.size)})),r>0){var a=new THREE.Vector3(Math.abs(n.x-i.x),o.y,Math.abs(n.z-i.z));o.add(a.multiplyScalar(r)).multiplyScalar(1/(r+e.length)),t.add(l.center.clone().multiplyScalar(r)).multiplyScalar(1/(r+e.length))}else o.multiplyScalar(1/e.length),t.multiplyScalar(1/e.length);return{center1:t,size:o}},d=function(e,t){a.forEach((function(e){e.sc=-e.center.distanceToSquared(f)-.5*t.distanceToSquared(e.size)}))},p=u(a),f=p.center1;d(0,p.size),a.sort((function(e,t){return t.sc-e.sc}));var m=a[Math.floor(a.length/2)];d(m.center,m.size);var v=a.filter((function(e){return e.sc<-8}));if(v.length){var g=De.disconnectGroup(v.map((function(e){return[e.box0,e.box1]})),s).newGroups;if(console.log("去除错误数据",v),g.length>1)return void g.forEach((function(t){e(t)}));a=a.filter((function(e){return e.sc>=-8}))}if(a.length){var y=u(a);l.center=y.center1,l.size=y.size}}l.k=function(e){var t;if(e.left){var n=new THREE.Vector2(e.left.x-e.right.x,e.left.z-e.right.z);t=Math.abs(n.x/n.y)}else t=Math.abs(Math.max(e.size.x,.6)/Math.max(e.size.z,.6));return t}(l),l.bigBoxes=a,l.group=t,h.push(l)};s.slice(0).forEach((function(e){d(e)}));var p=function(e){return e.size?e.k>1?e.size.x:e.size.z:e.k>1?e.right.x-e.left.x:e.right.z-e.left.z+.6},f=function(){for(var e=[],t=function(e,t){var n=[];e.forEach((function(e){n.push.apply(n,H(e.group.map((function(e){return e.boxes.length}))))})),n.sort((function(e,t){return e-t}));var i=[];n.slice(Math.floor(.3*n.length),Math.floor(.7*n.length)+1).forEach((function(e){i.includes(e)||i.push(e)}));var o=SP.cabinet.widthNormal,r=o.min,a=o.max,s=(r+a)/2,l=i.map((function(e){return{aveW:t/e,count:e}}));l.sort((function(e,t){return Math.abs(e.aveW-s)-Math.abs(t.aveW-s)}));var c=l[0].aveW,u=l[0].count;return(c>a||c<r)&&(c=THREE.MathUtils.clamp(c,r,a)),{aveW:c,count:u}},n=function(e,t,n,i){var o=new THREE.Box2;o.expandByPoint(new THREE.Vector2(e.x,e.z));var r=i>1?new THREE.Vector2(t/2,n/2):new THREE.Vector2(n/2,t/2);return o.expandByVector(r),o},i=function(i){for(var o=h[i],r=function(i){var r,a,s=h[i];if("pano4-row-4&pano6-row-5,1"==(null===(r=s.bigBoxes[0])||void 0===r?void 0:r.name)&&"pano4-row-2,5&pano6-row-3"==(null===(a=o.bigBoxes[0])||void 0===a?void 0:a.name)&&console.log(4),(o.k>1&&s.k<1||o.k<1&&s.k>1)&&p(o)>1.5&&p(s)>1.5)return"continue";var l=(o.k+s.k)/2>1?"z":"x";if(Math.abs(o.center[l]-s.center[l])>.6*1.5)return"continue";var c=t([o],p(o)),u=t([s],p(s)),d=o.predictLen=c.aveW*c.count,f=s.predictLen=u.aveW*u.count,m=o.area=d*c.aveW,v=s.area=f*u.aveW,g=function(e,t){var i=n(o.center,d+e,c.aveW+t,o.k),r=n(s.center,f+e,u.aveW+t,s.k),a=lR(i,r).getSize(new THREE.Vector2);return{box0:i,box1:r,areaMix:Math.max(0,a.x)*Math.max(0,a.y)}}(.1,.3).areaMix;if(g/m<.65&&g/v<.65)return"continue";De.pushToGroupAuto([o,s],e)},a=i+1;a<h.length;a++)r(a)},o=0;o<h.length-1;o++)i(o);return h.forEach((function(t){e.some((function(e){return e.includes(t)}))||e.push([t])})),e.forEach((function(e,n){var i,o=e.reduce((function(e,t){return e+(t.pointsLen||t.bigBoxes.length)}),0),r={"<1":{count:0,sum:0},">1":{count:0,sum:0}};e.forEach((function(e){e.k<1?(r["<1"].count++,r["<1"].sum+=1/e.k):(r[">1"].count++,r[">1"].sum+=e.k)})),r["<1"].count&&(r["<1"].ave=r["<1"].sum/r["<1"].count),r[">1"].count&&(r[">1"].ave=r[">1"].sum/r[">1"].count),i=r["<1"].ave>r[">1"].ave?1/r["<1"].ave:r[">1"].ave;var a=e.reduce((function(e,t){return e.add(t.center.clone().multiplyScalar(t.pointsLen||t.bigBoxes.length))}),new THREE.Vector3).multiplyScalar(1/o),s=e.map((function(e){return function(e,t){var n=(t||e.k)>1?"x":"z";return e.left?e.left[n]-.3:e.center[n]-e.size[n]/2}(e,i)})).sort((function(e,t){return e-t})).filter((function(e){return e<a[i>1?"x":"z"]})).slice(0,3),l=e.map((function(e){return function(e,t){var n=(t||e.k)>1?"x":"z";return e.right?e.right[n]+.3:e.center[n]+e.size[n]/2}(e,i)})).sort((function(e,t){return t-e})).filter((function(e){return e>a[i>1?"x":"z"]})).slice(0,3),c=0,u=0,h=(s.length+1)*s.length/2;s.forEach((function(e,t){c+=e*((s.length-t)/h)})),h=(l.length+1)*l.length/2,l.forEach((function(e,t){u+=e*((l.length-t)/h)})),a[i>1?"x":"z"]=(c+u)/2;var d=u-c,p=e.filter((function(e){return!e.predictLen||e.predictLen/d>.7}));0==p.length&&(p=e.sort((function(e,t){return t.predictLen-e.predictLen})).slice(0,1));var f,m=t(p,d),v=m.aveW,g=m.count,y=[],A=[];e.forEach((function(e){A.push.apply(A,H(e.group.filter((function(e){return!A.includes(e)&&e.boxes.length==g}))))})),(f=A.map((function(e){var t=e.boxes.map((function(e){var t={box0:e};return YP(t),t.topPos}));return(i<1&&t[0].z>t[g-1].z||i>1&&t[0].x>t[g-1].x)&&t.reverse(),t.map((function(e){return e.y-gP}))}))).forEach((function(e){for(var t=0;t<g;t++)y[t]=(y[t]||0)+e[t]})),y=y.map((function(e){return e/f.length}));var E=new THREE.Vector3(v,2,v),b=0;for(e.rowboxs=[];b<g;){var w=void 0;if(i>1){var x=a.x-(g-1)/2*v;w=new THREE.Vector3(x+b*v,a.y,a.z)}else{var C=a.z-(g-1)/2*v;w=new THREE.Vector3(a.x,a.y,C+b*v)}var T=y[b]?E.clone().setY(y[b]):E,I=new zP({name:"row"+n+"-"+b,center:w,size:T,boxType:"cabinet",infos:e});b++,e.rowboxs.push(I)}})),{v:e.length>0}}();if("object"==typeof f)return f.v},i=[],o=function(o){console.error("开始search",o);var r=a.matchScoreMap[o]=new Map,s={},c=[];for(var u in a.datas)a.datas[u]&&(s[u]=a.datas[u].shapes.filter((function(e){return $P(e.category,o)})),s[u].length&&c.push(u));var p=function(e){if(!a.datas[e])return"continue";(function(e){var t=e.length;if(!(t<2)){for(var n=0;n<t-1;n++){var i=e[n];WP(i),i.contains=i.contains||[];for(var o=n+1;o<t;o++){var r=e[o];if(WP(r),r.contains=r.contains||[],!(Math.abs(r.bbox2CenterX-i.bbox2CenterX)>.4)){var a=qP(r.bbox2[0],i.bbox2[0]),s=qP(i.bbox2[2],r.bbox2[2]),l=qP(i.bbox2[2],i.bbox2[0]),c=qP(r.bbox2[2],r.bbox2[0]),u=Math.min(.005,.2*Math.min(l,c));s>=0&&Math.abs(a)<u||a>=0&&Math.abs(s)<u||s>=0&&a>=0?i.contains.push(r):(a<=0&&Math.abs(s)<u||s<=0&&Math.abs(a)<u||s<=0&&a<=0)&&r.contains.push(i)}}}var h=function(e,t){var n=oR(e,KP(e),.1),i=n.projectWidth,o=(n.maxProjectWidth+n.minProjectWidth)/2,r="out"==t?i-o:o-i;return 10*-Math.pow(r,2)},d="battery"==e[0].boxType||"tv"==e[0].boxType?1:2;e.slice().forEach((function(t){if(t.contains.length>=d){var n=cR(t.contains),i=n.leftX,o=n.rightX;if(t.contains.length>1&&(Math.abs(qP(t.bbox2[0],i))>.005||Math.abs(qP(t.bbox2[2],o))>.005))return;var r=!0;if(1==t.contains.length)r=!1;else{var a=h(t,"out"),s=t.contains.map((function(e){return h(e,"in")})),l=s.reduce((function(e,t){return e+t}),0)/s.length;l<-4&&(r=l>a)}r?(t.state="因嵌套其他被删除",console.log("因嵌套其他被删除",t),e.splice(e.indexOf(t),1)):t.contains.forEach((function(n){var i;n.state="因被嵌套被删除",n.containBy=t,e.splice(e.indexOf(n),1),(i=console).log.apply(i,["因被嵌套被删除"].concat(H(t.contains)))}))}}))}})(s[e]),s[e].length&&t(s[e],{reason:"mix"}).forEach((function(t){if(t.boxes.length>1){t.boxes.forEach((function(n){n.state="被删除",n.mixTo=t;var i=s[e].indexOf(n);s[e].splice(i,1),i=a.datasMixed[e].shapes.findIndex((function(e){return e.sid==n.sid})),a.datasMixed[e].shapes.splice(i,1)})),console.log("因融合而删除",t.boxes),s[e].push(t),a.datasMixed[e].shapes.push(t);var n=a.datas[e].shapes;t.index=n.length>1?n[n.length-1].index+1:0;var i=t.sid.split("mix-");t.sid=i[0]+t.index+"(mix"+i[1]+")"}}))};for(var f in a.datas)p(f);if(0!=c.length){c.sort((function(e,t){return s[t].length-s[e].length}));var m=c.map((function(e){return s[e]})),v=m[0],g=v.length;if(1==m.length)return SP[o].tinyXZ&&a.expandModelBound(o),v.forEach((function(e){return d(e)})),h(o);var y=function(e){i.push({type:o,args:[e]}),SP[o].tinyXZ&&a.confirmGroundY(o),SP[o].tiny&&a.expandModelBound2(o)};if(1==g){c.forEach((function(e){return WP(s[e][0])}));for(var A=0;A<c.length;A++)for(var E=s[c[A]][0],b=A+1;b<c.length;b++){var w=s[c[b]][0];e(E,w,{isSingle:!0})}var x=Array.from(r).map((function(e){return e[1]})).sort((function(e,t){return t.score-e.score})),C=x[0];if(iR(C),C.score>-100&&(aR(C),C.score>0&&C.sizeAdjust<.1))return new zP(C),void y(m);var T=[];x.forEach((function(e){T.includes(e.box0.pano.id)||T.push(e.box0.pano.id),T.includes(e.box1.pano.id)||T.push(e.box1.pano.id)}));var I=T.map((function(e){return s[e]}));return l([C],I),void y(I)}var k={};m.forEach((function(e){e.forEach((function(e){return WP(e)})),k[e.length]||(k[e.length]=[]),k[e.length].push(e)})),m=[],SP[o].atWall;var B=Object.keys(k);if(B.reverse(),B.forEach((function(e){var t,n=k[e];n.length>1&&(n.forEach((function(e){e.disSc=e.reduce((function(e,t){var n=KP(t);return e+Math.abs(t.pano.position.distanceToSquared(n)-2)}),0)})),n.sort((function(e,t){return e.disSc-t.disSc}))),(t=m).push.apply(t,H(n))})),g=(v=m[0]).length,"cabinet"==o&&n(m))i.push({type:o,args:[m,0]});else{var P=function(t,n){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},o=i.fake;t.length,n.length;var r=[],s=t.slice(0),c=n.slice(0),u=e.bind(a);uR(null,s,c,null,r,u),r=r.map((function(t){var n=t.map((function(t){return e(t[0],t[1])})),i=n.reduce((function(e,t){return e+(t?t.score:0)}),0);return{infos:n,score:i,pairs:t,name:t.map((function(e){return e.map((function(e){return e.sid})).join(" & ")}))}})),console.log("resultPairs按分数高低",r.sort((function(e,t){return t.score-e.score})));var h=IP?-2e3:-800,d=[],p=[];r[0]&&r[0].infos.forEach((function(e,t){if(e)if(e.score<h||SP[e.boxType].bottom&&e.minAng<5)p.push(e);else if(iR(e),aR(e),e.sizeAdjust&&SP[e.boxType].tiny||e.sizeAdjust>.2)p.push(e);else{if(e.box0.category==DP.battery&&e.size.x<1&&e.size.z<1){var n=(new THREE.Vector3).subVectors(e.box0.pano.position,KP(e)),i=(new THREE.Vector3).subVectors(e.box1.pano.position,KP(e));if(n.x*i.x>0&&n.z*i.z>0)return void p.push(e)}e.fake=o,new zP(e)}else d.push(r[0].pairs[t].find((function(e){return"void"!=e.sid})))})),d.length&&l(d.map((function(e){return{box0:e}})),m,{fake:o}),l(p,m,{fake:o})};if(SP[o].tinyXZ)for(var R=0;R<m.length-1&&(P(m[R],m[R+1],{fake:R>0}),!(m[R+1].length<2));R++);else{for(var M=[],S=0;S<m.length-1;S++){var D=m[S][0].pano.position.distanceToSquared(m[S+1][0].pano.position),L=ge.linearClamp(D,[0,.4,2,6,100],[-10,0,10,5,-100])+(m[S].length+m[S+1].length);M.push({score:L,i:S,disSqure:D,length1:m[S].length,length2:m[S+1].length})}M.sort((function(e,t){return t.score-e.score})),P(m[M[0].i],m[M[0].i+1])}y(m)}}else SP[o].tinyXZ&&a.expandModelBound()};function r(e){var t=.1,n=.5,i=[],o=new Map;e.forEach((function(e){var t;(t=i).push.apply(t,H(e))})),(i=i.filter((function(e){return!s(e)}))).forEach((function(e){"pano2-0"==e.sid&&console.log(4),WP(e);var t=new THREE.Vector2(e.pano.position.x,e.pano.position.z),n=new THREE.Vector2(e.btmPos.x,e.btmPos.z),i=t.distanceToSquared(n),r=-Math.abs(i-2);e.pose||(e.pose=oR(e,KP(e)));var a=rR([e.pose],e.boxType)+7*THREE.MathUtils.clamp(e.pose.projectWidth,e.pose.minProjectWidth,e.pose.maxProjectWidth);o.set(e,{s1:r,s2:a,sum:r+a})})),(i=i.sort((function(e,t){return o.get(t).sum-o.get(e).sum}))).forEach((function(i){"pano0-4"==i.sid&&console.log(3),s(i)||function(e){if(!SP[e.boxType].bottom){e.blocked||(e.blocked={centerBtmDir:null,leftBtmDir:null,rightBtmDir:null});var t=function(t){if(!e.blocked[t]){var n=kP.find((function(n){if(CP.set(e.pano.position,e[t]),CP.ray.intersectsBox(n.bound))return!0}));if(!n)return e.blocked[t]=!1,{v:!1};e.blocked[t]=n}};for(var n in e.blocked){var i=t(n);if("object"==typeof i)return i.v}return!0}var o=kP.find((function(t){if(t.boxType==e.boxType)return CP.set(e.pano.position,e.centerDir),!!CP.ray.intersectsBox(t.bound)||void 0}));if(o)return e.blocked=o,!0}(i)||kP.find((function(e){if("air-pano16-7&pano14-13"==e.name&&console.log(3),e.boxType==i.boxType||"air-hanging"!=e.boxType&&"air-hanging"!=i.boxType){var o=KP(e),r=KP(i);new THREE.Vector2(o.x,o.z),new THREE.Vector2(r.x,r.z);var a=SP[i.boxType].widthNormal.max/2;a=THREE.MathUtils.clamp(a,t,n);var s=e.bound.distanceToPoint(r),l=SP[i.boxType].closeRatio,c=ge.linearClamp(i.pano.position.distanceTo(r),3,20,1,5);return a*((e.boxType==i.boxType?1:.5)*l*c)-1.3*s>0}}))||l([{box0:i,log:"findRest"}],e,{startIndex:0})}))}function s(e){var t=function t(n){return function(t){return t.box0==e||t.box1==e}(n)||n.list&&n.list.some((function(e){return t(e)}))||n.mixedFrom&&n.mixedFrom.some((function(e){return t(e)}))||n.infos&&n.infos.some((function(t){return t.group.some((function(t){return t.boxes.some((function(t){return t==e}))}))}))};return kP.some((function(e){return t(e)}))}function l(t,n){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},o=i.startIndex,r=void 0===o?2:o,a=i.fake,l=[],h=IP?-2e3:-800,p=function(t,n){var i=function(t,n){if(t!=n)return t.pano==n.pano||e(t,n,{isSingle:!0,restMatch:!0}).score<h||void 0};if(!(i(t.box0,n.box0)||i(t.box1,n.box1)||i(t.box0,n.box1)||i(t.box1,n.box0)))return!0};t.length&&(t[0].box1&&t.sort((function(e,t){return e.score-t.score})),t.forEach((function(i){var o=i.box0,f=i.box1,m=[];f&&m.push(i);for(var v=function(t){var i=n[t],r=[],a=[];i.forEach((function(t){if(!s(t)){if(t.pano!=o.pano&&t!=f){var n=e(o,t,{isSingle:!0,restMatch:!0});n.score>1.5*h&&r.push(n)}if(f&&t.pano!=f.pano&&t!=o){var i=e(f,t,{isSingle:!0,restMatch:!0});i.score>1.5*h&&a.push(i)}}})),r.sort((function(e,t){return t.score-e.score})),a.sort((function(e,t){return t.score-e.score})),r[0]&&m.push(r[0]),a[0]&&m.push(a[0])},g=r;g<n.length;g++)v(g);m.sort((function(e,t){return t.score-e.score}));var y=m.slice(0,10).map((function(e){return KP(e)?(iR(e),aR(e),e):e})).sort((function(e,t){return t.score-e.score})).slice(0,3);if(0==y.length)return a||d(o,.6);if(!(y[0].score>.65*h))return f?l.push(y[0]):void(("findRest"==i.log||KP(o).distanceTo(o.pano.position)<2.5)&&(a||d(o)));if((y=y.filter((function(e){return e.score>.65*h}))).length){for(var A=[],E=[],b=function(e,t){var n=y[e];if(A.some((function(e){return e.includes(n)})))return"continue";for(var i=[n],o=e+1;o<t;o++){var r=y[o];p(n,r)&&i.push(r)}A.push(i)},w=0,x=y.length;w<x;w++)b(w,x);A.forEach((function(e){E.push(c(e,t[0].log,a))})),a||u(E)}})))}function c(e,t,n){var i=new THREE.Vector3,o=new THREE.Vector3,r=new THREE.Box3;e.forEach((function(e){var t=(new THREE.Box3).setFromCenterAndSize(HP(e),e.size);r.union(t)})),r.getSize(o),e.forEach((function(e){return i.add(e.center)})),i.multiplyScalar(1/e.length);var a=e.find((function(e){return e.xProp}))||{},s=a.xProp,l=a.yProp;s&&e.find((function(e){return e.xProp&&e.xProp!=s}))&&(s=l=null);var c={name:("findRest"==t?"rest:":"low:")+e.map((function(e){return e.name})),boxType:e[0].boxType,center:i,size:o,list:e,xProp:s,yProp:l},u=sR(o.x,o.y,o.z,c);return o.x=u.x,o.y=u.y,o.z=u.z,c.fake=n,new zP(c)}function u(e,t){var n=[];if(e.length>1){var i=e[0].boxType,o=SP[i].widthNormal;o.min;var r=o.max,a=r,s=r,l=SP[i].height.max;SP[i].height.min;for(var c=0,u=e.length;c<u-1;c++){var h=e[c];if(!h.fake)for(var d=c+1;d<u;d++){var p=e[d];if(!p.fake){var f=h.bound.clone().union(p.bound).getSize(new THREE.Vector3),m=h.bound.intersectsBox(p.bound);"desk-pano21-0"==h.name&&"desk-pano20-0"==p.name&&console.log(1);var v=m?1.5:1.3,g=f.x/a,y=f.y/l,A=f.z/s;g<v&&y<v&&A<v&&De.pushToGroupAuto([h,p],n)}}}n.length&&n.forEach((function(e){var n=[],o=new THREE.Box3;e.forEach((function(e){if(o.union(e.bound),e.dispose(),t>1){var i=n.find((function(t){return t.boxType==e.boxType})),r=0,a=function(e){e&&(r+=e.score)};e.traversePair((function(e){a(e.box0),a(e.box1)})),i?i.score+=r:n.push({score:r,boxType:e.boxType})}})),t>1&&(n.sort((function(e,t){return t.score-e.score})),i=n[0].boxType);var r=o.getSize(new THREE.Vector3),a=o.getCenter(new THREE.Vector3),s=e.find((function(e){return e.xProp}))||{},l=s.xProp,c=s.yProp;l&&e.find((function(e){return e.xProp&&e.xProp!=l}))&&(l=c=null);var u={name:"mix:"+e.map((function(e){return" "+e.name})),mixedFrom:e,boxType:i,center:a,size:r,xProp:l,yProp:c},h=sR(r.x,r.y,r.z,u);r.x=h.x,r.y=h.y,r.z=h.z;var d=new zP(u);console.error("混合",i,e,d)}))}}function h(e){e instanceof Array||(e=[e]),u(kP.filter((function(t){return e.includes(t.boxType)})),e.length)}var d=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;WP(e);var n=KP(e);if(yP.distanceToPoint(n)>0)return console.log("取消createSinglePano:超出safebound",e);var i={name:e.sid,box0:e,center:n,topPos:e.topPos,btmPos:e.btmPos,xProp:e.xProp,yProp:e.yProp};iR(i);var o=-500*t,r=rR(i.boxposes,e.boxType),a=r<o;console.log("createSinglePano",a?"失败":"成功","pose score:",r,e.sid,e),a||(i.score=r,"pano10-1"==e.sid&&console.log(7),aR(i),new zP(i))};a.removedDatas={};for(var p=Object.keys(a.datas).filter((function(e){return!!fP.model.panos.index[e]||(a.removedDatas[e]=a.datas[e],void delete a.datas[e])})),f=p.length,m=0;m<f;m++)for(var v=fP.model.panos.index[p[m]],g=m+1;g<f;g++){var y=fP.model.panos.index[p[g]];if(v.position.distanceToSquared(y.position)<.01){var A=void 0;A=a.datas[p[m]].shapes.length>a.datas[p[g]].shapes.length?p[g]:p[m],console.log("删除pano".concat(A,"的data,因pano").concat(p[m],"和pano").concat(p[g],"很近")),a.removedDatas[A]=a.datas[A],delete a.datas[A]}}for(var E in a.datasMixed=De.CloneObject(a.datas,null,void 0,(function(e){return e.category})),DP)o(E);console.log("----FindRest----"),i.forEach((function(e){r.apply(void 0,H(e.args)),"air"!=e.type&&"airSmart"!=e.type&&"cabinet"!=e.type&&h(e.type)})),h(["air","airSmart"]),console.log("cost:",Date.now()-AP,"ms, boxSolid:",a.boxesSolid,"共"+a.boxesSolid.length+"个")},i=function(){var e=function(e){if(!a.datas[e])return"continue";a.datas[e].shapes=a.datas[e].shapes.map((function(t,n){return Object.assign({sid:"pano"+e+"-"+n,category:t.category,pano:fP.model.panos.index[e],index:n},t)}))};for(var t in a.datas)e(t);a.findOutAllTypes(),a.panoBound=new THREE.Box3,fP.model.chunks.forEach((function(e){xP.union(e.geometry.boundingBox)}));var i=1/0,o=[];fP.model.panos.list.filter((function(e){return e.isAligned()})).forEach((function(e){var t=(new THREE.Box3).setFromCenterAndSize(e.position,new THREE.Vector3(.1,.1,.1));xP.union(t),a.panoBound.union(t),i=Math.min(e.floorPosition.y,i),o.push(e.floorPosition.y)})),yP=a.safeBound=xP,(mP=new ho(xP,new THREE.MeshBasicMaterial({side:THREE.DoubleSide,wireframe:!0,transparent:!0,opacity:.05,visible:!1}),0)).updateMatrixWorld(),vP.add(mP),a.skyboxTight=mP,TP.setFromNormalAndCoplanarPoint(new THREE.Vector3(0,1,0),new THREE.Vector3(0,gP,0)),a.ifAnalyze&&n(),a.load(fP.currentPano.id),a.boxesSolid.forEach((function(e){return e.boxMesh.updateMatrixWorld()})),a.updateBoxVisiInPano()},t?(t.forEach((function(e){var t=e.imagePath.split(".jpg")[0];a.datas[t]=e})),i()):o.bind(this)();case 14:case"end":return e.stop()}}),e,this)}))),function(e){return t.apply(this,arguments)})},{key:"expandModelBound",value:function(){var e=this,t=xP.clone(),n=[],i=function(t){if(!e.datas[t])return"continue";var i=e.datas[t],o=i.imageWidth,r=i.imageHeight;e.datas[t].shapes.forEach((function(e){if(WP(e,o,r),"pano2-10"==e.sid&&console.log(4),e.btmPosPredict){if(e.pano.position.distanceToSquared(e.btmPosPredict)>20)return;var t=xP.distanceToPoint(e.btmPosPredict);t>0&&t<3&&n.push({box:e,dis:t})}}))};for(var o in this.datas)i(o);n.sort((function(e,t){return e.dis-t.dis}));for(var r=n.length,a=0;a<r;a++){var s=n[a].box.btmPosPredict;if(n[a].dis>1){var l=s.clone().clamp(xP.min,xP.max),c=(new THREE.Vector3).subVectors(s,l).normalize().multiplyScalar(1);s=(new THREE.Vector3).addVectors(l,c)}var u=(new THREE.Box3).setFromCenterAndSize(s,new THREE.Vector3(.2,0,.2));t.union(u)}(mP=new ho(t,new THREE.MeshBasicMaterial({side:THREE.DoubleSide,wireframe:!0,transparent:!0,opacity:.05}),0)).updateMatrixWorld(),vP.add(mP),this.skyboxTight=mP,this.safeBound=this.safeBoundFirstVer=yP=t,IP=!0,console.log("bound1:",this.safeBound.min.toArray(),this.safeBound.max.toArray())}},{key:"expandModelBound2",value:function(e){var t=this,n=mP.material;mP.geometry.dispose(),kP.forEach((function(n){n.boxType==e&&t.safeBound.union(n.bound)})),(mP=new ho(this.safeBound,n,0)).updateMatrixWorld(),vP.add(mP),this.skyboxTight=mP,console.log("bound2:",this.safeBound.min.toArray(),this.safeBound.max.toArray())}},{key:"updateBoxVisiInPano",value:function(){if("panorama"==fP.mode){var e=this.visiInfos[fP.currentPano.id];e||(e=this.boxesSolid.filter((function(e){return e.visiPanos?e.visiPanos.includes(fP.currentPano):e.cptVisiAtPano(fP.currentPano)})),this.visiInfos[fP.currentPano.id]=e),this.boxesSolid.forEach((function(t){t.updateVisible(e.includes(t),"panoVisi")}))}else this.boxesSolid.forEach((function(e){return e.updateVisible(!0,"panoVisi")}))}},{key:"confirmGroundY",value:function(e){if(!IP){var t=[],n=[],i=0,o=function(e){e.btmPos&&e.box1&&n.push(e)};kP.forEach((function(t){t.boxType==e&&t.traversePair(o)}));var r=n;if(n.length>5){var a=new Map;n.forEach((function(e){a.set(e,Math.max(e.box0.pano.position.distanceTo(e.box0.btmPosPredict),e.box1.pano.position.distanceTo(e.box1.btmPosPredict)))})),n.sort((function(e,t){return a.get(e)-a.get(t)})),r=n.slice(0,5);for(var s=5;s<n.length;s++)a.get(n[s])<3&&r.push(n[s])}r.forEach((function(e){var n=e.btmPos.y,o=e.size.x/2,r=o/Math.tan(Math.acos(-e.box0.centerBtmDir.y)),a=o/Math.tan(Math.acos(-e.box1.centerBtmDir.y));n+=Math.min(r,a)*ge.linearClamp(e.minAng,0,90,0,1),t.push(n),i+=n})),i/=t.length,t.length&&(console.error("confirmGroundY",i,t,r.map((function(e){return e.name})),n),gP=this.safeBound.min.y=this.panoBound.min.y=i,TP.setFromNormalAndCoplanarPoint(new THREE.Vector3(0,1,0),new THREE.Vector3(0,gP,0)));var l=SP[e].height,c=l.min,u=l.max;kP.slice().forEach((function(t){if(t.boxType==e)if(t.fake)t.dispose();else{var n=t.topPos?t.topPos.y:t.list.reduce((function(e,t){return e+t.topPos.y}),0)/t.list.length;t.size.y=THREE.MathUtils.clamp(n-gP,c,u),t.setFromInfo(t),t.draw()}})),this.panoBound,this.expandModelBound()}}},{key:"bindEvents",value:function(){var e=this;fP.on(ca,(function(t){e.traverse((function(e){e.isMesh&&(e.geometry.dispose(),e.material.dispose())})),e.wireframes.clear(),e.currentId=null})),fP.on(ua,(function(){e.updateBoxVisiInPano(),fP.mode==xt.PANORAMA&&e.load(fP.currentPano.id)}));var t=[];fP.on("collectIntersectMesh",(function(n,i){bP&&(t=e.boxesSolid.filter((function(e){return De.getObjVisiByReason(e.label,"panoVisi")})).map((function(e){return e.boxMesh})))})),fP.on("judgeIntersect",(function(n,i){if(!i.getConsumed()&&bP){var o=fP.getMouseIntersect(null,t,{}),r=o&&t.includes(o.object)?o.object.masterBox:null;r!=e.hoveredBox&&(e.hoveredBox,r?Wr.add("hoverMonitor"):Wr.remove("hoverMonitor"),e.hoveredBox=r),r&&i.consume()}})),fP.on("click",(function(t){!t.getConsumed()&&bP&&e.hoveredBox&&(fP.$app.Scene.emit("box-frame-click",e.hoveredBox),t.consume())})),setTimeout((function(){fP.$app.Scene.on("ai-box.set-display",function(){var t=k(S.mark((function t(n){return S.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(e.startToCompute||!n){t.next=3;break}return t.next=3,e.compute();case 3:RP&&(e.wireframes.visible=BP=n),e.boxesSolid.forEach((function(e){return e.updateVisible(n,"whole")})),e.showBoxes=n;case 6:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()),e.ifAnalyze&&!bP&&(fP.$app.Scene.on("ai-box.fetch-list",(function(){for(var t=[],n=0;n<kP.length;n++){var i=kP[n],o="zh"==fP.$app.config.lang?LP[i.boxType]:DP[i.boxType];o&&t.push({name:o+"-"+(n+1),position:i.position,getClosetPano:i.getClosetPano.bind(i)})}if(RP)for(var r in e.datasMixed)for(var a=e.datasMixed[r],s=0;s<a.shapes.length;s++){var l=a.shapes[s];/^[A-Za-z]+$/.test(l.category)||(jP(l,a.imageWidth,a.imageHeight),NP(l),t.push({name:l.category,box:l,type:"pano"}))}fP.$app.Scene.emit("ai-box.list",t)})),fP.$app.Scene.emit("ai-box.loaded"))}),1e3)}},{key:"load",value:function(e){var t=this,n=this.datasMixed[e]||this.datas[e];if(n){if(fP.currentPano.id==e&&!fP.flying&&this.currentId!=e){this.currentId=e;var i=n.shapes,o=n.imageHeight,r=n.imageWidth,a=i.slice();i.forEach((function(e){e.boxes&&a.push.apply(a,H(e.boxes))})),a.forEach((function(e){jP(e),NP(e,fP.currentPano);var n=e.fill_color,i=e.color,a=[].concat(H(void 0===i?[56,56,255]:i),[255]);n||(n=[255,255,255,0]),a||(a=[255,0,0,255]),e.boxes&&(a=[20,205,255,255]);var s=KP(e)?e.pano.position.distanceTo(KP(e)):1,l=("fire"==e.boxType?0:-.2)/s,c=e.category+"-"+e.sid;c=[c],e.score&&c.push("sc: "+ge.toPrecision(e.score,3)),t.showSignalFrom2d(c,e.bbox2,r,o,{fill:{color:(new THREE.Color).setRGB(n[0]/255,n[1]/255,n[2]/255),opacity:n[3]/255},line:{color:(new THREE.Color).setRGB(a[0]/255,a[1]/255,a[2]/255),opacity:"cabling_rack"==e.category?.4:a[3]/255}},e.centerDir,l,"被删除"==e.state,e)}))}}else e in this.datas||setTimeout((function(){t.load(e)}),100)}},{key:"showSignalFrom2d",value:function(e,t,n,i,o,r,a,s,l){for(var c=[new THREE.Vector2(t[0],t[1]),new THREE.Vector2(t[2],t[1]),new THREE.Vector2(t[2],t[3]),new THREE.Vector2(t[0],t[3])],u=[],h=0;h<c.length;h++){var d=c[h];u.push(d)}var p=[];u.forEach((function(e){var t=UP(e,fP.currentPano);p.push(t)}));var f=(new THREE.BufferGeometry).setFromPoints(p),m=new THREE.LineBasicMaterial({color:o.line.color,opacity:o.line.opacity,transparent:!0,depthTest:!1}),v=new THREE.LineLoop(f,m);v.renderOrder=100;var g=f.clone().setIndex(new THREE.BufferAttribute(new Uint16Array([0,1,3,2,3,1]),1)),y=new THREE.MeshBasicMaterial({color:o.fill.color,opacity:o.fill.opacity,transparent:!0,side:THREE.DoubleSide,depthTest:!1}),A=new THREE.Mesh(g,y);A.renderOrder=v.renderOrder-1,v.add(A),A.visible=!1;var E=new Ce({text:e,backgroundColor:{r:255*o.line.color.r,g:255*o.line.color.g,b:255*o.line.color.b,a:.5*o.line.opacity},textColor:{r:255,g:255,b:255,a:1.1*o.line.opacity},borderRadius:2,renderOrder:v.renderOrder+1,player:fP});E.position.copy(r),E.lookAt(0,0,0),E.scale.set(.12,.12,.12);var b=new THREE.Group;b.name="rectInPano",b.position.copy(fP.currentPano.position),b.add(v),b.add(E),this.wireframes.visible=null===BP?RP:BP,this.wireframes.add(b),b.label=E,b.wireframe=v,b.plane=A,s&&(E.sprite.material.opacity=.4,m.opacity*=.6,m.color.set("#efe")),b.data=l}},{key:"findOutAllTypes",value:function(){var e={};for(var t in this.datas)this.datas[t].shapes.forEach((function(t){e[t.category]||(e[t.category]=t.name)}));console.log("allTypes:",e)}},{key:"clear",value:function(){mP=null,vP=null,xP=new THREE.Box3,gP=null,yP=null,kP=[]}}]),i}();function dR(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}var pR=function(e){f(n,e);var t=dR(n);function n(e){var i;return o(this,n),(i=t.call(this)).app=e,i.ready=!1,i.loaded=!1,i.locked=null,i.Decoration=new gB(h(i)),i.on("ready",(function(){return i.ready=!0})),i.on("loaded",(function(){i.loaded=!0;var e=i.app.core.get("PanoVideoRenderer");if(e.on(Dt.CanPlayVideo,(function(){return i.emit(Dt.CanPlayVideo)})),e.on(Dt.StartPlay,(function(){return i.emit(Dt.StartPlay)})),e.on(Dt.SuspendRender,(function(){return i.emit(Dt.SuspendRender)})),e.on(Dt.ResumeRender,(function(){return i.emit(Dt.ResumeRender)})),"ids"==Fe.valueFromUrl("ai"))new dP(i.app.core.get("Player"));else if("sds"==Fe.valueFromUrl("ai"))new dP(i.app.core.get("Player"),!0);else{var t=i.app.store.getValue("metadata"),n=1==Fe.valueFromUrl("showrect");(t.hasRecognition||n)&&i.app.config.view&&(t.controls.showAi||n)&&new hR(i.app.core.get("Player"),!0)}})),i}return u(n,[{key:"panos",get:function(){return this.app.core.get("Player").model.panos}},{key:"panoId",get:function(){return this.app.core.get("Player").currentPano.id}},{key:"floors",get:function(){return this.app.core.get("Player").model.floors}},{key:"floorId",get:function(){return this.app.core.get("Player").currentPano.floorIndex}},{key:"currentFloorId",get:function(){return this.app.core.get("Player").model.currentFloor.floorIndex}},{key:"panoCount",get:function(){return this.app.core.get("Player").model.panos.list.length}},{key:"videoCount",get:function(){var e=this.app.store.getValue("metadata").videos;return e&&e.data&&e.data.length?e.data.length:0}},{key:"videoList",get:function(){var e=this.app.store.getValue("metadata").videos;return e&&e.data&&e.data.length?e.data.map((function(e){return e.id})):[]}},{key:"isCurrentPanoHasVideo",get:function(){return this.app.core.get("Player").currentPano.hasVideo}},{key:"whenReady",value:function(e){var t=this,n=function(t){t(),"function"==typeof e&&e()};return new Promise((function(e){t.ready?n(e):t.once("ready",(function(){return n(e)}))}))}},{key:"whenLoaded",value:function(e){var t=this,n=function(t){t(),"function"==typeof e&&e()};return new Promise((function(e){t.loaded?n(e):t.once("loaded",(function(){return n(e)}))}))}},{key:"showFloorCadImage",value:function(){this.app.core.get("Player").model.floorplanCadImg.displayCadPlane(!0)}},{key:"hideFloorCadImage",value:function(){var e=this;this.app.core.get("Player")?this.app.core.get("Player").model.floorplanCadImg.displayCadPlane(!1):setTimeout((function(){e.hideFloorCadImage()}),100)}},{key:"setFloorLogo",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.ready&&this.app.core.get("Player").model.floorLogos.changeFloorLogo(e)}},{key:"gotoFloor",value:function(e){if("all"==e)this.app.core.get("Player").model.toggleAllFloors(!0);else{var t=parseInt(e)-this.app.core.get("Player").model.currentFloor.floorIndex;this.app.core.get("Player").changeFloor(t)}this.app.core.get("Player").model.currentFloorId=e}},{key:"lock",value:function(){this.locked=oe()}},{key:"unlock",value:function(){this.locked&&(this.locked.resolve(),this.locked=null)}},{key:"showRule",value:function(){this.app.core.get("Player").model.wallManager.switchDisplay(!0)}},{key:"hideRule",value:function(){this.app.core.get("Player").model.wallManager.switchDisplay(!1)}}]),n}(yo),fR=function(){function e(t){o(this,e),this.app=t,this.plugin=null,this.display=null,this.hidden=!1,this.deferred=oe()}return u(e,[{key:"install",value:function(e){this.plugin=e,this.deferred.resolve(this.plugin)}},{key:"use",value:function(){return this.plugin?Promise.resolve(this.plugin):this.deferred}},{key:"show",value:function(e){var t=this;return this.display=!0,e&&(this.hidden=!1),this.hidden?Promise.resolve():this.use().then((function(){return t.plugin.show()}))}},{key:"hide",value:function(e){var t=this;return this.display=!1,e&&(this.hidden=!0),this.use().then((function(){return t.plugin.hide()}))}},{key:"reload",value:function(){var e=this;return this.use().then((function(){return e.plugin.data(!0)}))}}]),e}(),mR=function(){function e(t){o(this,e),this.app=t}var t;return u(e,[{key:"use",value:(t=k(S.mark((function e(t,n){return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.app.CadManager.use();case 2:e.sent.sync.use(t,n);case 4:case"end":return e.stop()}}),e,this)}))),function(e,n){return t.apply(this,arguments)})}]),e}();function vR(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}var gR=K("render"),yR=function(e){f(n,e);var t=vR(n);function n(e){var i;return o(this,n),i=t.call(this),Object.defineProperty(h(i),gR,{value:AR}),i.app=e,i.marks=[],i.player=null,i.enable=!0,i.app.Scene.on("ready",(function(){i.player=i.app.core.get("Player"),i.player.on(fa,Z(h(i),gR)[gR].bind(h(i)))})),i}return u(n,[{key:"add",value:function(e){e&&e.position&&(e.position=new THREE.Vector3(e.position.x,e.position.y,e.position.z),e.position.y=-1,this.marks.push(e))}},{key:"filter",value:function(e){}}]),n}(yo);function AR(){var e=this,t=this.marks||[];if(t.length){var n=this.player.mode,i=this.player.model.currentFloor.floorIndex;t.forEach((function(t){if(t.position){var o=pt.getPos2d(t.position,e.player);o.trueSide?pt.ifShelter(t.position,e.player,{x:o.vector.x,y:o.vector.y},null,e.player.model.allFloorsVisible?null:i)||t.mode&&t.mode!=n?t.visible=!1:null==t.floorId||t.floorId==i?(t.x=o.pos.x,t.y=o.pos.y,t.visible=!0):t.visible=!1:t.visible=!1}})),this.emit("render",{marks:t,mode:n,floorId:i})}}function ER(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}var bR=function(){function e(t){var n=this;o(this,e),this.getOverlayBySid=function(e){var t=n.app.core.get("Player"),i=t.OverlayManager.group.children.find((function(t){return t.sid==e}));return i||(i=t.OverlayManager.group.children[0],console.warn("无效sid:",e,i)),i},this.app=t,this.edit={},this.deferred=oe();var i=null;this.app.Scene.on("loaded",(function(){(i=n.app.core.get("Player")).EditOverlay=new _s(i),i.OverlayManager=new Os(i),n.deferred.resolve(),n.app.Scene.emit("BoxVideo.loaded")})),this.edit.enter=function(){n.waitOverlayManager((function(){var e=function(){i.EditOverlay.transformControls?i.EditOverlay.enter():i.EditOverlay.init(),setTimeout((function(){var e=i.OverlayManager.group.children.filter((function(e){return"video"==e.overlayType}))[0];e&&i.OverlayManager.clickOverlay(e,{dontEmit:!0})}),0)};"panorama"==i.model.mode?e():n.app.Camera.once("mode.afterChange",e)}),n.edit.enter.bind(n))},this.edit.exit=function(){i&&i.EditOverlay.leave()},this.edit.save=function(e){var t;try{t=i.EditOverlay.getOverlaySavingInfo()}catch(e){console.error(e)}return"save"===e&&i.modelSideManager.recover(),t},this.edit.undoEdit=function(){i.EditOverlay.undoEdit(),i.modelSideManager.recover()},this.edit.add=function(){i.EditOverlay.beginToAddPlane(),i.mode===xt.FLOORPLAN&&i.model.floorplanCadImg.hideCadPlane(),i.modelSideManager.tempAuto()},this.edit.upload=function(e,t){t.videoWidth||t.width?i.EditOverlay.overlayUploaded(e,t):t.onloadedmetadata=function(){i.EditOverlay.overlayUploaded(e,t)}},this.edit.delete=function(e,t){var o=n.getOverlayBySid(e);i.EditOverlay.DeleteOverlay(o,t)},this.edit.lookAt=function(e){var t=n.getOverlayBySid(e);i.OverlayManager.clickOverlay(t,{dontEmit:!0})},this.edit.select=function(e){var t=n.getOverlayBySid(e);i.OverlayManager.clickOverlay(t),i.mode===xt.FLOORPLAN&&i.model.floorplanCadImg.hideCadPlane(),i.modelSideManager.tempAuto()},this.edit.unselect=function(){var e=i.EditOverlay.editPlane;e&&(e.raycastToFindFloor(),e.updateVisibleOnFloor(),i.EditOverlay.controlSelectOverlay(null),i.EditOverlay.editPlane=null),i.mode===xt.FLOORPLAN&&i.model.floorplanCadImg.showCadPlane(),i.emit("endEditOverlay")},this.edit.setVisible=function(e,t){var o=n.getOverlayBySid(e);t?o.show("forceHide"):o.hide("forceHide"),i.EditOverlay.editPlane&&i.EditOverlay.controlSelectOverlay(o.visible?o:null)},this.edit.reverse=function(e){var t=i.EditOverlay.editPlane;t.scale.x=Math.abs(t.scale.x)*(e?-1:1)},this.edit.transfrom=function(e){if(i.EditOverlay.editing){var t=i.EditOverlay.transformControls;setTimeout((function(){t.mode=0==e?"translate":1==e?"scale":"rotate";var n=i.EditOverlay.editPlane;n.visible&&n.frame.switchTranformControls(t)}),0)}},this.edit.setPlaneWH=function(e,t){var n=i.EditOverlay.editPlane;return t.value=THREE.MathUtils.clamp(t.value,t.min,t.max),"W"==e&&(n.scale.x*=t.value/n.width,n.width=t.value),"H"==e&&(n.scale.y*=t.value/n.height,n.height=t.value),n.frame&&n.frame.update({mode:"scale"}),t.value},this.edit.setThinkness=function(e){var t=i.EditOverlay.editPlane;if(e.value=THREE.MathUtils.clamp(e.value,e.min,e.max),!t.frame)return 0==e.value?(t.addBox(!1),t.depth=.001,t.scale.z=.001):(t.addBox(!0),t.depth=e.value/100,t.scale.z=e.value/100/at.overlay.depth),e.value;t.depth=e.value/100,t.frame.setFrameThickness(t.depth)},this.edit.resetRatio=function(){var e=i.EditOverlay.editPlane;e.overlayType&&(e.width/=e.scale.x,e.height/=e.scale.y,e.scale.setX(1),e.scale.setY(1),i.EditOverlay.updateOverlayScaleDisplay(),i.EditOverlay.useImgRatio(),e.frame&&e.frame.update({mode:"scale"}))},this.edit.getCurentPanoVisi=function(){return i.OverlayManager.group.children.filter((function(e){return e.visiblePanos.find((function(e){return e==i.currentPano}))}))},this.edit.setOverlayFrame=function(e){var t=i.EditOverlay.editPlane;if(t.addFrame(e.type),t.visible){var n=i.EditOverlay.transformControls;t.frame?t.frame.switchTranformControls(n):n.attach(t)}},this.edit.limitToCurrentPano=function(e){var t=i.EditOverlay.editPlane;t.limitToOnlyPano=!!e&&i.currentPano,t.show("limitToOnlyPano")}}return u(e,[{key:"showAll",value:function(){var e=this;this.waitOverlayManager((function(){e.app.core.get("Player").OverlayManager.setGroupVisible(!0)}),this.showAll.bind(this))}},{key:"hideAll",value:function(){var e=this;this.waitOverlayManager((function(){e.app.core.get("Player").OverlayManager.setGroupVisible(!1)}),this.hideAll.bind(this))}},{key:"waitOverlayManager",value:function(e,t){var n=this.app.core.get("Player");n&&n.OverlayManager&&n.EditOverlay?e&&e():this.deferred.then((function(){return t()}))}},{key:"operable",value:function(e){var t=this.app.core.get("Player");t.OverlayManager&&t.OverlayManager.group.children.forEach((function(t){var n=e?Lt:Ht;t.layers.set(n),t.children.forEach((function(e){return e.layers.set(n)}))}))}}]),e}(),wR=function(e){f(n,e);var t=ER(n);function n(e){var i;return o(this,n),(i=t.call(this)).BoxVideo=new bR(e),i}return n}(yo);function xR(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}var CR=function(e){f(n,e);var t=xR(n);function n(e){var i,r;o(this,n),(i=t.call(this)).app=e,i.edit={},i.mosaic=oe(),i.mosaics=[];var a=oe();return i.app.Scene.on("loaded",(function(){i.mosaics=i.app.store.getValue("metadata").mosaicList||[],r=i.app.core.get("Player"),a.resolve()})),i.edit.focusVideo=function(e){var t=r.model.panos.index[e];r.flying?r.once("flying.ended",(function(){i.edit.focusVideo(e)})):r.flyToPano({pano:t},(function(){}))},i.edit.startPaint=function(){r.flyToNewMode({mode:"panorama",pano:r.currentPano,callback:function(){r.paintEditor.start(),r.OverlayManager.hide("all"),r.viewLinkManager.hideAllViews()}})},i.edit.cancelPaint=function(){r.paintEditor.cancel(),r.OverlayManager.show("all"),r.viewLinkManager.showAllViews()},i.edit.selectBrush=function(e){r.paintEditor.changeBrush(e)},i.edit.setBrushSize=function(e){r.paintEditor.setBrushSize(e)},i.edit.savePaint=function(){return r.paintEditor.save()},i.edit.deletePaint=function(e){r.paintEditor.paintData=r.paintEditor.paintData.filter((function(t){return t.panoId!=e})),r.currentPano.id==e&&r.paintEditor.updatePanoPaint(e,e)},i.edit.checkPaintEdit=function(){return r.paintEditor.hasEdit},i}return u(n,[{key:"install",value:function(e,t){this[e]&&this[e].resolve(t)}}]),n}(yo);function TR(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}var IR,kR=window.navigator.userAgent,BR=function(){function e(t){o(this,e),this.app=t}return u(e,[{key:"add",value:function(e,t){e.audio&&this.remove(e);var n=e.music;if(!e.music){if(!t)return;n=""}e.audio=new Howl({preload:!0,src:[this.app.resource.getUserResourceURL(n,!0)],loop:!1,html5:(t||kR.indexOf("VivoBrowser"),!1),format:["mp3"],onloaderror(e,t){console.log(e,t)},onplayerror:function(e){console.log(e)},onload(){}}),e.audio.on("play",(function(){})),e.audio.on("pause",(function(){})),e.audio.on("end",(function(){t&&(e.audio.play(),e.audio.pause())}))}},{key:"remove",value:function(e){e.audio&&(e.audio.unload(),e.audio=null,delete e.audio)}},{key:"play",value:function(){}}]),e}(),PR=function(e){f(i,e);var t,n=TR(i);function i(e){var t;return o(this,i),(t=n.call(this)).app=e,t.partId=0,t.frameId=0,t.playing=!1,t.tours=[],t.player=oe(),t.recorder=oe(),t.audioPlayer=new BR(e),t.app.store.on("tours",(function(e){e.forEach((function(e){e.list=e.list.filter((function(e){return"panorama"!==e.enter.mode||t.app.core.get("Player").model.panos.get(e.enter.panoId)}))}));for(var n=e.length;n--;n>=0)0==e[n].list.length&&e.splice(n,1);t.tours=e,t.load(),t.emit("loaded",t.tours)})),t.edit={},t.edit.enterModule=function(){t.editing=!0},t.edit.leaveModule=function(){t.editing=!1},t}return u(i,[{key:"uuid",value:function(){return De.getRandomSid()}},{key:"load",value:function(e,t){var n=this,i=null;e&&(this.tours=e),this.tours.forEach((function(e){n.audioPlayer.add(e,t),e.list.forEach((function(e){delete e._trans,null==i||"panorama"==i.enter.mode&&"panorama"==e.enter.mode&&i.enter.panoId!=e.enter.panoId||(i._notrans=!0),i=e}))}))}},{key:"reload",value:(t=k(S.mark((function e(){return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.partId=0,this.frameId=0,this.playing=!1,e.next=5,this.app.store.get("tours",!0);case 5:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})},{key:"install",value:function(e,t){this[e]&&this[e].resolve(t)}},{key:"toJSON",value:function(){for(var e=[],t=JSON.parse(JSON.stringify(this.tours,(function(e,t){return"audio"===e?null:t}))),n=t.length-1;n>=0;n--){var i=t[n];i.list&&i.list.length?(delete i.audio,delete i._uploaded,i.music&&0===i.music.indexOf("blob:")&&(i.music=i.musicName.replace(/(.+)\.(.+)/,"tour-audio-".concat(i.sid,".$2"))),i.list.forEach((function(e,t){delete e._notrans,delete e.enter._uploaded,delete e.exit._uploaded,e.enter&&e.enter.cover&&0===e.enter.cover.indexOf("data:image")&&(e.enter.cover="tour-enter-".concat(e.sid,".jpg")),e.exit&&e.exit.cover&&0===e.exit.cover.indexOf("data:image")&&(e.exit.cover="tour-exit-".concat(e.sid,".jpg"))}))):t.splice(n,1)}return this.tours.forEach((function(t,n){t.list.forEach((function(t,n){t.enter&&t.enter.cover&&0===t.enter.cover.indexOf("data:image")&&e.push(Wk(jk(t.enter.cover),"tour-enter-".concat(t.sid,".jpg"))),t.exit&&t.exit.cover&&0===t.exit.cover.indexOf("data:image")&&e.push(Wk(jk(t.enter.cover),"tour-exit-".concat(t.sid,".jpg")))}))})),{tours:t,files:e}}}]),i}(yo);function RR(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}var MR=.7,SR=3,DR=1.78,LR=function(e){f(i,e);var t,n=RR(i);function i(e){var t;return o(this,i),(t=n.call(this)).app=e,t.editing=!1,t.temp={onRangeChange:0},t}return u(i,[{key:"enter",value:function(e){var t=this;if(!this.editing){if(this.editing=!0,!(IR=this.app.core.get("Player")))return this.app.Scene.on("loaded",(function(){t.editing&&t.enter(e)}));this.setPlayerSize(!0),this.oldStates={zoomMax:at.zoom.max,zoomMin:at.zoom.min,zoomEnabled:at.zoom.enabled,zoomToDefaultWhenToPano:at.zoom.zoomToDefaultWhenToPano},at.zoom.max=3,at.zoom.min=.7,at.zoom.enabled=!0,at.zoom.zoomToDefaultWhenToPano=!1,this.eventList={zoomTo:e.bind(this),setSize:this.setPlayerSize.bind(this),update:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.hasChanged,i=void 0!==n&&n,o=arguments.length>1?arguments[1]:void 0;if(IR.lastFrameChanged||o){var r=IR.cameraControls.activeControl;if("dollhouse"==IR.mode){var a=r.camera.position.distanceTo(r.target),s=ge.linearClamp(a,r.minDistance,Math.max(r.maxDistance/2,r.minDistance+3),SR,MR);e(s)}else if("floorplan"==IR.mode&&i.cameraProjectionChanged){var l=r.getDefaultAbsoluteScale(IR.model.size),c=Math.max(at.zoomNearLimit,.5*l),u=Math.min(at.zoomFarLimit,2.5*l),h=ge.linearClamp(r.absoluteScale,c,u,SR,MR);e(h)}}}},IR.on("zoomTo",this.eventList.zoomTo),IR.on("setSize",this.eventList.setSize),IR.on("update",this.eventList.update),this.eventList.zoomTo(IR.zoomLevel),this.eventList.update(0,!0),at.highestQualityTile=!0}}},{key:"leave",value:function(){this.editing=!1,console.log("退出,恢复"),IR&&(IR.zoomTo(1),at.zoom.enabled=this.oldStates.zoomEnabled,at.zoom.max=this.oldStates.zoomMax,at.zoom.min=this.oldStates.zoomMin,at.zoom.zoomToDefaultWhenToPano=this.oldStates.zoomToDefaultWhenToPano,IR.off("zoomTo",this.eventList.zoomTo),IR.off("setSize",this.eventList.setSize),IR.off("update",this.eventList.update),at.highestQualityTile=!1,this.setPlayerSize(!1))}},{key:"setPlayerSize",value:function(e){if(e){var t=document.querySelector(".ui-editor-head").offsetHeight,n=window.innerHeight-t,i=window.innerWidth;if(i/n<DR){var o=i/DR;IR.domElement.style.height="".concat(o,"px"),IR.domElement.style.top=(n-o)/2+t+"px"}else IR.domElement.style.top="".concat(t,"px"),IR.domElement.style.height="calc(100% - ".concat(t,"px)")}else IR.domElement.style.top=0,IR.domElement.style.height="100%"}},{key:"waitTexLoaded",value:function(e){var t=this;if("panorama"==IR.mode){if(!IR.currentPano||IR.flying)return console.log("延迟"),e||(e=oe()),setTimeout((function(){t.waitTexLoaded(e)}),100),e.promise();var n=this.getTileSize(),i=new THREE.Vector3(0,0,-1).applyQuaternion(IR.quaternion),o=IR.cameraControls.activeControl.camera,r=o.fov,a=Aa.getHFOVForCamera(o,o.aspect,1),s=IR.currentPano.loadTiledPano(n,i,{hFov:a,vFov:r},!1,!1,!0);return s.done((function(){console.log("加载完成"),e&&e.resolve()})),s}return oe().resolve().promise()}},{key:"getMaxHeight",value:function(){return"2k"==this.app.core.get("QualityManager").tileClass?4096:"4k"==this.app.core.get("QualityManager").tileClass?8192:1024}},{key:"getTileSize",value:function(){return"2k"==this.app.core.get("QualityManager").tileClass?2048:"4k"==this.app.core.get("QualityManager").tileClass?4096:512}},{key:"getPicSize",value:function(){if("panorama"!=IR.mode)return{width:1780,height:1e3};var e=this.getMaxHeight(),t=IR.cameraControls.activeControl.camera.fov/180*e,n=t*DR;return{width:Math.round(n),height:Math.round(t)}}},{key:"listenZoomLevel",value:function(e){}},{key:"onResetCamera",value:function(){"panorama"==IR.mode&&(IR.cameraControls.activeControl.lat=0)}},{key:"onResumeSize",value:function(){var e=this;if(IR){var t=IR.cameraControls.activeControl;if("transitioning"==IR.mode)return IR.once("mode.changed",(function(t,n){e.editing&&e.onResumeSize()}));"panorama"==IR.mode?IR.zoomTo(1):"dollhouse"==IR.mode?(t.target.copy(IR.model.center),this.onRangeChange({value:100})):"floorplan"==IR.mode&&(t.target.setX(IR.model.center.x),t.target.setZ(IR.model.center.z),t.camera.position.setX(IR.model.center.x),t.camera.position.setZ(IR.model.center.z),t.rotateToView(IR.model.size,IR.getDirection()),t.zoomToContain(IR.model.size))}}},{key:"onRangeChange",value:function(e){var t=this;this.temp.onRangeChange=e;var n=IR.cameraControls.activeControl,i=Math.round(e.value)/100;if(i<MR?(i=MR,this.eventList.zoomTo(i)):i>SR&&(i=SR,this.eventList.zoomTo(i)),"transitioning"==IR.mode)return IR.once("mode.changed",(function(e,n){t.editing&&t.onRangeChange(t.temp.onRangeChange)}));if("panorama"==IR.mode)at.zoom.enabled=!0,IR.zoomTo(i);else if("dollhouse"==IR.mode){var o=ge.linearClamp(i,MR,SR,Math.max(n.maxDistance/2,n.minDistance+3),n.minDistance);n.camera.position.copy(n.target).add(IR.getDirection().multiplyScalar(-o))}else if("floorplan"==IR.mode){var r=n.getDefaultAbsoluteScale(IR.model.size),a=Math.max(at.zoomNearLimit,.5*r),s=Math.min(at.zoomFarLimit,2.5*r);n.absoluteScale=ge.linearClamp(i,MR,SR,s,a)}}},{key:"imgAddLabel",value:(t=k(S.mark((function e(t,n,i,o){var r,a,s,l,c;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return(r=new Image).setAttribute("crossOrigin","Anonymous"),r.src=t,s=0,l=n?2:1,c=!!n,e.abrupt("return",new Promise((function(e,t){var u=function(){var t=k(S.mark((function t(){var n,u,h;return S.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!(++s>=l)){t.next=27;break}if(!c){t.next=13;break}if(console.log("labelInfo",i),i.opacity/=100,n=De.imgAddLabel(r,a,i),!o){t.next=12;break}return r.src=n,c=!1,t.abrupt("return");case 12:e(n);case 13:if(!o){t.next=27;break}return o.player=IR,console.log("lonlatInfo",o),u=r.width*o.widthRatioToImg/201,o.textAlign="left",o.fontsize&&(o.fontsize*=u),o.margin&&(o.margin.x*=u,o.margin.y*=u),o.borderRadius&&(o.borderRadius*=u),o.lineSpace=7*u,t.next=25,De.imgAddText(r,o.location.text,o);case 25:h=t.sent,e(h);case 27:case"end":return t.stop()}}),t)})));return function(){return t.apply(this,arguments)}}();n&&((a=new Image).src=n,a.setAttribute("crossOrigin","Anonymous"),a.onload=u),r.onload=u})));case 7:case"end":return e.stop()}}),e)}))),function(e,n,i,o){return t.apply(this,arguments)})}]),i}(yo),FR=function(){function e(t){o(this,e),this.app=t,this.num=this.app.config.num}var t,n,i;return u(e,[{key:"setEntry",value:(i=k(S.mark((function e(){var t;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return(t={}).entry=this.app.Camera.getScreenshotInfo(),e.next=4,this.app.Camera.screenshot();case 4:return t.thumbs=e.sent,this.app.core.get("Scene").firstView.updateByEntry(t.entry,this.app.core.get("Player").model.panos),e.abrupt("return",t);case 7:case"end":return e.stop()}}),e,this)}))),function(){return i.apply(this,arguments)})},{key:"saveEntry",value:(n=k(S.mark((function e(){var t,n,i,o,r=arguments;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=r.length>0&&void 0!==r[0]?r[0]:"thumb-1k.jpg",e.next=3,this.setEntry();case 3:return n=e.sent,i={num:this.num,bizType:"settings-thumb",files:n.thumbs.map((function(e){return Wk(e.data,"thumb-".concat(e.name,".jpg"))}))},o=null,e.prev=6,e.next=9,this.app.remote_editor.upload_files(i);case 9:o=e.sent,e.next=15;break;case 12:return e.prev=12,e.t0=e.catch(6),e.abrupt("return",Promise.reject(e.t0));case 15:if(o.success){e.next=17;break}return e.abrupt("return",Promise.reject(o));case 17:return e.prev=17,e.next=20,this.app.remote_editor.saveInitialPage({num:this.num,fileName:t,data:JSON.stringify(n.entry)});case 20:return o=e.sent,e.abrupt("return",o);case 24:return e.prev=24,e.t1=e.catch(17),e.abrupt("return",Promise.reject(e.t1));case 27:case"end":return e.stop()}}),e,this,[[6,12],[17,24]])}))),function(){return n.apply(this,arguments)})},{key:"publish",value:(t=k(S.mark((function e(){return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.app.remote_editor.publicScene({num:this.num});case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})}]),e}();function HR(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}var VR=function(e){f(n,e);var t=HR(n);function n(e){var i;return o(this,n),(i=t.call(this)).app=e,i.records=[],i.paints=[],i.isPaint=!0,i.isPainting=!1,i.isUndo=!1,i.role="leader",i.colors={leader:"#00c8af",follow:"#3A78E7"},i}return u(n,[{key:"show",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.role,n=e.colors,i=e.paint,o=e.ele;this.player=this.app.core.get("Player"),this.$paint=this.elem(o),this.$paint.style.display="",this.isPainting=!0,this.role="leader"==t?"leader":"follow",n&&Object.assign(this.colors,n),this.isPaint=!1!==i,this.onStart()}},{key:"hide",value:function(){this.isPainting=!1,this.isUndo=!1,this.paints=[],this.records=[],this.$paint&&(this.$paint.style.display="none",this.context.clearRect(0,0,this.canvas.width,this.canvas.height));var e=this.app.core.get("Player").currentPano;e&&e.hasVideo&&this.app.core.get("PanoVideoRenderer").activatePanorama(e)}},{key:"elem",value:function(e){var t=this.app.$plugins.querySelector("[xui_sync_paint]");if(null==t){var n='<div xui_sync_paint style="display:none">\n <canvas></canvas>\n </div>\n <style>\n [xui_sync_paint] {\n position: absolute;\n width: 100%;\n height: 100%;\n z-index: 1000;\n }\n [xui_sync_paint] canvas {\n position: absolute;\n width: 100%;\n height: 100%;\n pointer-events: all;\n }\n </style>\n ';e?(document.querySelector(e).insertAdjacentHTML("afterbegin",n),t=document.querySelector(e).querySelector("[xui_sync_paint]")):(this.app.$plugins.insertAdjacentHTML("beforeend",n),t=this.app.$plugins.querySelector("[xui_sync_paint]")),this.bind(t)}return t}},{key:"bind",value:function(e){var t,n=this;this.mouse=new THREE.Vector2,this.canvas=e.querySelector("canvas"),this.context=this.canvas.getContext("2d"),this.canvas.onmousedown=function(e){n.isPaint&&(e.preventDefault(),n.beginStroke({x:e.clientX,y:e.clientY}))},this.canvas.onmouseup=function(e){n.isPaint&&(e.preventDefault(),n.endStroke())},this.canvas.onmousemove=function(e){n.isPaint&&(e.preventDefault(),n._mouseDown&&n.moveStroke({x:e.clientX,y:e.clientY}))},this.canvas.addEventListener("touchstart",(function(e){n.isPaint&&(e.preventDefault(),t=e.touches[0],n.beginStroke({x:t.pageX,y:t.pageY}))})),this.canvas.addEventListener("touchmove",(function(e){n.isPaint&&(e.preventDefault(),n._mouseDown&&(t=e.touches[0],n.moveStroke({x:t.pageX,y:t.pageY})))})),this.canvas.addEventListener("touchend",(function(e){n.isPaint&&(e.preventDefault(),n.endStroke())}))}},{key:"onStart",value:function(){var e=window.devicePixelRatio||1,t=this.canvas.getBoundingClientRect();this.ratio=1,this.canvas.width=t.width*e,this.canvas.height=t.height*e,this.context.scale(e,e),this.context.clearRect(0,0,this.canvas.width,this.canvas.height),this._endTime=0,this._mouseDown=!1,this._lastTimestamp=0,this._lastLineWidth=-1,this._lastPosition={x:0,y:0},ge.convertScreenPositionToNDC(0,0,this.mouse,this.app.dom);var n=pt.getMouseIntersect(this.player.camera,[this.player.model.skybox],this.mouse);this.placeIntersectPlane(n&&n.point)}},{key:"onRecord",value:function(e){this.transformTo3d(e),this.records.push(e),this.emit("data",{type:"paint",data:e})}},{key:"beginStroke",value:function(e){this._mouseDown=!0,this._lastTimestamp=Date.now(),this._lastPosition=this.windowToCanvas(e.x,e.y),this.paints.push({width:0,x:this._lastPosition.x,y:this._lastPosition.y,t:5})}},{key:"moveStroke",value:function(e){var t=Date.now(),n=this.windowToCanvas(e.x,e.y),i=this.calcDistance(n,this._lastPosition),o=t-this._lastTimestamp,r=this.calcLineWidth(o,i);this.context.beginPath(),this.context.moveTo(this._lastPosition.x,this._lastPosition.y),this.context.lineTo(n.x,n.y),this.paints.push({color:this.colors[this.role]||"#00c8af",width:r,x:n.x,y:n.y,t:5}),this.context.strokeStyle=this.colors[this.role]||"#00c8af",this.context.lineWidth=r,this.context.lineCap="round",this.context.linJoin="round",this.context.stroke(),this._lastPosition=n,this._lastTimestamp=t,this._lastLineWidth=r}},{key:"endStroke",value:function(){this.paints.push({width:0,x:this._lastPosition.x,y:this._lastPosition.y,t:0}),this.onRecord(this.paints),this.paints=[],this.isUndo=!0,this._mouseDown=!1,this._lastTimestamp=0,this._endTime=Date.now()}},{key:"calcDistance",value:function(e,t){return Math.sqrt((e.x-t.x)*(e.x-t.x)+(e.y-t.y)*(e.y-t.y))}},{key:"calcLineWidth",value:function(e,t){var n,i=t/e;return n=i<=.1?6:i>=3?2:6-(i-.1)/2.9*2,-1==this._lastLineWidth?n:2*this._lastLineWidth/3+1*n/3}},{key:"windowToCanvas",value:function(e,t){var n=this.canvas.getBoundingClientRect();return{x:Math.round(e-n.left),y:Math.round(t-n.top)}}},{key:"placeIntersectPlane",value:function(e){if(!this.intersectPlane){var t=new THREE.PlaneGeometry(8e3,8e4,1,1);this.intersectPlane=new THREE.Mesh(t,new THREE.MeshBasicMaterial({transparent:!0,wireframe:!1,opacity:0,side:THREE.DoubleSide,depthTest:!1})),this.intersectPlane.lookAt(new THREE.Vector3(0,1,0)),this.intersectPlane.name="intersectPlane",this.player.model.add(this.intersectPlane)}if(e){this.intersectPlane.position.copy(e);var n=this.player.getDirection(null,this.player.camera);this.intersectPlane.lookAt(e.clone().add(n))}}},{key:"transformTo3d",value:function(e){var t=this;0!=e.length&&e.forEach((function(e){ge.convertScreenPositionToNDC(e.x,e.y,t.mouse,t.app.dom);var n=pt.getMouseIntersect(t.player.camera,[t.intersectPlane],t.mouse);n?e.pos3d=n.point:console.error("no intersect ??")}))}},{key:"transformTo2d",value:function(e){var t=this;e.forEach((function(e){var n=new THREE.Vector3(e.pos3d.x,e.pos3d.y,e.pos3d.z),i=pt.getPos2d(n,t.player,t.player.camera);e.x=i.pos.x,e.y=i.pos.y}))}},{key:"undo",value:function(){this.records.pop(),this.context.clearRect(0,0,this.canvas.width,this.canvas.height);for(var e=0;e<this.records.length;e++)this.paint(this.records[e],0);this.emit("data",{type:"undo"})}},{key:"paint",value:function(e){for(var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:5,i=function(i){n?e[i].t&&setTimeout((function(){t.context.beginPath(),t.context.strokeStyle=e[i].color,t.context.moveTo(e[i].x*t.ratio,e[i].y*t.ratio),t.context.lineTo(e[i+1].x*t.ratio,e[i+1].y*t.ratio),t.context.lineWidth=e[i].width*t.ratio,t.context.lineCap="round",t.context.linJoin="round",t.context.stroke()}),n):e[i].t&&(t.context.beginPath(),t.context.strokeStyle=e[i].color,t.context.moveTo(e[i].x*t.ratio,e[i].y*t.ratio),t.context.lineTo(e[i+1].x*t.ratio,e[i+1].y*t.ratio),t.context.lineWidth=e[i].width*t.ratio,t.context.lineCap="round",t.context.linJoin="round",t.context.stroke())},o=0;o<e.length-1;o++)i(o)}},{key:"receive",value:function(e){if("undo"==e.type){this.records.pop(),this.context.clearRect(0,0,this.canvas.width,this.canvas.height);for(var t=0;t<this.records.length;t++)this.paint(this.records[t],0)}else this.transformTo2d(e.data),this.paint(e.data),this.records.push(e.data)}}]),n}(yo);function OR(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function QR(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}var _R="rotate",zR="zoom",UR="endRotation",NR="moveModel",GR="flying.started",jR="flying.ended",WR=0,qR=function(e){f(n,e);var t=QR(n);function n(e){var i;return o(this,n),(i=t.call(this)).index=WR++,i.app=e,i.inited=!1,i.started=!1,i}return u(n,[{key:"init",value:function(){var e=this;this.inited=!0;var t,n=this.app.core.get("Player");"leader"!=this.role&&this.role||(this.app.Camera.on(GR,(function(t){return e.emitData(t)})),this.app.Camera.on(zR,(function(t){return e.emitData(t)})),this.app.Camera.on(NR,(function(t){return e.emitData(t)})),n.viewLinkManager.addEventListener("loaded",(function(){e.started&&n.viewLinkManager.hideAllViews()})),this.app.Camera.on(_R,(function(n){e.emitData(n),clearTimeout(t),t=null})),this.app.Camera.on(UR,(function(i){if(e.emitData(i),"leader"==e.role){var o=0,r=20;t=function(){e.emitData({type:"syncRotContinue",quaternion:n.quaternion}),o++<10&&t&&"panorama"==n.mode&&setTimeout(t,r+=20)},setTimeout(t,r)}})));"follow"==this.role&&this.app.Camera.on(jR,this.requestSync.bind(this))}},{key:"start",value:function(){this.started=!0,this.inited||(this.init(),this.app.core.get("Player").setPanoTaskEnable(!1),this.app.configSync||(this.app.VRScreenSYNC=!0,at.zoom.enabled=!1),this.app.core.get("Player").viewLinkManager.loaded&&this.app.core.get("Player").viewLinkManager.hideAllViews())}},{key:"exit",value:function(){this.started=!1,this.app.core.get("Player").setPanoTaskEnable(!0),this.app.core.get("Player").locked=!1,this.app.VRScreenSYNC=!1,at.zoom.enabled=!0,this.app.core.get("Player").viewLinkManager.loaded&&this.app.core.get("Player").viewLinkManager.showAllViews()}},{key:"sync",value:function(){var e=this.app.core.get("Player"),t=e.modeTran.split("-")[1];if(t===xt.PANORAMA){var n=null;e.mode==xt.PANORAMA&&null!=e.nextPano?n=e.nextPano.id:e.currentPano&&(n=e.currentPano.id),this.emitData({panoId:n,quaternion:e.quaternion,mode:t,type:"flyToPano"})}else{var i={quaternion:e.quaternion,position:e.position,currentScale:e.cameraControls.controls.floorplan.currentScale,mode:t,type:"flyToNewMode"};e.cameraControls.activeControl&&(i.target={x:e.cameraControls.activeControl.target.x,y:e.cameraControls.activeControl.target.y,z:e.cameraControls.activeControl.target.z}),this.emitData(i)}}},{key:"requestSync",value:function(e){var t=this;setTimeout((function(){t.emitData({type:"requestSync"})}),1)}},{key:"emitData",value:function(e){var t=this.app.core.get("Player");if("receive"!=t.syncType){if(this.started){if(e)for(var n in e){var i=e[n];i instanceof THREE.Vector2?e[n]=new THREE.Vector2(i.x,i.y):i instanceof THREE.Vector3&&(e[n]=new THREE.Vector3(i.x,i.y,i.z))}this.emit("data",function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?OR(Object(n),!0).forEach((function(t){xh(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):OR(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}({},e))}}else t.syncType=null}},{key:"transform",value:function(e){e.target&&e.target instanceof THREE.Vector3==!1&&(e.target=new THREE.Vector3(e.target.x,e.target.y,e.target.z)),e.position&&e.position instanceof THREE.Vector3==!1&&(e.position=new THREE.Vector3(e.position.x,e.position.y,e.position.z)),e.quaternion&&e.quaternion instanceof THREE.Quaternion==!1&&(e.quaternion.hasOwnProperty("_x")?e.quaternion=new THREE.Quaternion(e.quaternion._x,e.quaternion._y,e.quaternion._z,e.quaternion._w):e.quaternion=new THREE.Quaternion(e.quaternion.x,e.quaternion.y,e.quaternion.z,e.quaternion.w)),e.rotationSpeed&&e.rotationSpeed instanceof THREE.Vector2==!1&&(e.rotationSpeed=new THREE.Vector2(e.rotationSpeed.x,e.rotationSpeed.y)),e.info&&this.transform(e.info),e.modelInfo&&this.transform(e.modelInfo)}}]),n}(yo);function JR(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}var YR=function(e){f(n,e);var t=JR(n);function n(e){var i;return o(this,n),(i=t.call(this,e)).toSame=function(e,t,n){if(e.mode==t.mode){if(e.mode==xt.PANORAMA){if(e.currentPanoId==t.currentPano.id)return!0;var i=t.model.panos.index[parseInt(e.currentPanoId)];return t.flyToPano({pano:i},n),!1}return!0}return t.mode==xt.TRANSITIONING?null:e.mode==xt.FLOORPLAN?(t.flyToNewMode({mode:xt.FLOORPLAN,callback:n}),!1):e.mode!=xt.DOLLHOUSE||(t.flyToNewMode({mode:xt.DOLLHOUSE,target:e.info.target,position:e.info.position,quaternion:e.info.quaternion?(new THREE.Quaternion).set(e.info.quaternion._x,e.info.quaternion._y,e.info.quaternion._z,e.info.quaternion._w):null,panoId:null,callback:n}),!1)},i.syncRotate=function(e,t){var n=new THREE.Quaternion(e.quaternion._x,e.quaternion._y,e.quaternion._z,e.quaternion._w),i=new THREE.Vector3(0,0,-1).applyQuaternion(n).add(t.cameraControls.activeControl.camera.position);t.cameraControls.activeControl.lookAt(i)},i.copyCameraProp=function(e,t){var n=e.cameraControls.activeControl,i=n.camera;t.position&&i.position.copy(t.position),t.quaternion&&i.quaternion.set(t.quaternion._x,t.quaternion._y,t.quaternion._z,t.quaternion._w),t.target&&n.target.copy(t.target),t.scale&&(n.absoluteScale=t.scale,n.updateZoom())},i}return u(n,[{key:"receive",value:function(e){var t=this.app.core.get("Player"),n=!0;switch(this.transform(e),e.type){case"flyToPano":t.syncType="receive";var i=t.model.panos.index[parseInt(e.panoId)],o={};o.pano=i,e.quaternion&&(o.quaternion=(new THREE.Quaternion).set(e.quaternion._x,e.quaternion._y,e.quaternion._z,e.quaternion._w)),t.flyToPano(o);break;case"flyToNewMode":t.syncType="receive",e&&e.panoId&&(e.pano=t.model.panos.index[parseInt(e.panoId)]),"panorama"==t.model.mode&&this.app.configSync&&(this.app.dom.parentElement.style.width="100%",this.app.configSync.dom.style.width="0",this.app.dom.parentElement.style.height="100%",this.app.configSync.dom.style.height="0"),setTimeout((function(){return t.flyToNewMode(e)}),50);break;case"rotate":t.model.mode==xt.PANORAMA&&(n=this.toSame(e,t,function(){this.syncRotate(e,t)}.bind(this)))&&this.syncRotate(e,t);break;case"endRotation":t.cameraControls&&t.cameraControls.activeControl&&(t.cameraControls.activeControl.lockedForce=!1,t.cameraControls.activeControl.rotationSpeed=e.rotationSpeed||new THREE.Vector2);break;case"zoom":t.zoomTo(e.zoomLevel);break;case"moveModel":null==(n=this.toSame(e,t,function(){this.copyCameraProp(t,e.info)}.bind(this)))||n&&this.copyCameraProp(t,e.info)}}}]),n}(qR);function ZR(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}var XR,KR,$R=function(e){f(n,e);var t=ZR(n);function n(e){var i;return o(this,n),(i=t.call(this,e)).toSame=function(e,t,n){if(e.mode==t.mode){if(e.mode==xt.PANORAMA){if(e.currentPanoId==t.currentPano.id)return!0;var i=t.model.panos.index[parseInt(e.currentPanoId)],o=t.locked;return t.locked=!1,t.flyToPano({pano:i},n),t.locked=o,!1}return!0}return t.mode==xt.TRANSITIONING?null:e.mode==xt.FLOORPLAN?(t.flyToNewMode({mode:xt.FLOORPLAN,callback:n}),!1):e.mode!=xt.DOLLHOUSE||(t.flyToNewMode({mode:xt.DOLLHOUSE,target:e.info.target,position:e.info.position,quaternion:e.info.quaternion?(new THREE.Quaternion).set(e.info.quaternion._x,e.info.quaternion._y,e.info.quaternion._z,e.info.quaternion._w):null,panoId:null,callback:n}),!1)},i.syncRotate=function(e,t){this.stopLerpQua(t),this.pauseSyncRot=!1;var n=t.cameraControls.activeControl.camera.quaternion.clone(),i=new THREE.Quaternion(e.quaternion._x,e.quaternion._y,e.quaternion._z,e.quaternion._w);this.endQuaternion=i;var o=Date.now();o-this.lastUpdateTime>100?this.lerpRatio=.1:(this.lerpRatio+=.15,this.lerpRatio=Math.min(1,this.lerpRatio)),St.quaternion(n,i)(this.lerpRatio);var r=new THREE.Vector3(0,0,-1).applyQuaternion(n).add(t.cameraControls.activeControl.camera.position);t.cameraControls.activeControl.lookAt(r),t.cameraControls.activeControl.locked=!1,t.cameraControls.activeControl.update(0),t.cameraControls.activeControl.lockedForce=!0,this.lastUpdateTime=o},i.copyCameraProp=function(e,t){var n=e.cameraControls.activeControl,i=n.camera;t.position&&i.position.copy(t.position),t.quaternion&&i.quaternion.set(t.quaternion._x,t.quaternion._y,t.quaternion._z,t.quaternion._w),t.target&&n.target.copy(t.target),t.scale&&(n.absoluteScale=t.scale,n.updateZoom())},i.role="leader",i.lastUpdateTime=0,i.lerpRatio=1,i}return u(n,[{key:"start",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(this.role=t.follow?"follow":"leader",Tt(w(n.prototype),"start",this).call(this),t.follow){var i=this.app.core.get("Player");i.locked=!0,this.inited||(i.on(ea,(function(t){e.pauseSyncRot=!0,e.stopLerpQua(i)})),this.inited=!0)}}},{key:"exit",value:function(){Tt(w(n.prototype),"exit",this).call(this),this.role="leader";var e=this.app.core.get("Player");e.locked&&(e.locked=!1)}},{key:"receive",value:function(e){var t=this,n=this.app.core.get("Player"),i=!0;if(this.transform(e),"leader"==this.role)switch(e.type){case"requestSync":this.sync()}else switch(e.type){case"flyToPano":if(n.panosTaskList.length>0)return setTimeout((function(){t.requestSync()}),500);var o=n.model.panos.index[parseInt(e.panoId)];n.locked=!1;var r={pano:o};e.quaternion&&(r.quaternion=(new THREE.Quaternion).set(e.quaternion._x,e.quaternion._y,e.quaternion._z,e.quaternion._w)),"panorama"==n.mode&&n.currentPano.id==e.panoId&&(r.aimDuration=0),n.flyToPano(r,(function(){n.locked=!0}));break;case"flyToNewMode":if(console.log("flyToNewMode",e.mode),e.mode==n.mode)return e.type="moveModel",e.info={scale:e.currentScale,target:e.target,position:e.position,quaternion:e.quaternion},this.receive(e);e.panoId&&(e.pano=n.model.panos.index[parseInt(e.panoId)]),n.locked=!1,e.callback=function(){n.locked=!0},n.flyToNewMode(e);break;case"rotate":n.model.mode==xt.PANORAMA&&(i=this.toSame(e,n,function(){this.syncRotate(e,n)}.bind(this)))&&this.syncRotate(e,n);break;case"endRotation":n.cameraControls&&n.cameraControls.activeControl&&(n.cameraControls.activeControl.lockedForce=!1);break;case"syncRotContinue":n.cameraControls&&n.cameraControls.activeControl&&this.syncRotate2(e,n);break;case"zoom":null==(i=this.toSame(e,n,function(){n.handleControlScroll(e.zoom)}.bind(this)))||i&&n.handleControlScroll(e.zoom);break;case"moveModel":null==(i=this.toSame(e,n,function(){this.copyCameraProp(n,e.info)}.bind(this)))||i&&(n.cameraControls.activeControl.lockedForce=!0,n.locked=!0,this.copyCameraProp(n,e.info),n.cameraControls.activeControl.locked=!1,n.mode==xt.PANORAMA&&(n.locked=!1))}}},{key:"syncRotate2",value:function(e,t){var n=this;if(!this.pauseSyncRot&&"panorama"==t.mode){var i=new THREE.Quaternion(e.quaternion._x,e.quaternion._y,e.quaternion._z,e.quaternion._w),o=Date.now();this.lerpQuaFun&&this.stopLerpQua(t),this.lerpQuaFun=function(){if(!t.cameraControls.activeControl)return n.stopLerpQua(t);var e=t.quaternion.clone();St.quaternion(e,i)(.1);var r=new THREE.Vector3(0,0,-1).applyQuaternion(e).add(t.cameraControls.activeControl.camera.position);t.cameraControls.activeControl.lookAt(r),Date.now()-o>500&&n.stopLerpQua(t)},t.on("update",this.lerpQuaFun)}}},{key:"stopLerpQua",value:function(e){e.off("update",this.lerpQuaFun),this.lerpQuaFun=null}}]),n}(qR),eM=function e(t){o(this,e),this.sync=new YR(t),this.follow=new $R(t),this.paint=new VR(t)};function tM(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}var nM,iM={},oM=function(e){f(n,THREE.EventDispatcher);var t=tM(n);function n(e){var i;return o(this,n),(i=t.call(this)).app=e,i.app.Scene.on("loaded",(function(){XR=i.app.core.get("Player"),KR=i.app.core.get("SceneRenderer"),i.init(),i.editing&&i.enter()})),window.editView=h(i),i}return u(n,[{key:"init",value:function(){var e=this;nM=Math.max(2*Math.sqrt(XR.model.size.x*XR.model.size.x+XR.model.size.y*XR.model.size.y),30),XR.model.floors.list.forEach((function(e){var t=0;e.panos.forEach((function(e){t+=e.position.y})),t/=e.panos.length,iM[e.floorIndex]=t})),this.ground=new THREE.Mesh(new THREE.PlaneGeometry(8e4,8e4,1,1),new THREE.MeshBasicMaterial({transparent:!0,wireframe:!0,opacity:0,side:THREE.DoubleSide,depthTest:!1})),this.ground.lookAt(new THREE.Vector3(0,1,0)),this.ground.name="editviewLink-ground",this.ground.position.setY(XR.model.center.y);var t=[{x:0,y:0,z:0},{x:10,y:0,z:0}];this.linkLine=yi.createFatLine(t,{material:yi.createFatLineMat({lineWidth:3,color:"#00C8AF",dashed:!0,gapSize:.2,dashSize:.3})}),XR.model.add(this.linkLine),this.linkLine2=yi.createFatLine(t,{material:yi.createFatLineMat({lineWidth:3,opacity:.2,color:"#30FFDF"})}),XR.model.add(this.linkLine2),this.linkLine.visible=this.linkLine2.visible=!1,this.events={changeFloor:function(t,n){e.settingPos&&e.fadeMarkerByFloor(!0)},movePos:function(){e.movePos()},confirmPos:function(t){t.consume(),e.confirmPos()},dragStart:function(){e.markView&&!XR.enteringView&&(XR.viewLinkManager.hoverBalloon&&e.markView.balloon==XR.viewLinkManager.hoverBalloon&&e.dragBalloonStart(),XR.viewLinkManager.hoverExit?e.dragExitStart():XR.viewLinkManager.hoverCircle&&e.dragViewStart(XR.viewLinkManager.hoverCircle.mesh))},dragEnd:function(t){e.handelDragEnd(t)},lookAim:function(){XR.on("ifFocusPoint",(function(t){if(e.editing&&e.markView){t.importance<3&&(t.importance=3,t.aim=e.markView.circle.mesh.position.clone())}}))}},XR.viewLinkManager.dispatchEvent({type:"getViewLinkEdit",v:this}),XR.viewLinkManager.addEventListener("changeIntersect",(function(t){e.dispatchEvent({type:"changeIntersect",hovered:t.hovered})})),this.inited=!0}},{key:"enter",value:function(){this.editing=!0,KR&&(XR.model.on("floor.changed",this.events.changeFloor),XR.on("pointerStart",this.events.dragStart),XR.on("pointerMove",this.events.movePos),XR.on("pointerUp",this.events.dragEnd),XR.on("ifFocusPoint",this.events.lookAim))}},{key:"leave",value:function(){this.editing=!1,KR&&(KR.removeComponent(this),XR.model.off("floor.changed",this.events.changeFloor),XR.off("pointerStart",this.events.dragStart),XR.off("pointerUp",this.events.dragEnd),XR.off("pointerMove",this.events.movePos),XR.off("ifFocusPoint",this.events.lookAim))}},{key:"setSize",value:function(e,t){this.inited}},{key:"checkCanAddView",value:function(){return this.inited&&!XR.flying&&XR.viewLinkManager.inited}},{key:"addView",value:function(){var e=this;if(this.app.Camera.monitor.control&&this.app.Camera.monitor.control.watchingCamera){this.app.Camera.monitor.control.stopWatch();var t=XR.cameraControls.controls.dollhouse;t.target.set(0,0,0),t.camera.position.setY(50),t.resetRanges()}if(this.checkCanAddView()){this.markView=new Ml({sid:"view360_"+De.getRandomSid()},this.app),XR.viewLinkManager.addView(this.markView);var n=function(){e.markView.balloon.showOrHide(!0,0),XR.updateFromControls(),e.beginSetPos(),e.setEditState(!0),Wr.add("viewChoosePos")};XR.isOutsideMode()?n():XR.flyToMode("floorplan",n),XR.mode===xt.FLOORPLAN&&XR.model.floorplanCadImg.hideCadPlane(),XR.modelSideManager.tempAuto()}else var i=setInterval((function(){e.checkCanAddView()&&(e.addView(),clearInterval(i))}),50)}},{key:"reEditView",value:function(e){this.markView=XR.viewLinkManager.views[e],this.oldData=this.getData(),this.reEdit=!0,this.setEditState(!0),this.markView.circle.mesh.visible=!0,XR.viewLinkManager.focusOn(this.markView),"dollhouse"!=XR.mode&&"floorplan"!=XR.mode||this.markView.balloon.showOrHide(!0,0),XR.mode===xt.FLOORPLAN&&XR.model.floorplanCadImg.hideCadPlane(),XR.modelSideManager.tempAuto()}},{key:"setEditState",value:function(e){e=!!e,this.markView.setSelect(e),this.markView.balloon.setStrictScale(e),e||(this.reEdit=!1,this.markView=null),XR.emit("editViewStateChange",e)}},{key:"exit",value:function(){this.markView&&(this.stopSetPos(),this.cancelSetExit(),this.cancelSetEntry(),this.markView.circle.setSelect(!1),"panorama"!=XR.modeTran.split("-")[1]&&(this.markView.circle.mesh.visible=!1),this.markView.balloon.showOrHide(null,50,"auto"),this.setEditState(!1),XR.mode===xt.FLOORPLAN&&XR.model.floorplanCadImg.showCadPlane(),XR.modelSideManager.recover())}},{key:"cancelEdit",value:function(){this.markView&&(this.reEdit?(this.markView.titleLabel.setText(this.oldData.title),this.markView.circle.mesh.scale.set(this.oldData.circle.scale,this.oldData.circle.scale,this.oldData.circle.scale),this.markView.balloon.mesh.position.copy(this.oldData.balloon.pos),this.markView.circle.updatePos("normal",{position:this.oldData.circle.pos,quaternion:this.oldData.circle.qua}),this.markView.nearestPano=this.oldData.nearestPano,this.markView.linkType=this.oldData.linkType,this.markView.url=this.oldData.url,this.changeType(this.markView.linkType),this.markView.panoImgVersion=this.oldData.panoImgVersion,this.markView.setPano({thumbPanoTex:this.markView.thumbPanoTex!=this.oldData.thumbPanoTex&&this.oldData.thumbPanoTex}),this.markView.circle.setMapOut(this.oldData.circle.mapOut),this.markView.exitDoor.setMapOut(this.oldData.exit.mapOut),this.markView.enterQuaternion.equals(this.oldData.enterQuaternion)||(this.markView.enterQuaternion=this.oldData.enterQuaternion.clone(),"pano"==this.markView.linkType&&this.markView.mapChangeRot()),this.markView.exitDirection=this.oldData.exitDirection.clone(),this.cancelSetExit()):(XR.viewLinkManager.removeView(this.markView),this.markView.dispose()),this.exit())}},{key:"confirmEdit",value:function(){console.log("confirmEdit"),this.markView.floor!=this.markView.nearestPano.floor&&(this.markView.pano&&(this.markView.pano.floorIndex=this.markView.nearestPano.floorIndex,this.markView.pano.floor.removePano(this.markView.pano),this.markView.pano.floor=this.markView.nearestPano.floor,this.markView.pano.floor.addPano(this.markView.pano)),this.markView.floor&&this.markView.floor.removeView(this.markView),this.markView.floor=this.markView.nearestPano.floor,this.markView.floor.addView(this.markView)),this.exit()}},{key:"fadeMarkerByFloor",value:function(e){XR.model.panos.forEach((function(t){if(t.isAligned()){var n=e&&(XR.model.allFloorsVisible||!t.floor.hidden);t.marker.material.opacity=n?1:0}}))}},{key:"beginSetPos",value:function(e){this.settingPos=!0,this.markView.circle.state="sprite",this.fadeMarkerByFloor(!0),this.markView.circle.mesh.visible=!0,this.markView.update(XR.camera,!0),this.markView.circle.mesh.visible=!1,this.placeGround(),"reset"!=e&&this.movePos("init"),XR.on("click",this.events.confirmPos)}},{key:"stopSetPos",value:function(){this.settingPos&&(this.settingPos=!1,this.linkLine.visible=!1,this.linkLine2.visible=!1,this.markView.circle.state="3D",this.markView.circle.quaternion&&this.markView.circle.mesh.quaternion.copy(this.markView.circle.quaternion),this.fadeMarkerByFloor(!1),XR.off("click",this.events.confirmPos),Wr.remove("viewChoosePos"))}},{key:"confirmPos",value:function(){this.stopSetPos(),this.dispatchEvent({type:"confirm",info:{sid:this.markView.sid,balloon:{pos:this.markView.balloon.mesh.position.toArray()},circle:{pos:this.markView.circle.position.toArray(),qua:this.markView.circle.quaternion.toArray(),scale:Math.round(100*this.markView.circle.mesh.scale.x)},nearestPano:this.markView.nearestPano.id,enterQuaternion:this.markView.enterQuaternion.toArray(),exitDirection:this.markView.exitDirection.toArray()}})}},{key:"cancelPos",value:function(){this.dispatchEvent({type:"cancelPos"})}},{key:"reSetPos",value:function(){this.markView.balloon.setSelect(!0),XR.viewLinkManager.focusOn(this.markView)}},{key:"focusView",value:function(e,t){var n=XR.viewLinkManager.views[e];XR.viewLinkManager.focusOn(n,t)}},{key:"changeScale",value:function(e){this.markView.circle.mesh.scale.set(e,e,e),this.markView.titleLabel.updatePos()}},{key:"movePos",value:function(e){if(this.settingPos){var t=XR.model.center.clone();if(!(p=XR.getMouseIntersect(null,[this.ground])))return void console.error("no intersect");if(XR.model.allFloorsVisible)"init"!=e&&t.setY(this.markView.balloon.mesh.position.y);else{if(0==XR.model.currentFloor.panos.length)return console.warn("该层无漫游点!"),void this.stopSetPos();t.setY(iM[XR.model.currentFloor.floorIndex])}var n=pt.getPosAtPlane(p.point,XR,{y:t.y});n||((n=pt.getPosAtPlane(p.point,XR,{y:100})).y=t.y),n&&n.distanceTo(t)>nM&&(n=t.clone().add(n.clone().sub(t).normalize().multiplyScalar(nM)));var i=this.markView.circle.mesh.quaternion.clone(),o=De.sortByScore(XR.model.panos.list,[so.filters.isPanoAligned(),function(e){return XR.model.allFloorsVisible||e.floor==XR.model.currentFloor}],[function(e){return-n.distanceTo(e.position)}]).map((function(e){return e.item})),r=o.find((function(e){var t=e.getVideoFilter(),i=(new THREE.Vector3).copy(n).setY(e.position.y);return!t||!t(i)}));r||(r=o[0]);var a=r.position.clone();if(this.markView.nearestPano=r,n.setY(a.y),this.markView.balloon.mesh.position.copy(n),this.markView.balloon.update(),p=pt.ifIntersectChunks(a,n,XR.model,{InfinityLen:!0})){var s=p[0].face.normal.applyQuaternion(p[0].object.quaternion);f=p[0].point.add(s.multiplyScalar(.01*(1+Math.random()))),this.markView.circle.mesh.lookAt(this.markView.circle.mesh.position.clone().add(s))}else{var l=n.clone().sub(r.position).setY(0).normalize().multiplyScalar(at.boundExpandLength);f=a.clone().add(l),this.markView.circle.mesh.lookAt(this.markView.circle.mesh.position.clone().sub(l))}this.markView.circle.mesh.visible=!0,this.markView.circle.updatePos("normal",{position:f,quaternion:this.markView.circle.mesh.quaternion.clone()}),this.markView.circle.mesh.quaternion.copy(i);var c=n.clone().sub(f),u=c.length(),h=f.clone().add(c.multiplyScalar(Math.max(0,(u-.4)/u)));h.y-=.01;var d=[h,f];if(yi.moveFatLine(this.linkLine,d),a.distanceTo(f)<a.distanceTo(h))d=[a,f];else d=[a,h];yi.moveFatLine(this.linkLine2,d),this.linkLine.visible=!0,this.linkLine2.visible=!0}else if(this.draggingExit){var p=XR.getMouseIntersect(null,[XR.model.skybox]);this.markView.exitDoor.mesh.position.copy(p.point.clone().normalize().multiplyScalar(at.view360.circleDisToCenter))}else if(this.draggingCircleAtView)if(this.settingVisibles){p=XR.getMouseIntersect(null,[XR.model.skybox]);this.draggingMesh.position.copy(p.point.clone().normalize().multiplyScalar(at.view360.circleDisToCenter)),this.saveVisibleViews()}else{var f;a=XR.position.clone();if((p=pt.getMouseIntersect(XR.camera,XR.model.colliders.concat(XR.model.skybox),XR.mouse)).object==XR.model.skybox){l=p.point.clone().sub(a).normalize().multiplyScalar(at.boundExpandLength);f=a.clone().add(l),this.markView.circle.mesh.lookAt(this.markView.circle.mesh.position.clone().sub(l))}else{s=p.face.normal.applyQuaternion(p.object.quaternion);XR.getMouseDirection().angleTo(p.face.normal)<Math.PI/2&&(s=s.negate()),f=p.point.add(s.multiplyScalar(.01*(1+Math.random()))),this.markView.circle.mesh.lookAt(this.markView.circle.mesh.position.clone().add(s))}this.markView.circle.updatePos("normal",{position:f,quaternion:this.markView.circle.mesh.quaternion.clone()}),this.markView.nearestPano=XR.currentPano}}},{key:"placeGround",value:function(){this.ground.position.copy(this.markView.balloon.mesh.position),this.ground.lookAt(this.ground.position.clone().add(XR.getDirection(null,XR.camera)))}},{key:"changeType",value:function(e){console.log("changeType",e),this.markView.linkType=e,this.markView.setPano()}},{key:"changeTitle",value:function(e){this.markView.titleLabel.setText(e)}},{key:"uploadedPanoMap",value:function(e){console.log("uploadedPanoMap ",e),e.mapSrc=e.thumb,this.changeType("pano"),this.markView.pano,this.markView.setPano({reloadTex:!0,mapSrc:e.mapSrc,thumb:e.thumb})}},{key:"setLinkUrl",value:function(e){this.markView.url=e}},{key:"setCircleMap",value:function(e,t){console.log("setCircleMap",e,t),"object"==typeof t&&(t={style:{enter:t}}),XR.viewLinkManager.views[e].circle.setMapOut(t)}},{key:"setExitMap",value:function(e,t){console.log("setExitMap",e,t),"object"==typeof t&&(t={style:{exit:t}}),XR.viewLinkManager.views[e].exitDoor.setMapOut(t)}},{key:"deleteView",value:function(e){try{XR.viewLinkManager.views[e].dispose(),XR.viewLinkManager.removeView(XR.viewLinkManager.views[e])}catch(e){console.log(e)}}},{key:"enterView",value:function(e){var t=this,n=function(){e&&e()};XR.flying?XR.once("flying.ended",(function(){t.enterView(e)})):XR.currentPano==this.markView.pano&&"panorama"==XR.mode?n():this.markView.enter360Pano(n)}},{key:"exitView",value:function(){return new Promise((function(e,t){XR.viewLinkManager.exitView().then((function(){e("success")}))}))}},{key:"beginSetEntry",value:function(){var e=this,t=new oe;return console.log("beginSetEntry"),this.settingEntry=!0,this.enterView((function(){t.resolve(),XR.flyToPano({pano:XR.currentPano,quaternion:e.markView.enterQuaternion,rotSpeed:2})})),t.promise()}},{key:"confirmEntry",value:function(){XR.currentPano==this.markView.pano&&(this.markView.pano.quaternion.copy(XR.quaternion),this.markView.enterQuaternion.copy(XR.quaternion),this.markView.mapChangeRot(),this.dispatchEvent({type:"confirmEntry",sid:this.markView.sid,enterQuaternion:XR.quaternion.toArray()}),this.cancelSetEntry())}},{key:"cancelSetEntry",value:function(){this.settingEntry&&(this.settingEntry=!1,this.markView.backToPanorama())}},{key:"beginSetExit",value:function(){var e=this;console.log("beginSetExit");var t=new oe;return this.settingExit=!0,this.enterView((function(){t.resolve(),XR.flyToPano({pano:XR.currentPano,lookAtPoint:e.markView.exitDoor.mesh.position,rotSpeed:2})})),t.promise()}},{key:"confirmExit",value:function(){this.markView.exitDirection=this.markView.exitDoor.mesh.position.clone(),this.dispatchEvent({type:"confirmExit",sid:this.markView.sid,exitDirection:this.markView.exitDirection.toArray()}),"pano"!=this.markView.linkType&&(this.markView.thumbPanoTex&&this.markView.thumbPanoTex.dispose(),this.markView.thumbPanoTex=null),this.cancelSetExit(!0)}},{key:"cancelSetExit",value:function(e){this.settingExit&&(this.settingExit=!1,e||this.markView.exitDoor.mesh.position.copy(this.markView.exitDirection),this.markView.backToPanorama())}},{key:"beginSetVisibleViews",value:function(e){this.markView=XR.viewLinkManager.views[e],enterView((function(){})),this.settingVisibles=!0,this.oldVisibleData=JSON.parse(JSON.stringify(this.markView.visibleViews))}},{key:"addVisibleView",value:function(e,t){console.log("addVisibleView "+e);var n=XR.viewLinkManager.views[e];n.circle.mesh.visible=!0,XR.handleInputStart(t.offsetX,t.offsetY,!0,!0);var i=XR.getMouseIntersect(null,[XR.model.skybox]);n.circle.updatePos("at360View",{viewDir:i.point.clone()}),n.circle.update(XR.camera),this.saveVisibleViews()}},{key:"delVisibleView",value:function(e){delete this.markView.visibleViews[e],XR.viewLinkManager.views[e].circle.mesh.visible=!1,this.saveVisibleViews()}},{key:"saveVisibleViews",value:function(){var e={};for(var t in XR.viewLinkManager.views)XR.viewLinkManager.views[t].circle.mesh.visible&&(e[t]=XR.viewLinkManager.views[t].circle.mesh.position.toArray());this.markView.visibleViews=e}},{key:"cancelVisibleViews",value:function(e){this.markView.visibleViews=this.oldVisibleData,this.markView.backToPanorama(),bus.emit("link/tag/links",{sid:this.markView.sid,visibleViews:this.markView.visibleViews}),this.finishVisibleViews()}},{key:"finishVisibleViews",value:function(){this.settingVisibles=!1,this.markView=null}},{key:"handelClickView",value:function(){if(this.settingPos)return this.confirmPos(),!0}},{key:"dragBalloonStart",value:function(){this.settingPos||(this.beginSetPos("reset"),this.draggingBall=!0,XR.cameraControls.activeControl.enabled=!1)}},{key:"dragExitStart",value:function(){this.settingExit&&(this.draggingExit=!0,XR.cameraControls.activeControl.enabled=!1)}},{key:"dragViewStart",value:function(e){(this.settingVisibles||this.markView&&e==this.markView.circle.mesh)&&(this.draggingCircleAtView=!0,this.draggingMesh=e,XR.cameraControls.activeControl.enabled=!1)}},{key:"handelDragEnd",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};XR.flying||(this.draggingBall||this.draggingExit||this.draggingCircleAtView)&&(this.draggingBall?(this.draggingBall=!1,this.settingPos&&(e.cancel||this.confirmPos()),e.consume&&e.consume()):this.draggingExit?(this.draggingExit=!1,XR.cameraControls.activeControl.pointerDragOn=!1,e.consume&&e.consume()):this.draggingCircleAtView&&(this.draggingCircleAtView=!1,XR.cameraControls.activeControl.pointerDragOn=!1,e.cancel||this.confirmPos(),e.consume&&e.consume()),this.draggingMesh=null,XR.cameraControls.activeControl.enabled=!0)}},{key:"getData",value:function(e){return{sid:this.markView.sid,title:this.markView.titleLabel.text,balloon:{pos:this.markView.balloon.mesh.position.clone()},circle:{pos:this.markView.circle.position.clone(),qua:this.markView.circle.quaternion.clone(),mapOut:this.markView.circle.mesh.material.uniforms.mapOut.value,scale:this.markView.circle.mesh.scale.x},exit:{mapOut:this.markView.exitDoor.mesh.material.uniforms.mapOut.value},exitDirection:this.markView.exitDirection.clone(),enterQuaternion:this.markView.enterQuaternion.clone(),panoImgVersion:this.markView.panoImgVersion,url:this.markView.url,thumbPanoTex:this.markView.thumbPanoTex,linkType:this.markView.linkType,nearestPano:this.markView.nearestPano}}},{key:"showAll",value:function(){var e=this;this.inited?XR.viewLinkManager.showAllViews():setTimeout((function(){e.showAll()}),200)}},{key:"hideAll",value:function(){var e=this;this.inited?XR.viewLinkManager.hideAllViews():setTimeout((function(){e.hideAll()}),200)}},{key:"highlight",value:function(e){var t=XR.viewLinkManager.views,n=t[e];if(!this.markView||n)if(n)n.setSelect(!0);else for(var i in t)t[i].setSelect(!1)}}]),n}();function rM(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}var aM=function(e){f(n,e);var t=rM(n);function n(e){var i,r;o(this,n),(i=t.call(this)).app=e,i.edit={};var a=oe();return i.filterTemp={},i.app.Scene.on("loaded",(function(){(r=i.app.core.get("Player")).on(aa,(function(e,t){i.emit("FilterManager.updateCurrentFilter",JSON.parse(JSON.stringify(i.filterTemp[t.id]||t.filterEffect)))})),a.resolve()})),i.edit.enter=function(){r?i.emit("FilterManager.updateCurrentFilter",JSON.parse(JSON.stringify(r.currentPano.filterEffect))):a.then((function(){return i.edit.enter()}))},i.edit.startFilter=function(){r.flyToNewMode({mode:"panorama",pano:r.currentPano})},i.edit.brightness=function(e){i.getPanoMaterials().forEach((function(t){t.uniforms.filterBase0.value.setX(e),t.uniforms.filterBase1.value.setX(e),t.defines.hasFilter=!0,t.needsUpdate=!0})),i.filterTemp[r.currentPano.id]||(i.filterTemp[r.currentPano.id]=JSON.parse(JSON.stringify(r.currentPano.filterEffect))),i.filterTemp[r.currentPano.id].brightness=e},i.edit.contrast=function(e){i.getPanoMaterials().forEach((function(t){t.uniforms.filterBase0.value.setY(e),t.uniforms.filterBase1.value.setY(e),t.defines.hasFilter=!0,t.needsUpdate=!0})),i.filterTemp[r.currentPano.id]||(i.filterTemp[r.currentPano.id]=JSON.parse(JSON.stringify(r.currentPano.filterEffect))),i.filterTemp[r.currentPano.id].contrast=e},i.edit.saturation=function(e){i.getPanoMaterials().forEach((function(t){t.uniforms.filterBase0.value.setZ(e),t.uniforms.filterBase1.value.setZ(e),t.defines.hasFilter=!0,t.needsUpdate=!0})),i.filterTemp[r.currentPano.id]||(i.filterTemp[r.currentPano.id]=JSON.parse(JSON.stringify(r.currentPano.filterEffect))),i.filterTemp[r.currentPano.id].saturation=e},i.edit.temperature=function(e){i.getPanoMaterials().forEach((function(t){t.uniforms.filterTemperature0.value=e,t.uniforms.filterTemperature1.value=e,t.defines.hasFilter=!0,t.needsUpdate=!0})),i.filterTemp[r.currentPano.id]||(i.filterTemp[r.currentPano.id]=JSON.parse(JSON.stringify(r.currentPano.filterEffect))),i.filterTemp[r.currentPano.id].temperature=e},i.edit.clearCurrent=function(){i.edit.brightness(0),i.edit.contrast(0),i.edit.saturation(0),i.edit.temperature(0)},i.edit.applyCurrent2All=function(){var e=i.filterTemp[r.currentPano.id]||r.currentPano.filterEffect;r.model.panos.list.forEach((function(t){t.panoType||(i.filterTemp[t.id]=JSON.parse(JSON.stringify(e)))}))},i.edit.save=function(){var e=[];r.model.panos.list.forEach((function(t){i.filterTemp[t.id]?e.push(Object.assign({id:t.id},i.filterTemp[t.id])):0==t.filterEffect.brightness&&0==t.filterEffect.contrast&&0==t.filterEffect.saturation&&0==t.filterEffect.temperature||e.push(Object.assign({id:t.id},t.filterEffect))}));var t=h(i);return{data:e,successCallBack:function(){Object.keys(t.filterTemp).forEach((function(e){r.model.panos.index[e].filterEffect=t.filterTemp[e]})),i.getPanoMaterials().forEach((function(e){r.currentPano.hasFilter?e.defines.hasFilter=!0:delete e.defines.hasFilter,e.needsUpdate=!0})),t.filterTemp={}}}},i.edit.undoEdit=function(){i.filterTemp={};var e=r.currentPano.filterEffect;i.getPanoMaterials().forEach((function(t){t.uniforms.filterBase0.value.set(e.brightness,e.contrast,e.saturation),t.uniforms.filterBase1.value.set(e.brightness,e.contrast,e.saturation),t.uniforms.filterTemperature0.value=e.temperature,t.uniforms.filterTemperature1.value=e.temperature,r.currentPano.hasFilter?t.defines.hasFilter=!0:delete t.defines.hasFilter,t.needsUpdate=!0})),i.emit("FilterManager.updateCurrentFilter",JSON.parse(JSON.stringify(e)))},i}return u(n,[{key:"initFilters",value:function(){var e=this,t=function(t){t.forEach((function(t){var n=t.id,i=e.app.core.get("Player").model.panos.index[n];i&&(delete t.id,i.filterEffect=t)}))},n=this.app.store.getValue("filters");n?t(n):this.app.store.on("filters",(function(n){t(n);var i=e.app.core.get("Player");e.updatePanoFilters(i.currentPano,i.currentPano)}))}},{key:"updatePanoFilters",value:function(e,t){var n=this.filterTemp[e.id]||e.filterEffect,i=this.filterTemp[t.id]||t.filterEffect;this.getPanoMaterials().forEach((function(o){o.uniforms.filterBase0.value.set(n.brightness,n.contrast,n.saturation),o.uniforms.filterTemperature0.value=n.temperature,o.uniforms.filterBase1.value.set(i.brightness,i.contrast,i.saturation),o.uniforms.filterTemperature1.value=i.temperature,e.hasFilter||t.hasFilter?o.defines.hasFilter=!0:delete o.defines.hasFilter,o.needsUpdate=!0}))}},{key:"getPanoMaterials",value:function(){var e=this.app.core.get("Player"),t=[this.app.core.get("QuickstartManager").skybox.material].concat(H(e.model.chunks.map((function(e){return e.materialInside}))));return e.model.skybox&&t.push(e.model.skybox.material),e.model.highMapCube&&t.push.apply(t,H(e.model.highMapCube.tiles.map((function(e){return e.material})))),t}}]),n}(yo);function sM(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}var lM,cM,uM=function(e){f(n,e);var t=sM(n);function n(){var e;return o(this,n),(e=t.call(this)).sourceApp=null,e.targetApp=null,e.player1=null,e.player2=null,e}return u(n,[{key:"bind",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{sourceApp:null,targetApp:null};e.sourceApp?(this.sourceApp=e.sourceApp,this.player1=this.sourceApp.core.get("Player")):e.targetApp&&(this.targetApp=e.targetApp,this.player2=this.targetApp.core.get("Player")),this.sourceApp&&this.targetApp&&this.init()}},{key:"init",value:function(){this.player1.model.panos.list.length&&this.player2.model.panos.list.length&&(this.diffLon=this.computeAveDiffLon(),this.diffQuaternion=(new THREE.Quaternion).setFromAxisAngle(new THREE.Vector3(0,1,0),this.diffLon),this.diffQuaternionInvert=this.diffQuaternion.clone().invert())}},{key:"computeAveDiffLon",value:function(){for(var e=this,t=0,n=[],i=Object.keys(this.panoMapping.mapping),o=i.map((function(t){return e.player1.model.panos.index[t].position})),r=i.map((function(t){var n=e.panoMapping.mapping[t];return e.player2.model.panos.index[n].position})),a=i.length,s=0;s<a;){var l=(new THREE.Vector3).copy([s]),c=(new THREE.Vector3).copy(o[(s+1)%a]),u=(new THREE.Vector3).copy(r[s]),h=(new THREE.Vector3).copy(r[(s+1)%a]),d=(new THREE.Vector3).subVectors(l,c).setY(0),p=(new THREE.Vector3).subVectors(u,h).setY(0),f=ge.getAngle(d,p,"z");n.push(f),t+=f,s++}return console.log("diffLons",n),t/=a,console.log("diffLonAve",t),t}},{key:"applyDiff",value:function(e){if(this.player1&&this.player2&&this.targetApp.config.num!=this.sourceApp.config.num&&this.player1.mode==this.player2.mode){var t,n,i;e==this.sourceApp?(t=this.player1,n=this.player2,i=this.diffQuaternion):(t=this.player2,n=this.player1,i=this.diffQuaternionInvert);var o=t.cameraControls.activeControl,r=n.cameraControls.activeControl;if(t.quaternion.copy(n.quaternion).premultiply(i),"panorama"==t.mode){var a=(new THREE.Vector3).subVectors(r.target,n.position);a.applyQuaternion(i);var s=(new THREE.Vector3).addVectors(t.position,a);o.lookAt(s),o.target.copy(s)}else if(r){var l=(new THREE.Vector3).subVectors(r.target,n.model.panos.list[0].position);l.applyQuaternion(i),o.target.addVectors(t.model.panos.list[0].position,l),t.target.copy(o.target);var c=(new THREE.Vector3).subVectors(r.camera.position,r.target);c.applyQuaternion(i),t.position=(new THREE.Vector3).addVectors(o.target,c),o.camera.position.copy(t.position)}o.camera.quaternion.copy(t.quaternion)}}}]),n}(yo);function hM(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}var dM=function(e){f(n,EventEmitter);var t=hM(n);function n(e){var i;return o(this,n),(i=t.call(this)).ctx=e,i.app=e.app,i.player=null,i.events={movePos:function(e){if(e.reCompute)var t=cM;else{if(!i.dragging)return;if(!(t=lM.getMouseIntersect(null,lM.getColliders())))return}var n=i.getPoseByIntersect(t),o=n.position,r=n.quaternion,a=n.faceAngle2,s=n.subgroup;i.editPlane.position.copy(o),i.editPlane.quaternion.copy(r),i.editPlane.faceAngle2=a,i.editPlane.getIsLieDown()&&i.editPlane.updateLabelPose(),i.editPlane.homePanoId=lM.currentPano.id,i.editPlane.subgroup=s,i.emit("dragPos",{panoId:lM.currentPano.id})},confirmPos:function(e){e.consume(),i.confirmPos()},dragStart:function(e){i.editPlane&&lM.OverlayManager.hoveringPlane==i.editPlane&&(lM.cameraControls.activeControl.enabled=!1,lM.cameraControls.activeControl.pointerDragOn=!1,i.dragging=!0,e.consume())},dragEnd:function(e){i.dragging&&(i.dragging=!1,e.consume(),lM.cameraControls.activeControl.enabled=!0)}},i}return u(n,[{key:"waitReady",value:function(e){lM?e():this.once("ready",e)}},{key:"enter",value:function(e){var t=this;this.entered||(this.entered=!0,this.waitReady((function(){e&&e(),t.entered&&(lM.on("pointerStart",t.events.dragStart),lM.on("pointerMove",t.events.movePos),lM.on("pointerUp",t.events.dragEnd))})))}},{key:"leave",value:function(){this.endAddPlane(),this.undoEdit(),this.editPlane&&(this.editPlane.isEditing=!1,lM.OverlayManager.highlight(null)),this.editPlane=null,this.entered=!1,lM.off("pointerStart",this.events.dragStart),lM.off("pointerUp",this.events.dragEnd),lM.off("pointerMove",this.events.movePos)}},{key:"reEdit",value:function(e){var t=this;this.enter((function(){var n=t.ctx.get(e);t.updateEditPlane(n),lM.OverlayManager.clickOverlay(n,{dontEmit:!0,forceFlyToPlane:!0}),lM.modelSideManager.tempAuto()}))}},{key:"undoEdit",value:function(){if(this.editPlane){var e=this.editPlane;"new"==e.info.modified?this.dispose(e.sid):e.setFromInfo(e.info),lM.modelSideManager.recover()}}},{key:"save",value:function(){var e=this;console.log("save");var t=this.editPlane;return{done:function(){t.info.modified="old",t.info.width=t.width,t.info.height=t.height,t.info.pos=t.position.clone(),t.info.qua=t.quaternion.clone(),t.info.faceAngle=t.faceAngle,t.info.scaleRatio=t.scaleRatio,t.info.title=t.titleLabel.text,t.info.media=t.plane.material.map.image,t.info.targetPano=t.targetPano,t.info.icon=t.getMapName(),t.info.panoId=t.homePanoId,t.info.subgroup=t.subgroup,t.raycastToFindFloor(),t.updateVisibleOnFloor(),e.leave()},info:{width:ge.toPrecision(t.width,4),height:ge.toPrecision(t.height,4),pos:ge.toPrecision(t.position.toArray(),4),qua:ge.toPrecision(t.quaternion.toArray(),4),subgroup:null==t.subgroup?null:t.subgroup}}}},{key:"add",value:function(e){e&&e.sid&&(this.ctx.list.push(e),De.updateVisible(e.titleLabel,"onShow",!!this.showTitles))}},{key:"clear",value:function(){this.ctx.list=[]}},{key:"dispose",value:function(e){var t=this.ctx.get(e);if(t){t.titleLabel.dispose(),t.dispose();var n=this.ctx.list.indexOf(t);this.ctx.list.splice(n,1)}}},{key:"changeTitlesShow",value:function(e){this.showTitles=!!e,this.ctx.list.forEach((function(t){De.updateVisible(t.titleLabel,"onShow",e)}))}},{key:"highlight",value:function(e){var t=this.ctx.get(e);lM.OverlayManager.highlight(t)}},{key:"beginToAddPlane",value:function(){var e=this;this.enter((function(){lM.viewLinkManager.exitView(),lM.reticule.visible=!1,e.isAdding=!0,lM.modelSideManager.tempAuto(),Wr.add("addOverlay")}))}},{key:"endAddPlane",value:function(){this.isAdding=!1,Wr.remove("addOverlay"),lM.reticule.visible=!0}},{key:"updateEditPlane",value:function(e){this.editPlane=e,e.isEditing=!0,lM.OverlayManager.highlight(e)}},{key:"getPoseByIntersect",value:function(e){var t=e.face.normal.clone();lM.getMouseDirection().angleTo(e.face.normal)<Math.PI/2&&t.negate();var n,i=(new THREE.Quaternion).setFromRotationMatrix((new THREE.Matrix4).lookAt(t,to.ZERO,to.UP)),o=e.point.clone().add(t.multiplyScalar(.02));if(gM(i)){var r=e.face.normal.clone().setY(0),a=(new THREE.Vector3).subVectors(o,lM.position).setY(0).normalize();0==r.x&&0==r.z&&(r.z=1),n=ge.getAngle(r,a,"y")-Math.PI/2;var s=(new THREE.Quaternion).setFromAxisAngle(new THREE.Vector3(0,0,1),n);i.multiply(s)}return{position:o,quaternion:i,faceAngle2:n,subgroup:e.object.parent.floor.floorIndex}}},{key:"startInsertion",value:function(e){var t=this,n=e.intersect,i=this.getPoseByIntersect(n),o=i.position,r=i.quaternion,a=i.faceAngle2,s=i.subgroup,l=new fM(lM,{sid:De.getRandomSid(),pos:o,qua:r,modified:"new",subgroup:s});l.faceAngle=0,l.faceAngle2=a,l.updateMatrixWorld(),this.emit("createBill",{sid:l.sid,panoId:lM.currentPano.id}),lM.OverlayManager.clickOverlay(l,{dontEmit:!0,forceFlyToPlane:!0,afterFly:function(e){setTimeout((function(){t.events.movePos({reCompute:!0})}),1)}}),cM=n,this.updateEditPlane(l),this.add(l),this.endAddPlane()}},{key:"setScale",value:function(e){this.editPlane.setScale(e)}},{key:"setRotation",value:function(e){this.editPlane.setRotation(e)}},{key:"setJumpPano",value:function(e){console.log("setJumpPano",e),this.editPlane.targetPano=e}},{key:"setMap",value:function(e,t){var n=t?this.ctx.get(t):this.editPlane;n.setMap(e),this.editPlane&&this.editPlane==n||(n.info.icon=n.getMapName())}},{key:"setTitle",value:function(e){this.editPlane.setTitle(e)}},{key:"cancel",value:function(){this.leave()}},{key:"flyToBillBoard",value:function(e){var t=e?this.ctx.get(e):this.editPlane;lM.OverlayManager.clickOverlay(t,{dontEmit:!0,forceFlyToPlane:!0})}}]),n}(),pM=["style-1","style-2","style-3"],fM=function(e){f(n,e);var t=hM(n);function n(e){var i,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};o(this,n),r.media=["photo"],r.isBillboard=!0,r.faceAngle=r.faceAngle||0,r.scaleRatio=r.scaleRatio||100,(i=t.call(this,e,r)).plane.material.side=THREE.DoubleSide,i.titleLabel=new Ce({text:r.title,backgroundColor:{r:255,g:255,b:255,a:0},textColor:{r:255,g:255,b:255,a:1},textshadowColor:"#888",borderRadius:2,fontsize:34,renderOrder:je-1,margin:{x:12,y:10},player:e,fixOrient:!0}),i.titleLabel.sprite.material.depthTest=!0;var a=.3;return i.titleLabel.scale.set(a,a,a),i.add(i.titleLabel),De.updateVisible(h(i),"waitMapForResize",!1),i.addEventListener("mapLoaded",(function(){var t=i.plane.material.map;t.needsUpdate=!0,i.setScale(),De.updateVisible(h(i),"waitMapForResize",!0),t.dispose();e.$app.core.get("SceneRenderer").on(xa,(function n(){t._listeners&&t._listeners.dispose&&t._listeners.dispose.length&&(t.anisotropy=4,t.needsUpdate=!0,e.$app.core.get("SceneRenderer").off(xa,n))}))})),i.addEventListener("lieDownChanged",(function(){i.updateLabelPose()})),i}return u(n,[{key:"setFromInfo",value:function(e){Tt(w(n.prototype),"setFromInfo",this).call(this,e),this.plane.scale.copy(this.scale),this.scale.set(1,1,1),this.setTitle(e.title),this.targetPano=e.targetPano,this.homePanoId=e.panoId,this.scaleRatio=e.scaleRatio,this.setRotation(e.faceAngle),this.setMap(e.icon),this.subgroup=e.subgroup}},{key:"setRotation",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;this.faceAngle=e,this.plane.quaternion.setFromAxisAngle(new THREE.Vector3(0,0,1),THREE.MathUtils.degToRad(-e)),this.updateLabelPose()}},{key:"setScale",value:function(e){if(null==e&&(e=this.scaleRatio),this.scaleRatio=e,this.plane.material.map.image.width){var t=this.plane.material.map.image,n=t.width,i=t.height;this.width=n/512*e/100,this.height=i/512*e/100,this.plane.scale.set(this.width/at.overlay.width,this.height/at.overlay.height),this.updateLabelPose()}}},{key:"getFaceAngle2",value:function(e){if(null!=this.faceAngle2)return this.faceAngle2;e||(e=new THREE.Vector3(0,0,1).applyQuaternion(this.quaternion));var t=(new THREE.Quaternion).setFromRotationMatrix((new THREE.Matrix4).lookAt(e,to.ZERO,to.UP)),n=this.quaternion.clone().premultiply(t.invert());this.faceAngle2=(new THREE.Euler).setFromQuaternion(n).z}},{key:"updateLabelPose",value:function(){if(this.titleLabel){if(this.titleLabel.rotation.z=0,this.getIsLieDown()){var e=THREE.MathUtils.degToRad(-this.faceAngle),t=lM.getDirection().negate(),n=Math.atan2(t.x,t.z),i=new THREE.Vector3(0,0,1).applyQuaternion(this.quaternion),o=this.getFaceAngle2(i);e-=n-=Math.atan2(i.x,i.z)+o;var r=(this.height*Math.abs(Math.cos(e))+this.width*Math.abs(Math.sin(e)))/2+.1,a=-r*Math.sin(-n),s=-r*Math.cos(-n);this.titleLabel.position.set(a,s,0),this.titleLabel.rotation.z=n}else{var l=THREE.MathUtils.degToRad(-this.faceAngle),c=(this.height*Math.abs(Math.cos(l))+this.width*Math.abs(Math.sin(l)))/2+.1;this.titleLabel.position.set(0,-c,0)}}}},{key:"setTitle",value:function(e){this.titleLabel&&this.titleLabel.setText(e)}},{key:"setMap",value:function(e){this.plane.material.map.image.src=this.getMapSrc(e),this.plane.material.map.anisotropy=0}},{key:"getMapSrc",value:function(e){if(e&&"blob:"==e.slice(0,5))return e;var t=e||this.info.icon||pM[0];return pM.includes(t)?lM.$app.resource.getAppURL("images/billboard/".concat(t,".png")):(1==t.split(".").length&&(t+=".png"),lM.$app.resource.getUserResourceURL(t))}},{key:"getMapName",value:function(){var e=this.plane.material.map.image.src;return"blob:"==e.slice(0,5)?e:e.split("/").pop().split(".")[0]}},{key:"getIsLieDown",value:function(){var e=this.lieDown;return this.lieDown=gM(this.quaternion),this.lieDown!=e&&this.dispatchEvent({type:"lieDownChanged"}),this.lieDown}}]),n}(bs),mM=K("list"),vM=function(){function e(t){var n=this;o(this,e),Object.defineProperty(this,mM,{writable:!0,value:[]}),this.hover={sid:null,state:null},this.app=t,this.app.store.on("billboards",(function(e){(e.tags||e).forEach((function(e){e.panoId in lM.model.panos.index&&(e=De.CloneJson(e),n.manager.add(new fM(lM,e)))}))})),this.manager=new dM(this),this.manager.on("clickBillboard",(function(e){e.sid,e.title;var t=e.event;n.manager.app.Scene.emit("hotspot.click",{type:"billboard",event:t})})),this.manager.on("hoverBillboard",(function(e){var t=e.sid,i=e.state,o=e.event;if(n.hover.sid==t){if(n.hover.state==i)return;n.hover.state=i}else n.hover.sid=t,n.hover.state=i;n.manager.app.Scene.emit("hotspot.".concat(i?"enter":"leave"),{type:"billboard",event:o})})),this.app.Scene.on("loaded",(function(){(lM=n.app.core.get("Player")).billboardManager=n.manager,n.manager.emit("ready"),n.app.store.getValue("metadata").controls.showBillboardTitle&&n.manager.changeTitlesShow(!0),lM.on("view.changed",(function(e){"panorama"!=lM.mode&&"floorplan"!=lM.mode||!e.cameraWorldMatrixChanged||n.list.forEach((function(e){e.lieDown&&e.updateLabelPose()}))}))}))}return u(e,[{key:"list",get:function(){return Z(this,mM)[mM]}},{key:"get",value:function(e){return Z(this,mM)[mM].find((function(t){return t.sid==e}))}},{key:"flyToBillBoard",value:function(e){this.manager.flyToBillBoard(e)}}]),e}();function gM(e){var t=new THREE.Vector3(0,0,-1).applyQuaternion(e);return Math.abs(t.y)>.9}function yM(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}var AM=yi.createFatLineMat({lineWidth:2,color:16761403,transparent:!1,depthWrite:!0,depthTest:!0}),EM=yi.createFatLineMat({lineWidth:2,color:3073230,transparent:!1,depthWrite:!0,depthTest:!0}),bM=new THREE.LineBasicMaterial({color:16761403}),wM=new THREE.LineBasicMaterial({color:3073230}),xM=new THREE.BoxGeometry(1,1,1),CM=function(e){f(n,THREE.Mesh);var t=yM(n);function n(e){var i;o(this,n);var r=new THREE.MeshBasicMaterial({color:11828780,transparent:!0,depthWrite:!1,opacity:.1,side:THREE.DoubleSide}),a=new THREE.MeshBasicMaterial({color:3073230,transparent:!0,depthWrite:!1,opacity:.1,side:THREE.DoubleSide});0===e?((i=t.call(this,xM,r)).lowLight=function(){1!==i.status&&(i.outLines.visible=!1,i.line.visible=!0,i.material.opacity=0)},i.midLight=function(){1!==i.status&&(i.outLines.visible=!1,i.line.visible=!0,i.material.opacity=.1)},i.highLight=function(){1!==i.status&&(i.outLines.visible=!0,i.line.visible=!0,i.material.opacity=.3,i.status=1)},i.switchBoxType=function(){i.clipType=Number(!i.clipType),console.log(!i.clipType);var e=0===i.clipType?i.material0:i.material1,t=0===i.clipType?bM:wM,n=0===i.clipType?AM:EM;i.material=e,i.line.material=t,i.outLines.material=n,console.log(i.clipType)}):((i=t.call(this,xM,a)).lowLight=function(){1!==i.status&&(i.outLines.visible=!1,i.line.visible=!0,i.material.opacity=0)},i.midLight=function(){1!==i.status&&(i.outLines.visible=!1,i.line.visible=!0,i.material.opacity=.1)},i.highLight=function(){1!==i.status&&(i.outLines.visible=!0,i.line.visible=!0,i.material.opacity=.3,i.status=1)},i.switchBoxType=function(){i.clipType=Number(!i.clipType),console.log(!i.clipType);var e=0===i.clipType?i.material0:i.material1,t=0===i.clipType?bM:wM,n=0===i.clipType?AM:EM;i.material=e,i.line.material=t,i.outLines.material=n,console.log(i.clipType)});var s,l,c=new THREE.EdgesGeometry(xM);0===e?(s=bM,l=AM):(s=wM,l=EM),i.line=new THREE.LineSegments(c,s);var u=[];return u.push(new THREE.Vector3(-.5,.5,-.5)),u.push(new THREE.Vector3(-.5,.5,.5)),u.push(new THREE.Vector3(.5,.5,.5)),u.push(new THREE.Vector3(.5,.5,-.5)),u.push(new THREE.Vector3(-.5,.5,-.5)),u.push(new THREE.Vector3(-.5,-.5,-.5)),u.push(new THREE.Vector3(-.5,-.5,.5)),u.push(new THREE.Vector3(.5,-.5,.5)),u.push(new THREE.Vector3(.5,-.5,-.5)),u.push(new THREE.Vector3(-.5,-.5,-.5)),u.push(new THREE.Vector3(.5,-.5,-.5)),u.push(new THREE.Vector3(.5,.5,-.5)),u.push(new THREE.Vector3(.5,.5,.5)),u.push(new THREE.Vector3(.5,-.5,.5)),u.push(new THREE.Vector3(-.5,-.5,.5)),u.push(new THREE.Vector3(-.5,.5,.5)),i.outLines=yi.createFatLine(u,{material:l}),i.outLines.visible=!1,i.add(i.line),i.add(i.outLines),i.name="clipBox",i.status=0,i.clipType=e,i.isClipBox=!0,i.renderOrder=et,i.material0=r,i.material1=a,i.boundingBox=new THREE.Box3(new THREE.Vector3(-.5,-.5,-.5),new THREE.Vector3(.5,.5,.5)),y(i)}return n}();function TM(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}var IM=function(e){f(n,e);var t=TM(n);function n(e){var i;return o(this,n),(i=t.call(this)).updateMaterials=function(){console.log("updateMaterials"),(i.player.model._3dTilesRuntime||0===i.materials.length)&&(i.materials.length=0,i.player.model.chunks.forEach((function(e){return i.materials.push(e.materialOutside)})),i.player.model.chunks.forEach((function(e){return i.materials.push(e.materialInside)}))),i.materials.forEach((function(e){e.uniforms.clipBoxType.value=i.clipBoxType,e.uniforms.clipBoxPoints.value=i.clipBoxPoints})),i.boxCountChanged()},i.bindEvents=function(){i.player.on("pointerMove",i.onMouseMove),i.player.on("pointerUp",i.onMouseUp),i.player.on("moveModel",i.onZoom),i.player.model.transformTool.addEventListener("transformed",i.updateClipBox),i.player.model.transformTool.addEventListener("stopDrag",i.finishUpdateClipBox),i.player.model.transformTool.addEventListener("changeByHistory",i.changeByHistory)},i.unBindEvents=function(){i.player.off("pointerMove",i.onMouseMove),i.player.off("pointerUp",i.onMouseUp),i.player.off("moveModel",i.onZoom),i.player.model.transformTool.removeEventListener("transformed",i.updateClipBox),i.player.model.transformTool.removeEventListener("stopDrag",i.finishUpdateClipBox),i.player.model.transformTool.removeEventListener("changeByHistory",i.changeByHistory)},i.changeByHistory=function(e){var t=i.clipBoxs.indexOf(e.data.object);e.data.object.updateMatrixWorld(),i.updateClipBox({activeBoxIndex:t}),i.updateMaterials(),i.emit("clipBoxManager.update",{list:i.clipBoxs})},i.onMouseUp=function(e){if(i.player.mouseCouldBeClickToMove)if(i.adding)i.adding=!1,i.activeBox&&(i.activeBox.status=0,i.activeBox.lowLight()),i.activeBoxIndex=i.clipBoxs.length-1,i.activeBox=i.clipBoxs[i.activeBoxIndex],i.activeBox.highLight(),i.player.model.transformTool.attach(i.activeBox),i.emit("clipBoxManager.active",{status:!0,list:i.clipBoxs}),i.emit("clipBoxManager.update",{list:i.clipBoxs}),i.clipBoxType[i.clipBoxs.length-1]=i.activeBox.clipType,i.updateClipBox(),1===i.clipBoxs.length&&i.clipInit();else{i.activeBox&&(i.activeBox.status=0,i.activeBox.lowLight());var t=i.player.getMouseIntersect(null,i.clipBoxs);if(t){i.player.model.transformTool.attach(t.object),i.emit("clipBoxManager.active",{status:!0,list:i.clipBoxs}),i.activeBox=t.object;for(var n=0;n<i.clipBoxs.length;n++)if(i.activeBox===i.clipBoxs[n]){i.activeBoxIndex=n;break}i.activeBox.highLight()}else i.cancelActive()}},i.onMouseMove=function(){if(i.adding)i.clipBoxs[i.clipBoxs.length-1].position.copy(i.player.reticule.position);else{var e=i.player.getMouseIntersect(null,i.clipBoxs);e?null===i.touchBox?(i.touchBox=e.object,i.touchBox.midLight()):e.object!==i.touchBox&&(i.touchBox.lowLight(),i.touchBox=e.object,i.touchBox.midLight()):i.touchBox&&(i.touchBox.lowLight(),i.touchBox=null)}},i.onZoom=function(){if(i.adding){var e=i.clipBoxs[i.clipBoxs.length-1],t=i.player.camera.position.distanceTo(e.position)/5;i.clipBoxs[i.clipBoxs.length-1].scale.set(t,t,t)}},i.app=e,i.player=null,i.deferred=oe(),i.clipBoxs=[],i.clipBoxGroup=new THREE.Group,i.clipBoxType=[],i.clipBoxPoints=[],i.oriObj={clipBoxType:[],clipMatrixs:[]},i.activeBoxIndex=null,i.activeBox=null,i.touchBox=null,i.adding=!1,i.materials=[],i.mousedown=new THREE.Vector3,i.mouseup=new THREE.Vector3,i.isBind3dTile=!1,i.initFinish=!1,i.init=function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(new THREE.Vector3,e){e[0]&&(e=e[0].modelData),i.clipBoxType=e.clipBoxType;for(var n=e.clipMatrixs,o=0;o<n.length;o++){var r=new CM(i.clipBoxType[o],1),a=new THREE.Matrix4;a.fromArray(n[o]),r.applyMatrix4(a),i.clipBoxPoints[4*o]=new THREE.Vector3(.5,-.5,-.5).applyMatrix4(a),i.clipBoxPoints[4*o+1]=new THREE.Vector3(-.5,.5,-.5).applyMatrix4(a),i.clipBoxPoints[4*o+2]=new THREE.Vector3(-.5,-.5,-.5).applyMatrix4(a),i.clipBoxPoints[4*o+3]=new THREE.Vector3(-.5,-.5,.5).applyMatrix4(a),i.clipBoxs.push(r),i.clipBoxGroup.add(r)}i.oriObj={clipBoxType:JSON.parse(JSON.stringify(i.clipBoxType)),clipMatrixs:n}}t||(i.setAllClipBoxVisible(!1),i.player.model.add(i.clipBoxGroup)),i.clipInit(),i.deferred.resolve()},i.app.Scene.on("loaded",(function(){setTimeout((function(){i.player=i.app.core.get("Player");var e=i.app.store.getValue("cutModel");i.init(e)}),50)})),i.enterModule=function(){i.waitInit((function(){i.app.Camera.monitor.control.watchingCamera&&(i.app.Camera.monitor.control.stopWatch(),i.player.dollhouseMode()),i.player.mode!==xt.DOLLHOUSE?(i.player.flyToNewMode({mode:xt.DOLLHOUSE}),i.player.once("flying.ended",(function(){i.player.model.panos.forEach((function(e){return e.hasVideo&&De.updateVisible(e.marker,"clipBox",!1,10)})),i.player.OverlayManager.group.children.forEach((function(e){return e.hide("clipBox")})),i.app.Camera.monitor.control.hideAll(void 0,"clipBox",10,void 0),i.app.Scene.Decoration.hideAll(),i.player.labelManager.hide(),i.player.linkEditor.hideFootIcons(),i.player.linkEditor.delVisibleLines(),i.emit("clipBoxManager.enter"),i.player.model.floors.show()}))):(i.player.model.panos.forEach((function(e){return e.hasVideo&&De.updateVisible(e.marker,"clipBox",!1,10)})),i.player.OverlayManager.group.children.forEach((function(e){return e.hide("clipBox")})),i.app.Camera.monitor.control.hideAll(void 0,"clipBox",10,void 0),i.app.Scene.Decoration.hideAll(),i.player.labelManager.hide(),i.player.linkEditor.hideFootIcons(),i.player.linkEditor.delVisibleLines(),i.emit("clipBoxManager.enter"),i.player.model.floors.show()),i.setAllClipBoxVisible(!0),i.bindEvents(),i.player.locked=!0,i.player.model.transformTool.frame.material.visible=!1}),i.enterModule.bind(h(i)))},i.leaveModule=function(){i.setAllClipBoxVisible(!1),i.player.model.transformTool.frame.material.visible=!0,i.player.model.transformTool.history.clear(),i.player.model.transformTool.detach(),i.emit("clipBoxManager.active",{status:!1,list:i.clipBoxs}),i.adding&&i.cancelAddClipBox(),i.unBindEvents(),i.player.locked=!1,i.player.model.panos.forEach((function(e){return e.hasVideo&&De.updateVisible(e.marker,"clipBox",!0,10)})),i.player.OverlayManager.group.children.forEach((function(e){return e.show("clipBox")})),i.app.Camera.monitor.control.showAll(void 0,"clipBox",10,void 0),i.app.Scene.Decoration.showAll(),i.player.labelManager.show()},i.addClipBox=function(e){i.waitInit((function(){if(console.log("add"),!i.adding||e!==i.clipBoxs[i.clipBoxs.length-1].clipType)if(i.adding&&e!==i.clipBoxs[i.clipBoxs.length-1].clipType)i.changeClipBoxType();else{var t=new CM(e);i.clipBoxs.push(t),i.clipBoxGroup.add(t),i.adding=!0,i.onZoom()}}),i.addClipBox.bind(h(i),e))},i.cancelAddClipBox=function(){i.adding&&(console.log(i.clipBoxs[i.clipBoxs.length-1]),i.clipBoxGroup.remove(i.clipBoxs[i.clipBoxs.length-1]),i.clipBoxs.pop(),i.adding=!1,i.boxCountChanged(),null!==i.activeBoxIndex&&i.emit("clipBoxManager.active",{status:!1,list:i.clipBoxs}))},i.deleteClipBox=function(e){void 0===e&&null===i.activeBoxIndex||(void 0===e&&(e=i.activeBoxIndex),e===i.activeBoxIndex&&(i.activeBox=null,i.activeBoxIndex=null),i.player.model.transformTool.detach(),i.emit("clipBoxManager.active",{status:!1,list:i.clipBoxs}),i.emit("clipBoxManager.update",{list:i.clipBoxs}),i.clipBoxGroup.remove(i.clipBoxGroup.children[e]),i.clipBoxs.splice(e,1),i.clipBoxType.splice(e,1),i.clipBoxPoints.splice(4*e,4),i.boxCountChanged())},i.clearClipBoxs=function(){for(var e=i.clipBoxs.length,t=0;t<e;t++)i.deleteClipBox(0);i.clipBoxGroup.children=[],i.emit("clipBoxManager.active",{status:!1,list:i.clipBoxs}),i.emit("clipBoxManager.update",{list:i.clipBoxs}),i.boxCountChanged(),i.cancelAddClipBox()},i.changeClipBoxType=function(e){void 0===e&&(e=i.clipBoxs.length-1),i.adding?i.clipBoxs[e].switchBoxType():(i.clipBoxs[e].switchBoxType(),i.clipBoxType[e]=i.clipBoxs[e].clipType)},i.focusClipBox=function(e){i.activeBoxIndex=e,i.activeBox=i.clipBoxs[e],i.player.model.transformTool.attach(i.activeBox),i.emit("clipBoxManager.active",{status:!0,list:i.clipBoxs})},i.cancelActive=function(){i.player.model.transformTool.detach(),i.emit("clipBoxManager.active",{status:!1,list:i.clipBoxs}),i.activeBox&&(i.activeBox.status=0,i.activeBox.lowLight()),i.activeBox=null,i.activeBoxIndex=null},i.finishUpdateClipBox=function(){i.updateClipBox(),i.emit("clipBoxManager.update",{list:i.clipBoxs})},i.updateClipBox=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=null!=e.activeBoxIndex?e.activeBoxIndex:i.activeBoxIndex;if(null!=t){var n=i.clipBoxs[t].matrix;i.clipBoxPoints[4*t]=new THREE.Vector3(.5,-.5,-.5).applyMatrix4(n),i.clipBoxPoints[4*t+1]=new THREE.Vector3(-.5,.5,-.5).applyMatrix4(n),i.clipBoxPoints[4*t+2]=new THREE.Vector3(-.5,-.5,-.5).applyMatrix4(n),i.clipBoxPoints[4*t+3]=new THREE.Vector3(-.5,-.5,.5).applyMatrix4(n),i.boxCountChanged()}},i.saveEdit=function(){for(var e=[],t=0;t<i.clipBoxs.length;t++)e.push(i.clipBoxs[t].matrix.toArray());var n={clipBoxType:JSON.parse(JSON.stringify(i.clipBoxType)),clipMatrixs:e};return i.oriObj=n,console.log("save",n),i.player.model.transformTool.history.clear(),i.cancelActive(),n},i.cancelEdit=function(){i.adding&&i.cancelAddClipBox(),i.clipBoxs=[],i.clipBoxGroup.children=[],i.clipBoxPoints=[],i.clipBoxType=[],i.player.model.transformTool.detach(),i.player.model.transformTool.history.clear(),i.activeBox=null,i.emit("clipBoxManager.active",{status:!1,list:i.clipBoxs}),i.init(i.oriObj,!0)},i.setAllClipBoxVisible=function(e){i.clipBoxGroup.visible=e},i.switchTransformControlsMode=function(e){0==parseInt(e)&&(e="translation"),1==parseInt(e)&&(e="rotation"),2==parseInt(e)&&(e="scale"),i.player.model.transformTool.setModeEnable([e])},i}return u(n,[{key:"enableClip",value:function(e){var t=!e;this.unableClip!=t&&(this.unableClip=t,this.updateMaterials())}},{key:"boxCountChanged",value:function(){var e=this.clipBoxPoints.length/4,t=this.clipBoxs.length>0&&!this.unableClip;this.materials.forEach((function(n){var i="HasClip"in n.defines;t?n.defines.HasClip=!0:delete n.defines.HasClip,i==t&&n.defines.clipBoxCount==e||(n.needsUpdate=!0),n.defines.clipBoxCount=e}))}},{key:"clipInit",value:function(){this.player.model._3dTilesRuntime&&!this.isBind3dTile&&0!==this.clipBoxs.length&&(this.player.model._3dTilesRuntime.getTileset().on("endTileLoading",this.updateMaterials),this.isBind3dTile=!0),this.updateMaterials(),this.initFinish=!0,console.log("clipBox init finish")}},{key:"waitInit",value:function(e,t){this.initFinish?e&&e():this.deferred.then((function(){return t()}))}}]),n}(yo);function kM(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}var BM=new e.Vector3,PM=new e.Quaternion,RM=new e.Vector3,MM=function(e){f(n,e);var t=kM(n);function n(){var e,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:document.createElement("div");return o(this,n),(e=t.call(this)).isCSS3DObject=!0,e.element=i,e.element.style.position="absolute",e.element.style.pointerEvents="auto",e.element.style.userSelect="none",e.element.setAttribute("draggable",!1),e.addEventListener("removed",(function(){this.traverse((function(e){e.element instanceof Element&&null!==e.element.parentNode&&e.element.parentNode.removeChild(e.element)}))})),e}return u(n,[{key:"copy",value:function(e,t){return Tt(w(n.prototype),"copy",this).call(this,e,t),this.element=e.element.cloneNode(!0),this}}]),n}(e.Object3D),SM=new e.Matrix4,DM=new e.Matrix4,LM=function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};o(this,e);var n,i,r,a,s=this,l={camera:{style:""},objects:new WeakMap},c=void 0!==t.element?t.element:document.createElement("div");c.style.overflow="hidden",this.domElement=c;var u=document.createElement("div");u.style.transformOrigin="0 0",u.style.pointerEvents="none",c.appendChild(u);var h=document.createElement("div");function d(e){return Math.abs(e)<1e-10?0:e}function p(e){var t=e.elements;return"matrix3d("+d(t[0])+","+d(-t[1])+","+d(t[2])+","+d(t[3])+","+d(t[4])+","+d(-t[5])+","+d(t[6])+","+d(t[7])+","+d(t[8])+","+d(-t[9])+","+d(t[10])+","+d(t[11])+","+d(t[12])+","+d(-t[13])+","+d(t[14])+","+d(t[15])+")"}function f(e){var t=e.elements;return"translate(-50%,-50%)"+("matrix3d("+d(t[0])+","+d(t[1])+","+d(t[2])+","+d(t[3])+","+d(-t[4])+","+d(-t[5])+","+d(-t[6])+","+d(-t[7])+","+d(t[8])+","+d(t[9])+","+d(t[10])+","+d(t[11])+","+d(t[12])+","+d(t[13])+","+d(t[14])+","+d(t[15])+")")}function m(e,t,n,i){if(e.isCSS3DObject){var o=!0===e.visible&&!0===e.layers.test(n.layers);if(e.element.style.display=!0===o?"":"none",!0===o){var r;e.onBeforeRender(s,t,n),e.isCSS3DSprite?(SM.copy(n.matrixWorldInverse),SM.transpose(),0!==e.rotation2D&&SM.multiply(DM.makeRotationZ(e.rotation2D)),e.matrixWorld.decompose(BM,PM,RM),SM.setPosition(BM),SM.scale(RM),SM.elements[3]=0,SM.elements[7]=0,SM.elements[11]=0,SM.elements[15]=1,r=f(SM)):r=f(e.matrixWorld);var a=e.element,c=l.objects.get(e);if(void 0===c||c.style!==r){a.style.transform=r;var u={style:r};l.objects.set(e,u)}a.parentNode!==h&&h.appendChild(a),e.onAfterRender(s,t,n)}}for(var d=0,p=e.children.length;d<p;d++)m(e.children[d],t,n)}h.style.transformStyle="preserve-3d",u.appendChild(h),this.getSize=function(){return{width:n,height:i}},this.render=function(e,t){var o,s,c=t.projectionMatrix.elements[5]*a;t.view&&t.view.enabled?(u.style.transform="translate( ".concat(-t.view.offsetX*(n/t.view.width),"px, ").concat(-t.view.offsetY*(i/t.view.height),"px )"),u.style.transform+="scale( ".concat(t.view.fullWidth/t.view.width,", ").concat(t.view.fullHeight/t.view.height," )")):u.style.transform="",!0===e.matrixWorldAutoUpdate&&e.updateMatrixWorld(),null===t.parent&&!0===t.matrixWorldAutoUpdate&&t.updateMatrixWorld(),t.isOrthographicCamera&&(o=-(t.right+t.left)/2,s=(t.top+t.bottom)/2);var f=t.view&&t.view.enabled?t.view.height/t.view.fullHeight:1,v=t.isOrthographicCamera?"scale( ".concat(f," )")+"scale("+c+")translate("+d(o)+"px,"+d(s)+"px)"+p(t.matrixWorldInverse):"scale( ".concat(f," )")+"translateZ("+c+"px)"+p(t.matrixWorldInverse),g=(t.isPerspectiveCamera?"perspective("+c+"px) ":"")+v+"translate("+r+"px,"+a+"px)";l.camera.style!==g&&(h.style.transform=g,l.camera.style=g),m(e,e,t)},this.setSize=function(e,t){r=(n=e)/2,a=(i=t)/2,c.style.width=e+"px",c.style.height=t+"px",u.style.width=e+"px",u.style.height=t+"px",h.style.width=e+"px",h.style.height=t+"px"}};function FM(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}var HM=function(e){f(n,e);var t=FM(n);function n(e,i){var r;return o(this,n),(r=t.call(this,e)).player=i.player,r.manager=i.manager,r.sid=i.sid,r.text=void 0!==i.text?i.text:"",r.widthHeight=i.widthHeight,r.renderRes=void 0!==i.renderRes?i.renderRes:1,r.panoId=i.panoId,e.children[0].style.zoom=r.renderRes,r.scaleRes=void 0!==i.scaleRes?i.scaleRes/r.renderRes:1/r.renderRes,r.scale.set(r.scaleRes,r.scaleRes,r.scaleRes),r.enabled=void 0===i.visible||i.visible,r.visible=void 0===i.visible||i.visible,r.plane=new THREE.Mesh(new THREE.PlaneGeometry(.25,.25),new THREE.MeshBasicMaterial({wireframe:!0,side:2})),r.widthHeight&&r.plane.scale.set(r.widthHeight.x/100,r.widthHeight.y/100,1),void 0!==i.position&&r.plane.position.copy(i.position),void 0!==i.rotation&&r.plane.rotation.copy(i.rotation),r.plane.css3dObj=h(r),e.addEventListener("pointerdown",(function(e){e.stopPropagation()})),e.addEventListener("pointermove",(function(e){e.stopPropagation()})),e.addEventListener("pointerup",(function(e){e.stopPropagation(),r.manager.flyAndLookAt(h(r))})),e.addEventListener("mousewheel",(function(e){e.stopPropagation()})),e.addEventListener("mousedown",(function(e){e.stopPropagation()})),e.addEventListener("mousemove",(function(e){e.stopPropagation()})),e.addEventListener("mouseup",(function(e){e.stopPropagation()})),r.visible=!1,r.tempHide=!1,r.plane.visible=!1,r}return u(n,[{key:"update",value:function(){if(this.position.copy(this.plane.position),this.rotation.copy(this.plane.rotation),this.widthHeight&&0!==this.widthHeight.x&&0!==this.widthHeight.y){var e=Math.floor(100*this.plane.scale.x),t=Math.floor(100*this.plane.scale.y);this.element.firstChild.style.width=e+"px",this.element.firstChild.style.height=t+"px",this.widthHeight.x=e,this.widthHeight.y=t}else this.widthHeight={x:0,y:0},this.widthHeight.x=this.element.firstChild.offsetWidth,this.widthHeight.y=this.element.firstChild.offsetHeight,this.plane.scale.set(this.widthHeight.x/100,this.widthHeight.y/100,1);if(this.manager.isEdit);else if(!this.enabled||"panorama"!==this.player.mode||this.player.currentPano.id!==this.panoId)return void(this.visible=!1);this.enabled&&!this.tempHide&&(this.visible=!0)}},{key:"updatePlane",value:function(){this.plane.position.copy(this.position),this.plane.rotation.copy(this.rotation);var e=this.widthHeight.x/100,t=this.widthHeight.y/100;this.plane.scale.set(e,t,1)}}]),n}(MM);function VM(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}U(".domBox {\n max-width: 500px;\n max-height: 500px;\n background-color: #292929;\n border-radius: 5px;\n padding: 20px;\n font-size: 30px;\n overflow: auto;\n /* overflow-x: hidden; */\n /* overflow-y: auto; */\n\n font-family: Microsoft YaHei;\n font-weight: 400;\n font-size: 14px;\n color: #FFFFFF;\n line-height: 22px;\n text-align: left;\n font-style: normal;\n text-transform: none;\n word-wrap:break-word;\n\n pointer-events: auto;\n cursor: pointer;\n}\n\n/* .domBox :first-child{ */\n /* width: 400px; */\n /* height: 418px; */\n/* } */",{});var OM=500,QM=500,_M=.0025,zM=2;function UM(e){return e*(Math.PI/180)}function NM(e){return Math.floor(e*(180/Math.PI))}function GM(e,t){var n=Math.pow(10,t);return Math.round(e*n)/n}var jM=function(e){f(n,e);var t=VM(n);function n(e){var i;return o(this,n),(i=t.call(this)).bindEvents=function(){i.isBind||(i.player.on(fa,i.update),i.player.on("flying.start",i.onFlyStart.bind(h(i))),i.player.on("flying.ended",i.onFlyEnd.bind(h(i))),i.isBind=!0)},i.unBindEvents=function(){i.isBind&&(i.player.off(fa,i.update),i.isBind=!1)},i.onFlyStart=function(){i.update()},i.onFlyEnd=function(){i.isEdit&&(i.player.mode===xt.PANORAMA?i.player.locked=!0:i.player.locked=!1),i.update()},i.switchTransformControlsMode=function(e){0==parseInt(e)&&(e="translate"),1==parseInt(e)&&(e="rotate"),2==parseInt(e)&&(e="scale"),i.player.model.transformControls.mode=e},i.update=function(){i.list.forEach((function(e){e.update()}))},i.show=function(e){i.waitInit((function(){var t=i.getObjBySid(e);t?(t.enabled=!0,t.visible=!0,i.isEdit&&(i.player.model.transformControls.visible=!0)):console.error("cssObject no found sid="+e)}),i.show.bind(h(i),e))},i.hide=function(e){i.waitInit((function(){var t=i.getObjBySid(e);t?(t.enabled=!1,t.visible=!1,i.isEdit&&(i.player.model.transformControls.visible=!1)):console.error("cssObject no found sid="+e)}),i.hide.bind(h(i),e))},i.showAll=function(e){var t;e&&(t=i.player.currentPano),i.list.forEach((function(n){e&&t?n.panoId===t.id&&(n.visible=!0):(n.tempHide=!1,n.visible=!0)})),i.update()},i.hideAll=function(){i.list.forEach((function(e){e.tempHide=!0,e.visible=!1})),console.log("hideAll"),i.update()},i.sendData=function(){if(i.isEdit){var e=i.player.model.transformControls.object,t=e.css3dObj;e.scale.x=Math.min(OM/100,e.scale.x),e.scale.y=Math.min(QM/100,e.scale.y),e.scale.x=Math.max(.4,e.scale.x),e.scale.y=Math.max(.4,e.scale.y);var n={sid:t.sid,position:{x:GM(t.position.x,2),y:GM(t.position.y,2),z:GM(t.position.z,2)},scale:{x:t.widthHeight.x,y:t.widthHeight.y},rotation:{x:NM(t.rotation.x),y:NM(t.rotation.y),z:NM(t.rotation.z)},panoId:t.panoId,visible:t.enabled,text:t.text};i.emit("css3dmanager_sendData",n)}},i.setEditStyle=function(e,t){t?(i.player.model.transformControls.attach(e.plane),e.enabled||(i.player.model.transformControls.visible=!1),e.element.style.opacity=.5,e.element.style.pointerEvents="none",e.element.firstChild.style.pointerEvents="none"):(i.player.model.transformControls.detach(),e.element.style.opacity=1,e.element.style.pointerEvents="auto",e.element.firstChild.style.pointerEvents="auto")},i.app=e,i.player=null,i.deferred=oe(),i.renderer=new LM,i.group=new THREE.Group,i.group.name="css3D_Object_Group",i.list=[],i.intrArr=[],i.mouse=new THREE.Vector3,i.mousedown=new THREE.Vector3,i.mouseup=new THREE.Vector3,i.inited=!1,i.isBind=!1,i.isEdit=!1,i.renderInited=!1,i.recoverStack=null,i.init=function(e){e&&e.forEach((function(e){i.build(e)})),i.inited=!0,i.deferred.resolve()},i.addRenderer=function(){i.player.model.add(i.group);var e=i.app.core.get("SceneRenderer");e.css3dRenderer=i.renderer,i.renderer.domElement.style.position="absolute",i.renderer.domElement.style.top=0,i.renderer.domElement.style.zIndex=1e4,i.renderer.domElement.style.pointerEvents="none",i.renderer.setSize(e.renderWidth,e.renderHeight),i.app.dom.querySelector(".player").appendChild(i.renderer.domElement),i.bindEvents(),i.renderInited=!0},i.app.Scene.on("loaded",(function(){setTimeout((function(){i.player=i.app.core.get("Player");i.init(null),console.log("css3dManager init finish")}),50)})),i.enterEdit=function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];i.waitInit((function(){var n=i.getObjBySid(e);if(n){i.setEditStyle(n,!0),i.player.model.transformControls.switchEditState("css3d"),i.player.model.transformControls.addEventListener("mousing",i.sendData),i.isEdit=!0,i.flyAndLookAt(n,!0),e.isCSS3DObject&&(e=e.sid);var o={sid:e,position:{x:n.position.x,y:n.position.y,z:n.position.z},scale:{x:n.widthHeight.x,y:n.widthHeight.y},rotation:{x:NM(n.rotation.x),y:NM(n.rotation.y),z:NM(n.rotation.z)},visible:n.enabled,text:n.text,panoId:n.panoId};i.emit("css3dmanager_sendData",o),i.recoverStack={obj:n,isNew:t,position:{x:n.position.x,y:n.position.y,z:n.position.z},scale:{x:n.widthHeight.x,y:n.widthHeight.y},rotation:{x:NM(n.rotation.x),y:NM(n.rotation.y),z:NM(n.rotation.z)},enabled:n.enabled,panoId:n.panoId},console.log("recoverStack =>",i.recoverStack)}else console.error("cssObject no found sid="+e)}),i.enterEdit.bind(h(i),e))},i.leaveEdit=function(e){i.setEditStyle(e,!1),i.player.model.transformControls.removeEventListener("mousing",i.sendData)},i.build=function(e,t){void 0!==e.panoId&&null!==e.panoId&&i.waitInit((function(){console.log("--------------build----------------"),console.log(e),i.renderInited||i.addRenderer();var n=e.position.isVector3?e.position:new THREE.Vector3(e.position.x,e.position.y,e.position.z),o=e.scale,r=e.position.isEuler?e.rotation:new THREE.Euler(UM(e.rotation.x),UM(e.rotation.y),UM(e.rotation.z)),a=e.text,s=document.createElement("div"),l=document.createElement("div");l.classList.add("domBox"),l.innerText=a,s.append(l);var c=new HM(s,{player:i.player,manager:h(i),sid:e.sid,text:a,position:n,rotation:r,renderRes:zM,scaleRes:_M,widthHeight:o,visible:e.visible,panoId:e.panoId});i.group.add(c),i.group.add(c.plane),i.list.push(c),i.intrArr.push(c.plane),e.cameraPos&&c.plane.lookAt(e.cameraPos),c.update(),t&&i.waitCSS3DObjInit(c)}),i.build.bind(h(i),e))},i.add=function(e){var t=i.player.cameraControls.cameras.panorama,n=t.position,o=new THREE.Vector3;t.getWorldDirection(o);var r=n.clone().add(o);r.x=GM(r.x,2),r.y=GM(r.y,2),r.z=GM(r.z,2);var a=new THREE.Euler(0,-Math.PI/2,0);i.build({sid:e.sid,position:r,rotation:a,text:e.text,visible:!0,cameraPos:n,panoId:i.player.currentPano.id},!0)},i.resetOption=function(e){i.waitInit((function(){var t=function(){var t=i.getObjBySid(e);if(t){i.recoverStack={obj:t,isNew:!1,position:{x:t.position.x,y:t.position.y,z:t.position.z},scale:{x:t.widthHeight.x,y:t.widthHeight.y},rotation:{x:NM(t.rotation.x),y:NM(t.rotation.y),z:NM(t.rotation.z)},panoId:t.panoId,enabled:t.enabled},i.isEdit=!0,i.setEditStyle(t,!0),i.player.model.transformControls.switchEditState("css3dpanel"),i.player.model.transformControls.addEventListener("mousing",i.sendData),i.player.locked=!0;var n=i.player.cameraControls.cameras.panorama,o=n.position,r=new THREE.Vector3;n.getWorldDirection(r);var a=o.clone().add(r);a.x=GM(a.x,2),a.y=GM(a.y,2),a.z=GM(a.z,2);var s=i.player.currentPano.id;t.position.copy(a),t.panoId=s,t.lookAt(n.position),t.updatePlane(),t.update();var l={sid:e,position:{x:t.position.x,y:t.position.y,z:t.position.z},scale:{x:t.widthHeight.x,y:t.widthHeight.y},rotation:{x:NM(t.rotation.x),y:NM(t.rotation.y),z:NM(t.rotation.z)},panoId:t.panoId,visible:t.enabled,text:t.text};i.emit("css3dmanager_sendData",l)}else console.error("cssObject no found sid="+e)};i.player.mode!==xt.PANORAMA?(i.player.insideMode(),i.player.once("flying.ended",t.bind(h(i)))):t()}),i.resetOption.bind(h(i),e))},i.updateList=function(e){i.waitInit((function(){i.isEdit||!e||e.length<=0||e.forEach((function(e){var t=i.getObjBySid(e.sid);t?(t.text!==e.text&&(console.log(t.sid+"=> text udpate"),i.setText(t,e.text)),t.position.x===e.position.x&&t.position.y===e.position.y&&t.position.z===e.position.z||(console.log(t.sid+"=> position udpate"),i.setPosition(t,e.position)),(Math.abs(NM(t.rotation.x)-e.rotation.x)>=1||Math.abs(NM(t.rotation.y)-e.rotation.y)>=1||Math.abs(NM(t.rotation.z)-e.rotation.z)>=1)&&(console.log(t.sid+"=> rotation udpate"),i.setRotation(t,e.rotation)),t.widthHeight.x===e.scale.x&&t.widthHeight.y===e.scale.y||(console.log(t.sid+"=> scale udpate"),i.setScale(t,e.scale)),t.enabled!==e.visible&&(console.log(t,t.enabled,e.visible),console.log(t.sid+"=> visible udpate"),t.enabled=e.visible)):i.build(e)}))}),i.updateList.bind(h(i),e))},i.setText=function(e,t){var n=i.getObjBySid(e);n?(n.element.children[0].innerText=t,n.text=t):console.error("cssObject no found sid="+e)},i.setPosition=function(e,t){var n=i.getObjBySid(e);if(n){var o=new THREE.Vector3(t.x,t.y,t.z);n.position.copy(o),n.updatePlane()}else console.error("cssObject no found sid="+e)},i.setRotation=function(e,t){var n=i.getObjBySid(e);if(n){var o=new THREE.Euler(UM(t.x),UM(t.y),UM(t.z));n.rotation.copy(o),n.updatePlane()}else console.error("cssObject no found sid="+e)},i.setScale=function(e,t){var n=i.getObjBySid(e);if(n){var o=n.element.children[0];o.style.width=t.x+"px",o.style.height=t.y+"px",n.widthHeight={x:t.x,y:t.y},t.x>OM?o.style.maxWidth="none":o.style.maxWidth=OM+"px",t.y>QM?o.style.maxHeight="none":o.style.maxHeight=QM+"px",n.updatePlane()}else console.error("cssObject no found sid="+e)},i.getObjBySid=function(e){var t=null;if(e.isCSS3DObject)t=e;else for(var n=0;n<i.list.length;n++)if(i.list[n].sid===e){t=i.list[n];break}return t},i.flyAndLookAt=function(e,t){var n=i.getObjBySid(e);if(n)if(void 0!==n.panoId){var o=i.player.currentPano.id;i.player.flyToPano({pano:i.app.Scene.panos.index[n.panoId],lookAtPoint:n.position,checkAlone:!0}),t&&o===n.panoId&&(i.player.locked=!0)}else console.error("cssObject.panoId no found sid="+e);else console.error("cssObject no found sid="+e)},i.saveEdit=function(){i.isEdit&&(i.leaveEdit(i.recoverStack.obj),i.recoverStack=null,i.isEdit=!1,i.player.locked=!1,i.update())},i.cancelEdit=function(){i.isEdit&&(console.log(i.recoverStack),i.leaveEdit(i.recoverStack.obj),i.recoverStack.isNew?i.recoverStack.obj.removeFromParent():(i.setPosition(i.recoverStack.obj,i.recoverStack.position),i.setRotation(i.recoverStack.obj,i.recoverStack.rotation),i.setScale(i.recoverStack.obj,i.recoverStack.scale),i.recoverStack.obj.enabled=i.recoverStack.enabled,i.recoverStack.obj.panoId=i.recoverStack.panoId,i.recoverStack=null,i.isEdit=!1,i.player.locked=!1,i.update()))},i}return u(n,[{key:"waitInit",value:function(e,t){this.inited?e&&e():this.deferred.then((function(){return t()}))}},{key:"waitCSS3DObjInit",value:function(e){var t=this;0!==e.widthHeight.x&&0!==e.widthHeight.y?this.enterEdit(e,!0):setTimeout((function(){e.update(),t.waitCSS3DObjInit(e)}),50)}}]),n}(yo);function WM(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}var qM=1,JM=function(e){f(n,THREE.Sprite);var t=WM(n);function n(e){var i;o(this,n);var r=new Uint8Array([255,255,255,255]),a=new THREE.DataTexture(r,1,1);a.needsUpdate=!0;var s=new THREE.SpriteMaterial({transparent:!0,sizeAttenuation:!1,color:e,map:a}),l={uactive:{value:!1}};return s.onBeforeCompile=function(e){e.uniforms.uactive=l.uactive,e.fragmentShader=e.fragmentShader.replace("#include <uv_pars_fragment>","\n #include <uv_pars_fragment>\n \n uniform bool uactive;\n "),e.fragmentShader=e.fragmentShader.replace("#include <output_fragment>","\n #ifdef OPAQUE\n diffuseColor.a = 1.0;\n #endif\n #ifdef USE_TRANSMISSION\n strength *= transmissionAlpha + 0.1;\n #endif\n float strength = 1.0 - smoothstep(0.3, 0.55, distance(vUv, vec2(0.5)));\n // if(strength == 0.0) discard;\n diffuseColor.a = strength; \n vec3 col = diffuse;\n if (uactive) {\n float outline = 1.0 - smoothstep(0.15, 0.3, distance(vUv, vec2(0.5)));\n // col = outline == 0.0 ? vec3(0.0, 0.7843, 0.6863) : vec3(1.0, 1.0, 1.0);\n col = mix(vec3(0.0, 0.7843, 0.6863), vec3(1.0, 1.0, 1.0), outline);\n }\n gl_FragColor = vec4(col, diffuseColor.a);\n ")},s.depthFunc=THREE.AlwaysDepth,(i=t.call(this,s)).uniforms=l,i.color=e,i.scale.set(.012,.012,1),i.renderOrder=tt,i.setScale(null,!1),i.isPolygonMarkElement=!0,i.isPolygonMarkPoint=!0,i}return u(n,[{key:"setPosition",value:function(e){this.position.copy(e)}},{key:"setScale",value:function(e){var t,n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];e?(t=1/e*.012,n&&(qM=e)):t=1/qM*.012,this.scale.set(t,t,t)}},{key:"setColor",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.material.color.set(e),t&&(this.color=e)}},{key:"highLight",value:function(){this.uniforms.uactive.value=!0,this.visible=!0}},{key:"midLight",value:function(){this.uniforms.uactive.value=!1,this.visible=!0}},{key:"lowLight",value:function(){this.uniforms.uactive.value=!1,this.visible=!1}}]),n}();function YM(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}var ZM=yi.createFatLineMat({lineWidth:2,color:51375,dashSize:.03,gapSize:.03,dashed:!0}),XM=yi.createFatLineMat({lineWidth:2,color:51375}),KM=function(e){f(n,THREE.Group);var t=YM(n);function n(e,i){var r;return o(this,n),(r=t.call(this)).line=yi.createFatLine(e,{material:i}),r.line.renderOrder=et,r.normalMaterial=i,r.startPoint=e[0],r.add(r.line),r}return u(n,[{key:"setMaterial",value:function(e){switch(e){case"normal":this.line.material=this.normalMaterial;break;case"active":this.line.material=XM;break;case"dashed":this.line.material=ZM}}},{key:"update",value:function(e){yi.moveFatLine(this.line,[this.startPoint,e])}}]),n}();function $M(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}var eS=yi.createFatLineMat({lineWidth:2,color:51375}),tS=function(e){f(n,THREE.Group);var t=$M(n);function n(e,i){var r;o(this,n),r=t.call(this);var a=e[0].clone();a=e.concat([a]);for(var s=new THREE.LineBasicMaterial({color:16777215}),l=0;l<a.length-1;l++){var c=[a[l],a[l+1]],u=(new THREE.BufferGeometry).setFromPoints(c),h=new THREE.Line(u,s);h.isPolygonMarkElement=!0,h.isPolygonMarkLine=!0,h.startPoint=l,r.add(h)}return r.fatLine=yi.createFatLine(a,{material:i}),r.fatLine.renderOrder=et,r.normalMaterial=i,r.isPolygonMarkElement=!0,r.isPolygonMarkLineLoop=!0,r.add(r.fatLine),r}return u(n,[{key:"setColor",value:function(e){this.normalMaterial.color.set(e)}},{key:"highLight",value:function(){this.fatLine.material=eS}},{key:"midLight",value:function(){this.fatLine.material=this.normalMaterial}},{key:"lowLight",value:function(){this.fatLine.material=this.normalMaterial}}]),n}();function nS(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}var iS=.3,oS=function(e){f(n,THREE.Mesh);var t=nS(n);function n(e){var i,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[0,1,2],a=arguments.length>2?arguments[2]:void 0;o(this,n);var s=new THREE.MeshBasicMaterial({color:a,transparent:!0,opacity:iS,side:THREE.DoubleSide});s.depthFunc=THREE.AlwaysDepth;var l=new THREE.BufferGeometry,c=new Float32Array(e),u=r;return l.setIndex(u),l.setAttribute("position",new THREE.BufferAttribute(c,3)),(i=t.call(this,l,s)).frustumCulled=!1,i.renderOrder=et,i.visible=!1,i.isPolygonMarkElement=!0,i.active=0,i.originColor=a,i}return u(n,[{key:"highLight",value:function(){this.selected=!0,De.updateVisible(this,"highlight",!0),this.material.opacity=THREE.MathUtils.clamp((this.opacity2||iS)+.3,.4,.95)}},{key:"midLight",value:function(){De.updateVisible(this,"highlight",!1)}},{key:"lowLight",value:function(){this.selected=!1,De.updateVisible(this,"highlight",!1),this.material.opacity=null==this.opacity2?iS:this.opacity2}},{key:"setDisplay",value:function(e,t,n){De.updateVisible(this,"display",e,1,e?"add":"cancel"),null!=t&&this.material.color.set(t),null!=n&&(this.opacity2=this.material.opacity=n)}}]),n}(),rS=function(e,t){var n,i,o,r,a,s,l,c=arguments.length>2&&void 0!==arguments[2]?arguments[2]:2,u=t&&t.length,h=u?t[0]*c:e.length,d=aS(e,0,h,c,!0),p=[];if(!d||d.next===d.prev)return p;if(u&&(d=pS(e,t,d,c)),e.length>80*c){n=o=e[0],i=r=e[1];for(var f=c;f<h;f+=c)(a=e[f])<n&&(n=a),(s=e[f+1])<i&&(i=s),a>o&&(o=a),s>r&&(r=s);l=0!==(l=Math.max(o-n,r-i))?32767/l:0}return lS(d,p,c,n,i,l,0),p};function aS(e,t,n,i,o){var r,a;if(o===function(e,t,n,i){for(var o=0,r=t,a=n-i;r<n;r+=i)o+=(e[a]-e[r])*(e[r+1]+e[a+1]),a=r;return o}(e,t,n,i)>0)for(r=t;r<n;r+=i)a=BS(r,e[r],e[r+1],a);else for(r=n-i;r>=t;r-=i)a=BS(r,e[r],e[r+1],a);return a&&wS(a,a.next)&&(PS(a),a=a.next),a}function sS(e,t){if(!e)return e;t||(t=e);var n,i=e;do{if(n=!1,i.steiner||!wS(i,i.next)&&0!==bS(i.prev,i,i.next))i=i.next;else{if(PS(i),(i=t=i.prev)===i.next)break;n=!0}}while(n||i!==t);return t}function lS(e,t,n,i,o,r,a){if(e){!a&&r&&function(e,t,n,i){var o=e;do{0===o.z&&(o.z=gS(o.x,o.y,t,n,i)),o.prevZ=o.prev,o.nextZ=o.next,o=o.next}while(o!==e);o.prevZ.nextZ=null,o.prevZ=null,function(e){var t,n,i,o,r,a,s,l,c=1;do{for(n=e,e=null,r=null,a=0;n;){for(a++,i=n,s=0,t=0;t<c&&(s++,i=i.nextZ);t++);for(l=c;s>0||l>0&&i;)0!==s&&(0===l||!i||n.z<=i.z)?(o=n,n=n.nextZ,s--):(o=i,i=i.nextZ,l--),r?r.nextZ=o:e=o,o.prevZ=r,r=o;n=i}r.nextZ=null,c*=2}while(a>1)}(o)}(e,i,o,r);for(var s,l,c=e;e.prev!==e.next;)if(s=e.prev,l=e.next,r?uS(e,i,o,r):cS(e))t.push(s.i/n|0),t.push(e.i/n|0),t.push(l.i/n|0),PS(e),e=l.next,c=l.next;else if((e=l)===c){a?1===a?lS(e=hS(sS(e),t,n),t,n,i,o,r,2):2===a&&dS(e,t,n,i,o,r):lS(sS(e),t,n,i,o,r,1);break}}}function cS(e){var t=e.prev,n=e,i=e.next;if(bS(t,n,i)>=0)return!1;for(var o=t.x,r=n.x,a=i.x,s=t.y,l=n.y,c=i.y,u=o<r?o<a?o:a:r<a?r:a,h=s<l?s<c?s:c:l<c?l:c,d=o>r?o>a?o:a:r>a?r:a,p=s>l?s>c?s:c:l>c?l:c,f=i.next;f!==t;){if(f.x>=u&&f.x<=d&&f.y>=h&&f.y<=p&&AS(o,s,r,l,a,c,f.x,f.y)&&bS(f.prev,f,f.next)>=0)return!1;f=f.next}return!0}function uS(e,t,n,i){var o=e.prev,r=e,a=e.next;if(bS(o,r,a)>=0)return!1;for(var s=o.x,l=r.x,c=a.x,u=o.y,h=r.y,d=a.y,p=s<l?s<c?s:c:l<c?l:c,f=u<h?u<d?u:d:h<d?h:d,m=s>l?s>c?s:c:l>c?l:c,v=u>h?u>d?u:d:h>d?h:d,g=gS(p,f,t,n,i),y=gS(m,v,t,n,i),A=e.prevZ,E=e.nextZ;A&&A.z>=g&&E&&E.z<=y;){if(A.x>=p&&A.x<=m&&A.y>=f&&A.y<=v&&A!==o&&A!==a&&AS(s,u,l,h,c,d,A.x,A.y)&&bS(A.prev,A,A.next)>=0)return!1;if(A=A.prevZ,E.x>=p&&E.x<=m&&E.y>=f&&E.y<=v&&E!==o&&E!==a&&AS(s,u,l,h,c,d,E.x,E.y)&&bS(E.prev,E,E.next)>=0)return!1;E=E.nextZ}for(;A&&A.z>=g;){if(A.x>=p&&A.x<=m&&A.y>=f&&A.y<=v&&A!==o&&A!==a&&AS(s,u,l,h,c,d,A.x,A.y)&&bS(A.prev,A,A.next)>=0)return!1;A=A.prevZ}for(;E&&E.z<=y;){if(E.x>=p&&E.x<=m&&E.y>=f&&E.y<=v&&E!==o&&E!==a&&AS(s,u,l,h,c,d,E.x,E.y)&&bS(E.prev,E,E.next)>=0)return!1;E=E.nextZ}return!0}function hS(e,t,n){var i=e;do{var o=i.prev,r=i.next.next;!wS(o,r)&&xS(o,i,i.next,r)&&IS(o,r)&&IS(r,o)&&(t.push(o.i/n|0),t.push(i.i/n|0),t.push(r.i/n|0),PS(i),PS(i.next),i=e=r),i=i.next}while(i!==e);return sS(i)}function dS(e,t,n,i,o,r){var a=e;do{for(var s=a.next.next;s!==a.prev;){if(a.i!==s.i&&ES(a,s)){var l=kS(a,s);return a=sS(a,a.next),l=sS(l,l.next),lS(a,t,n,i,o,r,0),void lS(l,t,n,i,o,r,0)}s=s.next}a=a.next}while(a!==e)}function pS(e,t,n,i){var o,r,a,s=[];for(o=0,r=t.length;o<r;o++)(a=aS(e,t[o]*i,o<r-1?t[o+1]*i:e.length,i,!1))===a.next&&(a.steiner=!0),s.push(yS(a));for(s.sort(fS),o=0;o<s.length;o++)n=mS(s[o],n);return n}function fS(e,t){return e.x-t.x}function mS(e,t){var n=function(e,t){var n,i=t,o=-1/0,r=e.x,a=e.y;do{if(a<=i.y&&a>=i.next.y&&i.next.y!==i.y){var s=i.x+(a-i.y)*(i.next.x-i.x)/(i.next.y-i.y);if(s<=r&&s>o&&(o=s,n=i.x<i.next.x?i:i.next,s===r))return n}i=i.next}while(i!==t);if(!n)return null;var l,c=n,u=n.x,h=n.y,d=1/0;i=n;do{r>=i.x&&i.x>=u&&r!==i.x&&AS(a<h?r:o,a,u,h,a<h?o:r,a,i.x,i.y)&&(l=Math.abs(a-i.y)/(r-i.x),IS(i,e)&&(l<d||l===d&&(i.x>n.x||i.x===n.x&&vS(n,i)))&&(n=i,d=l)),i=i.next}while(i!==c);return n}(e,t);if(!n)return t;var i=kS(n,e);return sS(i,i.next),sS(n,n.next)}function vS(e,t){return bS(e.prev,e,t.prev)<0&&bS(t.next,e,e.next)<0}function gS(e,t,n,i,o){return(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-n)*o|0)|e<<8))|e<<4))|e<<2))|e<<1))|(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-i)*o|0)|t<<8))|t<<4))|t<<2))|t<<1))<<1}function yS(e){var t=e,n=e;do{(t.x<n.x||t.x===n.x&&t.y<n.y)&&(n=t),t=t.next}while(t!==e);return n}function AS(e,t,n,i,o,r,a,s){return(o-a)*(t-s)>=(e-a)*(r-s)&&(e-a)*(i-s)>=(n-a)*(t-s)&&(n-a)*(r-s)>=(o-a)*(i-s)}function ES(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!function(e,t){var n=e;do{if(n.i!==e.i&&n.next.i!==e.i&&n.i!==t.i&&n.next.i!==t.i&&xS(n,n.next,e,t))return!0;n=n.next}while(n!==e);return!1}(e,t)&&(IS(e,t)&&IS(t,e)&&function(e,t){var n=e,i=!1,o=(e.x+t.x)/2,r=(e.y+t.y)/2;do{n.y>r!=n.next.y>r&&n.next.y!==n.y&&o<(n.next.x-n.x)*(r-n.y)/(n.next.y-n.y)+n.x&&(i=!i),n=n.next}while(n!==e);return i}(e,t)&&(bS(e.prev,e,t.prev)||bS(e,t.prev,t))||wS(e,t)&&bS(e.prev,e,e.next)>0&&bS(t.prev,t,t.next)>0)}function bS(e,t,n){return(t.y-e.y)*(n.x-t.x)-(t.x-e.x)*(n.y-t.y)}function wS(e,t){return e.x===t.x&&e.y===t.y}function xS(e,t,n,i){var o=TS(bS(e,t,n)),r=TS(bS(e,t,i)),a=TS(bS(n,i,e)),s=TS(bS(n,i,t));return o!==r&&a!==s||(!(0!==o||!CS(e,n,t))||(!(0!==r||!CS(e,i,t))||(!(0!==a||!CS(n,e,i))||!(0!==s||!CS(n,t,i)))))}function CS(e,t,n){return t.x<=Math.max(e.x,n.x)&&t.x>=Math.min(e.x,n.x)&&t.y<=Math.max(e.y,n.y)&&t.y>=Math.min(e.y,n.y)}function TS(e){return e>0?1:e<0?-1:0}function IS(e,t){return bS(e.prev,e,e.next)<0?bS(e,t,e.next)>=0&&bS(e,e.prev,t)>=0:bS(e,t,e.prev)<0||bS(e,e.next,t)<0}function kS(e,t){var n=new RS(e.i,e.x,e.y),i=new RS(t.i,t.x,t.y),o=e.next,r=t.prev;return e.next=t,t.prev=e,n.next=o,o.prev=n,i.next=n,n.prev=i,r.next=i,i.prev=r,i}function BS(e,t,n,i){var o=new RS(e,t,n);return i?(o.next=i.next,o.prev=i,i.next.prev=o,i.next=o):(o.prev=o,o.next=o),o}function PS(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ)}function RS(e,t,n){this.i=e,this.x=t,this.y=n,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}var MS=function(){function e(t,n,i){var r=this;o(this,e),this.manager=t,this.parent=n,this.group=new THREE.Group,this.group.parentObj=this,this.pointGroup=new THREE.Group,this.lineGroup=new THREE.Group,this.shapeGroup=new THREE.Group,this.group.add(this.pointGroup),this.group.add(this.lineGroup),this.group.add(this.shapeGroup),this.points=[],this.lines=[],this.shape=null,this.shapeIndexes=[],this.color=i.color,this.activeColor=51375,this.lineMat=i.lineMat,this.tempPoint,this.tempLine,this.active=!1,this.draw={},this.edit={},this.draw.add=function(e){if(r.points.length>3&&r.tempPoint&&r.tempPoint.position.distanceTo(r.points[0].position)<.025)r.draw.finish();else{var t=new JM(r.color);if(r.tempPoint=t,t.setPosition(e),t.highLight(),r.pointGroup.add(t),r.points.push(t),1===r.points.length)r.draw.add(e);else{var n=r.points[r.points.length-2].position.clone(),i=r.points[r.points.length-1].position.clone(),o=new KM([n,i],r.lineMat);r.tempLine&&r.tempLine.setMaterial("active"),r.tempLine=o,r.tempLine.setMaterial("dashed"),r.lineGroup.add(o),r.lines.push(o)}}},this.draw.delete=function(){if(r.tempPoint){var e=r.tempPoint.position.clone();r.points.pop(),r.lines.pop(),r.pointGroup.remove(r.tempPoint),r.lineGroup.remove(r.tempLine);var t=r.points[r.points.length-1].position.clone();return r.points.length>1?(r.tempPoint=r.points[r.points.length-1],r.tempLine=r.lines[r.lines.length-1],r.tempLine.setMaterial("dashed"),r.draw.update(e)):r.deleteAll(),t}},this.draw.recover=function(e){var t=new JM(r.color);t.setPosition(e),t.highLight(),r.pointGroup.add(t),r.points.splice(r.points.length-1,0,t),r.lines.pop(),r.lineGroup.remove(r.tempLine);var n=r.points[r.points.length-3].position.clone(),i=r.points[r.points.length-2].position.clone(),o=new KM([n,i],r.lineMat);o.setMaterial("active"),r.lineGroup.add(o),r.lines.push(o);var a=r.points[r.points.length-2].position.clone(),s=r.points[r.points.length-1].position.clone(),l=new KM([a,s],r.lineMat);r.tempLine=l,r.tempLine.setMaterial("dashed"),r.lineGroup.add(l),r.lines.push(l),r.draw.update(r.tempPoint.position)},this.draw.finish=function(e){if(!(r.points.length<4)){console.log("finish");var t=r.points.indexOf(r.tempPoint);-1!==t&&r.points.splice(t,1),r.pointGroup.remove(r.tempPoint),r.createLoopLine(),r.createShape(),r.midLight(),r.manager.emit("polygonmarkManager.finish"),r.manager.emit("polygonmarkManager.update"),r.parent.label?r.parent.updateIntersectArr():r.parent.createLabel(r.computePointsCenter())}},this.draw.update=function(e){r.tempPoint&&r.tempPoint.setPosition(e),r.tempLine&&r.tempLine.update(e)},this.draw.increase=function(e,t){var n=new JM(r.color);n.midLight(),n.setPosition(e),r.points.splice(t+1,0,n),r.pointGroup.add(n),r.createLoopLine(),r.createShape(),r.parent.updateIntersectArr(),r.manager.emit("polygonmarkManager.update"),setTimeout((function(){r.manager.onMouseMove()}),100)},this.draw.subtract=function(e){var t=r.points.indexOf(e);t>-1&&r.points.splice(t,1),r.pointGroup.remove(e),r.createLoopLine(),r.createShape(),r.parent.updateIntersectArr(),r.points.length<=2&&r.deleteAll(),r.manager.emit("polygonmarkManager.update")},this.edit.update=function(e,t){e.setPosition(t),r.createLoopLine(),r.createShape(),r.parent.updateIntersectArr(),r.active&&r.highLight()}}return u(e,[{key:"build",value:function(e,t){var n=this;e.forEach((function(e){var t=new JM(n.color);t.setPosition(e),n.points.push(t),n.pointGroup.add(t)})),this.createLoopLine(),this.createShape(t),this.lowLight()}},{key:"createShape",value:function(e){if(e){var t=[];this.points.forEach((function(e){t.push(e.position.x),t.push(e.position.y),t.push(e.position.z)})),this.shapeIndexes=e;var n=new oS(t,e,this.activeColor);return this.shapeGroup.clear(),this.shapeGroup.add(n),void(this.shape=n)}var i=[];if(!(this.points.length<3))if(3===this.points.length){this.points.forEach((function(e){i.push(e.position.x),i.push(e.position.y),i.push(e.position.z)})),this.shapeIndexes=[0,1,2];var o=new oS(i,null,this.activeColor);this.shapeGroup.clear(),this.shapeGroup.add(o),this.shape=o}else{var r=new THREE.Vector3,a=this.manager.player.cameraControls.cameras.panorama;a.getWorldDirection(r);var s=new THREE.Plane(r,0),l=[];this.points.forEach((function(e){var t=new THREE.Vector3;s.projectPoint(e.position,t),t.applyMatrix4(a.matrixWorldInverse),l.push(t.x),l.push(t.y),i.push(e.position.x),i.push(e.position.y),i.push(e.position.z)}));var c=rS(l);this.shapeIndexes=c;var u=new oS(i,c,this.activeColor);this.shapeGroup.clear(),this.shapeGroup.add(u),this.shape=u}}},{key:"createLoopLine",value:function(){var e=[];this.points.forEach((function(t){e.push(t.position)}));var t=new tS(e,this.lineMat);this.lines.length=[],this.lines.push(t),this.group.remove(this.lineGroup),this.lineGroup.clear(),this.lineGroup=t,this.group.add(this.lineGroup)}},{key:"hide",value:function(){this.group.visible=!1}},{key:"show",value:function(){this.group.visible=!0}},{key:"deleteAll",value:function(){this.parent.deleteMark(this),this.manager.updateActivePoint(null,null,!1),this.manager.emit("polygonmarkManager.finish"),this.parent.updateIntersectArr()}},{key:"setColor",value:function(e){this.points.forEach((function(t){t.setColor(e)})),this.color=e}},{key:"setLight",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];e?(t&&this.lines[0].highLight(),n&&this.shape.highLight()):(t&&this.lines[0].lowLight(),n&&this.shape.lowLight())}},{key:"highLight",value:function(){this.points.forEach((function(e){e.highLight&&e.highLight()})),this.lines.forEach((function(e){e.highLight&&e.highLight()})),this.shape&&this.shape.highLight&&this.shape.highLight()}},{key:"midLight",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.active&&!e||(this.points.forEach((function(e){e.midLight&&e.midLight()})),this.lines.forEach((function(e){e.midLight&&e.midLight()})),this.shape&&this.shape.midLight&&this.shape.midLight())}},{key:"lowLight",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.active&&!e||(this.points.forEach((function(e){e.lowLight&&e.lowLight()})),this.lines.forEach((function(e){e.lowLight&&e.lowLight()})),this.shape&&this.shape.lowLight&&this.shape.lowLight())}},{key:"computePointsCenter",value:function(){var e=0,t=0,n=0,i=this.points.length;return this.points.forEach((function(i){e+=i.position.x,t+=i.position.y,n+=i.position.z})),e/=i,t/=i,n/=i,new THREE.Vector3(e,t,n)}},{key:"dispose",value:function(){this.group.clear(),this.pointGroup.clear(),this.lineGroup.clear(),this.shapeGroup.clear(),this.points.length=0,this.lines.length=0,this.shape=null,this.shapeIndexes.length=0,this.tempPoint=null,this.tempLine=null}},{key:"toJSON",value:function(){var e=[];return this.points.forEach((function(t){var n={x:t.position.x,y:t.position.y,z:t.position.z};e.push(n)})),{points:e,shapeIndexes:this.shapeIndexes}}}]),e}();function SS(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}new THREE.Vector2;var DS=function(e){f(n,THREE.EventDispatcher);var t=SS(n);function n(e,i,r,a){var s;return o(this,n),(s=t.call(this)).player=e,s.manager=i,s.parentObj=r,s.sid=a.sid,s.name=a.name||"",s.type=a.type||"",s.panoId=a.panoId,s.color=a.color,s.labelPoint=a.labelPoint,s.clickFun=a.clickFun,s.elem=document.createElement("div"),s.elem.className="polygonMark-label",s.elem.style.display="block",s.elem.innerHTML='<p class="name">'.concat(s.name,'</p><div class="line"><div class="point"></div></div><p class="type">').concat(s.type,"</p>"),s.labelPointDomElement=s.elem.querySelector(".point"),s.setColor(s.color),s.mousedownPos=[1/0,1/0],s.elem.style.width="auto",s.elem.style.height="auto",setTimeout((function(){var e=s.elem.offsetWidth,t=s.elem.offsetHeight;s.elem.style.width=e+5+"px",s.elem.style.height=t+"px"}),0),s.elem.addEventListener("pointerdown",s.onPointerDown.bind(h(s))),s.player.domElement.addEventListener("pointermove",s.onPointerMove.bind(h(s))),s.elem.addEventListener("pointerup",s.onPointerUp.bind(h(s))),s.elem.addEventListener("mouseenter",s.onMouseEnter.bind(h(s))),s.elem.addEventListener("mouseleave",s.onMouseLeave.bind(h(s))),s.elem.addEventListener("mousedown",s.onMouseDown.bind(h(s))),s.elem.addEventListener("mouseup",s.onMouseUp.bind(h(s))),s.player.domElement.querySelector(".polygonmark-labels").append(s.elem),s.player.polygonmarkLabels.push(h(s)),s.enable=!0,s.pos2d=new THREE.Vector2,s.pointer=new THREE.Vector4,s.dragging=!1,s.visible=!0,s.isPolygonMarkLabel=!0,s}return u(n,[{key:"setElementWidthAndHeight",value:function(){var e=this;this.elem.style.width="auto",this.elem.style.height="auto",setTimeout((function(){var t=e.elem.offsetWidth,n=e.elem.offsetHeight;e.elem.style.width=t+5+"px",e.elem.style.height=n+"px"}),0)}},{key:"setNameType",value:function(e,t){this.elem.getElementsByClassName("name")[0].innerHTML=this.name=e,this.elem.getElementsByClassName("type")[0].innerHTML=this.type=t,this.setElementWidthAndHeight(),this.update()}},{key:"setColor",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.labelPointDomElement.style.backgroundColor=e,t&&(this.color=e)}},{key:"highLight",value:function(){this.setColor("#00c8af",!1)}},{key:"midLight",value:function(){this.setColor(this.color,!1)}},{key:"update",value:function(){if("panorama"===this.player.mode&&this.manager.labelVisible&&this.manager.labelEnabled&&this.enable&&this.visible&&this.name){var e=pt.getPos2d(this.labelPoint,this.player);if(e.trueSide){this.elem.style.display="";var t=this.elem.offsetWidth,n=this.elem.offsetHeight,i=this.elem.querySelector(".name").offsetHeight,o=this.elem.querySelector(".type").offsetHeight;if((i>30&&t<340||o>30&&t<340||0===t||0===n)&&this.setElementWidthAndHeight(),!this.dragging){var r=this.elem.children[0].offsetHeight+.5;this.pos2d.x=e.pos.x+2.5,this.pos2d.y=e.pos.y-r,this.elem.style.left=this.pos2d.x+"px",this.elem.style.top=this.pos2d.y+"px"}this.manager.isEdit?this.elem.style.cursor="move":this.elem.style.cursor="pointer"}}else this.elem.style.display="none"}},{key:"remove",value:function(){var e=this.elem.parentElement;e&&e.removeChild(this.elem);var t=this.player.polygonmarkLabels.indexOf(this);t>-1&&this.player.polygonmarkLabels.splice(t,1),this.labelPoint=null,this.parentObj=null}},{key:"show",value:function(){this.elem.style.display="block",this.visible=!0}},{key:"hide",value:function(){this.elem.style.display="none",this.visible=!1}},{key:"onPointerDown",value:function(e){e.stopPropagation(),console.log("pointerDown",e.clientX,e.clientY),this.mousedownPos=[e.clientX,e.clientY],this.manager.isEdit&&(this.dragging=!0,this.pointer.x=e.clientX,this.pointer.y=e.clientY,this.pointer.z=this.pos2d.x,this.pointer.w=this.pos2d.y)}},{key:"onPointerMove",value:function(e){if(this.manager.isEdit&&this.dragging){var t=e.clientX-this.pointer.x,n=e.clientY-this.pointer.y;this.pos2d.x=this.pointer.z+t,this.pos2d.y=this.pointer.w+n,this.elem.style.left=this.pos2d.x+"px",this.elem.style.top=this.pos2d.y+"px"}}},{key:"onPointerUp",value:function(e){if(e.stopPropagation(),console.log("pointerUp",e.clientX,e.clientY),!(Math.abs(e.clientX-this.mousedownPos[0])>1||Math.abs(e.clientY-this.mousedownPos[1])>1))if(console.log("pointerUp 1"),this.manager.isEdit){var t=new THREE.Vector2,n=this.elem.children[0].offsetHeight+.5;t.x=this.pos2d.x-2.5,t.y=this.pos2d.y+n,t.x=t.x/this.player.domElement.clientWidth*2-1,t.y=-t.y/this.player.domElement.clientHeight*2+1;var i=this.player.getMouseIntersect(t,[this.manager.intersectBox],{recursive:!1});i&&this.labelPoint.copy(i.point),this.dragging=!1}else this.manager.emit("polygonmarkManager.clickLabel",this.sid),this.manager.setFocusGroup(this.sid,e)}},{key:"onMouseDown",value:function(e){e.stopPropagation()}},{key:"onMouseUp",value:function(e){e.stopPropagation()}},{key:"onMouseEnter",value:function(e){this.manager.isEdit||(this.parentObj.focus||this.parentObj.midLight(),this.manager.focusGroup||(this.manager.emit("polygonmarkManager.enterLabel",this.sid),e.data={sid:this.sid,title:this.name,panoId:this.panoId},this.manager.app.Scene.emit("hotspot.enter",{type:"draw",event:e})))}},{key:"onMouseLeave",value:function(e){this.manager.isEdit||(this.parentObj.focus||this.parentObj.lowLight(),this.manager.focusGroup||(this.manager.emit("polygonmarkManager.leaveLabel",this.sid),e.data={sid:this.sid,title:this.name,panoId:this.panoId},this.manager.app.Scene.emit("hotspot.leave",{type:"draw",event:e})))}}]),n}(),LS=function(){function e(t,n,i){o(this,e),this.player=t,this.manager=n,this.sid=void 0!==i.sid?i.sid:De.getRandomSid(),this.name=void 0!==i.name?i.name:"标题",this.type=void 0!==i.type?i.type:"类型",this.color=void 0!==i.color?i.color:16777215,this.panoId=i.panoId,this.list=[],this.label=null,this.labelPoint=null,this.group=new THREE.Group,this.intersectArr=[],this.active=!1,this.focus=!1,this.lineMat=yi.createFatLineMat({lineWidth:2,color:this.color}),this.lineMat.resolution=new THREE.Vector2(this.manager.app.core.get("SceneRenderer").renderWidth,this.manager.app.core.get("SceneRenderer").renderHeight),this.activeMark=null}return u(e,[{key:"build",value:function(e,t){var n=this,i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];i&&(this.list.length=[],this.group.clear(),this.removeLabel()),e.forEach((function(e){var t=new MS(n.manager,n,{color:n.color,lineMat:n.lineMat}),i=[];e.points.forEach((function(e){var t=new THREE.Vector3(e.x,e.y,e.z);i.push(t)})),t.build(i,e.shapeIndexes),n.list.push(t),n.group.add(t.group)})),t&&this.createLabel(new THREE.Vector3(t.x,t.y,t.z)),this.updateIntersectArr()}},{key:"addChild",value:function(){var e=new MS(this.manager,this,{color:this.color,lineMat:this.lineMat});this.list.push(e),this.group.add(e.group),this.activeMark=e}},{key:"updateIntersectArr",value:function(){var e=this;this.intersectArr.length=0,this.list.forEach((function(t){var n=t.points.concat(t.lines);e.intersectArr=e.intersectArr.concat(n)}))}},{key:"createLabel",value:function(e){e&&(this.labelPoint=new THREE.Vector3,this.labelPoint.copy(e),this.label=new DS(this.player,this.manager,this,{sid:this.sid,labelPoint:this.labelPoint,name:this.name,type:this.type,panoId:this.panoId,color:this.color,floorIndex:0}),this.label.update(),this.updateIntersectArr())}},{key:"removeLabel",value:function(){this.label&&(this.label.remove(),this.label=null),this.labelPoint&&(this.labelPoint=null)}},{key:"setColor",value:function(e){this.color=e,this.lineMat.color.set(e),this.label&&this.label.setColor(e),this.list.forEach((function(t){t.setColor(e)}))}},{key:"setShapeStyle",value:function(e){var t=e.bgColor,n=e.bgOpacity,i=e.flashInterval;if(this.list.forEach((function(e){e.shape.setDisplay(!0,t,n)})),null!=i&&this.flashInterval!=i){var o="polygon_shine_"+this.sid;if(Ae.cancelById(o),i>0){Ae.trigger({func:function(e){if(!this.focus){var t=e<.5?2*e:2-2*e,n=ye.easeOutQuad(t,0,1,1);n=ge.linearClamp(n,[0,1],[.3,.8]),this.list.forEach((function(e){e.shape.material.opacity=n}))}}.bind(this),cycling:!0,duration:2*i,id:o})}this.flashInterval=i}}},{key:"setNameType",value:function(e,t){this.name=e,this.type=t,this.label&&this.label.setNameType(e,t)}},{key:"hide",value:function(){this.group.visible=!1,this.label&&(this.label.visible=!1,this.label.update())}},{key:"show",value:function(){this.group.visible=!0,this.label&&(this.label.visible=!0,this.label.update())}},{key:"deleteMark",value:function(e){if(e||(e=this.activeMark),e){var t=this.list.indexOf(e);t>-1&&this.list.splice(t,1),this.group.remove(e.group),e.active=!1,this.activeMark=null,e.dispose(),this.list.length<=0&&this.removeLabel()}}},{key:"setActive",value:function(e){e?(this.list.forEach((function(t){t.setLight(e)})),this.label&&this.label.highLight()):(this.list.forEach((function(t){t.setLight(e)})),this.label&&this.label.midLight()),this.focus=e}},{key:"highLight",value:function(){this.list.forEach((function(e){e.setLight(!0)})),this.label&&this.label.highLight()}},{key:"midLight",value:function(){this.list.forEach((function(e){e.setLight(!0,!0,!1)})),this.label&&this.label.highLight()}},{key:"lowLight",value:function(){this.list.forEach((function(e){e.lowLight(!0)})),this.label&&this.label.midLight()}},{key:"reload",value:function(e){e?(this.build(e.list,e.labelPoint,!0),this.setNameType(e.name,e.type),this.setColor(e.color)):this.manager.deleteMarkGroup(this.sid)}},{key:"dispose",value:function(){this.list.forEach((function(e){e.dispose()})),this.sid=null,this.panoId=null,this.list.length=0,this.removeLabel(),this.group.clear(),this.intersectArr.length=0,this.lineMat.dispose(),this.activeMark=null}},{key:"toJSON",value:function(){var e=[];this.list.forEach((function(t){e.push(t.toJSON())}));var t=null;return this.labelPoint&&(t={x:this.labelPoint.x,y:this.labelPoint.y,z:this.labelPoint.z}),{sid:this.sid,name:this.name,type:this.type,labelPoint:t,color:this.color,panoId:this.panoId,list:e}}}]),e}();function FS(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}var HS=1,VS=function(e){f(n,THREE.Sprite);var t=FS(n);function n(){var e;o(this,n);var i=new THREE.Texture,r=new THREE.SpriteMaterial({sizeAttenuation:!1,color:51375,map:i});return r.onBeforeCompile=function(e){e.fragmentShader=e.fragmentShader.replace("#include <output_fragment>","\n #ifdef OPAQUE\n diffuseColor.a = 1.0;\n #endif\n #ifdef USE_TRANSMISSION\n diffuseColor.a *= transmissionAlpha + 0.1;\n #endif\n float strength = -step(0.5, distance(vUv, vec2(0.5))) + step(0.4, distance(vUv, vec2(0.5)));\n // float strength = 1.0 - step(0.5, distance(vUv, vec2(0.5)));\n if(strength == 0.0) discard;\n gl_FragColor = vec4(diffuse, 1.0);\n ")},r.depthFunc=THREE.AlwaysDepth,(e=t.call(this,r)).renderOrder=tt,e.setScale(null,!1),e}return u(n,[{key:"setPosition",value:function(e){this.position.copy(e)}},{key:"setScale",value:function(e){var t,n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];e?(t=1/e*.012,n&&(HS=e)):t=1/HS*.012,this.scale.set(4*t,4*t,t)}}]),n}();function OS(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}var QS=function(e){f(n,e);var t=OS(n);function n(e){var i;return o(this,n),(i=t.call(this)).saveEdit=function(){var e=i.activeGroup,t=e.toJSON();return t.name?t.list.length<=0?{code:402}:t.list[t.list.length-1].shapeIndexes.length<=0?{code:403}:(e.lowLight(),i.activeGroup=null,i.leaveEdit(),i.setState(0),{code:400,data:t}):{code:401}},i.cancelEdit=function(){i.leaveEdit(),i.setState(0),i.activeGroup.reload(i.activeGroupHistoryData)},i.Listener={onKeydownFun:i.onKeydown.bind(h(i)),cancelEdit:i.cancelEdit.bind(h(i))},i.bindEvents=function(){var e=i.app.dom.querySelector(".player");e.addEventListener("pointerdown",i.onMouseDown),e.addEventListener("pointerup",i.onMouseUp),e.addEventListener("keydown",i.Listener.onKeydownFun),window.addEventListener("hashchange",i.Listener.cancelEdit),i.on("polygonmarkManager.finish",i.onFinishDraw.bind(h(i))),i.player.on("pointerMove",i.onMouseMove)},i.unBindEvents=function(){var e=i.app.dom.querySelector(".player");e.removeEventListener("pointerdown",i.onMouseDown),e.removeEventListener("pointerup",i.onMouseUp),e.removeEventListener("keydown",i.Listener.onKeydownFun),window.removeEventListener("hashchange",i.Listener.cancelEdit),i.player.off("pointerMove",i.onMouseMove)},i.updateTouchElement=function(){var e=i.player.getMouseIntersect(null,i.activeGroup.intersectArr,{recursive:!0,type:"getAll"});if(e&&(e=e.filter((function(e){return e.object.visible&&(e.object.isPolygonMarkElement||e.object.isPolygonLabelElement)&&e.object.parent}))).length<=0&&(e=null),e){var t=e.filter((function(e){return!0===e.object.isSprite}));if(e=t.length>=1?t[0]:e[0],i.touchElement&&i.touchElement.isPolygonMarkElement&&i.touchElement.parent)i.touchElement.parent.parent.parentObj.lowLight(),i.updateActivePoint(null,null,!1);i.touchElement=e.object,i.touchElement.isPolygonMarkElement&&i.touchElement.parent.parent.parentObj.midLight()}else{if(i.touchElement&&i.touchElement.isPolygonMarkElement&&i.touchElement.parent)i.touchElement.parent.parent.parentObj.lowLight(),i.updateActivePoint(null,null,!1);i.touchElement=null}return e},i.setGroupLight=function(e){if(e){for(var t=0;t<i.list.length;t++)if(e===i.list[t].sid){i.touchGroup=i.list[t],i.touchGroup.label.onMouseEnter();break}}else i.touchGroup&&i.touchGroup.label&&i.touchGroup.label.onMouseLeave(),i.touchGroup=null},i.onMouseDown=function(){switch(i.mousedown.copy(i.player.mouse),i.state){case 0:i.touchElement&&i.touchElement.isSprite&&i.onDragStart(i.touchElement)}},i.onMouseMove=function(){var e=i.player.getMouseIntersect(null,[i.intersectBox],{recursive:!1});if(e&&i.mouse.copy(e.point),i.dragging)i.onDragging(i.mouse);else{var t=null;switch(i.activeGroup&&(t=i.updateTouchElement()),i.state){case 0:i.touchElement?i.touchElement.isSprite?Wr.add("polygonMark_move"):i.touchElement.isPolygonMarkLine&&(Wr.remove("polygonMark_move"),Wr.add("polygonMark_hover")):(Wr.remove("polygonMark_move"),Wr.remove("polygonMark_hover"));break;case 1:if(i.drawing)i.activeGroup.activeMark.draw.update(i.mouse);else if(i.touchElement){var n=i.touchElement.parent.parent.parentObj;i.touchElement.isPolygonMarkPoint?(Wr.remove("polygonMark_addPen"),Wr.add("polygonMark_subPen"),i.updateActivePoint(i.touchElement.position,n,!0)):i.touchElement.isPolygonMarkLine&&(Wr.remove("polygonMark_subPen"),Wr.add("polygonMark_addPen"),i.updateActivePoint(t.point,n,!0))}else Wr.remove("polygonMark_addPen"),Wr.remove("polygonMark_subPen")}}},i.onMouseUp=function(e){switch(i.mouseup.copy(i.player.mouse),i.state){case 0:if(i.dragging)i.onDragEnd();else{if(Math.abs(i.mousedown.x-i.mouseup.x)>0||Math.abs(i.mousedown.y-i.mouseup.y)>0)return;i.touchElement&&i.touchElement.isPolygonMarkLine?(null!==i.activeGroup.activeMark&&(i.activeGroup.activeMark.active=!1,i.activeGroup.activeMark.lowLight(!0)),i.activeGroup.activeMark=i.touchElement.parent.parent.parentObj,i.activeGroup.activeMark.active=!0,i.activeGroup.activeMark.highLight(),i.emit("polygonmarkManager.activeMark")):i.touchElement||(null!==i.activeGroup.activeMark&&(i.activeGroup.activeMark.active=!1,i.activeGroup.activeMark.lowLight(!0)),i.activeGroup.activeMark=null,i.emit("polygonmarkManager.unactiveMark"))}break;case 1:if(i.drawing)if(2===e.button)i.activeGroup.activeMark.draw.add(i.mouse),i.activeGroup.activeMark.draw.finish(!0);else{if(Math.abs(i.mousedown.x-i.mouseup.x)>0||Math.abs(i.mousedown.y-i.mouseup.y)>0)return;i.activeGroup.activeMark.draw.add(i.mouse),i.recoverStack.length=0}else{if(2===e.button)return;if(i.touchElement){if(i.touchElement.isPolygonMarkPoint){var t=i.touchElement.parent.parent.parentObj;t.draw.subtract(i.touchElement),i.updateActivePoint(null,null,!1),t&&t.lowLight()}else if(i.touchElement.isPolygonMarkLine){i.touchElement.parent.parent.parentObj.draw.increase(i.activePoint.position,i.touchElement.startPoint)}}else{if(Math.abs(i.mousedown.x-i.mouseup.x)>0||Math.abs(i.mousedown.y-i.mouseup.y)>0)return;i.activeGroup.addChild(),i.activeGroup.activeMark.draw.add(i.mouse),i.drawing=!0}}}i.onMouseMove()},i.onDblClick=function(){i.drawing&&(console.log("onDblClick"),i.activeGroup.activeMark.draw.finish(!0))},i.onDragStart=function(e){i.player.cameraControls.activeControl.enabled=!1,i.dragging=!0,i.dragElement=e,i.emit("polygonmarkManager.update")},i.onDragging=function(e){i.dragging&&i.dragElement&&i.dragElement.parent.parent.parentObj.edit.update(i.dragElement,e)},i.onDragEnd=function(){i.player.cameraControls.activeControl.pointerDragOn=!1,i.player.cameraControls.activeControl.enabled=!0,i.dragging=!1,i.dragElement=null},i.onZoom=function(e,t){i.isEdit&&i.mainGroup.traverse((function(n){n.isSprite&&n.setScale(e.zoomLevel,t)}))},i.setActiveGroupNameType=function(e,t){i.activeGroup&&i.activeGroup.setNameType(e,t)},i.setActiveGroupColor=function(e){i.activeGroup&&i.activeGroup.setColor(e)},i.setLabelVisible=function(e){i.labelVisible=e},i.setLabelEnabled=function(e){i.labelEnabled=e,i.list.forEach((function(e){e.label&&e.label.update()}))},i.app=e,i.player=null,i.deferred=oe(),i.list=[],i.mainGroup=new THREE.Group,i.reloadData=null,i.labelVisible=!0,i.labelEnabled=!0,i.intersectBox=null,i.mouse=new THREE.Vector3,i.mousedown=new THREE.Vector3,i.mouseup=new THREE.Vector3,i.state=0,i.drawing=!1,i.dragging=!1,i.inited=!1,i.isEdit=!1,i.readyToEdit=!1,i.touchElement=null,i.dragElement=null,i.activeGroup=null,i.touchGroup=null,i.activeGroupHistoryData=null,i.focusGroup=null,i.activePoint=new JM(16777215),i.activePoint.midLight(),i.activePoint.visible=!1,i.mainGroup.add(i.activePoint),i.finishReticule=new VS,i.finishReticule.visible=!1,i.mainGroup.add(i.finishReticule),i.activeMarkStartPoint=new THREE.Vector3,i.recoverStack=[],i.init=function(e){var t=new THREE.CylinderGeometry(5,5,25,3,1),n=new THREE.MeshBasicMaterial({side:1,wireframe:!0});n.depthFunc=THREE.AlwaysDepth,i.intersectBox=new THREE.Mesh(t,n),i.intersectBox.renderOrder=20,i.intersectBox.name="polygonmark_intersect",i.intersectBox.visible=!1,i.mainGroup.add(i.intersectBox),i.mainGroup.layers.set(17);var o=i.player.currentPano;i.intersectBox.position.copy(o.position);var r=document.createElement("div");r.className="polygonmark-labels",i.player.domElement.append(r),e&&(e.data.forEach((function(e){if(i.player.model.panos.index[e.panoId]){var t=new LS(i.player,h(i),{sid:e.sid,name:e.name,type:e.type,color:e.color,panoId:e.panoId});t.build(e.list,e.labelPoint),i.list.push(t),i.mainGroup.add(t.group),e.panoId!==o.id&&t.hide()}})),i.setLabelEnabled(e.labelEnabled)),i.player.model.add(i.mainGroup),i.player.on("flying.ended",i.onFlyEnd.bind(h(i))),i.player.on("flying.started",i.onFlyStart.bind(h(i))),i.player.on("zoom",i.onZoom.bind(h(i))),i.inited=!0,i.player.mode!==xt.PANORAMA&&i.hideAll(),i.deferred.resolve()},i.app.Scene.on("loadeddata",(function(){setTimeout(k(S.mark((function e(){var t,n;return S.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:i.player=i.app.core.get("Player"),t=null,(n=i.app.store.getValue("sceneDraw"))&&(t={data:n,labelEnabled:i.app.store.getValue("metadata").controls.showDrawTitle}),i.init(t),console.log("polygonmanager init finish");case 6:case"end":return e.stop()}}),e)}))),50)})),i.enterEdit=function(){i.waitInit((function(){i.isEdit||(i.player.mode!==xt.PANORAMA&&i.player.insideMode(),i.bindEvents(),i.player.locked=!0,i.isEdit=!0)}),i.enterEdit.bind(h(i)))},i.leaveEdit=function(){i.isEdit&&(i.unBindEvents(),i.player.locked=!1,i.emit("polygonmarkManager.unactiveMark"),i.showAll(!0,!0),i.isEdit=!1)},i.setState=function(e){switch(i.state=e,i.state){case 0:i.drawing&&i.activeGroup.activeMark.deleteAll(),Wr.remove("polygonMark_pen");break;case 1:Wr.add("polygonMark_pen")}},i.addMarkGroup=function(e,t,n){i.waitInit((function(){var o=new LS(i.player,h(i),{name:e,type:t,color:n,panoId:i.player.currentPano.id});i.list.push(o),i.mainGroup.add(o.group),i.setActiveGroup(o.sid,!0),i.setState(1)}),i.addMarkGroup.bind(h(i),e,t,n))},i.deleteMarkGroup=function(e){for(var t=0;t<i.list.length;t++)if(i.list[t].sid===e){var n=i.list.splice(t,1)[0];n.dispose(),i.mainGroup.remove(n);break}},i.deleteMark=function(){i.activeGroup&&i.activeGroup.deleteMark(),i.emit("polygonmarkManager.unactiveMark")},i.setFocusGroup=function(e,t){for(var n,o=0;o<i.list.length;o++)if(i.list[o].sid===e){if(n=i.list[o],i.focusGroup&&i.focusGroup===n)return i.focusGroup.setActive(!1),i.emit("polygonmarkManager.leaveLabel",n.sid),void(i.focusGroup=null);n.setActive(!0),i.focusGroup=n,i.emit("polygonmarkManager.clickLabel",n.sid),t||(t={}),t.data={sid:n.sid,title:n.name,panoId:n.panoId},i.app.Scene.emit("hotspot.click",{type:"draw",event:t})}else i.list[o].setActive(!1);n?n.labelPoint&&i.flyAndLookAt(n.panoId,n.labelPoint,!0):console.error("group not found, sid = "+e)},i.flyAndLookAt=function(e,t,n){i.player.flyToPano({pano:i.app.Scene.panos.index[e],lookAtPoint:t,checkAlone:n,zoomLevel:i.player.zoomLevel})},i.setActiveGroup=function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];i.list.forEach((function(n){if(n.sid===e)if(i.activeGroup=n,console.log("getActiveGroup",e),n.setActive(!1),t)i.activeGroupHistoryData=null,i.enterEdit();else{i.activeGroupHistoryData=n.toJSON();var o=i.player.currentPano.id;i.flyAndLookAt(n.panoId,n.labelPoint,!0),o!==n.panoId?(i.readyToEdit=!0,i.player.once("flying.ended",(function(){n.show(),i.enterEdit(),i.readyToEdit=!1}))):(n.show(),i.enterEdit())}else n.hide()}))},i.clear=function(){i.list.forEach((function(e){e.dispose()})),i.list.length=0,i.activeGroup=null,i.mainGroup.clear()},i.hideAll=function(e){i.mainGroup.visible=!1,i.setLabelVisible(!1),e&&i.list.forEach((function(e){e.hide()})),i.updateLabels()},i.showAll=function(e,t){i.player&&i.player.mode!==xt.PANORAMA||(i.mainGroup.visible=!0,i.setLabelVisible(!0),e&&i.list.forEach((function(e){if(t){var n=i.player.currentPano.id;e.panoId===n?e.show():e.hide()}else e.show()})),i.updateLabels())},i}return u(n,[{key:"onFlyStart",value:function(){this.hideAll()}},{key:"onFlyEnd",value:function(){if(this.player.mode!==xt.PANORAMA)this.onZoom({zoomLevel:1},!1);else{var e=this.player.currentPano;this.intersectBox.position.copy(e.position),this.onZoom({zoomLevel:null},!1),this.isEdit||this.readyToEdit?this.showAll():this.showAll(!0,!0)}}},{key:"onExit",value:function(){this.cancelEdit()}},{key:"onKeydown",value:function(e){if(this.drawing)if(e.ctrlKey&&!e.shiftKey&&"KeyZ"==e.code){var t=this.activeGroup.activeMark.draw.delete();this.drawing&&this.recoverStack.push(t)}else if(e.ctrlKey&&"KeyY"==e.code||e.ctrlKey&&e.shiftKey&&"KeyZ"==e.code){if(this.recoverStack.length<=0)return;var n=this.recoverStack.pop();this.activeGroup.activeMark.draw.recover(n)}else"Escape"==e.code&&(this.activeGroup.activeMark.deleteAll(),this.setState(0),this.emit("polygonmarkManager.setState",0))}},{key:"updateActivePoint",value:function(e,t,n){e&&this.activePoint.setPosition(e),t&&this.activePoint.setColor(t.color),this.activePoint.visible=n}},{key:"updateLabels",value:function(){this.player&&this.player.polygonmarkLabels&&this.player.polygonmarkLabels.forEach((function(e){e.update()}))}},{key:"showFinishManager",value:function(e){this.activeMarkStartPoint.copy(e),this.finishReticule.setPosition(e),this.finishReticule.visible=!0}},{key:"onFinishDraw",value:function(){this.drawing=!1,this.recoverStack.length=0}},{key:"toJSON",value:function(){return this.activeGroup.toJSON()}},{key:"waitInit",value:function(e,t){this.inited?e&&e():this.deferred.then((function(){return t()}))}},{key:"setAttributes",value:function(e,t){var n=t.bgColor,i=t.bgOpacity,o=t.flashInterval,r=this.list.find((function(t){return t.sid==e}));r&&r.setShapeStyle({bgColor:n,bgOpacity:i,flashInterval:o})}},{key:"flyToDraw",value:function(e){this.focusGroup=null,this.setFocusGroup(e)}}]),n}(yo);function _S(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}var zS=function(e){f(n,THREE.Mesh);var t=_S(n);function n(e){var i;o(this,n);var r=new THREE.SphereGeometry(5,60,40);r.scale(-1,1,1),(i=t.call(this,r)).videoElement=i.creatVides(e);var a=i.getMaterial(i.videoElement);return i.material=a,i.renderOrder=et,i}return u(n,[{key:"getMaterial",value:function(e){var t=new THREE.VideoTexture(e);t.minFilter=THREE.LinearFilter;var n=new THREE.MeshBasicMaterial({map:t,opacity:0,transparent:!0});return n.depthFunc=THREE.AlwaysDepth,n}},{key:"creatVides",value:function(e){var t=Hs.getEnvironment(),n=t.os,i=t.environment;return!window.MediaSource||"Android"!=n&&"WeChat"!=i?(new Ss)._createVideoElement(e):(new Is)._createVideo(e).videoElement}}]),n}();function US(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}var NS=function(e){f(n,e);var t=US(n);function n(e){var i;return o(this,n),(i=t.call(this)).bindEvents=function(){i.player.on(aa,i.getPano),i.player.on("updataProgress",i.updateOpacity),i.player.on(ra,i.switchMode),i.player.model._3dTilesRuntime},i.getPano=function(e,t){i.currentPano=e,i.nextPano=t},i.updateOpacity=function(e){i.currentPano&&i.currentPano._360videos&&(i.currentPano._360videos.material.opacity=1-e),i.nextPano&&i.nextPano._360videos&&(i.nextPano._360videos.material.opacity=e),1===e&&(i.nextPano&&i.nextPano._360videos&&i.videoReInit(i.nextPano._360videos.videoElement,!0),i.currentPano&&i.currentPano._360videos&&i.videoReInit(i.currentPano._360videos.videoElement,!1)),0===e&&(i.nextPano&&i.nextPano._360videos&&i.videoReInit(i.nextPano._360videos.videoElement,!1),i.currentPano&&i.currentPano._360videos&&i.videoReInit(i.currentPano._360videos.videoElement,!0))},i.switchMode=function(e,t,n,o){t===xt.PANORAMA?(i.panoVideoGroup.visible=!0,i.player.once("flying.ended",(function(){n&&n._360videos&&(n._360videos.material.opacity=1,i.videoReInit(n._360videos.videoElement,!0))}))):(i.panoVideoGroup.visible=!1,i.panoVideoGroup.children.forEach((function(e){e.material.opacity=0,i.videoReInit(e.videoElement,!1)})))},i.videoReInit=function(e,t){e.muted=!1,t?e.play():e.pause()},i.app=e,i.player=null,i.deferred=oe(),i.panoVideoGroup=new THREE.Group,i.panoVideos=[],i.opacity=0,i.currentPano=null,i.nextPano=null,i.mouse=new THREE.Vector3,i.mousedown=new THREE.Vector3,i.mouseup=new THREE.Vector3,i.init=function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];e&&(console.log("PanoVideoManager init"),console.log(i.app.Scene.panos),i.bindEvents(),i.currentPano=i.player.currentPano,e.forEach((function(e){var t=i.app.Scene.panos.index[e.id];if(t){var n=new zS(e.url);n.position.copy(t.position),i.panoVideoGroup.add(n),t._360videos=n}else console.error("pano360VideoManager: pano"+e.id+" not find")})),i.player.model.add(i.panoVideoGroup),i.updateOpacity(0)),t||i.deferred.resolve()},i.load=function(e,t){i.app.Scene.whenLoaded((function(){var n=Hs.getEnvironment(),o=n.os,r=n.environment,a=null;i.player=i.app.core.get("Player"),a=!window.MediaSource||"Android"!=o&&"WeChat"!=r?".mp4":".flv",e&&(e.forEach((function(e){e.url=t+e.file+a,delete e.file})),i.init(e,!0),console.log("init finish"))}))},i}return u(n,[{key:"waitInit",value:function(e,t){this.player?e&&e():this.deferred.then((function(){return t()}))}}]),n}(yo),GS=function(e){return ri.get("/service/scene/getInfo",e)},jS=Object.freeze({__proto__:null,uploadBodySegment:function(e){return ri.postFile("/service/scene/uploadBodySegment",e)},checkDynamicPanel:function(e){return ri.get("/service/scene/checkDynamicPanel",e)},downLoadZSData:function(e){return ri.postFile("/service/scene/downLoadZSData",e)},getBodySegmentStatus:function(e){return ri.postFile("/service/scene/getBodySegmentStatus",e)},check_key:function(e){return ri.post("/service/scene/check/key",e)},getInfo:GS}),WS=function(e){return ri.post("/service/scene/edit/saveInitialPage",e)},qS=function(e){return ri.post("/service/scene/edit/base/save",e)},JS=function(e){return ri.post("/service/scene/edit/cad/rename",e)},YS=function(e){return ri.post("/service/scene/edit/publicScene",e)},ZS=function(e){return ri.postFile("/service/scene/edit/upload/files",e)},XS=function(e){return ri.get("/service/scene/edit/getInfo",e)},KS=function(e){return ri.post("/service/scene/edit/saveRoam",e)},$S=function(e){return ri.post("/service/scene/edit/cad/save",e)},eD=function(e){return ri.postFile("/service/scene/edit/cad/reset",e)},tD=function(e){return ri.postFile("/service/scene/edit/uploadBallScreenVideo",e)},nD=function(e){return ri.post("/service/scene/edit/downloadBallScreenVideo",e)},iD=Object.freeze({__proto__:null,tour_video_upload:function(e){return ri.postFile("/service/scene/edit/tour/video/upload",e)},tour_video_download:function(e){return ri.postFile("/service/scene/edit/tour/video/download",e)},tour_save:function(e){return ri.post("/service/scene/edit/tour/save",e)},tour_delete:function(e){return ri.post("/service/scene/edit/tour/delete",e)},point_getLatAndLon:function(e){return ri.get("/service/scene/edit/point/getLatAndLon",e)},locales:function(e){return ri.post("/service/scene/edit/locales",e)},upload_content:function(e){return ri.post("/service/scene/edit/upload/content",e)},getAuth:function(e){return ri.postFile("/service/scene/edit/getAuth",e)},getAsynOperLog:function(e){return ri.post("/service/scene/edit/getAsynOperLog",e)},getServiceUpTip:function(e){return ri.get("/service/scene/edit/getServiceUpTip",e)},saveInitialPage:WS,dynamicPanel_update:function(e){return ri.post("/service/scene/edit/dynamicPanel/update",e)},dynamicPanel_list:function(e){return ri.get("/service/scene/edit/dynamicPanel/list",e)},uploadShareLogo:function(e){return ri.postFile("/service/scene/edit/uploadShareLogo",e)},waterMark_add:function(e){return ri.post("/service/scene/edit/waterMark/add",e)},waterMark_delete:function(e){return ri.post("/service/scene/edit/waterMark/delete",e)},linkPan_upload:function(e){return ri.postFile("/service/scene/edit/linkPan/upload",e)},linkPan_save:function(e){return ri.post("/service/scene/edit/linkPan/save",e)},linkPan_delete:function(e){return ri.post("/service/scene/edit/linkPan/delete",e)},styles_delete:function(e){return ri.post("/service/scene/edit/styles/delete",e)},linkPan_list:function(e){return ri.postFile("/service/scene/edit/linkPan/list",e)},base_save:qS,cad_dxf_upload:function(e){return ri.postFile("/service/scene/edit/cad/dxf/upload",e)},cad_dxf_download:function(e){return ri.get("/service/scene/edit/cad/dxf/download",e)},cad_rename:JS,cutModel_save:function(e){return ri.post("/service/scene/edit/cutModel/save",e)},cutModel_list:function(e){return ri.post("/service/scene/edit/cutModel/list",e)},cutModel_delete:function(e){return ri.post("/service/scene/edit/cutModel/delete",e)},icons_delete:function(e){return ri.post("/service/scene/edit/icons/delete",e)},tag_img_delete:function(e){return ri.post("/service/scene/edit/tag/img/delete",e)},tag_img_upload:function(e){return ri.postFile("/service/scene/edit/tag/img/upload",e)},filter_save:function(e){return ri.post("/service/scene/edit/filter/save",e)},uploadROIFilter:function(e){return ri.post("/service/scene/edit/uploadROIFilter",e)},filter_list:function(e){return ri.post("/service/scene/edit/filter/list",e)},billboards_save:function(e){return ri.post("/service/scene/edit/billboards/save",e)},billboards_list:function(e){return ri.post("/service/scene/edit/billboards/list",e)},billboards_delete:function(e){return ri.post("/service/scene/edit/billboards/delete",e)},billboards_styles_delete:function(e){return ri.post("/service/scene/edit/billboards/styles/delete",e)},surveillance_save:function(e){return ri.post("/service/scene/edit/surveillance/save",e)},surveillance_delete:function(e){return ri.post("/service/scene/edit/surveillance/delete",e)},surveillance_list:function(e){return ri.post("/service/scene/edit/surveillance/list",e)},sceneDraw_save:function(e){return ri.post("/service/scene/edit/sceneDraw/save",e)},sceneDraw_delete:function(e){return ri.post("/service/scene/edit/sceneDraw/delete",e)},sceneDraw_list:function(e){return ri.get("/service/scene/edit/sceneDraw/list",e)},model_box_upload:function(e){return ri.postFile("/service/scene/edit/model/box/upload",e)},model_box_save:function(e){return ri.post("/service/scene/edit/model/box/save",e)},photo_box_save:function(e){return ri.post("/service/scene/edit/photo/box/save",e)},model_box_delete:function(e){return ri.post("/service/scene/edit/model/box/delete",e)},photo_box_delete:function(e){return ri.post("/service/scene/edit/photo/box/delete",e)},mosaics_delete:function(e){return ri.post("/service/scene/edit/mosaics/delete",e)},mosaics_add:function(e){return ri.post("/service/scene/edit/mosaics/add",e)},mosaics_list:function(e){return ri.post("/service/scene/edit/mosaics/list",e)},publicScene:YS,upload_files:ZS,delete_file:function(e){return ri.post("/service/scene/edit/delete/file",e)},saveUpload:function(e){return ri.post("/service/scene/edit/saveUpload",e)},getInfo:XS,saveRoam:KS,saveTagsVisible:function(e){return ri.post("/service/scene/edit/saveTagsVisible",e)},cad_save:$S,tag_save:function(e){return ri.post("/service/scene/edit/tag/save",e)},tag_delete:function(e){return ri.post("/service/scene/edit/tag/delete",e)},uploadPanorama:function(e){return ri.postFile("/service/scene/edit/uploadPanorama",e)},uploadModel:function(e){return ri.postFile("/service/scene/edit/uploadModel",e)},downloadModel:function(e){return ri.postFile("/service/scene/edit/downloadModel",e)},tag_list:function(e){return ri.postFile("/service/scene/edit/tag/list",e)},cad_reset:eD,downloadPanorama:function(e){return ri.post("/service/scene/edit/downloadPanorama",e)},video_box_save:function(e){return ri.post("/service/scene/edit/video/box/save",e)},video_box_delete:function(e){return ri.post("/service/scene/edit/video/box/delete",e)},uploadBallScreenVideo:tD,downloadBallScreenVideo:nD,sceneSync:function(e){return ri.postFile("/service/scene/edit/sceneSync",e)}});function oD(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function rD(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?oD(Object(n),!0).forEach((function(t){xh(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):oD(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var aD=function(e){return{info:function(){return GS(e)}}},sD=function(e){return{uploads:function(t){return ZS(rD(rD({},e),t))},publish:function(){return YS(e)},info:function(){return XS(e)},save:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return qS(rD(rD({},e),t))},get_pano_video:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return nD(rD(rD({},e),t))},upload_pano_video:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return tD(rD(rD({},e),t))},cad_save:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return $S(rD(rD({},e),t))},cad_reset:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return eD(rD(rD({},e),t))},cad_rename:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return JS(rD(rD({},e),t))},walk_save:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return KS(rD(rD({},e),t))},setting_save_initial:(t=k(S.mark((function t(){var n,i,o=arguments;return S.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(n=o.length>0&&void 0!==o[0]?o[0]:{},i=null,n.files&&n.files.length&&n.entry){t.next=4;break}return t.abrupt("return",Promise.resolve({code:0,success:!0}));case 4:if(!n.files||!n.files.length){t.next=10;break}return t.next=7,this.uploads({bizType:"settings-thumb",files:n.files});case 7:if((i=t.sent).success){t.next=10;break}return t.abrupt("return",Promise.reject(i));case 10:return t.next=12,WS(rD(rD({},e),{},{data:JSON.stringify(n.entry),fileName:"thumb-1k.jpg"}));case 12:if((i=t.sent).success){t.next=15;break}return t.abrupt("return",Promise.reject(i));case 15:return t.abrupt("return",Promise.resolve(i));case 16:case"end":return t.stop()}}),t,this)}))),function(){return t.apply(this,arguments)})};var t};U('@-webkit-keyframes ruler-point {\n 0% {\n height: 0\n }\n\n to {\n height: 11.375px\n }\n}\n\n@keyframes ruler-point {\n 0% {\n height: 0\n }\n\n to {\n height: 11.375px\n }\n}\n\n@-webkit-keyframes ruler-label {\n 0% {\n max-width: 0\n }\n\n to {\n max-width: 131.25px\n }\n}\n\n@keyframes ruler-label {\n 0% {\n max-width: 0\n }\n\n to {\n max-width: 131.25px\n }\n}\n\n@-webkit-keyframes door-label {\n 0% {\n opacity: 0;\n margin-top: 8.75px\n }\n\n to {\n opacity: 1;\n margin-top: 0\n }\n}\n\n@keyframes door-label {\n 0% {\n opacity: 0;\n margin-top: 8.75px\n }\n\n to {\n opacity: 1;\n margin-top: 0\n }\n}\n\n@-webkit-keyframes room-label {\n 0% {\n opacity: 0;\n margin-top: 8.75px\n }\n\n to {\n opacity: 1;\n margin-top: 0\n }\n}\n\n@keyframes room-label {\n 0% {\n opacity: 0;\n margin-top: 8.75px\n }\n\n to {\n opacity: 1;\n margin-top: 0\n }\n}\n\n@-webkit-keyframes ruler-line {\n 0% {\n width: 0\n }\n\n to {\n width: 100%\n }\n}\n\n@keyframes ruler-line {\n 0% {\n width: 0\n }\n\n to {\n width: 100%\n }\n}\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n.widgets-design-option {\n width: 100%;\n height: 100%;\n z-index: 4;\n position: absolute;\n user-select: none;\n overflow: hidden;\n pointer-events: none;\n left: 0;\n top: 0;\n }\n .widgets-design-option i {\n margin: 0 5px;\n }\n .widgets-design-option i:before {\n font-family: "iconfont" !important;\n font-size: 32px;\n line-height: 36px;\n font-style: normal;\n }\n .widgets-design-option li {\n cursor: pointer;\n }\n .widgets-design-option > div {\n height: 36px;\n background: #262729;\n position: absolute;\n transform: translate(-100%, -50%) translateX(-15px);\n border-top-left-radius: 18px;\n border-bottom-left-radius: 18px;\n padding-left: 10px;\n pointer-events: auto;\n box-shadow: 0px 2px 8px 0px rgba(0, 0, 0, 0.4);\n }\n .widgets-design-option > div:after {\n position: absolute;\n right: -15px;\n top: 0;\n content: "";\n width: 0;\n height: 0;\n border-style: solid;\n border-width: 18px 0 18px 15px;\n border-color: transparent transparent transparent #262729;\n }\n .widgets-design-option.right > div {\n transform: translate(15px, -50%);\n border-top-left-radius: 0;\n border-bottom-left-radius: 0;\n border-top-right-radius: 18px;\n border-bottom-right-radius: 18px;\n padding: 0 10px 0 0;\n }\n .widgets-design-option.right > div:after {\n right: auto;\n left: -15px;\n border-width: 18px 15px 18px 0;\n border-color: transparent #262729 transparent transparent;\n }\n .widgets-design-option .delete-ruler li {\n line-height: 36px;\n padding: 0 10px;\n word-break: keep-all;\n list-style: none;\n }\n \n .widgets-rulers {\n position: absolute;\n pointer-events: none;\n top: 0;\n left: 0;\n bottom: 0;\n right: 0;\n}\n\n.widgets-rulers .ruler-line {\n position: absolute;\n -webkit-transform-origin: left 0.875px;\n transform-origin: left 0.875px;\n width: 0;\n height: 1.75px;\n}\n\n.widgets-rulers .ruler-line em {\n background: linear-gradient(90deg, hsla(0, 0%, 100%, 0.5), hsla(0, 0%, 100%, 0.3));\n display: block;\n height: 100%;\n -webkit-animation: ruler-line 0.5s ease 1s;\n animation: ruler-line 0.5s ease 1s;\n -webkit-animation-fill-mode: both;\n animation-fill-mode: both;\n -webkit-box-shadow: 0 0 3.5px rgba(0, 0, 0, 0.6);\n box-shadow: 0 0 3.5px rgba(0, 0, 0, 0.6);\n}\n\n.widgets-rulers .ruler-label {\n position: absolute;\n /* width: 0; */\n height: 0;\n top: 0.875px;\n left: 38%;\n color: #fff;\n}\n\n.widgets-rulers .ruler-label .ruler-label-point {\n position: absolute;\n width: 28px;\n height: 11.375px;\n right: 0;\n bottom: 0;\n background-position: bottom;\n background-repeat: no-repeat;\n background-image: url("data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHN2ZyB3aWR0aD0iMzRweCIgaGVpZ2h0PSIxNXB4IiB2aWV3Qm94PSIwIDAgMzQgMTUiIHZlcnNpb249IjEuMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayI+CiAgICA8IS0tIEdlbmVyYXRvcjogU2tldGNoIDQ4LjIgKDQ3MzI3KSAtIGh0dHA6Ly93d3cuYm9oZW1pYW5jb2RpbmcuY29tL3NrZXRjaCAtLT4KICAgIDx0aXRsZT5Hcm91cCA3PC90aXRsZT4KICAgIDxkZXNjPkNyZWF0ZWQgd2l0aCBTa2V0Y2guPC9kZXNjPgogICAgPGRlZnM+CiAgICAgICAgPGNpcmNsZSBpZD0icGF0aC0xIiBjeD0iMS41IiBjeT0iMS41IiByPSIxLjUiPjwvY2lyY2xlPgogICAgICAgIDxmaWx0ZXIgeD0iLTEwMC4wJSIgeT0iLTEwMC4wJSIgd2lkdGg9IjMwMC4wJSIgaGVpZ2h0PSIzMDAuMCUiIGZpbHRlclVuaXRzPSJvYmplY3RCb3VuZGluZ0JveCIgaWQ9ImZpbHRlci0yIj4KICAgICAgICAgICAgPGZlT2Zmc2V0IGR4PSIwIiBkeT0iMCIgaW49IlNvdXJjZUFscGhhIiByZXN1bHQ9InNoYWRvd09mZnNldE91dGVyMSI+PC9mZU9mZnNldD4KICAgICAgICAgICAgPGZlR2F1c3NpYW5CbHVyIHN0ZERldmlhdGlvbj0iMSIgaW49InNoYWRvd09mZnNldE91dGVyMSIgcmVzdWx0PSJzaGFkb3dCbHVyT3V0ZXIxIj48L2ZlR2F1c3NpYW5CbHVyPgogICAgICAgICAgICA8ZmVDb2xvck1hdHJpeCB2YWx1ZXM9IjAgMCAwIDAgMCAgIDAgMCAwIDAgMCAgIDAgMCAwIDAgMCAgMCAwIDAgMC4yOTkzNjU5NDIgMCIgdHlwZT0ibWF0cml4IiBpbj0ic2hhZG93Qmx1ck91dGVyMSI+PC9mZUNvbG9yTWF0cml4PgogICAgICAgIDwvZmlsdGVyPgogICAgPC9kZWZzPgogICAgPGcgaWQ9IuWbuuWumueKtuaAgS3liqDovb0iIHN0cm9rZT0ibm9uZSIgc3Ryb2tlLXdpZHRoPSIxIiBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC00MjcuMDAwMDAwLCAtMjY3LjAwMDAwMCkiPgogICAgICAgIDxnIGlkPSJHcm91cC03IiB0cmFuc2Zvcm09InRyYW5zbGF0ZSg0MjkuMDAwMDAwLCAyNjkuMDAwMDAwKSI+CiAgICAgICAgICAgIDxwYXRoIGQ9Ik0zMS41LDEyLjUgTDIxLjUsMS41IiBpZD0iTGluZS1Db3B5LTExIiBzdHJva2U9IiNGRkZGRkYiIHN0cm9rZS13aWR0aD0iMC41IiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiPjwvcGF0aD4KICAgICAgICAgICAgPHBhdGggZD0iTTIxLjUsMS41IEwyLjUsMS41IiBpZD0iTGluZS1Db3B5LTEyIiBzdHJva2U9IiNGRkZGRkYiIHN0cm9rZS13aWR0aD0iMC41IiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiPjwvcGF0aD4KICAgICAgICAgICAgPGcgaWQ9Ik92YWwtNi1Db3B5LTYiPgogICAgICAgICAgICAgICAgPHVzZSBmaWxsPSJibGFjayIgZmlsbC1vcGFjaXR5PSIxIiBmaWx0ZXI9InVybCgjZmlsdGVyLTIpIiB4bGluazpocmVmPSIjcGF0aC0xIj48L3VzZT4KICAgICAgICAgICAgICAgIDx1c2UgZmlsbD0iI0ZGRkZGRiIgZmlsbC1ydWxlPSJldmVub2RkIiB4bGluazpocmVmPSIjcGF0aC0xIj48L3VzZT4KICAgICAgICAgICAgPC9nPgogICAgICAgIDwvZz4KICAgIDwvZz4KPC9zdmc+");\n background-size: 28px 11.375px;\n -webkit-transform: translateZ(0);\n transform: translateZ(0);\n transform-origin: right center;\n -webkit-animation: ruler-point 0.3s ease 1.3s;\n animation: ruler-point 0.3s ease 1.3s;\n -webkit-animation-fill-mode: both;\n animation-fill-mode: both;\n}\n\n.widgets-rulers .ruler-label .ruler-label-name {\n position: absolute;\n height: 15.75px;\n font-size: 12px;\n line-height: 15.75px;\n right: 28px;\n bottom: 0.875px;\n white-space: nowrap;\n /* max-width: 0; */\n overflow: hidden;\n -webkit-animation: ruler-label 1s ease 1.6s;\n animation: ruler-label 1s ease 1.6s;\n -webkit-animation-fill-mode: both;\n animation-fill-mode: both;\n text-shadow: 0 0 3.5px rgba(0, 0, 0, 0.6);\n}\n\n.widgets-rulers .ruler-label.reverse .ruler-label-point {\n -webkit-transform: rotateY(180deg);\n transform: rotateY(180deg);\n}\n\n.widgets-rulers .ruler-label.reverse .ruler-label-name {\n /* -webkit-transform: rotateY(-180deg); */\n /* transform: rotateY(-180deg); */\n right: auto;\n left: 28px;\n}\n\n.widgets-rulers .measure .ruler-label .ruler-label-name {\n color: #f0ff00;\n}\n\n.widgets-rulers .ruler-intersection {\n position: absolute;\n width: 0;\n height: 0;\n}\n\n.widgets-rulers .ruler-intersection .ruler-intersection-point {\n position: absolute;\n left: 0;\n bottom: 0;\n width: 18.375px;\n height: 7px;\n background-repeat: no-repeat;\n background-size: 18.375px 7px;\n background-position: 50%;\n}\n\n.widgets-rulers .ruler-intersection .ruler-intersection-text {\n position: absolute;\n left: 18.375px;\n bottom: 0;\n font-size: 12px;\n line-height: 12px;\n white-space: nowrap;\n color: #12fffb;\n text-shadow: 0 0 3.5px rgba(0, 0, 0, 0.3);\n -webkit-transform-origin: left center;\n transform-origin: left center;\n -webkit-transform: scale(0.85);\n transform: scale(0.85);\n}\n\n.measure .ruler-label .ruler-label-name {\n font-size: 14px;\n line-height: 14px;\n}\n\n.measure .ruler-label {\n position: absolute;\n}\n\n.measure .ruler-label .ruler-label-point {\n background-image: url("data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4KPCEtLSBHZW5lcmF0b3I6IEFkb2JlIElsbHVzdHJhdG9yIDIxLjAuMCwgU1ZHIEV4cG9ydCBQbHVnLUluIC4gU1ZHIFZlcnNpb246IDYuMDAgQnVpbGQgMCkgIC0tPgo8c3ZnIHZlcnNpb249IjEuMSIgaWQ9IuWbvuWxgl8xIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB4PSIwcHgiIHk9IjBweCIKCSB2aWV3Qm94PSIwIDAgMzQgMTUiIHN0eWxlPSJlbmFibGUtYmFja2dyb3VuZDpuZXcgMCAwIDM0IDE1OyIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+CjxzdHlsZSB0eXBlPSJ0ZXh0L2NzcyI+Cgkuc3Qwe2ZpbGw6bm9uZTtzdHJva2U6I0YwRkYwMDtzdHJva2Utd2lkdGg6MC41O3N0cm9rZS1saW5lY2FwOnJvdW5kO3N0cm9rZS1saW5lam9pbjpyb3VuZDt9Cgkuc3Qxe2ZpbHRlcjp1cmwoI2ZpbHRlci0yKTt9Cgkuc3Qye2ZpbGw6I0YwRkYwMDt9Cjwvc3R5bGU+CjxmaWx0ZXIgIGZpbHRlclVuaXRzPSJvYmplY3RCb3VuZGluZ0JveCIgaGVpZ2h0PSIzMDAuMCUiIGlkPSJmaWx0ZXItMiIgd2lkdGg9IjMwMC4wJSIgeD0iLTEwMC4wJSIgeT0iLTEwMC4wJSI+Cgk8ZmVPZmZzZXQgIGR4PSIwIiBkeT0iMCIgaW49IlNvdXJjZUFscGhhIiByZXN1bHQ9InNoYWRvd09mZnNldE91dGVyMSI+PC9mZU9mZnNldD4KCTxmZUdhdXNzaWFuQmx1ciAgaW49InNoYWRvd09mZnNldE91dGVyMSIgcmVzdWx0PSJzaGFkb3dCbHVyT3V0ZXIxIiBzdGREZXZpYXRpb249IjEiPjwvZmVHYXVzc2lhbkJsdXI+Cgk8ZmVDb2xvck1hdHJpeCAgaW49InNoYWRvd0JsdXJPdXRlcjEiIHR5cGU9Im1hdHJpeCIgdmFsdWVzPSIwIDAgMCAwIDAgICAwIDAgMCAwIDAgICAwIDAgMCAwIDAgIDAgMCAwIDAuMjk5MzY1OTQyIDAiPgoJCTwvZmVDb2xvck1hdHJpeD4KPC9maWx0ZXI+Cjx0aXRsZT5Hcm91cCA3PC90aXRsZT4KPGRlc2M+Q3JlYXRlZCB3aXRoIFNrZXRjaC48L2Rlc2M+CjxwYXRoIGlkPSJMaW5lLUNvcHktMTEiIGNsYXNzPSJzdDAiIGQ9Ik0zMy41LDE0LjVsLTEwLTExIi8+CjxwYXRoIGlkPSJMaW5lLUNvcHktMTIiIGNsYXNzPSJzdDAiIGQ9Ik0yMy41LDMuNWgtMTkiLz4KPGcgaWQ9Ik92YWwtNi1Db3B5LTYiPgoJPGcgY2xhc3M9InN0MSI+CgkJPGNpcmNsZSBpZD0icGF0aC0xXzJfIiBjbGFzcz0ic3QyIiBjeD0iMy41IiBjeT0iMy41IiByPSIxLjUiLz4KCTwvZz4KCTxnPgoJCTxjaXJjbGUgaWQ9InBhdGgtMV8xXyIgY2xhc3M9InN0MiIgY3g9IjMuNSIgY3k9IjMuNSIgcj0iMS41Ii8+Cgk8L2c+CjwvZz4KPC9zdmc+Cg==");\n animation-delay: 0.3s;\n}\n\n.measure .ruler-label .ruler-label-name {\n animation-delay: 0.6s;\n}\n',{});var lD="#f0ff00",cD=new THREE.Mesh(new THREE.SphereBufferGeometry(.01,10,10),new THREE.MeshBasicMaterial({color:lD,depthTest:!1,transparent:!0})),uD=yi.createFatLineMat({linewidth:3,color:lD});function hD(e,t){var n=this;this.player=t,this.setPoints(e.points),this.state=e.state||"active",this.visiblePanos=e.visiblePanos,this.initVisiblePanos(),this.elem=document.createElement("div"),this.elem.className="ruler measure",this.elem.setAttribute("data-name",""),this.elem.style.display="none",document.querySelector(".widgets-rulers").append(this.elem),this.text=e.text||"",this.length=Math.round(100*this.points[0].distanceTo(this.points[1]))/100,this.text=W.i18n("common.about")+this.length+W.i18n("common.meter"),this.elem.innerHTML='\n\t\t<div class="ruler-label">\n\t\t\t<div class="ruler-label-point"></div>\n\t\t\t<span class="ruler-label-name">'.concat(this.text,"</span>\n\t\t</div>\n\t"),this.player.measureRulers.push(this);var i,o=new THREE.Object3D;o.name="measure",this.balls=[cD.clone(),cD.clone()],this.balls[0].position.copy(this.points[0]),this.balls[1].position.copy(this.points[1]),this.balls[0].renderOrder=this.balls[1].renderOrder=$e,o.add(this.balls[0]),o.add(this.balls[1]),this.line=yi.createFatLine([this.points[0],this.points[1]],{material:uD}),this.line.renderOrder=$e,o.add(this.line),this.boldLine=yi.createBoldLine(this.points,{mat:new THREE.MeshBasicMaterial({wireframe:!0,opacity:0,transparent:!0,depthTest:!1,color:"#991111"}),type:"init"},this.player),this.boldLine.parentRuler=this,o.add(this.boldLine),this.player.model.add(o),this.group=o,this.player.$app.config.vrFishTemp&&(this.getPosAtSphere(this.player.currentPano.position),this.updateBoldLine()),this.events={updatePano:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};n.updateVisible(e.targetPano),"active"==n.state&&n.updateBoldLine()},updateVR:function(e){var t=at.vrEnabled&&at.vrSplitScreen;t!=i&&(t?(n.state="vrSplitScreen",n.update()):n.events.updatePano(),i=t)}},this.player.on("flying.ended",this.events.updatePano),this.player.on("vrStateChanged",this.events.updateVR)}hD.prototype.setPoints=function(e){this.points=e},hD.prototype.initVisiblePanos=function(){var e=this,t=this.player.model.wallManager.roomInfo;if(t)if(2==this.player.model.wallManager.version)for(var n=this.points[0].clone().setY(0),i=this.points[1].clone().setY(0),o=new THREE.Raycaster(n.clone(),i.clone().sub(n).normalize(),0,n.distanceTo(i)).intersectObjects(this.player.model.chunks),r=0;r<o.length;r++){var a=o[r].point.clone(),s=pt.getVisiblePano(a,this.player.model);this.visiblePanos=this.visiblePanos.concat(s.filter((function(t){return-1==e.visiblePanos.indexOf(t)})))}else for(var l=[new THREE.Vector2(this.points[0].x,this.points[0].z),new THREE.Vector2(this.points[1].x,this.points[1].z)],c=0;c<t.length;c++)for(var u=0,h=t[c].points.length;u<h;u++){var d=[{x:t[c].points[u].x,y:t[c].points[u].y},{x:t[c].points[(u+1)%h].x,y:t[c].points[(u+1)%h].y}];if(ge.isLineIntersect(l,d)){t[c].panos.forEach((function(t){-1==e.visiblePanos.indexOf(t)&&e.visiblePanos.push(t)})),console.log("加入房间 "+c);break}}},hD.prototype.remove=function(){var e=this.player.measureRulers.indexOf(this);this.player.measureRulers.splice(e,1),this.group.parent.remove(this.group),this.elem.remove(),this.player.off("flying.ended",this.events.updatePano),this.player.off("vrStateChanged",this.events.updateVR)},hD.prototype.updateBoldLine=function(){this.player.$app.config.vrFishTemp?yi.updateBoldLine(this.boldLine,this.fishPoints,"moveAndRotate"):yi.updateBoldLine(this.boldLine,this.points,"update")},hD.prototype.showOptionLabel=function(e,t){if(e){this.player.chosenMeasureRuler=this;t=ge.getFootPoint(t,this.points[0],this.points[1]);this.optionLabelPos=t,document.querySelector(".widgets-design-option").style.display="",this.updateOptionPos()}else this.player.chosenMeasureRuler=null,document.querySelector(".widgets-design-option").style.display="none",this.optionLabelPos=null},hD.prototype.updateOptionPos=function(){if(this.optionLabelPos){var e=pt.getPos2d(this.optionLabelPos,this.player,this.player.camera),t=document.querySelector(".widgets-design-option"),n=document.querySelector(".widgets-design-option div");e.trueSide?(n.className.replace("hide",""),n.style.left=e.pos.x+"px",n.style.top=e.pos.y+"px",e.vector.x>0?t.className.replace("right",""):t.className.indexOf("right")<0&&(t.className+=" right")):n.className.indexOf("hide")<0&&(n.className+=" hide")}},hD.prototype.getCrossPoint=function(e,t){var n,i,o,r=this.player.domElement.clientWidth,a=this.player.domElement.clientHeight,s=(t.x-e.x)/(t.y-e.y),l=function(t){return s*(t-e.y)+e.x},c=function(t){return 1/s*(t-e.x)+e.y};return t.x>r||t.x<0?(o=t.x>r?r:0,t.y<0||t.y>a?((n=l(i=t.y<0?0:a))>r||n<0)&&(i=c(n=o)):i=c(n=o)):n=l(i=t.y<0?0:a),new THREE.Vector2(n,i)},hD.prototype.getPosInCrossPoint=function(e,t){var n=this.player.domElement.clientWidth,i=this.player.domElement.clientHeight;return ge.getCrossPointAtRect(e,t,n,i,0,0)},hD.prototype.getPosAtSphere=function(e,t){this.fishPoints=[];var n=[];this.points.forEach(function(t,i){var o=pt.getPosAtSphere(t.clone(),e);this.fishPoints.push(o),n.push(o.x,o.y,o.z),this.balls[i].position.copy(o);var r=Constants.skyRadius/e.distanceTo(t);this.balls[i].scale.set(r,r,r)}.bind(this)),yi.moveFatLine(this.line,n)};function dD(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}hD.prototype.getPosInScreen=function(e,t,n){var i=e.point.clone().add(t.point).multiplyScalar(.5),o=pt.getPos2d(i,this.player);if(o.trueSide){var r=e.pos2d.trueSide?e.pos2d:t.pos2d;return o.inSight&&(o.pos=this.getPosInCrossPoint(r.pos,o.pos),o.vector=null),{result:"p1p2",p1:r,p2:o}}if(!(n+1>1)){var a=e.pos2d.trueSide?e:t;return this.getPosInScreen(a,{point:i,pos2d:o},++n)}},hD.prototype.updateVisible=function(e){this.visiblePanos.indexOf(e||this.player.currentPano)>-1?this.state="active":this.state="unable"},hD.prototype.update=function(){if("floorplan"==this.player.mode||"active"!=this.state)return this.elem.style.display="none",void(this.group.visible=!1);var e,t,n=pt.getPos2d(this.points[0],this.player),i=pt.getPos2d(this.points[1],this.player),o=this.player.domElement.clientWidth,r=this.player.domElement.clientHeight;if(!n.trueSide||!i.trueSide){if(!n.trueSide&&!i.trueSide)return void(this.elem.style.display="none");var a=this.getPosInScreen({point:this.points[0],pos2d:n},{point:this.points[1],pos2d:i},0);if(!a)return void(this.elem.style.display="none");n=a.p1,i=a.p2}var s=n.pos,l=i.pos;if(0!=s.distanceTo(l)){if(n.inSight&&i.inSight)e=(s.x+l.x)/2,t=(s.y+l.y)/2;else{var c,u;c=n.inSight?s.clone():this.getCrossPoint(l,s),u=i.inSight?l.clone():this.getCrossPoint(s,l);var h,d=c.clone().add(u).multiplyScalar(.5);if(e=d.x,t=d.y,d.x>o||d.x<0||d.y>r||d.y<0)return this.elem.style.display="none",void(this.group.visible=!1);if(l.x==s.x){if(l.y==s.y)return void console.warn("pos1和2一样???");h=l.y<s.y?(t-l.y)/(s.y-l.y):(l.y-t)/(l.y-s.y)}else h=l.x<s.x?(e-l.x)/(s.x-l.x):(l.x-e)/(l.x-s.x);if(h<0||h>1)return void(this.elem.style.display="none")}this.elem.style.display="",this.group.visible=!0;var p=this.elem.querySelector(".ruler-label");"left"!=this.dir&&e<o/2||"right"==this.dir?p.className.indexOf("reverse")<0&&(p.className+=" reverse"):p.className.indexOf("reverse")>=0&&(p.className=p.className.replace("reverse","")),p.style.left=e+"px",p.style.top=t+"px"}else console.warn("ruler间距为0!")};var pD=function(e,t){if(!e)return 0;var n="";return document.defaultView&&document.defaultView.getComputedStyle?n=document.defaultView.getComputedStyle(e,"").getPropertyValue(t):e.currentStyle&&(t=t.replace(/\-(\w)/g,(function(e,t){return t.toUpperCase()})),n=e.currentStyle[t]),n||0},fD=function(e){f(n,e);var t=dD(n);function n(e){var i;o(this,n),(i=t.call(this)).focusBeforeModify=function(e){var t=i.app.core.get("Player");i.editTag=i.tags.find((function(t){return t.sid==e})),i.tempTag={position:new THREE.Vector3(i.editTag.position.x,i.editTag.position.y,i.editTag.position.z)};var n=i.findBestPanoForWatching(i.editTag);t.flyToPano({pano:n,lookAtPoint:i.editTag.position,aimDuration:0,duration:1,checkAlone:!0},(function(){i.edit.enter(i.editTag,(function(){i.editHandle.markTagPos=i.editTag.position,i.editHandle.markSpotA.elem.style.display="block",i.editHandle.markSpotB.elem.style.display="block"}))}))},i.focus=function(e,t,n){var o=i.app.core.get("Player"),r=new THREE.Vector3,a=i.tags.find((function(t){return t.sid==e.sid}))||e.tag,s=i.findBestPanoForWatching(a),l=function(){o.mode===xt.PANORAMA&&i.app.Camera.emit(ea,{panoId:o.currentPano?o.currentPano.id:null,quaternion:o.cameraControls.activeControl.camera.quaternion,mode:xt.PANORAMA,type:"flyToPano"})},c=function(){a.x=i.convertPositionTo2D(a.position).pos.x,a.y=i.convertPositionTo2D(a.position).pos.y,r.set(0,0,0);var t=a.x-("left"==n?e.arrowBox.width+e.tagBox.width/2:0),s=a.y-("top"==n?e.arrowBox.height+e.tagBox.height/2:0);ge.convertScreenPositionToNDC(t,s,r,i.app.dom),r.unproject(o.camera)};if("board"==t){if(!i.app.config.mobile){var u=document.querySelector('[tag-sid="'.concat(a.sid,'"]'));if(u){var h=u.querySelector(".move-layer");h&&(h.style.transform="translateY(0)",setTimeout((function(){var e=h.getBoundingClientRect(),t=e.top+e.height;t>window.innerHeight?h.style.transform="translateY(".concat(window.innerHeight-t,"px)"):e.height/2>a.y&&(h.style.transform="translateY(175px)")}),1500))}}if(s.id==o.currentPano.id&&"panorama"==o.mode){c();var d=new THREE.Vector3(0,0,1).applyQuaternion(o.camera.quaternion).normalize(),p=o.camera.position.clone().sub(a.position).normalize();if(d.dot(p)<0){var f=o.camera.position.clone().sub(r).multiplyScalar(-1);r=o.camera.position.clone().sub(f)}var m=a.x;o.flyToPano({pano:s,lookAtPoint:r,checkAlone:!0,isTagFlying:!0},(function(){m>window.innerWidth/4&&m<window.innerWidth/4*3?l():(c(),o.flyToPano({pano:s,aimDuration:600,lookAtPoint:r},(function(){l()})))}))}else o.flyToPano({pano:s,lookAtPoint:a.position,duration:1e3,checkAlone:!0,isTagFlying:!0},(function(){return setTimeout((function(){c(),o.flyToPano({pano:s,aimDuration:600,lookAtPoint:r})}),10)}))}else o.flyToPano({pano:s,lookAtPoint:a.position,checkAlone:!0,isTagFlying:!0})},i.startMeasure=function(){var e=i.app.core.get("Player");"panorama"==e.mode?(document.querySelector(".widgets-design-option").style.display="none",i.edit.enter(),e.measureRulers.forEach((function(e){e.state="unable"})),e.chosenMeasureRuler&&e.chosenMeasureRuler.showOptionLabel(!1)):i.app.Camera.panorama().then((function(){return i.startMeasure()}))},i.confirmMeasure=function(e){var t,n=i.app.core.get("Player");if(1==e){var o;i.isSingleView?(o=i.spot3d.position.clone(),i.updateTagPos=!0,i.spot3d.visible=!1):(o=i.editHandle.confirmPos().position,i.editHandle.enter(),n.locked=!1),i.lastPosition=o,i.measureStep=1;var r=o.clone().setY(n.model.currentFloor.boundingBox.min.y),a=De.sortByScore(n.model.panos.list,[so.filters.isPanoAligned()],[so.scoreFunctions.distanceSquared(i.currentPano,-.6)]);a[0]&&r.setY(a[0].item.floorPosition.y);var s=yi.createLine([o,r],{width:2,color:"#09e1c0"});n.model.add(s);var l=new THREE.Mesh(new THREE.CircleGeometry(.08,32),new THREE.MeshBasicMaterial({color:16777215,transparent:!0,opacity:.6,depthTest:!1}));l.position.copy(r),l.position.y+=.002,l.lookAt(r.clone().add(new THREE.Vector3(0,1,0))),n.model.add(l),t=n.currentPano;var c=document.createElement("div");c.className="visible",c.id="measureTag",c.innerHTML='<span class="point zoom" style="background-image: url('.concat(si.getImageURL("images/tag_icon_default.svg"),');"></span>');var u=i.convertPositionTo2D(o).pos;c.style.left=u.x+"px",c.style.top=u.y+"px",c.style.setProperty("display","block","important");var h=document.querySelector("div[xui_tags]");null==h&&(h=document.querySelector("div[xui_tags_view]")),h&&h.appendChild(c),i.measurePointTemp={measureTag:c,stemLine:s,shadow:l}}else if(2==e){var d,p=(d=i.isSingleView?i.spot3d.position.clone():i.editHandle.confirmPos().position).distanceTo(i.lastPosition),f=Math.max(5,6*p),m=.3,v=i.getVisiblePano(i.lastPosition,f,m),g=i.getVisiblePano(d,f,m),y=De.getUnionSet(v,g);0==y.length&&(m=1,v=i.getVisiblePano(i.lastPosition,f,m),g=i.getVisiblePano(d,f,m),y=De.getUnionSet(v,g));var A=new hD({points:[i.lastPosition,d],visiblePanos:y,state:"active"},n);n.chosenMeasureRuler=A,A.visiblePanos.includes(n.currentPano)||A.visiblePanos.push(n.currentPano),A.visiblePanos.includes(t)||A.visiblePanos.push(t),n.measureRulers.forEach((function(e){e.updateVisible(),"active"==e.state&&e.updateBoldLine(),e.update()}))}},i.cancelMeasure=function(){var e=i.app.core.get("Player");if(i.measurePointTemp){var t=i.measurePointTemp,n=t.measureTag,o=t.stemLine,r=t.shadow,a=document.querySelector("div[xui_tags]");null==a&&(a=document.querySelector("div[xui_tags_view]")),a&&a.removeChild(n),o.geometry.dispose(),o.material.dispose(),e.model.remove(o),r.geometry.dispose(),r.material.dispose(),e.model.remove(r),i.measurePointTemp=null}e.measureRulers.forEach((function(e){e.updateVisible(),"active"==e.state&&e.updateBoldLine()})),i.edit.exit()},i.app=e,i.root="[xui_tags_view]",i.view=oe(),i.editor=oe(),i.plugin=oe(),i.loaded=!1,i.editTag=null,i.tags=[],i.labels=[],i.showTags=!0,i.showTagPanel=!0,i.showTagsVisible=!1,i.app.store.on("tags",(function(t){i.tags=t.tags||[];var n=e.core.get("Player"),o=new THREE.Vector3(0,-1,0),r=new THREE.Raycaster(new THREE.Vector3(0,0,0),o,.001,9999);i.tags.forEach((function(e){if(null==e.floorIndex){r.set(e.position,o);var t=r.intersectObjects(n.model.chunks);if(t.length)e.floorIndex=t[0].object.parent.floorIndex;else{var i=n.model.floors.list.find((function(t){return e.position.y>=t.boundingBox.min.y&&e.position.y<=t.boundingBox.max.y}));e.floorIndex=i&&i.floorIndex}}})),i.view.then((function(e){return e.render()})),i.loaded=!0,i.emit("loaded",i.tags)})),i.edit={},i.edit.enter=function(t,n){if(i.tagPosChosing=!0,i.isSingleView){i.hideAll();var o=e.core.get("Player");o.locked=!0,o.reticule.visible=!1,i.spot3d.visible=!0,t?(i.updateTagPos=!1,i.spot3d.position.set(t.position.x,t.position.y,t.position.z),setTimeout((function(){var e=new THREE.Vector3(0,0,0),n=new THREE.Vector3(0,0,.5);ge.projectPositionToCanvas(t.position,o.camera,e,o.domElement),ge.convertScreenPositionToNDC(e.x,e.y,n,o.domElement);var r=o.getMouseIntersect(n,o.OverlayManager.group.children.concat(o.model.colliders));r&&(i.spot3d.lookAt(r.normal.add(i.spot3d.position)),i.spot3d.topMesh.lookAt(o.camera.position))}),10)):(i.updateTagPos=!0,i.spot3d.position.set(0,1e3,0))}else e.core.get("Scene").getSplit("TAG").then((function(o){null==i.editHandle&&(i.editHandle=e.withNewComponent("TagEditManager",o,{spotA:e.dom.querySelector('.player[name="main"] .player-mark'),spotB:e.dom.querySelector('.player[name="copy"] .player-mark')})),t?i.editHandle.reSetPos(t.position):i.editHandle.enter(),n&&n()}))},i.edit.exit=function(t){var n=i.app.core.get("Player");if(n.cameraControls.activeControl.enabled=!0,i.tempTag&&!t&&(i.editTag.position=i.tempTag.position),i.isSingleView)i.showAll(),n.domElement.style.cursor="default",n.locked=!1,n.reticule.visible=!0,i.spot3d.visible=!1,i.updateTagPos=!1;else{if(!i.editHandle)return;e.core.get("Scene").restore("TAG"),i.editHandle.exit({cancel:!0})}i.editTag=null,i.tempTag=null,i.tagPosChosing=!1,setTimeout((function(){n.cameraControls.activeControl.camera.fov=70,n.camera.fov=n.baseFov*(1/n.zoomLevel)}),50)};var r=new THREE.Raycaster(new THREE.Vector3,new THREE.Vector3,.001,9999);return i.edit.confirm=function(t){var n=i.app.core.get("Player"),o=i.editTag;if(i.isSingleView){if(!o)return;if(i.showAll(),i.spot3d.visible=!0,o.position=i.spot3d.topMesh.getWorldPosition(new THREE.Vector3),!o.visiblePanos&&(o.visiblePanos=i.getVisiblePano(o.position),0==o.visiblePanos.length)){var a=n.currentPano.id;o.visiblePanos.push(n.model.panos.index[a])}}else{if(!i.editHandle)return;var s=i.editHandle.confirmPos(),l=s.position,c=s.sid,u=s.panoId;if(!l)return t||i.edit.exit(),null;var h=i.getVisiblePano(l);0==h.length&&h.push(n.model.panos.index[u]),null==o?o={position:l,visiblePanos:h,sid:c,panoId:u,icon:e.resource.base("images/tag_icon_default.svg")}:(o.position=l,o.visiblePanos=h)}var d=n.cameraControls.activeControl.camera,p=(new THREE.Vector3).subVectors(o.position,d.position).normalize();r.set(d.position,p);var f=r.intersectObjects(n.model.chunks);return f.length?o.floorIndex=f[0].object.parent.floorIndex:o.floorIndex=n.currentPano.floorIndex,i.edit.exit(!0),o},i.edit.editTag=function(){i.tagInfoEditing=!0},i.edit.cancelTagEdit=function(){i.tagInfoEditing=!1},i.edit.beginTagVisiSetting=function(){i.showTagsVisible=!0;var e=i.app.core.get("Player");e&&e.linkEditor&&(e.linkEditor.enterSet("tagVisible"),e.linkEditor.beginSetTagVisible()),e.model.floorplanCadImg.hideCadPlane(),e.emit("beginTagVisiSetting")},i.edit.setTagVisi=function(e){var t=i.tags.find((function(t){return t.sid==e}));i.app.core.get("Player").linkEditor.SetOneTagVisible(t)},i.edit.resetTagVisi=function(){var e=i.app.core.get("Player").linkEditor,t=e.tagVsetting;e.tagVsetting=null,e.SetOneTagVisible(t)},i.edit.checkNeedSaveTagVisi=function(){return i.app.core.get("Player").linkEditor.checkTagVisiChange()},i.edit.saveTagVisi=function(){var e=i.app.core.get("Player"),t=e.linkEditor.saveTagVisibles(),n=i.app.store.getValue("tags");return t.forEach((function(t){i.tags.find((function(e){return e.sid==t.sid})).visiblePanos=t.value.map((function(t){return e.model.panos.index[t]}))})),n.tags=i.tags,i.app.store.set("tags",n),{data:t,func:e.linkEditor.afterSaveTagVisibles.bind(e.linkEditor)}},i.edit.cancelTagVisiSetting=function(){var e=i.app.core.get("Player");i.showTagsVisible=!1,i.app.core.get("Player").linkEditor.finishSetTagVisible(),i.app.core.get("Player").model.floorplanCadImg.showCadPlane(),e.emit("exitTagVisiSetting")},i.edit.hideAllTagVisi=function(){var e=i.app.core.get("Player").linkEditor,t=e.tagVsetting;e.setTagHideAll(t)},i.edit.showAllTagVisi=function(){var e=i.app.core.get("Player").linkEditor,t=e.tagVsetting;e.setTagShowAll(t)},i.app.Scene.on("loaded",(function(){var t=e.core.get("Player"),n=document.createElement("div");n.className="widgets-rulers",t.domElement.append(n);var o=document.querySelector(".widgets-design-option div");o&&o.addEventListener("pointerup",(function(e){e.stopPropagation(),t.chosenMeasureRuler.remove(),t.chosenMeasureRuler.showOptionLabel(!1)}));var r=i.app.store.getValue("metadata");r?i.isSingleView="laser"==r.sceneFrom:i.app.store.on("metadata",(function(e){return i.isSingleView="laser"==e.sceneFrom})),i.isSingleView&&(i.spot3d=new sB(t));var a=i.app.config.tag.showIn,s={};if(e.core.get("SceneRenderer").on(xa,(function(){if(i.measurePointTemp){var n=i.convertPositionTo2D(i.lastPosition),o=i.measurePointTemp.measureTag;o.style.left=n.pos.x+"px",o.style.top=n.pos.y+"px",o.className=n.trueSide&&n.inSight?"visible":""}if(i.labels.length&&i.labels.forEach((function(n){if(t.mode!=xt.PANORAMA||n.visiblePanos&&!n.visiblePanos.includes(t.currentPano))return n.visible=!1;if(n.floorIndex!=t.model.currentFloor.floorIndex)return n.visible=!1;var i=e.TagManager.convertPositionTo2D(n.position);if(!i.trueSide||!i.inSight)return n.visible=!1;n.x=i.pos.x,n.y=i.pos.y,n.visible=!0})),i.tags&&i.tags.length){var r=function(e,t){e.visible!=t&&(e.visible=t)};i.tags.forEach((function(n){if(n.isLose||!1===i.showTags)return r(n,!1);if(0==i.showTagsVisible){if(a)if("all"===a){if(i.editTag||t.paintEditor&&t.paintEditor.painting||t.mode==xt.PANORAMA&&!n.visiblePanos.includes(t.currentPano))return r(n,!1)}else if(-1==a.indexOf(t.mode))return r(n,!1);if(at.vrEnabled&&at.vrSplitScreen)return r(n,!1);if((!a||"all"!=a&&-1!=a.indexOf(xt.PANORAMA)&&t.mode==xt.PANORAMA)&&(i.editTag||t.mode!=xt.PANORAMA||n.visiblePanos&&!n.visiblePanos.includes(t.currentPano)||t.paintEditor&&t.paintEditor.painting))return r(n,!1)}if(t.linkEditor.setTagVisible&&n.floorIndex!=t.model.currentFloor.floorIndex&&t.linkEditor.tagVsetting!=n)return r(n,!1);var o=e.TagManager.convertPositionTo2D(n.position);if(!o.trueSide||!o.inSight)return r(n,!1);n.x=o.pos.x,n.y=o.pos.y,r(n,!0)})),s.lastFrameChanged=t.lastFrameChanged,i.emit("update",s)}})),i.isSingleView){var l=new THREE.Vector3;t.on("pointerStart",(function(e){i.editTag&&t.getMouseIntersect(null,[i.spot3d.topMesh,i.spot3d.bottomMesh])&&(i.updateTagPos=!0,t.cameraControls.activeControl.enabled=!1)})),t.on("pointerMove",(function(e){if((i.editTag||i.updateTagPos)&&(t.getMouseIntersect(null,[i.spot3d.topMesh,i.spot3d.bottomMesh])?t.domElement.style.cursor="move":i.editTag&&!i.updateTagPos&&(t.domElement.style.cursor="default"),i.updateTagPos)){var n=t.getMouseIntersect(null,t.OverlayManager.group.children.concat(t.model.colliders));if(n){i.spot3d.visible=!0,i.spot3d.position.copy(n.point),i.spot3d.lookAt(l.addVectors(n.point,n.normal)),i.spot3d.topMesh.lookAt(t.camera.position);var o=ge.getScaleForConstantSize({width2d:500,position:i.spot3d.position,camera:t.camera,dom:t.$app.dom});i.spot3d.topMesh.scale.set(o,o,o)}else i.spot3d.visible=!1}})),t.on("pointerUp",(function(e){if(i.spot3d&&i.updateTagPos){var n=t.getMouseIntersect(null,t.OverlayManager.group.children.concat(t.model.colliders));if(!n)return;i.spot3d.visible=!0,i.spot3d.position.copy(n.point),i.spot3d.lookAt(l.addVectors(n.point,n.normal)),i.spot3d.topMesh.lookAt(t.camera.position);var o=ge.getScaleForConstantSize({width2d:500,position:i.spot3d.position,camera:t.camera,dom:t.$app.dom});i.spot3d.topMesh.scale.set(o,o,o),t.cameraControls.activeControl.enabled=!0,t.cameraControls.activeControl.pointerDragOn=!1,i.updateTagPos=!1,i.editTag?i.editTag.position=i.spot3d.position:i.editTag={position:i.spot3d.position,sid:De.getRandomSid(),icon:i.app.resource.base("images/tag_icon_default.svg")},i.emit("tagManager.markTagPos",e)}}))}})),i}return u(n,[{key:"tag",value:function(){return this.ready?Promise.resolve(this):this.plugin.promise()}},{key:"load",value:function(e){var t=this;if(!this.app.Scene.loaded)return setTimeout((function(){t.load(e)}),100);e&&(e.forEach((function(e){e.position&&e.position instanceof THREE.Vector3==0&&(e.position=new THREE.Vector3(e.position.x,e.position.y,e.position.z)),e.visiblePanos&&e.visiblePanos.length?e.visiblePanos=e.visiblePanos.map((function(e){return"object"==typeof e?t.app.core.get("Player").model.panos.index[e.id]:t.app.core.get("Player").model.panos.index[e]})):e.visiblePanos=t.getVisiblePano(e.position)})),this.tags=e)}},{key:"install",value:function(e,t){this.ready=!0,this.plugin.resolve(this),this[e]&&(this[e].resolve(t),this.loaded&&"function"==typeof t.render&&t.render())}},{key:"convertPositionTo2D",value:function(e){return pt.getPos2d(e,this.app.core.get("Player"))}},{key:"ifShelter",value:function(e,t){var n=this.app.core.get("Player"),i=n.model.allFloorsVisible?null:n.model.currentFloor.floorIndex;return pt.ifShelter(e,n,t,null,i)}},{key:"getVisiblePano",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:6,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:.15,i=pt.getVisiblePano(e,this.app.core.get("Player").model,{maxDis:t,tolerance:n});return i}},{key:"add",value:function(e){var t=this;return e&&e.length?(e.forEach((function(e){e.position&&e.position instanceof THREE.Vector3==0&&(e.position=new THREE.Vector3(e.position.x,e.position.y,e.position.z),e.visiblePanos&&e.visiblePanos.length?e.visiblePanos=e.visiblePanos.map((function(e){return t.app.core.get("Player").model.panos.index[e]})):e.visiblePanos=t.getVisiblePano(e.position)),t.tags.push(e)})),this.view.then((function(e){return e.refresh()}))):Promise.resolve()}},{key:"remove",value:function(e){var t=this.tags.findIndex((function(t){return t.sid==e}));return-1!=t?(this.tags.splice(t,1),this.view.then((function(t){return t.remove(e)}))):Promise.resolve()}},{key:"removeAll",value:function(){return this.tags=[],this.view.then((function(e){return e.removeAll()}))}},{key:"update",value:function(e){e&&e.length&&(this.tags=e)}},{key:"updatePosition",value:function(e){this.tags=e}},{key:"focusTag",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{direction:"",checkSameTag:!1,attrs:null};return new Promise((function(i){"object"!=typeof n&&(n={});var o=t.tags.find((function(t){return t.sid==e}));if(!o)return i();if(t.emit("focus",e,t.focusId),e==t.focusId&&n.checkSameTag)return t.focusId="",i();t.focusId=e;var r=t.player||t.app.core.get("Player"),a=r.model.panos.closestPanoTowardPoint({point:o.position,getAll:!0}).map((function(e){return e.item})).filter((function(e){return o.visiblePanos.indexOf(e)>-1&&e.position.clone().setY(o.position.y).sub(o.position).length()>1.5})),s=a[0],l=a.filter((function(e){return e.floorIndex==r.model.currentFloor.floorIndex}));if(l.length>0&&(s=l[0]),s||(console.warn("该热点无可视点位"),s=r.currentPano),t.__is_aimat=!0,n.direction){var c;if(n.attrs)c=n.attrs;else{var u=document.querySelector(t.root).querySelector('[data-tag-id="'.concat(e,'"]')).querySelector(".tag-body");if(!u)return i();c={width:(u.clientWidth||0)+parseInt(pD(u,"margin-left"))+parseInt(pD(u,"margin-right")),height:(u.clientHeight||0)+parseInt(pD(u,"margin-top"))+parseInt(pD(u,"margin-bottom"))}}var h=new THREE.Vector3,d=function(){o.x=t.app.TagManager.convertPositionTo2D(o.position).pos.x,o.y=t.app.TagManager.convertPositionTo2D(o.position).pos.y,h.set(0,0,0);var e=o.x-("left"==n.direction?c.width/2:0),i=o.y-("top"==n.direction?c.height/2:0);t.app.TagManager.convertScreenPositionToNDC(e,i,h,t.app.dom),h.unproject(r.camera)};if(s.id==r.currentPano.id&&"panorama"==r.mode){d();var p=new THREE.Vector3(0,0,1).applyQuaternion(r.camera.quaternion).normalize(),f=r.camera.position.clone().sub(o.position).normalize();if(p.dot(f)<0){var m=r.camera.position.clone().sub(h).multiplyScalar(-1);h=r.camera.position.clone().sub(m)}o.x,r.flyToPano({pano:s,lookAtPoint:h,duration:1e3,isTagFlying:!0},(function(){setTimeout((function(){d(),r.flyToPano({pano:s,aimDuration:500,lookAtPoint:h}),i(),t.__is_aimat=!1}),10)}))}else r.flyToPano({pano:s,lookAtPoint:o.position,duration:1e3,isTagFlying:!0},(function(){return setTimeout((function(){d(),r.flyToPano({pano:s,aimDuration:400,lookAtPoint:h}),i(),t.__is_aimat=!1}),10)}))}else r.flyToPano({pano:s,lookAtPoint:o.position,isTagFlying:!0},(function(){i(),t.__is_aimat=!1}))}))}},{key:"unfocusTag",value:function(){this.focusId=""}},{key:"closeTag",value:function(e){this.unfocusTag(),this.emit("close")}},{key:"openTag",value:function(e){this.emit("open",e)}},{key:"flyToTag",value:function(e){this.focus({sid:e})}},{key:"open",value:function(e,t){var n=this;if(!this.tags.find((function(t){return t.sid==e})).visible){if(t)return;return setTimeout((function(){n.open(e,!0)}),500)}var i=document.querySelector('[tag-sid="'.concat(e,'"]'));if(i){var o=i.querySelector(".point"),r=document.createEvent("HTMLEvents");this.app.config.mobile?r.initEvent("click",!0,!0):r.initEvent("mouseenter",!0,!0),r.fixed=!0,o.dispatchEvent(r)}}},{key:"close",value:function(e){if(this.tags.find((function(t){return t.sid==e})).visible){var t=document.querySelector('[tag-sid="'.concat(e,'"]'));if(t){var n=document.createEvent("HTMLEvents");this.app.config.mobile?(t=t.querySelector(".arrow i"),n.initEvent("click",!0,!0)):n.initEvent("mouseleave",!0,!0),n.relatedTarget=!0,n.unfixed=!0,t&&t.dispatchEvent(n)}}}},{key:"findBestPanoForWatching",value:function(e){var t=this.app.core.get("Player"),n=t.model.panos.closestPanoTowardPoint({point:e.position,getAll:!0,require:[function(t){return e.visiblePanos.indexOf(t)>-1}]}).map((function(e){return e.item})),i=n.filter((function(e){return e.neighbourUUIDs.filter((function(t){return t!=e.id})).length>0}));i.length>0&&(n=i);var o=n.filter((function(e){return e.floorIndex==t.model.currentFloor.floorIndex}));o.length>0&&(n=o);var r=n[0];return t.mode===xt.PANORAMA&&(n=n.filter((function(n){var i=new THREE.Vector3(e.position.x-n.position.x,e.position.y-n.position.y,e.position.z-n.position.z),o=new THREE.Vector3(e.position.x-t.currentPano.position.x,e.position.y-t.currentPano.position.y,e.position.z-t.currentPano.position.z);return i.angleTo(o)<Math.PI/4}))),n.length>0&&(r=n[0]),r||(console.warn("该热点无可视点位"),r=t.currentPano),r}},{key:"showAll",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.showTags=!0,e&&(this.showTagsVisible=!0)}},{key:"hideAll",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.showTags=!1,e&&(this.showTagsVisible=!1)}},{key:"convertScreenPositionToNDC",value:function(e,t,n){return ge.convertScreenPositionToNDC(e,t,n,this.app.dom)}},{key:"handleMouseEvent",value:function(e,t){this.app.Scene.emit("hotspot.".concat(e),{type:"tag",event:t})}},{key:"toJSON",value:function(e){var t=JSON.stringify(e||this.tags,(function(e,t){return"visiblePanos"===e&&t?t.map((function(e){return e.id})):t}));return JSON.parse(t)}}]),n}(yo);function mD(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}var vD=K("visibleEnter"),gD=K("visibleLeave"),yD=function(){function e(t){o(this,e),Object.defineProperty(this,gD,{value:ED}),Object.defineProperty(this,vD,{value:AD}),this.app=t,this.player=null,this.symbol=null,this.visible=!1}return u(e,[{key:"enter",value:function(e){var t=this;this.symbol||(this.player=this.app.core.get("Player"),null!=this.player?(this.symbol=e,"visible"==e&&Z(this,vD)[vD]()):setTimeout((function(){return t.enter(e)}),500))}},{key:"leave",value:function(){"visible"==this.symbol&&Z(this,gD)[gD](),this.symbol=null}},{key:"setVisibleState",value:function(e){var t=this.app.TagManager.tags.find((function(t){return t.sid==e}));t&&this.player.linkEditor.SetOneTagVisible(t)}}]),e}();function AD(){this.visible=!0,this.player.linkEditor&&(this.player.linkEditor.enterSet("tagVisible"),this.player.linkEditor.beginSetTagVisible()),this.player.model.floorplanCadImg.hideCadPlane()}function ED(){this.visible=!1,this.player.linkEditor.finishSetTagVisible(),this.player.model.floorplanCadImg.showCadPlane()}var bD=function(e){f(n,e);var t=mD(n);function n(e){var i;return o(this,n),(i=t.call(this)).focusBeforeModify=function(e){var t=i.app.core.get("Player");i.editTag=i.tags.find((function(t){return t.sid==e}));var n=i.findBestPanoForWatching(i.editTag);t.flyToPano({pano:n,lookAtPoint:i.editTag.position,aimDuration:0,duration:1,checkAlone:!0},(function(){i.edit.enter(i.editTag,(function(){i.editHandle.markTagPos=i.editTag.position,i.editHandle.markSpotA.elem.style.display="block",i.editHandle.markSpotB.elem.style.display="block"}))}))},i.focusing=function(e){var t=i.app.core.get("Player"),n=new THREE.Vector3,o=i.tags.find((function(t){return t.sid==e.sid}))||e.tag,r=i.findBestPanoForWatching(o),a=function(){t.mode===xt.PANORAMA&&i.app.Camera.emit(ea,{panoId:t.currentPano?t.currentPano.id:null,quaternion:t.cameraControls.activeControl.camera.quaternion,mode:xt.PANORAMA,type:"flyToPano"})},s=function(){o.x=i.convertPositionTo2D(o.position).pos.x,o.y=i.convertPositionTo2D(o.position).pos.y,n.set(0,0,0);var r=o.x,a=o.y;e.board?(e.board.width&&(r=o.x-e.board.width/2),e.board.height&&(a=o.y-e.board.height/2)):(r=o.x,a=o.y),ge.convertScreenPositionToNDC(r,a,n,i.app.dom),n.unproject(t.camera)};if(e.target=e.target||"board","board"==e.target)if(r.id==t.currentPano.id&&"panorama"==t.mode){i.emit("focus.rotating"),s();var l=new THREE.Vector3(0,0,1).applyQuaternion(t.camera.quaternion).normalize(),c=t.camera.position.clone().sub(o.position).normalize();if(l.dot(c)<0){var u=t.camera.position.clone().sub(n).multiplyScalar(-1);n=t.camera.position.clone().sub(u)}t.flyToPano({pano:r,lookAtPoint:n,checkAlone:!0,isTagFlying:!0},(function(){o.x>window.innerWidth/4&&o.x<window.innerWidth/4*3?(a(),i.emit("focus.rotated",o)):(s(),t.flyToPano({pano:r,aimDuration:600,lookAtPoint:n},(function(){a(),i.emit("focus.rotated",o)})))}))}else t.flyToPano({pano:r,lookAtPoint:o.position,duration:1e3,checkAlone:!0,isTagFlying:!0},(function(){return setTimeout((function(){s(),t.flyToPano({pano:r,aimDuration:600,lookAtPoint:n},(function(){i.emit("focus.rotated",o)}))}),10)}));else"tag"==e.target&&t.flyToPano({pano:r,lookAtPoint:o.position,checkAlone:!0,isTagFlying:!0},(function(){i.emit("focus.rotated",o)}))},console.info("TagManagerV2"),i.app=e,i.tags=[],i.icons=[],i.manager=new yD(i.app),i.app.store.on("tags",(function(t){t.icons&&(i.icons=t.icons),t.tags&&t.tags.forEach((function(e){i.tags.push(e)}));var n=e.core.get("Player"),o=new THREE.Vector3(0,-1,0),r=new THREE.Raycaster(new THREE.Vector3(0,0,0),o,.001,9999);i.tags.forEach((function(e){if(null==e.floorIndex){r.set(e.position,o);var t=r.intersectObjects(n.model.chunks);if(t.length)e.floorIndex=t[0].object.parent.floorIndex;else{var i=n.model.floors.list.find((function(t){return e.position.y>=t.boundingBox.min.y&&e.position.y<=t.boundingBox.max.y}));e.floorIndex=i&&i.floorIndex}}})),i.loaded=!0,i.emit("loaded",i.tags)})),i.app.Camera.on("flying.started",(function(e){e.isTagFlying||i.emit("close")})),i.app.Scene.on("loaded",(function(){var t=e.core.get("Player"),n=i.app.config.tag.showIn,o={tags:i.tags};e.core.get("SceneRenderer").on(xa,(function(){if(i.tags&&i.tags.length){var e=function(e,t){e.visible!=t&&(e.visible=t)};i.tags.forEach((function(o){if(o.isLose||!1===i.showTags)return e(o,!1);if(i.manager.visible){if(t.linkEditor.setTagVisible&&o.floorIndex!=t.model.currentFloor.floorIndex&&t.linkEditor.tagVsetting!=o)return e(o,!1)}else{if(n)if("all"===n){if(t.mode==xt.PANORAMA&&!o.visiblePanos.includes(t.currentPano))return e(o,!1)}else if(-1==n.indexOf(t.mode))return e(o,!1);if(at.vrEnabled&&at.vrSplitScreen)return e(o,!1);if((!n||"all"!=n&&n==xt.PANORAMA)&&(t.mode!=xt.PANORAMA||o.visiblePanos&&!o.visiblePanos.includes(t.currentPano)))return e(o,!1)}var r=i.convertPositionTo2D(o.position);if(!r.trueSide||!r.inSight)return e(o,!1);o.x=r.pos.x,o.y=r.pos.y,e(o,!0)})),o.lastFrameChanged=t.lastFrameChanged,i.emit("update",o)}}))})),i}return u(n,[{key:"load",value:function(e){var t=this;if(e&&!(!e instanceof Array)){var n=this.app.core.get("Player");e.forEach((function(e){e.position&&e.position instanceof THREE.Vector3==0&&(e.position=new THREE.Vector3(e.position.x,e.position.y,e.position.z),e.visiblePanos&&e.visiblePanos.length?e.visiblePanos=e.visiblePanos.map((function(e){return n.model.panos.index[e]})):e.visiblePanos=t.getVisiblePano(e.position))})),this.tags=e}}},{key:"convertPositionTo2D",value:function(e){return pt.getPos2d(e,this.app.core.get("Player"))}},{key:"ifShelter",value:function(e,t){var n=this.app.core.get("Player"),i=n.model.allFloorsVisible?null:n.model.currentFloor.floorIndex;return pt.ifShelter(e,n,t,null,i)}},{key:"getVisiblePano",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:6,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:.15,i=pt.getVisiblePano(e,this.app.core.get("Player").model,{maxDis:t,tolerance:n});return i}},{key:"open",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=this.tags.find((function(t){return t.sid==e}));if(i){if(!i.visible){if(console.log(n),n>5)return;return setTimeout((function(){return t.open(e,++n)}),300)}this.emit("open",i)}}},{key:"focus",value:function(e){var t=this.tags.find((function(t){return t.sid==e}));t&&this.emit("focus",t)}},{key:"close",value:function(){this.emit("close")}},{key:"findBestPanoForWatching",value:function(e){var t=this.app.core.get("Player"),n=t.model.panos.closestPanoTowardPoint({point:e.position,getAll:!0,require:[function(t){return e.visiblePanos.indexOf(t)>-1}]}).map((function(e){return e.item})),i=n.filter((function(e){return e.neighbourUUIDs.filter((function(t){return t!=e.id})).length>0}));i.length>0&&(n=i);var o=n.filter((function(e){return e.floorIndex==t.model.currentFloor.floorIndex}));o.length>0&&(n=o);var r=n[0];return t.mode===xt.PANORAMA&&(n=n.filter((function(n){var i=new THREE.Vector3(e.position.x-n.position.x,e.position.y-n.position.y,e.position.z-n.position.z),o=new THREE.Vector3(e.position.x-t.currentPano.position.x,e.position.y-t.currentPano.position.y,e.position.z-t.currentPano.position.z);return i.angleTo(o)<Math.PI/4}))),n.length>0&&(r=n[0]),r||(console.warn("该热点无可视点位"),r=t.currentPano),r}},{key:"showAll",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.showTags=!0,e&&(this.showTagsVisible=!0)}},{key:"hideAll",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.showTags=!1,e&&(this.showTagsVisible=!1)}},{key:"convertScreenPositionToNDC",value:function(e,t,n){return ge.convertScreenPositionToNDC(e,t,n,this.app.dom)}},{key:"toJSON",value:function(e){var t=JSON.stringify(e||this.tags,(function(e,t){return"visiblePanos"===e&&t?t.map((function(e){return e.id})):t}));return JSON.parse(t)}}]),n}(yo);function wD(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}var xD=function(e){f(n,e);var t=wD(n);function n(e){var i,r;o(this,n),(i=t.call(this)).app=e,i.edit={};var a=oe();return i.app.Scene.on("loaded",(function(){(r=i.app.core.get("Player")).linkEditor=new Ws(r),a.resolve()})),i.edit.enter=function(){r&&r.linkEditor?setTimeout((function(){r.linkEditor.enterSet("panoVisible"),r.labelManager.updateEntryVisi(!1)}),0):a.then((function(){return i.edit.enter()}))},i.edit.exit=function(){r&&r.linkEditor.finishSetPanoVisible()},i.edit.undoEdit=function(){var e=r.linkEditor.startEditPano;r.linkEditor.pauseSetPanoVisible(!1,r.model.currentFloor),e&&e.floorIndex==r.model.currentFloor.floorIndex&&(r.linkEditor.SetOnePanoVisible(e),i.emit("walkManager.active",r.linkEditor.checkLinkStatus()))},i.edit.checkNeedSave=function(){return r.linkEditor.checkPanoVisiChange()},i.edit.save=function(e){e(r.linkEditor.savePanoVisibles(),r.linkEditor.afterSavePanoVisibles.bind(r.linkEditor))},i.edit.toggle=function(e){return r.linkEditor.toggle(e)},i.edit.linkToUpperFloor=function(){var e=r.linkEditor;e.startEditPano||(e.startEditPano=e.activePano);var t=e.getFloor(e.activePano.floorIndex,"upper");null!=window.jumpFloor&&(lowerFloorIndex=jumpFloor),r.model.once("floor.changed",(function(t,n){setTimeout((function(){e.actionIcons.forEach((function(e){return e.visible=!1}));var t=e.lastFloorActivePano;t.footIcon.visible=!0,e.changeIconLinkState(t.footIcon,"floorLinked")}),10)})),i.edit.unlinkToOtherFloor(null,{checkMainFirstView:!1}),i.app.Scene.gotoFloor(t),e.setMultiFloorPanoVisible="upper"},i.edit.linkToLowerFloor=function(){var e=r.linkEditor;e.startEditPano||(e.startEditPano=e.activePano);var t=e.getFloor(e.activePano.floorIndex,"lower");null!=window.jumpFloor&&(t=jumpFloor),r.model.once("floor.changed",(function(t,n){setTimeout((function(){e.actionIcons.forEach((function(e){return e.visible=!1}));var t=e.lastFloorActivePano;t.footIcon.visible=!0,e.changeIconLinkState(t.footIcon,"floorLinked")}),10)})),i.edit.unlinkToOtherFloor(null,{checkMainFirstView:!1}),i.app.Scene.gotoFloor(t),e.setMultiFloorPanoVisible="lower"},i.edit.floorLinkConfirm=function(){var e=r.linkEditor,t=e.lastFloorActivePano,n=e.linkToFloorPano;if(!n)return console.log("没有选择漫游点");i.edit.unlinkToOtherFloor(n),n&&(e.savePanoVisiChange(t.id,[{type:"add",id:n.id}]),e.changeIconVisiState(t.footIcon,e.checkHasNeighbor(t)))},i.edit.unlinkToOtherFloor=function(e){var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=n.checkMainFirstView,o=void 0===i||i,a=r.linkEditor,s=r.$app.core.get("Scene").firstView.pano;a.startEditPano||(a.startEditPano=a.activePano);var l=e||a.activePano;a.saveLastPanoVi();var c=a.panoVTemp[l.id]&&a.panoVTemp[l.id].neighbourPanos||r.model.panos.index[l.id].neighbourPanos,u=Object.keys(c).map((function(e){return r.model.panos.index[e]})),h=[];u.forEach((function(e){e.floorIndex!=l.floorIndex&&h.push({type:"sub",id:e.id})})),h.length&&(a.savePanoVisiChange(l.id,h),o&&l==s&&!a.checkHasNeighbor(s)&&(t=!0,h=[{type:"add",id:h[0].id}],a.savePanoVisiChange(l.id,h)),a.changeIconVisiState(l.footIcon,a.checkHasNeighbor(l)),a.delVisibleLines(),a.showFootIcons(l,!0),a.createPanoVisiLines(l)),t&&(r.$app.gui.toast({event:"DialogList3D.WalkManger.firstPointLimit",content:Gs.WalkManger.firstPointLimit}),setTimeout((function(){a.checkFloorLinkStatus()}),1))},i.edit.cancelFloorLink=function(){var e=r.linkEditor;i.app.Scene.gotoFloor(e.lastFloorActivePano.floorIndex),e.actionIcons.forEach((function(e){return e.visible=!0})),e.linkToFloorPano=null,e.setMultiFloorPanoVisible=!1,r.$app.WalkManager.emit("walkManager.multiFloorLinking",!1)},i.edit.checkFirstView=function(e,t){var n,i=r.$app.core.get("Scene").firstView.pano;if(i==e)n=t;else{if(i!=t)return!1;n=e}var o=r.linkEditor.getCurNeighbors(i);return 1==o.length&&o.includes(n.id)},i}return n}(yo);function CD(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}var TD=function(e){f(n,e);var t=CD(n);function n(e){var i;return o(this,n),(i=t.call(this)).app=e,i.player=null,i.on("walkManager.active",(function(e){var t=null;switch(e){case"walkManager.linkAll":t="all";break;case"walkManager.linkSome":t="some";break;case"walkManager.linkNone":t="none"}i.emit("pano.status",t)})),i.on("walkManager.deactive",(function(){i.emit("pano.status")})),i}return u(n,[{key:"save",value:function(){var e=this.toJSON();return 0==e.length?Promise.resolve():this.app.APIs.editor.walk_save({data:e})}},{key:"enter",value:function(){var e=this;null!==this.player?(this.app.Scene.hideFloorCadImage(),this.player.linkEditor.enterSet("panoVisible"),this.player.labelManager.updateEntryVisi(!1)):this.app.Scene.whenLoaded((function(){e.player=e.app.core.get("Player"),e.player.linkEditor=new Ws(e.player),setTimeout((function(){return e.enter()}),200)}))}},{key:"leave",value:function(){this.player&&(this.app.Scene.showFloorCadImage(),this.player.linkEditor.finishSetPanoVisible())}},{key:"toggle",value:function(e){if(this.player)return this.player.linkEditor.toggle(e)}},{key:"cancel",value:function(){if(null!==this.player){var e=this.player.linkEditor.startEditPano;this.player.linkEditor.pauseSetPanoVisible(!1,this.player.model.currentFloor),e&&e.floorIndex==this.player.model.currentFloor.floorIndex&&(this.player.linkEditor.SetOnePanoVisible(e),this.emit("walkManager.active",this.player.linkEditor.checkLinkStatus()))}}},{key:"confirm",value:function(){}},{key:"toJSON",value:function(){return null===this.player?[]:this.player.linkEditor.savePanoVisibles()||[]}}]),n}(yo),ID=function(){function e(t){var n=this;o(this,e),this.app=t,this.edit={},this.labels=[{key:"porch",text:"玄关",type:"hall"},{key:"masterGuard",text:"主卫",type:"hall"},{key:"aisle",text:"过道",type:"hall"},{key:"guestGuard",text:"客卫",type:"hall"},{key:"kitchen",text:"厨房",type:"hall"},{key:"garage",text:"车库",type:"hall"},{key:"garden",text:"花园",type:"hall"},{key:"balcony",text:"阳台",type:"hall"},{key:"masterBedroom",text:"主卧",type:"room"},{key:"guestBedroom",text:"次卧",type:"room"},{key:"study",text:"书房",type:"room"},{key:"lockerRoom",text:"储物间",type:"room"},{key:"cloakroom",text:"衣帽间",type:"room"},{key:"elderlyRoom",text:"老人房",type:"room"},{key:"childrenRoom",text:"儿童房",type:"room"},{key:"petRoom",text:"宠物房",type:"room"},{key:"livingRoom",text:"客厅",type:"other"},{key:"restaurant",text:"餐厅",type:"other"}],this.plugin=oe(),this.deferred=oe(),this.app.Scene.on("loaded",(function(){n.deferred.resolve()})),this.edit.enter=function(){n.app.VideoManager.BoxVideo.hideAll(),n.app.Scene.Decoration.hideAll(),n.waitLoaded((function(){n.app.core.get("Player").model.floorplanCadImg.isEdit=!0}))},this.edit.exit=function(){n.app.VideoManager.BoxVideo.showAll(),n.app.Scene.Decoration.showAll();var e=n.app.core.get("Player");e&&(e.model.floorplanCadImg.isEdit=!1)}}return u(e,[{key:"install",value:function(e){this.target=e,this.plugin.resolve(e)}},{key:"use",value:function(){return this.target?Promise.resolve(this.target):this.plugin.promise()}},{key:"cad",value:function(){return this.target}},{key:"waitLoaded",value:function(e){e&&(this.app.core.get("Player")?e():this.deferred.then(e))}}]),e}(),kD=function(){function e(t){o(this,e),this.app=t,this.ready=oe(),this.option={},this.player=null,this.instance=null}return u(e,[{key:"install",value:function(e){for(var t in e)this[t]=e[t];this.instance=e,this.ready.resolve()}},{key:"config",value:function(e){var t=this;Object.assign(this.option,e||{}),this.ready.then((function(){t.option.padding&&t.instance.padding(t.option.padding)}))}},{key:"enter",value:function(){var e=this;return this.app.Scene.whenLoaded((function(){e.app.VideoManager.BoxVideo.hideAll(),e.app.Scene.Decoration.hideAll(),e.player=e.app.core.get("Player"),e.player.model.floorplanCadImg.isEdit=!0,e.ready.then((function(){null==e.instance.$xui&&(e.instance.$xui=e.$xui),e.show()}))}))}},{key:"leave",value:function(){var e=this;return this.app.Scene.whenLoaded((function(){e.app.Scene.Decoration.showAll(),e.player.model.floorplanCadImg.isEdit=!1,e.ready.then((function(){return e.hide()}))}))}}]),e}();function BD(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}var PD=function(){function e(t){o(this,e),this.app=t,this.player=null}return u(e,[{key:"length",get:function(){return this.player.GLTFEditor.group.children.length}},{key:"add",value:function(e,t){var n=this;e&&(-1===e.indexOf("?")&&(e+="?"),null==t?t={scale:{x:.1,y:.1,z:.1},position:{x:0,y:0,z:0},quaternion:{x:0,y:0,z:0,w:1}}:null==t.scale?t.scale={x:.1,y:.1,z:.1}:null==t.position?t.position={x:0,y:0,z:0}:null==t.quaternion&&(t.quaternion={x:0,y:0,z:0,w:1}),this.app.Scene.whenLoaded((function(){null==n.player&&(n.player=n.app.core.get("Player")),null==n.player.GLTFEditor&&(n.player.GLTFEditor=new Nl(n.player)),n.player.GLTFEditor.add(function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?BD(Object(n),!0).forEach((function(t){xh(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):BD(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}({url:e,sid:t.sid||String(n.player.GLTFEditor.group.children.length),panoId:t.panoId||n.app.Scene.panos.list[0].id,visible:!0},t))})))}},{key:"load",value:function(e){var t=this;Array.isArray(e)&&e.forEach((function(e){return t.add(e.url,e.options)}))}},{key:"enter",value:function(){var e=this;this.app.Scene.whenLoaded((function(){null==e.player&&(e.player=e.app.core.get("Player")),null==e.player.GLTFEditor&&(e.player.GLTFEditor=new Nl(e.player)),e.player.GLTFEditor.editing=!0}))}},{key:"leave",value:function(){this.player&&(this.player.GLTFEditor.editing=!1)}},{key:"select",value:function(e){if(null!==this.player){e=String(e);var t=this.player.GLTFEditor.group.children.find((function(t){return t.sid===e}));t&&(this.player.GLTFEditor.select(t),this.player.flyToPano({pano:this.player.model.panos.get(t.panoId),lookAtPoint:t.position,checkAlone:!0}))}}},{key:"unselect",value:function(){this.player.GLTFEditor.unselect()}},{key:"remove",value:function(e){var t=this;if(this.player&&this.player.GLTFEditor)if(null==e)this.player.GLTFEditor.group.children.forEach((function(e){t.player.GLTFEditor.delete(e)}));else{e=String(e);var n=this.player.GLTFEditor.group.children.find((function(t){return t.sid===e}));n&&this.player.GLTFEditor.delete(n)}}},{key:"transformMode",value:function(e){null!==this.player&&-1!=="translate,rotate,scale".indexOf(e)&&(this.player.model.transformControls.mode=e)}},{key:"toJSON",value:function(){if(!this.player||!this.player.GLTFEditor)return null;if(this.player.GLTFEditor.selecting){var e=this.player.GLTFEditor.selecting;return{url:e.url,options:{sid:e.sid,panoId:e.panoId,position:{x:parseFloat(e.position.x.toFixed(2)),y:parseFloat(e.position.y.toFixed(2)),z:parseFloat(e.position.z.toFixed(2))},scale:{x:parseFloat(e.scale.x.toFixed(1)),y:parseFloat(e.scale.y.toFixed(1)),z:parseFloat(e.scale.z.toFixed(1))},quaternion:{x:parseFloat(e.quaternion.x.toFixed(3)),y:parseFloat(e.quaternion.y.toFixed(3)),z:parseFloat(e.quaternion.z.toFixed(3)),w:parseFloat(e.quaternion.w.toFixed(3))},visible:e.visible}}}return this.player.GLTFEditor.group.children.map((function(e){return{url:e.url,options:{sid:e.sid,panoId:e.panoId,position:{x:parseFloat(e.position.x.toFixed(2)),y:parseFloat(e.position.y.toFixed(2)),z:parseFloat(e.position.z.toFixed(2))},scale:{x:parseFloat(e.scale.x.toFixed(1)),y:parseFloat(e.scale.y.toFixed(1)),z:parseFloat(e.scale.z.toFixed(1))},quaternion:{x:parseFloat(e.quaternion.x.toFixed(3)),y:parseFloat(e.quaternion.y.toFixed(3)),z:parseFloat(e.quaternion.z.toFixed(3)),w:parseFloat(e.quaternion.w.toFixed(3))},visible:e.visible}}}))}}]),e}();function RD(e){e.APIs=function(e){var t={num:e.config.num,get rnd(){return Date.now()}};return{viewer:aD(t),editor:sD(t)}}(e),e.Scene=new pR(e),e.Camera=new mB(e),e.MinMap=new fR(e),e.DataSYNC=new mR(e),e.MarkManager=new yR(e),e.VideoManager=new wR(e),e.RepairManager=new CR(e),e.ClipBoxManager=new IM(e),e.CSS3DManager=new jM(e),e.PolygonMarkManager=new QS(e),e.PanoVideoManager=new NS(e),e.TourManager=new PR(e),e.Editor=new FR(e),e.Connect=new eM(e),e.Billboard=new vM(e),e.Screenshot=new LR(e),e.ViewLinkEdit=new oM(e),e.FilterManager=new aM(e),e.ConvertViews=new uM,e.config.edition?(e.TagManager=new bD(e),e.CadManager=new kD(e),e.WalkManager=new TD(e)):(e.TagManager=new fD(e),e.CadManager=new ID(e),e.WalkManager=new xD(e)),e.ModelManager=new PD(e)}var MD={pointFrom2DTo3D(e,t,n,i){var o=e.x,r=e.y;n||(n=t.camera),i||(i=t.domElement);var a=new THREE.Vector3(0,0,0);return ge.convertScreenPositionToNDC(o,r,a,i),a.unproject(n),a.y=0,a},pointFrom3DTo2D(e,t,n,i){var o=e;return n||(n=t.camera),i||(i=t.domElement),e instanceof THREE.Vector3==!1&&(o=new THREE.Vector3(o.x||0,o.y||0,o.z||0)),pt.getPos2d(o,t,n,i).pos}};function SD(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return DD(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return DD(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var i=0,o=function(){};return{s:o,n:function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var r,a=!0,s=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return a=e.done,e},e:function(e){s=!0,r=e},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw r}}}}function DD(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);n<t;n++)i[n]=e[n];return i}function LD(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=w(e);if(t){var o=w(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return y(this,n)}}var FD=function(e){f(n,e);var t=LD(n);function n(e){var i;o(this,n),(i=t.call(this,e)).withComponent("store"),i.withComponent("resource"),i.withComponent("Scene"),i.config.dom&&i.withDom(),i.remote_editor=iD,i.remote_viewer=jS,RD(h(i)),function(e){e&&!oi&&(ii=e.config,oi=e,(ni=ti.create({baseURL:ii.server||""})).interceptors.request.use((function(e){if(-1!=e.url.indexOf("/service/")){var t=Fe.valueFromUrl("token")||localStorage.getItem("token")||"";t&&(e.headers.token=t)}return e}),(function(e){return Promise.reject(e)})),ni.interceptors.response.use((function(e){if(!/json/gi.test(e.headers["content-type"]))return e.data;if("arraybuffer"===e.request.responseType){var t=new TextDecoder("utf-8");return JSON.parse(t.decode(new Uint8Array(e.data)))}return oi&&!1===e.data.success&&oi.Scene.emit("error",{type:"network",code:e.data.code,message:e.data.message}),e.data}),(function(e){if(oi){var t=null;e.response&&e.response.data?t=e.response.data:(t={code:500,message:e},-1!=e.message.indexOf("Request aborted")&&(t.code=403)),e.config&&-1==e.config.url.indexOf("data/mapping")&&-1==e.config.url.indexOf("floorplan.json")&&-1==e.config.url.indexOf("vision2.modeldata")&&oi.Scene.emit("error",{type:"network",code:t.code,message:t.message})}return e.response&&e.response.data?Promise.reject(e.response):Promise.reject(e)})))}(h(i)),i.config.useStatistics&&(window._hmt=window._hmt||[],function(){var e=document.createElement("script");e.src="https://hm.baidu.com/hm.js?aa59943d9a481ab824cf054f2d463ca2";var t=document.getElementsByTagName("script")[0];t.parentNode.insertBefore(e,t)}());var r=Fe.valueFromUrl("app_plugins");return r&&r.split(",").forEach((function(e){e&&i.use(e)})),i}return u(n,[{key:"use",value:function(e,t){var n=this;return"string"==typeof e?this.Plugins[e]?Promise.resolve(this.Plugins[e]):function(e,t){return de(he()+"plugins/"+e+".js",e,t)}(e,this.config.version+"-"+Date.now()).then((function(e){return n.Plugins.add(window[e],t)})):"function"==typeof e?this.Plugins.add(e,t):void 0}},{key:"mount",value:function(e){if(!e)throw new Error("el must be require");return this.config.dom=e,this.withDom(),this}},{key:"render",value:function(){return this.core.get("Scene").start(),this}},{key:"metadata",value:function(e){return void 0===e?(this.store.set("metadata"),this):this.store.get("metadata")}},{key:"destroy",value:function(){console.log("dispose renderer!");var e=this.core.get("SceneRenderer").scene;this.core.get("SceneRenderer").renderer.dispose(),this.core.get("SceneRenderer").started=!1;var t=function(e){console.log("dispose material!"),e.dispose();for(var t=0,n=Object.keys(e);t<n.length;t++){var i=e[n[t]];i&&"object"==typeof i&&"minFilter"in i&&(console.log("dispose texture!"),i.dispose())}};e.traverse((function(e){if(e.isMesh)if(console.log("dispose geometry!"),e.geometry.dispose(),e.material.isMaterial)t(e.material);else{var n,i=SD(e.material);try{for(i.s();!(n=i.n()).done;){var o=n.value;t(o)}}catch(e){i.e(e)}finally{i.f()}}}))}}]),n}(ut);return FD.MITT={Emiter:yo},FD.Utils={http:ri,file:Jk,math:ge,convert:MD,MathLight:ht},FD.Animate={transitions:Ae,easing:ye,lerp:St},FD.Viewmode=xt,FD.THREE=THREE,FD.Deferred=oe,window.PetiteVue=Gk,FD}));
|