@xeokit/xeokit-sdk 2.6.96 → 2.6.98

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,10 +1,10 @@
1
1
  /**
2
- * xeokit-sdk v2.6.96
3
- * Commit: c76eb4c08555d55fdd54313f5fb25481d28d1150
4
- * Built: 2025-12-02T12:22:54.826Z
2
+ * xeokit-sdk v2.6.98
3
+ * Commit: 30ac0fa9a4eaf6759fe306bb2e332cce49884787
4
+ * Built: 2025-12-08T14:33:34.719Z
5
5
  */
6
6
 
7
- var _globalThis$loaders3,_DRACO_EXTERNAL_LIBRA,_DEFAULT_SAMPLER_PARA;var _marked=/*#__PURE__*/_regeneratorRuntime().mark(makeStringIterator),_marked2=/*#__PURE__*/_regeneratorRuntime().mark(makeArrayBufferIterator),_marked3=/*#__PURE__*/_regeneratorRuntime().mark(makeMeshPrimitiveIterator);function _wrapNativeSuper(Class){var _cache=typeof Map==="function"?new Map():undefined;_wrapNativeSuper=function _wrapNativeSuper(Class){if(Class===null||!_isNativeFunction(Class))return Class;if(typeof Class!=="function"){throw new TypeError("Super expression must either be null or a function");}if(typeof _cache!=="undefined"){if(_cache.has(Class))return _cache.get(Class);_cache.set(Class,Wrapper);}function Wrapper(){return _construct(Class,arguments,_getPrototypeOf(this).constructor);}Wrapper.prototype=Object.create(Class.prototype,{constructor:{value:Wrapper,enumerable:false,writable:true,configurable:true}});return _setPrototypeOf(Wrapper,Class);};return _wrapNativeSuper(Class);}function _construct(Parent,args,Class){if(_isNativeReflectConstruct()){_construct=Reflect.construct.bind();}else{_construct=function _construct(Parent,args,Class){var a=[null];a.push.apply(a,args);var Constructor=Function.bind.apply(Parent,a);var instance=new Constructor();if(Class)_setPrototypeOf(instance,Class.prototype);return instance;};}return _construct.apply(null,arguments);}function _isNativeFunction(fn){return Function.toString.call(fn).indexOf("[native code]")!==-1;}function _regeneratorRuntime(){"use strict";/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */_regeneratorRuntime=function _regeneratorRuntime(){return exports;};var exports={},Op=Object.prototype,hasOwn=Op.hasOwnProperty,$Symbol="function"==typeof Symbol?Symbol:{},iteratorSymbol=$Symbol.iterator||"@@iterator",asyncIteratorSymbol=$Symbol.asyncIterator||"@@asyncIterator",toStringTagSymbol=$Symbol.toStringTag||"@@toStringTag";function define(obj,key,value){return Object.defineProperty(obj,key,{value:value,enumerable:!0,configurable:!0,writable:!0}),obj[key];}try{define({},"");}catch(err){define=function define(obj,key,value){return obj[key]=value;};}function wrap(innerFn,outerFn,self,tryLocsList){var protoGenerator=outerFn&&outerFn.prototype instanceof Generator?outerFn:Generator,generator=Object.create(protoGenerator.prototype),context=new Context(tryLocsList||[]);return generator._invoke=function(innerFn,self,context){var state="suspendedStart";return function(method,arg){if("executing"===state)throw new Error("Generator is already running");if("completed"===state){if("throw"===method)throw arg;return doneResult();}for(context.method=method,context.arg=arg;;){var delegate=context.delegate;if(delegate){var delegateResult=maybeInvokeDelegate(delegate,context);if(delegateResult){if(delegateResult===ContinueSentinel)continue;return delegateResult;}}if("next"===context.method)context.sent=context._sent=context.arg;else if("throw"===context.method){if("suspendedStart"===state)throw state="completed",context.arg;context.dispatchException(context.arg);}else"return"===context.method&&context.abrupt("return",context.arg);state="executing";var record=tryCatch(innerFn,self,context);if("normal"===record.type){if(state=context.done?"completed":"suspendedYield",record.arg===ContinueSentinel)continue;return{value:record.arg,done:context.done};}"throw"===record.type&&(state="completed",context.method="throw",context.arg=record.arg);}};}(innerFn,self,context),generator;}function tryCatch(fn,obj,arg){try{return{type:"normal",arg:fn.call(obj,arg)};}catch(err){return{type:"throw",arg:err};}}exports.wrap=wrap;var ContinueSentinel={};function Generator(){}function GeneratorFunction(){}function GeneratorFunctionPrototype(){}var IteratorPrototype={};define(IteratorPrototype,iteratorSymbol,function(){return this;});var getProto=Object.getPrototypeOf,NativeIteratorPrototype=getProto&&getProto(getProto(values([])));NativeIteratorPrototype&&NativeIteratorPrototype!==Op&&hasOwn.call(NativeIteratorPrototype,iteratorSymbol)&&(IteratorPrototype=NativeIteratorPrototype);var Gp=GeneratorFunctionPrototype.prototype=Generator.prototype=Object.create(IteratorPrototype);function defineIteratorMethods(prototype){["next","throw","return"].forEach(function(method){define(prototype,method,function(arg){return this._invoke(method,arg);});});}function AsyncIterator(generator,PromiseImpl){function invoke(method,arg,resolve,reject){var record=tryCatch(generator[method],generator,arg);if("throw"!==record.type){var result=record.arg,value=result.value;return value&&"object"==_typeof(value)&&hasOwn.call(value,"__await")?PromiseImpl.resolve(value.__await).then(function(value){invoke("next",value,resolve,reject);},function(err){invoke("throw",err,resolve,reject);}):PromiseImpl.resolve(value).then(function(unwrapped){result.value=unwrapped,resolve(result);},function(error){return invoke("throw",error,resolve,reject);});}reject(record.arg);}var previousPromise;this._invoke=function(method,arg){function callInvokeWithMethodAndArg(){return new PromiseImpl(function(resolve,reject){invoke(method,arg,resolve,reject);});}return previousPromise=previousPromise?previousPromise.then(callInvokeWithMethodAndArg,callInvokeWithMethodAndArg):callInvokeWithMethodAndArg();};}function maybeInvokeDelegate(delegate,context){var method=delegate.iterator[context.method];if(undefined===method){if(context.delegate=null,"throw"===context.method){if(delegate.iterator["return"]&&(context.method="return",context.arg=undefined,maybeInvokeDelegate(delegate,context),"throw"===context.method))return ContinueSentinel;context.method="throw",context.arg=new TypeError("The iterator does not provide a 'throw' method");}return ContinueSentinel;}var record=tryCatch(method,delegate.iterator,context.arg);if("throw"===record.type)return context.method="throw",context.arg=record.arg,context.delegate=null,ContinueSentinel;var info=record.arg;return info?info.done?(context[delegate.resultName]=info.value,context.next=delegate.nextLoc,"return"!==context.method&&(context.method="next",context.arg=undefined),context.delegate=null,ContinueSentinel):info:(context.method="throw",context.arg=new TypeError("iterator result is not an object"),context.delegate=null,ContinueSentinel);}function pushTryEntry(locs){var entry={tryLoc:locs[0]};1 in locs&&(entry.catchLoc=locs[1]),2 in locs&&(entry.finallyLoc=locs[2],entry.afterLoc=locs[3]),this.tryEntries.push(entry);}function resetTryEntry(entry){var record=entry.completion||{};record.type="normal",delete record.arg,entry.completion=record;}function Context(tryLocsList){this.tryEntries=[{tryLoc:"root"}],tryLocsList.forEach(pushTryEntry,this),this.reset(!0);}function values(iterable){if(iterable){var iteratorMethod=iterable[iteratorSymbol];if(iteratorMethod)return iteratorMethod.call(iterable);if("function"==typeof iterable.next)return iterable;if(!isNaN(iterable.length)){var i=-1,next=function next(){for(;++i<iterable.length;){if(hasOwn.call(iterable,i))return next.value=iterable[i],next.done=!1,next;}return next.value=undefined,next.done=!0,next;};return next.next=next;}}return{next:doneResult};}function doneResult(){return{value:undefined,done:!0};}return GeneratorFunction.prototype=GeneratorFunctionPrototype,define(Gp,"constructor",GeneratorFunctionPrototype),define(GeneratorFunctionPrototype,"constructor",GeneratorFunction),GeneratorFunction.displayName=define(GeneratorFunctionPrototype,toStringTagSymbol,"GeneratorFunction"),exports.isGeneratorFunction=function(genFun){var ctor="function"==typeof genFun&&genFun.constructor;return!!ctor&&(ctor===GeneratorFunction||"GeneratorFunction"===(ctor.displayName||ctor.name));},exports.mark=function(genFun){return Object.setPrototypeOf?Object.setPrototypeOf(genFun,GeneratorFunctionPrototype):(genFun.__proto__=GeneratorFunctionPrototype,define(genFun,toStringTagSymbol,"GeneratorFunction")),genFun.prototype=Object.create(Gp),genFun;},exports.awrap=function(arg){return{__await:arg};},defineIteratorMethods(AsyncIterator.prototype),define(AsyncIterator.prototype,asyncIteratorSymbol,function(){return this;}),exports.AsyncIterator=AsyncIterator,exports.async=function(innerFn,outerFn,self,tryLocsList,PromiseImpl){void 0===PromiseImpl&&(PromiseImpl=Promise);var iter=new AsyncIterator(wrap(innerFn,outerFn,self,tryLocsList),PromiseImpl);return exports.isGeneratorFunction(outerFn)?iter:iter.next().then(function(result){return result.done?result.value:iter.next();});},defineIteratorMethods(Gp),define(Gp,toStringTagSymbol,"Generator"),define(Gp,iteratorSymbol,function(){return this;}),define(Gp,"toString",function(){return"[object Generator]";}),exports.keys=function(object){var keys=[];for(var key in object){keys.push(key);}return keys.reverse(),function next(){for(;keys.length;){var key=keys.pop();if(key in object)return next.value=key,next.done=!1,next;}return next.done=!0,next;};},exports.values=values,Context.prototype={constructor:Context,reset:function reset(skipTempReset){if(this.prev=0,this.next=0,this.sent=this._sent=undefined,this.done=!1,this.delegate=null,this.method="next",this.arg=undefined,this.tryEntries.forEach(resetTryEntry),!skipTempReset)for(var name in this){"t"===name.charAt(0)&&hasOwn.call(this,name)&&!isNaN(+name.slice(1))&&(this[name]=undefined);}},stop:function stop(){this.done=!0;var rootRecord=this.tryEntries[0].completion;if("throw"===rootRecord.type)throw rootRecord.arg;return this.rval;},dispatchException:function dispatchException(exception){if(this.done)throw exception;var context=this;function handle(loc,caught){return record.type="throw",record.arg=exception,context.next=loc,caught&&(context.method="next",context.arg=undefined),!!caught;}for(var i=this.tryEntries.length-1;i>=0;--i){var entry=this.tryEntries[i],record=entry.completion;if("root"===entry.tryLoc)return handle("end");if(entry.tryLoc<=this.prev){var hasCatch=hasOwn.call(entry,"catchLoc"),hasFinally=hasOwn.call(entry,"finallyLoc");if(hasCatch&&hasFinally){if(this.prev<entry.catchLoc)return handle(entry.catchLoc,!0);if(this.prev<entry.finallyLoc)return handle(entry.finallyLoc);}else if(hasCatch){if(this.prev<entry.catchLoc)return handle(entry.catchLoc,!0);}else{if(!hasFinally)throw new Error("try statement without catch or finally");if(this.prev<entry.finallyLoc)return handle(entry.finallyLoc);}}}},abrupt:function abrupt(type,arg){for(var i=this.tryEntries.length-1;i>=0;--i){var entry=this.tryEntries[i];if(entry.tryLoc<=this.prev&&hasOwn.call(entry,"finallyLoc")&&this.prev<entry.finallyLoc){var finallyEntry=entry;break;}}finallyEntry&&("break"===type||"continue"===type)&&finallyEntry.tryLoc<=arg&&arg<=finallyEntry.finallyLoc&&(finallyEntry=null);var record=finallyEntry?finallyEntry.completion:{};return record.type=type,record.arg=arg,finallyEntry?(this.method="next",this.next=finallyEntry.finallyLoc,ContinueSentinel):this.complete(record);},complete:function complete(record,afterLoc){if("throw"===record.type)throw record.arg;return"break"===record.type||"continue"===record.type?this.next=record.arg:"return"===record.type?(this.rval=this.arg=record.arg,this.method="return",this.next="end"):"normal"===record.type&&afterLoc&&(this.next=afterLoc),ContinueSentinel;},finish:function finish(finallyLoc){for(var i=this.tryEntries.length-1;i>=0;--i){var entry=this.tryEntries[i];if(entry.finallyLoc===finallyLoc)return this.complete(entry.completion,entry.afterLoc),resetTryEntry(entry),ContinueSentinel;}},"catch":function _catch(tryLoc){for(var i=this.tryEntries.length-1;i>=0;--i){var entry=this.tryEntries[i];if(entry.tryLoc===tryLoc){var record=entry.completion;if("throw"===record.type){var thrown=record.arg;resetTryEntry(entry);}return thrown;}}throw new Error("illegal catch attempt");},delegateYield:function delegateYield(iterable,resultName,nextLoc){return this.delegate={iterator:values(iterable),resultName:resultName,nextLoc:nextLoc},"next"===this.method&&(this.arg=undefined),ContinueSentinel;}},exports;}function asyncGeneratorStep(gen,resolve,reject,_next,_throw,key,arg){try{var info=gen[key](arg);var value=info.value;}catch(error){reject(error);return;}if(info.done){resolve(value);}else{Promise.resolve(value).then(_next,_throw);}}function _asyncToGenerator(fn){return function(){var self=this,args=arguments;return new Promise(function(resolve,reject){var gen=fn.apply(self,args);function _next(value){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"next",value);}function _throw(err){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"throw",err);}_next(undefined);});};}function _createForOfIteratorHelper(o,allowArrayLike){var it=typeof Symbol!=="undefined"&&o[Symbol.iterator]||o["@@iterator"];if(!it){if(Array.isArray(o)||(it=_unsupportedIterableToArray(o))||allowArrayLike&&o&&typeof o.length==="number"){if(it)o=it;var i=0;var F=function F(){};return{s:F,n:function n(){if(i>=o.length)return{done:true};return{done:false,value:o[i++]};},e:function e(_e14){throw _e14;},f:F};}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 normalCompletion=true,didErr=false,err;return{s:function s(){it=it.call(o);},n:function n(){var step=it.next();normalCompletion=step.done;return step;},e:function e(_e15){didErr=true;err=_e15;},f:function f(){try{if(!normalCompletion&&it["return"]!=null)it["return"]();}finally{if(didErr)throw err;}}};}function ownKeys(object,enumerableOnly){var keys=Object.keys(object);if(Object.getOwnPropertySymbols){var symbols=Object.getOwnPropertySymbols(object);enumerableOnly&&(symbols=symbols.filter(function(sym){return Object.getOwnPropertyDescriptor(object,sym).enumerable;})),keys.push.apply(keys,symbols);}return keys;}function _objectSpread(target){for(var i=1;i<arguments.length;i++){var source=null!=arguments[i]?arguments[i]:{};i%2?ownKeys(Object(source),!0).forEach(function(key){_defineProperty(target,key,source[key]);}):Object.getOwnPropertyDescriptors?Object.defineProperties(target,Object.getOwnPropertyDescriptors(source)):ownKeys(Object(source)).forEach(function(key){Object.defineProperty(target,key,Object.getOwnPropertyDescriptor(source,key));});}return target;}function _defineProperty(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true});}else{obj[key]=value;}return obj;}function _toConsumableArray(arr){return _arrayWithoutHoles(arr)||_iterableToArray(arr)||_unsupportedIterableToArray(arr)||_nonIterableSpread();}function _nonIterableSpread(){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 _iterableToArray(iter){if(typeof Symbol!=="undefined"&&iter[Symbol.iterator]!=null||iter["@@iterator"]!=null)return Array.from(iter);}function _arrayWithoutHoles(arr){if(Array.isArray(arr))return _arrayLikeToArray(arr);}function _get(){if(typeof Reflect!=="undefined"&&Reflect.get){_get=Reflect.get.bind();}else{_get=function _get(target,property,receiver){var base=_superPropBase(target,property);if(!base)return;var desc=Object.getOwnPropertyDescriptor(base,property);if(desc.get){return desc.get.call(arguments.length<3?target:receiver);}return desc.value;};}return _get.apply(this,arguments);}function _superPropBase(object,property){while(!Object.prototype.hasOwnProperty.call(object,property)){object=_getPrototypeOf(object);if(object===null)break;}return object;}function _inherits(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function");}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,writable:true,configurable:true}});Object.defineProperty(subClass,"prototype",{writable:false});if(superClass)_setPrototypeOf(subClass,superClass);}function _setPrototypeOf(o,p){_setPrototypeOf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function _setPrototypeOf(o,p){o.__proto__=p;return o;};return _setPrototypeOf(o,p);}function _createSuper(Derived){var hasNativeReflectConstruct=_isNativeReflectConstruct();return function _createSuperInternal(){var Super=_getPrototypeOf(Derived),result;if(hasNativeReflectConstruct){var NewTarget=_getPrototypeOf(this).constructor;result=Reflect.construct(Super,arguments,NewTarget);}else{result=Super.apply(this,arguments);}return _possibleConstructorReturn(this,result);};}function _possibleConstructorReturn(self,call){if(call&&(_typeof(call)==="object"||typeof call==="function")){return call;}else if(call!==void 0){throw new TypeError("Derived constructors may only return object or undefined");}return _assertThisInitialized(self);}function _assertThisInitialized(self){if(self===void 0){throw new ReferenceError("this hasn't been initialised - super() hasn't been called");}return self;}function _isNativeReflectConstruct(){if(typeof Reflect==="undefined"||!Reflect.construct)return false;if(Reflect.construct.sham)return false;if(typeof Proxy==="function")return true;try{Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}));return true;}catch(e){return false;}}function _getPrototypeOf(o){_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function _getPrototypeOf(o){return o.__proto__||Object.getPrototypeOf(o);};return _getPrototypeOf(o);}function _typeof(obj){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj;}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj;},_typeof(obj);}function _slicedToArray(arr,i){return _arrayWithHoles(arr)||_iterableToArrayLimit(arr,i)||_unsupportedIterableToArray(arr,i)||_nonIterableRest();}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");}function _unsupportedIterableToArray(o,minLen){if(!o)return;if(typeof o==="string")return _arrayLikeToArray(o,minLen);var n=Object.prototype.toString.call(o).slice(8,-1);if(n==="Object"&&o.constructor)n=o.constructor.name;if(n==="Map"||n==="Set")return Array.from(o);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return _arrayLikeToArray(o,minLen);}function _arrayLikeToArray(arr,len){if(len==null||len>arr.length)len=arr.length;for(var i=0,arr2=new Array(len);i<len;i++){arr2[i]=arr[i];}return arr2;}function _iterableToArrayLimit(arr,i){var _i=arr==null?null:typeof Symbol!=="undefined"&&arr[Symbol.iterator]||arr["@@iterator"];if(_i==null)return;var _arr=[];var _n=true;var _d=false;var _s,_e;try{for(_i=_i.call(arr);!(_n=(_s=_i.next()).done);_n=true){_arr.push(_s.value);if(i&&_arr.length===i)break;}}catch(err){_d=true;_e=err;}finally{try{if(!_n&&_i["return"]!=null)_i["return"]();}finally{if(_d)throw _e;}}return _arr;}function _arrayWithHoles(arr){if(Array.isArray(arr))return arr;}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function");}}function _defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if("value"in descriptor)descriptor.writable=true;Object.defineProperty(target,descriptor.key,descriptor);}}function _createClass(Constructor,protoProps,staticProps){if(protoProps)_defineProperties(Constructor.prototype,protoProps);if(staticProps)_defineProperties(Constructor,staticProps);Object.defineProperty(Constructor,"prototype",{writable:false});return Constructor;}function _awaitAsyncGenerator(value){return new _AwaitValue(value);}function _wrapAsyncGenerator(fn){return function(){return new _AsyncGenerator(fn.apply(this,arguments));};}function _AsyncGenerator(gen){var front,back;function send(key,arg){return new Promise(function(resolve,reject){var request={key:key,arg:arg,resolve:resolve,reject:reject,next:null};if(back){back=back.next=request;}else{front=back=request;resume(key,arg);}});}function resume(key,arg){try{var result=gen[key](arg);var value=result.value;var wrappedAwait=value instanceof _AwaitValue;Promise.resolve(wrappedAwait?value.wrapped:value).then(function(arg){if(wrappedAwait){resume(key==="return"?"return":"next",arg);return;}settle(result.done?"return":"normal",arg);},function(err){resume("throw",err);});}catch(err){settle("throw",err);}}function settle(type,value){switch(type){case"return":front.resolve({value:value,done:true});break;case"throw":front.reject(value);break;default:front.resolve({value:value,done:false});break;}front=front.next;if(front){resume(front.key,front.arg);}else{back=null;}}this._invoke=send;if(typeof gen["return"]!=="function"){this["return"]=undefined;}}_AsyncGenerator.prototype[typeof Symbol==="function"&&Symbol.asyncIterator||"@@asyncIterator"]=function(){return this;};_AsyncGenerator.prototype.next=function(arg){return this._invoke("next",arg);};_AsyncGenerator.prototype["throw"]=function(arg){return this._invoke("throw",arg);};_AsyncGenerator.prototype["return"]=function(arg){return this._invoke("return",arg);};function _AwaitValue(value){this.wrapped=value;}function _asyncIterator(iterable){var method,async,sync,retry=2;for("undefined"!=typeof Symbol&&(async=Symbol.asyncIterator,sync=Symbol.iterator);retry--;){if(async&&null!=(method=iterable[async]))return method.call(iterable);if(sync&&null!=(method=iterable[sync]))return new AsyncFromSyncIterator(method.call(iterable));async="@@asyncIterator",sync="@@iterator";}throw new TypeError("Object is not async iterable");}function AsyncFromSyncIterator(s){function AsyncFromSyncIteratorContinuation(r){if(Object(r)!==r)return Promise.reject(new TypeError(r+" is not an object."));var done=r.done;return Promise.resolve(r.value).then(function(value){return{value:value,done:done};});}return AsyncFromSyncIterator=function AsyncFromSyncIterator(s){this.s=s,this.n=s.next;},AsyncFromSyncIterator.prototype={s:null,n:null,next:function next(){return AsyncFromSyncIteratorContinuation(this.n.apply(this.s,arguments));},"return":function _return(value){var ret=this.s["return"];return void 0===ret?Promise.resolve({value:value,done:!0}):AsyncFromSyncIteratorContinuation(ret.apply(this.s,arguments));},"throw":function _throw(value){var thr=this.s["return"];return void 0===thr?Promise.reject(value):AsyncFromSyncIteratorContinuation(thr.apply(this.s,arguments));}},new AsyncFromSyncIterator(s);}if(typeof window!=='undefined'){window.__XEOKIT__={version:'2.6.96',commit:'c76eb4c08555d55fdd54313f5fb25481d28d1150',built:'2025-12-02T12:22:54.826Z'};}/** @private */var Map$1=/*#__PURE__*/function(){function Map$1(items,baseId){_classCallCheck(this,Map$1);this.items=items||[];this._lastUniqueId=(baseId||0)+1;}/**
7
+ var _globalThis$loaders3,_DRACO_EXTERNAL_LIBRA,_DEFAULT_SAMPLER_PARA;var _marked=/*#__PURE__*/_regeneratorRuntime().mark(makeStringIterator),_marked2=/*#__PURE__*/_regeneratorRuntime().mark(makeArrayBufferIterator),_marked3=/*#__PURE__*/_regeneratorRuntime().mark(makeMeshPrimitiveIterator);function _wrapNativeSuper(Class){var _cache=typeof Map==="function"?new Map():undefined;_wrapNativeSuper=function _wrapNativeSuper(Class){if(Class===null||!_isNativeFunction(Class))return Class;if(typeof Class!=="function"){throw new TypeError("Super expression must either be null or a function");}if(typeof _cache!=="undefined"){if(_cache.has(Class))return _cache.get(Class);_cache.set(Class,Wrapper);}function Wrapper(){return _construct(Class,arguments,_getPrototypeOf(this).constructor);}Wrapper.prototype=Object.create(Class.prototype,{constructor:{value:Wrapper,enumerable:false,writable:true,configurable:true}});return _setPrototypeOf(Wrapper,Class);};return _wrapNativeSuper(Class);}function _construct(Parent,args,Class){if(_isNativeReflectConstruct()){_construct=Reflect.construct.bind();}else{_construct=function _construct(Parent,args,Class){var a=[null];a.push.apply(a,args);var Constructor=Function.bind.apply(Parent,a);var instance=new Constructor();if(Class)_setPrototypeOf(instance,Class.prototype);return instance;};}return _construct.apply(null,arguments);}function _isNativeFunction(fn){return Function.toString.call(fn).indexOf("[native code]")!==-1;}function _regeneratorRuntime(){"use strict";/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */_regeneratorRuntime=function _regeneratorRuntime(){return exports;};var exports={},Op=Object.prototype,hasOwn=Op.hasOwnProperty,$Symbol="function"==typeof Symbol?Symbol:{},iteratorSymbol=$Symbol.iterator||"@@iterator",asyncIteratorSymbol=$Symbol.asyncIterator||"@@asyncIterator",toStringTagSymbol=$Symbol.toStringTag||"@@toStringTag";function define(obj,key,value){return Object.defineProperty(obj,key,{value:value,enumerable:!0,configurable:!0,writable:!0}),obj[key];}try{define({},"");}catch(err){define=function define(obj,key,value){return obj[key]=value;};}function wrap(innerFn,outerFn,self,tryLocsList){var protoGenerator=outerFn&&outerFn.prototype instanceof Generator?outerFn:Generator,generator=Object.create(protoGenerator.prototype),context=new Context(tryLocsList||[]);return generator._invoke=function(innerFn,self,context){var state="suspendedStart";return function(method,arg){if("executing"===state)throw new Error("Generator is already running");if("completed"===state){if("throw"===method)throw arg;return doneResult();}for(context.method=method,context.arg=arg;;){var delegate=context.delegate;if(delegate){var delegateResult=maybeInvokeDelegate(delegate,context);if(delegateResult){if(delegateResult===ContinueSentinel)continue;return delegateResult;}}if("next"===context.method)context.sent=context._sent=context.arg;else if("throw"===context.method){if("suspendedStart"===state)throw state="completed",context.arg;context.dispatchException(context.arg);}else"return"===context.method&&context.abrupt("return",context.arg);state="executing";var record=tryCatch(innerFn,self,context);if("normal"===record.type){if(state=context.done?"completed":"suspendedYield",record.arg===ContinueSentinel)continue;return{value:record.arg,done:context.done};}"throw"===record.type&&(state="completed",context.method="throw",context.arg=record.arg);}};}(innerFn,self,context),generator;}function tryCatch(fn,obj,arg){try{return{type:"normal",arg:fn.call(obj,arg)};}catch(err){return{type:"throw",arg:err};}}exports.wrap=wrap;var ContinueSentinel={};function Generator(){}function GeneratorFunction(){}function GeneratorFunctionPrototype(){}var IteratorPrototype={};define(IteratorPrototype,iteratorSymbol,function(){return this;});var getProto=Object.getPrototypeOf,NativeIteratorPrototype=getProto&&getProto(getProto(values([])));NativeIteratorPrototype&&NativeIteratorPrototype!==Op&&hasOwn.call(NativeIteratorPrototype,iteratorSymbol)&&(IteratorPrototype=NativeIteratorPrototype);var Gp=GeneratorFunctionPrototype.prototype=Generator.prototype=Object.create(IteratorPrototype);function defineIteratorMethods(prototype){["next","throw","return"].forEach(function(method){define(prototype,method,function(arg){return this._invoke(method,arg);});});}function AsyncIterator(generator,PromiseImpl){function invoke(method,arg,resolve,reject){var record=tryCatch(generator[method],generator,arg);if("throw"!==record.type){var result=record.arg,value=result.value;return value&&"object"==_typeof(value)&&hasOwn.call(value,"__await")?PromiseImpl.resolve(value.__await).then(function(value){invoke("next",value,resolve,reject);},function(err){invoke("throw",err,resolve,reject);}):PromiseImpl.resolve(value).then(function(unwrapped){result.value=unwrapped,resolve(result);},function(error){return invoke("throw",error,resolve,reject);});}reject(record.arg);}var previousPromise;this._invoke=function(method,arg){function callInvokeWithMethodAndArg(){return new PromiseImpl(function(resolve,reject){invoke(method,arg,resolve,reject);});}return previousPromise=previousPromise?previousPromise.then(callInvokeWithMethodAndArg,callInvokeWithMethodAndArg):callInvokeWithMethodAndArg();};}function maybeInvokeDelegate(delegate,context){var method=delegate.iterator[context.method];if(undefined===method){if(context.delegate=null,"throw"===context.method){if(delegate.iterator["return"]&&(context.method="return",context.arg=undefined,maybeInvokeDelegate(delegate,context),"throw"===context.method))return ContinueSentinel;context.method="throw",context.arg=new TypeError("The iterator does not provide a 'throw' method");}return ContinueSentinel;}var record=tryCatch(method,delegate.iterator,context.arg);if("throw"===record.type)return context.method="throw",context.arg=record.arg,context.delegate=null,ContinueSentinel;var info=record.arg;return info?info.done?(context[delegate.resultName]=info.value,context.next=delegate.nextLoc,"return"!==context.method&&(context.method="next",context.arg=undefined),context.delegate=null,ContinueSentinel):info:(context.method="throw",context.arg=new TypeError("iterator result is not an object"),context.delegate=null,ContinueSentinel);}function pushTryEntry(locs){var entry={tryLoc:locs[0]};1 in locs&&(entry.catchLoc=locs[1]),2 in locs&&(entry.finallyLoc=locs[2],entry.afterLoc=locs[3]),this.tryEntries.push(entry);}function resetTryEntry(entry){var record=entry.completion||{};record.type="normal",delete record.arg,entry.completion=record;}function Context(tryLocsList){this.tryEntries=[{tryLoc:"root"}],tryLocsList.forEach(pushTryEntry,this),this.reset(!0);}function values(iterable){if(iterable){var iteratorMethod=iterable[iteratorSymbol];if(iteratorMethod)return iteratorMethod.call(iterable);if("function"==typeof iterable.next)return iterable;if(!isNaN(iterable.length)){var i=-1,next=function next(){for(;++i<iterable.length;){if(hasOwn.call(iterable,i))return next.value=iterable[i],next.done=!1,next;}return next.value=undefined,next.done=!0,next;};return next.next=next;}}return{next:doneResult};}function doneResult(){return{value:undefined,done:!0};}return GeneratorFunction.prototype=GeneratorFunctionPrototype,define(Gp,"constructor",GeneratorFunctionPrototype),define(GeneratorFunctionPrototype,"constructor",GeneratorFunction),GeneratorFunction.displayName=define(GeneratorFunctionPrototype,toStringTagSymbol,"GeneratorFunction"),exports.isGeneratorFunction=function(genFun){var ctor="function"==typeof genFun&&genFun.constructor;return!!ctor&&(ctor===GeneratorFunction||"GeneratorFunction"===(ctor.displayName||ctor.name));},exports.mark=function(genFun){return Object.setPrototypeOf?Object.setPrototypeOf(genFun,GeneratorFunctionPrototype):(genFun.__proto__=GeneratorFunctionPrototype,define(genFun,toStringTagSymbol,"GeneratorFunction")),genFun.prototype=Object.create(Gp),genFun;},exports.awrap=function(arg){return{__await:arg};},defineIteratorMethods(AsyncIterator.prototype),define(AsyncIterator.prototype,asyncIteratorSymbol,function(){return this;}),exports.AsyncIterator=AsyncIterator,exports.async=function(innerFn,outerFn,self,tryLocsList,PromiseImpl){void 0===PromiseImpl&&(PromiseImpl=Promise);var iter=new AsyncIterator(wrap(innerFn,outerFn,self,tryLocsList),PromiseImpl);return exports.isGeneratorFunction(outerFn)?iter:iter.next().then(function(result){return result.done?result.value:iter.next();});},defineIteratorMethods(Gp),define(Gp,toStringTagSymbol,"Generator"),define(Gp,iteratorSymbol,function(){return this;}),define(Gp,"toString",function(){return"[object Generator]";}),exports.keys=function(object){var keys=[];for(var key in object){keys.push(key);}return keys.reverse(),function next(){for(;keys.length;){var key=keys.pop();if(key in object)return next.value=key,next.done=!1,next;}return next.done=!0,next;};},exports.values=values,Context.prototype={constructor:Context,reset:function reset(skipTempReset){if(this.prev=0,this.next=0,this.sent=this._sent=undefined,this.done=!1,this.delegate=null,this.method="next",this.arg=undefined,this.tryEntries.forEach(resetTryEntry),!skipTempReset)for(var name in this){"t"===name.charAt(0)&&hasOwn.call(this,name)&&!isNaN(+name.slice(1))&&(this[name]=undefined);}},stop:function stop(){this.done=!0;var rootRecord=this.tryEntries[0].completion;if("throw"===rootRecord.type)throw rootRecord.arg;return this.rval;},dispatchException:function dispatchException(exception){if(this.done)throw exception;var context=this;function handle(loc,caught){return record.type="throw",record.arg=exception,context.next=loc,caught&&(context.method="next",context.arg=undefined),!!caught;}for(var i=this.tryEntries.length-1;i>=0;--i){var entry=this.tryEntries[i],record=entry.completion;if("root"===entry.tryLoc)return handle("end");if(entry.tryLoc<=this.prev){var hasCatch=hasOwn.call(entry,"catchLoc"),hasFinally=hasOwn.call(entry,"finallyLoc");if(hasCatch&&hasFinally){if(this.prev<entry.catchLoc)return handle(entry.catchLoc,!0);if(this.prev<entry.finallyLoc)return handle(entry.finallyLoc);}else if(hasCatch){if(this.prev<entry.catchLoc)return handle(entry.catchLoc,!0);}else{if(!hasFinally)throw new Error("try statement without catch or finally");if(this.prev<entry.finallyLoc)return handle(entry.finallyLoc);}}}},abrupt:function abrupt(type,arg){for(var i=this.tryEntries.length-1;i>=0;--i){var entry=this.tryEntries[i];if(entry.tryLoc<=this.prev&&hasOwn.call(entry,"finallyLoc")&&this.prev<entry.finallyLoc){var finallyEntry=entry;break;}}finallyEntry&&("break"===type||"continue"===type)&&finallyEntry.tryLoc<=arg&&arg<=finallyEntry.finallyLoc&&(finallyEntry=null);var record=finallyEntry?finallyEntry.completion:{};return record.type=type,record.arg=arg,finallyEntry?(this.method="next",this.next=finallyEntry.finallyLoc,ContinueSentinel):this.complete(record);},complete:function complete(record,afterLoc){if("throw"===record.type)throw record.arg;return"break"===record.type||"continue"===record.type?this.next=record.arg:"return"===record.type?(this.rval=this.arg=record.arg,this.method="return",this.next="end"):"normal"===record.type&&afterLoc&&(this.next=afterLoc),ContinueSentinel;},finish:function finish(finallyLoc){for(var i=this.tryEntries.length-1;i>=0;--i){var entry=this.tryEntries[i];if(entry.finallyLoc===finallyLoc)return this.complete(entry.completion,entry.afterLoc),resetTryEntry(entry),ContinueSentinel;}},"catch":function _catch(tryLoc){for(var i=this.tryEntries.length-1;i>=0;--i){var entry=this.tryEntries[i];if(entry.tryLoc===tryLoc){var record=entry.completion;if("throw"===record.type){var thrown=record.arg;resetTryEntry(entry);}return thrown;}}throw new Error("illegal catch attempt");},delegateYield:function delegateYield(iterable,resultName,nextLoc){return this.delegate={iterator:values(iterable),resultName:resultName,nextLoc:nextLoc},"next"===this.method&&(this.arg=undefined),ContinueSentinel;}},exports;}function asyncGeneratorStep(gen,resolve,reject,_next,_throw,key,arg){try{var info=gen[key](arg);var value=info.value;}catch(error){reject(error);return;}if(info.done){resolve(value);}else{Promise.resolve(value).then(_next,_throw);}}function _asyncToGenerator(fn){return function(){var self=this,args=arguments;return new Promise(function(resolve,reject){var gen=fn.apply(self,args);function _next(value){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"next",value);}function _throw(err){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"throw",err);}_next(undefined);});};}function _createForOfIteratorHelper(o,allowArrayLike){var it=typeof Symbol!=="undefined"&&o[Symbol.iterator]||o["@@iterator"];if(!it){if(Array.isArray(o)||(it=_unsupportedIterableToArray(o))||allowArrayLike&&o&&typeof o.length==="number"){if(it)o=it;var i=0;var F=function F(){};return{s:F,n:function n(){if(i>=o.length)return{done:true};return{done:false,value:o[i++]};},e:function e(_e14){throw _e14;},f:F};}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 normalCompletion=true,didErr=false,err;return{s:function s(){it=it.call(o);},n:function n(){var step=it.next();normalCompletion=step.done;return step;},e:function e(_e15){didErr=true;err=_e15;},f:function f(){try{if(!normalCompletion&&it["return"]!=null)it["return"]();}finally{if(didErr)throw err;}}};}function ownKeys(object,enumerableOnly){var keys=Object.keys(object);if(Object.getOwnPropertySymbols){var symbols=Object.getOwnPropertySymbols(object);enumerableOnly&&(symbols=symbols.filter(function(sym){return Object.getOwnPropertyDescriptor(object,sym).enumerable;})),keys.push.apply(keys,symbols);}return keys;}function _objectSpread(target){for(var i=1;i<arguments.length;i++){var source=null!=arguments[i]?arguments[i]:{};i%2?ownKeys(Object(source),!0).forEach(function(key){_defineProperty(target,key,source[key]);}):Object.getOwnPropertyDescriptors?Object.defineProperties(target,Object.getOwnPropertyDescriptors(source)):ownKeys(Object(source)).forEach(function(key){Object.defineProperty(target,key,Object.getOwnPropertyDescriptor(source,key));});}return target;}function _defineProperty(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true});}else{obj[key]=value;}return obj;}function _toConsumableArray(arr){return _arrayWithoutHoles(arr)||_iterableToArray(arr)||_unsupportedIterableToArray(arr)||_nonIterableSpread();}function _nonIterableSpread(){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 _iterableToArray(iter){if(typeof Symbol!=="undefined"&&iter[Symbol.iterator]!=null||iter["@@iterator"]!=null)return Array.from(iter);}function _arrayWithoutHoles(arr){if(Array.isArray(arr))return _arrayLikeToArray(arr);}function _get(){if(typeof Reflect!=="undefined"&&Reflect.get){_get=Reflect.get.bind();}else{_get=function _get(target,property,receiver){var base=_superPropBase(target,property);if(!base)return;var desc=Object.getOwnPropertyDescriptor(base,property);if(desc.get){return desc.get.call(arguments.length<3?target:receiver);}return desc.value;};}return _get.apply(this,arguments);}function _superPropBase(object,property){while(!Object.prototype.hasOwnProperty.call(object,property)){object=_getPrototypeOf(object);if(object===null)break;}return object;}function _inherits(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function");}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,writable:true,configurable:true}});Object.defineProperty(subClass,"prototype",{writable:false});if(superClass)_setPrototypeOf(subClass,superClass);}function _setPrototypeOf(o,p){_setPrototypeOf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function _setPrototypeOf(o,p){o.__proto__=p;return o;};return _setPrototypeOf(o,p);}function _createSuper(Derived){var hasNativeReflectConstruct=_isNativeReflectConstruct();return function _createSuperInternal(){var Super=_getPrototypeOf(Derived),result;if(hasNativeReflectConstruct){var NewTarget=_getPrototypeOf(this).constructor;result=Reflect.construct(Super,arguments,NewTarget);}else{result=Super.apply(this,arguments);}return _possibleConstructorReturn(this,result);};}function _possibleConstructorReturn(self,call){if(call&&(_typeof(call)==="object"||typeof call==="function")){return call;}else if(call!==void 0){throw new TypeError("Derived constructors may only return object or undefined");}return _assertThisInitialized(self);}function _assertThisInitialized(self){if(self===void 0){throw new ReferenceError("this hasn't been initialised - super() hasn't been called");}return self;}function _isNativeReflectConstruct(){if(typeof Reflect==="undefined"||!Reflect.construct)return false;if(Reflect.construct.sham)return false;if(typeof Proxy==="function")return true;try{Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}));return true;}catch(e){return false;}}function _getPrototypeOf(o){_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function _getPrototypeOf(o){return o.__proto__||Object.getPrototypeOf(o);};return _getPrototypeOf(o);}function _typeof(obj){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj;}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj;},_typeof(obj);}function _slicedToArray(arr,i){return _arrayWithHoles(arr)||_iterableToArrayLimit(arr,i)||_unsupportedIterableToArray(arr,i)||_nonIterableRest();}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");}function _unsupportedIterableToArray(o,minLen){if(!o)return;if(typeof o==="string")return _arrayLikeToArray(o,minLen);var n=Object.prototype.toString.call(o).slice(8,-1);if(n==="Object"&&o.constructor)n=o.constructor.name;if(n==="Map"||n==="Set")return Array.from(o);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return _arrayLikeToArray(o,minLen);}function _arrayLikeToArray(arr,len){if(len==null||len>arr.length)len=arr.length;for(var i=0,arr2=new Array(len);i<len;i++){arr2[i]=arr[i];}return arr2;}function _iterableToArrayLimit(arr,i){var _i=arr==null?null:typeof Symbol!=="undefined"&&arr[Symbol.iterator]||arr["@@iterator"];if(_i==null)return;var _arr=[];var _n=true;var _d=false;var _s,_e;try{for(_i=_i.call(arr);!(_n=(_s=_i.next()).done);_n=true){_arr.push(_s.value);if(i&&_arr.length===i)break;}}catch(err){_d=true;_e=err;}finally{try{if(!_n&&_i["return"]!=null)_i["return"]();}finally{if(_d)throw _e;}}return _arr;}function _arrayWithHoles(arr){if(Array.isArray(arr))return arr;}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function");}}function _defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if("value"in descriptor)descriptor.writable=true;Object.defineProperty(target,descriptor.key,descriptor);}}function _createClass(Constructor,protoProps,staticProps){if(protoProps)_defineProperties(Constructor.prototype,protoProps);if(staticProps)_defineProperties(Constructor,staticProps);Object.defineProperty(Constructor,"prototype",{writable:false});return Constructor;}function _awaitAsyncGenerator(value){return new _AwaitValue(value);}function _wrapAsyncGenerator(fn){return function(){return new _AsyncGenerator(fn.apply(this,arguments));};}function _AsyncGenerator(gen){var front,back;function send(key,arg){return new Promise(function(resolve,reject){var request={key:key,arg:arg,resolve:resolve,reject:reject,next:null};if(back){back=back.next=request;}else{front=back=request;resume(key,arg);}});}function resume(key,arg){try{var result=gen[key](arg);var value=result.value;var wrappedAwait=value instanceof _AwaitValue;Promise.resolve(wrappedAwait?value.wrapped:value).then(function(arg){if(wrappedAwait){resume(key==="return"?"return":"next",arg);return;}settle(result.done?"return":"normal",arg);},function(err){resume("throw",err);});}catch(err){settle("throw",err);}}function settle(type,value){switch(type){case"return":front.resolve({value:value,done:true});break;case"throw":front.reject(value);break;default:front.resolve({value:value,done:false});break;}front=front.next;if(front){resume(front.key,front.arg);}else{back=null;}}this._invoke=send;if(typeof gen["return"]!=="function"){this["return"]=undefined;}}_AsyncGenerator.prototype[typeof Symbol==="function"&&Symbol.asyncIterator||"@@asyncIterator"]=function(){return this;};_AsyncGenerator.prototype.next=function(arg){return this._invoke("next",arg);};_AsyncGenerator.prototype["throw"]=function(arg){return this._invoke("throw",arg);};_AsyncGenerator.prototype["return"]=function(arg){return this._invoke("return",arg);};function _AwaitValue(value){this.wrapped=value;}function _asyncIterator(iterable){var method,async,sync,retry=2;for("undefined"!=typeof Symbol&&(async=Symbol.asyncIterator,sync=Symbol.iterator);retry--;){if(async&&null!=(method=iterable[async]))return method.call(iterable);if(sync&&null!=(method=iterable[sync]))return new AsyncFromSyncIterator(method.call(iterable));async="@@asyncIterator",sync="@@iterator";}throw new TypeError("Object is not async iterable");}function AsyncFromSyncIterator(s){function AsyncFromSyncIteratorContinuation(r){if(Object(r)!==r)return Promise.reject(new TypeError(r+" is not an object."));var done=r.done;return Promise.resolve(r.value).then(function(value){return{value:value,done:done};});}return AsyncFromSyncIterator=function AsyncFromSyncIterator(s){this.s=s,this.n=s.next;},AsyncFromSyncIterator.prototype={s:null,n:null,next:function next(){return AsyncFromSyncIteratorContinuation(this.n.apply(this.s,arguments));},"return":function _return(value){var ret=this.s["return"];return void 0===ret?Promise.resolve({value:value,done:!0}):AsyncFromSyncIteratorContinuation(ret.apply(this.s,arguments));},"throw":function _throw(value){var thr=this.s["return"];return void 0===thr?Promise.reject(value):AsyncFromSyncIteratorContinuation(thr.apply(this.s,arguments));}},new AsyncFromSyncIterator(s);}if(typeof window!=='undefined'){window.__XEOKIT__={version:'2.6.98',commit:'30ac0fa9a4eaf6759fe306bb2e332cce49884787',built:'2025-12-08T14:33:34.719Z'};}/** @private */var Map$1=/*#__PURE__*/function(){function Map$1(items,baseId){_classCallCheck(this,Map$1);this.items=items||[];this._lastUniqueId=(baseId||0)+1;}/**
8
8
  * Usage:
9
9
  *
10
10
  * id = myMap.addItem("foo") // ID internally generated
@@ -545,7 +545,7 @@ next:null,z:0,// z-order curve value
545
545
  prevZ:null,// previous and next nodes in z-order
546
546
  nextZ:null,steiner:false// indicates whether this is a steiner point
547
547
  };}function signedArea(data,start,end,dim){var sum=0;for(var _i17=start,j=end-dim;_i17<end;_i17+=dim){sum+=(data[j]-data[_i17])*(data[_i17+1]+data[j+1]);j=_i17;}return sum;}// Some temporary vars to help avoid garbage collection
548
- var doublePrecision=true;var FloatArrayType=doublePrecision?Float64Array:Float32Array;var tempVec3a$j=new FloatArrayType(3);var tempMat1=new FloatArrayType(16);var tempMat2=new FloatArrayType(16);var tempVec4$3=new FloatArrayType(4);/**
548
+ var doublePrecision=true;var FloatArrayType=doublePrecision?Float64Array:Float32Array;var tempVec3a$j=new FloatArrayType(3);var tempMat1=new FloatArrayType(16);var tempMat2=new FloatArrayType(16);var tempVec4$4=new FloatArrayType(4);/**
549
549
  * @private
550
550
  */var math={setDoublePrecisionEnabled:function setDoublePrecisionEnabled(enable){doublePrecision=enable;FloatArrayType=doublePrecision?Float64Array:Float32Array;},getDoublePrecisionEnabled:function getDoublePrecisionEnabled(){return doublePrecision;},MIN_DOUBLE:-Number.MAX_SAFE_INTEGER,MAX_DOUBLE:Number.MAX_SAFE_INTEGER,MAX_INT:10000000,/**
551
551
  * The number of radiians in a degree (0.0174532925).
@@ -1115,7 +1115,7 @@ xy=x*y;yz=y*z;zx=z*x;xs=x*s;ys=y*s;zs=z*s;m=m||math.mat4();m[0]=q*x*x+c;m[1]=q*x
1115
1115
  * @param {Number[]} [dest] Destination Euler angles, created by default.
1116
1116
  * @returns {Number[]} The Euler angles (in degrees).
1117
1117
  */mat4ToEuler:function mat4ToEuler(mat,order){var dest=arguments.length>2&&arguments[2]!==undefined?arguments[2]:math.vec4();var clamp=math.clamp;// Assumes the upper 3x3 of m is a pure rotation matrix (i.e, unscaled)
1118
- var m11=mat[0];var m12=mat[4];var m13=mat[8];var m21=mat[1];var m22=mat[5];var m23=mat[9];var m31=mat[2];var m32=mat[6];var m33=mat[10];if(order==='XYZ'){dest[1]=Math.asin(clamp(m13,-1,1));if(Math.abs(m13)<0.99999){dest[0]=Math.atan2(-m23,m33);dest[2]=Math.atan2(-m12,m11);}else{dest[0]=Math.atan2(m32,m22);dest[2]=0;}}else if(order==='YXZ'){dest[0]=Math.asin(-clamp(m23,-1,1));if(Math.abs(m23)<0.99999){dest[1]=Math.atan2(m13,m33);dest[2]=Math.atan2(m21,m22);}else{dest[1]=Math.atan2(-m31,m11);dest[2]=0;}}else if(order==='ZXY'){dest[0]=Math.asin(clamp(m32,-1,1));if(Math.abs(m32)<0.99999){dest[1]=Math.atan2(-m31,m33);dest[2]=Math.atan2(-m12,m22);}else{dest[1]=0;dest[2]=Math.atan2(m21,m11);}}else if(order==='ZYX'){dest[1]=Math.asin(-clamp(m31,-1,1));if(Math.abs(m31)<0.99999){dest[0]=Math.atan2(m32,m33);dest[2]=Math.atan2(m21,m11);}else{dest[0]=0;dest[2]=Math.atan2(-m12,m22);}}else if(order==='YZX'){dest[2]=Math.asin(clamp(m21,-1,1));if(Math.abs(m21)<0.99999){dest[0]=Math.atan2(-m23,m22);dest[1]=Math.atan2(-m31,m11);}else{dest[0]=0;dest[1]=Math.atan2(m13,m33);}}else if(order==='XZY'){dest[2]=Math.asin(-clamp(m12,-1,1));if(Math.abs(m12)<0.99999){dest[0]=Math.atan2(m32,m22);dest[1]=Math.atan2(m13,m11);}else{dest[0]=Math.atan2(-m23,m33);dest[1]=0;}}dest[0]*=math.RADTODEG;dest[1]*=math.RADTODEG;dest[2]*=math.RADTODEG;return dest;},composeMat4:function composeMat4(position,quaternion,scale){var mat=arguments.length>3&&arguments[3]!==undefined?arguments[3]:math.mat4();math.quaternionToRotationMat4(quaternion,mat);math.scaleMat4v(scale,mat);math.translateMat4v(position,mat);return mat;},decomposeMat4:function(){var vec=new FloatArrayType(3);var matrix=new FloatArrayType(16);return function decompose(mat,position,quaternion,scale){vec[0]=mat[0];vec[1]=mat[1];vec[2]=mat[2];var sx=math.lenVec3(vec);vec[0]=mat[4];vec[1]=mat[5];vec[2]=mat[6];var sy=math.lenVec3(vec);vec[8]=mat[8];vec[9]=mat[9];vec[10]=mat[10];var sz=math.lenVec3(vec);// if determine is negative, we need to invert one scale
1118
+ var m11=mat[0];var m12=mat[4];var m13=mat[8];var m21=mat[1];var m22=mat[5];var m23=mat[9];var m31=mat[2];var m32=mat[6];var m33=mat[10];if(order==='XYZ'){dest[1]=Math.asin(clamp(m13,-1,1));if(Math.abs(m13)<0.99999){dest[0]=Math.atan2(-m23,m33);dest[2]=Math.atan2(-m12,m11);}else{dest[0]=Math.atan2(m32,m22);dest[2]=0;}}else if(order==='YXZ'){dest[0]=Math.asin(-clamp(m23,-1,1));if(Math.abs(m23)<0.99999){dest[1]=Math.atan2(m13,m33);dest[2]=Math.atan2(m21,m22);}else{dest[1]=Math.atan2(-m31,m11);dest[2]=0;}}else if(order==='ZXY'){dest[0]=Math.asin(clamp(m32,-1,1));if(Math.abs(m32)<0.99999){dest[1]=Math.atan2(-m31,m33);dest[2]=Math.atan2(-m12,m22);}else{dest[1]=0;dest[2]=Math.atan2(m21,m11);}}else if(order==='ZYX'){dest[1]=Math.asin(-clamp(m31,-1,1));if(Math.abs(m31)<0.99999){dest[0]=Math.atan2(m32,m33);dest[2]=Math.atan2(m21,m11);}else{dest[0]=0;dest[2]=Math.atan2(-m12,m22);}}else if(order==='YZX'){dest[2]=Math.asin(clamp(m21,-1,1));if(Math.abs(m21)<0.99999){dest[0]=Math.atan2(-m23,m22);dest[1]=Math.atan2(-m31,m11);}else{dest[0]=0;dest[1]=Math.atan2(m13,m33);}}else if(order==='XZY'){dest[2]=Math.asin(-clamp(m12,-1,1));if(Math.abs(m12)<0.99999){dest[0]=Math.atan2(m32,m22);dest[1]=Math.atan2(m13,m11);}else{dest[0]=Math.atan2(-m23,m33);dest[1]=0;}}dest[0]*=math.RADTODEG;dest[1]*=math.RADTODEG;dest[2]*=math.RADTODEG;return dest;},composeMat4:function composeMat4(position,quaternion,scale){var mat=arguments.length>3&&arguments[3]!==undefined?arguments[3]:math.mat4();math.quaternionToRotationMat4(quaternion,mat);math.scaleMat4v(scale,mat);math.translateMat4v(position,mat);return mat;},decomposeMat4:function(){var vec=new FloatArrayType(3);var matrix=new FloatArrayType(16);return function decompose(mat,position,quaternion,scale){vec[0]=mat[0];vec[1]=mat[1];vec[2]=mat[2];var sx=math.lenVec3(vec);vec[0]=mat[4];vec[1]=mat[5];vec[2]=mat[6];var sy=math.lenVec3(vec);vec[0]=mat[8];vec[1]=mat[9];vec[2]=mat[10];var sz=math.lenVec3(vec);// if determine is negative, we need to invert one scale
1119
1119
  var det=math.determinantMat4(mat);if(det<0){sx=-sx;}position[0]=mat[12];position[1]=mat[13];position[2]=mat[14];// scale the rotation part
1120
1120
  matrix.set(mat);var invSX=1/sx;var invSY=1/sy;var invSZ=1/sz;matrix[0]*=invSX;matrix[1]*=invSX;matrix[2]*=invSX;matrix[4]*=invSY;matrix[5]*=invSY;matrix[6]*=invSY;matrix[8]*=invSZ;matrix[9]*=invSZ;matrix[10]*=invSZ;math.mat4ToQuaternion(matrix,quaternion);scale[0]=sx;scale[1]=sy;scale[2]=sz;return this;};}(),/** @private */getColMat4:function getColMat4(mat,c){var i=c*4;return[mat[i],mat[i+1],mat[i+2],mat[i+3]];},/** @private */setRowMat4:function setRowMat4(mat,r,v){mat[r]=v[0];mat[r+4]=v[1];mat[r+8]=v[2];mat[r+12]=v[3];},/**
1121
1121
  * Returns a 4x4 'lookat' viewing transform matrix.
@@ -1286,7 +1286,7 @@ var q2=q[2];//z
1286
1286
  var q3=q[3];//w
1287
1287
  var tx=2.0*q0;var ty=2.0*q1;var tz=2.0*q2;var twx=tx*q3;var twy=ty*q3;var twz=tz*q3;var txx=tx*q0;var txy=ty*q0;var txz=tz*q0;var tyy=ty*q1;var tyz=tz*q1;var tzz=tz*q2;dest[0]=1.0-(tyy+tzz);dest[1]=txy+twz;dest[2]=txz-twy;dest[4]=txy-twz;dest[5]=1.0-(txx+tzz);dest[6]=tyz+twx;dest[8]=txz+twy;dest[9]=tyz-twx;dest[10]=1.0-(txx+tyy);return dest;},quaternionToRotationMat4:function quaternionToRotationMat4(q,m){var x=q[0];var y=q[1];var z=q[2];var w=q[3];var x2=x+x;var y2=y+y;var z2=z+z;var xx=x*x2;var xy=x*y2;var xz=x*z2;var yy=y*y2;var yz=y*z2;var zz=z*z2;var wx=w*x2;var wy=w*y2;var wz=w*z2;m[0]=1-(yy+zz);m[4]=xy-wz;m[8]=xz+wy;m[1]=xy+wz;m[5]=1-(xx+zz);m[9]=yz-wx;m[2]=xz-wy;m[6]=yz+wx;m[10]=1-(xx+yy);// last column
1288
1288
  m[3]=0;m[7]=0;m[11]=0;// bottom row
1289
- m[12]=0;m[13]=0;m[14]=0;m[15]=1;return m;},normalizeQuaternion:function normalizeQuaternion(q){var dest=arguments.length>1&&arguments[1]!==undefined?arguments[1]:q;var len=math.lenVec4([q[0],q[1],q[2],q[3]]);dest[0]=q[0]/len;dest[1]=q[1]/len;dest[2]=q[2]/len;dest[3]=q[3]/len;return dest;},conjugateQuaternion:function conjugateQuaternion(q){var dest=arguments.length>1&&arguments[1]!==undefined?arguments[1]:q;dest[0]=-q[0];dest[1]=-q[1];dest[2]=-q[2];dest[3]=q[3];return dest;},inverseQuaternion:function inverseQuaternion(q,dest){return math.normalizeQuaternion(math.conjugateQuaternion(q,dest));},quaternionToAngleAxis:function quaternionToAngleAxis(q){var angleAxis=arguments.length>1&&arguments[1]!==undefined?arguments[1]:math.vec4();q=math.normalizeQuaternion(q,tempVec4$3);var q3=q[3];var angle=2*Math.acos(q3);var s=Math.sqrt(1-q3*q3);if(s<0.001){// test to avoid divide by zero, s is always positive due to sqrt
1289
+ m[12]=0;m[13]=0;m[14]=0;m[15]=1;return m;},normalizeQuaternion:function normalizeQuaternion(q){var dest=arguments.length>1&&arguments[1]!==undefined?arguments[1]:q;var len=math.lenVec4([q[0],q[1],q[2],q[3]]);dest[0]=q[0]/len;dest[1]=q[1]/len;dest[2]=q[2]/len;dest[3]=q[3]/len;return dest;},conjugateQuaternion:function conjugateQuaternion(q){var dest=arguments.length>1&&arguments[1]!==undefined?arguments[1]:q;dest[0]=-q[0];dest[1]=-q[1];dest[2]=-q[2];dest[3]=q[3];return dest;},inverseQuaternion:function inverseQuaternion(q,dest){return math.normalizeQuaternion(math.conjugateQuaternion(q,dest));},quaternionToAngleAxis:function quaternionToAngleAxis(q){var angleAxis=arguments.length>1&&arguments[1]!==undefined?arguments[1]:math.vec4();q=math.normalizeQuaternion(q,tempVec4$4);var q3=q[3];var angle=2*Math.acos(q3);var s=Math.sqrt(1-q3*q3);if(s<0.001){// test to avoid divide by zero, s is always positive due to sqrt
1290
1290
  angleAxis[0]=q[0];angleAxis[1]=q[1];angleAxis[2]=q[2];}else{angleAxis[0]=q[0]/s;angleAxis[1]=q[1]/s;angleAxis[2]=q[2]/s;}angleAxis[3]=angle;// * 57.295779579;
1291
1291
  return angleAxis;},//------------------------------------------------------------------------------------------------------------------
1292
1292
  // Boundaries
@@ -2107,7 +2107,7 @@ return component;}},{key:"_checkComponent",value:function _checkComponent(expect
2107
2107
  */this.fire("destroyed",this.destroyed=true);// Must fire before we blow away subscription maps, below
2108
2108
  // Unsubscribe from child components and destroy then
2109
2109
  var id;var attachment;var component;var subs;var i;var len;if(this._attachments){for(id in this._attachments){if(this._attachments.hasOwnProperty(id)){attachment=this._attachments[id];component=attachment.component;subs=attachment.subs;for(i=0,len=subs.length;i<len;i++){component.off(subs[i]);}if(attachment.managingLifecycle){component.destroy();}}}}if(this._ownedComponents){for(id in this._ownedComponents){if(this._ownedComponents.hasOwnProperty(id)){component=this._ownedComponents[id];component.destroy();delete this._ownedComponents[id];}}}this.scene._removeComponent(this);// Memory leak avoidance
2110
- this._attached={};this._attachments=null;this._subIdMap=null;this._subIdEvents=null;this._eventSubs=null;this._events=null;this._eventCallDepth=0;this._ownedComponents=null;this._updateScheduled=false;}}]);return Component;}();var tempVec3a$i=math.vec3();var tempVec3b$b=math.vec3();var tempMat4a$1=math.mat4();/**
2110
+ this._attached={};this._attachments=null;this._subIdMap=null;this._subIdEvents=null;this._eventSubs=null;this._events=null;this._eventCallDepth=0;this._ownedComponents=null;this._updateScheduled=false;this._renderer=null;}}]);return Component;}();var tempVec3a$i=math.vec3();var tempVec3b$b=math.vec3();var tempMat4a$1=math.mat4();/**
2111
2111
  * @private
2112
2112
  */var FrustumPlane=/*#__PURE__*/function(){function FrustumPlane(){_classCallCheck(this,FrustumPlane);this.normal=math.vec3();this.offset=0;this.testVertex=math.vec3();}_createClass(FrustumPlane,[{key:"set",value:function set(nx,ny,nz,offset){var s=1.0/Math.sqrt(nx*nx+ny*ny+nz*nz);this.normal[0]=nx*s;this.normal[1]=ny*s;this.normal[2]=nz*s;this.offset=offset*s;this.testVertex[0]=this.normal[0]>=0.0?1:0;this.testVertex[1]=this.normal[1]>=0.0?1:0;this.testVertex[2]=this.normal[2]>=0.0?1:0;}}]);return FrustumPlane;}();/**
2113
2113
  * @private
@@ -5286,14 +5286,14 @@ var tempChildList=this._children.splice(0);var child;for(var _i79=0,len=tempChil
5286
5286
  * Media type for PNG images.
5287
5287
  */var PNGMediaType=10002;/**
5288
5288
  * Media type for compressed texture data.
5289
- */var CompressedMediaType=10003;var ids$1=new Map$1({});var tempVec3a$f=math.vec3();var tempVec4$2=math.vec4();var TEXTURE_DECODE_FUNCS=_defineProperty({},sRGBEncoding,"sRGBToLinear");var iota$3=function iota$3(n){var ret=[];for(var _i81=0;_i81<n;++_i81){ret.push(_i81);}return ret;};var createProgramVariablesState=function createProgramVariablesState(){var _this22=this;var vertAppenders=[];var vOutAppenders=[];var fragAppenders=[];var fragDefAppenders=[];var attrSetters=[];var attrHahes=[];var unifSetters=[];var createVertexDefinition=function createVertexDefinition(name,appendDefinition){var needed=false;vertAppenders.push(function(src){return needed&&appendDefinition(name,src);});return{toString:function toString(){needed=true;return name;}};};var programVariables={createAttribute:function createAttribute(type,name){var needed=false;vertAppenders.push(function(src){return needed&&src.push("in ".concat(type," ").concat(name,";"));});var ret={toString:function toString(){needed=true;return name;}};attrSetters.push(function(getInputSetter){var setValue=needed&&getInputSetter(name);setValue&&attrHahes.push(setValue.attributeHash);ret.setInputValue=setValue;return null;});return ret;},createFragmentDefinition:function createFragmentDefinition(name,appendDefinition){var needed=false;fragDefAppenders.push(function(src){return needed&&appendDefinition(name,src);});return{toString:function toString(){needed=true;return name;}};},createOutput:function createOutput(type,name,location){var needed=false;fragAppenders.push(function(src){return needed&&src.push("layout(location = ".concat(location||0,") out ").concat(type," ").concat(name,";"));});return{toString:function toString(){needed=true;return name;}};},createUniform:function createUniform(type,name,valueSetter){var needed=false;var append=function append(src){return needed&&src.push("uniform ".concat(type," ").concat(name,";"));};vertAppenders.push(append);fragAppenders.push(append);var ret={toString:function toString(){needed=true;return name;}};unifSetters.push(function(getInputSetter){var setValue=needed&&getInputSetter(name);if(valueSetter){return setValue&&function(state){return valueSetter(setValue,state);};}else{ret.setInputValue=setValue;return null;}});return ret;},createUniformArray:function createUniformArray(type,name,length){var needed=false;var append=function append(src){return needed&&src.push("uniform ".concat(type," ").concat(name,"[").concat(length,"];"));};vertAppenders.push(append);fragAppenders.push(append);var ret={toString:function toString(){needed=true;return name;}};unifSetters.push(function(getInputSetter){ret.setInputValue=needed&&getInputSetter(name);return null;});return ret;},createUniformBlock:function createUniformBlock(name,types,valueSetter){var needed=false;var keys=Object.keys(types);var append=function append(src){if(needed){src.push("uniform ".concat(name," {"));keys.forEach(function(k){return src.push(" ".concat(types[k]," ").concat(k,";"));});src.push("};");}};vertAppenders.push(append);fragAppenders.push(append);var ret={};keys.forEach(function(k){return ret[k]={toString:function toString(){needed=true;return k;}};});unifSetters.push(function(getInputSetter){var setValue=needed&&getInputSetter(name);if(valueSetter){return setValue&&function(state){return valueSetter(setValue,state);};}else{ret.setInputValue=setValue;return null;}});return ret;},createVarying:function createVarying(type,name,genValueCode,interpolationQualifier){var needed=false;var intp=interpolationQualifier?interpolationQualifier+" ":"";vertAppenders.push(function(src){return needed&&src.push("".concat(intp,"out ").concat(type," ").concat(name,";"));});vOutAppenders.push(function(src){return needed&&src.push("".concat(name," = ").concat(genValueCode(),";"));});fragAppenders.push(function(src){return needed&&src.push("".concat(intp,"in ").concat(type," ").concat(name,";"));});return{toString:function toString(){needed=true;return name;}};},createVertexDefinition:createVertexDefinition,commonLibrary:{octDecode:createVertexDefinition("octDecode",function(name,src){src.push("vec3 ".concat(name,"(vec2 oct) {"));src.push(" vec3 v = vec3(oct.xy, 1.0 - abs(oct.x) - abs(oct.y));");src.push(" if (v.z < 0.0) {");src.push(" v.xy = (1.0 - abs(v.yx)) * vec2(v.x >= 0.0 ? 1.0 : -1.0, v.y >= 0.0 ? 1.0 : -1.0);");src.push(" }");src.push(" return normalize(v);");src.push("}");})}};return{programVariables:programVariables,buildProgram:function buildProgram(gl,programName,cfg){var getLogDepth=cfg.getLogDepth;var clipPos=cfg.clipPos;var clipTransformSetup=cfg.usePickClipPos&&function(){var pickClipPos=programVariables.createUniform("vec2","pickClipPos");var pickClipPosInv=programVariables.createUniform("vec2","pickClipPosInv");return{setClipPosInputValue:function setClipPosInputValue(frameCtx){pickClipPos.setInputValue(frameCtx.pickClipPos);pickClipPosInv.setInputValue(frameCtx.pickClipPosInv);},transformedClipPos:function transformedClipPos(){return"vec4((".concat(clipPos,".xy / ").concat(clipPos,".w - ").concat(pickClipPos,") * ").concat(pickClipPosInv," * ").concat(clipPos,".w, ").concat(clipPos,".zw)");}};}();var vertexClipPosition=clipTransformSetup?clipTransformSetup.transformedClipPos():clipPos;var fragmentOutputs=[];var isPerspective=programVariables.createVarying("float","isPerspective",function(){return"(".concat(cfg.projMatrix,"[2][3] == -1.0) ? 1.0 : 0.0");});var logDepthBufFC=programVariables.createUniform("float","logDepthBufFC",function(set,state){return set(2.0/(Math.log(state.view.far+1.0)/Math.LN2));});var vFragDepth=programVariables.createVarying("float","vFragDepth",function(){return"1.0 + clipPos.w";});if(getLogDepth){fragmentOutputs.push("gl_FragDepth = ".concat(cfg.testPerspectiveForGl_FragDepth?"".concat(isPerspective," == 0.0 ? gl_FragCoord.z : "):"","log2(").concat(getLogDepth(vFragDepth),") * ").concat(logDepthBufFC," * 0.5;"));}else if(cfg.cleanerEdges){fragmentOutputs.push("gl_FragDepth = gl_FragCoord.z + length(vec2(dFdx(gl_FragCoord.z), dFdy(gl_FragCoord.z)));");}var linearToGamma=programVariables.createFragmentDefinition("linearToGamma",function(name,src){src.push("vec4 ".concat(name,"(in vec4 value, in float gammaFactor) {"));src.push(" return vec4(pow(value.xyz, vec3(1.0 / gammaFactor)), value.w);");src.push("}");});var sectionPlanesState=cfg.sectionPlanesState;var getClippingDistance=sectionPlanesState&&function(){var allocatedUniforms=iota$3(sectionPlanesState.getNumAllocatedSectionPlanes()).map(function(i){var sectionPlaneUniform=function sectionPlaneUniform(type,postfix,getValue){return programVariables.createUniform(type,"sectionPlane".concat(postfix).concat(i),function(set,state){var sectionPlanes=sectionPlanesState.sectionPlanes;var numSectionPlanes=sectionPlanes.length;var baseIndex=(state.mesh.layerIndex||0)*numSectionPlanes;var active=i<numSectionPlanes&&state.mesh.renderFlags.sectionPlanesActivePerLayer[baseIndex+i];return getValue(set,active,sectionPlanes[i],state.mesh.origin);});};return{act:sectionPlaneUniform("bool","Active",function(set,active){return set(active?1:0);}),dir:sectionPlaneUniform("vec3","Dir",function(set,active,plane){return active&&set(plane.dir);}),pos:sectionPlaneUniform("vec3","Pos",function(set,active,plane,orig){return active&&set(orig?math.mulVec3Scalar(math.normalizeVec3(plane.dir,tempVec3a$f),-(math.dotVec3(plane.dir,orig)+plane.dist),tempVec3a$f)// getPlaneRTCPos
5289
+ */var CompressedMediaType=10003;var ids$1=new Map$1({});var tempVec3a$f=math.vec3();var tempVec4$3=math.vec4();var TEXTURE_DECODE_FUNCS=_defineProperty({},sRGBEncoding,"sRGBToLinear");var iota$3=function iota$3(n){var ret=[];for(var _i81=0;_i81<n;++_i81){ret.push(_i81);}return ret;};var createProgramVariablesState=function createProgramVariablesState(){var _this22=this;var vertAppenders=[];var vOutAppenders=[];var fragAppenders=[];var fragDefAppenders=[];var attrSetters=[];var attrHahes=[];var unifSetters=[];var createVertexDefinition=function createVertexDefinition(name,appendDefinition){var needed=false;vertAppenders.push(function(src){return needed&&appendDefinition(name,src);});return{toString:function toString(){needed=true;return name;}};};var programVariables={createAttribute:function createAttribute(type,name){var needed=false;vertAppenders.push(function(src){return needed&&src.push("in ".concat(type," ").concat(name,";"));});var ret={toString:function toString(){needed=true;return name;}};attrSetters.push(function(getInputSetter){var setValue=needed&&getInputSetter(name);setValue&&attrHahes.push(setValue.attributeHash);ret.setInputValue=setValue;return null;});return ret;},createFragmentDefinition:function createFragmentDefinition(name,appendDefinition){var needed=false;fragDefAppenders.push(function(src){return needed&&appendDefinition(name,src);});return{toString:function toString(){needed=true;return name;}};},createOutput:function createOutput(type,name,location){var needed=false;fragAppenders.push(function(src){return needed&&src.push("layout(location = ".concat(location||0,") out ").concat(type," ").concat(name,";"));});return{toString:function toString(){needed=true;return name;}};},createUniform:function createUniform(type,name,valueSetter){var needed=false;var append=function append(src){return needed&&src.push("uniform ".concat(type," ").concat(name,";"));};vertAppenders.push(append);fragAppenders.push(append);var ret={toString:function toString(){needed=true;return name;}};unifSetters.push(function(getInputSetter){var setValue=needed&&getInputSetter(name);if(valueSetter){return setValue&&function(state){return valueSetter(setValue,state);};}else{ret.setInputValue=setValue;return null;}});return ret;},createUniformArray:function createUniformArray(type,name,length){var needed=false;var append=function append(src){return needed&&src.push("uniform ".concat(type," ").concat(name,"[").concat(length,"];"));};vertAppenders.push(append);fragAppenders.push(append);var ret={toString:function toString(){needed=true;return name;}};unifSetters.push(function(getInputSetter){ret.setInputValue=needed&&getInputSetter(name);return null;});return ret;},createUniformBlock:function createUniformBlock(name,types,valueSetter){var needed=false;var keys=Object.keys(types);var append=function append(src){if(needed){src.push("uniform ".concat(name," {"));keys.forEach(function(k){return src.push(" ".concat(types[k]," ").concat(k,";"));});src.push("};");}};vertAppenders.push(append);fragAppenders.push(append);var ret={};keys.forEach(function(k){return ret[k]={toString:function toString(){needed=true;return k;}};});unifSetters.push(function(getInputSetter){var setValue=needed&&getInputSetter(name);if(valueSetter){return setValue&&function(state){return valueSetter(setValue,state);};}else{ret.setInputValue=setValue;return null;}});return ret;},createVarying:function createVarying(type,name,genValueCode,interpolationQualifier){var needed=false;var intp=interpolationQualifier?interpolationQualifier+" ":"";vertAppenders.push(function(src){return needed&&src.push("".concat(intp,"out ").concat(type," ").concat(name,";"));});vOutAppenders.push(function(src){return needed&&src.push("".concat(name," = ").concat(genValueCode(),";"));});fragAppenders.push(function(src){return needed&&src.push("".concat(intp,"in ").concat(type," ").concat(name,";"));});return{toString:function toString(){needed=true;return name;}};},createVertexDefinition:createVertexDefinition,commonLibrary:{octDecode:createVertexDefinition("octDecode",function(name,src){src.push("vec3 ".concat(name,"(vec2 oct) {"));src.push(" vec3 v = vec3(oct.xy, 1.0 - abs(oct.x) - abs(oct.y));");src.push(" if (v.z < 0.0) {");src.push(" v.xy = (1.0 - abs(v.yx)) * vec2(v.x >= 0.0 ? 1.0 : -1.0, v.y >= 0.0 ? 1.0 : -1.0);");src.push(" }");src.push(" return normalize(v);");src.push("}");})}};return{programVariables:programVariables,buildProgram:function buildProgram(gl,programName,cfg){var getLogDepth=cfg.getLogDepth;var clipPos=cfg.clipPos;var clipTransformSetup=cfg.usePickClipPos&&function(){var pickClipPos=programVariables.createUniform("vec2","pickClipPos");var pickClipPosInv=programVariables.createUniform("vec2","pickClipPosInv");return{setClipPosInputValue:function setClipPosInputValue(frameCtx){pickClipPos.setInputValue(frameCtx.pickClipPos);pickClipPosInv.setInputValue(frameCtx.pickClipPosInv);},transformedClipPos:function transformedClipPos(){return"vec4((".concat(clipPos,".xy / ").concat(clipPos,".w - ").concat(pickClipPos,") * ").concat(pickClipPosInv," * ").concat(clipPos,".w, ").concat(clipPos,".zw)");}};}();var vertexClipPosition=clipTransformSetup?clipTransformSetup.transformedClipPos():clipPos;var fragmentOutputs=[];var isPerspective=programVariables.createVarying("float","isPerspective",function(){return"(".concat(cfg.projMatrix,"[2][3] == -1.0) ? 1.0 : 0.0");});var logDepthBufFC=programVariables.createUniform("float","logDepthBufFC",function(set,state){return set(2.0/(Math.log(state.view.far+1.0)/Math.LN2));});var vFragDepth=programVariables.createVarying("float","vFragDepth",function(){return"1.0 + clipPos.w";});if(getLogDepth){fragmentOutputs.push("gl_FragDepth = ".concat(cfg.testPerspectiveForGl_FragDepth?"".concat(isPerspective," == 0.0 ? gl_FragCoord.z : "):"","log2(").concat(getLogDepth(vFragDepth),") * ").concat(logDepthBufFC," * 0.5;"));}else if(cfg.cleanerEdges){fragmentOutputs.push("gl_FragDepth = gl_FragCoord.z + length(vec2(dFdx(gl_FragCoord.z), dFdy(gl_FragCoord.z)));");}var linearToGamma=programVariables.createFragmentDefinition("linearToGamma",function(name,src){src.push("vec4 ".concat(name,"(in vec4 value, in float gammaFactor) {"));src.push(" return vec4(pow(value.xyz, vec3(1.0 / gammaFactor)), value.w);");src.push("}");});var sectionPlanesState=cfg.sectionPlanesState;var getClippingDistance=sectionPlanesState&&function(){var allocatedUniforms=iota$3(sectionPlanesState.getNumAllocatedSectionPlanes()).map(function(i){var sectionPlaneUniform=function sectionPlaneUniform(type,postfix,getValue){return programVariables.createUniform(type,"sectionPlane".concat(postfix).concat(i),function(set,state){var sectionPlanes=sectionPlanesState.sectionPlanes;var numSectionPlanes=sectionPlanes.length;var baseIndex=(state.mesh.layerIndex||0)*numSectionPlanes;var active=i<numSectionPlanes&&state.mesh.renderFlags.sectionPlanesActivePerLayer[baseIndex+i];return getValue(set,active,sectionPlanes[i],state.mesh.origin);});};return{act:sectionPlaneUniform("bool","Active",function(set,active){return set(active?1:0);}),dir:sectionPlaneUniform("vec3","Dir",function(set,active,plane){return active&&set(plane.dir);}),pos:sectionPlaneUniform("vec3","Pos",function(set,active,plane,orig){return active&&set(orig?math.mulVec3Scalar(math.normalizeVec3(plane.dir,tempVec3a$f),-(math.dotVec3(plane.dir,orig)+plane.dist),tempVec3a$f)// getPlaneRTCPos
5290
5290
  :plane.pos);})};});return allocatedUniforms.length>0&&function(worldPosition){return allocatedUniforms.map(function(a){return"(".concat(a.act," ? clamp(dot(-").concat(a.dir,", ").concat(worldPosition," - ").concat(a.pos,"), 0.0, 1000.0) : 0.0)");}).join(" + ");};}();var crossSections=cfg.crossSections;var sliceColorOr=getClippingDistance?function(){var sliceColor=programVariables.createUniform("vec4","sliceColor",function(set){return set(crossSections.sliceColor);});var sliceColorOr=function sliceColorOr(color){sliceColorOr.needed=true;return"(sliced ? ".concat(sliceColor," : ").concat(color,")");};return sliceColorOr;}():function(color){return color;};var getGammaFactor=cfg.getGammaFactor;var gammaFactor=programVariables.createUniform("float","gammaFactor",function(set){return set(getGammaFactor());});cfg.appendFragmentOutputs(fragmentOutputs,getGammaFactor&&function(color){return"".concat(linearToGamma,"(").concat(color,", ").concat(gammaFactor,")");},"gl_FragCoord",sliceColorOr);var fragmentClippingLines=function(){var src=[];var sliceThickness=programVariables.createUniform("float","sliceThickness",function(set){return set(crossSections.sliceThickness);});if(getClippingDistance){if(sliceColorOr.needed){src.push(" bool sliced = false;");}src.push(" if (".concat(cfg.clippableTest(),") {"));var fragWorldPosition=programVariables.createVarying("highp vec3","vHighpWorldPosition",function(){return"".concat(cfg.worldPositionAttribute,".xyz");});src.push(" float dist = ".concat(getClippingDistance(fragWorldPosition),";"));if(cfg.clippingCaps){var vClipPositionW=programVariables.createVarying("float","vClipPositionW",function(){return"gl_Position.w";});src.push(" if (dist > (0.002 * ".concat(vClipPositionW,")) { discard; }"));src.push(" if (dist > 0.0) { ");src.push(" ".concat(cfg.clippingCaps," = vec4(1.0, 0.0, 0.0, 1.0);"));getLogDepth&&src.push(" gl_FragDepth = log2(".concat(getLogDepth(vFragDepth),") * ").concat(logDepthBufFC," * 0.5;"));src.push(" return;");src.push(" }");}else{src.push(" if (dist > ".concat(sliceColorOr.needed?sliceThickness:"0.0",") { discard; }"));}if(sliceColorOr.needed){src.push(" sliced = dist > 0.0;");}src.push(" }");}return src;}();var fragDefinitions=function(){var src=[];fragDefAppenders.forEach(function(a){return a(src);});return src;}();var fragmentShader=[].concat(_toConsumableArray(function(){var src=[];fragAppenders.forEach(function(a){return a(src);});return src;}()),_toConsumableArray(fragDefinitions),["void main(void) {"],_toConsumableArray(cfg.discardPoints?[" vec2 cxy = 2.0 * gl_PointCoord - 1.0;"," if (dot(cxy, cxy) > 1.0) { discard; }"]:[]),_toConsumableArray(fragmentClippingLines),fragmentOutputs,["}"]);var vertexOutputs=["gl_Position = ".concat(vertexClipPosition,";")].concat(_toConsumableArray(cfg.getPointSize?["gl_PointSize = ".concat(cfg.getPointSize(),";")]:[]),_toConsumableArray(function(){var src=[];vOutAppenders.forEach(function(a){return a(src);});return src;}()));var vertexData=cfg.getVertexData?cfg.getVertexData():[];var vertexShader=[].concat(_toConsumableArray(function(){var src=[];vertAppenders.forEach(function(a){return a(src);});return src;}()),["void main(void) {"],_toConsumableArray(vertexData),_toConsumableArray(vertexOutputs),["}"]);var preamble=function preamble(type){return["#version 300 es","// "+programName+" "+type+" shader","#ifdef GL_FRAGMENT_PRECISION_HIGH","precision highp float;","precision highp int;","precision highp usampler2D;","precision highp isampler2D;","precision highp sampler2D;","#else","precision mediump float;","precision mediump int;","precision mediump usampler2D;","precision mediump isampler2D;","precision mediump sampler2D;","#endif"];};var vertSrc=preamble("vertex").concat(vertexShader);var fragSrc=preamble("fragment").concat([// Not the best place to define here, TODO: Move somewhere more appropriate after refactors
5291
5291
  "vec4 sRGBToLinear(in vec4 value) {"," return vec4(mix(pow(value.rgb * 0.9478672986 + 0.0521327014, vec3(2.4)), value.rgb * 0.0773993808, vec3(lessThanEqual(value.rgb, vec3(0.04045)))), value.w);","}"]).concat(fragmentShader);var makeShader=function makeShader(type,srcLines){var src=srcLines.join("\n");var shader=gl.createShader(type);gl.shaderSource(shader,src);gl.compileShader(shader);if(gl.getShaderParameter(shader,gl.COMPILE_STATUS)){return[shader];}else{return[null,["Failed to compile",gl.getShaderInfoLog(shader),src.split("\n").map(function(line,i){return i+1+": "+line+"\n";}).join("")]];}};var _makeShader=makeShader(gl.VERTEX_SHADER,vertSrc),_makeShader2=_slicedToArray(_makeShader,2),vertShader=_makeShader2[0],vertErrors=_makeShader2[1];var _makeShader3=makeShader(gl.FRAGMENT_SHADER,fragSrc),_makeShader4=_slicedToArray(_makeShader3,2),fragShader=_makeShader4[0],fragErrors=_makeShader4[1];var errorObj=function errorObj(errors){console.error(errors.join("\n"));return[null,errors];};if(vertErrors){return errorObj(["Vertex shader error"].concat(vertErrors));}else if(fragErrors){return errorObj(["Fragment shader error"].concat(fragErrors));}else{var program=gl.createProgram();if(!program){return errorObj(["Failed to allocate program"]);}else{gl.attachShader(program,vertShader);gl.attachShader(program,fragShader);gl.linkProgram(program);// HACK: Disable validation temporarily
5292
5292
  // Perhaps we should defer validation until render-time, when the program has values set for all inputs?
5293
5293
  if(!gl.getProgramParameter(program,gl.LINK_STATUS)){return errorObj(["",gl.getProgramInfoLog(_this22.program),"","Vertex shader:",""].concat(_toConsumableArray(vertSrc),["","Fragment shader:",""],_toConsumableArray(fragSrc)));}else{var getInputSetter=makeInputSetters(gl,program);attrSetters.forEach(function(i){return i(getInputSetter);});var uSetters=unifSetters.map(function(i){return i(getInputSetter);}).filter(function(s){return s;});var id=ids$1.addItem({});return[{id:id,bind:function bind(){return gl.useProgram(program);},inputSetters:{attributesHash:attrHahes.sort().join(", "),setUniforms:function setUniforms(frameCtx,state){clipTransformSetup&&clipTransformSetup.setClipPosInputValue(frameCtx);uSetters.forEach(function(s){return s(state);});}},destroy:function destroy(){ids$1.removeItem(id);gl.deleteProgram(program);gl.deleteShader(vertShader);gl.deleteShader(fragShader);}}];}}}}};};var createLightSetup=function createLightSetup(programVariables,lightsState){var lightAmbient=programVariables.createUniform("vec4","lightAmbient",function(set){return set(lightsState.getAmbientColorAndIntensity());});var lights=lightsState.lights;var directionals=lights.map(function(light,i){var lightUniforms={color:programVariables.createUniform("vec4","lightColor".concat(i),function(set){var light=lights[i];// in case it changed
5294
- tempVec4$2[0]=light.color[0];tempVec4$2[1]=light.color[1];tempVec4$2[2]=light.color[2];tempVec4$2[3]=light.intensity;set(tempVec4$2);}),position:programVariables.createUniform("vec3","lightPos".concat(i),function(set){return set(lights[i].pos);}),direction:programVariables.createUniform("vec3","lightDir".concat(i),function(set){return set(lights[i].dir);}),shadowProjMatrix:programVariables.createUniform("mat4","shadowProjMatrix".concat(i),function(set){return set(lights[i].getShadowViewMatrix());}),shadowViewMatrix:programVariables.createUniform("mat4","shadowViewMatrix".concat(i),function(set){return set(lights[i].getShadowViewMatrix());}),shadowMap:programVariables.createUniform("sampler2D","shadowMap".concat(i),function(set){return set(lights[i].getShadowRenderBuf().colorTextures[0]);})};var withViewLightDir=function withViewLightDir(_getDirection){return{glslLight:{isViewSpace:light.space==="view",getColor:function getColor(){return"".concat(lightUniforms.color,".rgb * ").concat(lightUniforms.color,".a");},getDirection:function getDirection(viewMatrix,viewPosition){return"normalize(".concat(_getDirection(viewMatrix,viewPosition),")");},shadowParameters:light.castsShadow&&{getShadowProjMatrix:function getShadowProjMatrix(){return lightUniforms.shadowProjMatrix;},getShadowViewMatrix:function getShadowViewMatrix(){return lightUniforms.shadowViewMatrix;},getShadowMap:function getShadowMap(){return lightUniforms.shadowMap;}}},setupLightsInputs:function setupLightsInputs(){var setters=Object.values(lightUniforms).map(function(u){return u.setupLightsInputs();}).filter(function(v){return v;});return function(){return setters.forEach(function(setState){return setState();});};}};};if(light.type==="dir"){if(light.space==="view"){return withViewLightDir(function(viewMatrix,viewPosition){return"-".concat(lightUniforms.direction);});}else{// If normal mapping, the fragment->light vector will be in tangent space
5294
+ tempVec4$3[0]=light.color[0];tempVec4$3[1]=light.color[1];tempVec4$3[2]=light.color[2];tempVec4$3[3]=light.intensity;set(tempVec4$3);}),position:programVariables.createUniform("vec3","lightPos".concat(i),function(set){return set(lights[i].pos);}),direction:programVariables.createUniform("vec3","lightDir".concat(i),function(set){return set(lights[i].dir);}),shadowProjMatrix:programVariables.createUniform("mat4","shadowProjMatrix".concat(i),function(set){return set(lights[i].getShadowViewMatrix());}),shadowViewMatrix:programVariables.createUniform("mat4","shadowViewMatrix".concat(i),function(set){return set(lights[i].getShadowViewMatrix());}),shadowMap:programVariables.createUniform("sampler2D","shadowMap".concat(i),function(set){return set(lights[i].getShadowRenderBuf().colorTextures[0]);})};var withViewLightDir=function withViewLightDir(_getDirection){return{glslLight:{isViewSpace:light.space==="view",getColor:function getColor(){return"".concat(lightUniforms.color,".rgb * ").concat(lightUniforms.color,".a");},getDirection:function getDirection(viewMatrix,viewPosition){return"normalize(".concat(_getDirection(viewMatrix,viewPosition),")");},shadowParameters:light.castsShadow&&{getShadowProjMatrix:function getShadowProjMatrix(){return lightUniforms.shadowProjMatrix;},getShadowViewMatrix:function getShadowViewMatrix(){return lightUniforms.shadowViewMatrix;},getShadowMap:function getShadowMap(){return lightUniforms.shadowMap;}}},setupLightsInputs:function setupLightsInputs(){var setters=Object.values(lightUniforms).map(function(u){return u.setupLightsInputs();}).filter(function(v){return v;});return function(){return setters.forEach(function(setState){return setState();});};}};};if(light.type==="dir"){if(light.space==="view"){return withViewLightDir(function(viewMatrix,viewPosition){return"-".concat(lightUniforms.direction);});}else{// If normal mapping, the fragment->light vector will be in tangent space
5295
5295
  return withViewLightDir(function(viewMatrix,viewPosition){return"-(".concat(viewMatrix," * vec4(").concat(lightUniforms.direction,", 0.0)).xyz");});}}else if(light.type==="point"){if(light.space==="view"){return withViewLightDir(function(viewMatrix,viewPosition){return"".concat(lightUniforms.position," - ").concat(viewPosition);});}else{// If normal mapping, the fragment->light vector will be in tangent space
5296
- return withViewLightDir(function(viewMatrix,viewPosition){return"(".concat(viewMatrix," * vec4(").concat(lightUniforms.position,", 1.0)).xyz - ").concat(viewPosition);});}}else{return null;}}).filter(function(v){return v;});var setupCubeTexture=function setupCubeTexture(name,getMaps){var getValue=function getValue(){var m=getMaps();return m.length>0&&m[0];};var initMap=getValue();return initMap&&setupTexture(programVariables,"samplerCube",name,initMap.encoding,function(set){var v=getValue();v&&set(v.texture);});};var lightMap=setupCubeTexture("light",function(){return lightsState.lightMaps;});var reflectionMap=setupCubeTexture("reflection",function(){return lightsState.reflectionMaps;});return{getHash:function getHash(){return lightsState.getHash();},getAmbientColor:function getAmbientColor(){return"".concat(lightAmbient,".rgb * ").concat(lightAmbient,".a");},directionalLights:directionals.map(function(light){return light.glslLight;}),getIrradiance:lightMap&&function(worldNormal){return"".concat(lightMap(worldNormal),".rgb");},getReflection:reflectionMap&&function(reflectVec,mipLevel){return"".concat(reflectionMap(reflectVec,mipLevel),".rgb");}};};var setupTexture=function setupTexture(programVariables,type,name,encoding,getTexture){var map=programVariables.createUniform(type,name+"Map",getTexture);return function(texturePos,bias){var texel=bias?"texture(".concat(map,", ").concat(texturePos,", ").concat(bias,")"):"texture(".concat(map,", ").concat(texturePos,")");return encoding!==LinearEncoding?"".concat(TEXTURE_DECODE_FUNCS[encoding],"(").concat(texel,")"):texel;};};var makeInputSetters=function makeInputSetters(gl,handle){var activeInputs={};var numAttributes=gl.getProgramParameter(handle,gl.ACTIVE_ATTRIBUTES);var _loop6=function _loop6(_i82){var attribute=gl.getActiveAttrib(handle,_i82);var location=gl.getAttribLocation(handle,attribute.name);activeInputs[attribute.name]=function(arrayBuf){arrayBuf.bindAtLocation(location);gl.enableVertexAttribArray(location);var divisor=arrayBuf.attributeDivisor;if(divisor){gl.vertexAttribDivisor(location,divisor);}};activeInputs[attribute.name].attributeHash="".concat(location.toString().padStart(1+Math.floor(Math.log10(numAttributes)),"0"),":").concat(attribute.name);};for(var _i82=0;_i82<numAttributes;++_i82){_loop6(_i82);}var numBlocks=gl.getProgramParameter(handle,gl.ACTIVE_UNIFORM_BLOCKS);var _loop7=function _loop7(_i83){var blockName=gl.getActiveUniformBlockName(handle,_i83);var uniformBlockIndex=gl.getUniformBlockIndex(handle,blockName);var uniformBlockBinding=_i83;gl.uniformBlockBinding(handle,uniformBlockIndex,uniformBlockBinding);var buffer=gl.createBuffer();activeInputs[blockName]=function(data){gl.bindBuffer(gl.UNIFORM_BUFFER,buffer);gl.bufferData(gl.UNIFORM_BUFFER,data,gl.DYNAMIC_DRAW);gl.bindBufferBase(gl.UNIFORM_BUFFER,uniformBlockBinding,buffer);};};for(var _i83=0;_i83<numBlocks;++_i83){_loop7(_i83);}var numUniforms=gl.getProgramParameter(handle,gl.ACTIVE_UNIFORMS);var nextUnit=0;var _loop8=function _loop8(_i84){var u=gl.getActiveUniform(handle,_i84);var uName=u.name;if(uName.endsWith("[0]")){uName=uName.substr(0,uName.length-3);}if(uName[uName.length-1]==="\0"){uName=uName.substr(0,uName.length-1);}var location=gl.getUniformLocation(handle,uName);(function(){for(var k in gl){if(u.type===gl[k])return k;}return null;})();if(u.type===gl.SAMPLER_2D||u.type===gl.SAMPLER_CUBE||u.type===gl.SAMPLER_2D_SHADOW||gl instanceof window.WebGL2RenderingContext&&(u.type===gl.UNSIGNED_INT_SAMPLER_2D||u.type===gl.INT_SAMPLER_2D)){var unit=nextUnit++;activeInputs[uName]=function(texture){var bound=texture.bind(unit);if(bound){gl.uniform1i(location,unit);}return bound;};}else{activeInputs[uName]=function(){if(u.size===1){switch(u.type){case gl.BOOL:return function(value){return gl.uniform1i(location,value);};case gl.INT:return function(value){return gl.uniform1i(location,value);};case gl.FLOAT:return function(value){return gl.uniform1f(location,value);};case gl.FLOAT_VEC2:return function(value){return gl.uniform2fv(location,value);};case gl.FLOAT_VEC3:return function(value){return gl.uniform3fv(location,value);};case gl.FLOAT_VEC4:return function(value){return gl.uniform4fv(location,value);};case gl.FLOAT_MAT3:return function(value){return gl.uniformMatrix3fv(location,false,value);};case gl.FLOAT_MAT4:return function(value){return gl.uniformMatrix4fv(location,false,value);};}}else if(u.size>1){switch(u.type){case gl.FLOAT:return function(value){return gl.uniform1fv(location,value);};case gl.FLOAT_VEC2:return function(value){return gl.uniform2fv(location,value);};case gl.FLOAT_VEC3:return function(value){return gl.uniform3fv(location,value);};case gl.FLOAT_VEC4:return function(value){return gl.uniform4fv(location,value);};}}throw"Unhandled uniform ".concat(uName);}();}};for(var _i84=0;_i84<numUniforms;++_i84){_loop8(_i84);}return function(name){var u=activeInputs[name];if(!u){throw"Missing input \"".concat(name,"\"");}return u;};};var tempVec4$1=math.vec4();var DrawShaderSource=function DrawShaderSource(meshDrawHash,programVariables,geometry,material,scene){var materialState=material._state;var phongMaterial=materialState.type==="PhongMaterial";var metallicMaterial=materialState.type==="MetallicMaterial";var specularMaterial=materialState.type==="SpecularMaterial";var attributes=geometry.attributes;var lightSetup=createLightSetup(programVariables,scene._lightsState);var colorize=programVariables.createUniform("vec4","colorize",function(set,state){return set(state.meshColorize);});var fresnel=programVariables.createFragmentDefinition("fresnel",function(name,src){src.push("float ".concat(name,"(vec3 eyeDir, vec3 normal, float edgeBias, float centerBias, float power) {"));src.push(" float fr = abs(dot(eyeDir, normal));");src.push(" float finalFr = clamp((fr - edgeBias) / (centerBias - edgeBias), 0.0, 1.0);");src.push(" return pow(finalFr, power);");src.push("}");});var setupFresnel=function setupFresnel(name,colorSwizzle,getMaterialValue){var fresnelUniform=function fresnelUniform(type,namePostfix,getParameterValue){return programVariables.createUniform(type,name+"Fresnel"+namePostfix,function(set,state){return set(getParameterValue(getMaterialValue(state.material)));});};var edgeBias=fresnelUniform("float","EdgeBias",function(fresnelValue){return fresnelValue.edgeBias;});var centerBias=fresnelUniform("float","CenterBias",function(fresnelValue){return fresnelValue.centerBias;});var power=fresnelUniform("float","Power",function(fresnelValue){return fresnelValue.power;});var edgeColor=fresnelUniform("vec3","EdgeColor",function(fresnelValue){return fresnelValue.edgeColor;});var centerColor=fresnelUniform("vec3","CenterColor",function(fresnelValue){return fresnelValue.centerColor;});return getMaterialValue(material)&&function(viewEyeDir,viewNormal){var f="".concat(fresnel,"(").concat(viewEyeDir,", ").concat(viewNormal,", ").concat(edgeBias,", ").concat(centerBias,", ").concat(power,")");return"mix(".concat(edgeColor+colorSwizzle,", ").concat(centerColor+colorSwizzle,", ").concat(f,")");};};var diffuseFresnel=setupFresnel("diffuse","",function(mtl){return mtl._diffuseFresnel;});var specularFresnel=setupFresnel("specular","",function(mtl){return mtl._specularFresnel;});var emissiveFresnel=setupFresnel("emissive","",function(mtl){return mtl._emissiveFresnel;});var alphaFresnel=setupFresnel("alpha",".r",function(mtl){return mtl._alphaFresnel;});var setup2dTexture=function setup2dTexture(name,getMaterialValue){var initTex=attributes.uv&&getMaterialValue(material);var tex=initTex&&setupTexture(programVariables,"sampler2D",name,initTex.encoding,function(set,state){return set(getMaterialValue(state.material)._state.texture);});return tex&&function(){var matrix=initTex._state.matrix&&programVariables.createUniform("mat4",name+"MapMatrix",function(set,state){return set(getMaterialValue(state.material)._state.matrix);});var getTexCoordExpression=matrix?function(texPos){return"(".concat(matrix," * ").concat(texPos,").st");}:function(texPos){return"".concat(texPos,".st");};var sample=function sample(texturePos,bias){return tex(getTexCoordExpression(texturePos));};sample.getTexCoordExpression=getTexCoordExpression;return sample;}();};var ambientMap=setup2dTexture("ambient",function(mtl){return mtl._ambientMap;});var baseColorMap=setup2dTexture("baseColor",function(mtl){return mtl._baseColorMap;});var diffuseMap=setup2dTexture("diffuse",function(mtl){return mtl._diffuseMap;});var emissiveMap=setup2dTexture("emissive",function(mtl){return mtl._emissiveMap;});var occlusionMap=setup2dTexture("occlusion",function(mtl){return mtl._occlusionMap;});var alphaMap=setup2dTexture("alpha",function(mtl){return mtl._alphaMap;});var metallicMap=setup2dTexture("metallic",function(mtl){return mtl._metallicMap;});var roughnessMap=setup2dTexture("roughness",function(mtl){return mtl._roughnessMap;});var metallicRoughnessMap=setup2dTexture("metallicRoughness",function(mtl){return mtl._metallicRoughnessMap;});var specularMap=setup2dTexture("specular",function(mtl){return mtl._specularMap;});var glossinessMap=setup2dTexture("glossiness",function(mtl){return mtl._glossinessMap;});var specularGlossinessMap=setup2dTexture("specularGlossiness",function(mtl){return mtl._specularGlossinessMap;});var normalMap=setup2dTexture("normal",function(mtl){return mtl._normalMap;});var setupUniform=function setupUniform(name,type,getMaterialValue){var initValue=getMaterialValue(material);var isDefined=type==="float"?initValue!==undefined&&initValue!==null:initValue;return isDefined&&programVariables.createUniform(type,name,function(set,state){return set(getMaterialValue(state.material));});};var materialAmbient=setupUniform("materialAmbient","vec3",function(mtl){return mtl.ambient;});var materialDiffuse=setupUniform("materialDiffuse","vec3",function(mtl){return mtl.diffuse;});var materialBaseColor=setupUniform("materialBaseColor","vec3",function(mtl){return mtl.baseColor;});var materialEmissive=setupUniform("materialEmissive","vec3",function(mtl){return mtl.emissive;});var materialSpecular=setupUniform("materialSpecular","vec3",function(mtl){return mtl.specular;});var materialGlossiness=setupUniform("materialGlossiness","float",function(mtl){return mtl.glossiness;});var materialMetallic=setupUniform("materialMetallic","float",function(mtl){return mtl.metallic;});var materialRoughness=setupUniform("materialRoughness","float",function(mtl){return mtl.roughness;});var materialShininess=setupUniform("materialShininess","float",function(mtl){return mtl.shininess;});var materialSpecularF0=setupUniform("materialSpecularF0","float",function(mtl){return mtl.specularF0;});var materialAlphaModeCutoff=setupUniform("materialAlphaModeCutoff","vec4",function(mtl){var alpha=mtl.alpha;if(alpha!==undefined&&alpha!==null){tempVec4$1[0]=alpha;tempVec4$1[1]=mtl.alphaMode===1?1:0;tempVec4$1[2]=mtl.alphaCutoff;return tempVec4$1;}else{return null;}});var vViewPosition=programVariables.createVarying("vec3","vViewPosition",function(){return"".concat(attributes.position.view,".xyz");});var texturePos=programVariables.createVarying("vec4","texturePos",function(){return"vec4(".concat(attributes.uv,", 1.0, 1.0)");});var vColor=attributes.color&&programVariables.createVarying("vec4","vColor",function(){return attributes.color;});var vViewNormal=programVariables.createVarying("vec3","vViewNormal",function(){return attributes.normal.view;});var texUnitConverter="mat4(0.5, 0.0, 0.0, 0.0, 0.0, 0.5, 0.0, 0.0, 0.0, 0.0, 0.5, 0.0, 0.5, 0.5, 0.5, 1.0)";var vDirectionals=lightSetup.directionalLights.map(function(light,i){return{vViewLightReverseDir:programVariables.createVarying("vec3","vViewLightReverseDir".concat(i),function(){return light.getDirection(geometry.viewMatrix,null);}),vShadowPosFromLight:programVariables.createVarying("vec3","vShadowPosFromLight".concat(i),function(){return"(".concat(texUnitConverter," * ").concat(light.shadowParameters.getShadowProjMatrix()," * (").concat(light.shadowParameters.getShadowViewMatrix()," * ").concat(attributes.position.world,")).xyz");})};});var vWorldNormal=programVariables.createVarying("vec3","vWorldNormal",function(){return attributes.normal.world;});var outColor=programVariables.createOutput("vec4","outColor");var saturate=programVariables.createFragmentDefinition("saturate",function(name,src){return src.push("float ".concat(name,"(const in float a) { return clamp(a, 0.0, 1.0); }"));});var BRDF_Specular_GGX=programVariables.createFragmentDefinition("BRDF_Specular_GGX",function(name,src){src.push("vec3 F_Schlick(const in vec3 specularColor, const in float dotLH) {");src.push(" float fresnel = exp2( ( -5.55473 * dotLH - 6.98316 ) * dotLH );");src.push(" return ( 1.0 - specularColor ) * fresnel + specularColor;");src.push("}");src.push("float G_GGX_Smith(const in float alpha, const in float dotNL, const in float dotNV) {");src.push(" float a2 = ( alpha * alpha );");src.push(" float gl = dotNL + sqrt( a2 + ( 1.0 - a2 ) * ( dotNL * dotNL ) );");src.push(" float gv = dotNV + sqrt( a2 + ( 1.0 - a2 ) * ( dotNV * dotNV ) );");src.push(" return 1.0 / ( gl * gv );");src.push("}");src.push("float G_GGX_SmithCorrelated(const in float alpha, const in float dotNL, const in float dotNV) {");src.push(" float a2 = ( alpha * alpha );");src.push(" float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * ( dotNV * dotNV ) );");src.push(" float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * ( dotNL * dotNL ) );");src.push(" return 0.5 / max( gv + gl, 1e-6 );");src.push("}");src.push("float D_GGX(const in float alpha, const in float dotNH) {");src.push(" float a2 = ( alpha * alpha );");src.push(" float denom = ( dotNH * dotNH) * ( a2 - 1.0 ) + 1.0;");src.push(" return 0.31830988618 * a2 / ( denom * denom);");// 1/PI
5296
+ return withViewLightDir(function(viewMatrix,viewPosition){return"(".concat(viewMatrix," * vec4(").concat(lightUniforms.position,", 1.0)).xyz - ").concat(viewPosition);});}}else{return null;}}).filter(function(v){return v;});var setupCubeTexture=function setupCubeTexture(name,getMaps){var getValue=function getValue(){var m=getMaps();return m.length>0&&m[0];};var initMap=getValue();return initMap&&setupTexture(programVariables,"samplerCube",name,initMap.encoding,function(set){var v=getValue();v&&set(v.texture);});};var lightMap=setupCubeTexture("light",function(){return lightsState.lightMaps;});var reflectionMap=setupCubeTexture("reflection",function(){return lightsState.reflectionMaps;});return{getHash:function getHash(){return lightsState.getHash();},getAmbientColor:function getAmbientColor(){return"".concat(lightAmbient,".rgb * ").concat(lightAmbient,".a");},directionalLights:directionals.map(function(light){return light.glslLight;}),getIrradiance:lightMap&&function(worldNormal){return"".concat(lightMap(worldNormal),".rgb");},getReflection:reflectionMap&&function(reflectVec,mipLevel){return"".concat(reflectionMap(reflectVec,mipLevel),".rgb");}};};var setupTexture=function setupTexture(programVariables,type,name,encoding,getTexture){var map=programVariables.createUniform(type,name+"Map",getTexture);return function(texturePos,bias){var texel=bias?"texture(".concat(map,", ").concat(texturePos,", ").concat(bias,")"):"texture(".concat(map,", ").concat(texturePos,")");return encoding!==LinearEncoding?"".concat(TEXTURE_DECODE_FUNCS[encoding],"(").concat(texel,")"):texel;};};var makeInputSetters=function makeInputSetters(gl,handle){var activeInputs={};var numAttributes=gl.getProgramParameter(handle,gl.ACTIVE_ATTRIBUTES);var _loop6=function _loop6(_i82){var attribute=gl.getActiveAttrib(handle,_i82);var location=gl.getAttribLocation(handle,attribute.name);activeInputs[attribute.name]=function(arrayBuf){arrayBuf.bindAtLocation(location);gl.enableVertexAttribArray(location);var divisor=arrayBuf.attributeDivisor;if(divisor){gl.vertexAttribDivisor(location,divisor);}};activeInputs[attribute.name].attributeHash="".concat(location.toString().padStart(1+Math.floor(Math.log10(numAttributes)),"0"),":").concat(attribute.name);};for(var _i82=0;_i82<numAttributes;++_i82){_loop6(_i82);}var numBlocks=gl.getProgramParameter(handle,gl.ACTIVE_UNIFORM_BLOCKS);var _loop7=function _loop7(_i83){var blockName=gl.getActiveUniformBlockName(handle,_i83);var uniformBlockIndex=gl.getUniformBlockIndex(handle,blockName);var uniformBlockBinding=_i83;gl.uniformBlockBinding(handle,uniformBlockIndex,uniformBlockBinding);var buffer=gl.createBuffer();activeInputs[blockName]=function(data){gl.bindBuffer(gl.UNIFORM_BUFFER,buffer);gl.bufferData(gl.UNIFORM_BUFFER,data,gl.DYNAMIC_DRAW);gl.bindBufferBase(gl.UNIFORM_BUFFER,uniformBlockBinding,buffer);};};for(var _i83=0;_i83<numBlocks;++_i83){_loop7(_i83);}var numUniforms=gl.getProgramParameter(handle,gl.ACTIVE_UNIFORMS);var nextUnit=0;var _loop8=function _loop8(_i84){var u=gl.getActiveUniform(handle,_i84);var uName=u.name;if(uName.endsWith("[0]")){uName=uName.substr(0,uName.length-3);}if(uName[uName.length-1]==="\0"){uName=uName.substr(0,uName.length-1);}var location=gl.getUniformLocation(handle,uName);(function(){for(var k in gl){if(u.type===gl[k])return k;}return null;})();if(u.type===gl.SAMPLER_2D||u.type===gl.SAMPLER_CUBE||u.type===gl.SAMPLER_2D_SHADOW||gl instanceof window.WebGL2RenderingContext&&(u.type===gl.UNSIGNED_INT_SAMPLER_2D||u.type===gl.INT_SAMPLER_2D)){var unit=nextUnit++;activeInputs[uName]=function(texture){var bound=texture.bind(unit);if(bound){gl.uniform1i(location,unit);}return bound;};}else{activeInputs[uName]=function(){if(u.size===1){switch(u.type){case gl.BOOL:return function(value){return gl.uniform1i(location,value);};case gl.INT:return function(value){return gl.uniform1i(location,value);};case gl.FLOAT:return function(value){return gl.uniform1f(location,value);};case gl.FLOAT_VEC2:return function(value){return gl.uniform2fv(location,value);};case gl.FLOAT_VEC3:return function(value){return gl.uniform3fv(location,value);};case gl.FLOAT_VEC4:return function(value){return gl.uniform4fv(location,value);};case gl.FLOAT_MAT3:return function(value){return gl.uniformMatrix3fv(location,false,value);};case gl.FLOAT_MAT4:return function(value){return gl.uniformMatrix4fv(location,false,value);};}}else if(u.size>1){switch(u.type){case gl.FLOAT:return function(value){return gl.uniform1fv(location,value);};case gl.FLOAT_VEC2:return function(value){return gl.uniform2fv(location,value);};case gl.FLOAT_VEC3:return function(value){return gl.uniform3fv(location,value);};case gl.FLOAT_VEC4:return function(value){return gl.uniform4fv(location,value);};}}throw"Unhandled uniform ".concat(uName);}();}};for(var _i84=0;_i84<numUniforms;++_i84){_loop8(_i84);}return function(name){var u=activeInputs[name];if(!u){throw"Missing input \"".concat(name,"\"");}return u;};};var tempVec4$2=math.vec4();var DrawShaderSource=function DrawShaderSource(meshDrawHash,programVariables,geometry,material,scene){var materialState=material._state;var phongMaterial=materialState.type==="PhongMaterial";var metallicMaterial=materialState.type==="MetallicMaterial";var specularMaterial=materialState.type==="SpecularMaterial";var attributes=geometry.attributes;var lightSetup=createLightSetup(programVariables,scene._lightsState);var colorize=programVariables.createUniform("vec4","colorize",function(set,state){return set(state.meshColorize);});var fresnel=programVariables.createFragmentDefinition("fresnel",function(name,src){src.push("float ".concat(name,"(vec3 eyeDir, vec3 normal, float edgeBias, float centerBias, float power) {"));src.push(" float fr = abs(dot(eyeDir, normal));");src.push(" float finalFr = clamp((fr - edgeBias) / (centerBias - edgeBias), 0.0, 1.0);");src.push(" return pow(finalFr, power);");src.push("}");});var setupFresnel=function setupFresnel(name,colorSwizzle,getMaterialValue){var fresnelUniform=function fresnelUniform(type,namePostfix,getParameterValue){return programVariables.createUniform(type,name+"Fresnel"+namePostfix,function(set,state){return set(getParameterValue(getMaterialValue(state.material)));});};var edgeBias=fresnelUniform("float","EdgeBias",function(fresnelValue){return fresnelValue.edgeBias;});var centerBias=fresnelUniform("float","CenterBias",function(fresnelValue){return fresnelValue.centerBias;});var power=fresnelUniform("float","Power",function(fresnelValue){return fresnelValue.power;});var edgeColor=fresnelUniform("vec3","EdgeColor",function(fresnelValue){return fresnelValue.edgeColor;});var centerColor=fresnelUniform("vec3","CenterColor",function(fresnelValue){return fresnelValue.centerColor;});return getMaterialValue(material)&&function(viewEyeDir,viewNormal){var f="".concat(fresnel,"(").concat(viewEyeDir,", ").concat(viewNormal,", ").concat(edgeBias,", ").concat(centerBias,", ").concat(power,")");return"mix(".concat(edgeColor+colorSwizzle,", ").concat(centerColor+colorSwizzle,", ").concat(f,")");};};var diffuseFresnel=setupFresnel("diffuse","",function(mtl){return mtl._diffuseFresnel;});var specularFresnel=setupFresnel("specular","",function(mtl){return mtl._specularFresnel;});var emissiveFresnel=setupFresnel("emissive","",function(mtl){return mtl._emissiveFresnel;});var alphaFresnel=setupFresnel("alpha",".r",function(mtl){return mtl._alphaFresnel;});var setup2dTexture=function setup2dTexture(name,getMaterialValue){var initTex=attributes.uv&&getMaterialValue(material);var tex=initTex&&setupTexture(programVariables,"sampler2D",name,initTex.encoding,function(set,state){return set(getMaterialValue(state.material)._state.texture);});return tex&&function(){var matrix=initTex._state.matrix&&programVariables.createUniform("mat4",name+"MapMatrix",function(set,state){return set(getMaterialValue(state.material)._state.matrix);});var getTexCoordExpression=matrix?function(texPos){return"(".concat(matrix," * ").concat(texPos,").st");}:function(texPos){return"".concat(texPos,".st");};var sample=function sample(texturePos,bias){return tex(getTexCoordExpression(texturePos));};sample.getTexCoordExpression=getTexCoordExpression;return sample;}();};var ambientMap=setup2dTexture("ambient",function(mtl){return mtl._ambientMap;});var baseColorMap=setup2dTexture("baseColor",function(mtl){return mtl._baseColorMap;});var diffuseMap=setup2dTexture("diffuse",function(mtl){return mtl._diffuseMap;});var emissiveMap=setup2dTexture("emissive",function(mtl){return mtl._emissiveMap;});var occlusionMap=setup2dTexture("occlusion",function(mtl){return mtl._occlusionMap;});var alphaMap=setup2dTexture("alpha",function(mtl){return mtl._alphaMap;});var metallicMap=setup2dTexture("metallic",function(mtl){return mtl._metallicMap;});var roughnessMap=setup2dTexture("roughness",function(mtl){return mtl._roughnessMap;});var metallicRoughnessMap=setup2dTexture("metallicRoughness",function(mtl){return mtl._metallicRoughnessMap;});var specularMap=setup2dTexture("specular",function(mtl){return mtl._specularMap;});var glossinessMap=setup2dTexture("glossiness",function(mtl){return mtl._glossinessMap;});var specularGlossinessMap=setup2dTexture("specularGlossiness",function(mtl){return mtl._specularGlossinessMap;});var normalMap=setup2dTexture("normal",function(mtl){return mtl._normalMap;});var setupUniform=function setupUniform(name,type,getMaterialValue){var initValue=getMaterialValue(material);var isDefined=type==="float"?initValue!==undefined&&initValue!==null:initValue;return isDefined&&programVariables.createUniform(type,name,function(set,state){return set(getMaterialValue(state.material));});};var materialAmbient=setupUniform("materialAmbient","vec3",function(mtl){return mtl.ambient;});var materialDiffuse=setupUniform("materialDiffuse","vec3",function(mtl){return mtl.diffuse;});var materialBaseColor=setupUniform("materialBaseColor","vec3",function(mtl){return mtl.baseColor;});var materialEmissive=setupUniform("materialEmissive","vec3",function(mtl){return mtl.emissive;});var materialSpecular=setupUniform("materialSpecular","vec3",function(mtl){return mtl.specular;});var materialGlossiness=setupUniform("materialGlossiness","float",function(mtl){return mtl.glossiness;});var materialMetallic=setupUniform("materialMetallic","float",function(mtl){return mtl.metallic;});var materialRoughness=setupUniform("materialRoughness","float",function(mtl){return mtl.roughness;});var materialShininess=setupUniform("materialShininess","float",function(mtl){return mtl.shininess;});var materialSpecularF0=setupUniform("materialSpecularF0","float",function(mtl){return mtl.specularF0;});var materialAlphaModeCutoff=setupUniform("materialAlphaModeCutoff","vec4",function(mtl){var alpha=mtl.alpha;if(alpha!==undefined&&alpha!==null){tempVec4$2[0]=alpha;tempVec4$2[1]=mtl.alphaMode===1?1:0;tempVec4$2[2]=mtl.alphaCutoff;return tempVec4$2;}else{return null;}});var vViewPosition=programVariables.createVarying("vec3","vViewPosition",function(){return"".concat(attributes.position.view,".xyz");});var texturePos=programVariables.createVarying("vec4","texturePos",function(){return"vec4(".concat(attributes.uv,", 1.0, 1.0)");});var vColor=attributes.color&&programVariables.createVarying("vec4","vColor",function(){return attributes.color;});var vViewNormal=programVariables.createVarying("vec3","vViewNormal",function(){return attributes.normal.view;});var texUnitConverter="mat4(0.5, 0.0, 0.0, 0.0, 0.0, 0.5, 0.0, 0.0, 0.0, 0.0, 0.5, 0.0, 0.5, 0.5, 0.5, 1.0)";var vDirectionals=lightSetup.directionalLights.map(function(light,i){return{vViewLightReverseDir:programVariables.createVarying("vec3","vViewLightReverseDir".concat(i),function(){return light.getDirection(geometry.viewMatrix,null);}),vShadowPosFromLight:programVariables.createVarying("vec3","vShadowPosFromLight".concat(i),function(){return"(".concat(texUnitConverter," * ").concat(light.shadowParameters.getShadowProjMatrix()," * (").concat(light.shadowParameters.getShadowViewMatrix()," * ").concat(attributes.position.world,")).xyz");})};});var vWorldNormal=programVariables.createVarying("vec3","vWorldNormal",function(){return attributes.normal.world;});var outColor=programVariables.createOutput("vec4","outColor");var saturate=programVariables.createFragmentDefinition("saturate",function(name,src){return src.push("float ".concat(name,"(const in float a) { return clamp(a, 0.0, 1.0); }"));});var BRDF_Specular_GGX=programVariables.createFragmentDefinition("BRDF_Specular_GGX",function(name,src){src.push("vec3 F_Schlick(const in vec3 specularColor, const in float dotLH) {");src.push(" float fresnel = exp2( ( -5.55473 * dotLH - 6.98316 ) * dotLH );");src.push(" return ( 1.0 - specularColor ) * fresnel + specularColor;");src.push("}");src.push("float G_GGX_Smith(const in float alpha, const in float dotNL, const in float dotNV) {");src.push(" float a2 = ( alpha * alpha );");src.push(" float gl = dotNL + sqrt( a2 + ( 1.0 - a2 ) * ( dotNL * dotNL ) );");src.push(" float gv = dotNV + sqrt( a2 + ( 1.0 - a2 ) * ( dotNV * dotNV ) );");src.push(" return 1.0 / ( gl * gv );");src.push("}");src.push("float G_GGX_SmithCorrelated(const in float alpha, const in float dotNL, const in float dotNV) {");src.push(" float a2 = ( alpha * alpha );");src.push(" float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * ( dotNV * dotNV ) );");src.push(" float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * ( dotNL * dotNL ) );");src.push(" return 0.5 / max( gv + gl, 1e-6 );");src.push("}");src.push("float D_GGX(const in float alpha, const in float dotNH) {");src.push(" float a2 = ( alpha * alpha );");src.push(" float denom = ( dotNH * dotNH) * ( a2 - 1.0 ) + 1.0;");src.push(" return 0.31830988618 * a2 / ( denom * denom);");// 1/PI
5297
5297
  src.push("}");src.push("vec3 ".concat(name,"(const in vec3 incidentLightDirection, const in vec3 viewNormal, const in vec3 viewEyeDir, const in vec3 specularColor, const in float roughness) {"));src.push(" float alpha = ( roughness * roughness );");src.push(" vec3 halfDir = normalize( incidentLightDirection + viewEyeDir );");src.push(" float dotNL = ".concat(saturate,"( dot( viewNormal, incidentLightDirection ) );"));src.push(" float dotNV = ".concat(saturate,"( dot( viewNormal, viewEyeDir ) );"));src.push(" float dotNH = ".concat(saturate,"( dot( viewNormal, halfDir ) );"));src.push(" float dotLH = ".concat(saturate,"( dot( incidentLightDirection, halfDir ) );"));src.push(" vec3 F = F_Schlick( specularColor, dotLH );");src.push(" float G = G_GGX_SmithCorrelated( alpha, dotNL, dotNV );");src.push(" float D = D_GGX( alpha, dotNH );");src.push(" return F * (G * D);");src.push("}");});var BRDF_Specular_GGX_Environment=programVariables.createFragmentDefinition("BRDF_Specular_GGX_Environment",function(name,src){src.push("vec3 ".concat(name,"(const in vec3 viewNormal, const in vec3 viewEyeDir, const in vec3 specularColor, const in float roughness) {"));src.push(" float dotNV = ".concat(saturate,"(dot(viewNormal, viewEyeDir));"));src.push(" const vec4 c0 = vec4( -1, -0.0275, -0.572, 0.022);");src.push(" const vec4 c1 = vec4( 1, 0.0425, 1.04, -0.04);");src.push(" vec4 r = roughness * c0 + c1;");src.push(" float a004 = min(r.x * r.x, exp2(-9.28 * dotNV)) * r.x + r.y;");src.push(" vec2 AB = vec2(-1.04, 1.04) * a004 + r.zw;");src.push(" return specularColor * AB.x + AB.y;");src.push("}");});var perturbNormal2Arb=programVariables.createFragmentDefinition("perturbNormal2Arb",function(name,src){src.push("vec3 ".concat(name,"( vec3 eye_pos, vec3 surf_norm, vec2 uv, vec4 texel ) {"));src.push(" vec3 q0 = vec3( dFdx( eye_pos.x ), dFdx( eye_pos.y ), dFdx( eye_pos.z ) );");src.push(" vec3 q1 = vec3( dFdy( eye_pos.x ), dFdy( eye_pos.y ), dFdy( eye_pos.z ) );");src.push(" vec2 st0 = dFdx( uv.st );");src.push(" vec2 st1 = dFdy( uv.st );");src.push(" vec3 S = normalize( q0 * st1.t - q1 * st0.t );");src.push(" vec3 T = normalize( -q0 * st1.s + q1 * st0.s );");src.push(" vec3 N = normalize( surf_norm );");src.push(" vec3 mapN = texel.xyz * 2.0 - 1.0;");src.push(" mat3 tsn = mat3( S, T, N );");// src.push(" mapN *= 3.0;");
5298
5298
  src.push(" return normalize( tsn * mapN );");src.push("}");});return{getHash:function getHash(){return[meshDrawHash,scene.gammaOutput?"go":"",lightSetup.getHash(),material._state.hash];},programName:"Draw",canActAsBackground:true,discardPoints:true,setupPointSize:true,setsLineWidth:true,appendFragmentOutputs:function appendFragmentOutputs(src,getGammaOutputExpression,gl_FragCoord){var hasNonAmbientLighting=attributes.normal&&(lightSetup.directionalLights.length>0||lightSetup.getIrradiance||lightSetup.getReflection);src.push("vec3 diffuseColor = ".concat(hasNonAmbientLighting&&(phongMaterial||specularMaterial)&&materialDiffuse||metallicMaterial&&materialBaseColor||"vec3(1.0)",";"));src.push("vec4 alphaModeCutoff = ".concat((phongMaterial||metallicMaterial||specularMaterial)&&materialAlphaModeCutoff||"vec4(1.0, 0.0, 0.0, 0.0)",";"));src.push("float alpha = alphaModeCutoff[0];");(phongMaterial||metallicMaterial||specularMaterial)&&alphaMap&&src.push("alpha *= ".concat(alphaMap(texturePos),".r;"));if(vColor){src.push("diffuseColor *= ".concat(vColor,".rgb;"));src.push("alpha *= ".concat(vColor,".a;"));}if(metallicMaterial&&baseColorMap){src.push("vec4 baseColorTexel = "+baseColorMap(texturePos)+";");src.push("diffuseColor *= baseColorTexel.rgb;");src.push("alpha *= baseColorTexel.a;");}if((phongMaterial||specularMaterial)&&diffuseMap){src.push("vec4 diffuseTexel = "+diffuseMap(texturePos)+";");src.push("diffuseColor *= diffuseTexel.rgb;");src.push("alpha *= diffuseTexel.a;");}src.push("vec3 emissiveColor = ".concat((phongMaterial||metallicMaterial||specularMaterial)&&materialEmissive||"vec3(0.0)",";"));(phongMaterial||metallicMaterial||specularMaterial)&&emissiveMap&&src.push("emissiveColor = ".concat(emissiveMap(texturePos),".rgb;"));if(hasNonAmbientLighting){src.push("vec3 specular = ".concat((phongMaterial||specularMaterial)&&materialSpecular||"vec3(1.0)",";"));src.push("float glossiness = ".concat(specularMaterial&&materialGlossiness||"1.0",";"));src.push("float metallic = ".concat(metallicMaterial&&materialMetallic||"1.0",";"));src.push("float roughness = ".concat((metallicMaterial||specularMaterial)&&materialRoughness||"1.0",";"));src.push("float shininess = ".concat(phongMaterial&&materialShininess||"1.0",";"));src.push("float specularF0 = ".concat(metallicMaterial&&materialSpecularF0||"1.0",";"));src.push("float occlusion = ".concat((phongMaterial||metallicMaterial||specularMaterial)&&occlusionMap?"".concat(occlusionMap(texturePos),".r"):"1.0",";"));//--------------------------------------------------------------------------------
5299
5299
  // SHADING
@@ -9097,9 +9097,10 @@ appendFragmentOutputs:function appendFragmentOutputs(src){return src.push("".con
9097
9097
  appendFragmentOutputs:function appendFragmentOutputs(src){var worldNormal=isFlat?"normalize(cross(dFdx(".concat(vWorldPosition,"), dFdy(").concat(vWorldPosition,")))"):vWorldNormal;src.push("".concat(outNormal," = ivec4(").concat(worldNormal," * float(").concat(math.MAX_INT,"), 1.0);"));}};};var ShadowProgram=function ShadowProgram(programVariables,logarithmicDepthBufferEnabled){// VBOBatchingPointsShadowRenderer has been implemented by 14e973df6268369b00baef60e468939e062ac320,
9098
9098
  // but never used (and probably not maintained), as opposed to VBOInstancingPointsShadowRenderer in the same commit
9099
9099
  var outColor=programVariables.createOutput("vec4","outColor");var encodeFloat=programVariables.createFragmentDefinition("encodeFloat",function(name,src){src.push("vec4 ".concat(name,"(const in float v) {"));src.push(" const vec4 bitShift = vec4(256 * 256 * 256, 256 * 256, 256, 1.0);");src.push(" const vec4 bitMask = vec4(0, 1.0 / 256.0, 1.0 / 256.0, 1.0 / 256.0);");src.push(" vec4 comp = fract(v * bitShift);");src.push(" comp -= comp.xxyz * bitMask;");src.push(" return comp;");src.push("}");});return{programName:"Shadow",getLogDepth:logarithmicDepthBufferEnabled&&function(vFragDepth){return vFragDepth;},renderPassFlag:0,isShadowProgram:true,appendFragmentOutputs:function appendFragmentOutputs(src,getGammaOutputExpression,gl_FragCoord){return src.push("".concat(outColor," = ").concat(encodeFloat,"(").concat(gl_FragCoord,".z);"));}};};var SilhouetteProgram=function SilhouetteProgram(programVariables,geometry,logarithmicDepthBufferEnabled,isPointsOrLines){var silhouetteColor=programVariables.createUniform("vec4","silhouetteColor",function(set,state){return set(state.legacyFrameCtx.programColor);});var vAlpha=programVariables.createVarying("float","vAlpha",function(){return"".concat(geometry.attributes.color,".a");});var outColor=programVariables.createOutput("vec4","outColor");return{programName:"Silhouette",getLogDepth:logarithmicDepthBufferEnabled&&function(vFragDepth){return vFragDepth;},renderPassFlag:1,// SILHOUETTE_HIGHLIGHTED | SILHOUETTE_SELECTED | SILHOUETTE_XRAYED
9100
- appendFragmentOutputs:function appendFragmentOutputs(src,getGammaOutputExpression,gl_FragCoord,sliceColorOr){src.push("".concat(outColor," = ").concat(isPointsOrLines?silhouetteColor:sliceColorOr("vec4(".concat(silhouetteColor,".rgb, min(").concat(silhouetteColor,".a, ").concat(vAlpha,"))")),";"));}};};var SnapProgram=function SnapProgram(programVariables,geometry,isSnapInit,isPoints){var layerNumber=programVariables.createUniform("int","layerNumber",function(set,state){return set(state.legacyFrameCtx.snapPickLayerParams.length);});var coordinateScaler=programVariables.createUniform("vec3","coordinateScaler",function(set,state){return set(state.legacyFrameCtx.snapPickCoordinateScale);});var vWorldPosition=programVariables.createVarying("vec3","vWorldPosition",function(){return"".concat(geometry.attributes.position.world,".xyz");});var vPickColor=programVariables.createVarying("vec4","vPickColor",function(){return geometry.attributes.pickColor;},"flat");var outCoords=programVariables.createOutput("highp ivec4","outCoords",0);var outNormal=programVariables.createOutput("highp ivec4","outNormal",1);var outPickColor=programVariables.createOutput("lowp uvec4","outPickColor",2);return{programName:isSnapInit?"SnapInit":"Snap",// Improves occlusion accuracy at distance
9100
+ appendFragmentOutputs:function appendFragmentOutputs(src,getGammaOutputExpression,gl_FragCoord,sliceColorOr){src.push("".concat(outColor," = ").concat(isPointsOrLines?silhouetteColor:sliceColorOr("vec4(".concat(silhouetteColor,".rgb, min(").concat(silhouetteColor,".a, ").concat(vAlpha,"))")),";"));}};};var SnapProgram=function SnapProgram(programVariables,geometry,isSnapInit,isPoints){var layerNumber=programVariables.createUniform("int","layerNumber",function(set,state){return set(state.legacyFrameCtx.snapPickLayerParams.length);});var coordinateScaler=programVariables.createUniform("vec3","coordinateScaler",function(set,state){return set(state.legacyFrameCtx.snapPickCoordinateScale);});var vWorldPosition=programVariables.createVarying("vec3","vWorldPosition",function(){return"".concat(geometry.attributes.position.world,".xyz");});var vPickColor=programVariables.createVarying("vec4","vPickColor",function(){return geometry.attributes.pickColor;});// Using `flat` causes an instability - see XEOK-385 and XEOK-401
9101
+ var outCoords=programVariables.createOutput("highp ivec4","outCoords",0);var outNormal=programVariables.createOutput("highp ivec4","outNormal",1);var outPickColor=programVariables.createOutput("lowp uvec4","outPickColor",2);return{programName:isSnapInit?"SnapInit":"Snap",// Improves occlusion accuracy at distance
9101
9102
  getLogDepth:function getLogDepth(vFragDepth){return isSnapInit?"".concat(vFragDepth," + length(vec2(dFdx(").concat(vFragDepth,"), dFdy(").concat(vFragDepth,")))"):vFragDepth;},renderPassFlag:3,// PICK
9102
- vertexCullX:!isSnapInit&&"2.0",dontCullOnAlphaZero:!isSnapInit,appendFragmentOutputs:function appendFragmentOutputs(src){src.push("".concat(outCoords," = ivec4(").concat(vWorldPosition," * ").concat(coordinateScaler,".xyz, ").concat(isSnapInit?"-":"").concat(layerNumber,");"));if(isSnapInit){src.push("".concat(outNormal," = ").concat(isPoints?"ivec4(1.0)":"ivec4(normalize(cross(dFdx(".concat(vWorldPosition,"), dFdy(").concat(vWorldPosition,"))) * float(").concat(math.MAX_INT,"), 1.0)"),";"));src.push("".concat(outPickColor," = uvec4(").concat(vPickColor,");"));}}};};var tempVec2=math.vec2();var tempVec3$6=math.vec3();var tempVec4=math.vec4();var tempMat4$2=math.mat4();var vec3zero=math.vec3([0,0,0]);var RENDER_PASSES={// Skipped - suppress rendering
9103
+ vertexCullX:!isSnapInit&&"2.0",dontCullOnAlphaZero:!isSnapInit,appendFragmentOutputs:function appendFragmentOutputs(src){src.push("".concat(outCoords," = ivec4(").concat(vWorldPosition," * ").concat(coordinateScaler,".xyz, ").concat(isSnapInit?"-":"").concat(layerNumber,");"));if(isSnapInit){src.push("".concat(outNormal," = ").concat(isPoints?"ivec4(1.0)":"ivec4(normalize(cross(dFdx(".concat(vWorldPosition,"), dFdy(").concat(vWorldPosition,"))) * float(").concat(math.MAX_INT,"), 1.0)"),";"));src.push("".concat(outPickColor," = uvec4(").concat(vPickColor,");"));}}};};var tempVec2=math.vec2();var tempVec3$6=math.vec3();var tempVec4$1=math.vec4();var tempMat4$2=math.mat4();var vec3zero=math.vec3([0,0,0]);var RENDER_PASSES={// Skipped - suppress rendering
9103
9104
  NOT_RENDERED:0,// Normal rendering - mutually exclusive modes
9104
9105
  COLOR_OPAQUE:1,COLOR_TRANSPARENT:2,// Emphasis silhouette rendering - mutually exclusive modes
9105
9106
  SILHOUETTE_HIGHLIGHTED:3,SILHOUETTE_SELECTED:4,SILHOUETTE_XRAYED:5,// Edges rendering - mutually exclusive modes
@@ -9121,17 +9122,17 @@ var blendCutoff="".concat(uSAOParams,".z");var blendFactor="".concat(uSAOParams,
9121
9122
  return{"PBR":pbrSupported&&lazy(function(vars,geo,c){return c(PBRProgram(vars,geo,scene,createLights(vars),useSao&&createSAO(vars)));}),"texture":colorTextureSupported&&{"alphaCutoff-":lazy(function(vars,geo,c){return c(makeColorTextureProgram(vars,geo,false));}),"alphaCutoff+":lazy(function(vars,geo,c){return c(makeColorTextureProgram(vars,geo,true));})},"vertex":surfaceHasNormals?lazy(function(vars,geo,c){return c(makeColorProgram(vars,geo,createLights(vars),useSao&&createSAO(vars)));}):lazy(function(vars,geo,c){return c(FlatColorProgram(vars,geo,scene.logarithmicDepthBufferEnabled,createLights(vars),useSao&&createSAO(vars)));})};};return{"sao-":saoRenderers(false),"sao+":saoEnabled&&saoRenderers(true)};}(),depthRenderer:lazy(function(vars,geo,c){return c(DepthProgram(vars,geo,scene.logarithmicDepthBufferEnabled));}),edgesRenderers:{uniform:lazy(function(vars,geo,c){return c(EdgesProgram(vars,geo,scene.logarithmicDepthBufferEnabled,true));},{vertices:false}),vertex:lazy(function(vars,geo,c){return c(EdgesProgram(vars,geo,scene.logarithmicDepthBufferEnabled,false));},{vertices:false})},occlusionRenderer:lazy(function(vars,geo,c){return c(OcclusionProgram(vars,scene.logarithmicDepthBufferEnabled));}),pickDepthRenderer:eager(makePickDepthProgram),pickMeshRenderer:eager(makePickMeshProgram),pickNormalsFlatRenderer:eager(function(vars,geo,c){return makePickNormalsProgram(vars,geo,c,true);}),pickNormalsRenderer:eager(function(vars,geo,c){return makePickNormalsProgram(vars,geo,c,false);}),shadowRenderer:lazy(function(vars,geo,c){return c(ShadowProgram(vars,scene));}),silhouetteRenderer:eager(function(vars,geo,c){return c(SilhouetteProgram(vars,geo,scene.logarithmicDepthBufferEnabled,false));}),snapInitRenderer:eager(function(vars,geo,c){return makeSnapProgram(vars,geo,c,true,false);}),snapEdgeRenderer:eager(function(vars,geo,c){return makeSnapProgram(vars,geo,c,false,false);},{vertices:false}),snapVertexRenderer:eager(function(vars,geo,c){return makeSnapProgram(vars,geo,c,false,false);},{vertices:true})};}var revalidateAll=function revalidateAll(force){(function rec(obj){if(obj.revalidate){obj.revalidate(force);}else{Object.values(obj).forEach(function(v){return v&&rec(v);});}})(cache[sceneId]);};var compile=function compile(){return revalidateAll(false);};compile();scene.on("compile",compile);scene.on("destroyed",function(){delete cache[sceneId];});}return cache[sceneId];};}();var Layer=/*#__PURE__*/function(){function Layer(model,primitive,origin){_classCallCheck(this,Layer);this.model=model;this.primitive=primitive;this.origin=origin;this._meshes=[];// The axis-aligned World-space boundary of this Layer's positions.
9122
9123
  this._aabb=math.collapseAABB3();this._aabbDirty=true;}_createClass(Layer,[{key:"finalize",value:function finalize(){var _this38=this;if(!this._compiledPortions){this._compiledPortions=this.compilePortions();this.solid=this._compiledPortions.solid;this.sortId=this._compiledPortions.sortId;this.layerTextureSet=this._compiledPortions.layerTextureSet;this.drawCalls=this._compiledPortions.drawCalls;this._renderers=this._compiledPortions.renderers;this._setFlags=this._compiledPortions.setFlags;this.setColor=this._compiledPortions.setColor;this.setMatrix=this._compiledPortions.setMatrix;this.setOffset=this._compiledPortions.setOffset;this.getEachIndex=this._compiledPortions.getEachIndex;this.getEachVertex=this._compiledPortions.getEachVertex;this.readGeometryData=this._compiledPortions.readGeometryData;this.precisionRayPickSurface=this._compiledPortions.precisionRayPickSurface;// These counts are used to avoid unnecessary render passes
9123
9124
  this._countsByFlag={};var setupFlagCount=function setupFlagCount(entityFlag,modelCountProperty){var cnt={count:0,fromFlags:function fromFlags(flags,onlyIncrement){if(flags&entityFlag){cnt.count++;_this38.model[modelCountProperty]++;}else if(!onlyIncrement){cnt.count--;_this38.model[modelCountProperty]--;}}};_this38._countsByFlag[entityFlag]=cnt;};setupFlagCount(ENTITY_FLAGS.VISIBLE,"numVisibleLayerPortions");setupFlagCount(ENTITY_FLAGS.CULLED,"numCulledLayerPortions");setupFlagCount(ENTITY_FLAGS.PICKABLE,"numPickableLayerPortions");setupFlagCount(ENTITY_FLAGS.CLIPPABLE,"numClippableLayerPortions");setupFlagCount(ENTITY_FLAGS.XRAYED,"numXRayedLayerPortions");setupFlagCount(ENTITY_FLAGS.HIGHLIGHTED,"numHighlightedLayerPortions");setupFlagCount(ENTITY_FLAGS.SELECTED,"numSelectedLayerPortions");if(this._renderers.edgesRenderers){setupFlagCount(ENTITY_FLAGS.EDGES,"numEdgesLayerPortions");}// Optimize initFlags to not require Object.values call each time (adds up a lot)
9124
- this._countsByFlagArr=Object.values(this._countsByFlag);this._numTransparentLayerPortions=0;}}},{key:"aabbChanged",value:function aabbChanged(){this._aabbDirty=true;}},{key:"__drawLayer",value:function __drawLayer(renderFlags,frameCtx,renderer,pass){if(this._countsByFlag[ENTITY_FLAGS.CULLED].count<this._portions.length&&this._countsByFlag[ENTITY_FLAGS.VISIBLE].count>0){var backfacePasses=this.primitive!=="points"&&this.primitive!=="lines"&&[RENDER_PASSES.COLOR_OPAQUE,RENDER_PASSES.COLOR_TRANSPARENT,RENDER_PASSES.PICK,RENDER_PASSES.SILHOUETTE_HIGHLIGHTED,RENDER_PASSES.SILHOUETTE_SELECTED,RENDER_PASSES.SILHOUETTE_XRAYED];if(backfacePasses&&backfacePasses.includes(pass)){// _updateBackfaceCull
9125
+ this._countsByFlagArr=Object.values(this._countsByFlag);this._numTransparentLayerPortions=0;}}},{key:"aabbChanged",value:function aabbChanged(){this._aabbDirty=true;}},{key:"getAABB",value:function getAABB(){var _this39=this;if(this._aabbDirty){// Per-layer AABB for best RTC accuracy
9126
+ math.collapseAABB3(this._aabb);this._meshes.forEach(function(m){return math.expandAABB3(_this39._aabb,m.aabb);});this._aabbDirty=false;}return this._aabb;}},{key:"__drawLayer",value:function __drawLayer(renderFlags,frameCtx,renderer,pass){if(this._countsByFlag[ENTITY_FLAGS.CULLED].count<this._portions.length&&this._countsByFlag[ENTITY_FLAGS.VISIBLE].count>0){var backfacePasses=this.primitive!=="points"&&this.primitive!=="lines"&&[RENDER_PASSES.COLOR_OPAQUE,RENDER_PASSES.COLOR_TRANSPARENT,RENDER_PASSES.PICK,RENDER_PASSES.SILHOUETTE_HIGHLIGHTED,RENDER_PASSES.SILHOUETTE_SELECTED,RENDER_PASSES.SILHOUETTE_XRAYED];if(backfacePasses&&backfacePasses.includes(pass)){// _updateBackfaceCull
9125
9127
  var backfaces=true;// See XCD-230
9126
9128
  if(frameCtx.backfaces!==backfaces){var gl=this.model.scene.canvas.gl;{gl.disable(gl.CULL_FACE);}frameCtx.backfaces=backfaces;}}frameCtx.textureUnit=0;// WIP Maybe only for (! snap)?
9127
9129
  renderer.drawLayer(frameCtx,this,pass);}}},{key:"__setVec4FromMaterialColorAlpha",value:function __setVec4FromMaterialColorAlpha(color,alpha,dst){dst[0]=color[0];dst[1]=color[1];dst[2]=color[2];dst[3]=alpha;return dst;}// ---------------------- COLOR RENDERING -----------------------------------
9128
9130
  },{key:"__drawColor",value:function __drawColor(renderFlags,frameCtx,renderOpaque){if((renderOpaque?this._numTransparentLayerPortions<this._portions.length:this._numTransparentLayerPortions>0)&&this._countsByFlag[ENTITY_FLAGS.XRAYED].count<this._portions.length){var saoRenderer=renderOpaque&&frameCtx.withSAO&&this._renderers.colorRenderers["sao+"]||this._renderers.colorRenderers["sao-"];var renderer=frameCtx.pbrEnabled&&saoRenderer["PBR"]?saoRenderer["PBR"]:frameCtx.colorTextureEnabled&&saoRenderer["texture"]?saoRenderer["texture"][this.layerTextureSet&&typeof this.layerTextureSet.alphaCutoff==="number"?"alphaCutoff+":"alphaCutoff-"]:saoRenderer["vertex"];var pass=renderOpaque?RENDER_PASSES.COLOR_OPAQUE:RENDER_PASSES.COLOR_TRANSPARENT;this.__drawLayer(renderFlags,frameCtx,renderer,pass);}}},{key:"drawColorOpaque",value:function drawColorOpaque(renderFlags,frameCtx){this.__drawColor(renderFlags,frameCtx,true);}},{key:"drawColorTransparent",value:function drawColorTransparent(renderFlags,frameCtx){this.__drawColor(renderFlags,frameCtx,false);}// ---------------------- RENDERING SAO POST EFFECT TARGETS --------------
9129
9131
  },{key:"drawDepth",value:function drawDepth(renderFlags,frameCtx){// Assume whatever post-effect uses depth (eg SAO) does not apply to transparent objects
9130
9132
  var renderer=this._renderers.depthRenderer;if(renderer&&this._numTransparentLayerPortions<this._portions.length&&this._countsByFlag[ENTITY_FLAGS.XRAYED].count<this._portions.length){this.__drawLayer(renderFlags,frameCtx,renderer,RENDER_PASSES.COLOR_OPAQUE);}}// ---------------------- SILHOUETTE RENDERING -----------------------------------
9131
- },{key:"__drawSilhouette",value:function __drawSilhouette(renderFlags,frameCtx,material,renderPass){frameCtx.programColor=this.__setVec4FromMaterialColorAlpha(material.fillColor,material.fillAlpha,tempVec4);this.__drawLayer(renderFlags,frameCtx,this._renderers.silhouetteRenderer,renderPass);}},{key:"drawSilhouetteXRayed",value:function drawSilhouetteXRayed(renderFlags,frameCtx){if(this._countsByFlag[ENTITY_FLAGS.XRAYED].count>0){this.__drawSilhouette(renderFlags,frameCtx,this.model.scene.xrayMaterial,RENDER_PASSES.SILHOUETTE_XRAYED);}}},{key:"drawSilhouetteHighlighted",value:function drawSilhouetteHighlighted(renderFlags,frameCtx){if(this._countsByFlag[ENTITY_FLAGS.HIGHLIGHTED].count>0){this.__drawSilhouette(renderFlags,frameCtx,this.model.scene.highlightMaterial,RENDER_PASSES.SILHOUETTE_HIGHLIGHTED);}}},{key:"drawSilhouetteSelected",value:function drawSilhouetteSelected(renderFlags,frameCtx){if(this._countsByFlag[ENTITY_FLAGS.SELECTED].count>0){this.__drawSilhouette(renderFlags,frameCtx,this.model.scene.selectedMaterial,RENDER_PASSES.SILHOUETTE_SELECTED);}}// ---------------------- EDGES RENDERING -----------------------------------
9132
- },{key:"__drawVertexEdges",value:function __drawVertexEdges(renderFlags,frameCtx,renderPass){var renderer=this._renderers.edgesRenderers&&this._renderers.edgesRenderers.vertex;if(renderer&&this._countsByFlag[ENTITY_FLAGS.EDGES].count>0){this.__drawLayer(renderFlags,frameCtx,renderer,renderPass);}}},{key:"drawEdgesColorOpaque",value:function drawEdgesColorOpaque(renderFlags,frameCtx){if(this._compiledPortions.edgesColorOpaqueAllowed()){this.__drawVertexEdges(renderFlags,frameCtx,RENDER_PASSES.EDGES_COLOR_OPAQUE);}}},{key:"drawEdgesColorTransparent",value:function drawEdgesColorTransparent(renderFlags,frameCtx){if(this._numTransparentLayerPortions>0){this.__drawVertexEdges(renderFlags,frameCtx,RENDER_PASSES.EDGES_COLOR_TRANSPARENT);}}},{key:"__drawUniformEdges",value:function __drawUniformEdges(renderFlags,frameCtx,material,renderPass){var renderer=this._renderers.edgesRenderers&&this._renderers.edgesRenderers.uniform;if(renderer){frameCtx.programColor=this.__setVec4FromMaterialColorAlpha(material.edgeColor,material.edgeAlpha,tempVec4);this.__drawLayer(renderFlags,frameCtx,renderer,renderPass);}}},{key:"drawEdgesHighlighted",value:function drawEdgesHighlighted(renderFlags,frameCtx){if(this._countsByFlag[ENTITY_FLAGS.HIGHLIGHTED].count>0){this.__drawUniformEdges(renderFlags,frameCtx,this.model.scene.highlightMaterial,RENDER_PASSES.EDGES_HIGHLIGHTED);}}},{key:"drawEdgesSelected",value:function drawEdgesSelected(renderFlags,frameCtx){if(this._countsByFlag[ENTITY_FLAGS.SELECTED].count>0){this.__drawUniformEdges(renderFlags,frameCtx,this.model.scene.selectedMaterial,RENDER_PASSES.EDGES_SELECTED);}}},{key:"drawEdgesXRayed",value:function drawEdgesXRayed(renderFlags,frameCtx){if(this._countsByFlag[ENTITY_FLAGS.XRAYED].count>0){this.__drawUniformEdges(renderFlags,frameCtx,this.model.scene.xrayMaterial,RENDER_PASSES.EDGES_XRAYED);}}//---- PICKING ----------------------------------------------------------------------------------------------------
9133
- },{key:"__drawPick",value:function __drawPick(renderFlags,frameCtx,renderer){if(renderer){this.__drawLayer(renderFlags,frameCtx,renderer,RENDER_PASSES.PICK);}}},{key:"drawPickMesh",value:function drawPickMesh(renderFlags,frameCtx){this.__drawPick(renderFlags,frameCtx,this._renderers.pickMeshRenderer);}},{key:"drawPickDepths",value:function drawPickDepths(renderFlags,frameCtx){this.__drawPick(renderFlags,frameCtx,this._renderers.pickDepthRenderer);}},{key:"drawPickNormals",value:function drawPickNormals(renderFlags,frameCtx){var renderer=this._renderers.pickNormalsFlatRenderer;this.__drawPick(renderFlags,frameCtx,renderer);}},{key:"drawSnap",value:function drawSnap(renderFlags,frameCtx,isSnapInit){var _this39=this;frameCtx.snapPickOrigin=[0,0,0];if(this._aabbDirty){// Per-layer AABB for best RTC accuracy
9134
- math.collapseAABB3(this._aabb);this._meshes.forEach(function(m){return math.expandAABB3(_this39._aabb,m.aabb);});this._aabbDirty=false;}var aabb=this._aabb;frameCtx.snapPickCoordinateScale=math.mulVec3Scalar(safeInvVec3([aabb[3]-aabb[0],aabb[4]-aabb[1],aabb[5]-aabb[2]]),math.MAX_INT);var renderer=isSnapInit?this._renderers.snapInitRenderer:frameCtx.snapMode==="edge"?this._renderers.snapEdgeRenderer:this._renderers.snapVertexRenderer;this.__drawPick(renderFlags,frameCtx,renderer);frameCtx.snapPickLayerParams.push({origin:frameCtx.snapPickOrigin.slice(),coordinateScale:safeInvVec3(frameCtx.snapPickCoordinateScale)});}},{key:"drawOcclusion",value:function drawOcclusion(renderFlags,frameCtx){var renderer=this._renderers.occlusionRenderer;if(renderer){this.__drawLayer(renderFlags,frameCtx,renderer,RENDER_PASSES.COLOR_OPAQUE);}}},{key:"drawShadow",value:function drawShadow(renderFlags,frameCtx){var renderer=this._renderers.shadowRenderer;if(renderer){this.__drawLayer(renderFlags,frameCtx,renderer,RENDER_PASSES.COLOR_OPAQUE);}}},{key:"initFlags",value:function initFlags(portionId,flags,transparent){this._countsByFlagArr.forEach(function(cnt){return cnt.fromFlags(flags,true);});if(transparent){this._numTransparentLayerPortions++;this.model.numTransparentLayerPortions++;}var deferred=this.primitive!=="points";this._setFlags(portionId,flags,transparent,deferred);this._compiledPortions.setFlags2(portionId,flags,deferred);}},{key:"flushInitFlags",value:function flushInitFlags(){this._compiledPortions.setDeferredFlags();}},{key:"setVisible",value:function setVisible(portionId,flags,transparent){this._countsByFlag[ENTITY_FLAGS.VISIBLE].fromFlags(flags);this._setFlags(portionId,flags,transparent);}},{key:"setCulled",value:function setCulled(portionId,flags,transparent){this._countsByFlag[ENTITY_FLAGS.CULLED].fromFlags(flags);this._setFlags(portionId,flags,transparent);}},{key:"setPickable",value:function setPickable(portionId,flags,transparent){this._countsByFlag[ENTITY_FLAGS.PICKABLE].fromFlags(flags);this._setFlags(portionId,flags,transparent);}},{key:"setClippable",value:function setClippable(portionId,flags){this._countsByFlag[ENTITY_FLAGS.CLIPPABLE].fromFlags(flags);this._compiledPortions.setClippableFlags(portionId,flags);}},{key:"setCollidable",value:function setCollidable(portionId,flags){}},{key:"setXRayed",value:function setXRayed(portionId,flags,transparent){this._countsByFlag[ENTITY_FLAGS.XRAYED].fromFlags(flags);this._setFlags(portionId,flags,transparent);}},{key:"setHighlighted",value:function setHighlighted(portionId,flags,transparent){this._countsByFlag[ENTITY_FLAGS.HIGHLIGHTED].fromFlags(flags);this._setFlags(portionId,flags,transparent);}},{key:"setSelected",value:function setSelected(portionId,flags,transparent){this._countsByFlag[ENTITY_FLAGS.SELECTED].fromFlags(flags);this._setFlags(portionId,flags,transparent);}},{key:"setEdges",value:function setEdges(portionId,flags,transparent){if(this._countsByFlag[ENTITY_FLAGS.EDGES]){this._countsByFlag[ENTITY_FLAGS.EDGES].fromFlags(flags);this._setFlags(portionId,flags,transparent);}}},{key:"setTransparent",value:function setTransparent(portionId,flags,transparent){if(transparent){this._numTransparentLayerPortions++;this.model.numTransparentLayerPortions++;}else{this._numTransparentLayerPortions--;this.model.numTransparentLayerPortions--;}this._setFlags(portionId,flags,transparent);}},{key:"destroy",value:function destroy(){this._compiledPortions&&this._compiledPortions.destroy();}}]);return Layer;}();var maxDataTextureHeight=1<<16;var maxGeometryBatchSize=5000000;/**
9133
+ },{key:"__drawSilhouette",value:function __drawSilhouette(renderFlags,frameCtx,material,renderPass){frameCtx.programColor=this.__setVec4FromMaterialColorAlpha(material.fillColor,material.fillAlpha,tempVec4$1);this.__drawLayer(renderFlags,frameCtx,this._renderers.silhouetteRenderer,renderPass);}},{key:"drawSilhouetteXRayed",value:function drawSilhouetteXRayed(renderFlags,frameCtx){if(this._countsByFlag[ENTITY_FLAGS.XRAYED].count>0){this.__drawSilhouette(renderFlags,frameCtx,this.model.scene.xrayMaterial,RENDER_PASSES.SILHOUETTE_XRAYED);}}},{key:"drawSilhouetteHighlighted",value:function drawSilhouetteHighlighted(renderFlags,frameCtx){if(this._countsByFlag[ENTITY_FLAGS.HIGHLIGHTED].count>0){this.__drawSilhouette(renderFlags,frameCtx,this.model.scene.highlightMaterial,RENDER_PASSES.SILHOUETTE_HIGHLIGHTED);}}},{key:"drawSilhouetteSelected",value:function drawSilhouetteSelected(renderFlags,frameCtx){if(this._countsByFlag[ENTITY_FLAGS.SELECTED].count>0){this.__drawSilhouette(renderFlags,frameCtx,this.model.scene.selectedMaterial,RENDER_PASSES.SILHOUETTE_SELECTED);}}// ---------------------- EDGES RENDERING -----------------------------------
9134
+ },{key:"__drawVertexEdges",value:function __drawVertexEdges(renderFlags,frameCtx,renderPass){var renderer=this._renderers.edgesRenderers&&this._renderers.edgesRenderers.vertex;if(renderer&&this._countsByFlag[ENTITY_FLAGS.EDGES].count>0){this.__drawLayer(renderFlags,frameCtx,renderer,renderPass);}}},{key:"drawEdgesColorOpaque",value:function drawEdgesColorOpaque(renderFlags,frameCtx){if(this._compiledPortions.edgesColorOpaqueAllowed()){this.__drawVertexEdges(renderFlags,frameCtx,RENDER_PASSES.EDGES_COLOR_OPAQUE);}}},{key:"drawEdgesColorTransparent",value:function drawEdgesColorTransparent(renderFlags,frameCtx){if(this._numTransparentLayerPortions>0){this.__drawVertexEdges(renderFlags,frameCtx,RENDER_PASSES.EDGES_COLOR_TRANSPARENT);}}},{key:"__drawUniformEdges",value:function __drawUniformEdges(renderFlags,frameCtx,material,renderPass){var renderer=this._renderers.edgesRenderers&&this._renderers.edgesRenderers.uniform;if(renderer){frameCtx.programColor=this.__setVec4FromMaterialColorAlpha(material.edgeColor,material.edgeAlpha,tempVec4$1);this.__drawLayer(renderFlags,frameCtx,renderer,renderPass);}}},{key:"drawEdgesHighlighted",value:function drawEdgesHighlighted(renderFlags,frameCtx){if(this._countsByFlag[ENTITY_FLAGS.HIGHLIGHTED].count>0){this.__drawUniformEdges(renderFlags,frameCtx,this.model.scene.highlightMaterial,RENDER_PASSES.EDGES_HIGHLIGHTED);}}},{key:"drawEdgesSelected",value:function drawEdgesSelected(renderFlags,frameCtx){if(this._countsByFlag[ENTITY_FLAGS.SELECTED].count>0){this.__drawUniformEdges(renderFlags,frameCtx,this.model.scene.selectedMaterial,RENDER_PASSES.EDGES_SELECTED);}}},{key:"drawEdgesXRayed",value:function drawEdgesXRayed(renderFlags,frameCtx){if(this._countsByFlag[ENTITY_FLAGS.XRAYED].count>0){this.__drawUniformEdges(renderFlags,frameCtx,this.model.scene.xrayMaterial,RENDER_PASSES.EDGES_XRAYED);}}//---- PICKING ----------------------------------------------------------------------------------------------------
9135
+ },{key:"__drawPick",value:function __drawPick(renderFlags,frameCtx,renderer){if(renderer){this.__drawLayer(renderFlags,frameCtx,renderer,RENDER_PASSES.PICK);}}},{key:"drawPickMesh",value:function drawPickMesh(renderFlags,frameCtx){this.__drawPick(renderFlags,frameCtx,this._renderers.pickMeshRenderer);}},{key:"drawPickDepths",value:function drawPickDepths(renderFlags,frameCtx){this.__drawPick(renderFlags,frameCtx,this._renderers.pickDepthRenderer);}},{key:"drawPickNormals",value:function drawPickNormals(renderFlags,frameCtx){var renderer=this._renderers.pickNormalsFlatRenderer;this.__drawPick(renderFlags,frameCtx,renderer);}},{key:"drawSnap",value:function drawSnap(renderFlags,frameCtx,isSnapInit){frameCtx.snapPickOrigin=[0,0,0];var aabb=this.getAABB();frameCtx.snapPickCoordinateScale=math.mulVec3Scalar(safeInvVec3([aabb[3]-aabb[0],aabb[4]-aabb[1],aabb[5]-aabb[2]]),math.MAX_INT);var renderer=isSnapInit?this._renderers.snapInitRenderer:frameCtx.snapMode==="edge"?this._renderers.snapEdgeRenderer:this._renderers.snapVertexRenderer;this.__drawPick(renderFlags,frameCtx,renderer);frameCtx.snapPickLayerParams.push({origin:frameCtx.snapPickOrigin.slice(),coordinateScale:safeInvVec3(frameCtx.snapPickCoordinateScale)});}},{key:"drawOcclusion",value:function drawOcclusion(renderFlags,frameCtx){var renderer=this._renderers.occlusionRenderer;if(renderer){this.__drawLayer(renderFlags,frameCtx,renderer,RENDER_PASSES.COLOR_OPAQUE);}}},{key:"drawShadow",value:function drawShadow(renderFlags,frameCtx){var renderer=this._renderers.shadowRenderer;if(renderer){this.__drawLayer(renderFlags,frameCtx,renderer,RENDER_PASSES.COLOR_OPAQUE);}}},{key:"initFlags",value:function initFlags(portionId,flags,transparent){this._countsByFlagArr.forEach(function(cnt){return cnt.fromFlags(flags,true);});if(transparent){this._numTransparentLayerPortions++;this.model.numTransparentLayerPortions++;}var deferred=this.primitive!=="points";this._setFlags(portionId,flags,transparent,deferred);this._compiledPortions.setFlags2(portionId,flags,deferred);}},{key:"flushInitFlags",value:function flushInitFlags(){this._compiledPortions.setDeferredFlags();}},{key:"setVisible",value:function setVisible(portionId,flags,transparent){this._countsByFlag[ENTITY_FLAGS.VISIBLE].fromFlags(flags);this._setFlags(portionId,flags,transparent);}},{key:"setCulled",value:function setCulled(portionId,flags,transparent){this._countsByFlag[ENTITY_FLAGS.CULLED].fromFlags(flags);this._setFlags(portionId,flags,transparent);}},{key:"setPickable",value:function setPickable(portionId,flags,transparent){this._countsByFlag[ENTITY_FLAGS.PICKABLE].fromFlags(flags);this._setFlags(portionId,flags,transparent);}},{key:"setClippable",value:function setClippable(portionId,flags){this._countsByFlag[ENTITY_FLAGS.CLIPPABLE].fromFlags(flags);this._compiledPortions.setClippableFlags(portionId,flags);}},{key:"setCollidable",value:function setCollidable(portionId,flags){}},{key:"setXRayed",value:function setXRayed(portionId,flags,transparent){this._countsByFlag[ENTITY_FLAGS.XRAYED].fromFlags(flags);this._setFlags(portionId,flags,transparent);}},{key:"setHighlighted",value:function setHighlighted(portionId,flags,transparent){this._countsByFlag[ENTITY_FLAGS.HIGHLIGHTED].fromFlags(flags);this._setFlags(portionId,flags,transparent);}},{key:"setSelected",value:function setSelected(portionId,flags,transparent){this._countsByFlag[ENTITY_FLAGS.SELECTED].fromFlags(flags);this._setFlags(portionId,flags,transparent);}},{key:"setEdges",value:function setEdges(portionId,flags,transparent){if(this._countsByFlag[ENTITY_FLAGS.EDGES]){this._countsByFlag[ENTITY_FLAGS.EDGES].fromFlags(flags);this._setFlags(portionId,flags,transparent);}}},{key:"setTransparent",value:function setTransparent(portionId,flags,transparent){if(transparent){this._numTransparentLayerPortions++;this.model.numTransparentLayerPortions++;}else{this._numTransparentLayerPortions--;this.model.numTransparentLayerPortions--;}this._setFlags(portionId,flags,transparent);}},{key:"destroy",value:function destroy(){this._compiledPortions&&this._compiledPortions.destroy();}}]);return Layer;}();var maxDataTextureHeight=1<<16;var maxGeometryBatchSize=5000000;/**
9135
9136
  * Manages global configurations for all {@link Viewer}s.
9136
9137
  *
9137
9138
  * ## Example
@@ -11884,8 +11885,8 @@ this.layerList.sort(function(a,b){if(a.sortId<b.sortId){return-1;}if(a.sortId>b.
11884
11885
  */},{key:"_updateRenderFlagsVisibleLayers",value:function _updateRenderFlagsVisibleLayers(){var renderFlags=this.renderFlags;renderFlags.numLayers=this.layerList.length;renderFlags.numVisibleLayers=0;for(var layerIndex=0,len=this.layerList.length;layerIndex<len;layerIndex++){var layer=this.layerList[layerIndex];var layerVisible=this._getActiveSectionPlanesForLayer(layer);if(layerVisible){renderFlags.visibleLayers[renderFlags.numVisibleLayers++]=layerIndex;}}}/** @private */},{key:"_createDummyEntityForUnusedMeshes",value:function _createDummyEntityForUnusedMeshes(){var unusedMeshIds=Object.keys(this._unusedMeshes);if(unusedMeshIds.length>0){var entityId="".concat(this.id,"-").concat(math.createUUID());this.warn("Creating dummy SceneModelEntity \"".concat(entityId,"\" for unused SceneMeshes: [").concat(unusedMeshIds.join(","),"]"));this.createEntity({id:entityId,meshIds:unusedMeshIds,isObject:true});}this._unusedMeshes={};}},{key:"_getActiveSectionPlanesForLayer",value:function _getActiveSectionPlanesForLayer(layer){var renderFlags=this.renderFlags;var sectionPlanes=this.scene._sectionPlanesState.sectionPlanes;var numSectionPlanes=sectionPlanes.length;var baseIndex=layer.layerIndex*numSectionPlanes;if(numSectionPlanes>0){for(var _i182=0;_i182<numSectionPlanes;_i182++){var sectionPlane=sectionPlanes[_i182];if(!sectionPlane.active){renderFlags.sectionPlanesActivePerLayer[baseIndex+_i182]=false;}else{renderFlags.sectionPlanesActivePerLayer[baseIndex+_i182]=true;renderFlags.sectioned=true;}}}return true;}},{key:"_updateRenderFlags",value:function _updateRenderFlags(){if(this.numVisibleLayerPortions===0){return;}if(this.numCulledLayerPortions===this.numPortions){return;}var renderFlags=this.renderFlags;renderFlags.colorOpaque=this.numTransparentLayerPortions<this.numPortions;if(this.numTransparentLayerPortions>0){renderFlags.colorTransparent=true;}if(this.numXRayedLayerPortions>0){var xrayMaterial=this.scene.xrayMaterial._state;if(xrayMaterial.fill){if(xrayMaterial.fillAlpha<1.0){renderFlags.xrayedSilhouetteTransparent=true;}else{renderFlags.xrayedSilhouetteOpaque=true;}}if(xrayMaterial.edges){if(xrayMaterial.edgeAlpha<1.0){renderFlags.xrayedEdgesTransparent=true;}else{renderFlags.xrayedEdgesOpaque=true;}}}if(this.numEdgesLayerPortions>0){var edgeMaterial=this.scene.edgeMaterial._state;if(edgeMaterial.edges){renderFlags.edgesOpaque=this.numTransparentLayerPortions<this.numPortions;if(this.numTransparentLayerPortions>0){renderFlags.edgesTransparent=true;}}}if(this.numSelectedLayerPortions>0){var selectedMaterial=this.scene.selectedMaterial._state;if(selectedMaterial.fill){if(selectedMaterial.fillAlpha<1.0){renderFlags.selectedSilhouetteTransparent=true;}else{renderFlags.selectedSilhouetteOpaque=true;}}if(selectedMaterial.edges){if(selectedMaterial.edgeAlpha<1.0){renderFlags.selectedEdgesTransparent=true;}else{renderFlags.selectedEdgesOpaque=true;}}}if(this.numHighlightedLayerPortions>0){var highlightMaterial=this.scene.highlightMaterial._state;if(highlightMaterial.fill){if(highlightMaterial.fillAlpha<1.0){renderFlags.highlightedSilhouetteTransparent=true;}else{renderFlags.highlightedSilhouetteOpaque=true;}}if(highlightMaterial.edges){if(highlightMaterial.edgeAlpha<1.0){renderFlags.highlightedEdgesTransparent=true;}else{renderFlags.highlightedEdgesOpaque=true;}}}}// -------------- RENDERING ---------------------------------------------------------------------------------------
11885
11886
  /**
11886
11887
  * @private
11887
- */},{key:"_withEachVisibleLayer",value:function _withEachVisibleLayer(testNumVisibleLayerPortions,cb){if(testNumVisibleLayerPortions&&this.numVisibleLayerPortions===0){return;}var renderFlags=this.renderFlags;for(var _i183=0,len=renderFlags.visibleLayers.length;_i183<len;_i183++){var layerIndex=renderFlags.visibleLayers[_i183];cb(this.layerList[layerIndex]);}}},{key:"drawColorOpaque",value:function drawColorOpaque(frameCtx){var _this51=this;this._withEachVisibleLayer(false,function(layer){return layer.drawColorOpaque(_this51.renderFlags,frameCtx);});}},{key:"drawColorTransparent",value:function drawColorTransparent(frameCtx){var _this52=this;this._withEachVisibleLayer(false,function(layer){return layer.drawColorTransparent(_this52.renderFlags,frameCtx);});}},{key:"drawDepth",value:function drawDepth(frameCtx){var _this53=this;this._withEachVisibleLayer(false,function(layer){return layer.drawDepth(_this53.renderFlags,frameCtx);});}// Dedicated to SAO because it skips transparent objects
11888
- },{key:"drawSilhouetteXRayed",value:function drawSilhouetteXRayed(frameCtx){var _this54=this;this._withEachVisibleLayer(false,function(layer){return layer.drawSilhouetteXRayed(_this54.renderFlags,frameCtx);});}},{key:"drawSilhouetteHighlighted",value:function drawSilhouetteHighlighted(frameCtx){var _this55=this;this._withEachVisibleLayer(false,function(layer){return layer.drawSilhouetteHighlighted(_this55.renderFlags,frameCtx);});}},{key:"drawSilhouetteSelected",value:function drawSilhouetteSelected(frameCtx){var _this56=this;this._withEachVisibleLayer(false,function(layer){return layer.drawSilhouetteSelected(_this56.renderFlags,frameCtx);});}},{key:"drawEdgesColorOpaque",value:function drawEdgesColorOpaque(frameCtx){var _this57=this;this._withEachVisibleLayer(false,function(layer){return layer.drawEdgesColorOpaque(_this57.renderFlags,frameCtx);});}},{key:"drawEdgesColorTransparent",value:function drawEdgesColorTransparent(frameCtx){var _this58=this;this._withEachVisibleLayer(false,function(layer){return layer.drawEdgesColorTransparent(_this58.renderFlags,frameCtx);});}},{key:"drawEdgesXRayed",value:function drawEdgesXRayed(frameCtx){var _this59=this;this._withEachVisibleLayer(false,function(layer){return layer.drawEdgesXRayed(_this59.renderFlags,frameCtx);});}},{key:"drawEdgesHighlighted",value:function drawEdgesHighlighted(frameCtx){var _this60=this;this._withEachVisibleLayer(false,function(layer){return layer.drawEdgesHighlighted(_this60.renderFlags,frameCtx);});}},{key:"drawEdgesSelected",value:function drawEdgesSelected(frameCtx){var _this61=this;this._withEachVisibleLayer(false,function(layer){return layer.drawEdgesSelected(_this61.renderFlags,frameCtx);});}},{key:"drawOcclusion",value:function drawOcclusion(frameCtx){var _this62=this;this._withEachVisibleLayer(true,function(layer){return layer.drawOcclusion(_this62.renderFlags,frameCtx);});}},{key:"drawShadow",value:function drawShadow(frameCtx){var _this63=this;this._withEachVisibleLayer(true,function(layer){return layer.drawShadow(_this63.renderFlags,frameCtx);});}},{key:"drawPickMesh",value:function drawPickMesh(frameCtx){var _this64=this;this._withEachVisibleLayer(true,function(layer){return layer.drawPickMesh(_this64.renderFlags,frameCtx);});}},{key:"drawPickDepths",value:function drawPickDepths(frameCtx){var _this65=this;this._withEachVisibleLayer(true,function(layer){return layer.drawPickDepths(_this65.renderFlags,frameCtx);});}},{key:"drawPickNormals",value:function drawPickNormals(frameCtx){var _this66=this;this._withEachVisibleLayer(true,function(layer){return layer.drawPickNormals(_this66.renderFlags,frameCtx);});}},{key:"_drawSnap",value:function _drawSnap(frameCtx,isSnapInit){var _this67=this;this._withEachVisibleLayer(true,function(layer){return layer.drawSnap(_this67.renderFlags,frameCtx,isSnapInit);});}},{key:"drawSnapInit",value:function drawSnapInit(frameCtx){this._drawSnap(frameCtx,true);}},{key:"drawSnap",value:function drawSnap(frameCtx){this._drawSnap(frameCtx,false);}/**
11888
+ */},{key:"_withEachVisibleLayer",value:function _withEachVisibleLayer(frameCtx,testNumVisibleLayerPortions,cb){if(testNumVisibleLayerPortions&&this.numVisibleLayerPortions===0){return;}var testLayerCull=frameCtx.testAABB;var renderFlags=this.renderFlags;for(var _i183=0,len=renderFlags.visibleLayers.length;_i183<len;_i183++){var layer=this.layerList[renderFlags.visibleLayers[_i183]];if(!testLayerCull||testLayerCull(layer.getAABB())){cb(layer);}}}},{key:"drawColorOpaque",value:function drawColorOpaque(frameCtx){var _this51=this;this._withEachVisibleLayer(frameCtx,false,function(layer){return layer.drawColorOpaque(_this51.renderFlags,frameCtx);});}},{key:"drawColorTransparent",value:function drawColorTransparent(frameCtx){var _this52=this;this._withEachVisibleLayer(frameCtx,false,function(layer){return layer.drawColorTransparent(_this52.renderFlags,frameCtx);});}},{key:"drawDepth",value:function drawDepth(frameCtx){var _this53=this;this._withEachVisibleLayer(frameCtx,false,function(layer){return layer.drawDepth(_this53.renderFlags,frameCtx);});}// Dedicated to SAO because it skips transparent objects
11889
+ },{key:"drawSilhouetteXRayed",value:function drawSilhouetteXRayed(frameCtx){var _this54=this;this._withEachVisibleLayer(frameCtx,false,function(layer){return layer.drawSilhouetteXRayed(_this54.renderFlags,frameCtx);});}},{key:"drawSilhouetteHighlighted",value:function drawSilhouetteHighlighted(frameCtx){var _this55=this;this._withEachVisibleLayer(frameCtx,false,function(layer){return layer.drawSilhouetteHighlighted(_this55.renderFlags,frameCtx);});}},{key:"drawSilhouetteSelected",value:function drawSilhouetteSelected(frameCtx){var _this56=this;this._withEachVisibleLayer(frameCtx,false,function(layer){return layer.drawSilhouetteSelected(_this56.renderFlags,frameCtx);});}},{key:"drawEdgesColorOpaque",value:function drawEdgesColorOpaque(frameCtx){var _this57=this;this._withEachVisibleLayer(frameCtx,false,function(layer){return layer.drawEdgesColorOpaque(_this57.renderFlags,frameCtx);});}},{key:"drawEdgesColorTransparent",value:function drawEdgesColorTransparent(frameCtx){var _this58=this;this._withEachVisibleLayer(frameCtx,false,function(layer){return layer.drawEdgesColorTransparent(_this58.renderFlags,frameCtx);});}},{key:"drawEdgesXRayed",value:function drawEdgesXRayed(frameCtx){var _this59=this;this._withEachVisibleLayer(frameCtx,false,function(layer){return layer.drawEdgesXRayed(_this59.renderFlags,frameCtx);});}},{key:"drawEdgesHighlighted",value:function drawEdgesHighlighted(frameCtx){var _this60=this;this._withEachVisibleLayer(frameCtx,false,function(layer){return layer.drawEdgesHighlighted(_this60.renderFlags,frameCtx);});}},{key:"drawEdgesSelected",value:function drawEdgesSelected(frameCtx){var _this61=this;this._withEachVisibleLayer(frameCtx,false,function(layer){return layer.drawEdgesSelected(_this61.renderFlags,frameCtx);});}},{key:"drawOcclusion",value:function drawOcclusion(frameCtx){var _this62=this;this._withEachVisibleLayer(frameCtx,true,function(layer){return layer.drawOcclusion(_this62.renderFlags,frameCtx);});}},{key:"drawShadow",value:function drawShadow(frameCtx){var _this63=this;this._withEachVisibleLayer(frameCtx,true,function(layer){return layer.drawShadow(_this63.renderFlags,frameCtx);});}},{key:"drawPickMesh",value:function drawPickMesh(frameCtx){var _this64=this;this._withEachVisibleLayer(frameCtx,true,function(layer){return layer.drawPickMesh(_this64.renderFlags,frameCtx);});}},{key:"drawPickDepths",value:function drawPickDepths(frameCtx){var _this65=this;this._withEachVisibleLayer(frameCtx,true,function(layer){return layer.drawPickDepths(_this65.renderFlags,frameCtx);});}},{key:"drawPickNormals",value:function drawPickNormals(frameCtx){var _this66=this;this._withEachVisibleLayer(frameCtx,true,function(layer){return layer.drawPickNormals(_this66.renderFlags,frameCtx);});}},{key:"_drawSnap",value:function _drawSnap(frameCtx,isSnapInit){var _this67=this;this._withEachVisibleLayer(frameCtx,true,function(layer){return layer.drawSnap(_this67.renderFlags,frameCtx,isSnapInit);});}},{key:"drawSnapInit",value:function drawSnapInit(frameCtx){this._drawSnap(frameCtx,true);}},{key:"drawSnap",value:function drawSnap(frameCtx){this._drawSnap(frameCtx,false);}/**
11889
11890
  * Destroys this SceneModel.
11890
11891
  */},{key:"destroy",value:function destroy(){Object.values(this._vboLayers).forEach(function(l){return l.destroy();});this._vboLayers={};this.scene.camera.off(this._onCameraViewMatrix);this.scene.off(this._onTick);for(var _i184=0,len=this.layerList.length;_i184<len;_i184++){this.layerList[_i184].destroy();}this.layerList=[];for(var _i185=0,_len23=this._entityList.length;_i185<_len23;_i185++){this._entityList[_i185]._destroy();}this._layersToFinalize=[];// Object.entries(this._geometries).forEach(([id, geometry]) => {
11891
11892
  // geometry.destroy();
@@ -14365,13 +14366,21 @@ return outside;});if(!culled){var origin=occlusionLayer.origin;viewMatrix.setInp
14365
14366
  * Sets visibilities of {@link Marker}s according to whether or not they are obscured by anything in the render buffer.
14366
14367
  */},{key:"doOcclusionTest",value:function doOcclusionTest(readColorPixel){this._occlusionLayersList.forEach(function(occlusionLayer){for(var _i197=0;_i197<occlusionLayer.lenOcclusionTestList;_i197++){var j=_i197*2;var _color3=readColorPixel(occlusionLayer.pixels[j],occlusionLayer.pixels[j+1]);occlusionLayer.occlusionTestList[_i197]._setVisible(math.compareVec3(MARKER_COLOR,_color3));}});}/**
14367
14368
  * Destroys this OcclusionTester.
14368
- */},{key:"destroy",value:function destroy(){if(!this.destroyed){this._occlusionLayersList.forEach(function(layer){return layer.destroy();});this._drawable&&this._drawable.destroy();this._scene.camera.off(this._onCameraViewMatrix);this._scene.camera.off(this._onCameraProjMatrix);this._scene.canvas.off(this._onCanvasBoundary);this.destroyed=true;}}}]);return OcclusionTester;}();var vec3_0=math.vec3([0,0,0]);var iota=function iota(n){var ret=[];for(var _i198=0;_i198<n;++_i198){ret.push(_i198);}return ret;};var bitShiftScreenZ=math.vec4([1.0/(256.0*256.0*256.0*256.0),1.0/(256.0*256.0*256.0),1.0/(256.0*256.0),1.0/256.0]);var pixelToInt=function pixelToInt(pix){return pix[0]+(pix[1]<<8)+(pix[2]<<16)+(pix[3]<<24);};var toWorldNormal=function toWorldNormal(n){return math.normalizeVec3(math.divVec3Scalar(n,math.MAX_INT,math.vec3()));};var toWorldPos=function toWorldPos(p,origin,scale){return math.vec3([p[0]*scale[0]+origin[0],p[1]*scale[1]+origin[1],p[2]*scale[2]+origin[2]]);};/**
14369
+ */},{key:"destroy",value:function destroy(){if(!this.destroyed){this._occlusionLayersList.forEach(function(layer){return layer.destroy();});this._drawable&&this._drawable.destroy();this._scene.camera.off(this._onCameraViewMatrix);this._scene.camera.off(this._onCameraProjMatrix);this._scene.canvas.off(this._onCanvasBoundary);this.destroyed=true;}}}]);return OcclusionTester;}();var vec3_0=math.vec3([0,0,0]);var iota=function iota(n){var ret=[];for(var _i198=0;_i198<n;++_i198){ret.push(_i198);}return ret;};var tempPlanes=iota(6).map(function(){return math.vec4();});var tempVec4=math.vec4();var bitShiftScreenZ=math.vec4([1.0/(256.0*256.0*256.0*256.0),1.0/(256.0*256.0*256.0),1.0/(256.0*256.0),1.0/256.0]);var pixelToInt=function pixelToInt(pix){return pix[0]+(pix[1]<<8)+(pix[2]<<16)+(pix[3]<<24);};var toWorldNormal=function toWorldNormal(n){return math.normalizeVec3(math.divVec3Scalar(n,math.MAX_INT,math.vec3()));};var toWorldPos=function toWorldPos(p,origin,scale){return math.vec3([p[0]*scale[0]+origin[0],p[1]*scale[1]+origin[1],p[2]*scale[2]+origin[2]]);};var makeFrustumAABBIntersectionTest=function makeFrustumAABBIntersectionTest(camera){var m=math.mat4();math.mulMat4(camera.projMatrix,camera.viewMatrix,m);for(var _i199=0;_i199<3;++_i199){tempPlanes[_i199*2+0][0]=m[3]+m[_i199];tempPlanes[_i199*2+0][1]=m[7]+m[_i199+4];tempPlanes[_i199*2+0][2]=m[11]+m[_i199+8];tempPlanes[_i199*2+0][3]=m[15]+m[_i199+12];tempPlanes[_i199*2+1][0]=m[3]-m[_i199];tempPlanes[_i199*2+1][1]=m[7]-m[_i199+4];tempPlanes[_i199*2+1][2]=m[11]-m[_i199+8];tempPlanes[_i199*2+1][3]=m[15]-m[_i199+12];}// Normalize each plane
14370
+ tempPlanes.forEach(function(p){return math.divVec4Scalar(p,math.lenVec3(p),p);});return function(aabb){return tempPlanes.every(function(p){// Compute the positive vertex (farthest in direction of normal)
14371
+ tempVec4[0]=aabb[p[0]>=0?3:0];tempVec4[1]=aabb[p[1]>=0?4:1];tempVec4[2]=aabb[p[2]>=0?5:2];tempVec4[3]=1;return math.dotVec4(p,tempVec4)>=0;});};};var makeRayAABBIntersectionTest=function makeRayAABBIntersectionTest(O,D){return function(aabb){var tmin=-Infinity;var tmax=Infinity;for(var _i200=0;_i200<3;_i200++){var origin=O[_i200];var _direction=D[_i200];var minBound=aabb[_i200];var maxBound=aabb[_i200+3];if(Math.abs(_direction)<1e-8){// Ray is parallel to plane
14372
+ if(origin<minBound||origin>maxBound){return false;// No intersection
14373
+ }}else{var t1=(minBound-origin)/_direction;var t2=(maxBound-origin)/_direction;tmin=Math.max(tmin,Math.min(t1,t2));// near
14374
+ tmax=Math.min(tmax,Math.max(t1,t2));// far
14375
+ if(tmin>tmax){return false;// No intersection
14376
+ }}}return tmax>=0;// Check if intersection is in front of ray
14377
+ };};/**
14369
14378
  * @private
14370
14379
  */var Renderer$1=function Renderer$1(scene,options){var _this87=this;options=options||{};var frameCtx=new FrameContext();var canvas=scene.canvas.canvas;/**
14371
14380
  * @type {WebGL2RenderingContext}
14372
14381
  */var gl=scene.canvas.gl;var canvasTransparent=!!options.transparent;var alphaDepthMask=options.alphaDepthMask;var pickIDs=new Map$1({});var drawableTypeInfo={};var drawables={};var postSortDrawableList=[];var postCullDrawableList=[];var uiDrawableList=[];var drawableListDirty=true;var stateSortDirty=true;var imageDirty=true;var transparentEnabled=true;var edgesEnabled=true;var saoEnabled=true;var pbrEnabled=true;var colorTextureEnabled=true;var renderBufferManager=function(){var renderBuffersBasic={};var renderBuffersScaled={};return{getRenderBuffer:function getRenderBuffer(id,colorFormats,hasDepthTexture){var renderBuffers=scene.canvas.resolutionScale===1.0?renderBuffersBasic:renderBuffersScaled;if(!renderBuffers[id]){renderBuffers[id]=new RenderBuffer(gl,colorFormats,hasDepthTexture);}return renderBuffers[id];},destroy:function destroy(){Object.values(renderBuffersBasic).forEach(function(buf){return buf.destroy();});Object.values(renderBuffersScaled).forEach(function(buf){return buf.destroy();});}};}();var SAOProgram=function SAOProgram(gl,name,programVariablesState,createOutColorDefinition){var programVariables=programVariablesState.programVariables;var uViewportInv=programVariables.createUniform("vec2","uViewportInv");var uCameraNear=programVariables.createUniform("float","uCameraNear");var uCameraFar=programVariables.createUniform("float","uCameraFar");var uDepthTexture=programVariables.createUniform("sampler2D","uDepthTexture");var uv=programVariables.createAttribute("vec2","uv");var vUV=programVariables.createVarying("vec2","vUV",function(){return uv;});var outColor=programVariables.createOutput("vec4","outColor");var getOutColor=programVariables.createFragmentDefinition("getOutColor",function(name,src){var getDepth="getDepth";src.push("\n float ".concat(getDepth,"(const in vec2 uv) {\n return texture(").concat(uDepthTexture,", uv).r;\n }\n "));src.push(createOutColorDefinition(name,vUV,uViewportInv,uCameraNear,uCameraFar,getDepth));});var _programVariablesStat7=programVariablesState.buildProgram(gl,name,{clipPos:"vec4(2.0 * ".concat(uv," - 1.0, 0.0, 1.0)"),appendFragmentOutputs:function appendFragmentOutputs(src){return src.push("".concat(outColor," = ").concat(getOutColor,"();"));}}),_programVariablesStat8=_slicedToArray(_programVariablesStat7,2),program=_programVariablesStat8[0],errors=_programVariablesStat8[1];if(errors){console.error(errors.join("\n"));throw errors;}else{var uvs=new Float32Array([1,1,0,1,0,0,1,0]);var uvBuf=new ArrayBuf(gl,gl.ARRAY_BUFFER,uvs,uvs.length,2,gl.STATIC_DRAW);// Mitigation: if Uint8Array is used, the geometry is corrupted on OSX when using Chrome with data-textures
14373
14382
  var indices=new Uint32Array([0,1,2,0,2,3]);var indicesBuf=new ArrayBuf(gl,gl.ELEMENT_ARRAY_BUFFER,indices,indices.length,1,gl.STATIC_DRAW);return{destroy:program.destroy,bind:function bind(viewportSize,project,depthTexture){program.bind();uViewportInv.setInputValue([1/viewportSize[0],1/viewportSize[1]]);uCameraNear.setInputValue(project.near);uCameraFar.setInputValue(project.far);uDepthTexture.setInputValue(depthTexture);uv.setInputValue(uvBuf);},draw:function draw(){indicesBuf.bind();gl.drawElements(gl.TRIANGLES,indicesBuf.numItems,indicesBuf.itemType,0);}};}};// SAO implementation inspired from previous SAO work in THREE.js by ludobaka / ludobaka.github.io and bhouston
14374
- var saoOcclusionRenderer=function(){var currentRenrerer=null;var curNumSamples=null;return{destroy:function destroy(){return currentRenrerer&&currentRenrerer.destroy();},render:function render(viewportSize,project,sao,depthTexture){var numSamples=Math.floor(sao.numSamples);if(curNumSamples!==numSamples){currentRenrerer&&currentRenrerer.destroy();var programVariablesState=createProgramVariablesState();var programVariables=programVariablesState.programVariables;var uProjectMatrix=programVariables.createUniform("mat4","uProjectMatrix");var uInvProjMatrix=programVariables.createUniform("mat4","uInvProjMatrix");var uPerspective=programVariables.createUniform("bool","uPerspective");var uScale=programVariables.createUniform("float","uScale");var uIntensity=programVariables.createUniform("float","uIntensity");var uBias=programVariables.createUniform("float","uBias");var uKernelRadius=programVariables.createUniform("float","uKernelRadius");var uMinResolution=programVariables.createUniform("float","uMinResolution");var uRandomSeed=programVariables.createUniform("float","uRandomSeed");var program=SAOProgram(gl,"SAOOcclusionRenderer",programVariablesState,function(name,vUV,uViewportInv,uCameraNear,uCameraFar,getDepth){return"\n #define EPSILON 1e-6\n #define PI 3.14159265359\n #define PI2 6.28318530718\n #define NUM_SAMPLES ".concat(numSamples,"\n #define NUM_RINGS 4\n\n const vec3 packFactors = vec3(256. * 256. * 256., 256. * 256., 256.);\n\n vec4 packFloatToRGBA(const in float v) {\n vec4 r = vec4(fract(v * packFactors), v);\n r.yzw -= r.xyz / 256.;\n return r * 256. / 255.;\n }\n\n highp float rand(const in vec2 uv) {\n const highp float a = 12.9898, b = 78.233, c = 43758.5453;\n return fract(sin(mod(dot(uv, vec2(a, b)), PI)) * c);\n }\n\n vec3 getViewPos(const in vec2 screenPos, const in float depth) {\n float near = ").concat(uCameraNear,";\n float far = ").concat(uCameraFar,";\n float viewZ = (").concat(uPerspective,"\n ? ((near * far) / ((far - near) * depth - far))\n : (depth * (near - far) - near));\n float clipW = ").concat(uProjectMatrix,"[2][3] * viewZ + ").concat(uProjectMatrix,"[3][3];\n return (").concat(uInvProjMatrix," * (clipW * vec4((vec3(screenPos, depth) - 0.5) * 2.0, 1.0))).xyz;\n }\n\n vec4 ").concat(name,"() {\n float centerDepth = ").concat(getDepth,"(").concat(vUV,");\n if (centerDepth >= (1.0 - EPSILON)) {\n discard;\n }\n\n vec3 centerViewPosition = getViewPos(").concat(vUV,", centerDepth);\n float scaleDividedByCameraFar = ").concat(uScale," / ").concat(uCameraFar,";\n float minResolutionMultipliedByCameraFar = ").concat(uMinResolution," * ").concat(uCameraFar,";\n vec3 centerViewNormal = normalize(cross(dFdx(centerViewPosition), dFdy(centerViewPosition)));\n\n vec2 radiusStep = ").concat(uKernelRadius," * ").concat(uViewportInv," / float(NUM_SAMPLES);\n vec2 radius = radiusStep;\n const float angleStep = PI2 * float(NUM_RINGS) / float(NUM_SAMPLES);\n float angle = PI2 * rand(").concat(vUV," + ").concat(uRandomSeed,");\n\n float occlusionSum = 0.0;\n float weightSum = 0.0;\n\n for (int i = 0; i < NUM_SAMPLES; i++) {\n vec2 sampleUv = ").concat(vUV," + vec2(cos(angle), sin(angle)) * radius;\n radius += radiusStep;\n angle += angleStep;\n\n float sampleDepth = ").concat(getDepth,"(sampleUv);\n if (sampleDepth >= (1.0 - EPSILON)) {\n continue;\n }\n\n vec3 sampleViewPosition = getViewPos(sampleUv, sampleDepth);\n vec3 viewDelta = sampleViewPosition - centerViewPosition;\n float scaledScreenDistance = scaleDividedByCameraFar * length(viewDelta);\n occlusionSum += max(0.0, (dot(centerViewNormal, viewDelta) - minResolutionMultipliedByCameraFar) / scaledScreenDistance - ").concat(uBias,") / (1.0 + scaledScreenDistance * scaledScreenDistance );\n weightSum += 1.0;\n }\n\n return packFloatToRGBA(1.0 - occlusionSum * ").concat(uIntensity," / weightSum);\n }");});currentRenrerer={destroy:program.destroy,render:function render(viewportSize,project,sao,depthTexture){program.bind(viewportSize,project,depthTexture);uProjectMatrix.setInputValue(project.matrix);uInvProjMatrix.setInputValue(project.inverseMatrix);uPerspective.setInputValue(project.type==="Perspective");uScale.setInputValue(sao.scale*project.far/5);uIntensity.setInputValue(sao.intensity);uBias.setInputValue(sao.bias);uKernelRadius.setInputValue(sao.kernelRadius);uMinResolution.setInputValue(sao.minResolution);uRandomSeed.setInputValue(Math.random());program.draw();}};curNumSamples=numSamples;}currentRenrerer.render(viewportSize,project,sao,depthTexture);}};}();var saoDepthLimitedBlurRenderer=function(){var blurStdDev=4;var blurDepthCutoff=0.01;var KERNEL_RADIUS=16;var createSampleOffsets=function createSampleOffsets(uvIncrement){var offsets=[];for(var _i199=0;_i199<=KERNEL_RADIUS+1;_i199++){offsets.push(uvIncrement[0]*_i199);offsets.push(uvIncrement[1]*_i199);}return new Float32Array(offsets);};var sampleOffsetsVer=createSampleOffsets([0,1]);var sampleOffsetsHor=createSampleOffsets([1,0]);var gaussian=function gaussian(i,stdDev){return Math.exp(-(i*i)/(2.0*(stdDev*stdDev)))/(Math.sqrt(2.0*Math.PI)*stdDev);};var sampleWeights=new Float32Array(iota(KERNEL_RADIUS+1).map(function(i){return gaussian(i,blurStdDev);}));// TODO: Optimize
14383
+ var saoOcclusionRenderer=function(){var currentRenrerer=null;var curNumSamples=null;return{destroy:function destroy(){return currentRenrerer&&currentRenrerer.destroy();},render:function render(viewportSize,project,sao,depthTexture){var numSamples=Math.floor(sao.numSamples);if(curNumSamples!==numSamples){currentRenrerer&&currentRenrerer.destroy();var programVariablesState=createProgramVariablesState();var programVariables=programVariablesState.programVariables;var uProjectMatrix=programVariables.createUniform("mat4","uProjectMatrix");var uInvProjMatrix=programVariables.createUniform("mat4","uInvProjMatrix");var uPerspective=programVariables.createUniform("bool","uPerspective");var uScale=programVariables.createUniform("float","uScale");var uIntensity=programVariables.createUniform("float","uIntensity");var uBias=programVariables.createUniform("float","uBias");var uKernelRadius=programVariables.createUniform("float","uKernelRadius");var uMinResolution=programVariables.createUniform("float","uMinResolution");var uRandomSeed=programVariables.createUniform("float","uRandomSeed");var program=SAOProgram(gl,"SAOOcclusionRenderer",programVariablesState,function(name,vUV,uViewportInv,uCameraNear,uCameraFar,getDepth){return"\n #define EPSILON 1e-6\n #define PI 3.14159265359\n #define PI2 6.28318530718\n #define NUM_SAMPLES ".concat(numSamples,"\n #define NUM_RINGS 4\n\n const vec3 packFactors = vec3(256. * 256. * 256., 256. * 256., 256.);\n\n vec4 packFloatToRGBA(const in float v) {\n vec4 r = vec4(fract(v * packFactors), v);\n r.yzw -= r.xyz / 256.;\n return r * 256. / 255.;\n }\n\n highp float rand(const in vec2 uv) {\n const highp float a = 12.9898, b = 78.233, c = 43758.5453;\n return fract(sin(mod(dot(uv, vec2(a, b)), PI)) * c);\n }\n\n vec3 getViewPos(const in vec2 screenPos, const in float depth) {\n float near = ").concat(uCameraNear,";\n float far = ").concat(uCameraFar,";\n float viewZ = (").concat(uPerspective,"\n ? ((near * far) / ((far - near) * depth - far))\n : (depth * (near - far) - near));\n float clipW = ").concat(uProjectMatrix,"[2][3] * viewZ + ").concat(uProjectMatrix,"[3][3];\n return (").concat(uInvProjMatrix," * (clipW * vec4((vec3(screenPos, depth) - 0.5) * 2.0, 1.0))).xyz;\n }\n\n vec4 ").concat(name,"() {\n float centerDepth = ").concat(getDepth,"(").concat(vUV,");\n if (centerDepth >= (1.0 - EPSILON)) {\n discard;\n }\n\n vec3 centerViewPosition = getViewPos(").concat(vUV,", centerDepth);\n float scaleDividedByCameraFar = ").concat(uScale," / ").concat(uCameraFar,";\n float minResolutionMultipliedByCameraFar = ").concat(uMinResolution," * ").concat(uCameraFar,";\n vec3 centerViewNormal = normalize(cross(dFdx(centerViewPosition), dFdy(centerViewPosition)));\n\n vec2 radiusStep = ").concat(uKernelRadius," * ").concat(uViewportInv," / float(NUM_SAMPLES);\n vec2 radius = radiusStep;\n const float angleStep = PI2 * float(NUM_RINGS) / float(NUM_SAMPLES);\n float angle = PI2 * rand(").concat(vUV," + ").concat(uRandomSeed,");\n\n float occlusionSum = 0.0;\n float weightSum = 0.0;\n\n for (int i = 0; i < NUM_SAMPLES; i++) {\n vec2 sampleUv = ").concat(vUV," + vec2(cos(angle), sin(angle)) * radius;\n radius += radiusStep;\n angle += angleStep;\n\n float sampleDepth = ").concat(getDepth,"(sampleUv);\n if (sampleDepth >= (1.0 - EPSILON)) {\n continue;\n }\n\n vec3 sampleViewPosition = getViewPos(sampleUv, sampleDepth);\n vec3 viewDelta = sampleViewPosition - centerViewPosition;\n float scaledScreenDistance = scaleDividedByCameraFar * length(viewDelta);\n occlusionSum += max(0.0, (dot(centerViewNormal, viewDelta) - minResolutionMultipliedByCameraFar) / scaledScreenDistance - ").concat(uBias,") / (1.0 + scaledScreenDistance * scaledScreenDistance );\n weightSum += 1.0;\n }\n\n return packFloatToRGBA(1.0 - occlusionSum * ").concat(uIntensity," / weightSum);\n }");});currentRenrerer={destroy:program.destroy,render:function render(viewportSize,project,sao,depthTexture){program.bind(viewportSize,project,depthTexture);uProjectMatrix.setInputValue(project.matrix);uInvProjMatrix.setInputValue(project.inverseMatrix);uPerspective.setInputValue(project.type==="Perspective");uScale.setInputValue(sao.scale*project.far/5);uIntensity.setInputValue(sao.intensity);uBias.setInputValue(sao.bias);uKernelRadius.setInputValue(sao.kernelRadius);uMinResolution.setInputValue(sao.minResolution);uRandomSeed.setInputValue(Math.random());program.draw();}};curNumSamples=numSamples;}currentRenrerer.render(viewportSize,project,sao,depthTexture);}};}();var saoDepthLimitedBlurRenderer=function(){var blurStdDev=4;var blurDepthCutoff=0.01;var KERNEL_RADIUS=16;var createSampleOffsets=function createSampleOffsets(uvIncrement){var offsets=[];for(var _i201=0;_i201<=KERNEL_RADIUS+1;_i201++){offsets.push(uvIncrement[0]*_i201);offsets.push(uvIncrement[1]*_i201);}return new Float32Array(offsets);};var sampleOffsetsVer=createSampleOffsets([0,1]);var sampleOffsetsHor=createSampleOffsets([1,0]);var gaussian=function gaussian(i,stdDev){return Math.exp(-(i*i)/(2.0*(stdDev*stdDev)))/(Math.sqrt(2.0*Math.PI)*stdDev);};var sampleWeights=new Float32Array(iota(KERNEL_RADIUS+1).map(function(i){return gaussian(i,blurStdDev);}));// TODO: Optimize
14375
14384
  var programVariablesState=createProgramVariablesState();var programVariables=programVariablesState.programVariables;var uDepthCutoff=programVariables.createUniform("float","uDepthCutoff");var uSampleOffsets=programVariables.createUniformArray("vec2","uSampleOffsets",KERNEL_RADIUS+1);var uSampleWeights=programVariables.createUniformArray("float","uSampleWeights",KERNEL_RADIUS+1);var uOcclusionTex=programVariables.createUniform("sampler2D","uOcclusionTex");var program=SAOProgram(gl,"SAODepthLimitedBlurRenderer",programVariablesState,function(name,vUV,uViewportInv,uCameraNear,uCameraFar,getDepth){return"\n #define EPSILON 1e-6\n\n const vec3 packFactors = vec3(256. * 256. * 256., 256. * 256., 256.);\n\n vec4 packFloatToRGBA(const in float v) {\n vec4 r = vec4(fract(v * packFactors), v);\n r.yzw -= r.xyz / 256.;\n return r * 256. / 255.;\n }\n\n float getOcclusion(const in vec2 uv) {\n vec4 v = texture(".concat(uOcclusionTex,", uv);\n return dot(floor(v * 255.0 + 0.5) / 255.0, 255. / 256. / vec4(packFactors, 1.)); // unpackRGBAToFloat\n }\n\n float getViewZ(const in float depth) {\n return (").concat(uCameraNear," * ").concat(uCameraFar,") / ((").concat(uCameraFar," - ").concat(uCameraNear,") * depth - ").concat(uCameraFar,");\n }\n\n vec4 ").concat(name,"() {\n float centerDepth = ").concat(getDepth,"(").concat(vUV,");\n if (centerDepth >= (1.0 - EPSILON)) {\n discard;\n }\n\n float centerViewZ = getViewZ(centerDepth);\n bool rBreak = false;\n bool lBreak = false;\n\n float weightSum = ").concat(uSampleWeights,"[0];\n float occlusionSum = getOcclusion(").concat(vUV,") * weightSum;\n\n for (int i = 1; i <= ").concat(KERNEL_RADIUS,"; i++) {\n float sampleWeight = ").concat(uSampleWeights,"[i];\n vec2 sampleUVOffset = ").concat(uSampleOffsets,"[i] * ").concat(uViewportInv,";\n\n if (! rBreak) {\n vec2 rSampleUV = ").concat(vUV," + sampleUVOffset;\n if (abs(centerViewZ - getViewZ(").concat(getDepth,"(rSampleUV))) > ").concat(uDepthCutoff,") {\n rBreak = true;\n } else {\n occlusionSum += getOcclusion(rSampleUV) * sampleWeight;\n weightSum += sampleWeight;\n }\n }\n\n if (! lBreak) {\n vec2 lSampleUV = ").concat(vUV," - sampleUVOffset;\n if (abs(centerViewZ - getViewZ(").concat(getDepth,"(lSampleUV))) > ").concat(uDepthCutoff,") {\n lBreak = true;\n } else {\n occlusionSum += getOcclusion(lSampleUV) * sampleWeight;\n weightSum += sampleWeight;\n }\n }\n }\n\n return packFloatToRGBA(occlusionSum / weightSum);\n }");});return{destroy:program.destroy,render:function render(viewportSize,project,direction,depthTexture,occlusionTexture){program.bind(viewportSize,project,depthTexture);uDepthCutoff.setInputValue(blurDepthCutoff);uSampleOffsets.setInputValue(direction===0?sampleOffsetsHor:sampleOffsetsVer);uSampleWeights.setInputValue(sampleWeights);uOcclusionTex.setInputValue(occlusionTexture);program.draw();}};}();var getSceneCameraViewParams=function(){var params=null;// scene.camera not defined yet
14376
14385
  return function(){if(!params){var camera=scene.camera;params={get eye(){return camera.eye;},get far(){return camera.project.far;},get projMatrix(){return camera.projMatrix;},get viewMatrix(){return camera.viewMatrix;},get viewNormalMatrix(){return camera.viewNormalMatrix;}};}return params;};}();var getNearPlaneHeight=function getNearPlaneHeight(camera,drawingBufferHeight){return camera.projection==="ortho"?1.0:drawingBufferHeight/(2*Math.tan(0.5*camera.perspective.fov*Math.PI/180.0));};this.scene=scene;this._occlusionTester=null;// Lazy-created in #addMarker()
14377
14386
  this.capabilities={astcSupported:!!getExtension(gl,'WEBGL_compressed_texture_astc'),etc1Supported:true,// WebGL2
@@ -14403,10 +14412,10 @@ drawable.drawShadow(frameCtx);}}});});shadowRenderBuf.unbind();}});drawColor(pas
14403
14412
  var saoDepthRenderBuffer=renderBufferManager.getRenderBuffer("saoDepth",[],true);saoDepthRenderBuffer.setSize(size);saoDepthRenderBuffer.bind();gl.clear(gl.COLOR_BUFFER_BIT|gl.DEPTH_BUFFER_BIT);frameCtx.reset();frameCtx.pass=pass;frameCtx.viewParams=getSceneCameraViewParams();frameCtx.nearPlaneHeight=getNearPlaneHeight(scene.camera,gl.drawingBufferHeight);gl.viewport(0,0,gl.drawingBufferWidth,gl.drawingBufferHeight);gl.clearColor(0,0,0,0);gl.enable(gl.DEPTH_TEST);gl.frontFace(gl.CCW);gl.enable(gl.CULL_FACE);gl.depthMask(true);gl.clear(gl.COLOR_BUFFER_BIT|gl.DEPTH_BUFFER_BIT);postCullDrawableList.forEach(function(drawable){if(!drawable.culled&&drawable.visible&&drawable.drawDepth&&drawable.saoEnabled&&drawable.renderFlags.colorOpaque){drawable.drawDepth(frameCtx);}});saoDepthRenderBuffer.unbind();var depthTexture=saoDepthRenderBuffer.depthTexture;// Render occlusion buffer
14404
14413
  var occlusionRenderBuffer1=renderBufferManager.getRenderBuffer("saoOcclusion");occlusionRenderBuffer1.setSize(size);occlusionRenderBuffer1.bind();gl.viewport(0,0,size[0],size[1]);gl.clearColor(0,0,0,1);gl.disable(gl.DEPTH_TEST);gl.disable(gl.BLEND);gl.frontFace(gl.CCW);gl.clear(gl.COLOR_BUFFER_BIT);saoOcclusionRenderer.render(size,scene.camera.project,sao,depthTexture);occlusionRenderBuffer1.unbind();if(sao.blur){var occlusionRenderBuffer2=renderBufferManager.getRenderBuffer("saoOcclusion2");occlusionRenderBuffer2.setSize(size);var blurSAO=function blurSAO(src,dst,direction){dst.bind();gl.viewport(0,0,size[0],size[1]);gl.clearColor(0,0,0,1);gl.enable(gl.DEPTH_TEST);gl.disable(gl.BLEND);gl.frontFace(gl.CCW);gl.clear(gl.COLOR_BUFFER_BIT|gl.DEPTH_BUFFER_BIT);var project=scene.camera.project;saoDepthLimitedBlurRenderer.render(size,project,direction,depthTexture,src.colorTextures[0]);dst.unbind();};blurSAO(occlusionRenderBuffer1,occlusionRenderBuffer2,0);// horizontally
14405
14414
  blurSAO(occlusionRenderBuffer2,occlusionRenderBuffer1,1);// vertically
14406
- }return occlusionRenderBuffer1.colorTextures[0];}function drawColor(pass,clear,occlusionTexture){var normalDrawSAOBin=[];var normalEdgesOpaqueBin=[];var normalFillTransparentBin=[];var normalEdgesTransparentBin=[];var xrayedFillOpaqueBin=[];var xrayEdgesOpaqueBin=[];var xrayedFillTransparentBin=[];var xrayEdgesTransparentBin=[];var highlightedFillOpaqueBin=[];var highlightedEdgesOpaqueBin=[];var highlightedFillTransparentBin=[];var highlightedEdgesTransparentBin=[];var selectedFillOpaqueBin=[];var selectedEdgesOpaqueBin=[];var selectedFillTransparentBin=[];var selectedEdgesTransparentBin=[];var ambientColorAndIntensity=scene._lightsState.getAmbientColorAndIntensity();frameCtx.reset();frameCtx.pass=pass;frameCtx.withSAO=false;frameCtx.pbrEnabled=pbrEnabled&&!!scene.pbrEnabled;frameCtx.colorTextureEnabled=colorTextureEnabled&&!!scene.colorTextureEnabled;frameCtx.viewParams=getSceneCameraViewParams();frameCtx.nearPlaneHeight=getNearPlaneHeight(scene.camera,gl.drawingBufferHeight);gl.viewport(0,0,gl.drawingBufferWidth,gl.drawingBufferHeight);if(canvasTransparent){gl.clearColor(0,0,0,0);}else{var _backgroundColor2=scene.canvas.backgroundColorFromAmbientLight?ambientColorAndIntensity:scene.canvas.backgroundColor;gl.clearColor(_backgroundColor2[0],_backgroundColor2[1],_backgroundColor2[2],1.0);}gl.enable(gl.DEPTH_TEST);gl.frontFace(gl.CCW);gl.enable(gl.CULL_FACE);gl.depthMask(true);gl.lineWidth(1);frameCtx.lineWidth=1;scene.sao;frameCtx.saoParams=[gl.drawingBufferWidth,gl.drawingBufferHeight,scene.sao.blendCutoff,scene.sao.blendFactor];frameCtx.occlusionTexture=occlusionTexture;var i;var drawable;var startTime=Date.now();if(clear){gl.clear(gl.COLOR_BUFFER_BIT|gl.DEPTH_BUFFER_BIT);}var renderDrawables=function renderDrawables(drawables){var normalDrawSAOBinLen=0;var normalEdgesOpaqueBinLen=0;var normalFillTransparentBinLen=0;var normalEdgesTransparentBinLen=0;var xrayedFillOpaqueBinLen=0;var xrayEdgesOpaqueBinLen=0;var xrayedFillTransparentBinLen=0;var xrayEdgesTransparentBinLen=0;var highlightedFillOpaqueBinLen=0;var highlightedEdgesOpaqueBinLen=0;var highlightedFillTransparentBinLen=0;var highlightedEdgesTransparentBinLen=0;var selectedFillOpaqueBinLen=0;var selectedEdgesOpaqueBinLen=0;var selectedFillTransparentBinLen=0;var selectedEdgesTransparentBinLen=0;//------------------------------------------------------------------------------------------------------
14415
+ }return occlusionRenderBuffer1.colorTextures[0];}function drawColor(pass,clear,occlusionTexture){var normalDrawSAOBin=[];var normalEdgesOpaqueBin=[];var normalFillTransparentBin=[];var normalEdgesTransparentBin=[];var xrayedFillOpaqueBin=[];var xrayEdgesOpaqueBin=[];var xrayedFillTransparentBin=[];var xrayEdgesTransparentBin=[];var highlightedFillOpaqueBin=[];var highlightedEdgesOpaqueBin=[];var highlightedFillTransparentBin=[];var highlightedEdgesTransparentBin=[];var selectedFillOpaqueBin=[];var selectedEdgesOpaqueBin=[];var selectedFillTransparentBin=[];var selectedEdgesTransparentBin=[];var ambientColorAndIntensity=scene._lightsState.getAmbientColorAndIntensity();frameCtx.reset();frameCtx.pass=pass;frameCtx.withSAO=false;frameCtx.pbrEnabled=pbrEnabled&&!!scene.pbrEnabled;frameCtx.colorTextureEnabled=colorTextureEnabled&&!!scene.colorTextureEnabled;frameCtx.viewParams=getSceneCameraViewParams();frameCtx.nearPlaneHeight=getNearPlaneHeight(scene.camera,gl.drawingBufferHeight);gl.viewport(0,0,gl.drawingBufferWidth,gl.drawingBufferHeight);if(canvasTransparent){gl.clearColor(0,0,0,0);}else{var _backgroundColor2=scene.canvas.backgroundColorFromAmbientLight?ambientColorAndIntensity:scene.canvas.backgroundColor;gl.clearColor(_backgroundColor2[0],_backgroundColor2[1],_backgroundColor2[2],1.0);}gl.enable(gl.DEPTH_TEST);gl.frontFace(gl.CCW);gl.enable(gl.CULL_FACE);gl.depthMask(true);gl.lineWidth(1);frameCtx.lineWidth=1;scene.sao;frameCtx.saoParams=[gl.drawingBufferWidth,gl.drawingBufferHeight,scene.sao.blendCutoff,scene.sao.blendFactor];frameCtx.occlusionTexture=occlusionTexture;var i;var drawable;var startTime=Date.now();if(clear){gl.clear(gl.COLOR_BUFFER_BIT|gl.DEPTH_BUFFER_BIT);}frameCtx.testAABB=makeFrustumAABBIntersectionTest(scene.camera);var renderDrawables=function renderDrawables(drawables){var normalDrawSAOBinLen=0;var normalEdgesOpaqueBinLen=0;var normalFillTransparentBinLen=0;var normalEdgesTransparentBinLen=0;var xrayedFillOpaqueBinLen=0;var xrayEdgesOpaqueBinLen=0;var xrayedFillTransparentBinLen=0;var xrayEdgesTransparentBinLen=0;var highlightedFillOpaqueBinLen=0;var highlightedEdgesOpaqueBinLen=0;var highlightedFillTransparentBinLen=0;var highlightedEdgesTransparentBinLen=0;var selectedFillOpaqueBinLen=0;var selectedEdgesOpaqueBinLen=0;var selectedFillTransparentBinLen=0;var selectedEdgesTransparentBinLen=0;//------------------------------------------------------------------------------------------------------
14407
14416
  // Render normal opaque solids, defer others to bins to render after
14408
14417
  //------------------------------------------------------------------------------------------------------
14409
- for(var _i200=0,len=drawables.length;_i200<len;_i200++){drawable=drawables[_i200];if(drawable.culled===true||drawable.visible===false){continue;}var renderFlags=drawable.renderFlags;if(renderFlags.colorOpaque){if(drawable.saoEnabled&&occlusionTexture){normalDrawSAOBin[normalDrawSAOBinLen++]=drawable;}else{drawable.drawColorOpaque(frameCtx);}}if(transparentEnabled){if(renderFlags.colorTransparent){normalFillTransparentBin[normalFillTransparentBinLen++]=drawable;}}if(renderFlags.xrayedSilhouetteTransparent){xrayedFillTransparentBin[xrayedFillTransparentBinLen++]=drawable;}if(renderFlags.xrayedSilhouetteOpaque){xrayedFillOpaqueBin[xrayedFillOpaqueBinLen++]=drawable;}if(renderFlags.highlightedSilhouetteTransparent){highlightedFillTransparentBin[highlightedFillTransparentBinLen++]=drawable;}if(renderFlags.highlightedSilhouetteOpaque){highlightedFillOpaqueBin[highlightedFillOpaqueBinLen++]=drawable;}if(renderFlags.selectedSilhouetteTransparent){selectedFillTransparentBin[selectedFillTransparentBinLen++]=drawable;}if(renderFlags.selectedSilhouetteOpaque){selectedFillOpaqueBin[selectedFillOpaqueBinLen++]=drawable;}if(drawable.edges&&edgesEnabled){if(renderFlags.edgesOpaque){normalEdgesOpaqueBin[normalEdgesOpaqueBinLen++]=drawable;}if(renderFlags.edgesTransparent){normalEdgesTransparentBin[normalEdgesTransparentBinLen++]=drawable;}if(renderFlags.selectedEdgesTransparent){selectedEdgesTransparentBin[selectedEdgesTransparentBinLen++]=drawable;}if(renderFlags.selectedEdgesOpaque){selectedEdgesOpaqueBin[selectedEdgesOpaqueBinLen++]=drawable;}if(renderFlags.xrayedEdgesTransparent){xrayEdgesTransparentBin[xrayEdgesTransparentBinLen++]=drawable;}if(renderFlags.xrayedEdgesOpaque){xrayEdgesOpaqueBin[xrayEdgesOpaqueBinLen++]=drawable;}if(renderFlags.highlightedEdgesTransparent){highlightedEdgesTransparentBin[highlightedEdgesTransparentBinLen++]=drawable;}if(renderFlags.highlightedEdgesOpaque){highlightedEdgesOpaqueBin[highlightedEdgesOpaqueBinLen++]=drawable;}}}//------------------------------------------------------------------------------------------------------
14418
+ for(var _i202=0,len=drawables.length;_i202<len;_i202++){drawable=drawables[_i202];if(drawable.culled===true||drawable.visible===false){continue;}var renderFlags=drawable.renderFlags;if(renderFlags.colorOpaque){if(drawable.saoEnabled&&occlusionTexture){normalDrawSAOBin[normalDrawSAOBinLen++]=drawable;}else{drawable.drawColorOpaque(frameCtx);}}if(transparentEnabled){if(renderFlags.colorTransparent){normalFillTransparentBin[normalFillTransparentBinLen++]=drawable;}}if(renderFlags.xrayedSilhouetteTransparent){xrayedFillTransparentBin[xrayedFillTransparentBinLen++]=drawable;}if(renderFlags.xrayedSilhouetteOpaque){xrayedFillOpaqueBin[xrayedFillOpaqueBinLen++]=drawable;}if(renderFlags.highlightedSilhouetteTransparent){highlightedFillTransparentBin[highlightedFillTransparentBinLen++]=drawable;}if(renderFlags.highlightedSilhouetteOpaque){highlightedFillOpaqueBin[highlightedFillOpaqueBinLen++]=drawable;}if(renderFlags.selectedSilhouetteTransparent){selectedFillTransparentBin[selectedFillTransparentBinLen++]=drawable;}if(renderFlags.selectedSilhouetteOpaque){selectedFillOpaqueBin[selectedFillOpaqueBinLen++]=drawable;}if(drawable.edges&&edgesEnabled){if(renderFlags.edgesOpaque){normalEdgesOpaqueBin[normalEdgesOpaqueBinLen++]=drawable;}if(renderFlags.edgesTransparent){normalEdgesTransparentBin[normalEdgesTransparentBinLen++]=drawable;}if(renderFlags.selectedEdgesTransparent){selectedEdgesTransparentBin[selectedEdgesTransparentBinLen++]=drawable;}if(renderFlags.selectedEdgesOpaque){selectedEdgesOpaqueBin[selectedEdgesOpaqueBinLen++]=drawable;}if(renderFlags.xrayedEdgesTransparent){xrayEdgesTransparentBin[xrayEdgesTransparentBinLen++]=drawable;}if(renderFlags.xrayedEdgesOpaque){xrayEdgesOpaqueBin[xrayEdgesOpaqueBinLen++]=drawable;}if(renderFlags.highlightedEdgesTransparent){highlightedEdgesTransparentBin[highlightedEdgesTransparentBinLen++]=drawable;}if(renderFlags.highlightedEdgesOpaque){highlightedEdgesOpaqueBin[highlightedEdgesOpaqueBinLen++]=drawable;}}}//------------------------------------------------------------------------------------------------------
14410
14419
  // Render deferred bins
14411
14420
  //------------------------------------------------------------------------------------------------------
14412
14421
  // Opaque color with SAO
@@ -14431,18 +14440,18 @@ if(selectedEdgesOpaqueBinLen>0){for(i=0;i<selectedEdgesOpaqueBinLen;i++){selecte
14431
14440
  if(selectedFillOpaqueBinLen>0){for(i=0;i<selectedFillOpaqueBinLen;i++){selectedFillOpaqueBin[i].drawSilhouetteSelected(frameCtx);}}}// Selected transparent
14432
14441
  if(selectedFillTransparentBinLen>0||selectedEdgesTransparentBinLen>0){frameCtx.lastProgramId=null;if(scene.selectedMaterial.glowThrough){gl.clear(gl.DEPTH_BUFFER_BIT);}gl.enable(gl.CULL_FACE);gl.enable(gl.BLEND);if(canvasTransparent){gl.blendEquation(gl.FUNC_ADD);gl.blendFuncSeparate(gl.SRC_ALPHA,gl.ONE_MINUS_SRC_ALPHA,gl.ONE,gl.ONE_MINUS_SRC_ALPHA);}else{gl.blendFunc(gl.SRC_ALPHA,gl.ONE_MINUS_SRC_ALPHA);}// Selected transparent edges
14433
14442
  if(selectedEdgesTransparentBinLen>0){for(i=0;i<selectedEdgesTransparentBinLen;i++){selectedEdgesTransparentBin[i].drawEdgesSelected(frameCtx);}}// Selected transparent fill
14434
- if(selectedFillTransparentBinLen>0){for(i=0;i<selectedFillTransparentBinLen;i++){selectedFillTransparentBin[i].drawSilhouetteSelected(frameCtx);}}gl.disable(gl.BLEND);}};renderDrawables(postCullDrawableList);if(uiDrawableList.length>0){gl.clear(gl.DEPTH_BUFFER_BIT);renderDrawables(uiDrawableList);}var endTime=Date.now();var frameStats=stats.frame;frameStats.renderTime=(endTime-startTime)/1000.0;frameStats.drawElements=frameCtx.drawElements;frameStats.drawArrays=frameCtx.drawArrays;frameStats.useProgram=frameCtx.useProgram;frameStats.bindTexture=frameCtx.bindTexture;frameStats.bindArray=frameCtx.bindArray;var numTextureUnits=WEBGL_INFO.MAX_TEXTURE_IMAGE_UNITS;for(var ii=0;ii<numTextureUnits;ii++){gl.activeTexture(gl.TEXTURE0+ii);}gl.bindTexture(gl.TEXTURE_CUBE_MAP,null);gl.bindTexture(gl.TEXTURE_2D,null);var numVertexAttribs=WEBGL_INFO.MAX_VERTEX_ATTRIBS;// Fixes https://github.com/xeokit/xeokit-sdk/issues/174
14443
+ if(selectedFillTransparentBinLen>0){for(i=0;i<selectedFillTransparentBinLen;i++){selectedFillTransparentBin[i].drawSilhouetteSelected(frameCtx);}}gl.disable(gl.BLEND);}};renderDrawables(postCullDrawableList);if(uiDrawableList.length>0){gl.clear(gl.DEPTH_BUFFER_BIT);renderDrawables(uiDrawableList);}frameCtx.testAABB=null;var endTime=Date.now();var frameStats=stats.frame;frameStats.renderTime=(endTime-startTime)/1000.0;frameStats.drawElements=frameCtx.drawElements;frameStats.drawArrays=frameCtx.drawArrays;frameStats.useProgram=frameCtx.useProgram;frameStats.bindTexture=frameCtx.bindTexture;frameStats.bindArray=frameCtx.bindArray;var numTextureUnits=WEBGL_INFO.MAX_TEXTURE_IMAGE_UNITS;for(var ii=0;ii<numTextureUnits;ii++){gl.activeTexture(gl.TEXTURE0+ii);}gl.bindTexture(gl.TEXTURE_CUBE_MAP,null);gl.bindTexture(gl.TEXTURE_2D,null);var numVertexAttribs=WEBGL_INFO.MAX_VERTEX_ATTRIBS;// Fixes https://github.com/xeokit/xeokit-sdk/issues/174
14435
14444
  for(var _ii=0;_ii<numVertexAttribs;_ii++){gl.disableVertexAttribArray(_ii);}}var resetPickFrameCtx=function resetPickFrameCtx(canvasPos,clipTransformDiv,camera,eye,projMatrix,viewMatrix,frameCtx){frameCtx.reset();frameCtx.backfaces=true;frameCtx.frontface=true;// "ccw"
14436
14445
  frameCtx.viewParams.eye=eye;frameCtx.viewParams.projMatrix=projMatrix;frameCtx.viewParams.viewMatrix=viewMatrix;frameCtx.nearPlaneHeight=getNearPlaneHeight(camera,gl.drawingBufferHeight);var resolutionScale=scene.canvas.resolutionScale;frameCtx.pickClipPos=[canvasPos?2*canvasPos[0]*resolutionScale/gl.drawingBufferWidth-1:0,canvasPos?1-2*canvasPos[1]*resolutionScale/gl.drawingBufferHeight:0];frameCtx.pickClipPosInv=[gl.drawingBufferWidth/clipTransformDiv,gl.drawingBufferHeight/clipTransformDiv];};/**
14437
14446
  * Picks an Entity.
14438
14447
  * @private
14439
- */this.pick=function(){var tempVec3a=math.vec3();var tempVec3b=math.vec3();var tempVec4a=math.vec4();var tempVec4b=math.vec4();var tempVec4c=math.vec4();var tempVec4d=math.vec4();var tempVec4e=math.vec4();var tempMat4a=math.mat4();var tempMat4b=math.mat4();var tempMat4c=math.mat4();var tempMat4d=math.mat4();var upVec=math.vec3([0,1,0]);var _pickResult=new PickResult();var nearAndFar=math.vec2();var canvasPos=math.vec3();var worldRayOrigin=math.vec3();var worldRayDir=math.vec3();math.vec3();math.vec3();var pickBuffer=new RenderBuffer(gl);pickBuffer.setSize([1,1]);var pickNormalBuffer=new RenderBuffer(gl,[gl.RGBA32I]);pickNormalBuffer.setSize([3,3]);return function(params){var pickResult=arguments.length>1&&arguments[1]!==undefined?arguments[1]:_pickResult;pickResult.reset();updateDrawlist();var pickViewMatrix=null;var pickProjMatrix=null;var projection=null;var camera=scene.camera;pickResult.pickSurface=params.pickSurface;if(params.canvasPos){canvasPos[0]=params.canvasPos[0];canvasPos[1]=params.canvasPos[1];pickViewMatrix=camera.viewMatrix;pickProjMatrix=camera.projMatrix;projection=camera.projection;nearAndFar[0]=camera.project.near;nearAndFar[1]=camera.project.far;pickResult.canvasPos=params.canvasPos;}else{// Picking with arbitrary World-space ray
14448
+ */this.pick=function(){var tempVec3a=math.vec3();var tempVec3b=math.vec3();var tempVec4a=math.vec4();var tempVec4b=math.vec4();var tempVec4c=math.vec4();var tempVec4d=math.vec4();var tempVec4e=math.vec4();var tempMat4a=math.mat4();var tempMat4b=math.mat4();var tempMat4c=math.mat4();var tempMat4d=math.mat4();var upVec=math.vec3([0,1,0]);var _pickResult=new PickResult();var nearAndFar=math.vec2();var canvasPos=math.vec3();var worldRayOrigin=math.vec3();var worldRayDir=math.vec3();math.vec3();math.vec3();var pickBuffer=new RenderBuffer(gl);pickBuffer.setSize([1,1]);var pickNormalBuffer=new RenderBuffer(gl,[gl.RGBA32I]);pickNormalBuffer.setSize([3,3]);return function(params){var pickResult=arguments.length>1&&arguments[1]!==undefined?arguments[1]:_pickResult;pickResult.reset();updateDrawlist();var pickViewMatrix=null;var pickProjMatrix=null;var projection=null;var camera=scene.camera;pickResult.pickSurface=params.pickSurface;if(params.canvasPos){canvasPos[0]=params.canvasPos[0];canvasPos[1]=params.canvasPos[1];pickViewMatrix=camera.viewMatrix;pickProjMatrix=camera.projMatrix;projection=camera.projection;nearAndFar[0]=camera.project.near;nearAndFar[1]=camera.project.far;pickResult.canvasPos=params.canvasPos;math.canvasPosToWorldRay(canvas,pickViewMatrix,pickProjMatrix,projection,canvasPos,tempVec3a,tempVec3b);frameCtx.testAABB=makeRayAABBIntersectionTest(tempVec3a,tempVec3b);}else{// Picking with arbitrary World-space ray
14440
14449
  // Align camera along ray and fire ray through center of canvas
14441
- if(params.matrix){pickViewMatrix=params.matrix;pickProjMatrix=camera.projMatrix;projection=camera.projection;nearAndFar[0]=camera.project.near;nearAndFar[1]=camera.project.far;}else{worldRayOrigin.set(params.origin||[0,0,0]);worldRayDir.set(params.direction||[0,0,1]);var look=math.addVec3(worldRayOrigin,worldRayDir,tempVec3a);var _up3=tempVec3b;if(Math.abs(math.dotVec3(worldRayDir,upVec))>1-1e-6){// worldRayDir aligned with Y axis
14450
+ canvasPos[0]=canvas.clientWidth*0.5;canvasPos[1]=canvas.clientHeight*0.5;if(params.matrix){pickViewMatrix=params.matrix;pickProjMatrix=camera.projMatrix;projection=camera.projection;nearAndFar[0]=camera.project.near;nearAndFar[1]=camera.project.far;math.canvasPosToWorldRay(canvas,pickViewMatrix,pickProjMatrix,projection,canvasPos,tempVec3a,tempVec3b);frameCtx.testAABB=makeRayAABBIntersectionTest(tempVec3a,tempVec3b);}else{worldRayOrigin.set(params.origin||[0,0,0]);worldRayDir.set(params.direction||[0,0,1]);var look=math.addVec3(worldRayOrigin,worldRayDir,tempVec3a);var _up3=tempVec3b;if(Math.abs(math.dotVec3(worldRayDir,upVec))>1-1e-6){// worldRayDir aligned with Y axis
14442
14451
  _up3[0]=0;_up3[1]=0;_up3[2]=Math.sign(worldRayDir[1]);}else{math.cross3Vec3(worldRayDir,upVec,_up3);math.cross3Vec3(_up3,worldRayDir,_up3);math.normalizeVec3(_up3,_up3);}pickViewMatrix=math.lookAtMat4v(worldRayOrigin,look,_up3,tempMat4b);// pickProjMatrix = camera.projMatrix;
14443
- pickProjMatrix=camera.ortho.matrix;projection="ortho";nearAndFar[0]=camera.ortho.near;nearAndFar[1]=camera.ortho.far;pickResult.origin=worldRayOrigin;pickResult.direction=worldRayDir;}canvasPos[0]=canvas.clientWidth*0.5;canvasPos[1]=canvas.clientHeight*0.5;}pickBuffer.bind();var resetFrameCtx=function resetFrameCtx(clipTransformDiv){return resetPickFrameCtx(canvasPos,clipTransformDiv,camera,pickResult.origin||camera.eye,pickProjMatrix||camera.projMatrix,pickViewMatrix||camera.viewMatrix,frameCtx);};// gpuPickPickable
14452
+ pickProjMatrix=camera.ortho.matrix;projection="ortho";nearAndFar[0]=camera.ortho.near;nearAndFar[1]=camera.ortho.far;pickResult.origin=worldRayOrigin;pickResult.direction=worldRayDir;frameCtx.testAABB=makeRayAABBIntersectionTest(pickResult.origin,pickResult.direction);}}pickBuffer.bind();var resetFrameCtx=function resetFrameCtx(clipTransformDiv){return resetPickFrameCtx(canvasPos,clipTransformDiv,camera,pickResult.origin||camera.eye,pickProjMatrix||camera.projMatrix,pickViewMatrix||camera.viewMatrix,frameCtx);};// gpuPickPickable
14444
14453
  resetFrameCtx(1);frameCtx.pickInvisible=!!params.pickInvisible;gl.viewport(0,0,1,1);gl.depthMask(true);gl.enable(gl.DEPTH_TEST);gl.disable(gl.CULL_FACE);gl.disable(gl.BLEND);gl.clear(gl.COLOR_BUFFER_BIT|gl.DEPTH_BUFFER_BIT);var includeEntityIds=params.includeEntityIds;var excludeEntityIds=params.excludeEntityIds;var renderDrawables=function renderDrawables(drawables){drawables.forEach(function(drawable){if(!drawable.culled&&drawable.visible&&drawable.pickable&&drawable.drawPickMesh// TODO: push this logic into drawable
14445
- &&(!includeEntityIds||includeEntityIds[drawable.id])&&(!excludeEntityIds||!excludeEntityIds[drawable.id])){drawable.drawPickMesh(frameCtx);}});};renderDrawables(postCullDrawableList);if(uiDrawableList.length>0){gl.clear(gl.DEPTH_BUFFER_BIT);renderDrawables(uiDrawableList);}var pickID=pixelToInt(pickBuffer.read(0,0));var pickable=pickID>=0&&pickIDs.items[pickID];if(!pickable){pickBuffer.unbind();return null;}var pickedEntity=pickable.delegatePickedEntity?pickable.delegatePickedEntity():pickable;if(!pickedEntity){pickBuffer.unbind();return null;}if(params.pickSurface){// GPU-based ray-picking
14454
+ &&(!includeEntityIds||includeEntityIds[drawable.id])&&(!excludeEntityIds||!excludeEntityIds[drawable.id])){drawable.drawPickMesh(frameCtx);}});};renderDrawables(postCullDrawableList);if(uiDrawableList.length>0){gl.clear(gl.DEPTH_BUFFER_BIT);renderDrawables(uiDrawableList);}frameCtx.testAABB=null;var pickID=pixelToInt(pickBuffer.read(0,0));var pickable=pickID>=0&&pickIDs.items[pickID];if(!pickable){pickBuffer.unbind();return null;}var pickedEntity=pickable.delegatePickedEntity?pickable.delegatePickedEntity():pickable;if(!pickedEntity){pickBuffer.unbind();return null;}if(params.pickSurface){// GPU-based ray-picking
14446
14455
  if(pickable.canPickTriangle&&pickable.canPickTriangle()){if(pickable.drawPickTriangles){resetFrameCtx(1);// frameCtx.pickInvisible = !!params.pickInvisible;
14447
14456
  gl.viewport(0,0,1,1);gl.clearColor(0,0,0,0);gl.enable(gl.DEPTH_TEST);gl.disable(gl.CULL_FACE);gl.disable(gl.BLEND);gl.clear(gl.COLOR_BUFFER_BIT|gl.DEPTH_BUFFER_BIT);pickable.drawPickTriangles(frameCtx);pickResult.primIndex=3*pixelToInt(pickBuffer.read(0,0));// Convert from triangle number to first vertex in indices
14448
14457
  }pickable.pickTriangleSurface(pickViewMatrix,pickProjMatrix,projection,pickResult);pickResult.pickSurfacePrecision=false;}else{if(pickable.canPickWorldPos&&pickable.canPickWorldPos()){// pickWorldPos
@@ -14465,7 +14474,7 @@ frameCtx.snapPickLayerParams=[];gl.depthMask(false);gl.drawBuffers([gl.COLOR_ATT
14465
14474
  postCullDrawableList.forEach(function(drawable){if(!drawable.culled&&drawable.visible&&drawable.pickable&&drawable.drawSnap){drawable.drawSnap(frameCtx);}});};if(snapToEdge){drawSnap("edge");}if(snapToVertex){drawSnap("vertex");}gl.depthMask(true);var layerParamsSnap=frameCtx.snapPickLayerParams;// Read and decode the snapped coordinates
14466
14475
  var readSnapPickBuffer=function readSnapPickBuffer(source,arrayType,glType){var w=vertexPickBuffer.buffer.width;var h=vertexPickBuffer.buffer.height;var pix=new arrayType(4*w*h);gl.readBuffer(source);gl.readPixels(0,0,w,h,gl.RGBA_INTEGER,glType,pix,0);return pix;};var snapPickResultArray=readSnapPickBuffer(gl.COLOR_ATTACHMENT0,Int32Array,gl.INT);var snapPickNormalResultArray=readSnapPickBuffer(gl.COLOR_ATTACHMENT1,Int32Array,gl.INT);var snapPickIdResultArray=readSnapPickBuffer(gl.COLOR_ATTACHMENT2,Uint32Array,gl.UNSIGNED_INT);vertexPickBuffer.unbind();// result 1) regular hi-precision world position
14467
14476
  var worldPos=null;var worldNormal=null;var pickable=null;var middleX=snapRadiusInPixels;var middleY=snapRadiusInPixels;var middleIndex=middleX*4+middleY*vertexPickBuffer.size[0]*4;var pickResultMiddleXY=snapPickResultArray.slice(middleIndex,middleIndex+4);var pickNormalResultMiddleXY=snapPickNormalResultArray.slice(middleIndex,middleIndex+4);var pickPickableResultMiddleXY=snapPickIdResultArray.slice(middleIndex,middleIndex+4);if(pickResultMiddleXY[3]!==0){var pickedLayerParmasSurface=layerParamsSurface[Math.abs(pickResultMiddleXY[3])%layerParamsSurface.length];worldPos=toWorldPos(pickResultMiddleXY,pickedLayerParmasSurface.origin,pickedLayerParmasSurface.coordinateScale);worldNormal=toWorldNormal(pickNormalResultMiddleXY);pickable=pickIDs.items[pixelToInt(pickPickableResultMiddleXY)];}// result 2) hi-precision snapped (to vertex/edge) world position
14468
- var snapPickResult=[];for(var _i201=0;_i201<snapPickResultArray.length;_i201+=4){var layerNumber=snapPickResultArray[_i201+3];if(layerNumber>0){var pixelNumber=Math.floor(_i201/4);var w=vertexPickBuffer.size[0];var x=pixelNumber%w-Math.floor(w/2);var y=Math.floor(pixelNumber/w)-Math.floor(w/2);snapPickResult.push({dist:math.lenVec2([x,y]),isVertex:snapToVertex&&snapToEdge?layerNumber>layerParamsSnap.length/2:snapToVertex,result:snapPickResultArray.subarray(_i201,_i201+4),normal:snapPickNormalResultArray.subarray(_i201,_i201+4),id:snapPickIdResultArray.subarray(_i201,_i201+4)});}}var getPickedEntity=function getPickedEntity(pickable){return pickable&&pickable.delegatePickedEntity?pickable.delegatePickedEntity():pickable;};if(snapPickResult.length>0){// closest vertex snap first, then closest edge snap
14477
+ var snapPickResult=[];for(var _i203=0;_i203<snapPickResultArray.length;_i203+=4){var layerNumber=snapPickResultArray[_i203+3];if(layerNumber>0){var pixelNumber=Math.floor(_i203/4);var w=vertexPickBuffer.size[0];var x=pixelNumber%w-Math.floor(w/2);var y=Math.floor(pixelNumber/w)-Math.floor(w/2);snapPickResult.push({dist:math.lenVec2([x,y]),isVertex:snapToVertex&&snapToEdge?layerNumber>layerParamsSnap.length/2:snapToVertex,result:snapPickResultArray.subarray(_i203,_i203+4),normal:snapPickNormalResultArray.subarray(_i203,_i203+4),id:snapPickIdResultArray.subarray(_i203,_i203+4)});}}var getPickedEntity=function getPickedEntity(pickable){return pickable&&pickable.delegatePickedEntity?pickable.delegatePickedEntity():pickable;};if(snapPickResult.length>0){// closest vertex snap first, then closest edge snap
14469
14478
  var res=snapPickResult.reduce(function(a,b){return(a.isVertex-b.isVertex||b.dist-a.dist)>0?a:b;});var snapPick=res.result;var pickedLayerParmas=layerParamsSnap[snapPick[3]];var snappedWorldPos=toWorldPos(snapPick,pickedLayerParmas.origin,pickedLayerParmas.coordinateScale);var snappedCanvasPos=camera.projectWorldPos(snappedWorldPos);pickResult.reset();pickResult.snappedToEdge=!res.isVertex;pickResult.snappedToVertex=res.isVertex;pickResult.worldPos=snappedWorldPos;pickResult.worldNormal=toWorldNormal(res.normal);pickResult.entity=getPickedEntity(pickIDs.items[pixelToInt(res.id)]);pickResult.canvasPos=canvasPos||worldPos&&camera.projectWorldPos(worldPos)||snappedCanvasPos;pickResult.snappedCanvasPos=snappedCanvasPos;return pickResult;}else if(worldPos){pickResult.reset();pickResult.snappedToEdge=false;pickResult.snappedToVertex=false;pickResult.worldPos=worldPos;pickResult.worldNormal=worldNormal;pickResult.entity=getPickedEntity(pickable);pickResult.canvasPos=canvasPos||camera.projectWorldPos(worldPos);pickResult.snappedCanvasPos=canvasPos;return pickResult;}else{return null;}};}();/**
14470
14479
  * Adds a {@link Marker} for occlusion testing.
14471
14480
  * @param marker
@@ -14487,7 +14496,7 @@ function(x,y){return readPixelBuf.read(Math.round(resolutionScale*x),Math.round(
14487
14496
  * @param colors
14488
14497
  * @param len
14489
14498
  * @private
14490
- */readPixels:function readPixels(pixels,colors,len){snapshotBuffer.bind();gl.clear(gl.COLOR_BUFFER_BIT|gl.DEPTH_BUFFER_BIT);imageDirty=true;_this87.render();for(var _i202=0;_i202<len;_i202++){var j=_i202*2;var k=_i202*4;var _color4=snapshotBuffer.read(pixels[j],pixels[j+1]);colors[k]=_color4[0];colors[k+1]=_color4[1];colors[k+2]=_color4[2];colors[k+3]=_color4[3];}snapshotBuffer.unbind();imageDirty=true;},/**
14499
+ */readPixels:function readPixels(pixels,colors,len){snapshotBuffer.bind();gl.clear(gl.COLOR_BUFFER_BIT|gl.DEPTH_BUFFER_BIT);imageDirty=true;_this87.render();for(var _i204=0;_i204<len;_i204++){var j=_i204*2;var k=_i204*4;var _color4=snapshotBuffer.read(pixels[j],pixels[j+1]);colors[k]=_color4[0];colors[k+1]=_color4[1];colors[k+2]=_color4[2];colors[k+3]=_color4[3];}snapshotBuffer.unbind();imageDirty=true;},/**
14491
14500
  * Enter snapshot mode.
14492
14501
  *
14493
14502
  * Switches rendering to a hidden snapshot canvas.
@@ -17126,7 +17135,7 @@ _this100.preset=cfg.preset;if(cfg.lineWidth!==undefined){_this100.lineWidth=cfg.
17126
17135
  var modelCenter=math.getAABB3Center(modelAABB,math.vec3());modelCaches[sceneModel.id].entityCaches.forEach(function(entityCache,entityId){var entity=sceneModel.objects[entityId];if(entityCache.generateCaps&&entity.capMaterial&&math.planeIntersectsAABB3(plane,entity.aabb)){entityCache.meshCaches||(entityCache.meshCaches=entity.meshes.filter(function(mesh){return mesh.isSolid();}).map(function(mesh){var meshIndices=[];var meshVertices=[];mesh.getEachIndex(function(i){return meshIndices.push(i);});mesh.getEachVertex(function(v){return meshVertices.push.apply(meshVertices,_toConsumableArray(math.subVec3(v,modelCenter,tempVec3a$a)));});return{mesh:mesh,meshIndices:meshIndices,meshVertices:meshVertices};}));entityCache.meshCaches.filter(function(meshCache){return math.planeIntersectsAABB3(plane,meshCache.mesh.aabb);}).forEach(function(meshCache,meshIdx){var geo=sliceMesh({origin:modelCenter,indices:meshCache.meshIndices,positions:meshCache.meshVertices},{onlyPosSliceWithUV:true}).pos;if(geo){entityCache.capMeshes.push(new Mesh(scene,{isObject:true,id:"".concat(plane.id,"-").concat(entityId,"-").concat(meshIdx),material:entity.capMaterial,origin:math.addVec3(modelCenter,math.mulVec3Scalar(plane.dir,0.001,tempVec3a$a),tempVec3a$a),geometry:new ReadableGeometry(scene,{primitive:"triangles",indices:geo.indices,positions:geo.positions,normals:geo.normals,uv:geo.uv})}));}});}});}});}});visibleSceneModels.forEach(function(sceneModel){return modelCaches[sceneModel.id].entityCaches.forEach(function(entityCache){return entityCache.generateCaps=false;});});},100);};this._onCapMaterialUpdated=function(entity){if(!destroy){updateTimeout=null;var handleSectionPlane=function handleSectionPlane(sectionPlane){var onSectionPlaneUpdated=function onSectionPlaneUpdated(){Object.values(modelCaches).forEach(function(modelCache){return modelCache.entityCaches.forEach(function(entityCache){entityCache.destroyCaps();entityCache.generateCaps=true;});});update();};sectionPlanes.push(sectionPlane);sectionPlane.on('pos',onSectionPlaneUpdated);sectionPlane.on('dir',onSectionPlaneUpdated);sectionPlane.on('active',onSectionPlaneUpdated);sectionPlane.once('destroyed',function(){var idx=sectionPlanes.indexOf(sectionPlane);if(idx>=0){sectionPlanes.splice(idx,1);onSectionPlaneUpdated();}});};for(var key in scene.sectionPlanes){handleSectionPlane(scene.sectionPlanes[key]);}var onSectionPlaneCreated=scene.on('sectionPlaneCreated',handleSectionPlane);var onTick=scene.on("tick",function(){//on ticks we only check if there is a model that we have saved vertices for,
17127
17136
  //but it's no more available on the scene, or if its visibility changed
17128
17137
  var doUpdate=false;for(var sceneModelId in modelCaches){var sceneModel=scene.models[sceneModelId];if(!sceneModel){modelCaches[sceneModelId].entityCaches.forEach(function(entityCache){return entityCache.destroyCaps();});delete modelCaches[sceneModelId];doUpdate=true;}else if(modelCaches[sceneModelId].modelVisible!=sceneModel.visible){var modelCache=modelCaches[sceneModelId];modelCache.modelVisible=!!sceneModel.visible;modelCache.entityCaches.forEach(function(entityCache){entityCache.destroyCaps();entityCache.generateCaps=true;});doUpdate=true;}}if(doUpdate){update();}});destroy=function destroy(){for(var sceneModelId in modelCaches){modelCaches[sceneModelId].entityCaches.forEach(function(entityCache){return entityCache.destroyCaps();});}scene.off(onSectionPlaneCreated);scene.off(onTick);};}var model=entity.model;var modelId=model.id;modelCaches[modelId]||(modelCaches[modelId]={modelVisible:model.visible,entityCaches:new Map()});var entityCaches=modelCaches[modelId].entityCaches;var entityId=entity.id;if(!entityCaches.has(entityId)){var _entityCache={capMeshes:[],meshCaches:null,generateCaps:false,destroyCaps:function destroyCaps(){_entityCache.capMeshes.forEach(function(capMesh){return capMesh.destroy();});_entityCache.capMeshes.length=0;}};entityCaches.set(entityId,_entityCache);}var entityCache=entityCaches.get(entityId);entityCache.destroyCaps();entityCache.generateCaps=true;update();};});// Cached vars to avoid garbage collection
17129
- function getEntityIDMap(scene,entityIds){var map={};var entityId;var entity;for(var _i203=0,len=entityIds.length;_i203<len;_i203++){entityId=entityIds[_i203];entity=scene.components[entityId];if(!entity){scene.warn("pick(): Component not found: "+entityId);continue;}if(!entity.isEntity){scene.warn("pick(): Component is not an Entity: "+entityId);continue;}map[entityId]=true;}return map;}/**
17138
+ function getEntityIDMap(scene,entityIds){var map={};var entityId;var entity;for(var _i205=0,len=entityIds.length;_i205<len;_i205++){entityId=entityIds[_i205];entity=scene.components[entityId];if(!entity){scene.warn("pick(): Component not found: "+entityId);continue;}if(!entity.isEntity){scene.warn("pick(): Component is not an Entity: "+entityId);continue;}map[entityId]=true;}return map;}/**
17130
17139
  * Fired whenever a debug message is logged on a component within this Scene.
17131
17140
  * @event log
17132
17141
  * @param {String} value The debug message
@@ -17562,7 +17571,7 @@ _this101._needRecompile=false;/**
17562
17571
  *
17563
17572
  * @type {Canvas}
17564
17573
  */_this101.canvas=new Canvas(_assertThisInitialized(_this101),{dontClear:true,// Never destroy this component with Scene#clear();
17565
- canvas:canvas,spinnerElementId:cfg.spinnerElementId,transparent:transparent,webgl2:cfg.webgl2!==false,contextAttr:cfg.contextAttr||{},backgroundColor:cfg.backgroundColor,backgroundColorFromAmbientLight:cfg.backgroundColorFromAmbientLight,premultipliedAlpha:cfg.premultipliedAlpha});var onContextLost=function onContextLost(event){return _this101.viewer.destroy();};canvas.addEventListener("webglcontextlost",onContextLost,false);_this101._removeWebglcontextlostListener=function(){return canvas.removeEventListener("webglcontextlost",onContextLost,false);};_this101.canvas.on("boundary",function(){_this101.glRedraw();});_this101.canvas.on("webglContextFailed",function(){alert("xeokit failed to find WebGL!");});_this101._renderer=new Renderer$1(_assertThisInitialized(_this101),{transparent:transparent,alphaDepthMask:alphaDepthMask});_this101._sectionPlanesState=new function(){this.sectionPlanes=[];this.clippingCaps=false;this._numCachedSectionPlanes=0;var hash=null;this.getHash=function(){if(hash){return hash;}var numAllocatedSectionPlanes=this.getNumAllocatedSectionPlanes();this.sectionPlanes;if(numAllocatedSectionPlanes===0){return this.hash=";";}var hashParts=[];for(var _i204=0,len=numAllocatedSectionPlanes;_i204<len;_i204++){hashParts.push("cp");}hashParts.push(";");hash=hashParts.join("");return hash;};this.addSectionPlane=function(sectionPlane){this.sectionPlanes.push(sectionPlane);hash=null;};this.removeSectionPlane=function(sectionPlane){for(var _i205=0,len=this.sectionPlanes.length;_i205<len;_i205++){if(this.sectionPlanes[_i205].id===sectionPlane.id){this.sectionPlanes.splice(_i205,1);hash=null;return;}}};this.setNumCachedSectionPlanes=function(numCachedSectionPlanes){this._numCachedSectionPlanes=numCachedSectionPlanes;hash=null;};this.getNumCachedSectionPlanes=function(){return this._numCachedSectionPlanes;};this.getNumAllocatedSectionPlanes=function(){var num=this.sectionPlanes.length;return num>this._numCachedSectionPlanes?num:this._numCachedSectionPlanes;};}();_this101._sectionPlanesState.setNumCachedSectionPlanes(cfg.numCachedSectionPlanes||0);_this101._lightsState=new function(){var DEFAULT_AMBIENT=math.vec4([0,0,0,0]);var ambientColorIntensity=math.vec4();this.lights=[];this.reflectionMaps=[];this.lightMaps=[];var hash=null;var ambientLight=null;this.getHash=function(){if(hash){return hash;}var hashParts=[];var lights=this.lights;var light;for(var _i206=0,len=lights.length;_i206<len;_i206++){light=lights[_i206];hashParts.push("/");hashParts.push(light.type);hashParts.push(light.space==="world"?"w":"v");if(light.castsShadow){hashParts.push("sh");}}if(this.lightMaps.length>0){hashParts.push("/lm");}if(this.reflectionMaps.length>0){hashParts.push("/rm");}hashParts.push(";");hash=hashParts.join("");return hash;};this.addLight=function(state){this.lights.push(state);ambientLight=null;hash=null;};this.removeLight=function(state){for(var _i207=0,len=this.lights.length;_i207<len;_i207++){var light=this.lights[_i207];if(light.id===state.id){this.lights.splice(_i207,1);if(ambientLight&&ambientLight.id===state.id){ambientLight=null;}hash=null;return;}}};this.addReflectionMap=function(state){this.reflectionMaps.push(state);hash=null;};this.removeReflectionMap=function(state){for(var _i208=0,len=this.reflectionMaps.length;_i208<len;_i208++){if(this.reflectionMaps[_i208].id===state.id){this.reflectionMaps.splice(_i208,1);hash=null;return;}}};this.addLightMap=function(state){this.lightMaps.push(state);hash=null;};this.removeLightMap=function(state){for(var _i209=0,len=this.lightMaps.length;_i209<len;_i209++){if(this.lightMaps[_i209].id===state.id){this.lightMaps.splice(_i209,1);hash=null;return;}}};this.getAmbientColorAndIntensity=function(){if(!ambientLight){for(var _i210=0,len=this.lights.length;_i210<len;_i210++){var light=this.lights[_i210];if(light.type==="ambient"){ambientLight=light;break;}}}if(ambientLight){var _color5=ambientLight.color;var intensity=ambientLight.intensity;ambientColorIntensity[0]=_color5[0];ambientColorIntensity[1]=_color5[1];ambientColorIntensity[2]=_color5[2];ambientColorIntensity[3]=intensity;return ambientColorIntensity;}else{return DEFAULT_AMBIENT;}};}();/**
17574
+ canvas:canvas,spinnerElementId:cfg.spinnerElementId,transparent:transparent,webgl2:cfg.webgl2!==false,contextAttr:cfg.contextAttr||{},backgroundColor:cfg.backgroundColor,backgroundColorFromAmbientLight:cfg.backgroundColorFromAmbientLight,premultipliedAlpha:cfg.premultipliedAlpha});var onContextLost=function onContextLost(event){return _this101.viewer.destroy();};canvas.addEventListener("webglcontextlost",onContextLost,false);_this101._removeWebglcontextlostListener=function(){return canvas.removeEventListener("webglcontextlost",onContextLost,false);};_this101.canvas.on("boundary",function(){_this101.glRedraw();});_this101.canvas.on("webglContextFailed",function(){alert("xeokit failed to find WebGL!");});_this101._renderer=new Renderer$1(_assertThisInitialized(_this101),{transparent:transparent,alphaDepthMask:alphaDepthMask});_this101._sectionPlanesState=new function(){this.sectionPlanes=[];this.clippingCaps=false;this._numCachedSectionPlanes=0;var hash=null;this.getHash=function(){if(hash){return hash;}var numAllocatedSectionPlanes=this.getNumAllocatedSectionPlanes();this.sectionPlanes;if(numAllocatedSectionPlanes===0){return this.hash=";";}var hashParts=[];for(var _i206=0,len=numAllocatedSectionPlanes;_i206<len;_i206++){hashParts.push("cp");}hashParts.push(";");hash=hashParts.join("");return hash;};this.addSectionPlane=function(sectionPlane){this.sectionPlanes.push(sectionPlane);hash=null;};this.removeSectionPlane=function(sectionPlane){for(var _i207=0,len=this.sectionPlanes.length;_i207<len;_i207++){if(this.sectionPlanes[_i207].id===sectionPlane.id){this.sectionPlanes.splice(_i207,1);hash=null;return;}}};this.setNumCachedSectionPlanes=function(numCachedSectionPlanes){this._numCachedSectionPlanes=numCachedSectionPlanes;hash=null;};this.getNumCachedSectionPlanes=function(){return this._numCachedSectionPlanes;};this.getNumAllocatedSectionPlanes=function(){var num=this.sectionPlanes.length;return num>this._numCachedSectionPlanes?num:this._numCachedSectionPlanes;};}();_this101._sectionPlanesState.setNumCachedSectionPlanes(cfg.numCachedSectionPlanes||0);_this101._lightsState=new function(){var DEFAULT_AMBIENT=math.vec4([0,0,0,0]);var ambientColorIntensity=math.vec4();this.lights=[];this.reflectionMaps=[];this.lightMaps=[];var hash=null;var ambientLight=null;this.getHash=function(){if(hash){return hash;}var hashParts=[];var lights=this.lights;var light;for(var _i208=0,len=lights.length;_i208<len;_i208++){light=lights[_i208];hashParts.push("/");hashParts.push(light.type);hashParts.push(light.space==="world"?"w":"v");if(light.castsShadow){hashParts.push("sh");}}if(this.lightMaps.length>0){hashParts.push("/lm");}if(this.reflectionMaps.length>0){hashParts.push("/rm");}hashParts.push(";");hash=hashParts.join("");return hash;};this.addLight=function(state){this.lights.push(state);ambientLight=null;hash=null;};this.removeLight=function(state){for(var _i209=0,len=this.lights.length;_i209<len;_i209++){var light=this.lights[_i209];if(light.id===state.id){this.lights.splice(_i209,1);if(ambientLight&&ambientLight.id===state.id){ambientLight=null;}hash=null;return;}}};this.addReflectionMap=function(state){this.reflectionMaps.push(state);hash=null;};this.removeReflectionMap=function(state){for(var _i210=0,len=this.reflectionMaps.length;_i210<len;_i210++){if(this.reflectionMaps[_i210].id===state.id){this.reflectionMaps.splice(_i210,1);hash=null;return;}}};this.addLightMap=function(state){this.lightMaps.push(state);hash=null;};this.removeLightMap=function(state){for(var _i211=0,len=this.lightMaps.length;_i211<len;_i211++){if(this.lightMaps[_i211].id===state.id){this.lightMaps.splice(_i211,1);hash=null;return;}}};this.getAmbientColorAndIntensity=function(){if(!ambientLight){for(var _i212=0,len=this.lights.length;_i212<len;_i212++){var light=this.lights[_i212];if(light.type==="ambient"){ambientLight=light;break;}}}if(ambientLight){var _color5=ambientLight.color;var intensity=ambientLight.intensity;ambientColorIntensity[0]=_color5[0];ambientColorIntensity[1]=_color5[1];ambientColorIntensity[2]=_color5[2];ambientColorIntensity[3]=intensity;return ambientColorIntensity;}else{return DEFAULT_AMBIENT;}};}();/**
17566
17575
  * Publishes input events that occur on this Scene's canvas.
17567
17576
  *
17568
17577
  * @property input
@@ -18094,13 +18103,13 @@ if(excludeEntities){params.excludeEntityIds=getEntityIDMap(this,excludeEntities)
18094
18103
  */},{key:"clear",value:function clear(){var component;for(var id in this.components){if(this.components.hasOwnProperty(id)){component=this.components[id];if(!component._dontClear){// Don't destroy components like Camera, Input, Viewport etc.
18095
18104
  component.destroy();}}}}/**
18096
18105
  * Destroys all {@link Light}s in this Scene..
18097
- */},{key:"clearLights",value:function clearLights(){var ids=Object.keys(this.lights);for(var _i211=0,len=ids.length;_i211<len;_i211++){this.lights[ids[_i211]].destroy();}}/**
18106
+ */},{key:"clearLights",value:function clearLights(){var ids=Object.keys(this.lights);for(var _i213=0,len=ids.length;_i213<len;_i213++){this.lights[ids[_i213]].destroy();}}/**
18098
18107
  * Destroys all {@link SectionPlane}s in this Scene.
18099
- */},{key:"clearSectionPlanes",value:function clearSectionPlanes(){var ids=Object.keys(this.sectionPlanes);for(var _i212=0,len=ids.length;_i212<len;_i212++){this.sectionPlanes[ids[_i212]].destroy();}}/**
18108
+ */},{key:"clearSectionPlanes",value:function clearSectionPlanes(){var ids=Object.keys(this.sectionPlanes);for(var _i214=0,len=ids.length;_i214<len;_i214++){this.sectionPlanes[ids[_i214]].destroy();}}/**
18100
18109
  * Destroys all {@link Line}s in this Scene.
18101
- */},{key:"clearBitmaps",value:function clearBitmaps(){var ids=Object.keys(this.bitmaps);for(var _i213=0,len=ids.length;_i213<len;_i213++){this.bitmaps[ids[_i213]].destroy();}}/**
18110
+ */},{key:"clearBitmaps",value:function clearBitmaps(){var ids=Object.keys(this.bitmaps);for(var _i215=0,len=ids.length;_i215<len;_i215++){this.bitmaps[ids[_i215]].destroy();}}/**
18102
18111
  * Destroys all {@link Line}s in this Scene.
18103
- */},{key:"clearLines",value:function clearLines(){var ids=Object.keys(this.lineSets);for(var _i214=0,len=ids.length;_i214<len;_i214++){this.lineSets[ids[_i214]].destroy();}}/**
18112
+ */},{key:"clearLines",value:function clearLines(){var ids=Object.keys(this.lineSets);for(var _i216=0,len=ids.length;_i216<len;_i216++){this.lineSets[ids[_i216]].destroy();}}/**
18104
18113
  * Gets the collective axis-aligned boundary (AABB) of a batch of {@link Entity}s that represent objects.
18105
18114
  *
18106
18115
  * An {@link Entity} represents an object when {@link Entity#isObject} is ````true````.
@@ -18218,7 +18227,7 @@ return entity.aabb;}ids=[ids];// Must be an entity type
18218
18227
  * @param {String[]} ids Array of {@link Entity#id} values.
18219
18228
  * @param {Function} callback Callback to execute on eacn {@link Entity}.
18220
18229
  * @returns {Boolean} True if any {@link Entity}s were updated, else false if all updates were redundant and not applied.
18221
- */},{key:"withObjects",value:function withObjects(ids,callback){if(utils.isString(ids)){ids=[ids];}var changed=false;for(var _i215=0,len=ids.length;_i215<len;_i215++){var id=ids[_i215];var entity=this.objects[id];if(entity){changed=callback(entity)||changed;}else{var modelIds=this.modelIds;for(var _i216=0,_len24=modelIds.length;_i216<_len24;_i216++){var modelId=modelIds[_i216];var globalObjectId=math.globalizeObjectId(modelId,id);entity=this.objects[globalObjectId];if(entity){changed=callback(entity)||changed;}}}}return changed;}/**
18230
+ */},{key:"withObjects",value:function withObjects(ids,callback){if(utils.isString(ids)){ids=[ids];}var changed=false;for(var _i217=0,len=ids.length;_i217<len;_i217++){var id=ids[_i217];var entity=this.objects[id];if(entity){changed=callback(entity)||changed;}else{var modelIds=this.modelIds;for(var _i218=0,_len24=modelIds.length;_i218<_len24;_i218++){var modelId=modelIds[_i218];var globalObjectId=math.globalizeObjectId(modelId,id);entity=this.objects[globalObjectId];if(entity){changed=callback(entity)||changed;}}}}return changed;}/**
18222
18231
  * This method will "tickify" the provided `cb` function.
18223
18232
  *
18224
18233
  * This means, the function will be wrapped so:
@@ -18383,7 +18392,7 @@ var camera=scene.camera;math.subVec3(camera.eye,camera.look,[]);controllers.came
18383
18392
  // up: camera.up,
18384
18393
  aabb:aabb});// TODO: Option to back off to fit AABB in view
18385
18394
  }else{// Fly to fit target boundary in view
18386
- controllers.cameraFlight.flyTo({aabb:aabb});}};var tickifiedMouseMoveFn=scene.tickify(this._canvasMouseMoveHandler=function(e){if(!(configs.active&&configs.pointerEnabled)){return;}if(leftDown||rightDown){return;}if(cameraControl.hasSubs("rayMove")){var origin=math.vec3();var _direction=math.vec3();math.canvasPosToWorldRay(scene.canvas.canvas,scene.camera.viewMatrix,scene.camera.projMatrix,scene.camera.projection,states.pointerCanvasPos,origin,_direction);cameraControl.fire("rayMove",{canvasPos:states.pointerCanvasPos,ray:{origin:origin,direction:_direction,canvasPos:states.pointerCanvasPos}},true);}var hoverSubs=cameraControl.hasSubs("hover");var hoverEnterSubs=cameraControl.hasSubs("hoverEnter");var hoverOutSubs=cameraControl.hasSubs("hoverOut");var hoverOffSubs=cameraControl.hasSubs("hoverOff");var hoverSurfaceSubs=cameraControl.hasSubs("hoverSurface");var hoverSnapOrSurfaceSubs=cameraControl.hasSubs("hoverSnapOrSurface");if(hoverSubs||hoverEnterSubs||hoverOutSubs||hoverOffSubs||hoverSurfaceSubs||hoverSnapOrSurfaceSubs){pickController.pickCursorPos=states.pointerCanvasPos;pickController.schedulePickEntity=true;pickController.schedulePickSurface=hoverSurfaceSubs;pickController.scheduleSnapOrPick=hoverSnapOrSurfaceSubs;pickController.update();if(pickController.pickResult){if(pickController.pickResult.entity){var pickedEntityId=pickController.pickResult.entity.id;if(_this103._lastPickedEntityId!==pickedEntityId){if(_this103._lastPickedEntityId!==undefined){cameraControl.fire("hoverOut",{// Hovered off an entity
18395
+ controllers.cameraFlight.flyTo({aabb:aabb});}};var tickifiedMouseMoveFn=scene.tickify(this._canvasMouseMoveHandler=function(e){if(!(configs.active&&configs.pointerEnabled)){return;}if(leftDown||rightDown){return;}if(cameraControl.hasSubs("rayMove")){var origin=math.vec3();var _direction2=math.vec3();math.canvasPosToWorldRay(scene.canvas.canvas,scene.camera.viewMatrix,scene.camera.projMatrix,scene.camera.projection,states.pointerCanvasPos,origin,_direction2);cameraControl.fire("rayMove",{canvasPos:states.pointerCanvasPos,ray:{origin:origin,direction:_direction2,canvasPos:states.pointerCanvasPos}},true);}var hoverSubs=cameraControl.hasSubs("hover");var hoverEnterSubs=cameraControl.hasSubs("hoverEnter");var hoverOutSubs=cameraControl.hasSubs("hoverOut");var hoverOffSubs=cameraControl.hasSubs("hoverOff");var hoverSurfaceSubs=cameraControl.hasSubs("hoverSurface");var hoverSnapOrSurfaceSubs=cameraControl.hasSubs("hoverSnapOrSurface");if(hoverSubs||hoverEnterSubs||hoverOutSubs||hoverOffSubs||hoverSurfaceSubs||hoverSnapOrSurfaceSubs){pickController.pickCursorPos=states.pointerCanvasPos;pickController.schedulePickEntity=true;pickController.schedulePickSurface=hoverSurfaceSubs;pickController.scheduleSnapOrPick=hoverSnapOrSurfaceSubs;pickController.update();if(pickController.pickResult){if(pickController.pickResult.entity){var pickedEntityId=pickController.pickResult.entity.id;if(_this103._lastPickedEntityId!==pickedEntityId){if(_this103._lastPickedEntityId!==undefined){cameraControl.fire("hoverOut",{// Hovered off an entity
18387
18396
  entity:scene.objects[_this103._lastPickedEntityId]},true);}cameraControl.fire("hoverEnter",pickController.pickResult,true);// Hovering over a new entity
18388
18397
  _this103._lastPickedEntityId=pickedEntityId;}}cameraControl.fire("hover",pickController.pickResult,true);if(pickController.pickResult.worldPos||pickController.pickResult.snappedWorldPos){// Hovering the surface of an entity
18389
18398
  cameraControl.fire("hoverSurface",pickController.pickResult,true);}}else{if(_this103._lastPickedEntityId!==undefined){cameraControl.fire("hoverOut",{// Hovered off an entity
@@ -18442,7 +18451,7 @@ if(configs.followPointer){var _dolliedThroughSurface2=panController.dollyToCanva
18442
18451
  */var MouseMiscHandler=/*#__PURE__*/function(){function MouseMiscHandler(scene,controllers,configs,states,updates){_classCallCheck(this,MouseMiscHandler);this._scene=scene;var canvas=this._scene.canvas.canvas;canvas.addEventListener("mouseenter",this._mouseEnterHandler=function(){states.mouseover=true;});canvas.addEventListener("mouseleave",this._mouseLeaveHandler=function(){states.mouseover=false;canvas.style.cursor=null;});document.addEventListener("mousemove",this._mouseMoveHandler=function(e){getCanvasPosFromEvent$2(e,canvas,states.pointerCanvasPos);states.mouseover=true;// Added to fix XCD-386: The zoom speed slows down when zooming into an empty space for the first time on a relatively large model, and it cannot be reset without reloading
18443
18452
  });canvas.addEventListener("mousedown",this._mouseDownHandler=function(e){if(!(configs.active&&configs.pointerEnabled)){return;}getCanvasPosFromEvent$2(e,canvas,states.pointerCanvasPos);states.mouseover=true;});canvas.addEventListener("mouseup",this._mouseUpHandler=function(e){if(!(configs.active&&configs.pointerEnabled)){return;}});}_createClass(MouseMiscHandler,[{key:"reset",value:function reset(){}},{key:"destroy",value:function destroy(){var canvas=this._scene.canvas.canvas;document.removeEventListener("mousemove",this._mouseMoveHandler);canvas.removeEventListener("mouseenter",this._mouseEnterHandler);canvas.removeEventListener("mouseleave",this._mouseLeaveHandler);canvas.removeEventListener("mousedown",this._mouseDownHandler);canvas.removeEventListener("mouseup",this._mouseUpHandler);}}]);return MouseMiscHandler;}();function getCanvasPosFromEvent$2(event,canvas,canvasPos){if(!event){event=window.event;canvasPos[0]=event.x;canvasPos[1]=event.y;}else{var _canvas$getBoundingCl=canvas.getBoundingClientRect(),left=_canvas$getBoundingCl.left,top=_canvas$getBoundingCl.top;canvasPos[0]=event.clientX-left;canvasPos[1]=event.clientY-top;}return canvasPos;}var getCanvasPosFromEvent$1=function getCanvasPosFromEvent$1(event,canvas,canvasPos){if(!event){event=window.event;canvasPos[0]=event.x;canvasPos[1]=event.y;}else{var canvasRect=canvas.getBoundingClientRect();canvasPos[0]=event.clientX-canvasRect.left;canvasPos[1]=event.clientY-canvasRect.top;}return canvasPos;};/**
18444
18453
  * @private
18445
- */var TouchPanRotateAndDollyHandler=/*#__PURE__*/function(){function TouchPanRotateAndDollyHandler(scene,controllers,configs,states,updates){_classCallCheck(this,TouchPanRotateAndDollyHandler);this._scene=scene;var pickController=controllers.pickController;var pivotController=controllers.pivotController;var tapStartCanvasPos=math.vec2();var tapCanvasPos0=math.vec2();var tapCanvasPos1=math.vec2();var touch0Vec=math.vec2();var lastCanvasTouchPosList=[];var canvas=this._scene.canvas.canvas;var numTouches=0;var waitForTick=false;this._onTick=scene.on("tick",function(){waitForTick=false;});canvas.addEventListener("touchstart",this._canvasTouchStartHandler=function(event){if(!(configs.active&&configs.pointerEnabled)){return;}event.preventDefault();var touches=event.touches;var changedTouches=event.changedTouches;states.touchStartTime=Date.now();if(touches.length===1&&changedTouches.length===1){getCanvasPosFromEvent$1(touches[0],canvas,tapStartCanvasPos);if(configs.followPointer){pickController.pickCursorPos=tapStartCanvasPos;pickController.schedulePickSurface=true;pickController.update();if(!configs.planView){if(pickController.picked&&pickController.pickedSurface&&pickController.pickResult&&pickController.pickResult.worldPos){pivotController.setPivotPos(pickController.pickResult.worldPos);if(!configs.firstPerson&&pivotController.startPivot()){pivotController.showPivot();}}else{if(configs.smartPivot){pivotController.setCanvasPivotPos(states.pointerCanvasPos);}else{pivotController.setPivotPos(scene.camera.look);}if(!configs.firstPerson&&pivotController.startPivot()){pivotController.showPivot();}}}}}while(lastCanvasTouchPosList.length<touches.length){lastCanvasTouchPosList.push(math.vec2());}for(var _i217=0,len=touches.length;_i217<len;++_i217){getCanvasPosFromEvent$1(touches[_i217],canvas,lastCanvasTouchPosList[_i217]);}numTouches=touches.length;});canvas.addEventListener("touchend",this._canvasTouchEndHandler=function(){if(pivotController.getPivoting()){pivotController.endPivot();pivotController.hidePivot();}});canvas.addEventListener("touchmove",this._canvasTouchMoveHandler=function(event){if(!(configs.active&&configs.pointerEnabled)){return;}event.stopPropagation();event.preventDefault();if(waitForTick){// Limit changes detection to one per frame
18454
+ */var TouchPanRotateAndDollyHandler=/*#__PURE__*/function(){function TouchPanRotateAndDollyHandler(scene,controllers,configs,states,updates){_classCallCheck(this,TouchPanRotateAndDollyHandler);this._scene=scene;var pickController=controllers.pickController;var pivotController=controllers.pivotController;var tapStartCanvasPos=math.vec2();var tapCanvasPos0=math.vec2();var tapCanvasPos1=math.vec2();var touch0Vec=math.vec2();var lastCanvasTouchPosList=[];var canvas=this._scene.canvas.canvas;var numTouches=0;var waitForTick=false;this._onTick=scene.on("tick",function(){waitForTick=false;});canvas.addEventListener("touchstart",this._canvasTouchStartHandler=function(event){if(!(configs.active&&configs.pointerEnabled)){return;}event.preventDefault();var touches=event.touches;var changedTouches=event.changedTouches;states.touchStartTime=Date.now();if(touches.length===1&&changedTouches.length===1){getCanvasPosFromEvent$1(touches[0],canvas,tapStartCanvasPos);if(configs.followPointer){pickController.pickCursorPos=tapStartCanvasPos;pickController.schedulePickSurface=true;pickController.update();if(!configs.planView){if(pickController.picked&&pickController.pickedSurface&&pickController.pickResult&&pickController.pickResult.worldPos){pivotController.setPivotPos(pickController.pickResult.worldPos);if(!configs.firstPerson&&pivotController.startPivot()){pivotController.showPivot();}}else{if(configs.smartPivot){pivotController.setCanvasPivotPos(states.pointerCanvasPos);}else{pivotController.setPivotPos(scene.camera.look);}if(!configs.firstPerson&&pivotController.startPivot()){pivotController.showPivot();}}}}}while(lastCanvasTouchPosList.length<touches.length){lastCanvasTouchPosList.push(math.vec2());}for(var _i219=0,len=touches.length;_i219<len;++_i219){getCanvasPosFromEvent$1(touches[_i219],canvas,lastCanvasTouchPosList[_i219]);}numTouches=touches.length;});canvas.addEventListener("touchend",this._canvasTouchEndHandler=function(){if(pivotController.getPivoting()){pivotController.endPivot();pivotController.hidePivot();}});canvas.addEventListener("touchmove",this._canvasTouchMoveHandler=function(event){if(!(configs.active&&configs.pointerEnabled)){return;}event.stopPropagation();event.preventDefault();if(waitForTick){// Limit changes detection to one per frame
18446
18455
  return;}waitForTick=true;// Scaling drag-rotate to canvas boundary
18447
18456
  var canvasBoundary=scene.canvas.boundary;var canvasWidth=canvasBoundary[2];var canvasHeight=canvasBoundary[3];var touches=event.touches;if(event.touches.length!==numTouches){// Two fingers were pressed, then one of them is removed
18448
18457
  // We don't want to rotate in this case (weird behavior)
@@ -18468,16 +18477,16 @@ updates.rotateDeltaX+=yPanDelta/canvasHeight*(configs.dragRotationRate*1.5);// H
18468
18477
  }}else if(numTouches===2){var touch0=touches[0];var touch1=touches[1];getCanvasPosFromEvent$1(touch0,canvas,tapCanvasPos0);getCanvasPosFromEvent$1(touch1,canvas,tapCanvasPos1);var lastMiddleTouch=math.geometricMeanVec2(lastCanvasTouchPosList[0],lastCanvasTouchPosList[1]);var currentMiddleTouch=math.geometricMeanVec2(tapCanvasPos0,tapCanvasPos1);var touchDelta=math.vec2();math.subVec2(lastMiddleTouch,currentMiddleTouch,touchDelta);var _xPanDelta=touchDelta[0];var _yPanDelta=touchDelta[1];var _camera2=scene.camera;// Dollying
18469
18478
  var d1=math.distVec2([touch0.pageX,touch0.pageY],[touch1.pageX,touch1.pageY]);var d2=math.distVec2(lastCanvasTouchPosList[0],lastCanvasTouchPosList[1]);var dollyDelta=(d2-d1)*configs.touchDollyRate;updates.dollyDelta=dollyDelta;states.followPointerDirty=true;// Added to fix XCD-386: The zoom speed slows down when zooming into an empty space for the first time on a relatively large model, and it cannot be reset without reloading
18470
18479
  if(Math.abs(dollyDelta)<1.0){// We use only canvasHeight here so that aspect ratio does not distort speed
18471
- if(_camera2.projection==="perspective"){var pickedWorldPos=pickController.pickResult?pickController.pickResult.worldPos:scene.center;var _depth=Math.abs(math.lenVec3(math.subVec3(pickedWorldPos,scene.camera.eye,[])));var _targetDistance=_depth*Math.tan(_camera2.perspective.fov/2*Math.PI/180.0);updates.panDeltaX-=_xPanDelta*_targetDistance/canvasHeight*configs.touchPanRate;updates.panDeltaY-=_yPanDelta*_targetDistance/canvasHeight*configs.touchPanRate;}else{updates.panDeltaX-=0.5*_camera2.ortho.scale*(_xPanDelta/canvasHeight)*configs.touchPanRate;updates.panDeltaY-=0.5*_camera2.ortho.scale*(_yPanDelta/canvasHeight)*configs.touchPanRate;}}states.pointerCanvasPos=currentMiddleTouch;}for(var _i218=0;_i218<numTouches;++_i218){getCanvasPosFromEvent$1(touches[_i218],canvas,lastCanvasTouchPosList[_i218]);}});}_createClass(TouchPanRotateAndDollyHandler,[{key:"reset",value:function reset(){}},{key:"destroy",value:function destroy(){var canvas=this._scene.canvas.canvas;canvas.removeEventListener("touchstart",this._canvasTouchStartHandler);canvas.removeEventListener("touchend",this._canvasTouchEndHandler);canvas.removeEventListener("touchmove",this._canvasTouchMoveHandler);this._scene.off(this._onTick);}}]);return TouchPanRotateAndDollyHandler;}();var TAP_INTERVAL=150;var DBL_TAP_INTERVAL=325;var TAP_DISTANCE_THRESHOLD=4;var getCanvasPosFromEvent=function getCanvasPosFromEvent(event,canvasPos){if(!event){event=window.event;canvasPos[0]=event.x;canvasPos[1]=event.y;}else{var element=event.target;var totalOffsetLeft=0;var totalOffsetTop=0;while(element.offsetParent){totalOffsetLeft+=element.offsetLeft;totalOffsetTop+=element.offsetTop;element=element.offsetParent;}canvasPos[0]=event.pageX-totalOffsetLeft;canvasPos[1]=event.pageY-totalOffsetTop;}return canvasPos;};/**
18480
+ if(_camera2.projection==="perspective"){var pickedWorldPos=pickController.pickResult?pickController.pickResult.worldPos:scene.center;var _depth=Math.abs(math.lenVec3(math.subVec3(pickedWorldPos,scene.camera.eye,[])));var _targetDistance=_depth*Math.tan(_camera2.perspective.fov/2*Math.PI/180.0);updates.panDeltaX-=_xPanDelta*_targetDistance/canvasHeight*configs.touchPanRate;updates.panDeltaY-=_yPanDelta*_targetDistance/canvasHeight*configs.touchPanRate;}else{updates.panDeltaX-=0.5*_camera2.ortho.scale*(_xPanDelta/canvasHeight)*configs.touchPanRate;updates.panDeltaY-=0.5*_camera2.ortho.scale*(_yPanDelta/canvasHeight)*configs.touchPanRate;}}states.pointerCanvasPos=currentMiddleTouch;}for(var _i220=0;_i220<numTouches;++_i220){getCanvasPosFromEvent$1(touches[_i220],canvas,lastCanvasTouchPosList[_i220]);}});}_createClass(TouchPanRotateAndDollyHandler,[{key:"reset",value:function reset(){}},{key:"destroy",value:function destroy(){var canvas=this._scene.canvas.canvas;canvas.removeEventListener("touchstart",this._canvasTouchStartHandler);canvas.removeEventListener("touchend",this._canvasTouchEndHandler);canvas.removeEventListener("touchmove",this._canvasTouchMoveHandler);this._scene.off(this._onTick);}}]);return TouchPanRotateAndDollyHandler;}();var TAP_INTERVAL=150;var DBL_TAP_INTERVAL=325;var TAP_DISTANCE_THRESHOLD=4;var getCanvasPosFromEvent=function getCanvasPosFromEvent(event,canvasPos){if(!event){event=window.event;canvasPos[0]=event.x;canvasPos[1]=event.y;}else{var element=event.target;var totalOffsetLeft=0;var totalOffsetTop=0;while(element.offsetParent){totalOffsetLeft+=element.offsetLeft;totalOffsetTop+=element.offsetTop;element=element.offsetParent;}canvasPos[0]=event.pageX-totalOffsetLeft;canvasPos[1]=event.pageY-totalOffsetTop;}return canvasPos;};/**
18472
18481
  * @private
18473
18482
  */var TouchPickHandler=/*#__PURE__*/function(){function TouchPickHandler(scene,controllers,configs,states,updates){_classCallCheck(this,TouchPickHandler);this._scene=scene;var pickController=controllers.pickController;var cameraControl=controllers.cameraControl;var touchStartTime;var activeTouches=[];var tapStartPos=new Float32Array(2);var tapStartTime=-1;var lastTapTime=-1;var canvas=this._scene.canvas.canvas;var flyCameraTo=function flyCameraTo(pickResult){var pos;if(pickResult&&pickResult.worldPos){pos=pickResult.worldPos;}var aabb=pickResult?pickResult.entity.aabb:scene.aabb;if(pos){// Fly to look at point, don't change eye->look dist
18474
18483
  var camera=scene.camera;math.subVec3(camera.eye,camera.look,[]);controllers.cameraFlight.flyTo({aabb:aabb});// TODO: Option to back off to fit AABB in view
18475
18484
  }else{// Fly to fit target boundary in view
18476
18485
  controllers.cameraFlight.flyTo({aabb:aabb});}};canvas.addEventListener("touchstart",this._canvasTouchStartHandler=function(e){if(!(configs.active&&configs.pointerEnabled)){return;}if(states.longTouchTimeout!==null){clearTimeout(states.longTouchTimeout);states.longTouchTimeout=null;}var touches=e.touches;var changedTouches=e.changedTouches;touchStartTime=Date.now();if(touches.length===1&&changedTouches.length===1){tapStartTime=touchStartTime;getCanvasPosFromEvent(touches[0],tapStartPos);var rightClickClientX=tapStartPos[0];var rightClickClientY=tapStartPos[1];var rightClickPageX=touches[0].pageX;var rightClickPageY=touches[0].pageY;states.longTouchTimeout=setTimeout(function(){if(configs.active&&configs.pointerEnabled){controllers.cameraControl.fire("rightClick",{// For context menus
18477
- pagePos:[Math.round(rightClickPageX),Math.round(rightClickPageY)],canvasPos:[Math.round(rightClickClientX),Math.round(rightClickClientY)],event:e},true);}states.longTouchTimeout=null;},configs.longTapTimeout);}else{tapStartTime=-1;}while(activeTouches.length<touches.length){activeTouches.push(new Float32Array(2));}for(var _i219=0,len=touches.length;_i219<len;++_i219){getCanvasPosFromEvent(touches[_i219],activeTouches[_i219]);}activeTouches.length=touches.length;},{passive:true});canvas.addEventListener("touchend",this._canvasTouchEndHandler=function(e){if(!(configs.active&&configs.pointerEnabled)){return;}var currentTime=Date.now();var touches=e.touches;var changedTouches=e.changedTouches;var pickedSurfaceSubs=cameraControl.hasSubs("pickedSurface");if(states.longTouchTimeout!==null){clearTimeout(states.longTouchTimeout);states.longTouchTimeout=null;}// process tap
18486
+ pagePos:[Math.round(rightClickPageX),Math.round(rightClickPageY)],canvasPos:[Math.round(rightClickClientX),Math.round(rightClickClientY)],event:e},true);}states.longTouchTimeout=null;},configs.longTapTimeout);}else{tapStartTime=-1;}while(activeTouches.length<touches.length){activeTouches.push(new Float32Array(2));}for(var _i221=0,len=touches.length;_i221<len;++_i221){getCanvasPosFromEvent(touches[_i221],activeTouches[_i221]);}activeTouches.length=touches.length;},{passive:true});canvas.addEventListener("touchend",this._canvasTouchEndHandler=function(e){if(!(configs.active&&configs.pointerEnabled)){return;}var currentTime=Date.now();var touches=e.touches;var changedTouches=e.changedTouches;var pickedSurfaceSubs=cameraControl.hasSubs("pickedSurface");if(states.longTouchTimeout!==null){clearTimeout(states.longTouchTimeout);states.longTouchTimeout=null;}// process tap
18478
18487
  if(touches.length===0&&changedTouches.length===1){if(tapStartTime>-1&&currentTime-tapStartTime<TAP_INTERVAL){if(lastTapTime>-1&&tapStartTime-lastTapTime<DBL_TAP_INTERVAL){// Double-tap
18479
18488
  getCanvasPosFromEvent(changedTouches[0],pickController.pickCursorPos);pickController.schedulePickEntity=true;pickController.schedulePickSurface=pickedSurfaceSubs;pickController.update();if(pickController.pickResult){pickController.pickResult.touchInput=true;cameraControl.fire("doublePicked",pickController.pickResult);if(pickController.pickedSurface){cameraControl.fire("doublePickedSurface",pickController.pickResult);}if(configs.doublePickFlyTo){flyCameraTo(pickController.pickResult);}}else{cameraControl.fire("doublePickedNothing");if(configs.doublePickFlyTo){flyCameraTo();}}lastTapTime=-1;}else if(math.distVec2(activeTouches[0],tapStartPos)<TAP_DISTANCE_THRESHOLD){// Single-tap
18480
- getCanvasPosFromEvent(changedTouches[0],pickController.pickCursorPos);pickController.schedulePickEntity=true;pickController.schedulePickSurface=pickedSurfaceSubs;pickController.update();if(pickController.pickResult){pickController.pickResult.touchInput=true;cameraControl.fire("picked",pickController.pickResult);if(pickController.pickedSurface){cameraControl.fire("pickedSurface",pickController.pickResult);}}else{cameraControl.fire("pickedNothing");}lastTapTime=currentTime;}tapStartTime=-1;}}activeTouches.length=touches.length;for(var _i220=0,len=touches.length;_i220<len;++_i220){activeTouches[_i220][0]=touches[_i220].pageX;activeTouches[_i220][1]=touches[_i220].pageY;}// e.stopPropagation();
18489
+ getCanvasPosFromEvent(changedTouches[0],pickController.pickCursorPos);pickController.schedulePickEntity=true;pickController.schedulePickSurface=pickedSurfaceSubs;pickController.update();if(pickController.pickResult){pickController.pickResult.touchInput=true;cameraControl.fire("picked",pickController.pickResult);if(pickController.pickedSurface){cameraControl.fire("pickedSurface",pickController.pickResult);}}else{cameraControl.fire("pickedNothing");}lastTapTime=currentTime;}tapStartTime=-1;}}activeTouches.length=touches.length;for(var _i222=0,len=touches.length;_i222<len;++_i222){activeTouches[_i222][0]=touches[_i222].pageX;activeTouches[_i222][1]=touches[_i222].pageY;}// e.stopPropagation();
18481
18490
  },{passive:true});}_createClass(TouchPickHandler,[{key:"reset",value:function reset(){// TODO
18482
18491
  // tapStartTime = -1;
18483
18492
  // lastTapTime = -1;
@@ -19124,12 +19133,12 @@ _this104.navMode=cfg.navMode;if(cfg.planView){_this104.planView=cfg.planView;}_t
19124
19133
  *
19125
19134
  * @returns {{Number:(Number | Number[])[]}} Current key mappings.
19126
19135
  */function get(){return this._keyMap;},set:function set(value){value=value||"qwerty";if(utils.isString(value)){var input=this.scene.input;var keyMap={};switch(value){default:this.error("Unsupported value for 'keyMap': "+value+" defaulting to 'qwerty'");// Intentional fall-through to "qwerty"
19127
- case"qwerty":keyMap[this.PAN_LEFT]=[input.KEY_A];keyMap[this.PAN_RIGHT]=[input.KEY_D];keyMap[this.PAN_UP]=[input.KEY_Z];keyMap[this.PAN_DOWN]=[input.KEY_X];keyMap[this.PAN_BACKWARDS]=[];keyMap[this.PAN_FORWARDS]=[];keyMap[this.DOLLY_FORWARDS]=[input.KEY_W,input.KEY_ADD];keyMap[this.DOLLY_BACKWARDS]=[input.KEY_S,input.KEY_SUBTRACT];keyMap[this.ROTATE_X_POS]=[input.KEY_DOWN_ARROW];keyMap[this.ROTATE_X_NEG]=[input.KEY_UP_ARROW];keyMap[this.ROTATE_Y_POS]=[input.KEY_Q,input.KEY_LEFT_ARROW];keyMap[this.ROTATE_Y_NEG]=[input.KEY_E,input.KEY_RIGHT_ARROW];keyMap[this.AXIS_VIEW_RIGHT]=[input.KEY_NUM_1];keyMap[this.AXIS_VIEW_BACK]=[input.KEY_NUM_2];keyMap[this.AXIS_VIEW_LEFT]=[input.KEY_NUM_3];keyMap[this.AXIS_VIEW_FRONT]=[input.KEY_NUM_4];keyMap[this.AXIS_VIEW_TOP]=[input.KEY_NUM_5];keyMap[this.AXIS_VIEW_BOTTOM]=[input.KEY_NUM_6];keyMap[this.MOUSE_PAN]=[[input.MOUSE_LEFT_BUTTON,input.KEY_SHIFT],this._configs.panRightClick?input.MOUSE_RIGHT_BUTTON:input.MOUSE_MIDDLE_BUTTON];keyMap[this.MOUSE_ROTATE]=[input.MOUSE_LEFT_BUTTON];keyMap[this.MOUSE_DOLLY]=[];break;case"azerty":keyMap[this.PAN_LEFT]=[input.KEY_Q];keyMap[this.PAN_RIGHT]=[input.KEY_D];keyMap[this.PAN_UP]=[input.KEY_W];keyMap[this.PAN_DOWN]=[input.KEY_X];keyMap[this.PAN_BACKWARDS]=[];keyMap[this.PAN_FORWARDS]=[];keyMap[this.DOLLY_FORWARDS]=[input.KEY_Z,input.KEY_ADD];keyMap[this.DOLLY_BACKWARDS]=[input.KEY_S,input.KEY_SUBTRACT];keyMap[this.ROTATE_X_POS]=[input.KEY_DOWN_ARROW];keyMap[this.ROTATE_X_NEG]=[input.KEY_UP_ARROW];keyMap[this.ROTATE_Y_POS]=[input.KEY_A,input.KEY_LEFT_ARROW];keyMap[this.ROTATE_Y_NEG]=[input.KEY_E,input.KEY_RIGHT_ARROW];keyMap[this.AXIS_VIEW_RIGHT]=[input.KEY_NUM_1];keyMap[this.AXIS_VIEW_BACK]=[input.KEY_NUM_2];keyMap[this.AXIS_VIEW_LEFT]=[input.KEY_NUM_3];keyMap[this.AXIS_VIEW_FRONT]=[input.KEY_NUM_4];keyMap[this.AXIS_VIEW_TOP]=[input.KEY_NUM_5];keyMap[this.AXIS_VIEW_BOTTOM]=[input.KEY_NUM_6];keyMap[this.MOUSE_PAN]=[[input.MOUSE_LEFT_BUTTON,input.KEY_SHIFT],this._configs.panRightClick?input.MOUSE_RIGHT_BUTTON:input.MOUSE_MIDDLE_BUTTON];keyMap[this.MOUSE_ROTATE]=[input.MOUSE_LEFT_BUTTON];keyMap[this.MOUSE_DOLLY]=[];break;}this._keyMap=keyMap;}else{var _keyMap=value;this._keyMap=_keyMap;}}},{key:"_areAllKeysDown",value:function _areAllKeysDown(keyDownMap,keys){if(!keys||keys.length<=0){return true;}if(!keyDownMap){return false;}for(var _i221=0,len=keys.length;_i221<len;_i221++){var key=keys[_i221];if(!keyDownMap[key])return false;}return true;}},{key:"_isAnyOtherKeyDown",value:function _isAnyOtherKeyDown(keyDownMap,keyMap){for(var _i222=0,len=keyDownMap.length;_i222<len;_i222++){if(keyDownMap[_i222]){if(Array.isArray(keyMap)){if(keyMap.indexOf(_i222)<0)return true;}else if(_i222!==keyMap)return true;}}return false;}},{key:"_isMouseAction",value:function _isMouseAction(action){switch(action){case this.MOUSE_ROTATE:case this.MOUSE_DOLLY:case this.MOUSE_PAN:return true;default:return false;}}/**
19136
+ case"qwerty":keyMap[this.PAN_LEFT]=[input.KEY_A];keyMap[this.PAN_RIGHT]=[input.KEY_D];keyMap[this.PAN_UP]=[input.KEY_Z];keyMap[this.PAN_DOWN]=[input.KEY_X];keyMap[this.PAN_BACKWARDS]=[];keyMap[this.PAN_FORWARDS]=[];keyMap[this.DOLLY_FORWARDS]=[input.KEY_W,input.KEY_ADD];keyMap[this.DOLLY_BACKWARDS]=[input.KEY_S,input.KEY_SUBTRACT];keyMap[this.ROTATE_X_POS]=[input.KEY_DOWN_ARROW];keyMap[this.ROTATE_X_NEG]=[input.KEY_UP_ARROW];keyMap[this.ROTATE_Y_POS]=[input.KEY_Q,input.KEY_LEFT_ARROW];keyMap[this.ROTATE_Y_NEG]=[input.KEY_E,input.KEY_RIGHT_ARROW];keyMap[this.AXIS_VIEW_RIGHT]=[input.KEY_NUM_1];keyMap[this.AXIS_VIEW_BACK]=[input.KEY_NUM_2];keyMap[this.AXIS_VIEW_LEFT]=[input.KEY_NUM_3];keyMap[this.AXIS_VIEW_FRONT]=[input.KEY_NUM_4];keyMap[this.AXIS_VIEW_TOP]=[input.KEY_NUM_5];keyMap[this.AXIS_VIEW_BOTTOM]=[input.KEY_NUM_6];keyMap[this.MOUSE_PAN]=[[input.MOUSE_LEFT_BUTTON,input.KEY_SHIFT],this._configs.panRightClick?input.MOUSE_RIGHT_BUTTON:input.MOUSE_MIDDLE_BUTTON];keyMap[this.MOUSE_ROTATE]=[input.MOUSE_LEFT_BUTTON];keyMap[this.MOUSE_DOLLY]=[];break;case"azerty":keyMap[this.PAN_LEFT]=[input.KEY_Q];keyMap[this.PAN_RIGHT]=[input.KEY_D];keyMap[this.PAN_UP]=[input.KEY_W];keyMap[this.PAN_DOWN]=[input.KEY_X];keyMap[this.PAN_BACKWARDS]=[];keyMap[this.PAN_FORWARDS]=[];keyMap[this.DOLLY_FORWARDS]=[input.KEY_Z,input.KEY_ADD];keyMap[this.DOLLY_BACKWARDS]=[input.KEY_S,input.KEY_SUBTRACT];keyMap[this.ROTATE_X_POS]=[input.KEY_DOWN_ARROW];keyMap[this.ROTATE_X_NEG]=[input.KEY_UP_ARROW];keyMap[this.ROTATE_Y_POS]=[input.KEY_A,input.KEY_LEFT_ARROW];keyMap[this.ROTATE_Y_NEG]=[input.KEY_E,input.KEY_RIGHT_ARROW];keyMap[this.AXIS_VIEW_RIGHT]=[input.KEY_NUM_1];keyMap[this.AXIS_VIEW_BACK]=[input.KEY_NUM_2];keyMap[this.AXIS_VIEW_LEFT]=[input.KEY_NUM_3];keyMap[this.AXIS_VIEW_FRONT]=[input.KEY_NUM_4];keyMap[this.AXIS_VIEW_TOP]=[input.KEY_NUM_5];keyMap[this.AXIS_VIEW_BOTTOM]=[input.KEY_NUM_6];keyMap[this.MOUSE_PAN]=[[input.MOUSE_LEFT_BUTTON,input.KEY_SHIFT],this._configs.panRightClick?input.MOUSE_RIGHT_BUTTON:input.MOUSE_MIDDLE_BUTTON];keyMap[this.MOUSE_ROTATE]=[input.MOUSE_LEFT_BUTTON];keyMap[this.MOUSE_DOLLY]=[];break;}this._keyMap=keyMap;}else{var _keyMap=value;this._keyMap=_keyMap;}}},{key:"_areAllKeysDown",value:function _areAllKeysDown(keyDownMap,keys){if(!keys||keys.length<=0){return true;}if(!keyDownMap){return false;}for(var _i223=0,len=keys.length;_i223<len;_i223++){var key=keys[_i223];if(!keyDownMap[key])return false;}return true;}},{key:"_isAnyOtherKeyDown",value:function _isAnyOtherKeyDown(keyDownMap,keyMap){for(var _i224=0,len=keyDownMap.length;_i224<len;_i224++){if(keyDownMap[_i224]){if(Array.isArray(keyMap)){if(keyMap.indexOf(_i224)<0)return true;}else if(_i224!==keyMap)return true;}}return false;}},{key:"_isMouseAction",value:function _isMouseAction(action){switch(action){case this.MOUSE_ROTATE:case this.MOUSE_DOLLY:case this.MOUSE_PAN:return true;default:return false;}}/**
19128
19137
  * Returns true if any keys configured for the given action are down.
19129
19138
  * @param action
19130
19139
  * @param keyDownMap
19131
19140
  * @private
19132
- */},{key:"_isKeyDownForAction",value:function _isKeyDownForAction(action,keyDownMap){var keys=this._keyMap[action];if(!keys){return false;}if(keys.length===0&&this._isMouseAction(action))return true;if(!keyDownMap){keyDownMap=this.scene.input.keyDown;}for(var _i223=0,len=keys.length;_i223<len;_i223++){var key=keys[_i223];if(!Array.isArray(key)){if(keyDownMap[key]&&!this._isAnyOtherKeyDown(keyDownMap,key))return true;}else{if(this._areAllKeysDown(keyDownMap,key)&&!this._isAnyOtherKeyDown(keyDownMap,key))return true;}}return false;}/**
19141
+ */},{key:"_isKeyDownForAction",value:function _isKeyDownForAction(action,keyDownMap){var keys=this._keyMap[action];if(!keys){return false;}if(keys.length===0&&this._isMouseAction(action))return true;if(!keyDownMap){keyDownMap=this.scene.input.keyDown;}for(var _i225=0,len=keys.length;_i225<len;_i225++){var key=keys[_i225];if(!Array.isArray(key)){if(keyDownMap[key]&&!this._isAnyOtherKeyDown(keyDownMap,key))return true;}else{if(this._areAllKeysDown(keyDownMap,key)&&!this._isAnyOtherKeyDown(keyDownMap,key))return true;}}return false;}/**
19133
19142
  * Sets the HTMl element to represent the pivot point when {@link CameraControl#followPointer} is true.
19134
19143
  *
19135
19144
  * See class comments for an example.
@@ -19251,7 +19260,7 @@ case"qwerty":keyMap[this.PAN_LEFT]=[input.KEY_A];keyMap[this.PAN_RIGHT]=[input.K
19251
19260
  *
19252
19261
  * @param {String} action To get the style for
19253
19262
  * @returns {String} style set on the cursor for action
19254
- */},{key:"getCursorStyle",value:function getCursorStyle(action){return this._cursors[action]||null;}},{key:"_reset",value:function _reset(){for(var _i224=0,len=this._handlers.length;_i224<len;_i224++){var handler=this._handlers[_i224];if(handler.reset){handler.reset();}}this._updates.panDeltaX=0;this._updates.panDeltaY=0;this._updates.rotateDeltaX=0;this._updates.rotateDeltaY=0;this._updates.dolyDelta=0;}},{key:"followPointer",get:/**
19263
+ */},{key:"getCursorStyle",value:function getCursorStyle(action){return this._cursors[action]||null;}},{key:"_reset",value:function _reset(){for(var _i226=0,len=this._handlers.length;_i226<len;_i226++){var handler=this._handlers[_i226];if(handler.reset){handler.reset();}}this._updates.panDeltaX=0;this._updates.panDeltaY=0;this._updates.rotateDeltaX=0;this._updates.rotateDeltaY=0;this._updates.dolyDelta=0;}},{key:"followPointer",get:/**
19255
19264
  * Sets whether the {@link Camera} follows the mouse/touch pointer.
19256
19265
  *
19257
19266
  * In orbiting mode, the Camera will orbit about the pointer, and will dolly to and from the pointer.
@@ -19392,7 +19401,7 @@ case"qwerty":keyMap[this.PAN_LEFT]=[input.KEY_A];keyMap[this.PAN_RIGHT]=[input.K
19392
19401
  * Does not apply when {@link CameraControl#navMode} is ````"planView"````, which disallows rotation.
19393
19402
  *
19394
19403
  * @param {Number} rotationInertia New inertial factor.
19395
- */,set:function set(value){this._configs.panRightClick=value!==false;var panKeyMap=this._keyMap[this.MOUSE_PAN];if(panKeyMap&&panKeyMap.length>0){var input=this.scene.input;for(var _i225=0,len=panKeyMap.length;_i225<len;_i225++){if(this._configs.panRightClick&&panKeyMap[_i225]===input.MOUSE_MIDDLE_BUTTON)this._keyMap[this.MOUSE_PAN][_i225]=input.MOUSE_RIGHT_BUTTON;else if(!this._configs.panRightClick&&panKeyMap[_i225]===input.MOUSE_RIGHT_BUTTON)this._keyMap[this.MOUSE_PAN][_i225]=input.MOUSE_MIDDLE_BUTTON;}}}},{key:"rotationInertia",get:/**
19404
+ */,set:function set(value){this._configs.panRightClick=value!==false;var panKeyMap=this._keyMap[this.MOUSE_PAN];if(panKeyMap&&panKeyMap.length>0){var input=this.scene.input;for(var _i227=0,len=panKeyMap.length;_i227<len;_i227++){if(this._configs.panRightClick&&panKeyMap[_i227]===input.MOUSE_MIDDLE_BUTTON)this._keyMap[this.MOUSE_PAN][_i227]=input.MOUSE_RIGHT_BUTTON;else if(!this._configs.panRightClick&&panKeyMap[_i227]===input.MOUSE_RIGHT_BUTTON)this._keyMap[this.MOUSE_PAN][_i227]=input.MOUSE_MIDDLE_BUTTON;}}}},{key:"rotationInertia",get:/**
19396
19405
  * Gets the rotation inertia factor.
19397
19406
  *
19398
19407
  * Default is ````0.0````.
@@ -19650,7 +19659,7 @@ value=value||"qwerty";if(value!=="qwerty"&&value!=="azerty"){this.error("Unsuppo
19650
19659
  */function get(){return this._configs.zoomOnMouseWheel;}/**
19651
19660
  * Destroys this ````CameraControl````.
19652
19661
  * @private
19653
- */,set:function set(enabled){this._configs.zoomOnMouseWheel=!!enabled;}},{key:"destroy",value:function destroy(){this._destroyHandlers();this._destroyControllers();this._cameraUpdater.destroy();_get(_getPrototypeOf(CameraControl.prototype),"destroy",this).call(this);}},{key:"_destroyHandlers",value:function _destroyHandlers(){for(var _i226=0,len=this._handlers.length;_i226<len;_i226++){var handler=this._handlers[_i226];if(handler.destroy){handler.destroy();}}}},{key:"_destroyControllers",value:function _destroyControllers(){for(var _i227=0,len=this._controllers.length;_i227<len;_i227++){var controller=this._controllers[_i227];if(controller.destroy){controller.destroy();}}}}]);return CameraControl;}(Component);/**
19662
+ */,set:function set(enabled){this._configs.zoomOnMouseWheel=!!enabled;}},{key:"destroy",value:function destroy(){this._destroyHandlers();this._destroyControllers();this._cameraUpdater.destroy();_get(_getPrototypeOf(CameraControl.prototype),"destroy",this).call(this);}},{key:"_destroyHandlers",value:function _destroyHandlers(){for(var _i228=0,len=this._handlers.length;_i228<len;_i228++){var handler=this._handlers[_i228];if(handler.destroy){handler.destroy();}}}},{key:"_destroyControllers",value:function _destroyControllers(){for(var _i229=0,len=this._controllers.length;_i229<len;_i229++){var controller=this._controllers[_i229];if(controller.destroy){controller.destroy();}}}}]);return CameraControl;}(Component);/**
19654
19663
  * @desc A property within a {@link PropertySet}.
19655
19664
  *
19656
19665
  * @class Property
@@ -19721,7 +19730,7 @@ value=value||"qwerty";if(value!=="qwerty"&&value!=="azerty"){this.error("Unsuppo
19721
19730
  *
19722
19731
  * @property properties
19723
19732
  * @type {Property[]}
19724
- */this.properties=[];if(params.properties){var properties=params.properties;for(var _i228=0,len=properties.length;_i228<len;_i228++){var property=properties[_i228];if(Number.isInteger(property)){// Will decompress in MetaModel.finalize();
19733
+ */this.properties=[];if(params.properties){var properties=params.properties;for(var _i230=0,len=properties.length;_i230<len;_i230++){var property=properties[_i230];if(Number.isInteger(property)){// Will decompress in MetaModel.finalize();
19725
19734
  this.properties.push(property);}else{this.properties.push(new Property(property.name,property.value,property.type,property.valueType,property.description));}}}});/**
19726
19735
  * @desc Metadata corresponding to an {@link Entity} that represents an object.
19727
19736
  *
@@ -19913,20 +19922,20 @@ this.properties.push(property);}else{this.properties.push(new Property(property.
19913
19922
  */_createClass(MetaModel,[{key:"rootMetaObject",get:function get(){if(this.rootMetaObjects.length===1){return this.rootMetaObjects[0];}return null;}/**
19914
19923
  * Load metamodel data into this MetaModel.
19915
19924
  * @param metaModelData
19916
- */},{key:"loadData",value:function loadData(metaModelData){var options=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};if(this.finalized){throw"MetaScene already finalized - can't add more data";}this._globalizeIDs(metaModelData,options);var metaScene=this.metaScene;var propertyLookup=metaModelData.properties;if(propertyLookup){for(var _i229=0,len=propertyLookup.length;_i229<len;_i229++){this._propertyLookup.push(propertyLookup[_i229]);}}// Create global Property Sets
19917
- if(metaModelData.propertySets){for(var _i230=0,_len26=metaModelData.propertySets.length;_i230<_len26;_i230++){var propertySetData=metaModelData.propertySets[_i230];if(!propertySetData.properties){// HACK: https://github.com/Creoox/creoox-ifc2gltfcxconverter/issues/8
19918
- propertySetData.properties=[];}var propertySet=metaScene.propertySets[propertySetData.id];if(!propertySet){propertySet=new PropertySet({id:propertySetData.id,originalSystemId:propertySetData.originalSystemId||propertySetData.id,type:propertySetData.type,name:propertySetData.name,properties:propertySetData.properties});metaScene.propertySets[propertySet.id]=propertySet;}propertySet.metaModels.push(this);this.propertySets.push(propertySet);}}if(metaModelData.metaObjects){for(var _i231=0,_len27=metaModelData.metaObjects.length;_i231<_len27;_i231++){var metaObjectData=metaModelData.metaObjects[_i231];var id=metaObjectData.id;var metaObject=metaScene.metaObjects[id];if(!metaObject){var type=metaObjectData.type;var originalSystemId=metaObjectData.originalSystemId;var propertySetIds=metaObjectData.propertySets||metaObjectData.propertySetIds;metaObject=new MetaObject({id:id,originalSystemId:originalSystemId,parentId:metaObjectData.parent,type:type,name:metaObjectData.name,attributes:metaObjectData.attributes,propertySetIds:propertySetIds,external:metaObjectData.external});this.metaScene.metaObjects[id]=metaObject;metaObject.metaModels=[];}this.metaObjects[id]=metaObject;if(!metaObjectData.parent){this.rootMetaObjects.push(metaObject);metaScene.rootMetaObjects[id]=metaObject;}metaObject.metaModels.push(this);}}}},{key:"_decompressProperties",value:function _decompressProperties(propertyLookup,properties){var propsNotFound=[];for(var _i232=0,len=properties.length;_i232<len;_i232++){var property=properties[_i232];if(Number.isInteger(property)){var lookupProperty=propertyLookup[property];if(lookupProperty){properties[_i232]=lookupProperty;}else{propsNotFound.push(property);}}}if(propsNotFound.length>0){console.error("[MetaModel._decompressProperties] Properties not found: ".concat(propsNotFound));}}},{key:"finalize",value:function finalize(){if(this.finalized){throw"MetaScene already finalized - can't re-finalize";}// Re-link MetaScene's entire MetaObject parent/child hierarchy
19925
+ */},{key:"loadData",value:function loadData(metaModelData){var options=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};if(this.finalized){throw"MetaScene already finalized - can't add more data";}this._globalizeIDs(metaModelData,options);var metaScene=this.metaScene;var propertyLookup=metaModelData.properties;if(propertyLookup){for(var _i231=0,len=propertyLookup.length;_i231<len;_i231++){this._propertyLookup.push(propertyLookup[_i231]);}}// Create global Property Sets
19926
+ if(metaModelData.propertySets){for(var _i232=0,_len26=metaModelData.propertySets.length;_i232<_len26;_i232++){var propertySetData=metaModelData.propertySets[_i232];if(!propertySetData.properties){// HACK: https://github.com/Creoox/creoox-ifc2gltfcxconverter/issues/8
19927
+ propertySetData.properties=[];}var propertySet=metaScene.propertySets[propertySetData.id];if(!propertySet){propertySet=new PropertySet({id:propertySetData.id,originalSystemId:propertySetData.originalSystemId||propertySetData.id,type:propertySetData.type,name:propertySetData.name,properties:propertySetData.properties});metaScene.propertySets[propertySet.id]=propertySet;}propertySet.metaModels.push(this);this.propertySets.push(propertySet);}}if(metaModelData.metaObjects){for(var _i233=0,_len27=metaModelData.metaObjects.length;_i233<_len27;_i233++){var metaObjectData=metaModelData.metaObjects[_i233];var id=metaObjectData.id;var metaObject=metaScene.metaObjects[id];if(!metaObject){var type=metaObjectData.type;var originalSystemId=metaObjectData.originalSystemId;var propertySetIds=metaObjectData.propertySets||metaObjectData.propertySetIds;metaObject=new MetaObject({id:id,originalSystemId:originalSystemId,parentId:metaObjectData.parent,type:type,name:metaObjectData.name,attributes:metaObjectData.attributes,propertySetIds:propertySetIds,external:metaObjectData.external});this.metaScene.metaObjects[id]=metaObject;metaObject.metaModels=[];}this.metaObjects[id]=metaObject;if(!metaObjectData.parent){this.rootMetaObjects.push(metaObject);metaScene.rootMetaObjects[id]=metaObject;}metaObject.metaModels.push(this);}}}},{key:"_decompressProperties",value:function _decompressProperties(propertyLookup,properties){var propsNotFound=[];for(var _i234=0,len=properties.length;_i234<len;_i234++){var property=properties[_i234];if(Number.isInteger(property)){var lookupProperty=propertyLookup[property];if(lookupProperty){properties[_i234]=lookupProperty;}else{propsNotFound.push(property);}}}if(propsNotFound.length>0){console.error("[MetaModel._decompressProperties] Properties not found: ".concat(propsNotFound));}}},{key:"finalize",value:function finalize(){if(this.finalized){throw"MetaScene already finalized - can't re-finalize";}// Re-link MetaScene's entire MetaObject parent/child hierarchy
19919
19928
  var metaScene=this.metaScene;for(var objectId in metaScene.metaObjects){var metaObject=metaScene.metaObjects[objectId];if(metaObject.children){metaObject.children=[];}// Re-link each MetaObject's property sets
19920
- if(metaObject.propertySets){metaObject.propertySets=[];}if(metaObject.propertySetIds){for(var _i233=0,len=metaObject.propertySetIds.length;_i233<len;_i233++){var propertySetId=metaObject.propertySetIds[_i233];var propertySet=metaScene.propertySets[propertySetId];metaObject.propertySets.push(propertySet);}}}for(var _objectId in metaScene.metaObjects){var _metaObject=metaScene.metaObjects[_objectId];if(_metaObject.parentId){var parentMetaObject=metaScene.metaObjects[_metaObject.parentId];if(parentMetaObject){_metaObject.parent=parentMetaObject;(parentMetaObject.children||(parentMetaObject.children=[])).push(_metaObject);}}}// Relink MetaObjects to their MetaModels
19929
+ if(metaObject.propertySets){metaObject.propertySets=[];}if(metaObject.propertySetIds){for(var _i235=0,len=metaObject.propertySetIds.length;_i235<len;_i235++){var propertySetId=metaObject.propertySetIds[_i235];var propertySet=metaScene.propertySets[propertySetId];metaObject.propertySets.push(propertySet);}}}for(var _objectId in metaScene.metaObjects){var _metaObject=metaScene.metaObjects[_objectId];if(_metaObject.parentId){var parentMetaObject=metaScene.metaObjects[_metaObject.parentId];if(parentMetaObject){_metaObject.parent=parentMetaObject;(parentMetaObject.children||(parentMetaObject.children=[])).push(_metaObject);}}}// Relink MetaObjects to their MetaModels
19921
19930
  for(var _objectId2 in metaScene.metaObjects){var _metaObject2=metaScene.metaObjects[_objectId2];_metaObject2.metaModels=[];}for(var modelId in metaScene.metaModels){var metaModel=metaScene.metaModels[modelId];for(var _objectId3 in metaModel.metaObjects){var _metaObject3=metaModel.metaObjects[_objectId3];_metaObject3.metaModels.push(metaModel);}}// Rebuild MetaScene's MetaObjects-by-type lookup
19922
19931
  metaScene.metaObjectsByType={};for(var _objectId4 in metaScene.metaObjects){var _metaObject4=metaScene.metaObjects[_objectId4];var type=_metaObject4.type;(metaScene.metaObjectsByType[type]||(metaScene.metaObjectsByType[type]={}))[_objectId4]=_metaObject4;}// Decompress properties
19923
- if(this.propertySets){for(var _i234=0,_len28=this.propertySets.length;_i234<_len28;_i234++){var _propertySet=this.propertySets[_i234];this._decompressProperties(this._propertyLookup,_propertySet.properties);}}this._propertyLookup=[];this.finalized=true;this.metaScene.fire("metaModelCreated",this.id);}/**
19932
+ if(this.propertySets){for(var _i236=0,_len28=this.propertySets.length;_i236<_len28;_i236++){var _propertySet=this.propertySets[_i236];this._decompressProperties(this._propertyLookup,_propertySet.properties);}}this._propertyLookup=[];this.finalized=true;this.metaScene.fire("metaModelCreated",this.id);}/**
19924
19933
  * Gets this MetaModel as JSON.
19925
19934
  * @returns {{schema: (String|string|*), createdAt: (String|string|*), metaObjects: *[], author: (String|string|*), id: (String|Number|string|number|*), creatingApplication: (String|string|*), projectId: (String|Number|string|number|*), propertySets: *[]}}
19926
- */},{key:"getJSON",value:function getJSON(){var json={id:this.id,projectId:this.projectId,author:this.author,createdAt:this.createdAt,schema:this.schema,creatingApplication:this.creatingApplication,metaObjects:[],propertySets:[]};var metaObjectsList=Object.values(this.metaObjects);for(var _i235=0,len=metaObjectsList.length;_i235<len;_i235++){var metaObject=metaObjectsList[_i235];var metaObjectCfg={id:metaObject.id,originalSystemId:metaObject.originalSystemId,extId:metaObject.extId,type:metaObject.type,name:metaObject.name};if(metaObject.parent){metaObjectCfg.parent=metaObject.parent.id;}if(metaObject.attributes){metaObjectCfg.attributes=metaObject.attributes;}if(metaObject.propertySetIds){metaObjectCfg.propertySetIds=metaObject.propertySetIds;}json.metaObjects.push(metaObjectCfg);}for(var _i236=0,_len29=this.propertySets.length;_i236<_len29;_i236++){var propertySet=this.propertySets[_i236];var propertySetCfg={id:propertySet.id,originalSystemId:propertySet.originalSystemId,extId:propertySet.extId,type:propertySet.type,name:propertySet.name,propertyies:[]};for(var j=0,lenj=propertySet.properties.length;j<lenj;j++){var property=propertySet.properties[j];var propertyCfg={id:property.id,description:property.description,type:property.type,name:property.name,value:property.value,valueType:property.valueType};propertySetCfg.properties.push(propertyCfg);}json.propertySets.push(propertySetCfg);}return json;}},{key:"_globalizeIDs",value:function _globalizeIDs(metaModelData,options){var globalize=!!options.globalizeObjectIds;if(metaModelData.metaObjects){for(var _i237=0,len=metaModelData.metaObjects.length;_i237<len;_i237++){var metaObjectData=metaModelData.metaObjects[_i237];// Globalize MetaObject IDs and parent IDs
19935
+ */},{key:"getJSON",value:function getJSON(){var json={id:this.id,projectId:this.projectId,author:this.author,createdAt:this.createdAt,schema:this.schema,creatingApplication:this.creatingApplication,metaObjects:[],propertySets:[]};var metaObjectsList=Object.values(this.metaObjects);for(var _i237=0,len=metaObjectsList.length;_i237<len;_i237++){var metaObject=metaObjectsList[_i237];var metaObjectCfg={id:metaObject.id,originalSystemId:metaObject.originalSystemId,extId:metaObject.extId,type:metaObject.type,name:metaObject.name};if(metaObject.parent){metaObjectCfg.parent=metaObject.parent.id;}if(metaObject.attributes){metaObjectCfg.attributes=metaObject.attributes;}if(metaObject.propertySetIds){metaObjectCfg.propertySetIds=metaObject.propertySetIds;}json.metaObjects.push(metaObjectCfg);}for(var _i238=0,_len29=this.propertySets.length;_i238<_len29;_i238++){var propertySet=this.propertySets[_i238];var propertySetCfg={id:propertySet.id,originalSystemId:propertySet.originalSystemId,extId:propertySet.extId,type:propertySet.type,name:propertySet.name,propertyies:[]};for(var j=0,lenj=propertySet.properties.length;j<lenj;j++){var property=propertySet.properties[j];var propertyCfg={id:property.id,description:property.description,type:property.type,name:property.name,value:property.value,valueType:property.valueType};propertySetCfg.properties.push(propertyCfg);}json.propertySets.push(propertySetCfg);}return json;}},{key:"_globalizeIDs",value:function _globalizeIDs(metaModelData,options){var globalize=!!options.globalizeObjectIds;if(metaModelData.metaObjects){for(var _i239=0,len=metaModelData.metaObjects.length;_i239<len;_i239++){var metaObjectData=metaModelData.metaObjects[_i239];// Globalize MetaObject IDs and parent IDs
19927
19936
  metaObjectData.originalSystemId=metaObjectData.id;if(metaObjectData.parent){metaObjectData.originalParentSystemId=metaObjectData.parent;}if(globalize){metaObjectData.id=math.globalizeObjectId(this.id,metaObjectData.id);if(metaObjectData.parent){metaObjectData.parent=math.globalizeObjectId(this.id,metaObjectData.parent);}}// Globalize MetaObject property set IDs
19928
19937
  if(globalize){var propertySetIds=metaObjectData.propertySetIds;if(propertySetIds){var propertySetGlobalIds=[];for(var j=0,lenj=propertySetIds.length;j<lenj;j++){propertySetGlobalIds.push(math.globalizeObjectId(this.id,propertySetIds[j]));}metaObjectData.propertySetIds=propertySetGlobalIds;metaObjectData.originalSystemPropertySetIds=propertySetIds;}}else{metaObjectData.originalSystemPropertySetIds=metaObjectData.propertySetIds;}}}// Globalize global PropertySet IDs
19929
- if(metaModelData.propertySets){for(var _i238=0,_len30=metaModelData.propertySets.length;_i238<_len30;_i238++){var propertySet=metaModelData.propertySets[_i238];propertySet.originalSystemId=propertySet.id;if(globalize){propertySet.id=math.globalizeObjectId(this.id,propertySet.id);}}}}}]);return MetaModel;}();/**
19938
+ if(metaModelData.propertySets){for(var _i240=0,_len30=metaModelData.propertySets.length;_i240<_len30;_i240++){var propertySet=metaModelData.propertySets[_i240];propertySet.originalSystemId=propertySet.id;if(globalize){propertySet.id=math.globalizeObjectId(this.id,propertySet.id);}}}}}]);return MetaModel;}();/**
19930
19939
  * @desc Metadata corresponding to a {@link Scene}.
19931
19940
  *
19932
19941
  * * Located in {@link Viewer#metaScene}.
@@ -19975,7 +19984,7 @@ if(metaModelData.propertySets){for(var _i238=0,_len30=metaModelData.propertySets
19975
19984
  *
19976
19985
  * @param {String} event Event name
19977
19986
  * @param {Object} value Event parameters
19978
- */},{key:"fire",value:function fire(event,value){var subs=this._eventSubs[event];if(subs){for(var _i239=0,len=subs.length;_i239<len;_i239++){subs[_i239](value);}}}/**
19987
+ */},{key:"fire",value:function fire(event,value){var subs=this._eventSubs[event];if(subs){for(var _i241=0,len=subs.length;_i241<len;_i241++){subs[_i241](value);}}}/**
19979
19988
  * Unsubscribes from an event fired at this Viewer.
19980
19989
  * @param event
19981
19990
  */},{key:"off",value:function off(event){// TODO
@@ -20004,12 +20013,12 @@ metaScene:this,id:modelId,projectId:metaModelData.projectId||"none",revisionId:m
20004
20013
  *
20005
20014
  * @param {String} metaModelId ID of the target {@link MetaModel}.
20006
20015
  */},{key:"destroyMetaModel",value:function destroyMetaModel(metaModelId){var metaModel=this.metaModels[metaModelId];if(!metaModel){return;}// Remove global PropertySets
20007
- if(metaModel.propertySets){for(var _i240=0,len=metaModel.propertySets.length;_i240<len;_i240++){var propertySet=metaModel.propertySets[_i240];if(propertySet.metaModels.length===1&&propertySet.metaModels[0].id===metaModelId){// Property set owned only by this model, delete
20016
+ if(metaModel.propertySets){for(var _i242=0,len=metaModel.propertySets.length;_i242<len;_i242++){var propertySet=metaModel.propertySets[_i242];if(propertySet.metaModels.length===1&&propertySet.metaModels[0].id===metaModelId){// Property set owned only by this model, delete
20008
20017
  delete this.propertySets[propertySet.id];}else{var newMetaModels=[];for(var j=0,lenj=propertySet.metaModels.length;j<lenj;j++){if(propertySet.metaModels[j].id!==metaModelId){newMetaModels.push(propertySet.metaModels[j]);}}propertySet.metaModels=newMetaModels;}}}// Remove MetaObjects
20009
20018
  if(metaModel.metaObjects){for(var objectId in metaModel.metaObjects){var metaObject=metaModel.metaObjects[objectId];if(metaObject.metaModels.length===1&&metaObject.metaModels[0].id===metaModelId){// MetaObject owned only by this model, delete
20010
20019
  delete this.metaObjects[objectId];if(!metaObject.parent){delete this.rootMetaObjects[objectId];}}else{metaObject.metaModels=metaObject.metaModels.filter(function(metaModel){return metaModel.id!==metaModelId;});}}}// Re-link entire MetaObject parent/child hierarchy
20011
20020
  for(var _objectId5 in this.metaObjects){var _metaObject5=this.metaObjects[_objectId5];if(_metaObject5.children){_metaObject5.children=[];}// Re-link each MetaObject's property sets
20012
- if(_metaObject5.propertySets){_metaObject5.propertySets=[];}if(_metaObject5.propertySetIds){for(var _i241=0,_len31=_metaObject5.propertySetIds.length;_i241<_len31;_i241++){var propertySetId=_metaObject5.propertySetIds[_i241];var _propertySet2=this.propertySets[propertySetId];_metaObject5.propertySets.push(_propertySet2);}}}this.metaObjectsByType={};for(var _objectId6 in this.metaObjects){var _metaObject6=this.metaObjects[_objectId6];var type=_metaObject6.type;if(_metaObject6.children){_metaObject6.children=null;}(this.metaObjectsByType[type]||(this.metaObjectsByType[type]={}))[_objectId6]=_metaObject6;}for(var _objectId7 in this.metaObjects){var _metaObject7=this.metaObjects[_objectId7];if(_metaObject7.parentId){var parentMetaObject=this.metaObjects[_metaObject7.parentId];if(parentMetaObject){_metaObject7.parent=parentMetaObject;(parentMetaObject.children||(parentMetaObject.children=[])).push(_metaObject7);}}}delete this.metaModels[metaModelId];// Relink MetaObjects to their MetaModels
20021
+ if(_metaObject5.propertySets){_metaObject5.propertySets=[];}if(_metaObject5.propertySetIds){for(var _i243=0,_len31=_metaObject5.propertySetIds.length;_i243<_len31;_i243++){var propertySetId=_metaObject5.propertySetIds[_i243];var _propertySet2=this.propertySets[propertySetId];_metaObject5.propertySets.push(_propertySet2);}}}this.metaObjectsByType={};for(var _objectId6 in this.metaObjects){var _metaObject6=this.metaObjects[_objectId6];var type=_metaObject6.type;if(_metaObject6.children){_metaObject6.children=null;}(this.metaObjectsByType[type]||(this.metaObjectsByType[type]={}))[_objectId6]=_metaObject6;}for(var _objectId7 in this.metaObjects){var _metaObject7=this.metaObjects[_objectId7];if(_metaObject7.parentId){var parentMetaObject=this.metaObjects[_metaObject7.parentId];if(parentMetaObject){_metaObject7.parent=parentMetaObject;(parentMetaObject.children||(parentMetaObject.children=[])).push(_metaObject7);}}}delete this.metaModels[metaModelId];// Relink MetaObjects to their MetaModels
20013
20022
  for(var _objectId8 in this.metaObjects){var _metaObject8=this.metaObjects[_objectId8];_metaObject8.metaModels=[];}for(var modelId in this.metaModels){var _metaModel=this.metaModels[modelId];for(var _objectId9 in _metaModel.metaObjects){var _metaObject9=_metaModel.metaObjects[_objectId9];_metaObject9.metaModels.push(_metaModel);}}this.fire("metaModelDestroyed",metaModelId);}/**
20014
20023
  * Gets the {@link MetaObject#id}s of the {@link MetaObject}s that have the given {@link MetaObject#type}.
20015
20024
  *
@@ -20146,7 +20155,7 @@ function createLog(){var log=new Log({id:'loaders.gl'});globalThis.loaders=globa
20146
20155
  * @param newOptions
20147
20156
  * @returns
20148
20157
  */function mergeLoaderOptions(baseOptions,newOptions){return mergeOptionsRecursively(baseOptions||{},newOptions);}function mergeOptionsRecursively(baseOptions,newOptions){var level=arguments.length>2&&arguments[2]!==undefined?arguments[2]:0;// Sanity check (jest test runner overwrites the console object which can lead to infinite recursion)
20149
- if(level>3){return newOptions;}var options=_objectSpread({},baseOptions);for(var _i242=0,_Object$entries=Object.entries(newOptions);_i242<_Object$entries.length;_i242++){var _Object$entries$_i=_slicedToArray(_Object$entries[_i242],2),key=_Object$entries$_i[0],newValue=_Object$entries$_i[1];if(newValue&&_typeof(newValue)==='object'&&!Array.isArray(newValue)){options[key]=mergeOptionsRecursively(options[key]||{},newOptions[key],level+1);// Object.assign(options[key] as object, newOptions[key]);
20158
+ if(level>3){return newOptions;}var options=_objectSpread({},baseOptions);for(var _i244=0,_Object$entries=Object.entries(newOptions);_i244<_Object$entries.length;_i244++){var _Object$entries$_i=_slicedToArray(_Object$entries[_i244],2),key=_Object$entries$_i[0],newValue=_Object$entries$_i[1];if(newValue&&_typeof(newValue)==='object'&&!Array.isArray(newValue)){options[key]=mergeOptionsRecursively(options[key]||{},newOptions[key],level+1);// Object.assign(options[key] as object, newOptions[key]);
20150
20159
  }else{options[key]=newOptions[key];}}return options;}// loaders.gl
20151
20160
  /**
20152
20161
  * Register application-imported modules
@@ -20473,14 +20482,14 @@ return getMagicString$2(data.buffer,data.byteOffset,length);}else if(data instan
20473
20482
  * @param byteOffset
20474
20483
  * @param length
20475
20484
  * @returns
20476
- */function getMagicString$2(arrayBuffer,byteOffset,length){if(arrayBuffer.byteLength<=byteOffset+length){return'';}var dataView=new DataView(arrayBuffer);var magic='';for(var _i243=0;_i243<length;_i243++){magic+=String.fromCharCode(dataView.getUint8(byteOffset+_i243));}return magic;}/**
20485
+ */function getMagicString$2(arrayBuffer,byteOffset,length){if(arrayBuffer.byteLength<=byteOffset+length){return'';}var dataView=new DataView(arrayBuffer);var magic='';for(var _i245=0;_i245<length;_i245++){magic+=String.fromCharCode(dataView.getUint8(byteOffset+_i245));}return magic;}/**
20477
20486
  * Minimal JSON parser that throws more meaningful error messages
20478
20487
  */function parseJSON(string){try{return JSON.parse(string);}catch(_){throw new Error("Failed to parse JSON from data starting with \"".concat(getFirstCharacters$1(string),"\""));}}/**
20479
20488
  * compare two binary arrays for equality
20480
20489
  * @param a
20481
20490
  * @param b
20482
20491
  * @param byteLength
20483
- */function compareArrayBuffers(arrayBuffer1,arrayBuffer2,byteLength){byteLength=byteLength||arrayBuffer1.byteLength;if(arrayBuffer1.byteLength<byteLength||arrayBuffer2.byteLength<byteLength){return false;}var array1=new Uint8Array(arrayBuffer1);var array2=new Uint8Array(arrayBuffer2);for(var _i244=0;_i244<array1.length;++_i244){if(array1[_i244]!==array2[_i244]){return false;}}return true;}/**
20492
+ */function compareArrayBuffers(arrayBuffer1,arrayBuffer2,byteLength){byteLength=byteLength||arrayBuffer1.byteLength;if(arrayBuffer1.byteLength<byteLength||arrayBuffer2.byteLength<byteLength){return false;}var array1=new Uint8Array(arrayBuffer1);var array2=new Uint8Array(arrayBuffer2);for(var _i246=0;_i246<array1.length;++_i246){if(array1[_i246]!==array2[_i246]){return false;}}return true;}/**
20484
20493
  * Concatenate a sequence of ArrayBuffers from arguments
20485
20494
  * @return A concatenated ArrayBuffer
20486
20495
  */function concatenateArrayBuffers(){for(var _len32=arguments.length,sources=new Array(_len32),_key4=0;_key4<_len32;_key4++){sources[_key4]=arguments[_key4];}return concatenateArrayBuffersFromArray(sources);}/**
@@ -20637,7 +20646,7 @@ response=new Response(resource,{headers:headers});// We can't control `Response.
20637
20646
  Object.defineProperty(response,'url',{value:url});return _context23.abrupt("return",response);case 16:case"end":return _context23.stop();}}},_callee19);}));return _makeResponse.apply(this,arguments);}function checkResponse(_x27){return _checkResponse.apply(this,arguments);}// HELPERS
20638
20647
  function _checkResponse(){_checkResponse=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee20(response){var _error2;return _regeneratorRuntime().wrap(function _callee20$(_context24){while(1){switch(_context24.prev=_context24.next){case 0:if(response.ok){_context24.next=5;break;}_context24.next=3;return getResponseError(response);case 3:_error2=_context24.sent;throw _error2;case 5:case"end":return _context24.stop();}}},_callee20);}));return _checkResponse.apply(this,arguments);}function getResponseError(_x28){return _getResponseError.apply(this,arguments);}function _getResponseError(){_getResponseError=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee21(response){var shortUrl,message,info,contentType;return _regeneratorRuntime().wrap(function _callee21$(_context25){while(1){switch(_context25.prev=_context25.next){case 0:shortUrl=shortenUrlForDisplay(response.url);message="Failed to fetch resource (".concat(response.status,") ").concat(response.statusText,": ").concat(shortUrl);message=message.length>100?"".concat(message.slice(0,100),"..."):message;info={reason:response.statusText,url:response.url,response:response};// See if we got an error message in the body
20639
20648
  _context25.prev=4;contentType=response.headers.get('Content-Type');if(!(!response.bodyUsed&&contentType!==null&&contentType!==void 0&&contentType.includes('application/json'))){_context25.next=12;break;}_context25.next=9;return response.json();case 9:_context25.t0=_context25.sent;_context25.next=15;break;case 12:_context25.next=14;return response.text();case 14:_context25.t0=_context25.sent;case 15:info.reason=_context25.t0;_context25.next=20;break;case 18:_context25.prev=18;_context25.t1=_context25["catch"](4);case 20:return _context25.abrupt("return",new FetchError(message,info));case 21:case"end":return _context25.stop();}}},_callee21,null,[[4,18]]);}));return _getResponseError.apply(this,arguments);}function getInitialDataUrl(_x29){return _getInitialDataUrl.apply(this,arguments);}// https://stackoverflow.com/questions/9267899/arraybuffer-to-base64-encoded-string
20640
- function _getInitialDataUrl(){_getInitialDataUrl=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee22(resource){var INITIAL_DATA_LENGTH,blobSlice,slice,_base;return _regeneratorRuntime().wrap(function _callee22$(_context26){while(1){switch(_context26.prev=_context26.next){case 0:INITIAL_DATA_LENGTH=5;if(!(typeof resource==='string')){_context26.next=3;break;}return _context26.abrupt("return","data:,".concat(resource.slice(0,INITIAL_DATA_LENGTH)));case 3:if(!(resource instanceof Blob)){_context26.next=8;break;}blobSlice=resource.slice(0,5);_context26.next=7;return new Promise(function(resolve){var reader=new FileReader();reader.onload=function(event){var _event$target;return resolve(event===null||event===void 0?void 0:(_event$target=event.target)===null||_event$target===void 0?void 0:_event$target.result);};reader.readAsDataURL(blobSlice);});case 7:return _context26.abrupt("return",_context26.sent);case 8:if(!(resource instanceof ArrayBuffer)){_context26.next=12;break;}slice=resource.slice(0,INITIAL_DATA_LENGTH);_base=arrayBufferToBase64(slice);return _context26.abrupt("return","data:base64,".concat(_base));case 12:return _context26.abrupt("return",null);case 13:case"end":return _context26.stop();}}},_callee22);}));return _getInitialDataUrl.apply(this,arguments);}function arrayBufferToBase64(buffer){var binary='';var bytes=new Uint8Array(buffer);for(var _i245=0;_i245<bytes.byteLength;_i245++){binary+=String.fromCharCode(bytes[_i245]);}return btoa(binary);}// loaders.gl
20649
+ function _getInitialDataUrl(){_getInitialDataUrl=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee22(resource){var INITIAL_DATA_LENGTH,blobSlice,slice,_base;return _regeneratorRuntime().wrap(function _callee22$(_context26){while(1){switch(_context26.prev=_context26.next){case 0:INITIAL_DATA_LENGTH=5;if(!(typeof resource==='string')){_context26.next=3;break;}return _context26.abrupt("return","data:,".concat(resource.slice(0,INITIAL_DATA_LENGTH)));case 3:if(!(resource instanceof Blob)){_context26.next=8;break;}blobSlice=resource.slice(0,5);_context26.next=7;return new Promise(function(resolve){var reader=new FileReader();reader.onload=function(event){var _event$target;return resolve(event===null||event===void 0?void 0:(_event$target=event.target)===null||_event$target===void 0?void 0:_event$target.result);};reader.readAsDataURL(blobSlice);});case 7:return _context26.abrupt("return",_context26.sent);case 8:if(!(resource instanceof ArrayBuffer)){_context26.next=12;break;}slice=resource.slice(0,INITIAL_DATA_LENGTH);_base=arrayBufferToBase64(slice);return _context26.abrupt("return","data:base64,".concat(_base));case 12:return _context26.abrupt("return",null);case 13:case"end":return _context26.stop();}}},_callee22);}));return _getInitialDataUrl.apply(this,arguments);}function arrayBufferToBase64(buffer){var binary='';var bytes=new Uint8Array(buffer);for(var _i247=0;_i247<bytes.byteLength;_i247++){binary+=String.fromCharCode(bytes[_i247]);}return btoa(binary);}// loaders.gl
20641
20650
  // import {FetchError} from './fetch-error';
20642
20651
  function isNodePath(url){return!isRequestURL(url)&&!isDataURL(url);}function isRequestURL(url){return url.startsWith('http:')||url.startsWith('https:');}function isDataURL(url){return url.startsWith('data:');}/**
20643
20652
  * fetch API compatible function
@@ -20776,7 +20785,7 @@ if(compareMIMETypes(mimeType,"application/x.".concat(loader.id))){return loader;
20776
20785
  if(testDataAgainstBinary(data.buffer,data.byteOffset,loader)){return loader;}}else if(data instanceof ArrayBuffer){var byteOffset=0;if(testDataAgainstBinary(data,byteOffset,loader)){return loader;}}// TODO Handle streaming case (requires creating a new AsyncIterator)
20777
20786
  }}catch(err){_iterator14.e(err);}finally{_iterator14.f();}return null;}function testDataAgainstText(data,loader){if(loader.testText){return loader.testText(data);}var tests=Array.isArray(loader.tests)?loader.tests:[loader.tests];return tests.some(function(test){return data.startsWith(test);});}function testDataAgainstBinary(data,byteOffset,loader){var tests=Array.isArray(loader.tests)?loader.tests:[loader.tests];return tests.some(function(test){return testBinary(data,byteOffset,loader,test);});}function testBinary(data,byteOffset,loader,test){if(test instanceof ArrayBuffer){return compareArrayBuffers(test,data,test.byteLength);}switch(_typeof(test)){case'function':return test(data);case'string':// Magic bytes check: If `test` is a string, check if binary data starts with that strings
20778
20787
  var magic=getMagicString$1(data,byteOffset,test.length);return test===magic;default:return false;}}function getFirstCharacters(data){var length=arguments.length>1&&arguments[1]!==undefined?arguments[1]:5;if(typeof data==='string'){return data.slice(0,length);}else if(ArrayBuffer.isView(data)){// Typed Arrays can have offsets into underlying buffer
20779
- return getMagicString$1(data.buffer,data.byteOffset,length);}else if(data instanceof ArrayBuffer){var byteOffset=0;return getMagicString$1(data,byteOffset,length);}return'';}function getMagicString$1(arrayBuffer,byteOffset,length){if(arrayBuffer.byteLength<byteOffset+length){return'';}var dataView=new DataView(arrayBuffer);var magic='';for(var _i246=0;_i246<length;_i246++){magic+=String.fromCharCode(dataView.getUint8(byteOffset+_i246));}return magic;}// loaders.gl
20788
+ return getMagicString$1(data.buffer,data.byteOffset,length);}else if(data instanceof ArrayBuffer){var byteOffset=0;return getMagicString$1(data,byteOffset,length);}return'';}function getMagicString$1(arrayBuffer,byteOffset,length){if(arrayBuffer.byteLength<byteOffset+length){return'';}var dataView=new DataView(arrayBuffer);var magic='';for(var _i248=0;_i248<length;_i248++){magic+=String.fromCharCode(dataView.getUint8(byteOffset+_i248));}return magic;}// loaders.gl
20780
20789
  // SPDX-License-Identifier: MIT
20781
20790
  // Copyright (c) vis.gl contributors
20782
20791
  var DEFAULT_CHUNK_SIZE$2=256*1024;/**
@@ -20947,7 +20956,7 @@ throw new Error("".concat(loader.id," loader - no parser found and worker is dis
20947
20956
  * @param attributes
20948
20957
  * @returns array of two vectors representing the axis aligned bounding box
20949
20958
  */ // eslint-disable-next-line complexity
20950
- function getMeshBoundingBox(attributes){var minX=Infinity;var minY=Infinity;var minZ=Infinity;var maxX=-Infinity;var maxY=-Infinity;var maxZ=-Infinity;var positions=attributes.POSITION?attributes.POSITION.value:[];var len=positions&&positions.length;for(var _i247=0;_i247<len;_i247+=3){var x=positions[_i247];var y=positions[_i247+1];var _z4=positions[_i247+2];minX=x<minX?x:minX;minY=y<minY?y:minY;minZ=_z4<minZ?_z4:minZ;maxX=x>maxX?x:maxX;maxY=y>maxY?y:maxY;maxZ=_z4>maxZ?_z4:maxZ;}return[[minX,minY,minZ],[maxX,maxY,maxZ]];}// loaders.gl
20959
+ function getMeshBoundingBox(attributes){var minX=Infinity;var minY=Infinity;var minZ=Infinity;var maxX=-Infinity;var maxY=-Infinity;var maxZ=-Infinity;var positions=attributes.POSITION?attributes.POSITION.value:[];var len=positions&&positions.length;for(var _i249=0;_i249<len;_i249+=3){var x=positions[_i249];var y=positions[_i249+1];var _z4=positions[_i249+2];minX=x<minX?x:minX;minY=y<minY?y:minY;minZ=_z4<minZ?_z4:minZ;maxX=x>maxX?x:maxX;maxY=y>maxY?y:maxY;maxZ=_z4>maxZ?_z4:maxZ;}return[[minX,minY,minZ],[maxX,maxY,maxZ]];}// loaders.gl
20951
20960
  /**
20952
20961
  * Create a schema for mesh attributes data
20953
20962
  * @param attributes
@@ -21075,7 +21084,7 @@ return decodeMajorBrand(buffer);}/**
21075
21084
  // return {ext: '3gp', mime: 'video/3gpp'};
21076
21085
  // }
21077
21086
  // return {ext: 'mp4', mime: 'video/mp4'};
21078
- }/** Interpret a chunk of bytes as a UTF8 string */function getUTF8String(array,start,end){return String.fromCharCode.apply(String,_toConsumableArray(array.slice(start,end)));}function stringToBytes(string){return _toConsumableArray(string).map(function(character){return character.charCodeAt(0);});}function checkString(buffer,header){var offset=arguments.length>2&&arguments[2]!==undefined?arguments[2]:0;var headerBytes=stringToBytes(header);for(var _i248=0;_i248<headerBytes.length;++_i248){if(headerBytes[_i248]!==buffer[_i248+offset]){return false;}}return true;}// Attributions
21087
+ }/** Interpret a chunk of bytes as a UTF8 string */function getUTF8String(array,start,end){return String.fromCharCode.apply(String,_toConsumableArray(array.slice(start,end)));}function stringToBytes(string){return _toConsumableArray(string).map(function(character){return character.charCodeAt(0);});}function checkString(buffer,header){var offset=arguments.length>2&&arguments[2]!==undefined?arguments[2]:0;var headerBytes=stringToBytes(header);for(var _i250=0;_i250<headerBytes.length;++_i250){if(headerBytes[_i250]!==buffer[_i250+offset]){return false;}}return true;}// Attributions
21079
21088
  var BIG_ENDIAN=false;var LITTLE_ENDIAN$1=true;/**
21080
21089
  * Extracts `{mimeType, width and height}` from a memory buffer containing a known image format
21081
21090
  * Currently supports `image/png`, `image/jpeg`, `image/bmp` and `image/gif`.
@@ -21108,7 +21117,7 @@ width:dataView.getUint16(i+7,BIG_ENDIAN)// Number of pixels per line
21108
21117
  if(!tableMarkers.has(marker)){return null;}// Length includes size of length parameter but not the two byte header.
21109
21118
  i+=2;i+=dataView.getUint16(i,BIG_ENDIAN);}return null;}function getJpegMarkers(){// Tables/misc header markers.
21110
21119
  // DQT, DHT, DAC, DRI, COM, APP_n
21111
- var tableMarkers=new Set([0xffdb,0xffc4,0xffcc,0xffdd,0xfffe]);for(var _i249=0xffe0;_i249<0xfff0;++_i249){tableMarkers.add(_i249);}// SOF markers and DHP marker.
21120
+ var tableMarkers=new Set([0xffdb,0xffc4,0xffcc,0xffdd,0xfffe]);for(var _i251=0xffe0;_i251<0xfff0;++_i251){tableMarkers.add(_i251);}// SOF markers and DHP marker.
21112
21121
  // These markers are after tables/misc data.
21113
21122
  var sofMarkers=new Set([0xffc0,0xffc1,0xffc2,0xffc3,0xffc5,0xffc6,0xffc7,0xffc9,0xffca,0xffcb,0xffcd,0xffce,0xffcf,0xffde]);return{tableMarkers:tableMarkers,sofMarkers:sofMarkers};}// TODO - move into image module?
21114
21123
  function toDataView(data){if(data instanceof DataView){return data;}if(ArrayBuffer.isView(data)){return new DataView(data.buffer);}// TODO: make these functions work for Node.js buffers?
@@ -21178,7 +21187,7 @@ var _getAccessorArrayType=getAccessorArrayTypeAndLength(gltfAccessor,bufferView)
21178
21187
  var elementByteSize=componentByteSize*numberOfComponentsInElement;var elementAddressScale=bufferView.byteStride||elementByteSize;// Creare an array of component's type where all components (not just elements) will reside
21179
21188
  if(typeof bufferView.byteStride==='undefined'||bufferView.byteStride===elementByteSize){// No iterleaving
21180
21189
  var _result3=new ArrayType(arrayBuffer,byteOffset,length);return _result3;}// Iterleaving
21181
- var result=new ArrayType(length);for(var _i250=0;_i250<gltfAccessor.count;_i250++){var values=new ArrayType(arrayBuffer,byteOffset+_i250*elementAddressScale,numberOfComponentsInElement);result.set(values,_i250*numberOfComponentsInElement);}return result;}// loaders.gl
21190
+ var result=new ArrayType(length);for(var _i252=0;_i252<gltfAccessor.count;_i252++){var values=new ArrayType(arrayBuffer,byteOffset+_i252*elementAddressScale,numberOfComponentsInElement);result.set(values,_i252*numberOfComponentsInElement);}return result;}// loaders.gl
21182
21191
  function makeDefaultGLTFJson(){return{asset:{version:'2.0',generator:'loaders.gl'},buffers:[],extensions:{},extensionsRequired:[],extensionsUsed:[]};}/**
21183
21192
  * Class for structured access to GLTF data
21184
21193
  */var GLTFScenegraph=/*#__PURE__*/function(){// internal
@@ -21661,9 +21670,9 @@ return getEnumsArray(valuesData,0,numberOfElements,enumEntry);}/**
21661
21670
  * @param count - Values length to parse.
21662
21671
  * @param enumEntry - Enums dictionary.
21663
21672
  * @returns Array of strings with parsed ENUM names.
21664
- */function getEnumsArray(valuesData,offset,count,enumEntry){var array=[];for(var _i251=0;_i251<count;_i251++){// At the moment we don't support BigInt. It requires additional calculations logic
21673
+ */function getEnumsArray(valuesData,offset,count,enumEntry){var array=[];for(var _i253=0;_i253<count;_i253++){// At the moment we don't support BigInt. It requires additional calculations logic
21665
21674
  // and might be an issue in Safari
21666
- if(valuesData instanceof BigInt64Array||valuesData instanceof BigUint64Array){array.push('');}else{var value=valuesData[offset+_i251];var enumObject=getEnumByValue(enumEntry,value);if(enumObject){array.push(enumObject.name);}else{array.push('');}}}return array;}/**
21675
+ if(valuesData instanceof BigInt64Array||valuesData instanceof BigUint64Array){array.push('');}else{var value=valuesData[offset+_i253];var enumObject=getEnumByValue(enumEntry,value);if(enumObject){array.push(enumObject.name);}else{array.push('');}}}return array;}/**
21667
21676
  * Looks up ENUM whose `value` property matches the specified number in the parameter `value`.
21668
21677
  * @param {GLTF_EXT_structural_metadata_Enum} enumEntry - ENUM entry containing the array of possible enums.
21669
21678
  * @param {number} value - The value of the ENUM to locate.
@@ -21681,7 +21690,7 @@ var count=0;var schemaClass=(_schema$classes2=schema.classes)===null||_schema$cl
21681
21690
  if(count!==attribute.values.length&&attribute.values.length){throw new Error('Illegal values in attributes');}var classProperty=schemaClass===null||schemaClass===void 0?void 0:schemaClass.properties[attribute.name];if(classProperty){// const tableProperty = createPropertyTableProperty(attribute, classProperty, scenegraph);
21682
21691
  if(!table.properties){table.properties={};}// values is a required field. Its real value will be set while encoding data
21683
21692
  table.properties[attribute.name]={values:0,data:attribute.values};}}}catch(err){_iterator32.e(err);}finally{_iterator32.f();}table.count=count;return table;}function createPropertyTableProperty(// attribute: PropertyAttribute,
21684
- values,classProperty,scenegraph){var prop={values:0};if(classProperty.type==='STRING'){var _createPropertyDataSt=createPropertyDataString(values),stringData=_createPropertyDataSt.stringData,stringOffsets=_createPropertyDataSt.stringOffsets;prop.stringOffsets=createBufferView(stringOffsets,scenegraph);prop.values=createBufferView(stringData,scenegraph);}else if(classProperty.type==='SCALAR'&&classProperty.componentType){var data=createPropertyDataScalar(values,classProperty.componentType);prop.values=createBufferView(data,scenegraph);}return prop;}var COMPONENT_TYPE_TO_ARRAY_CONSTRUCTOR={INT8:Int8Array,UINT8:Uint8Array,INT16:Int16Array,UINT16:Uint16Array,INT32:Int32Array,UINT32:Uint32Array,INT64:Int32Array,UINT64:Uint32Array,FLOAT32:Float32Array,FLOAT64:Float64Array};function createPropertyDataScalar(array,componentType){var numberArray=[];var _iterator33=_createForOfIteratorHelper(array),_step33;try{for(_iterator33.s();!(_step33=_iterator33.n()).done;){var value=_step33.value;numberArray.push(Number(value));}}catch(err){_iterator33.e(err);}finally{_iterator33.f();}var Construct=COMPONENT_TYPE_TO_ARRAY_CONSTRUCTOR[componentType];if(!Construct){throw new Error('Illegal component type');}return new Construct(numberArray);}function createPropertyDataString(strings){var utf8Encode=new TextEncoder();var arr=[];var len=0;var _iterator34=_createForOfIteratorHelper(strings),_step34;try{for(_iterator34.s();!(_step34=_iterator34.n()).done;){var _str=_step34.value;var uint8Array=utf8Encode.encode(_str);len+=uint8Array.length;arr.push(uint8Array);}}catch(err){_iterator34.e(err);}finally{_iterator34.f();}var strArray=new Uint8Array(len);var strOffsets=[];var offset=0;for(var _i252=0,_arr2=arr;_i252<_arr2.length;_i252++){var str=_arr2[_i252];strArray.set(str,offset);strOffsets.push(offset);offset+=str.length;}strOffsets.push(offset);// The last offset represents the byte offset after the last string.
21693
+ values,classProperty,scenegraph){var prop={values:0};if(classProperty.type==='STRING'){var _createPropertyDataSt=createPropertyDataString(values),stringData=_createPropertyDataSt.stringData,stringOffsets=_createPropertyDataSt.stringOffsets;prop.stringOffsets=createBufferView(stringOffsets,scenegraph);prop.values=createBufferView(stringData,scenegraph);}else if(classProperty.type==='SCALAR'&&classProperty.componentType){var data=createPropertyDataScalar(values,classProperty.componentType);prop.values=createBufferView(data,scenegraph);}return prop;}var COMPONENT_TYPE_TO_ARRAY_CONSTRUCTOR={INT8:Int8Array,UINT8:Uint8Array,INT16:Int16Array,UINT16:Uint16Array,INT32:Int32Array,UINT32:Uint32Array,INT64:Int32Array,UINT64:Uint32Array,FLOAT32:Float32Array,FLOAT64:Float64Array};function createPropertyDataScalar(array,componentType){var numberArray=[];var _iterator33=_createForOfIteratorHelper(array),_step33;try{for(_iterator33.s();!(_step33=_iterator33.n()).done;){var value=_step33.value;numberArray.push(Number(value));}}catch(err){_iterator33.e(err);}finally{_iterator33.f();}var Construct=COMPONENT_TYPE_TO_ARRAY_CONSTRUCTOR[componentType];if(!Construct){throw new Error('Illegal component type');}return new Construct(numberArray);}function createPropertyDataString(strings){var utf8Encode=new TextEncoder();var arr=[];var len=0;var _iterator34=_createForOfIteratorHelper(strings),_step34;try{for(_iterator34.s();!(_step34=_iterator34.n()).done;){var _str=_step34.value;var uint8Array=utf8Encode.encode(_str);len+=uint8Array.length;arr.push(uint8Array);}}catch(err){_iterator34.e(err);}finally{_iterator34.f();}var strArray=new Uint8Array(len);var strOffsets=[];var offset=0;for(var _i254=0,_arr2=arr;_i254<_arr2.length;_i254++){var str=_arr2[_i254];strArray.set(str,offset);strOffsets.push(offset);offset+=str.length;}strOffsets.push(offset);// The last offset represents the byte offset after the last string.
21685
21694
  var stringOffsetsTypedArray=new Uint32Array(strOffsets);// Its length = len+1
21686
21695
  return{stringData:strArray,stringOffsets:stringOffsetsTypedArray};}function createBufferView(typedArray,scenegraph){scenegraph.gltf.buffers.push({arrayBuffer:typedArray.buffer,byteOffset:typedArray.byteOffset,byteLength:typedArray.byteLength});return scenegraph.addBufferView(typedArray);}var EXT_structural_metadata=/*#__PURE__*/Object.freeze({__proto__:null,name:name$9,decode:decode$a,encode:encode$4,createExtStructuralMetadata:createExtStructuralMetadata});/** Extension name */var EXT_FEATURE_METADATA_NAME='EXT_feature_metadata';var name$8=EXT_FEATURE_METADATA_NAME;function decode$9(_x62,_x63){return _decode$.apply(this,arguments);}/**
21687
21696
  * Decodes feature metadata from extension.
@@ -21971,7 +21980,7 @@ NONE:'',OCTAHEDRAL:'meshopt_decodeFilterOct',QUATERNION:'meshopt_decodeFilterQua
21971
21980
  ATTRIBUTES:'meshopt_decodeVertexBuffer',TRIANGLES:'meshopt_decodeIndexBuffer',INDICES:'meshopt_decodeIndexSequence'};// eslint-disable-next-line max-params
21972
21981
  function meshoptDecodeGltfBuffer(_x70,_x71,_x72,_x73,_x74){return _meshoptDecodeGltfBuffer.apply(this,arguments);}function _meshoptDecodeGltfBuffer(){_meshoptDecodeGltfBuffer=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee42(target,count,size,source,mode){var filter,instance,_args45=arguments;return _regeneratorRuntime().wrap(function _callee42$(_context46){while(1){switch(_context46.prev=_context46.next){case 0:filter=_args45.length>5&&_args45[5]!==undefined?_args45[5]:'NONE';_context46.next=3;return loadWasmInstance();case 3:instance=_context46.sent;decode$8(instance,instance.exports[DECODERS[mode]],target,count,size,source,instance.exports[FILTERS[filter||'NONE']]);case 5:case"end":return _context46.stop();}}},_callee42);}));return _meshoptDecodeGltfBuffer.apply(this,arguments);}var wasmPromise;function loadWasmInstance(){return _loadWasmInstance.apply(this,arguments);}function _loadWasmInstance(){_loadWasmInstance=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee43(){return _regeneratorRuntime().wrap(function _callee43$(_context47){while(1){switch(_context47.prev=_context47.next){case 0:// eslint-disable-next-line
21973
21982
  if(!wasmPromise){wasmPromise=loadWasmModule();}return _context47.abrupt("return",wasmPromise);case 2:case"end":return _context47.stop();}}},_callee43);}));return _loadWasmInstance.apply(this,arguments);}function loadWasmModule(){return _loadWasmModule.apply(this,arguments);}function _loadWasmModule(){_loadWasmModule=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee44(){var wasm,result;return _regeneratorRuntime().wrap(function _callee44$(_context48){while(1){switch(_context48.prev=_context48.next){case 0:wasm=wasm_base;if(WebAssembly.validate(detector)){wasm=wasm_simd;// eslint-disable-next-line no-console
21974
- console.log('Warning: meshopt_decoder is using experimental SIMD support');}_context48.next=4;return WebAssembly.instantiate(unpack(wasm),{});case 4:result=_context48.sent;_context48.next=7;return result.instance.exports.__wasm_call_ctors();case 7:return _context48.abrupt("return",result.instance);case 8:case"end":return _context48.stop();}}},_callee44);}));return _loadWasmModule.apply(this,arguments);}function unpack(data){var result=new Uint8Array(data.length);for(var _i253=0;_i253<data.length;++_i253){var ch=data.charCodeAt(_i253);result[_i253]=ch>96?ch-71:ch>64?ch-65:ch>47?ch+4:ch>46?63:62;}var write=0;for(var _i254=0;_i254<data.length;++_i254){result[write++]=result[_i254]<60?wasmpack[result[_i254]]:(result[_i254]-60)*64+result[++_i254];}return result.buffer.slice(0,write);}// eslint-disable-next-line max-params
21983
+ console.log('Warning: meshopt_decoder is using experimental SIMD support');}_context48.next=4;return WebAssembly.instantiate(unpack(wasm),{});case 4:result=_context48.sent;_context48.next=7;return result.instance.exports.__wasm_call_ctors();case 7:return _context48.abrupt("return",result.instance);case 8:case"end":return _context48.stop();}}},_callee44);}));return _loadWasmModule.apply(this,arguments);}function unpack(data){var result=new Uint8Array(data.length);for(var _i255=0;_i255<data.length;++_i255){var ch=data.charCodeAt(_i255);result[_i255]=ch>96?ch-71:ch>64?ch-65:ch>47?ch+4:ch>46?63:62;}var write=0;for(var _i256=0;_i256<data.length;++_i256){result[write++]=result[_i256]<60?wasmpack[result[_i256]]:(result[_i256]-60)*64+result[++_i256];}return result.buffer.slice(0,write);}// eslint-disable-next-line max-params
21975
21984
  function decode$8(instance,fun,target,count,size,source,filter){var sbrk=instance.exports.sbrk;var count4=count+3&~3;// pad for SIMD filter
21976
21985
  var tp=sbrk(count4*size);var sp=sbrk(source.length);var heap=new Uint8Array(instance.exports.memory.buffer);heap.set(source,sp);var res=fun(tp,count,size,sp,source.length);if(res===0&&filter){filter(tp,count4,size);}target.set(heap.subarray(tp,tp+count*size));sbrk(tp-sbrk(0));if(res!==0){throw new Error("Malformed buffer data: ".concat(res));}}/** Extension name */var EXT_MESHOPT_COMPRESSION='EXT_meshopt_compression';var name$7=EXT_MESHOPT_COMPRESSION;function decode$7(_x75,_x76){return _decode$2.apply(this,arguments);}/** Decode one meshopt buffer view */function _decode$2(){_decode$2=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee45(gltfData,options){var _options$gltf8,_options$gltf9;var scenegraph,promises,_iterator69,_step69,bufferViewIndex;return _regeneratorRuntime().wrap(function _callee45$(_context49){while(1){switch(_context49.prev=_context49.next){case 0:scenegraph=new GLTFScenegraph(gltfData);if(!(!(options!==null&&options!==void 0&&(_options$gltf8=options.gltf)!==null&&_options$gltf8!==void 0&&_options$gltf8.decompressMeshes)||!((_options$gltf9=options.gltf)!==null&&_options$gltf9!==void 0&&_options$gltf9.loadBuffers))){_context49.next=3;break;}return _context49.abrupt("return");case 3:promises=[];_iterator69=_createForOfIteratorHelper(gltfData.json.bufferViews||[]);try{for(_iterator69.s();!(_step69=_iterator69.n()).done;){bufferViewIndex=_step69.value;promises.push(decodeMeshoptBufferView(scenegraph,bufferViewIndex));}// Decompress meshes in parallel
21977
21986
  }catch(err){_iterator69.e(err);}finally{_iterator69.f();}_context49.next=8;return Promise.all(promises);case 8:// We have now decompressed all primitives, so remove the top-level extension
@@ -22033,7 +22042,7 @@ if(dracoGeometry instanceof this.draco.Mesh){switch(options.topology){case'trian
22033
22042
  attributes:attributes,indices:{value:this._getTriangleStripIndices(dracoGeometry),size:1}};case'triangle-list':default:return{topology:'triangle-list',mode:5,// GL.TRIANGLE_STRIP
22034
22043
  attributes:attributes,indices:{value:this._getTriangleListIndices(dracoGeometry),size:1}};}}// PointCloud - must come last as Mesh inherits from PointCloud
22035
22044
  return{topology:'point-list',mode:0,// GL.POINTS
22036
- attributes:attributes};}},{key:"_getMeshAttributes",value:function _getMeshAttributes(loaderData,dracoGeometry,options){var attributes={};for(var _i255=0,_Object$values=Object.values(loaderData.attributes);_i255<_Object$values.length;_i255++){var loaderAttribute=_Object$values[_i255];var attributeName=this._deduceAttributeName(loaderAttribute,options);loaderAttribute.name=attributeName;var values=this._getAttributeValues(dracoGeometry,loaderAttribute);if(values){var value=values.value,size=values.size;attributes[attributeName]={value:value,size:size,byteOffset:loaderAttribute.byte_offset,byteStride:loaderAttribute.byte_stride,normalized:loaderAttribute.normalized};}}return attributes;}// MESH INDICES EXTRACTION
22045
+ attributes:attributes};}},{key:"_getMeshAttributes",value:function _getMeshAttributes(loaderData,dracoGeometry,options){var attributes={};for(var _i257=0,_Object$values=Object.values(loaderData.attributes);_i257<_Object$values.length;_i257++){var loaderAttribute=_Object$values[_i257];var attributeName=this._deduceAttributeName(loaderAttribute,options);loaderAttribute.name=attributeName;var values=this._getAttributeValues(dracoGeometry,loaderAttribute);if(values){var value=values.value,size=values.size;attributes[attributeName]={value:value,size:size,byteOffset:loaderAttribute.byte_offset,byteStride:loaderAttribute.byte_stride,normalized:loaderAttribute.normalized};}}return attributes;}// MESH INDICES EXTRACTION
22037
22046
  /**
22038
22047
  * For meshes, we need indices to define the faces.
22039
22048
  * @param dracoGeometry
@@ -22070,7 +22079,7 @@ console.warn("DRACO: Unsupported attribute type ".concat(attribute.data_type));r
22070
22079
  * types
22071
22080
  * @param attributeData
22072
22081
  */},{key:"_deduceAttributeName",value:function _deduceAttributeName(attribute,options){// Deduce name based on application provided map
22073
- var uniqueId=attribute.unique_id;for(var _i256=0,_Object$entries2=Object.entries(options.extraAttributes||{});_i256<_Object$entries2.length;_i256++){var _Object$entries2$_i=_slicedToArray(_Object$entries2[_i256],2),attributeName=_Object$entries2$_i[0],attributeUniqueId=_Object$entries2$_i[1];if(attributeUniqueId===uniqueId){return attributeName;}}// Deduce name based on attribute type
22082
+ var uniqueId=attribute.unique_id;for(var _i258=0,_Object$entries2=Object.entries(options.extraAttributes||{});_i258<_Object$entries2.length;_i258++){var _Object$entries2$_i=_slicedToArray(_Object$entries2[_i258],2),attributeName=_Object$entries2$_i[0],attributeUniqueId=_Object$entries2$_i[1];if(attributeUniqueId===uniqueId){return attributeName;}}// Deduce name based on attribute type
22074
22083
  var thisAttributeType=attribute.attribute_type;for(var dracoAttributeConstant in DRACO_TO_GLTF_ATTRIBUTE_NAME_MAP){var attributeType=this.draco[dracoAttributeConstant];if(attributeType===thisAttributeType){// TODO - Return unique names if there multiple attributes per type
22075
22084
  // (e.g. multiple TEX_COORDS or COLORS)
22076
22085
  return DRACO_TO_GLTF_ATTRIBUTE_NAME_MAP[dracoAttributeConstant];}}// Look up in metadata
@@ -22097,9 +22106,9 @@ this.metadataQuerier.GetIntEntryArray(dracoMetadata,entryName,dracoArray);var in
22097
22106
  * @returns draco specific data type
22098
22107
  */function getDracoDataType(draco,attributeType){switch(attributeType){case Float32Array:return draco.DT_FLOAT32;case Int8Array:return draco.DT_INT8;case Int16Array:return draco.DT_INT16;case Int32Array:return draco.DT_INT32;case Uint8Array:return draco.DT_UINT8;case Uint16Array:return draco.DT_UINT16;case Uint32Array:return draco.DT_UINT32;default:return draco.DT_INVALID;}}/**
22099
22108
  * Copy a Draco int32 array into a JS typed array
22100
- */function getInt32Array(dracoArray){var numValues=dracoArray.size();var intArray=new Int32Array(numValues);for(var _i257=0;_i257<numValues;_i257++){intArray[_i257]=dracoArray.GetValue(_i257);}return intArray;}/**
22109
+ */function getInt32Array(dracoArray){var numValues=dracoArray.size();var intArray=new Int32Array(numValues);for(var _i259=0;_i259<numValues;_i259++){intArray[_i259]=dracoArray.GetValue(_i259);}return intArray;}/**
22101
22110
  * Copy a Draco int32 array into a JS typed array
22102
- */function getUint32Array(dracoArray){var numValues=dracoArray.size();var intArray=new Int32Array(numValues);for(var _i258=0;_i258<numValues;_i258++){intArray[_i258]=dracoArray.GetValue(_i258);}return intArray;}// Dynamic DRACO module loading inspired by THREE.DRACOLoader
22111
+ */function getUint32Array(dracoArray){var numValues=dracoArray.size();var intArray=new Int32Array(numValues);for(var _i260=0;_i260<numValues;_i260++){intArray[_i260]=dracoArray.GetValue(_i260);}return intArray;}// Dynamic DRACO module loading inspired by THREE.DRACOLoader
22103
22112
  var DRACO_DECODER_VERSION='1.5.6';var DRACO_ENCODER_VERSION='1.4.1';var STATIC_DECODER_URL="https://www.gstatic.com/draco/versioned/decoders/".concat(DRACO_DECODER_VERSION);var DRACO_EXTERNAL_LIBRARIES={/** The primary Draco3D encoder, javascript wrapper part */DECODER:'draco_wasm_wrapper.js',/** The primary draco decoder, compiled web assembly part */DECODER_WASM:'draco_decoder.wasm',/** Fallback decoder for non-webassebly environments. Very big bundle, lower performance */FALLBACK_DECODER:'draco_decoder.js',/** Draco encoder */ENCODER:'draco_encoder.js'};var DRACO_EXTERNAL_LIBRARY_URLS=(_DRACO_EXTERNAL_LIBRA={},_defineProperty(_DRACO_EXTERNAL_LIBRA,DRACO_EXTERNAL_LIBRARIES.DECODER,"".concat(STATIC_DECODER_URL,"/").concat(DRACO_EXTERNAL_LIBRARIES.DECODER)),_defineProperty(_DRACO_EXTERNAL_LIBRA,DRACO_EXTERNAL_LIBRARIES.DECODER_WASM,"".concat(STATIC_DECODER_URL,"/").concat(DRACO_EXTERNAL_LIBRARIES.DECODER_WASM)),_defineProperty(_DRACO_EXTERNAL_LIBRA,DRACO_EXTERNAL_LIBRARIES.FALLBACK_DECODER,"".concat(STATIC_DECODER_URL,"/").concat(DRACO_EXTERNAL_LIBRARIES.FALLBACK_DECODER)),_defineProperty(_DRACO_EXTERNAL_LIBRA,DRACO_EXTERNAL_LIBRARIES.ENCODER,"https://raw.githubusercontent.com/google/draco/".concat(DRACO_ENCODER_VERSION,"/javascript/").concat(DRACO_EXTERNAL_LIBRARIES.ENCODER)),_DRACO_EXTERNAL_LIBRA);var loadDecoderPromise;function loadDracoDecoderModule(_x79){return _loadDracoDecoderModule.apply(this,arguments);}// DRACO DECODER LOADING
22104
22113
  function _loadDracoDecoderModule(){_loadDracoDecoderModule=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee47(options){var modules;return _regeneratorRuntime().wrap(function _callee47$(_context51){while(1){switch(_context51.prev=_context51.next){case 0:modules=options.modules||{};// Check if a bundled draco3d library has been supplied by application
22105
22114
  if(modules.draco3d){loadDecoderPromise||(loadDecoderPromise=modules.draco3d.createDecoderModule({}).then(function(draco){return{draco:draco};}));}else{// If not, dynamically load the WASM script from our CDN
@@ -22142,12 +22151,12 @@ scenegraph.addRequiredExtension(KHR_DRACO_MESH_COMPRESSION);}}catch(err){_iterat
22142
22151
  function decompressPrimitive(_x86,_x87,_x88,_x89){return _decompressPrimitive.apply(this,arguments);}// ENCODE
22143
22152
  // eslint-disable-next-line max-len
22144
22153
  // Only TRIANGLES: 0x0004 and TRIANGLE_STRIP: 0x0005 are supported
22145
- function _decompressPrimitive(){_decompressPrimitive=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee51(scenegraph,primitive,options,context){var dracoExtension,buffer,bufferCopy,dracoOptions,decodedData,decodedAttributes,_i424,_Object$entries8,_Object$entries8$_i,attributeName,decodedAttribute,accessorIndex,accessor;return _regeneratorRuntime().wrap(function _callee51$(_context55){while(1){switch(_context55.prev=_context55.next){case 0:dracoExtension=scenegraph.getObjectExtension(primitive,KHR_DRACO_MESH_COMPRESSION);if(dracoExtension){_context55.next=3;break;}return _context55.abrupt("return");case 3:buffer=scenegraph.getTypedArrayForBufferView(dracoExtension.bufferView);// TODO - parse does not yet deal well with byte offsets embedded in typed arrays. Copy buffer
22154
+ function _decompressPrimitive(){_decompressPrimitive=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee51(scenegraph,primitive,options,context){var dracoExtension,buffer,bufferCopy,dracoOptions,decodedData,decodedAttributes,_i426,_Object$entries8,_Object$entries8$_i,attributeName,decodedAttribute,accessorIndex,accessor;return _regeneratorRuntime().wrap(function _callee51$(_context55){while(1){switch(_context55.prev=_context55.next){case 0:dracoExtension=scenegraph.getObjectExtension(primitive,KHR_DRACO_MESH_COMPRESSION);if(dracoExtension){_context55.next=3;break;}return _context55.abrupt("return");case 3:buffer=scenegraph.getTypedArrayForBufferView(dracoExtension.bufferView);// TODO - parse does not yet deal well with byte offsets embedded in typed arrays. Copy buffer
22146
22155
  // TODO - remove when `parse` is fixed to handle `byteOffset`s
22147
22156
  bufferCopy=sliceArrayBuffer(buffer.buffer,buffer.byteOffset);// , buffer.byteLength);
22148
22157
  dracoOptions=_objectSpread({},options);// TODO - remove hack: The entire tileset might be included, too expensive to serialize
22149
22158
  delete dracoOptions['3d-tiles'];_context55.next=9;return parseFromContext(bufferCopy,DracoLoader,dracoOptions,context);case 9:decodedData=_context55.sent;decodedAttributes=getGLTFAccessors(decodedData.attributes);// Restore min/max values
22150
- for(_i424=0,_Object$entries8=Object.entries(decodedAttributes);_i424<_Object$entries8.length;_i424++){_Object$entries8$_i=_slicedToArray(_Object$entries8[_i424],2),attributeName=_Object$entries8$_i[0],decodedAttribute=_Object$entries8$_i[1];if(attributeName in primitive.attributes){accessorIndex=primitive.attributes[attributeName];accessor=scenegraph.getAccessor(accessorIndex);if(accessor!==null&&accessor!==void 0&&accessor.min&&accessor!==null&&accessor!==void 0&&accessor.max){decodedAttribute.min=accessor.min;decodedAttribute.max=accessor.max;}}}// @ts-ignore
22159
+ for(_i426=0,_Object$entries8=Object.entries(decodedAttributes);_i426<_Object$entries8.length;_i426++){_Object$entries8$_i=_slicedToArray(_Object$entries8[_i426],2),attributeName=_Object$entries8$_i[0],decodedAttribute=_Object$entries8$_i[1];if(attributeName in primitive.attributes){accessorIndex=primitive.attributes[attributeName];accessor=scenegraph.getAccessor(accessorIndex);if(accessor!==null&&accessor!==void 0&&accessor.min&&accessor!==null&&accessor!==void 0&&accessor.max){decodedAttribute.min=accessor.min;decodedAttribute.max=accessor.max;}}}// @ts-ignore
22151
22160
  primitive.attributes=decodedAttributes;if(decodedData.indices){// @ts-ignore
22152
22161
  primitive.indices=getGLTFAccessor(decodedData.indices);}// Extension has been processed, delete it
22153
22162
  scenegraph.removeObjectExtension(primitive,KHR_DRACO_MESH_COMPRESSION);checkPrimitive(primitive);case 16:case"end":return _context55.stop();}}},_callee51);}));return _decompressPrimitive.apply(this,arguments);}function compressMesh(attributes,indices){var _context$parseSync;var mode=arguments.length>2&&arguments[2]!==undefined?arguments[2]:4;var options=arguments.length>3?arguments[3]:undefined;var context=arguments.length>4?arguments[4]:undefined;if(!options.DracoWriter){throw new Error('options.gltf.DracoWriter not provided');}// TODO - use DracoWriter using encode w/ registered DracoWriter...
@@ -22181,8 +22190,8 @@ return"".concat(parseFloat(value.toPrecision(precision)));}/**
22181
22190
  * @param b
22182
22191
  * @param epsilon
22183
22192
  * @returns
22184
- */function _equals(a,b,epsilon){var oldEpsilon=config.EPSILON;if(epsilon){config.EPSILON=epsilon;}try{if(a===b){return true;}if(isArray(a)&&isArray(b)){if(a.length!==b.length){return false;}for(var _i259=0;_i259<a.length;++_i259){// eslint-disable-next-line max-depth
22185
- if(!_equals(a[_i259],b[_i259])){return false;}}return true;}if(a&&a.equals){return a.equals(b);}if(b&&b.equals){return b.equals(a);}if(typeof a==='number'&&typeof b==='number'){return Math.abs(a-b)<=config.EPSILON*Math.max(1,Math.abs(a),Math.abs(b));}return false;}finally{config.EPSILON=oldEpsilon;}}// HELPERS
22193
+ */function _equals(a,b,epsilon){var oldEpsilon=config.EPSILON;if(epsilon){config.EPSILON=epsilon;}try{if(a===b){return true;}if(isArray(a)&&isArray(b)){if(a.length!==b.length){return false;}for(var _i261=0;_i261<a.length;++_i261){// eslint-disable-next-line max-depth
22194
+ if(!_equals(a[_i261],b[_i261])){return false;}}return true;}if(a&&a.equals){return a.equals(b);}if(b&&b.equals){return b.equals(a);}if(typeof a==='number'&&typeof b==='number'){return Math.abs(a-b)<=config.EPSILON*Math.max(1,Math.abs(a),Math.abs(b));}return false;}finally{config.EPSILON=oldEpsilon;}}// HELPERS
22186
22195
  function round(value){return Math.round(value/config.EPSILON)*config.EPSILON;}// math.gl
22187
22196
  /** Base class for vectors and matrices */var MathArray=/*#__PURE__*/function(_Array){_inherits(MathArray,_Array);var _super61=_createSuper(MathArray);function MathArray(){_classCallCheck(this,MathArray);return _super61.apply(this,arguments);}_createClass(MathArray,[{key:"clone",value:// Common methods
22188
22197
  /**
@@ -22190,20 +22199,20 @@ function round(value){return Math.round(value/config.EPSILON)*config.EPSILON;}//
22190
22199
  * @returns a new copy of this object
22191
22200
  */function clone(){// @ts-expect-error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature.
22192
22201
  return new this.constructor().copy(this);// eslint-disable-line
22193
- }},{key:"fromArray",value:function fromArray(array){var offset=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0;for(var _i260=0;_i260<this.ELEMENTS;++_i260){this[_i260]=array[_i260+offset];}return this.check();}},{key:"toArray",value:function toArray(){var targetArray=arguments.length>0&&arguments[0]!==undefined?arguments[0]:[];var offset=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0;for(var _i261=0;_i261<this.ELEMENTS;++_i261){targetArray[offset+_i261]=this[_i261];}return targetArray;}},{key:"toObject",value:function toObject(targetObject){return targetObject;}},{key:"from",value:function from(arrayOrObject){return Array.isArray(arrayOrObject)?this.copy(arrayOrObject):// @ts-ignore
22202
+ }},{key:"fromArray",value:function fromArray(array){var offset=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0;for(var _i262=0;_i262<this.ELEMENTS;++_i262){this[_i262]=array[_i262+offset];}return this.check();}},{key:"toArray",value:function toArray(){var targetArray=arguments.length>0&&arguments[0]!==undefined?arguments[0]:[];var offset=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0;for(var _i263=0;_i263<this.ELEMENTS;++_i263){targetArray[offset+_i263]=this[_i263];}return targetArray;}},{key:"toObject",value:function toObject(targetObject){return targetObject;}},{key:"from",value:function from(arrayOrObject){return Array.isArray(arrayOrObject)?this.copy(arrayOrObject):// @ts-ignore
22194
22203
  this.fromObject(arrayOrObject);}},{key:"to",value:function to(arrayOrObject){// @ts-ignore
22195
22204
  if(arrayOrObject===this){return this;}// @ts-expect-error TS2339: Property 'toObject' does not exist on type 'MathArray'.
22196
- return isArray(arrayOrObject)?this.toArray(arrayOrObject):this.toObject(arrayOrObject);}},{key:"toTarget",value:function toTarget(target){return target?this.to(target):this;}/** @deprecated */},{key:"toFloat32Array",value:function toFloat32Array(){return new Float32Array(this);}},{key:"toString",value:function toString(){return this.formatString(config);}/** Formats string according to options */},{key:"formatString",value:function formatString(opts){var string='';for(var _i262=0;_i262<this.ELEMENTS;++_i262){string+=(_i262>0?', ':'')+formatValue(this[_i262],opts);}return"".concat(opts.printTypes?this.constructor.name:'',"[").concat(string,"]");}},{key:"equals",value:function equals(array){if(!array||this.length!==array.length){return false;}for(var _i263=0;_i263<this.ELEMENTS;++_i263){if(!_equals(this[_i263],array[_i263])){return false;}}return true;}},{key:"exactEquals",value:function exactEquals(array){if(!array||this.length!==array.length){return false;}for(var _i264=0;_i264<this.ELEMENTS;++_i264){if(this[_i264]!==array[_i264]){return false;}}return true;}// Modifiers
22197
- /** Negates all values in this object */},{key:"negate",value:function negate(){for(var _i265=0;_i265<this.ELEMENTS;++_i265){this[_i265]=-this[_i265];}return this.check();}},{key:"lerp",value:function lerp(a,b,t){if(t===undefined){return this.lerp(this,a,b);}for(var _i266=0;_i266<this.ELEMENTS;++_i266){var ai=a[_i266];var endValue=typeof b==='number'?b:b[_i266];this[_i266]=ai+t*(endValue-ai);}return this.check();}/** Minimal */},{key:"min",value:function min(vector){for(var _i267=0;_i267<this.ELEMENTS;++_i267){this[_i267]=Math.min(vector[_i267],this[_i267]);}return this.check();}/** Maximal */},{key:"max",value:function max(vector){for(var _i268=0;_i268<this.ELEMENTS;++_i268){this[_i268]=Math.max(vector[_i268],this[_i268]);}return this.check();}},{key:"clamp",value:function clamp(minVector,maxVector){for(var _i269=0;_i269<this.ELEMENTS;++_i269){this[_i269]=Math.min(Math.max(this[_i269],minVector[_i269]),maxVector[_i269]);}return this.check();}},{key:"add",value:function add(){for(var _len37=arguments.length,vectors=new Array(_len37),_key9=0;_key9<_len37;_key9++){vectors[_key9]=arguments[_key9];}for(var _i270=0,_vectors=vectors;_i270<_vectors.length;_i270++){var vector=_vectors[_i270];for(var _i271=0;_i271<this.ELEMENTS;++_i271){this[_i271]+=vector[_i271];}}return this.check();}},{key:"subtract",value:function subtract(){for(var _len38=arguments.length,vectors=new Array(_len38),_key10=0;_key10<_len38;_key10++){vectors[_key10]=arguments[_key10];}for(var _i272=0,_vectors2=vectors;_i272<_vectors2.length;_i272++){var vector=_vectors2[_i272];for(var _i273=0;_i273<this.ELEMENTS;++_i273){this[_i273]-=vector[_i273];}}return this.check();}},{key:"scale",value:function scale(_scale3){if(typeof _scale3==='number'){for(var _i274=0;_i274<this.ELEMENTS;++_i274){this[_i274]*=_scale3;}}else{for(var _i275=0;_i275<this.ELEMENTS&&_i275<_scale3.length;++_i275){this[_i275]*=_scale3[_i275];}}return this.check();}/**
22205
+ return isArray(arrayOrObject)?this.toArray(arrayOrObject):this.toObject(arrayOrObject);}},{key:"toTarget",value:function toTarget(target){return target?this.to(target):this;}/** @deprecated */},{key:"toFloat32Array",value:function toFloat32Array(){return new Float32Array(this);}},{key:"toString",value:function toString(){return this.formatString(config);}/** Formats string according to options */},{key:"formatString",value:function formatString(opts){var string='';for(var _i264=0;_i264<this.ELEMENTS;++_i264){string+=(_i264>0?', ':'')+formatValue(this[_i264],opts);}return"".concat(opts.printTypes?this.constructor.name:'',"[").concat(string,"]");}},{key:"equals",value:function equals(array){if(!array||this.length!==array.length){return false;}for(var _i265=0;_i265<this.ELEMENTS;++_i265){if(!_equals(this[_i265],array[_i265])){return false;}}return true;}},{key:"exactEquals",value:function exactEquals(array){if(!array||this.length!==array.length){return false;}for(var _i266=0;_i266<this.ELEMENTS;++_i266){if(this[_i266]!==array[_i266]){return false;}}return true;}// Modifiers
22206
+ /** Negates all values in this object */},{key:"negate",value:function negate(){for(var _i267=0;_i267<this.ELEMENTS;++_i267){this[_i267]=-this[_i267];}return this.check();}},{key:"lerp",value:function lerp(a,b,t){if(t===undefined){return this.lerp(this,a,b);}for(var _i268=0;_i268<this.ELEMENTS;++_i268){var ai=a[_i268];var endValue=typeof b==='number'?b:b[_i268];this[_i268]=ai+t*(endValue-ai);}return this.check();}/** Minimal */},{key:"min",value:function min(vector){for(var _i269=0;_i269<this.ELEMENTS;++_i269){this[_i269]=Math.min(vector[_i269],this[_i269]);}return this.check();}/** Maximal */},{key:"max",value:function max(vector){for(var _i270=0;_i270<this.ELEMENTS;++_i270){this[_i270]=Math.max(vector[_i270],this[_i270]);}return this.check();}},{key:"clamp",value:function clamp(minVector,maxVector){for(var _i271=0;_i271<this.ELEMENTS;++_i271){this[_i271]=Math.min(Math.max(this[_i271],minVector[_i271]),maxVector[_i271]);}return this.check();}},{key:"add",value:function add(){for(var _len37=arguments.length,vectors=new Array(_len37),_key9=0;_key9<_len37;_key9++){vectors[_key9]=arguments[_key9];}for(var _i272=0,_vectors=vectors;_i272<_vectors.length;_i272++){var vector=_vectors[_i272];for(var _i273=0;_i273<this.ELEMENTS;++_i273){this[_i273]+=vector[_i273];}}return this.check();}},{key:"subtract",value:function subtract(){for(var _len38=arguments.length,vectors=new Array(_len38),_key10=0;_key10<_len38;_key10++){vectors[_key10]=arguments[_key10];}for(var _i274=0,_vectors2=vectors;_i274<_vectors2.length;_i274++){var vector=_vectors2[_i274];for(var _i275=0;_i275<this.ELEMENTS;++_i275){this[_i275]-=vector[_i275];}}return this.check();}},{key:"scale",value:function scale(_scale3){if(typeof _scale3==='number'){for(var _i276=0;_i276<this.ELEMENTS;++_i276){this[_i276]*=_scale3;}}else{for(var _i277=0;_i277<this.ELEMENTS&&_i277<_scale3.length;++_i277){this[_i277]*=_scale3[_i277];}}return this.check();}/**
22198
22207
  * Multiplies all elements by `scale`
22199
22208
  * Note: `Matrix4.multiplyByScalar` only scales its 3x3 "minor"
22200
- */},{key:"multiplyByScalar",value:function multiplyByScalar(scalar){for(var _i276=0;_i276<this.ELEMENTS;++_i276){this[_i276]*=scalar;}return this.check();}// Debug checks
22201
- /** Throws an error if array length is incorrect or contains illegal values */},{key:"check",value:function check(){if(config.debug&&!this.validate()){throw new Error("math.gl: ".concat(this.constructor.name," some fields set to invalid numbers'"));}return this;}/** Returns false if the array length is incorrect or contains illegal values */},{key:"validate",value:function validate(){var valid=this.length===this.ELEMENTS;for(var _i277=0;_i277<this.ELEMENTS;++_i277){valid=valid&&Number.isFinite(this[_i277]);}return valid;}// three.js compatibility
22202
- /** @deprecated */},{key:"sub",value:function sub(a){return this.subtract(a);}/** @deprecated */},{key:"setScalar",value:function setScalar(a){for(var _i278=0;_i278<this.ELEMENTS;++_i278){this[_i278]=a;}return this.check();}/** @deprecated */},{key:"addScalar",value:function addScalar(a){for(var _i279=0;_i279<this.ELEMENTS;++_i279){this[_i279]+=a;}return this.check();}/** @deprecated */},{key:"subScalar",value:function subScalar(a){return this.addScalar(-a);}/** @deprecated */},{key:"multiplyScalar",value:function multiplyScalar(scalar){// Multiplies all elements
22209
+ */},{key:"multiplyByScalar",value:function multiplyByScalar(scalar){for(var _i278=0;_i278<this.ELEMENTS;++_i278){this[_i278]*=scalar;}return this.check();}// Debug checks
22210
+ /** Throws an error if array length is incorrect or contains illegal values */},{key:"check",value:function check(){if(config.debug&&!this.validate()){throw new Error("math.gl: ".concat(this.constructor.name," some fields set to invalid numbers'"));}return this;}/** Returns false if the array length is incorrect or contains illegal values */},{key:"validate",value:function validate(){var valid=this.length===this.ELEMENTS;for(var _i279=0;_i279<this.ELEMENTS;++_i279){valid=valid&&Number.isFinite(this[_i279]);}return valid;}// three.js compatibility
22211
+ /** @deprecated */},{key:"sub",value:function sub(a){return this.subtract(a);}/** @deprecated */},{key:"setScalar",value:function setScalar(a){for(var _i280=0;_i280<this.ELEMENTS;++_i280){this[_i280]=a;}return this.check();}/** @deprecated */},{key:"addScalar",value:function addScalar(a){for(var _i281=0;_i281<this.ELEMENTS;++_i281){this[_i281]+=a;}return this.check();}/** @deprecated */},{key:"subScalar",value:function subScalar(a){return this.addScalar(-a);}/** @deprecated */},{key:"multiplyScalar",value:function multiplyScalar(scalar){// Multiplies all elements
22203
22212
  // `Matrix4.scale` only scales its 3x3 "minor"
22204
- for(var _i280=0;_i280<this.ELEMENTS;++_i280){this[_i280]*=scalar;}return this.check();}/** @deprecated */},{key:"divideScalar",value:function divideScalar(a){return this.multiplyByScalar(1/a);}/** @deprecated */},{key:"clampScalar",value:function clampScalar(min,max){for(var _i281=0;_i281<this.ELEMENTS;++_i281){this[_i281]=Math.min(Math.max(this[_i281],min),max);}return this.check();}/** @deprecated */},{key:"elements",get:function get(){return this;}}]);return MathArray;}(/*#__PURE__*/_wrapNativeSuper(Array));// math.gl
22213
+ for(var _i282=0;_i282<this.ELEMENTS;++_i282){this[_i282]*=scalar;}return this.check();}/** @deprecated */},{key:"divideScalar",value:function divideScalar(a){return this.multiplyByScalar(1/a);}/** @deprecated */},{key:"clampScalar",value:function clampScalar(min,max){for(var _i283=0;_i283<this.ELEMENTS;++_i283){this[_i283]=Math.min(Math.max(this[_i283],min),max);}return this.check();}/** @deprecated */},{key:"elements",get:function get(){return this;}}]);return MathArray;}(/*#__PURE__*/_wrapNativeSuper(Array));// math.gl
22205
22214
  function validateVector(v,length){if(v.length!==length){return false;}// Could be arguments "array" (v.every not availasble)
22206
- for(var _i282=0;_i282<v.length;++_i282){if(!Number.isFinite(v[_i282])){return false;}}return true;}function checkNumber(value){if(!Number.isFinite(value)){throw new Error("Invalid number ".concat(JSON.stringify(value)));}return value;}function checkVector(v,length){var callerName=arguments.length>2&&arguments[2]!==undefined?arguments[2]:'';if(config.debug&&!validateVector(v,length)){throw new Error("math.gl: ".concat(callerName," some fields set to invalid numbers'"));}return v;}// math.gl
22215
+ for(var _i284=0;_i284<v.length;++_i284){if(!Number.isFinite(v[_i284])){return false;}}return true;}function checkNumber(value){if(!Number.isFinite(value)){throw new Error("Invalid number ".concat(JSON.stringify(value)));}return value;}function checkVector(v,length){var callerName=arguments.length>2&&arguments[2]!==undefined?arguments[2]:'';if(config.debug&&!validateVector(v,length)){throw new Error("math.gl: ".concat(callerName," some fields set to invalid numbers'"));}return v;}// math.gl
22207
22216
  // SPDX-License-Identifier: MIT
22208
22217
  // Copyright (c) vis.gl contributors
22209
22218
  function assert(condition,message){if(!condition){throw new Error("math.gl assertion ".concat(message));}}// math.gl
@@ -22217,10 +22226,10 @@ function get(){return this[0];},set:function set(value){this[0]=checkNumber(valu
22217
22226
  * Returns the length of the vector from the origin to the point described by this vector
22218
22227
  */},{key:"magnitude",value:function magnitude(){return this.len();}/**
22219
22228
  * Returns the squared length of the vector from the origin to the point described by this vector
22220
- */},{key:"lengthSquared",value:function lengthSquared(){var length=0;for(var _i283=0;_i283<this.ELEMENTS;++_i283){length+=this[_i283]*this[_i283];}return length;}/**
22229
+ */},{key:"lengthSquared",value:function lengthSquared(){var length=0;for(var _i285=0;_i285<this.ELEMENTS;++_i285){length+=this[_i285]*this[_i285];}return length;}/**
22221
22230
  * Returns the squared length of the vector from the origin to the point described by this vector
22222
- */},{key:"magnitudeSquared",value:function magnitudeSquared(){return this.lengthSquared();}},{key:"distance",value:function distance(mathArray){return Math.sqrt(this.distanceSquared(mathArray));}},{key:"distanceSquared",value:function distanceSquared(mathArray){var length=0;for(var _i284=0;_i284<this.ELEMENTS;++_i284){var dist=this[_i284]-mathArray[_i284];length+=dist*dist;}return checkNumber(length);}},{key:"dot",value:function dot(mathArray){var product=0;for(var _i285=0;_i285<this.ELEMENTS;++_i285){product+=this[_i285]*mathArray[_i285];}return checkNumber(product);}// MODIFIERS
22223
- },{key:"normalize",value:function normalize(){var length=this.magnitude();if(length!==0){for(var _i286=0;_i286<this.ELEMENTS;++_i286){this[_i286]/=length;}}return this.check();}},{key:"multiply",value:function multiply(){for(var _len39=arguments.length,vectors=new Array(_len39),_key11=0;_key11<_len39;_key11++){vectors[_key11]=arguments[_key11];}for(var _i287=0,_vectors3=vectors;_i287<_vectors3.length;_i287++){var vector=_vectors3[_i287];for(var _i288=0;_i288<this.ELEMENTS;++_i288){this[_i288]*=vector[_i288];}}return this.check();}},{key:"divide",value:function divide(){for(var _len40=arguments.length,vectors=new Array(_len40),_key12=0;_key12<_len40;_key12++){vectors[_key12]=arguments[_key12];}for(var _i289=0,_vectors4=vectors;_i289<_vectors4.length;_i289++){var vector=_vectors4[_i289];for(var _i290=0;_i290<this.ELEMENTS;++_i290){this[_i290]/=vector[_i290];}}return this.check();}// THREE.js compatibility
22231
+ */},{key:"magnitudeSquared",value:function magnitudeSquared(){return this.lengthSquared();}},{key:"distance",value:function distance(mathArray){return Math.sqrt(this.distanceSquared(mathArray));}},{key:"distanceSquared",value:function distanceSquared(mathArray){var length=0;for(var _i286=0;_i286<this.ELEMENTS;++_i286){var dist=this[_i286]-mathArray[_i286];length+=dist*dist;}return checkNumber(length);}},{key:"dot",value:function dot(mathArray){var product=0;for(var _i287=0;_i287<this.ELEMENTS;++_i287){product+=this[_i287]*mathArray[_i287];}return checkNumber(product);}// MODIFIERS
22232
+ },{key:"normalize",value:function normalize(){var length=this.magnitude();if(length!==0){for(var _i288=0;_i288<this.ELEMENTS;++_i288){this[_i288]/=length;}}return this.check();}},{key:"multiply",value:function multiply(){for(var _len39=arguments.length,vectors=new Array(_len39),_key11=0;_key11<_len39;_key11++){vectors[_key11]=arguments[_key11];}for(var _i289=0,_vectors3=vectors;_i289<_vectors3.length;_i289++){var vector=_vectors3[_i289];for(var _i290=0;_i290<this.ELEMENTS;++_i290){this[_i290]*=vector[_i290];}}return this.check();}},{key:"divide",value:function divide(){for(var _len40=arguments.length,vectors=new Array(_len40),_key12=0;_key12<_len40;_key12++){vectors[_key12]=arguments[_key12];}for(var _i291=0,_vectors4=vectors;_i291<_vectors4.length;_i291++){var vector=_vectors4[_i291];for(var _i292=0;_i292<this.ELEMENTS;++_i292){this[_i292]/=vector[_i292];}}return this.check();}// THREE.js compatibility
22224
22233
  },{key:"lengthSq",value:function lengthSq(){return this.lengthSquared();}},{key:"distanceTo",value:function distanceTo(vector){return this.distance(vector);}},{key:"distanceToSquared",value:function distanceToSquared(vector){return this.distanceSquared(vector);}},{key:"getComponent",value:function getComponent(i){assert(i>=0&&i<this.ELEMENTS,'index is out of range');return checkNumber(this[i]);}},{key:"setComponent",value:function setComponent(i,value){assert(i>=0&&i<this.ELEMENTS,'index is out of range');this[i]=value;return this.check();}},{key:"addVectors",value:function addVectors(a,b){return this.copy(a).add(b);}},{key:"subVectors",value:function subVectors(a,b){return this.copy(a).subtract(b);}},{key:"multiplyVectors",value:function multiplyVectors(a,b){return this.copy(a).multiply(b);}},{key:"addScaledVector",value:function addScaledVector(a,b){// @ts-expect-error error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature.
22225
22234
  return this.add(new this.constructor(a).multiplyScalar(b));}}]);return Vector$1;}(MathArray);// @eslint-disable
22226
22235
  var ARRAY_TYPE=typeof Float32Array!=='undefined'?Float32Array:Array;// @eslint-disable
@@ -22380,9 +22389,9 @@ _this112[0]=x;_this112[1]=y;_this112[2]=z;}return _this112;}_createClass(Vector3
22380
22389
  // return object;
22381
22390
  // }
22382
22391
  // TODO better override formatString?
22383
- function toString(){var string='[';if(config.printRowMajor){string+='row-major:';for(var row=0;row<this.RANK;++row){for(var col=0;col<this.RANK;++col){string+=" ".concat(this[col*this.RANK+row]);}}}else{string+='column-major:';for(var _i291=0;_i291<this.ELEMENTS;++_i291){string+=" ".concat(this[_i291]);}}string+=']';return string;}},{key:"getElementIndex",value:function getElementIndex(row,col){return col*this.RANK+row;}// By default assumes row major indices
22392
+ function toString(){var string='[';if(config.printRowMajor){string+='row-major:';for(var row=0;row<this.RANK;++row){for(var col=0;col<this.RANK;++col){string+=" ".concat(this[col*this.RANK+row]);}}}else{string+='column-major:';for(var _i293=0;_i293<this.ELEMENTS;++_i293){string+=" ".concat(this[_i293]);}}string+=']';return string;}},{key:"getElementIndex",value:function getElementIndex(row,col){return col*this.RANK+row;}// By default assumes row major indices
22384
22393
  },{key:"getElement",value:function getElement(row,col){return this[col*this.RANK+row];}// By default assumes row major indices
22385
- },{key:"setElement",value:function setElement(row,col,value){this[col*this.RANK+row]=checkNumber(value);return this;}},{key:"getColumn",value:function getColumn(columnIndex){var result=arguments.length>1&&arguments[1]!==undefined?arguments[1]:new Array(this.RANK).fill(-0);var firstIndex=columnIndex*this.RANK;for(var _i292=0;_i292<this.RANK;++_i292){result[_i292]=this[firstIndex+_i292];}return result;}},{key:"setColumn",value:function setColumn(columnIndex,columnVector){var firstIndex=columnIndex*this.RANK;for(var _i293=0;_i293<this.RANK;++_i293){this[firstIndex+_i293]=columnVector[_i293];}return this;}}]);return Matrix;}(MathArray);/**
22394
+ },{key:"setElement",value:function setElement(row,col,value){this[col*this.RANK+row]=checkNumber(value);return this;}},{key:"getColumn",value:function getColumn(columnIndex){var result=arguments.length>1&&arguments[1]!==undefined?arguments[1]:new Array(this.RANK).fill(-0);var firstIndex=columnIndex*this.RANK;for(var _i294=0;_i294<this.RANK;++_i294){result[_i294]=this[firstIndex+_i294];}return result;}},{key:"setColumn",value:function setColumn(columnIndex,columnVector){var firstIndex=columnIndex*this.RANK;for(var _i295=0;_i295<this.RANK;++_i295){this[firstIndex+_i295]=columnVector[_i295];}return this;}}]);return Matrix;}(MathArray);/**
22386
22395
  * Transpose the values of a mat3
22387
22396
  *
22388
22397
  * @param {mat3} out the receiving matrix
@@ -22471,8 +22480,8 @@ this[0]=array[0];this[1]=array[1];this[2]=array[2];this[3]=array[3];this[4]=arra
22471
22480
  * Transform TEXCOORD by material
22472
22481
  * @param materialIndex processing material index
22473
22482
  * @param gltfData gltf buffers and json
22474
- */function _decode$4(){_decode$4=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee52(gltfData,options){var _options$gltf11;var gltfScenegraph,hasExtension,materials,_i425;return _regeneratorRuntime().wrap(function _callee52$(_context56){while(1){switch(_context56.prev=_context56.next){case 0:gltfScenegraph=new GLTFScenegraph(gltfData);hasExtension=gltfScenegraph.hasExtension(KHR_TEXTURE_TRANSFORM);if(!(!hasExtension||!((_options$gltf11=options.gltf)!==null&&_options$gltf11!==void 0&&_options$gltf11.loadBuffers))){_context56.next=4;break;}return _context56.abrupt("return");case 4:materials=gltfData.json.materials||[];for(_i425=0;_i425<materials.length;_i425++){transformTexCoords(_i425,gltfData);}case 6:case"end":return _context56.stop();}}},_callee52);}));return _decode$4.apply(this,arguments);}function transformTexCoords(materialIndex,gltfData){var _gltfData$json$materi,_material$pbrMetallic,_material$pbrMetallic2;var material=(_gltfData$json$materi=gltfData.json.materials)===null||_gltfData$json$materi===void 0?void 0:_gltfData$json$materi[materialIndex];var materialTextures=[material===null||material===void 0?void 0:(_material$pbrMetallic=material.pbrMetallicRoughness)===null||_material$pbrMetallic===void 0?void 0:_material$pbrMetallic.baseColorTexture,material===null||material===void 0?void 0:material.emissiveTexture,material===null||material===void 0?void 0:material.normalTexture,material===null||material===void 0?void 0:material.occlusionTexture,material===null||material===void 0?void 0:(_material$pbrMetallic2=material.pbrMetallicRoughness)===null||_material$pbrMetallic2===void 0?void 0:_material$pbrMetallic2.metallicRoughnessTexture];// Save processed texCoords in order no to process the same twice
22475
- var processedTexCoords=[];for(var _i294=0,_materialTextures=materialTextures;_i294<_materialTextures.length;_i294++){var _textureInfo$extensio;var textureInfo=_materialTextures[_i294];if(textureInfo&&textureInfo!==null&&textureInfo!==void 0&&(_textureInfo$extensio=textureInfo.extensions)!==null&&_textureInfo$extensio!==void 0&&_textureInfo$extensio[KHR_TEXTURE_TRANSFORM]){transformPrimitives(gltfData,materialIndex,textureInfo,processedTexCoords);}}}/**
22483
+ */function _decode$4(){_decode$4=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee52(gltfData,options){var _options$gltf11;var gltfScenegraph,hasExtension,materials,_i427;return _regeneratorRuntime().wrap(function _callee52$(_context56){while(1){switch(_context56.prev=_context56.next){case 0:gltfScenegraph=new GLTFScenegraph(gltfData);hasExtension=gltfScenegraph.hasExtension(KHR_TEXTURE_TRANSFORM);if(!(!hasExtension||!((_options$gltf11=options.gltf)!==null&&_options$gltf11!==void 0&&_options$gltf11.loadBuffers))){_context56.next=4;break;}return _context56.abrupt("return");case 4:materials=gltfData.json.materials||[];for(_i427=0;_i427<materials.length;_i427++){transformTexCoords(_i427,gltfData);}case 6:case"end":return _context56.stop();}}},_callee52);}));return _decode$4.apply(this,arguments);}function transformTexCoords(materialIndex,gltfData){var _gltfData$json$materi,_material$pbrMetallic,_material$pbrMetallic2;var material=(_gltfData$json$materi=gltfData.json.materials)===null||_gltfData$json$materi===void 0?void 0:_gltfData$json$materi[materialIndex];var materialTextures=[material===null||material===void 0?void 0:(_material$pbrMetallic=material.pbrMetallicRoughness)===null||_material$pbrMetallic===void 0?void 0:_material$pbrMetallic.baseColorTexture,material===null||material===void 0?void 0:material.emissiveTexture,material===null||material===void 0?void 0:material.normalTexture,material===null||material===void 0?void 0:material.occlusionTexture,material===null||material===void 0?void 0:(_material$pbrMetallic2=material.pbrMetallicRoughness)===null||_material$pbrMetallic2===void 0?void 0:_material$pbrMetallic2.metallicRoughnessTexture];// Save processed texCoords in order no to process the same twice
22484
+ var processedTexCoords=[];for(var _i296=0,_materialTextures=materialTextures;_i296<_materialTextures.length;_i296++){var _textureInfo$extensio;var textureInfo=_materialTextures[_i296];if(textureInfo&&textureInfo!==null&&textureInfo!==void 0&&(_textureInfo$extensio=textureInfo.extensions)!==null&&_textureInfo$extensio!==void 0&&_textureInfo$extensio[KHR_TEXTURE_TRANSFORM]){transformPrimitives(gltfData,materialIndex,textureInfo,processedTexCoords);}}}/**
22476
22485
  * Transform primitives of the particular material
22477
22486
  * @param gltfData gltf data
22478
22487
  * @param materialIndex primitives with this material will be transformed
@@ -22499,10 +22508,10 @@ var _getAccessorArrayType2=getAccessorArrayTypeAndLength(accessor,bufferView),Ar
22499
22508
  var bytes=BYTES$1[accessor.componentType];// Number of components. For the `TEXCOORD_0` with `VEC2` type, it must return 2
22500
22509
  var components=COMPONENTS$1[accessor.type];// Multiplier to calculate the address of the `TEXCOORD_0` element in the arrayBuffer
22501
22510
  var elementAddressScale=bufferView.byteStride||bytes*components;// Data transform to Float32Array
22502
- var result=new Float32Array(length);for(var _i295=0;_i295<accessor.count;_i295++){// Take [u, v] couple from the arrayBuffer
22503
- var uv=new ArrayType(arrayBuffer,byteOffset+_i295*elementAddressScale,2);// Set and transform Vector3 per https://github.com/KhronosGroup/glTF/tree/main/extensions/2.0/Khronos/KHR_texture_transform#overview
22511
+ var result=new Float32Array(length);for(var _i297=0;_i297<accessor.count;_i297++){// Take [u, v] couple from the arrayBuffer
22512
+ var uv=new ArrayType(arrayBuffer,byteOffset+_i297*elementAddressScale,2);// Set and transform Vector3 per https://github.com/KhronosGroup/glTF/tree/main/extensions/2.0/Khronos/KHR_texture_transform#overview
22504
22513
  scratchVector.set(uv[0],uv[1],1);scratchVector.transformByMatrix3(matrix);// Save result in Float32Array
22505
- result.set([scratchVector[0],scratchVector[1]],_i295*components);}// If texCoord the same, replace gltf structural data
22514
+ result.set([scratchVector[0],scratchVector[1]],_i297*components);}// If texCoord the same, replace gltf structural data
22506
22515
  if(originalTexCoord===texCoord){updateGltf(accessor,bufferView,gltfData.buffers,result);}else{// If texCoord change, create new attribute
22507
22516
  createAttribute(texCoord,accessor,primitive,gltfData,result);}}}}}/**
22508
22517
  * Update GLTF structural objects with new data as we create new `Float32Array` for `TEXCOORD_0`.
@@ -22686,8 +22695,8 @@ var images=gltf.json.images||[];gltf.images=new Array(images.length).fill({});}/
22686
22695
  * @param options
22687
22696
  * @param context
22688
22697
  * @returns
22689
- */function _loadBuffers(){_loadBuffers=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee60(gltf,options,context){var buffers,_i426,buffer,_context$fetch,_response$arrayBuffer,_fetch,uri,response,arrayBuffer;return _regeneratorRuntime().wrap(function _callee60$(_context64){while(1){switch(_context64.prev=_context64.next){case 0:// TODO
22690
- buffers=gltf.json.buffers||[];_i426=0;case 2:if(!(_i426<buffers.length)){_context64.next=22;break;}buffer=buffers[_i426];if(!buffer.uri){_context64.next=18;break;}_fetch=context.fetch;assert$1(_fetch);uri=resolveUrl(buffer.uri,options);_context64.next=10;return context===null||context===void 0?void 0:(_context$fetch=context.fetch)===null||_context$fetch===void 0?void 0:_context$fetch.call(context,uri);case 10:response=_context64.sent;_context64.next=13;return response===null||response===void 0?void 0:(_response$arrayBuffer=response.arrayBuffer)===null||_response$arrayBuffer===void 0?void 0:_response$arrayBuffer.call(response);case 13:arrayBuffer=_context64.sent;gltf.buffers[_i426]={arrayBuffer:arrayBuffer,byteOffset:0,byteLength:arrayBuffer.byteLength};delete buffer.uri;_context64.next=19;break;case 18:if(gltf.buffers[_i426]===null){gltf.buffers[_i426]={arrayBuffer:new ArrayBuffer(buffer.byteLength),byteOffset:0,byteLength:buffer.byteLength};}case 19:++_i426;_context64.next=2;break;case 22:case"end":return _context64.stop();}}},_callee60);}));return _loadBuffers.apply(this,arguments);}function loadImages(_x104,_x105,_x106){return _loadImages.apply(this,arguments);}/** Make sure we only load images that are actually referenced by textures */function _loadImages(){_loadImages=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee61(gltf,options,context){var imageIndices,images,promises,_iterator76,_step76,imageIndex;return _regeneratorRuntime().wrap(function _callee61$(_context65){while(1){switch(_context65.prev=_context65.next){case 0:imageIndices=getReferencesImageIndices(gltf);images=gltf.json.images||[];promises=[];_iterator76=_createForOfIteratorHelper(imageIndices);try{for(_iterator76.s();!(_step76=_iterator76.n()).done;){imageIndex=_step76.value;promises.push(loadImage(gltf,images[imageIndex],imageIndex,options,context));}}catch(err){_iterator76.e(err);}finally{_iterator76.f();}_context65.next=7;return Promise.all(promises);case 7:return _context65.abrupt("return",_context65.sent);case 8:case"end":return _context65.stop();}}},_callee61);}));return _loadImages.apply(this,arguments);}function getReferencesImageIndices(gltf){var imageIndices=new Set();var textures=gltf.json.textures||[];var _iterator58=_createForOfIteratorHelper(textures),_step58;try{for(_iterator58.s();!(_step58=_iterator58.n()).done;){var texture=_step58.value;if(texture.source!==undefined){imageIndices.add(texture.source);}}}catch(err){_iterator58.e(err);}finally{_iterator58.f();}return Array.from(imageIndices).sort();}/** Asynchronously fetches and parses one image, store in images array outside of json */function loadImage(_x107,_x108,_x109,_x110,_x111){return _loadImage.apply(this,arguments);}/**
22698
+ */function _loadBuffers(){_loadBuffers=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee60(gltf,options,context){var buffers,_i428,buffer,_context$fetch,_response$arrayBuffer,_fetch,uri,response,arrayBuffer;return _regeneratorRuntime().wrap(function _callee60$(_context64){while(1){switch(_context64.prev=_context64.next){case 0:// TODO
22699
+ buffers=gltf.json.buffers||[];_i428=0;case 2:if(!(_i428<buffers.length)){_context64.next=22;break;}buffer=buffers[_i428];if(!buffer.uri){_context64.next=18;break;}_fetch=context.fetch;assert$1(_fetch);uri=resolveUrl(buffer.uri,options);_context64.next=10;return context===null||context===void 0?void 0:(_context$fetch=context.fetch)===null||_context$fetch===void 0?void 0:_context$fetch.call(context,uri);case 10:response=_context64.sent;_context64.next=13;return response===null||response===void 0?void 0:(_response$arrayBuffer=response.arrayBuffer)===null||_response$arrayBuffer===void 0?void 0:_response$arrayBuffer.call(response);case 13:arrayBuffer=_context64.sent;gltf.buffers[_i428]={arrayBuffer:arrayBuffer,byteOffset:0,byteLength:arrayBuffer.byteLength};delete buffer.uri;_context64.next=19;break;case 18:if(gltf.buffers[_i428]===null){gltf.buffers[_i428]={arrayBuffer:new ArrayBuffer(buffer.byteLength),byteOffset:0,byteLength:buffer.byteLength};}case 19:++_i428;_context64.next=2;break;case 22:case"end":return _context64.stop();}}},_callee60);}));return _loadBuffers.apply(this,arguments);}function loadImages(_x104,_x105,_x106){return _loadImages.apply(this,arguments);}/** Make sure we only load images that are actually referenced by textures */function _loadImages(){_loadImages=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee61(gltf,options,context){var imageIndices,images,promises,_iterator76,_step76,imageIndex;return _regeneratorRuntime().wrap(function _callee61$(_context65){while(1){switch(_context65.prev=_context65.next){case 0:imageIndices=getReferencesImageIndices(gltf);images=gltf.json.images||[];promises=[];_iterator76=_createForOfIteratorHelper(imageIndices);try{for(_iterator76.s();!(_step76=_iterator76.n()).done;){imageIndex=_step76.value;promises.push(loadImage(gltf,images[imageIndex],imageIndex,options,context));}}catch(err){_iterator76.e(err);}finally{_iterator76.f();}_context65.next=7;return Promise.all(promises);case 7:return _context65.abrupt("return",_context65.sent);case 8:case"end":return _context65.stop();}}},_callee61);}));return _loadImages.apply(this,arguments);}function getReferencesImageIndices(gltf){var imageIndices=new Set();var textures=gltf.json.textures||[];var _iterator58=_createForOfIteratorHelper(textures),_step58;try{for(_iterator58.s();!(_step58=_iterator58.n()).done;){var texture=_step58.value;if(texture.source!==undefined){imageIndices.add(texture.source);}}}catch(err){_iterator58.e(err);}finally{_iterator58.f();}return Array.from(imageIndices).sort();}/** Asynchronously fetches and parses one image, store in images array outside of json */function loadImage(_x107,_x108,_x109,_x110,_x111){return _loadImage.apply(this,arguments);}/**
22691
22700
  * GLTF loader
22692
22701
  */function _loadImage(){_loadImage=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee62(gltf,image,index,options,context){var arrayBuffer,uri,_fetch2,response,array,parsedImage;return _regeneratorRuntime().wrap(function _callee62$(_context66){while(1){switch(_context66.prev=_context66.next){case 0:if(!(image.uri&&!image.hasOwnProperty('bufferView'))){_context66.next=10;break;}uri=resolveUrl(image.uri,options);_fetch2=context.fetch;_context66.next=5;return _fetch2(uri);case 5:response=_context66.sent;_context66.next=8;return response.arrayBuffer();case 8:arrayBuffer=_context66.sent;image.bufferView={data:arrayBuffer};case 10:if(Number.isFinite(image.bufferView)){array=getTypedArrayForBufferView(gltf.json,gltf.buffers,image.bufferView);arrayBuffer=sliceArrayBuffer(array.buffer,array.byteOffset,array.byteLength);}assert$1(arrayBuffer,'glTF image has no data');// Call `parse`
22693
22702
  _context66.next=14;return parseFromContext(arrayBuffer,[ImageLoader,BasisLoader],_objectSpread(_objectSpread({},options),{},{mimeType:image.mimeType,basis:options.basis||{format:selectSupportedBasisFormat()}}),context);case 14:parsedImage=_context66.sent;if(parsedImage&&parsedImage[0]){parsedImage={compressed:true,// @ts-expect-error
@@ -22754,7 +22763,7 @@ if(accessor.bufferView){var buffer=accessor.bufferView.buffer;var _getAccessorAr
22754
22763
  * @param bytesPerElement
22755
22764
  * @param count
22756
22765
  * @returns
22757
- */},{key:"_getValueFromInterleavedBuffer",value:function _getValueFromInterleavedBuffer(buffer,byteOffset,byteStride,bytesPerElement,count){var result=new Uint8Array(count*bytesPerElement);for(var _i296=0;_i296<count;_i296++){var elementOffset=byteOffset+_i296*byteStride;result.set(new Uint8Array(buffer.arrayBuffer.slice(elementOffset,elementOffset+bytesPerElement)),_i296*bytesPerElement);}return result.buffer;}},{key:"_resolveTexture",value:function _resolveTexture(gltfTexture,index){return _objectSpread(_objectSpread({},gltfTexture),{},{// @ts-expect-error id could already be present, glTF standard does not prevent it
22766
+ */},{key:"_getValueFromInterleavedBuffer",value:function _getValueFromInterleavedBuffer(buffer,byteOffset,byteStride,bytesPerElement,count){var result=new Uint8Array(count*bytesPerElement);for(var _i298=0;_i298<count;_i298++){var elementOffset=byteOffset+_i298*byteStride;result.set(new Uint8Array(buffer.arrayBuffer.slice(elementOffset,elementOffset+bytesPerElement)),_i298*bytesPerElement);}return result.buffer;}},{key:"_resolveTexture",value:function _resolveTexture(gltfTexture,index){return _objectSpread(_objectSpread({},gltfTexture),{},{// @ts-expect-error id could already be present, glTF standard does not prevent it
22758
22767
  id:gltfTexture.id||"texture-".concat(index),sampler:typeof gltfTexture.sampler==='number'?this.getSampler(gltfTexture.sampler):makeDefaultSampler(),source:typeof gltfTexture.source==='number'?this.getImage(gltfTexture.source):undefined});}},{key:"_resolveSampler",value:function _resolveSampler(gltfSampler,index){var sampler=_objectSpread(_objectSpread({// @ts-expect-error id could already be present, glTF standard does not prevent it
22759
22768
  id:gltfSampler.id||"sampler-".concat(index)},gltfSampler),{},{parameters:{}});// Map textual parameters to GL parameter values
22760
22769
  for(var key in sampler){var glEnum=this._enumSamplerParameter(key);if(glEnum!==undefined){sampler.parameters[glEnum]=sampler[key];}}return sampler;}},{key:"_enumSamplerParameter",value:function _enumSamplerParameter(key){return SAMPLER_PARAMETER_GLTF_TO_GL[key];}},{key:"_resolveImage",value:function _resolveImage(gltfImage,index){var image=_objectSpread(_objectSpread({},gltfImage),{},{// @ts-expect-error id could already be present, glTF standard does not prevent it
@@ -22803,7 +22812,7 @@ asmGlobalArg,asmLibraryArg,buffer);var __ZSt18uncaught_exceptionv=Module['__ZSt1
22803
22812
  * @param offset
22804
22813
  * @param count
22805
22814
  * @returns number | number[] from incoming binary data
22806
- */function readAs(buf){var Type=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};var offset=arguments.length>2?arguments[2]:undefined;var count=arguments.length>3?arguments[3]:undefined;count=count===undefined||count===0?1:count;var sub=buf.slice(offset,offset+Type.BYTES_PER_ELEMENT*count);var r=new Type(sub);if(count===1){return r[0];}var ret=[];for(var _i297=0;_i297<count;_i297++){ret.push(r[_i297]);}return ret;}/**
22815
+ */function readAs(buf){var Type=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};var offset=arguments.length>2?arguments[2]:undefined;var count=arguments.length>3?arguments[3]:undefined;count=count===undefined||count===0?1:count;var sub=buf.slice(offset,offset+Type.BYTES_PER_ELEMENT*count);var r=new Type(sub);if(count===1){return r[0];}var ret=[];for(var _i299=0;_i299<count;_i299++){ret.push(r[_i299]);}return ret;}/**
22807
22816
  * Parsing of header's attributes
22808
22817
  * @param arraybuffer
22809
22818
  * @returns header as LASHeader
@@ -22823,7 +22832,7 @@ return true;}/**
22823
22832
  * @param count
22824
22833
  * @param skip
22825
22834
  * @returns new ArrayBuffer, count, hasMoreData
22826
- */},{key:"readData",value:function readData(count,skip){var header=this.header,arraybuffer=this.arraybuffer;if(!header){throw new Error('Cannot start reading data till a header request is issued');}var readOffset=this.readOffset;var start;if(skip<=1){count=Math.min(count,header.pointsCount-readOffset);start=header.pointsOffset+readOffset*header.pointsStructSize;var end=start+count*header.pointsStructSize;readOffset+=count;this.readOffset=readOffset;return{buffer:arraybuffer.slice(start,end),count:count,hasMoreData:readOffset<header.pointsCount};}var pointsToRead=Math.min(count*skip,header.pointsCount-readOffset);var bufferSize=Math.ceil(pointsToRead/skip);var pointsRead=0;var buf=new Uint8Array(bufferSize*header.pointsStructSize);for(var _i298=0;_i298<pointsToRead;_i298++){if(_i298%skip===0){start=header.pointsOffset+readOffset*header.pointsStructSize;var src=new Uint8Array(arraybuffer,start,header.pointsStructSize);buf.set(src,pointsRead*header.pointsStructSize);pointsRead++;}readOffset++;}this.readOffset=readOffset;return{buffer:buf.buffer,count:pointsRead,hasMoreData:readOffset<header.pointsCount};}/**
22835
+ */},{key:"readData",value:function readData(count,skip){var header=this.header,arraybuffer=this.arraybuffer;if(!header){throw new Error('Cannot start reading data till a header request is issued');}var readOffset=this.readOffset;var start;if(skip<=1){count=Math.min(count,header.pointsCount-readOffset);start=header.pointsOffset+readOffset*header.pointsStructSize;var end=start+count*header.pointsStructSize;readOffset+=count;this.readOffset=readOffset;return{buffer:arraybuffer.slice(start,end),count:count,hasMoreData:readOffset<header.pointsCount};}var pointsToRead=Math.min(count*skip,header.pointsCount-readOffset);var bufferSize=Math.ceil(pointsToRead/skip);var pointsRead=0;var buf=new Uint8Array(bufferSize*header.pointsStructSize);for(var _i300=0;_i300<pointsToRead;_i300++){if(_i300%skip===0){start=header.pointsOffset+readOffset*header.pointsStructSize;var src=new Uint8Array(arraybuffer,start,header.pointsStructSize);buf.set(src,pointsRead*header.pointsStructSize);pointsRead++;}readOffset++;}this.readOffset=readOffset;return{buffer:buf.buffer,count:pointsRead,hasMoreData:readOffset<header.pointsCount};}/**
22827
22836
  * Method which brings data to null to close the file
22828
22837
  * @returns
22829
22838
  */},{key:"close",value:function close(){// @ts-ignore Possibly null
@@ -22840,7 +22849,7 @@ Module=getModule();}}/**
22840
22849
  * @param offset
22841
22850
  * @param skip
22842
22851
  * @returns Data
22843
- */},{key:"readData",value:function readData(count,offset,skip){if(!this.instance){throw new Error('You need to open the file before trying to read stuff');}var header=this.header,instance=this.instance;if(!header){throw new Error('You need to query header before reading, I maintain state that way, sorry :(');}try{var pointsToRead=Math.min(count*skip,header.pointsCount-instance.readOffset);var bufferSize=Math.ceil(pointsToRead/skip);var pointsRead=0;var thisBuf=new Uint8Array(bufferSize*header.pointsStructSize);var bufRead=Module._malloc(header.pointsStructSize);for(var _i299=0;_i299<pointsToRead;_i299++){instance.getPoint(bufRead);if(_i299%skip===0){var _a6=new Uint8Array(Module.HEAPU8.buffer,bufRead,header.pointsStructSize);thisBuf.set(_a6,pointsRead*header.pointsStructSize);pointsRead++;}instance.readOffset++;}Module._free(bufRead);return{buffer:thisBuf.buffer,count:pointsRead,hasMoreData:instance.readOffset<header.pointsCount};}catch(error){throw new Error("Failed to read data: ".concat(error.message));}}/**
22852
+ */},{key:"readData",value:function readData(count,offset,skip){if(!this.instance){throw new Error('You need to open the file before trying to read stuff');}var header=this.header,instance=this.instance;if(!header){throw new Error('You need to query header before reading, I maintain state that way, sorry :(');}try{var pointsToRead=Math.min(count*skip,header.pointsCount-instance.readOffset);var bufferSize=Math.ceil(pointsToRead/skip);var pointsRead=0;var thisBuf=new Uint8Array(bufferSize*header.pointsStructSize);var bufRead=Module._malloc(header.pointsStructSize);for(var _i301=0;_i301<pointsToRead;_i301++){instance.getPoint(bufRead);if(_i301%skip===0){var _a6=new Uint8Array(Module.HEAPU8.buffer,bufRead,header.pointsStructSize);thisBuf.set(_a6,pointsRead*header.pointsStructSize);pointsRead++;}instance.readOffset++;}Module._free(bufRead);return{buffer:thisBuf.buffer,count:pointsRead,hasMoreData:instance.readOffset<header.pointsCount};}catch(error){throw new Error("Failed to read data: ".concat(error.message));}}/**
22844
22853
  * Deletes the instance
22845
22854
  * @returns boolean
22846
22855
  */},{key:"close",value:function close(){try{if(this.instance!==null){Module._free(this.instance.buf);this.instance["delete"]();this.instance=null;}return true;}catch(error){throw new Error("Failed to close file: ".concat(error.message));}}}]);return LAZLoader;}();/**
@@ -22897,7 +22906,7 @@ schema:{fields:[],metadata:{}},header:{vertexCount:0,boundingBox:[[0,0,0],[0,0,0
22897
22906
  };/* eslint-disable max-statements */ // @ts-ignore Possibly undefined
22898
22907
  parseLASChunked(arrayBuffer,(_options$las=options.las)===null||_options$las===void 0?void 0:_options$las.skip,function(){var _options$las3,_options$onProgress;var decoder=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};var lasHeader=arguments.length>1?arguments[1]:undefined;if(!originalHeader){var _options$las2;originalHeader=lasHeader;var total=lasHeader.totalToRead;var PositionsType=(_options$las2=options.las)!==null&&_options$las2!==void 0&&_options$las2.fp64?Float64Array:Float32Array;positions=new PositionsType(total*3);// laslaz-decoder.js `pointFormatReaders`
22899
22908
  colors=lasHeader.pointsFormatId>=2?new Uint8Array(total*4):null;intensities=new Uint16Array(total);classifications=new Uint8Array(total);lasMesh.loaderData=lasHeader;lasMesh.attributes={POSITION:{value:positions,size:3},// non-gltf attributes, use non-capitalized names for now
22900
- intensity:{value:intensities,size:1},classification:{value:classifications,size:1}};if(colors){lasMesh.attributes.COLOR_0={value:colors,size:4};}}var batchSize=decoder.pointsCount;var _lasHeader$scale=_slicedToArray(lasHeader.scale,3),scaleX=_lasHeader$scale[0],scaleY=_lasHeader$scale[1],scaleZ=_lasHeader$scale[2],_lasHeader$offset=_slicedToArray(lasHeader.offset,3),offsetX=_lasHeader$offset[0],offsetY=_lasHeader$offset[1],offsetZ=_lasHeader$offset[2];var twoByteColor=detectTwoByteColors(decoder,batchSize,(_options$las3=options.las)===null||_options$las3===void 0?void 0:_options$las3.colorDepth);for(var _i300=0;_i300<batchSize;_i300++){var _decoder$getPoint=decoder.getPoint(_i300),_position4=_decoder$getPoint.position,_color6=_decoder$getPoint.color,intensity=_decoder$getPoint.intensity,classification=_decoder$getPoint.classification;positions[pointIndex*3]=_position4[0]*scaleX+offsetX;positions[pointIndex*3+1]=_position4[1]*scaleY+offsetY;positions[pointIndex*3+2]=_position4[2]*scaleZ+offsetZ;if(_color6&&colors){if(twoByteColor){colors[pointIndex*4]=_color6[0]/256;colors[pointIndex*4+1]=_color6[1]/256;colors[pointIndex*4+2]=_color6[2]/256;}else{colors[pointIndex*4]=_color6[0];colors[pointIndex*4+1]=_color6[1];colors[pointIndex*4+2]=_color6[2];}colors[pointIndex*4+3]=255;}intensities[pointIndex]=intensity;classifications[pointIndex]=classification;pointIndex++;}var meshBatch=_objectSpread(_objectSpread({},lasMesh),{},{header:{vertexCount:lasHeader.totalRead},progress:lasHeader.totalRead/lasHeader.totalToRead});options===null||options===void 0?void 0:(_options$onProgress=options.onProgress)===null||_options$onProgress===void 0?void 0:_options$onProgress.call(options,meshBatch);});/* eslint-enable max-statements */lasMesh.header={vertexCount:originalHeader.totalToRead,boundingBox:getMeshBoundingBox((lasMesh===null||lasMesh===void 0?void 0:lasMesh.attributes)||{})};if(lasMesh){lasMesh.schema=getLASSchema(lasMesh.loaderData,lasMesh.attributes);}return lasMesh;}/**
22909
+ intensity:{value:intensities,size:1},classification:{value:classifications,size:1}};if(colors){lasMesh.attributes.COLOR_0={value:colors,size:4};}}var batchSize=decoder.pointsCount;var _lasHeader$scale=_slicedToArray(lasHeader.scale,3),scaleX=_lasHeader$scale[0],scaleY=_lasHeader$scale[1],scaleZ=_lasHeader$scale[2],_lasHeader$offset=_slicedToArray(lasHeader.offset,3),offsetX=_lasHeader$offset[0],offsetY=_lasHeader$offset[1],offsetZ=_lasHeader$offset[2];var twoByteColor=detectTwoByteColors(decoder,batchSize,(_options$las3=options.las)===null||_options$las3===void 0?void 0:_options$las3.colorDepth);for(var _i302=0;_i302<batchSize;_i302++){var _decoder$getPoint=decoder.getPoint(_i302),_position4=_decoder$getPoint.position,_color6=_decoder$getPoint.color,intensity=_decoder$getPoint.intensity,classification=_decoder$getPoint.classification;positions[pointIndex*3]=_position4[0]*scaleX+offsetX;positions[pointIndex*3+1]=_position4[1]*scaleY+offsetY;positions[pointIndex*3+2]=_position4[2]*scaleZ+offsetZ;if(_color6&&colors){if(twoByteColor){colors[pointIndex*4]=_color6[0]/256;colors[pointIndex*4+1]=_color6[1]/256;colors[pointIndex*4+2]=_color6[2]/256;}else{colors[pointIndex*4]=_color6[0];colors[pointIndex*4+1]=_color6[1];colors[pointIndex*4+2]=_color6[2];}colors[pointIndex*4+3]=255;}intensities[pointIndex]=intensity;classifications[pointIndex]=classification;pointIndex++;}var meshBatch=_objectSpread(_objectSpread({},lasMesh),{},{header:{vertexCount:lasHeader.totalRead},progress:lasHeader.totalRead/lasHeader.totalToRead});options===null||options===void 0?void 0:(_options$onProgress=options.onProgress)===null||_options$onProgress===void 0?void 0:_options$onProgress.call(options,meshBatch);});/* eslint-enable max-statements */lasMesh.header={vertexCount:originalHeader.totalToRead,boundingBox:getMeshBoundingBox((lasMesh===null||lasMesh===void 0?void 0:lasMesh.attributes)||{})};if(lasMesh){lasMesh.schema=getLASSchema(lasMesh.loaderData,lasMesh.attributes);}return lasMesh;}/**
22901
22910
  * parse laz data
22902
22911
  * @param rawData
22903
22912
  * @param skip
@@ -22912,7 +22921,7 @@ onParseData(unpacker,header);if(!chunk.hasMoreData||totalRead>=totalToRead){brea
22912
22921
  * @param batchSize
22913
22922
  * @param colorDepth
22914
22923
  * @returns boolean
22915
- */function detectTwoByteColors(){var decoder=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};var batchSize=arguments.length>1?arguments[1]:undefined;var colorDepth=arguments.length>2?arguments[2]:undefined;var twoByteColor=false;switch(colorDepth){case 8:twoByteColor=false;break;case 16:twoByteColor=true;break;case'auto':if(decoder.getPoint(0).color){for(var _i301=0;_i301<batchSize;_i301++){var _decoder$getPoint2=decoder.getPoint(_i301),_color7=_decoder$getPoint2.color;// eslint-disable-next-line max-depth
22924
+ */function detectTwoByteColors(){var decoder=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};var batchSize=arguments.length>1?arguments[1]:undefined;var colorDepth=arguments.length>2?arguments[2]:undefined;var twoByteColor=false;switch(colorDepth){case 8:twoByteColor=false;break;case 16:twoByteColor=true;break;case'auto':if(decoder.getPoint(0).color){for(var _i303=0;_i303<batchSize;_i303++){var _decoder$getPoint2=decoder.getPoint(_i303),_color7=_decoder$getPoint2.color;// eslint-disable-next-line max-depth
22916
22925
  if(_color7[0]>255||_color7[1]>255||_color7[2]>255){twoByteColor=true;}}}break;default:// eslint-disable-next-line
22917
22926
  console.warn('las: illegal value for options.las.colorDepth');break;}return twoByteColor;}/**
22918
22927
  * Loader for the LAS (LASer) point cloud format
@@ -23265,19 +23274,19 @@ math.mulMat4v4(camera.viewMatrix,p,p);math.mulMat4v4(camera.projMatrix,p,p);};va
23265
23274
  // Calculate the interpolation factor t where the line segment crosses the near plane
23266
23275
  var _delta=math.subVec4(p1,p0,tmpVec4c);math.mulVec4Scalar(_delta,t,_delta);math.addVec4(p0,_delta,p0Behind?p0:p1);}// normalize clip space coords
23267
23276
  math.mulVec4Scalar(p0,1.0/p0[3]);math.mulVec4Scalar(p1,1.0/p1[3]);var t_min=0.0;var t_max=1.0;// If either point is outside the view frustum, clip the line segment
23268
- for(var _i302=0;_i302<2;++_i302){var denom=p1[_i302]-p0[_i302];var l=(-1-p0[_i302])/denom;var r=(1-p0[_i302])/denom;if(denom>0){t_min=Math.max(t_min,l);t_max=Math.min(t_max,r);}else if(denom<0){t_min=Math.max(t_min,r);t_max=Math.min(t_max,l);}else{if(p0[0]<-1){t_min=-window.Infinity;}else if(p0[0]>1){t_max=window.Infinity;}}}if(t_min>=t_max){return false;}// Calculate the clipped start and end points
23277
+ for(var _i304=0;_i304<2;++_i304){var denom=p1[_i304]-p0[_i304];var l=(-1-p0[_i304])/denom;var r=(1-p0[_i304])/denom;if(denom>0){t_min=Math.max(t_min,l);t_max=Math.min(t_max,r);}else if(denom<0){t_min=Math.max(t_min,r);t_max=Math.min(t_max,l);}else{if(p0[0]<-1){t_min=-window.Infinity;}else if(p0[0]>1){t_max=window.Infinity;}}}if(t_min>=t_max){return false;}// Calculate the clipped start and end points
23269
23278
  var ndcDelta=math.subVec4(p1,p0,tmpVec4c);math.addVec4(p0,math.mulVec4Scalar(ndcDelta,t_max,tmpVec4d),p1);math.addVec4(p0,math.mulVec4Scalar(ndcDelta,t_min,tmpVec4d),p0);math.mulVec4Scalar(p0,1/p0[3]);math.mulVec4Scalar(p1,1/p1[3]);toCanvasSpace(canvas,parentElement,p0,canvasStart);toCanvasSpace(canvas,parentElement,p1,canvasEnd);return true;};var Dot3D=/*#__PURE__*/function(_Marker2){_inherits(Dot3D,_Marker2);var _super66=_createSuper(Dot3D);function Dot3D(scene,markerCfg,parentElement){var _this124;var cfg=arguments.length>3&&arguments[3]!==undefined?arguments[3]:{};_classCallCheck(this,Dot3D);var camera=scene.camera;_this124=_super66.call(this,scene,markerCfg);_this124.__visible=true;// "__" to not interfere with Marker::_visible
23270
23279
  var handler=function handler(cfgEvent,componentEvent){return function(event){if(cfgEvent){cfgEvent(event);}_this124.fire(componentEvent,event,true);};};_this124._dot=new Dot(parentElement,{borderColor:cfg.borderColor,fillColor:cfg.fillColor,zIndex:cfg.zIndex,onMouseOver:handler(cfg.onMouseOver,"mouseover"),onMouseLeave:handler(cfg.onMouseLeave,"mouseleave"),onMouseWheel:handler(cfg.onMouseWheel,"wheel"),onMouseDown:handler(cfg.onMouseDown,"mousedown"),onMouseUp:handler(cfg.onMouseUp,"mouseup"),onMouseMove:handler(cfg.onMouseMove,"mousemove"),onTouchstart:handler(cfg.onTouchstart,"touchstart"),onTouchmove:handler(cfg.onTouchmove,"touchmove"),onTouchend:handler(cfg.onTouchend,"touchend"),onContextMenu:handler(cfg.onContextMenu,"contextmenu")});var toClipSpace=function toClipSpace(worldPos,p){// to homogeneous coords
23271
23280
  p.set(worldPos);p[3]=1;// to clip space
23272
23281
  math.mulMat4v4(camera.viewMatrix,p,p);math.mulMat4v4(camera.projMatrix,p,p);};var toCanvasSpace=function toCanvasSpace(ndc){var canvas=scene.canvas.canvas;ndc[0]=(1+ndc[0])*0.5*canvas.offsetWidth;ndc[1]=(1-ndc[1])*0.5*canvas.offsetHeight;transformToNode(canvas,parentElement,ndc);};var updateDotPos=function updateDotPos(){if(!_this124.__visible){return;}var p0=tmpVec4c;toClipSpace(_this124.worldPos,p0);math.mulVec3Scalar(p0,1.0/p0[3]);var outsideFrustum=p0[3]<0||p0[0]<-1||p0[0]>1||p0[1]<-1||p0[1]>1||p0[2]<-1||p0[2]>1;var culled=outsideFrustum||scene._sectionPlanesState.sectionPlanes.some(function(plane){return math.dotVec3(plane.dir,math.subVec3(plane.pos,_this124.worldPos,tmpVec3a$2))>0;});_this124._dot.setCulled(culled);if(!culled){toCanvasSpace(p0);_this124._dot.setPos(p0[0],p0[1]);}};_this124.on("worldPos",updateDotPos);var onViewMatrix=camera.on("viewMatrix",updateDotPos);var onProjMatrix=camera.on("projMatrix",updateDotPos);var onCanvasBnd=scene.canvas.on("boundary",updateDotPos);var planesUpdate=scene.on("sectionPlaneUpdated",updateDotPos);var planeCreated=scene.on("sectionPlaneCreated",updateDotPos);var planeDestroyed=scene.on("sectionPlaneDestroyed",updateDotPos);_this124._updatePosition=updateDotPos;_this124._cleanup=function(){camera.off(onViewMatrix);camera.off(onProjMatrix);scene.canvas.off(onCanvasBnd);scene.off(planesUpdate);scene.off(planeCreated);scene.off(planeDestroyed);_this124._dot.destroy();};return _this124;}_createClass(Dot3D,[{key:"setClickable",value:function setClickable(value){this._dot.setClickable(value);}},{key:"setFillColor",value:function setFillColor(value){this._dot.setFillColor(value);}},{key:"setBorderColor",value:function setBorderColor(value){this._dot.setBorderColor(value);}},{key:"setHighlighted",value:function setHighlighted(value){this._dot.setHighlighted(value);}},{key:"setOpacity",value:function setOpacity(value){this._dot.setOpacity(value);}},{key:"setVisible",value:function setVisible(value){if(this.__visible!=value){this.__visible=value;this._updatePosition();this._dot.setVisible(value);}}},{key:"destroy",value:function destroy(){this._cleanup();_get(_getPrototypeOf(Dot3D.prototype),"destroy",this).call(this);}}]);return Dot3D;}(Marker);var Label3D=/*#__PURE__*/function(){function Label3D(scene,parentElement,cfg){var _this125=this;_classCallCheck(this,Label3D);var camera=scene.camera;this._label=new Label(parentElement,cfg);this._start=math.vec3();this._mid=math.vec3();this._end=math.vec3();this._yOff=0;this.__visible=true;this._updatePos=function(){toClipSpace(camera,_this125._start,tmpVec4a);math.mulVec4Scalar(tmpVec4a,1.0/tmpVec4a[3]);toCanvasSpace(scene.canvas.canvas,parentElement,tmpVec4a,tmpVec2a);_this125._label.setPos(tmpVec2a[0],tmpVec2a[1]);};var setPosOnWire=function setPosOnWire(p0,p1,yOff){p0[0]+=p1[0];p0[1]+=p1[1];math.mulVec2Scalar(p0,.5);_this125._label.setPos(p0[0],p0[1]+yOff);};this._updatePosBetween=function(){var visibleA=clipSegment(scene,parentElement,_this125._start,_this125._mid,tmpVec2a,tmpVec2b);var visibleB=clipSegment(scene,parentElement,_this125._end,_this125._mid,tmpVec2c,tmpVec2d);_this125._label.setCulled(!(visibleA||visibleB));if(visibleA&&visibleB){tmpVec2b[0]+=tmpVec2d[0];tmpVec2b[1]+=tmpVec2d[1];math.mulVec2Scalar(tmpVec2b,.5);tmpVec2b[0]+=tmpVec2a[0]+tmpVec2c[0];tmpVec2b[1]+=tmpVec2a[1]+tmpVec2c[1];math.mulVec2Scalar(tmpVec2b,1/3);_this125._label.setPos(tmpVec2b[0],tmpVec2b[1]);}else if(visibleA){setPosOnWire(tmpVec2a,tmpVec2b,0);}else if(visibleB){setPosOnWire(tmpVec2c,tmpVec2d,0);}};this._updatePosOnWire=function(){var visible=clipSegment(scene,parentElement,_this125._start,_this125._end,tmpVec2a,tmpVec2b)&&math.distVec2(tmpVec2a,tmpVec2b)>=_this125._labelMinAxisLength;_this125._label.setCulled(!visible);if(visible){setPosOnWire(tmpVec2a,tmpVec2b,_this125._yOff);}};var posUpdate=function posUpdate(){};this._setUpdatePositions=function(_posUpdate){posUpdate=_posUpdate;_this125._updatePositions();};this._updatePositions=function(){if(_this125.__visible){posUpdate();}};var onViewMatrix=camera.on("viewMatrix",this._updatePositions);var onProjMatrix=camera.on("projMatrix",this._updatePositions);var onCanvasBnd=scene.canvas.on("boundary",this._updatePositions);var planesUpdate=scene.on("sectionPlaneUpdated",this._updatePositions);var planeCreated=scene.on("sectionPlaneCreated",this._updatePositions);var planeDestroyed=scene.on("sectionPlaneDestroyed",this._updatePositions);this._cleanup=function(){camera.off(onViewMatrix);camera.off(onProjMatrix);scene.canvas.off(onCanvasBnd);scene.off(planesUpdate);scene.off(planeCreated);scene.off(planeDestroyed);_this125._label.destroy();};}_createClass(Label3D,[{key:"setPos",value:function setPos(p0){this._start.set(p0);this._setUpdatePositions(this._updatePos);}},{key:"setPosOnWire",value:function setPosOnWire(p0,p1,yOff,labelMinAxisLength){this._start.set(p0);this._end.set(p1);this._yOff=yOff;this._labelMinAxisLength=labelMinAxisLength;this._setUpdatePositions(this._updatePosOnWire);}},{key:"setPosBetween",value:function setPosBetween(p0,p1,p2){this._start.set(p0);this._mid.set(p1);this._end.set(p2);this._setUpdatePositions(this._updatePosBetween);}},{key:"setFillColor",value:function setFillColor(value){this._label.setFillColor(value);}},{key:"setHighlighted",value:function setHighlighted(value){this._label.setHighlighted(value);}},{key:"setText",value:function setText(value){this._label.setText(value);}},{key:"setClickable",value:function setClickable(value){this._label.setClickable(value);}},{key:"setVisible",value:function setVisible(value){if(this.__visible!=value){this.__visible=value;this._updatePositions();this._label.setVisible(value);}}},{key:"destroy",value:function destroy(){this._cleanup();}}]);return Label3D;}();var Wire3D=/*#__PURE__*/function(){function Wire3D(scene,parentElement,cfg){var _this126=this;_classCallCheck(this,Wire3D);var camera=scene.camera;this._wire=new Wire(parentElement,cfg);this._start=math.vec3();this._end=math.vec3();this.__visible=true;this._updatePositions=function(){if(!_this126.__visible){return;}var visible=clipSegment(scene,parentElement,_this126._start,_this126._end,tmpVec2a,tmpVec2b);_this126._wire.setCulled(!visible);if(visible){_this126._wire.setStartAndEnd(tmpVec2a[0],tmpVec2a[1],tmpVec2b[0],tmpVec2b[1]);}};var onViewMatrix=camera.on("viewMatrix",this._updatePositions);var onProjMatrix=camera.on("projMatrix",this._updatePositions);var onCanvasBnd=scene.canvas.on("boundary",this._updatePositions);var planesUpdate=scene.on("sectionPlaneUpdated",this._updatePositions);var planeCreated=scene.on("sectionPlaneCreated",this._updatePositions);var planeDestroyed=scene.on("sectionPlaneDestroyed",this._updatePositions);this._cleanup=function(){camera.off(onViewMatrix);camera.off(onProjMatrix);scene.canvas.off(onCanvasBnd);scene.off(planesUpdate);scene.off(planeCreated);scene.off(planeDestroyed);_this126._wire.destroy();};}_createClass(Wire3D,[{key:"setEnds",value:function setEnds(start,end){this._start.set(start);this._end.set(end);this._updatePositions();}},{key:"setClickable",value:function setClickable(value){this._wire.setClickable(value);}},{key:"setColor",value:function setColor(value){this._wire.setColor(value);}},{key:"setHighlighted",value:function setHighlighted(value){this._wire.setHighlighted(value);}},{key:"setOpacity",value:function setOpacity(value){this._wire.setOpacity(value);}},{key:"setVisible",value:function setVisible(value){if(this.__visible!=value){this.__visible=value;this._updatePositions();this._wire.setVisible(value);}}},{key:"destroy",value:function destroy(){this._cleanup();}}]);return Wire3D;}();var marker3D=function marker3D(scene,color){var marker=new Dot3D(scene,{},scene.canvas.canvas.parentNode,{borderColor:"white",fillColor:color,zIndex:100});return{update:function update(worldPos){if(worldPos){marker.worldPos=worldPos;}marker.setVisible(!!worldPos);},setFillColor:function setFillColor(c){return marker.setFillColor(c);},setHighlighted:function setHighlighted(h){return marker.setHighlighted(h);},getCanvasPos:function getCanvasPos(){return marker.canvasPos;},getWorldPos:function getWorldPos(){return marker.worldPos;},destroy:function destroy(){return marker.destroy();}};};var wire3D=function wire3D(scene,color){var wire=new Wire3D(scene,scene.canvas.canvas.ownerDocument.body,{color:color,thickness:1,thicknessClickable:6// TODO: Remove to make not clickable?
23273
23282
  });wire.setVisible(false);return{update:function update(startWorldPos,endWorldPos){if(endWorldPos){wire.setEnds(startWorldPos,endWorldPos);}wire.setVisible(!!endWorldPos);},setColor:function setColor(c){return wire.setColor(c);},destroy:function destroy(){return wire.destroy();}};};function activateDraggableDot(dot,cfg){var extractCFG=function extractCFG(propName,defaultValue){if(propName in cfg){return cfg[propName];}else if(defaultValue!==undefined){return defaultValue;}else{throw"config missing: "+propName;}};var viewer=extractCFG("viewer");var ray2WorldPos=extractCFG("ray2WorldPos");var handleMouseEvents=extractCFG("handleMouseEvents",false);var handleTouchEvents=extractCFG("handleTouchEvents",false);var onStart=extractCFG("onStart",nop);var onMove=extractCFG("onMove",nop);var onEnd=extractCFG("onEnd",nop);var scene=viewer.scene;var canvas=scene.canvas.canvas;var pickWorldPos=function pickWorldPos(canvasPos){var origin=math.vec3();var direction=math.vec3();math.canvasPosToWorldRay(canvas,scene.camera.viewMatrix,scene.camera.projMatrix,scene.camera.projection,canvasPos,origin,direction);return ray2WorldPos(origin,direction,canvasPos);};var onChange=function onChange(event){var canvasPos=math.vec2([event.clientX,event.clientY]);transformToNode(canvas.ownerDocument.documentElement,canvas,canvasPos);onMove(canvasPos,pickWorldPos(canvasPos));};var currentDrag=null;var onDragMove=function onDragMove(event){var e=currentDrag.matchesEvent(event);if(e){onChange(e);}};var onDragEnd=function onDragEnd(event){var e=currentDrag.matchesEvent(event);if(e){dot.setOpacity(idleOpacity);currentDrag.cleanup();onChange(e);onEnd();}};var startDrag=function startDrag(matchesEvent,cleanupHandlers){if(currentDrag){currentDrag.cleanup();}dot.setOpacity(1.0);dot.setClickable(false);viewer.cameraControl.active=false;currentDrag={matchesEvent:matchesEvent,cleanup:function cleanup(){currentDrag=null;dot.setClickable(true);viewer.cameraControl.active=true;cleanupHandlers();}};onStart();};var cleanupDotHandlers=[];var dot_on=function dot_on(event,callback){var id=dot.on(event,callback);cleanupDotHandlers.push(function(){return dot.off(id);});};if(handleMouseEvents){dot_on("mouseover",function(){return!currentDrag&&dot.setOpacity(1.0);});dot_on("mouseleave",function(){return!currentDrag&&dot.setOpacity(idleOpacity);});dot_on("mousedown",function(event){if(event.which===1){canvas.addEventListener("mousemove",onDragMove);canvas.addEventListener("mouseup",onDragEnd);startDrag(function(event){return event.which===1&&event;},function(){canvas.removeEventListener("mousemove",onDragMove);canvas.removeEventListener("mouseup",onDragEnd);});}});}if(handleTouchEvents){var touchStartId;dot_on("touchstart",function(event){event.preventDefault();if(event.touches.length===1){touchStartId=event.touches[0].identifier;startDrag(function(event){return _toConsumableArray(event.changedTouches).find(function(e){return e.identifier===touchStartId;});},function(){touchStartId=null;});}});dot_on("touchmove",function(event){event.preventDefault();onDragMove(event);});dot_on("touchend",function(event){event.preventDefault();onDragEnd(event);});}var idleOpacity=0.8;dot.setOpacity(idleOpacity);return function(){currentDrag&&currentDrag.cleanup();cleanupDotHandlers.forEach(function(c){return c();});dot.setOpacity(1.0);};}function activateDraggableDots(cfg){var extractCFG=function extractCFG(propName,defaultValue){if(propName in cfg){return cfg[propName];}else if(defaultValue!==undefined){return defaultValue;}else{throw"config missing: "+propName;}};var viewer=extractCFG("viewer");var handleMouseEvents=extractCFG("handleMouseEvents",false);var handleTouchEvents=extractCFG("handleTouchEvents",false);var pointerLens=extractCFG("pointerLens",null);var dots=extractCFG("dots");var _ray2WorldPos=extractCFG("ray2WorldPos");var _onEnd=extractCFG("onEnd",nop);var updatePointerLens=pointerLens?function(canvasPos){pointerLens.visible=!!canvasPos;if(canvasPos){pointerLens.canvasPos=canvasPos;}}:function(){};var cleanups=dots.map(function(dot){var initPos;return activateDraggableDot(dot,{handleMouseEvents:handleMouseEvents,handleTouchEvents:handleTouchEvents,viewer:viewer,ray2WorldPos:function ray2WorldPos(orig,dir,canvasPos){return _ray2WorldPos(orig,dir,canvasPos)||initPos;},onStart:function onStart(){initPos=dot.worldPos.slice();setOtherDotsActive(false,dot);},onMove:function onMove(canvasPos,worldPos){updatePointerLens(canvasPos);dot.worldPos=worldPos;},onEnd:function onEnd(){if(!_onEnd(initPos,dot)){dot.worldPos=initPos;}updatePointerLens(null);setOtherDotsActive(true,dot);}});});var setOtherDotsActive=function setOtherDotsActive(active,dot){return dots.forEach(function(d){return d!==dot&&d.setClickable(active);});};setOtherDotsActive(true);return function(){cleanups.forEach(function(c){return c();});updatePointerLens(null);};}var touchPointSelector=function touchPointSelector(viewer,pointerCircle,ray2WorldPos){return function(onCancel,onChange,onCommit){var scene=viewer.scene;var canvas=scene.canvas.canvas;var longTouchTimeoutMs=300;var moveTolerance=20;var copyCanvasPos=function copyCanvasPos(event,vec2){vec2[0]=event.clientX;vec2[1]=event.clientY;transformToNode(canvas.ownerDocument.documentElement,canvas,vec2);return vec2;};var pickWorldPos=function pickWorldPos(canvasPos){var origin=math.vec3();var direction=math.vec3();math.canvasPosToWorldRay(canvas,scene.camera.viewMatrix,scene.camera.projMatrix,scene.camera.projection,canvasPos,origin,direction);return ray2WorldPos(origin,direction);};var longTouchTimeout=null;var nop=function nop(){};var onSingleTouchMove=nop;var startTouchIdentifier;var resetAction=function resetAction(){pointerCircle.stop();clearTimeout(longTouchTimeout);viewer.cameraControl.active=true;onSingleTouchMove=nop;startTouchIdentifier=null;};var cleanup=function cleanup(){resetAction();canvas.removeEventListener("touchstart",onCanvasTouchStart);canvas.removeEventListener("touchmove",onCanvasTouchMove);canvas.removeEventListener("touchend",onCanvasTouchEnd);};var onCanvasTouchStart=function onCanvasTouchStart(event){var touches=event.touches;if(touches.length!==1){resetAction();onCancel();}else{var startTouch=touches[0];var startCanvasPos=copyCanvasPos(startTouch,math.vec2());var startWorldPos=pickWorldPos(startCanvasPos);if(startWorldPos){startTouchIdentifier=startTouch.identifier;onSingleTouchMove=function onSingleTouchMove(canvasPos){if(math.distVec2(startCanvasPos,canvasPos)>moveTolerance){resetAction();}};longTouchTimeout=setTimeout(function(){pointerCircle.start(startCanvasPos);longTouchTimeout=setTimeout(function(){pointerCircle.stop();viewer.cameraControl.active=false;onSingleTouchMove=function onSingleTouchMove(canvasPos){onChange(canvasPos,pickWorldPos(canvasPos));};onSingleTouchMove(startCanvasPos);},longTouchTimeoutMs);},250);}}};canvas.addEventListener("touchstart",onCanvasTouchStart,{passive:true});// canvas.addEventListener("touchcancel", e => console.log("touchcancel", e), {passive: true});
23274
- var onCanvasTouchMove=function onCanvasTouchMove(event){var touch=_toConsumableArray(event.changedTouches).find(function(e){return e.identifier===startTouchIdentifier;});if(touch){onSingleTouchMove(copyCanvasPos(touch,math.vec2()));}};canvas.addEventListener("touchmove",onCanvasTouchMove,{passive:true});var onCanvasTouchEnd=function onCanvasTouchEnd(event){var touch=_toConsumableArray(event.changedTouches).find(function(e){return e.identifier===startTouchIdentifier;});if(touch){cleanup();var _canvasPos=copyCanvasPos(touch,math.vec2());onCommit(_canvasPos,pickWorldPos(_canvasPos));}};canvas.addEventListener("touchend",onCanvasTouchEnd,{passive:true});return cleanup;};};var triangulateEarClipping=function triangulateEarClipping(planeCoords){var polygonVertices=[];for(var _i303=0;_i303<planeCoords.length;++_i303){polygonVertices.push(_i303);}var isCCW=function(){var ba=math.vec2();var bc=math.vec2();var anglesSum=0;for(var _i304=0;_i304<polygonVertices.length;++_i304){var _a7=planeCoords[polygonVertices[_i304]];var b=planeCoords[polygonVertices[(_i304+1)%polygonVertices.length]];var c=planeCoords[polygonVertices[(_i304+2)%polygonVertices.length]];math.subVec2(_a7,b,ba);math.subVec2(c,b,bc);var theta=math.dotVec2(ba,bc)/Math.sqrt(math.sqLenVec2(ba)*math.sqLenVec2(bc));var _angle2=Math.acos(Math.max(-1,Math.min(theta,1)));var convex=ba[0]*bc[1]-ba[1]*bc[0]>=0;anglesSum+=convex?_angle2:2*Math.PI-_angle2;}return anglesSum<polygonVertices.length*Math.PI;}();var pointInTriangle=function(){var sign=function sign(p1,p2,p3){return(p1[0]-p3[0])*(p2[1]-p3[1])-(p2[0]-p3[0])*(p1[1]-p3[1]);};return function(pt,v1,v2,v3){var d1=sign(pt,v1,v2);var d2=sign(pt,v2,v3);var d3=sign(pt,v3,v1);var has_neg=d1<0||d2<0||d3<0;var has_pos=d1>0||d2>0||d3>0;return!(has_neg&&has_pos);};}();var baseTriangles=[];var vertices=(isCCW?polygonVertices:polygonVertices.slice(0).reverse()).map(function(i){return{idx:i};});vertices.forEach(function(v,i){v.prev=vertices[(i-1+vertices.length)%vertices.length];v.next=vertices[(i+1)%vertices.length];});var ba=math.vec2();var bc=math.vec2();while(vertices.length>2){var earIdx=0;var _loop13=function _loop13(){if(earIdx>=vertices.length){throw"isCCW = ".concat(isCCW,"; earIdx = ").concat(earIdx,"; len = ").concat(vertices.length);}var v=vertices[earIdx];var a=planeCoords[v.prev.idx];var b=planeCoords[v.idx];var c=planeCoords[v.next.idx];math.subVec2(a,b,ba);math.subVec2(c,b,bc);if(ba[0]*bc[1]-ba[1]*bc[0]>=0// a convex vertex
23283
+ var onCanvasTouchMove=function onCanvasTouchMove(event){var touch=_toConsumableArray(event.changedTouches).find(function(e){return e.identifier===startTouchIdentifier;});if(touch){onSingleTouchMove(copyCanvasPos(touch,math.vec2()));}};canvas.addEventListener("touchmove",onCanvasTouchMove,{passive:true});var onCanvasTouchEnd=function onCanvasTouchEnd(event){var touch=_toConsumableArray(event.changedTouches).find(function(e){return e.identifier===startTouchIdentifier;});if(touch){cleanup();var _canvasPos=copyCanvasPos(touch,math.vec2());onCommit(_canvasPos,pickWorldPos(_canvasPos));}};canvas.addEventListener("touchend",onCanvasTouchEnd,{passive:true});return cleanup;};};var triangulateEarClipping=function triangulateEarClipping(planeCoords){var polygonVertices=[];for(var _i305=0;_i305<planeCoords.length;++_i305){polygonVertices.push(_i305);}var isCCW=function(){var ba=math.vec2();var bc=math.vec2();var anglesSum=0;for(var _i306=0;_i306<polygonVertices.length;++_i306){var _a7=planeCoords[polygonVertices[_i306]];var b=planeCoords[polygonVertices[(_i306+1)%polygonVertices.length]];var c=planeCoords[polygonVertices[(_i306+2)%polygonVertices.length]];math.subVec2(_a7,b,ba);math.subVec2(c,b,bc);var theta=math.dotVec2(ba,bc)/Math.sqrt(math.sqLenVec2(ba)*math.sqLenVec2(bc));var _angle2=Math.acos(Math.max(-1,Math.min(theta,1)));var convex=ba[0]*bc[1]-ba[1]*bc[0]>=0;anglesSum+=convex?_angle2:2*Math.PI-_angle2;}return anglesSum<polygonVertices.length*Math.PI;}();var pointInTriangle=function(){var sign=function sign(p1,p2,p3){return(p1[0]-p3[0])*(p2[1]-p3[1])-(p2[0]-p3[0])*(p1[1]-p3[1]);};return function(pt,v1,v2,v3){var d1=sign(pt,v1,v2);var d2=sign(pt,v2,v3);var d3=sign(pt,v3,v1);var has_neg=d1<0||d2<0||d3<0;var has_pos=d1>0||d2>0||d3>0;return!(has_neg&&has_pos);};}();var baseTriangles=[];var vertices=(isCCW?polygonVertices:polygonVertices.slice(0).reverse()).map(function(i){return{idx:i};});vertices.forEach(function(v,i){v.prev=vertices[(i-1+vertices.length)%vertices.length];v.next=vertices[(i+1)%vertices.length];});var ba=math.vec2();var bc=math.vec2();while(vertices.length>2){var earIdx=0;var _loop13=function _loop13(){if(earIdx>=vertices.length){throw"isCCW = ".concat(isCCW,"; earIdx = ").concat(earIdx,"; len = ").concat(vertices.length);}var v=vertices[earIdx];var a=planeCoords[v.prev.idx];var b=planeCoords[v.idx];var c=planeCoords[v.next.idx];math.subVec2(a,b,ba);math.subVec2(c,b,bc);if(ba[0]*bc[1]-ba[1]*bc[0]>=0// a convex vertex
23275
23284
  &&vertices.every(// no other vertices inside
23276
23285
  function(vv){return vv===v||vv===v.prev||vv===v.next||!pointInTriangle(planeCoords[vv.idx],a,b,c);}))return"break";++earIdx;};while(true){var _ret3=_loop13();if(_ret3==="break")break;}var ear=vertices[earIdx];vertices.splice(earIdx,1);baseTriangles.push([ear.idx,ear.next.idx,ear.prev.idx]);var prev=ear.prev;prev.next=ear.next;var next=ear.next;next.prev=ear.prev;}return[planeCoords,baseTriangles,isCCW];};var addMousePressListener=function addMousePressListener(element,onChange){var moveTolerance=4;var copyElementPos=function copyElementPos(event,out){out[0]=event.clientX;out[1]=event.clientY;transformToNode(element.ownerDocument.documentElement,element,out);return out;};var buttonDown=false;var cleanups=[];var cleanup=function cleanup(){return cleanups.forEach(function(c){return c();});};var addElementEventListener=function addElementEventListener(type,listener){element.addEventListener(type,listener);cleanups.push(function(){return element.removeEventListener(type,listener);});};var downPos=math.vec2();addElementEventListener("mousedown",function(event){if(event.which===1){buttonDown=true;onChange(copyElementPos(event,downPos));}});addElementEventListener("mousemove",function(event){copyElementPos(event,tmpVec2a);if(buttonDown&&math.distVec2(downPos,tmpVec2a)>moveTolerance){buttonDown=false;}if(buttonDown||!event.buttons&1){onChange(tmpVec2a);}});addElementEventListener("mouseup",function(event){if(event.which===1&&buttonDown){var commit=onChange(copyElementPos(event,tmpVec2a));if(commit){cleanup();commit();}}});return cleanup;};var addTouchPressListener=function addTouchPressListener(element,cameraControl,pointerCircle,onChange){var longTouchTimeoutMs=300;var moveTolerance=20;var startPos=math.vec2();var copyElementPos=function copyElementPos(event,out){out[0]=event.clientX;out[1]=event.clientY;transformToNode(element.ownerDocument.documentElement,element,out);return out;};var longTouchTimeout=null;var onSingleTouchMove=nop;var startTouchIdentifier;var resetAction=function resetAction(){clearTimeout(longTouchTimeout);pointerCircle.stop();cameraControl.active=true;onSingleTouchMove=nop;startTouchIdentifier=null;};var cleanups=[];var cleanup=function cleanup(){return cleanups.forEach(function(c){return c();});};var addElementEventListener=function addElementEventListener(type,listener){element.addEventListener(type,listener,{passive:true});cleanups.push(function(){return element.removeEventListener(type,listener);});};addElementEventListener("touchstart",function(event){var touches=event.touches;if(touches.length!==1){resetAction();onChange(null);}else{var touch=touches[0];copyElementPos(touch,startPos);startTouchIdentifier=touch.identifier;onSingleTouchMove=function onSingleTouchMove(elementPos){if(math.distVec2(startPos,elementPos)>moveTolerance){resetAction();}};longTouchTimeout=setTimeout(function(){pointerCircle.start(startPos);longTouchTimeout=setTimeout(function(){pointerCircle.stop();cameraControl.active=false;onSingleTouchMove=onChange;onSingleTouchMove(startPos);},longTouchTimeoutMs);},250);}});// element.addEventListener("touchcancel", e => console.log("touchcancel", e), {passive: true});
23277
23286
  addElementEventListener("touchmove",function(event){var touch=_toConsumableArray(event.changedTouches).find(function(e){return e.identifier===startTouchIdentifier;});if(touch){onSingleTouchMove(copyElementPos(touch,tmpVec2a));}});addElementEventListener("touchend",function(event){var touch=_toConsumableArray(event.changedTouches).find(function(e){return e.identifier===startTouchIdentifier;});if(touch){var commit=onChange(copyElementPos(touch,tmpVec2a));resetAction();if(commit){cleanup();commit();}else{onChange(null);}}});return function(){resetAction();cleanup();};};var startPolygonCreate=function startPolygonCreate(scene,pointerLens,addPressListener,pickRayResult,onChange,onConclude){var canvas=scene.canvas.canvas;var updatePointerLens=pointerLens?function(canvasPos,isSnapped){pointerLens.visible=!!canvasPos;if(canvasPos){pointerLens.canvasPos=canvasPos;pointerLens.snapped=!!isSnapped;}}:function(){};var testLastSegmentIntersects=function(){var onSegment=function onSegment(p,q,r){return q[0]<=Math.max(p[0],r[0])&&q[0]>=Math.min(p[0],r[0])&&q[1]<=Math.max(p[1],r[1])&&q[1]>=Math.min(p[1],r[1]);};var orient=function orient(p,q,r){var val=(q[1]-p[1])*(r[0]-q[0])-(q[0]-p[0])*(r[1]-q[1]);// collinear
23278
23287
  // clockwise
23279
23288
  // counterclockwise
23280
- return val===0?0:val>0?1:2;};return function(pos2D,lastSegmentClosesLoop){var s=lastSegmentClosesLoop?1:0;var a=pos2D[(pos2D.length-2+s)%pos2D.length];var b=pos2D[(pos2D.length-1+s)%pos2D.length];for(var _i305=s;_i305<pos2D.length-2-1+s;++_i305){var c=pos2D[_i305];var d=pos2D[_i305+1];var o1=orient(a,b,c);var o2=orient(a,b,d);var o3=orient(c,d,a);var o4=orient(c,d,b);if(o1!==o2&&o3!==o4||// General case
23289
+ return val===0?0:val>0?1:2;};return function(pos2D,lastSegmentClosesLoop){var s=lastSegmentClosesLoop?1:0;var a=pos2D[(pos2D.length-2+s)%pos2D.length];var b=pos2D[(pos2D.length-1+s)%pos2D.length];for(var _i307=s;_i307<pos2D.length-2-1+s;++_i307){var c=pos2D[_i307];var d=pos2D[_i307+1];var o1=orient(a,b,c);var o2=orient(a,b,d);var o3=orient(c,d,a);var o4=orient(c,d,b);if(o1!==o2&&o3!==o4||// General case
23281
23290
  o1===0&&onSegment(a,c,b)||// a, b and c are collinear and c lies on segment ab
23282
23291
  o2===0&&onSegment(a,d,b)||// a, b and d are collinear and d lies on segment ab
23283
23292
  o3===0&&onSegment(c,a,d)||// c, d and a are collinear and a lies on segment cd
@@ -23399,7 +23408,7 @@ doublePickFlyTo:true});this._plugins=[];/**
23399
23408
  *
23400
23409
  * @param {String} event Event name
23401
23410
  * @param {Object} value Event parameters
23402
- */},{key:"fire",value:function fire(event,value){var subs=this._eventSubs[event];if(subs){for(var _i306=0,len=subs.length;_i306<len;_i306++){subs[_i306](value);}}}/**
23411
+ */},{key:"fire",value:function fire(event,value){var subs=this._eventSubs[event];if(subs){for(var _i308=0,len=subs.length;_i308<len;_i308++){subs[_i308](value);}}}/**
23403
23412
  * Unsubscribes from an event fired at this Viewer.
23404
23413
  * @param event
23405
23414
  */},{key:"off",value:function off(event){// TODO
@@ -23419,12 +23428,12 @@ doublePickFlyTo:true});this._plugins=[];/**
23419
23428
  * Uninstalls a Plugin, clearing content from it first.
23420
23429
  *
23421
23430
  * @private
23422
- */},{key:"removePlugin",value:function removePlugin(plugin){for(var _i307=0,len=this._plugins.length;_i307<len;_i307++){var _p4=this._plugins[_i307];if(_p4===plugin){if(_p4.clear){_p4.clear();}this._plugins.splice(_i307,1);return;}}}/**
23431
+ */},{key:"removePlugin",value:function removePlugin(plugin){for(var _i309=0,len=this._plugins.length;_i309<len;_i309++){var _p4=this._plugins[_i309];if(_p4===plugin){if(_p4.clear){_p4.clear();}this._plugins.splice(_i309,1);return;}}}/**
23423
23432
  * Sends a message to installed Plugins.
23424
23433
  *
23425
23434
  * The message can optionally be accompanied by a value.
23426
23435
  * @private
23427
- */},{key:"sendToPlugins",value:function sendToPlugins(name,value){for(var _i308=0,len=this._plugins.length;_i308<len;_i308++){var _p5=this._plugins[_i308];if(_p5.send){_p5.send(name,value);}}}/**
23436
+ */},{key:"sendToPlugins",value:function sendToPlugins(name,value){for(var _i310=0,len=this._plugins.length;_i310<len;_i310++){var _p5=this._plugins[_i310];if(_p5.send){_p5.send(name,value);}}}/**
23428
23437
  * @private
23429
23438
  * @deprecated
23430
23439
  */},{key:"clear",value:function clear(){throw"Viewer#clear() no longer implemented - use '#sendToPlugins(\"clear\") instead";}/**
@@ -23481,7 +23490,7 @@ this.scene.fire("rendering",{},true);return this._renderSnapshotToCanvas(params)
23481
23490
  * @param {String} [params.format="jpeg"] Desired format; "jpeg", "png" or "bmp".
23482
23491
  * @param {Boolean} [params.includeGizmos=false] When true, will include gizmos like {@link SectionPlane} in the snapshot.
23483
23492
  * @returns {Promise} Promise which returns a string-encoded image data URI.
23484
- */},{key:"getSnapshotWithPlugins",value:function(){var _getSnapshotWithPlugins=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee7(){var _style$sheet;var params,snapshotResult,pluginToCapture,pluginContainerElements,_i309,len,plugin,containerElement,style,snapshotCanvas,_i310,_len42,_containerElement,_args10=arguments;return _regeneratorRuntime().wrap(function _callee7$(_context11){while(1){switch(_context11.prev=_context11.next){case 0:params=_args10.length>0&&_args10[0]!==undefined?_args10[0]:{};// We use gl.readPixels to get the WebGL canvas snapshot in a new
23493
+ */},{key:"getSnapshotWithPlugins",value:function(){var _getSnapshotWithPlugins=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee7(){var _style$sheet;var params,snapshotResult,pluginToCapture,pluginContainerElements,_i311,len,plugin,containerElement,style,snapshotCanvas,_i312,_len42,_containerElement,_args10=arguments;return _regeneratorRuntime().wrap(function _callee7$(_context11){while(1){switch(_context11.prev=_context11.next){case 0:params=_args10.length>0&&_args10[0]!==undefined?_args10[0]:{};// We use gl.readPixels to get the WebGL canvas snapshot in a new
23485
23494
  // HTMLCanvas element, scaled to the target snapshot size, then
23486
23495
  // use html2canvas to render each plugin's container element into
23487
23496
  // that HTMLCanvas. Finally, we save the HTMLCanvas to a bitmap.
@@ -23490,20 +23499,20 @@ this.scene.fire("rendering",{},true);return this._renderSnapshotToCanvas(params)
23490
23499
  // blurring. Instead, we manage the scale and redraw of the WebGL
23491
23500
  // canvas ourselves, in order to allow the Viewer to render the
23492
23501
  // right amount of pixels, for a sharper image.
23493
- snapshotResult=this._renderSnapshotToCanvas(params);pluginToCapture={};pluginContainerElements=[];for(_i309=0,len=this._plugins.length;_i309<len;_i309++){// Find plugin container elements
23494
- plugin=this._plugins[_i309];if(plugin.getContainerElement){containerElement=plugin.getContainerElement();if(containerElement!==document.body){if(!pluginToCapture[containerElement.id]){pluginToCapture[containerElement.id]=true;pluginContainerElements.push(containerElement);}}}}// Added to fix label's text offset in an html2canvas capture (See XEOK-151)
23502
+ snapshotResult=this._renderSnapshotToCanvas(params);pluginToCapture={};pluginContainerElements=[];for(_i311=0,len=this._plugins.length;_i311<len;_i311++){// Find plugin container elements
23503
+ plugin=this._plugins[_i311];if(plugin.getContainerElement){containerElement=plugin.getContainerElement();if(containerElement!==document.body){if(!pluginToCapture[containerElement.id]){pluginToCapture[containerElement.id]=true;pluginContainerElements.push(containerElement);}}}}// Added to fix label's text offset in an html2canvas capture (See XEOK-151)
23495
23504
  // based on https://github.com/niklasvh/html2canvas/issues/2775#issuecomment-1316356991
23496
- style=document.createElement('style');document.head.appendChild(style);(_style$sheet=style.sheet)===null||_style$sheet===void 0?void 0:_style$sheet.insertRule('body > div:last-child img { display: inline-block; }');snapshotCanvas=snapshotResult.canvas;_i310=0,_len42=pluginContainerElements.length;case 10:if(!(_i310<_len42)){_context11.next=18;break;}_containerElement=pluginContainerElements[_i310];_context11.next=14;return html2canvas(_containerElement,{canvas:snapshotCanvas,backgroundColor:null,scale:snapshotCanvas.width/_containerElement.clientWidth});case 14:// Reverts translation and scaling applied to the snapshotCanvas's context
23505
+ style=document.createElement('style');document.head.appendChild(style);(_style$sheet=style.sheet)===null||_style$sheet===void 0?void 0:_style$sheet.insertRule('body > div:last-child img { display: inline-block; }');snapshotCanvas=snapshotResult.canvas;_i312=0,_len42=pluginContainerElements.length;case 10:if(!(_i312<_len42)){_context11.next=18;break;}_containerElement=pluginContainerElements[_i312];_context11.next=14;return html2canvas(_containerElement,{canvas:snapshotCanvas,backgroundColor:null,scale:snapshotCanvas.width/_containerElement.clientWidth});case 14:// Reverts translation and scaling applied to the snapshotCanvas's context
23497
23506
  // by the html2canvas call (inside the ForeignObjectRenderer's constructor)
23498
23507
  // (implemented to compensate XCD-153 issue)
23499
- snapshotCanvas.getContext("2d").resetTransform();case 15:_i310++;_context11.next=10;break;case 18:style.remove();return _context11.abrupt("return",snapshotResult.toDataURL());case 20:case"end":return _context11.stop();}}},_callee7,this);}));function getSnapshotWithPlugins(){return _getSnapshotWithPlugins.apply(this,arguments);}return getSnapshotWithPlugins;}()/**
23508
+ snapshotCanvas.getContext("2d").resetTransform();case 15:_i312++;_context11.next=10;break;case 18:style.remove();return _context11.abrupt("return",snapshotResult.toDataURL());case 20:case"end":return _context11.stop();}}},_callee7,this);}));function getSnapshotWithPlugins(){return _getSnapshotWithPlugins.apply(this,arguments);}return getSnapshotWithPlugins;}()/**
23500
23509
  * Exits snapshot mode.
23501
23510
  *
23502
23511
  * Switches rendering back to the main canvas.
23503
23512
  *
23504
23513
  */},{key:"endSnapshot",value:function endSnapshot(){if(this._snapshotBegun){this.scene._renderer.snapshot.endSnapshot();this._snapshotBegun=false;}}/** Destroys this Viewer.
23505
23514
  */},{key:"destroy",value:function destroy(){var plugins=this._plugins.slice();// Array will modify as we delete plugins
23506
- for(var _i311=0,len=plugins.length;_i311<len;_i311++){var plugin=plugins[_i311];plugin.destroy();}this.scene.destroy();}}]);return Viewer;}();/**
23515
+ for(var _i313=0,len=plugins.length;_i313<len;_i313++){var plugin=plugins[_i313];plugin.destroy();}this.scene.destroy();}}]);return Viewer;}();/**
23507
23516
  * @param {Component} scene
23508
23517
  * @param {*} [cfg] Texture configuration
23509
23518
  * @param {String[]} [cfg.src=null] Path to 6 images
@@ -24092,7 +24101,7 @@ primitive:"triangles",positions:[1,1,1,-1,1,1,-1,-1,1,1,-1,1,// v0-v1-v2-v3 fron
24092
24101
  * Shows all or hides the angle label of each {@link AngleMeasurement}.
24093
24102
  *
24094
24103
  * @param {Boolean} labelsShown Whether or not to show the labels.
24095
- */},{key:"setLabelsShown",value:function setLabelsShown(labelsShown){for(var _i312=0,_Object$entries3=Object.entries(this.measurements);_i312<_Object$entries3.length;_i312++){var _Object$entries3$_i=_slicedToArray(_Object$entries3[_i312],2),key=_Object$entries3$_i[0],measurement=_Object$entries3$_i[1];measurement.labelShown=labelsShown;}}/**
24104
+ */},{key:"setLabelsShown",value:function setLabelsShown(labelsShown){for(var _i314=0,_Object$entries3=Object.entries(this.measurements);_i314<_Object$entries3.length;_i314++){var _Object$entries3$_i=_slicedToArray(_Object$entries3[_i314],2),key=_Object$entries3$_i[0],measurement=_Object$entries3$_i[1];measurement.labelShown=labelsShown;}}/**
24096
24105
  * Destroys all {@link AngleMeasurement}s.
24097
24106
  */},{key:"clear",value:function clear(){var ids=Object.keys(this._measurements);for(var i=0,len=ids.length;i<len;i++){this.destroyMeasurement(ids[i]);}}/**
24098
24107
  * Destroys this AngleMeasurementsPlugin.
@@ -24817,7 +24826,7 @@ geometry:arrowShaft,material:zAxisMaterial,pickable:false,collidable:false,visib
24817
24826
  geometry:new ReadableGeometry(axisGizmoScene,buildVectorTextGeometry({text:"Z",size:1.5})),material:zAxisLabelMaterial,pickable:false,collidable:false,visible:cfg.visible!==false,position:[0,0,7],billboard:"spherical"})];return _this142;}/** Shows or hides this AxisGizmoPlugin.
24818
24827
  *
24819
24828
  * @param visible
24820
- */_createClass(AxisGizmoPlugin,[{key:"setVisible",value:function setVisible(visible){for(var _i313=0;_i313<this._meshes.length;_i313++){this._meshes[_i313].visible=visible;}}/**
24829
+ */_createClass(AxisGizmoPlugin,[{key:"setVisible",value:function setVisible(visible){for(var _i315=0;_i315<this._meshes.length;_i315++){this._meshes[_i315].visible=visible;}}/**
24821
24830
  * Destroys this AxisGizmoPlugin.
24822
24831
  */},{key:"destroy",value:function destroy(){this._axisGizmoCanvas=null;this._axisGizmoScene.destroy();this._axisGizmoScene=null;_get(_getPrototypeOf(AxisGizmoPlugin.prototype),"destroy",this).call(this);}}]);return AxisGizmoPlugin;}(Plugin);var tempVec3$2=math.vec3();var tempVec3a$5=math.vec3();var tempVec3b$2=math.vec3();var tempVec3c$1=math.vec3();/**
24823
24832
  * {@link Viewer} plugin that saves and loads BCF viewpoints as JSON objects.
@@ -25152,13 +25161,13 @@ geometry:new ReadableGeometry(axisGizmoScene,buildVectorTextGeometry({text:"Z",s
25152
25161
  */_createClass(BCFViewpointsPlugin,[{key:"getViewpoint",value:function getViewpoint(){var _this144=this;var options=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};var scene=this.viewer.scene;var camera=scene.camera;var realWorldOffset=scene.realWorldOffset;var reverseClippingPlanes=options.reverseClippingPlanes===true;var bcfViewpoint={};// Camera
25153
25162
  var lookDirection=math.normalizeVec3(math.subVec3(camera.look,camera.eye,math.vec3()));var eye=camera.eye;var up=camera.up;if(camera.yUp){// BCF is Z up
25154
25163
  lookDirection=YToZ(lookDirection);eye=YToZ(eye);up=YToZ(up);}var camera_view_point=xyzArrayToObject(math.addVec3(eye,realWorldOffset));if(camera.projection==="ortho"){bcfViewpoint.orthogonal_camera={camera_view_point:camera_view_point,camera_direction:xyzArrayToObject(lookDirection),camera_up_vector:xyzArrayToObject(up),view_to_world_scale:camera.ortho.scale};}else{bcfViewpoint.perspective_camera={camera_view_point:camera_view_point,camera_direction:xyzArrayToObject(lookDirection),camera_up_vector:xyzArrayToObject(up),field_of_view:camera.perspective.fov};}// Section planes
25155
- var sectionPlanes=scene.sectionPlanes;for(var id in sectionPlanes){if(sectionPlanes.hasOwnProperty(id)){var sectionPlane=sectionPlanes[id];if(!sectionPlane.active){continue;}var location=sectionPlane.pos;var _direction2=void 0;if(reverseClippingPlanes){_direction2=math.negateVec3(sectionPlane.dir,math.vec3());}else{_direction2=sectionPlane.dir;}if(camera.yUp){// BCF is Z up
25156
- location=YToZ(location);_direction2=YToZ(_direction2);}math.addVec3(location,realWorldOffset);location=xyzArrayToObject(location);_direction2=xyzArrayToObject(_direction2);if(!bcfViewpoint.clipping_planes){bcfViewpoint.clipping_planes=[];}bcfViewpoint.clipping_planes.push({location:location,direction:_direction2});}}// Lines
25157
- var lineSets=scene.lineSets;for(var _id in lineSets){if(lineSets.hasOwnProperty(_id)){var lineSet=lineSets[_id];if(!bcfViewpoint.lines){bcfViewpoint.lines=[];}var positions=lineSet.positions;var indices=lineSet.indices;for(var _i314=0,len=indices.length/2;_i314<len;_i314++){var _a8=indices[_i314*2];var b=indices[_i314*2+1];bcfViewpoint.lines.push({start_point:{x:positions[_a8*3+0],y:positions[_a8*3+1],z:positions[_a8*3+2]},end_point:{x:positions[b*3+0],y:positions[b*3+1],z:positions[b*3+2]}});}}}// Bitmaps
25164
+ var sectionPlanes=scene.sectionPlanes;for(var id in sectionPlanes){if(sectionPlanes.hasOwnProperty(id)){var sectionPlane=sectionPlanes[id];if(!sectionPlane.active){continue;}var location=sectionPlane.pos;var _direction3=void 0;if(reverseClippingPlanes){_direction3=math.negateVec3(sectionPlane.dir,math.vec3());}else{_direction3=sectionPlane.dir;}if(camera.yUp){// BCF is Z up
25165
+ location=YToZ(location);_direction3=YToZ(_direction3);}math.addVec3(location,realWorldOffset);location=xyzArrayToObject(location);_direction3=xyzArrayToObject(_direction3);if(!bcfViewpoint.clipping_planes){bcfViewpoint.clipping_planes=[];}bcfViewpoint.clipping_planes.push({location:location,direction:_direction3});}}// Lines
25166
+ var lineSets=scene.lineSets;for(var _id in lineSets){if(lineSets.hasOwnProperty(_id)){var lineSet=lineSets[_id];if(!bcfViewpoint.lines){bcfViewpoint.lines=[];}var positions=lineSet.positions;var indices=lineSet.indices;for(var _i316=0,len=indices.length/2;_i316<len;_i316++){var _a8=indices[_i316*2];var b=indices[_i316*2+1];bcfViewpoint.lines.push({start_point:{x:positions[_a8*3+0],y:positions[_a8*3+1],z:positions[_a8*3+2]},end_point:{x:positions[b*3+0],y:positions[b*3+1],z:positions[b*3+2]}});}}}// Bitmaps
25158
25167
  var bitmaps=scene.bitmaps;for(var _id2 in bitmaps){if(bitmaps.hasOwnProperty(_id2)){var bitmap=bitmaps[_id2];var _location=bitmap.pos;var normal=bitmap.normal;var _up4=bitmap.up;if(camera.yUp){// BCF is Z up
25159
25168
  _location=YToZ(_location);normal=YToZ(normal);_up4=YToZ(_up4);}math.addVec3(_location,realWorldOffset);if(!bcfViewpoint.bitmaps){bcfViewpoint.bitmaps=[];}bcfViewpoint.bitmaps.push({bitmap_type:bitmap.type,bitmap_data:bitmap.imageData,location:xyzArrayToObject(_location),normal:xyzArrayToObject(normal),up:xyzArrayToObject(_up4),height:bitmap.height});}}// Entity states
25160
25169
  bcfViewpoint.components={visibility:{view_setup_hints:{spaces_visible:!!options.spacesVisible,space_boundaries_visible:!!options.spaceBoundariesVisible,openings_visible:!!options.openingsVisible,spaces_translucent:!!options.spaces_translucent,space_boundaries_translucent:!!options.space_boundaries_translucent,openings_translucent:!!options.openings_translucent}}};var opacityObjectIds=new Set(scene.opacityObjectIds);var xrayedObjectIds=new Set(scene.xrayedObjectIds);var colorizedObjectIds=new Set(scene.colorizedObjectIds);var coloringMap=Object.values(scene.objects).filter(function(entity){return opacityObjectIds.has(entity.id)||colorizedObjectIds.has(entity.id)||xrayedObjectIds.has(entity.id);}).reduce(function(coloringMap,entity){var color=colorizeToRGB(entity.colorize);var alpha;if(entity.xrayed){if(scene.xrayMaterial.fillAlpha===0.0&&scene.xrayMaterial.edgeAlpha!==0.0){// BCF can't deal with edges. If xRay is implemented only with edges, set an arbitrary opacity
25161
- alpha=0.1;}else{alpha=scene.xrayMaterial.fillAlpha;}alpha=Math.round(alpha*255).toString(16).padStart(2,"0");color=alpha+color;}else if(opacityObjectIds.has(entity.id)){alpha=Math.round(entity.opacity*255).toString(16).padStart(2,"0");color=alpha+color;}if(!coloringMap[color]){coloringMap[color]=[];}var objectId=entity.id;var originalSystemId=entity.originalSystemId;var component={ifc_guid:originalSystemId,originating_system:_this144.originatingSystem};if(originalSystemId!==objectId){component.authoring_tool_id=objectId;}coloringMap[color].push(component);return coloringMap;},{});var coloringArray=Object.entries(coloringMap).map(function(_ref19){var _ref20=_slicedToArray(_ref19,2),color=_ref20[0],components=_ref20[1];return{color:color,components:components};});bcfViewpoint.components.coloring=coloringArray;var objectIds=scene.objectIds;var visibleObjects=scene.visibleObjects;var visibleObjectIds=scene.visibleObjectIds;var invisibleObjectIds=objectIds.filter(function(id){return!visibleObjects[id];});var selectedObjectIds=scene.selectedObjectIds;if(options.defaultInvisible||visibleObjectIds.length<invisibleObjectIds.length){bcfViewpoint.components.visibility.exceptions=this._createBCFComponents(visibleObjectIds);bcfViewpoint.components.visibility.default_visibility=false;}else{bcfViewpoint.components.visibility.exceptions=this._createBCFComponents(invisibleObjectIds);bcfViewpoint.components.visibility.default_visibility=true;}bcfViewpoint.components.selection=this._createBCFComponents(selectedObjectIds);bcfViewpoint.components.translucency=this._createBCFComponents(scene.xrayedObjectIds);if(options.snapshot!==false){bcfViewpoint.snapshot={snapshot_type:"png",snapshot_data:this.viewer.getSnapshot({format:"png"})};}return bcfViewpoint;}},{key:"_createBCFComponents",value:function _createBCFComponents(objectIds){var scene=this.viewer.scene;var components=[];for(var _i315=0,len=objectIds.length;_i315<len;_i315++){var objectId=objectIds[_i315];var entity=scene.objects[objectId];if(entity){var component={ifc_guid:entity.originalSystemId,originating_system:this.originatingSystem};if(entity.originalSystemId!==objectId){component.authoring_tool_id=objectId;}components.push(component);}}return components;}/**
25170
+ alpha=0.1;}else{alpha=scene.xrayMaterial.fillAlpha;}alpha=Math.round(alpha*255).toString(16).padStart(2,"0");color=alpha+color;}else if(opacityObjectIds.has(entity.id)){alpha=Math.round(entity.opacity*255).toString(16).padStart(2,"0");color=alpha+color;}if(!coloringMap[color]){coloringMap[color]=[];}var objectId=entity.id;var originalSystemId=entity.originalSystemId;var component={ifc_guid:originalSystemId,originating_system:_this144.originatingSystem};if(originalSystemId!==objectId){component.authoring_tool_id=objectId;}coloringMap[color].push(component);return coloringMap;},{});var coloringArray=Object.entries(coloringMap).map(function(_ref19){var _ref20=_slicedToArray(_ref19,2),color=_ref20[0],components=_ref20[1];return{color:color,components:components};});bcfViewpoint.components.coloring=coloringArray;var objectIds=scene.objectIds;var visibleObjects=scene.visibleObjects;var visibleObjectIds=scene.visibleObjectIds;var invisibleObjectIds=objectIds.filter(function(id){return!visibleObjects[id];});var selectedObjectIds=scene.selectedObjectIds;if(options.defaultInvisible||visibleObjectIds.length<invisibleObjectIds.length){bcfViewpoint.components.visibility.exceptions=this._createBCFComponents(visibleObjectIds);bcfViewpoint.components.visibility.default_visibility=false;}else{bcfViewpoint.components.visibility.exceptions=this._createBCFComponents(invisibleObjectIds);bcfViewpoint.components.visibility.default_visibility=true;}bcfViewpoint.components.selection=this._createBCFComponents(selectedObjectIds);bcfViewpoint.components.translucency=this._createBCFComponents(scene.xrayedObjectIds);if(options.snapshot!==false){bcfViewpoint.snapshot={snapshot_type:"png",snapshot_data:this.viewer.getSnapshot({format:"png"})};}return bcfViewpoint;}},{key:"_createBCFComponents",value:function _createBCFComponents(objectIds){var scene=this.viewer.scene;var components=[];for(var _i317=0,len=objectIds.length;_i317<len;_i317++){var objectId=objectIds[_i317];var entity=scene.objects[objectId];if(entity){var component={ifc_guid:entity.originalSystemId,originating_system:this.originatingSystem};if(entity.originalSystemId!==objectId){component.authoring_tool_id=objectId;}components.push(component);}}return components;}/**
25162
25171
  * Sets viewer state to the given BCF viewpoint.
25163
25172
  *
25164
25173
  * Note that xeokit's {@link Camera#look} is the **point-of-interest**, whereas the BCF ````camera_direction```` is a
@@ -25180,7 +25189,7 @@ alpha=0.1;}else{alpha=scene.xrayMaterial.fillAlpha;}alpha=Math.round(alpha*255).
25180
25189
  * @param {Boolean} [options.reverseClippingPlanes=false] When ````true````, clipping planes are reversed (https://github.com/buildingSMART/BCF-XML/issues/193)
25181
25190
  * @param {Boolean} [options.updateCompositeObjects=false] When ````true````, then when visibility and selection updates refer to composite objects (eg. an IfcBuildingStorey),
25182
25191
  * then this method will apply the updates to objects within those composites.
25183
- */},{key:"setViewpoint",value:function setViewpoint(bcfViewpoint){var _this145=this;var options=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};if(!bcfViewpoint){return;}var viewer=this.viewer;var scene=viewer.scene;var camera=scene.camera;var rayCast=options.rayCast!==false;var immediate=options.immediate!==false;var reset=options.reset!==false;var realWorldOffset=scene.realWorldOffset;var reverseClippingPlanes=options.reverseClippingPlanes===true;scene.clearSectionPlanes();if(bcfViewpoint.clipping_planes&&bcfViewpoint.clipping_planes.length>0){bcfViewpoint.clipping_planes.forEach(function(e){var pos=xyzObjectToArray(e.location,tempVec3$2);var dir=xyzObjectToArray(e.direction,tempVec3$2);if(reverseClippingPlanes){math.negateVec3(dir);}math.subVec3(pos,realWorldOffset);if(camera.yUp){pos=ZToY(pos);dir=ZToY(dir);}new SectionPlane(scene,{pos:pos,dir:dir});});}scene.clearLines();if(bcfViewpoint.lines&&bcfViewpoint.lines.length>0){var positions=[];var indices=[];var _i316=0;bcfViewpoint.lines.forEach(function(e){if(!e.start_point){return;}if(!e.end_point){return;}positions.push(e.start_point.x);positions.push(e.start_point.y);positions.push(e.start_point.z);positions.push(e.end_point.x);positions.push(e.end_point.y);positions.push(e.end_point.z);indices.push(_i316++);indices.push(_i316++);});new LineSet(scene,{positions:positions,indices:indices,clippable:false,collidable:true});}scene.clearBitmaps();if(bcfViewpoint.bitmaps&&bcfViewpoint.bitmaps.length>0){bcfViewpoint.bitmaps.forEach(function(e){var bitmap_type=e.bitmap_type||"jpg";// "jpg" | "png"
25192
+ */},{key:"setViewpoint",value:function setViewpoint(bcfViewpoint){var _this145=this;var options=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};if(!bcfViewpoint){return;}var viewer=this.viewer;var scene=viewer.scene;var camera=scene.camera;var rayCast=options.rayCast!==false;var immediate=options.immediate!==false;var reset=options.reset!==false;var realWorldOffset=scene.realWorldOffset;var reverseClippingPlanes=options.reverseClippingPlanes===true;scene.clearSectionPlanes();if(bcfViewpoint.clipping_planes&&bcfViewpoint.clipping_planes.length>0){bcfViewpoint.clipping_planes.forEach(function(e){var pos=xyzObjectToArray(e.location,tempVec3$2);var dir=xyzObjectToArray(e.direction,tempVec3$2);if(reverseClippingPlanes){math.negateVec3(dir);}math.subVec3(pos,realWorldOffset);if(camera.yUp){pos=ZToY(pos);dir=ZToY(dir);}new SectionPlane(scene,{pos:pos,dir:dir});});}scene.clearLines();if(bcfViewpoint.lines&&bcfViewpoint.lines.length>0){var positions=[];var indices=[];var _i318=0;bcfViewpoint.lines.forEach(function(e){if(!e.start_point){return;}if(!e.end_point){return;}positions.push(e.start_point.x);positions.push(e.start_point.y);positions.push(e.start_point.z);positions.push(e.end_point.x);positions.push(e.end_point.y);positions.push(e.end_point.z);indices.push(_i318++);indices.push(_i318++);});new LineSet(scene,{positions:positions,indices:indices,clippable:false,collidable:true});}scene.clearBitmaps();if(bcfViewpoint.bitmaps&&bcfViewpoint.bitmaps.length>0){bcfViewpoint.bitmaps.forEach(function(e){var bitmap_type=e.bitmap_type||"jpg";// "jpg" | "png"
25184
25193
  var bitmap_data=e.bitmap_data;// base64
25185
25194
  var location=xyzObjectToArray(e.location,tempVec3a$5);var normal=xyzObjectToArray(e.normal,tempVec3b$2);var up=xyzObjectToArray(e.up,tempVec3c$1);var height=e.height||1;if(!bitmap_type){return;}if(!bitmap_data){return;}if(!location){return;}if(!normal){return;}if(!up){return;}if(camera.yUp){location=ZToY(location);normal=ZToY(normal);up=ZToY(up);}new Bitmap(scene,{src:bitmap_data,type:bitmap_type,pos:location,normal:normal,up:up,clippable:false,collidable:true,height:height});});}if(reset){scene.setObjectsXRayed(scene.xrayedObjectIds,false);scene.setObjectsHighlighted(scene.highlightedObjectIds,false);scene.setObjectsSelected(scene.selectedObjectIds,false);}if(bcfViewpoint.components){if(bcfViewpoint.components.visibility){if(!bcfViewpoint.components.visibility.default_visibility){scene.setObjectsVisible(scene.objectIds,false);if(bcfViewpoint.components.visibility.exceptions){bcfViewpoint.components.visibility.exceptions.forEach(function(component){return _this145._withBCFComponent(options,component,function(entity){return entity.visible=true;});});}}else{scene.setObjectsVisible(scene.objectIds,true);if(bcfViewpoint.components.visibility.exceptions){bcfViewpoint.components.visibility.exceptions.forEach(function(component){return _this145._withBCFComponent(options,component,function(entity){return entity.visible=false;});});}}var view_setup_hints=bcfViewpoint.components.visibility.view_setup_hints;if(view_setup_hints){if(view_setup_hints.spaces_visible===false){scene.setObjectsVisible(viewer.metaScene.getObjectIDsByType("IfcSpace"),false);}if(view_setup_hints.spaces_translucent!==undefined){scene.setObjectsXRayed(viewer.metaScene.getObjectIDsByType("IfcSpace"),true);}if(view_setup_hints.space_boundaries_visible!==undefined);if(view_setup_hints.openings_visible===false){scene.setObjectsVisible(viewer.metaScene.getObjectIDsByType("IfcOpening"),true);}if(view_setup_hints.space_boundaries_translucent!==undefined);if(view_setup_hints.openings_translucent!==undefined){scene.setObjectsXRayed(viewer.metaScene.getObjectIDsByType("IfcOpening"),true);}}}if(bcfViewpoint.components.selection){scene.setObjectsSelected(scene.selectedObjectIds,false);bcfViewpoint.components.selection.forEach(function(component){return _this145._withBCFComponent(options,component,function(entity){return entity.selected=true;});});}if(bcfViewpoint.components.translucency){scene.setObjectsXRayed(scene.xrayedObjectIds,false);bcfViewpoint.components.translucency.forEach(function(component){return _this145._withBCFComponent(options,component,function(entity){return entity.xrayed=true;});});}if(bcfViewpoint.components.coloring){scene.setObjectsColorized(scene.colorizedObjectIds,null);bcfViewpoint.components.coloring.forEach(function(coloring){var color=coloring.color;var alpha=0;var alphaDefined=false;if(color.length===8){alpha=parseInt(color.substring(0,2),16)/255;if(alpha<=1.0&&alpha>=0.95){alpha=1.0;}color=color.substring(2);alphaDefined=true;}var colorize=[parseInt(color.substring(0,2),16)/255,parseInt(color.substring(2,4),16)/255,parseInt(color.substring(4,6),16)/255];coloring.components.map(function(component){return _this145._withBCFComponent(options,component,function(entity){entity.colorize=colorize;if(alphaDefined){entity.opacity=alpha;}});});});}}if(bcfViewpoint.perspective_camera||bcfViewpoint.orthogonal_camera){var eye;var look;var _up5;var projection;if(bcfViewpoint.perspective_camera){eye=xyzObjectToArray(bcfViewpoint.perspective_camera.camera_view_point,tempVec3$2);look=xyzObjectToArray(bcfViewpoint.perspective_camera.camera_direction,tempVec3$2);_up5=xyzObjectToArray(bcfViewpoint.perspective_camera.camera_up_vector,tempVec3$2);camera.perspective.fov=bcfViewpoint.perspective_camera.field_of_view;projection="perspective";}else{eye=xyzObjectToArray(bcfViewpoint.orthogonal_camera.camera_view_point,tempVec3$2);look=xyzObjectToArray(bcfViewpoint.orthogonal_camera.camera_direction,tempVec3$2);_up5=xyzObjectToArray(bcfViewpoint.orthogonal_camera.camera_up_vector,tempVec3$2);camera.ortho.scale=bcfViewpoint.orthogonal_camera.view_to_world_scale;projection="ortho";}math.subVec3(eye,realWorldOffset);if(camera.yUp){eye=ZToY(eye);look=ZToY(look);_up5=ZToY(_up5);}if(rayCast){var hit=scene.pick({pickSurface:true,// <<------ This causes picking to find the intersection point on the entity
25186
25195
  origin:eye,direction:look});look=hit?hit.worldPos:math.addVec3(eye,look,tempVec3$2);}else{look=math.addVec3(eye,look,tempVec3$2);}if(immediate){camera.eye=eye;camera.look=look;camera.up=_up5;camera.projection=projection;}else{viewer.cameraFlight.flyTo({eye:eye,look:look,up:_up5,duration:options.duration,projection:projection});}}}},{key:"_withBCFComponent",value:function _withBCFComponent(options,component,callback){var viewer=this.viewer;var scene=viewer.scene;if(component.authoring_tool_id&&component.originating_system===this.originatingSystem){var id=component.authoring_tool_id;var entity=scene.objects[id];if(entity){callback(entity);return;}if(options.updateCompositeObjects){var metaObject=viewer.metaScene.metaObjects[id];if(metaObject){scene.withObjects(viewer.metaScene.getObjectIDsInSubtree(id),callback);return;}}}if(component.ifc_guid){var originalSystemId=component.ifc_guid;var _entity2=scene.objects[originalSystemId];if(_entity2){callback(_entity2);return;}if(options.updateCompositeObjects){var _metaObject10=viewer.metaScene.metaObjects[originalSystemId];if(_metaObject10){scene.withObjects(viewer.metaScene.getObjectIDsInSubtree(originalSystemId),callback);return;}}Object.keys(scene.models).forEach(function(modelId){var id=math.globalizeObjectId(modelId,originalSystemId);var entity=scene.objects[id];if(entity){callback(entity);return;}if(options.updateCompositeObjects){var _metaObject11=viewer.metaScene.metaObjects[id];if(_metaObject11){scene.withObjects(viewer.metaScene.getObjectIDsInSubtree(id),callback);}}});}}/**
@@ -25900,11 +25909,11 @@ origin:eye,direction:look});look=hit?hit.worldPos:math.addVec3(eye,look,tempVec3
25900
25909
  * Shows all or hides the distance label of each {@link DistanceMeasurement}.
25901
25910
  *
25902
25911
  * @param {Boolean} labelsShown Whether or not to show the labels.
25903
- */},{key:"setLabelsShown",value:function setLabelsShown(labelsShown){for(var _i317=0,_Object$entries4=Object.entries(this.measurements);_i317<_Object$entries4.length;_i317++){var _Object$entries4$_i=_slicedToArray(_Object$entries4[_i317],2),key=_Object$entries4$_i[0],measurement=_Object$entries4$_i[1];measurement.labelShown=labelsShown;}}/**
25912
+ */},{key:"setLabelsShown",value:function setLabelsShown(labelsShown){for(var _i319=0,_Object$entries4=Object.entries(this.measurements);_i319<_Object$entries4.length;_i319++){var _Object$entries4$_i=_slicedToArray(_Object$entries4[_i319],2),key=_Object$entries4$_i[0],measurement=_Object$entries4$_i[1];measurement.labelShown=labelsShown;}}/**
25904
25913
  * Shows all or hides the axis wires of each {@link DistanceMeasurement}.
25905
25914
  *
25906
25915
  * @param {Boolean} labelsShown Whether or not to show the axis wires.
25907
- */},{key:"setAxisVisible",value:function setAxisVisible(axisVisible){for(var _i318=0,_Object$entries5=Object.entries(this.measurements);_i318<_Object$entries5.length;_i318++){var _Object$entries5$_i=_slicedToArray(_Object$entries5[_i318],2),key=_Object$entries5$_i[0],measurement=_Object$entries5$_i[1];measurement.axisVisible=axisVisible;}this.defaultAxisVisible=axisVisible;}/**
25916
+ */},{key:"setAxisVisible",value:function setAxisVisible(axisVisible){for(var _i320=0,_Object$entries5=Object.entries(this.measurements);_i320<_Object$entries5.length;_i320++){var _Object$entries5$_i=_slicedToArray(_Object$entries5[_i320],2),key=_Object$entries5$_i[0],measurement=_Object$entries5$_i[1];measurement.axisVisible=axisVisible;}this.defaultAxisVisible=axisVisible;}/**
25908
25917
  * Gets if the axis wires of each {@link DistanceMeasurement} are visible.
25909
25918
  *
25910
25919
  * @returns {Boolean} Whether or not the axis wires are visible.
@@ -26301,7 +26310,7 @@ sceneModel.fire("loaded",true,false);});if(ok){ok();}},function(msg){plugin.erro
26301
26310
  sceneModel.fire("loaded",true,false);if(ok){ok();}},function(msg){sceneModel.error(msg);sceneModel.fire("error",msg);if(error){error(msg);}});}}]);return GLTFSceneModelLoader;}();function loadGLTF(plugin,src,metaModelJSON,options,sceneModel,ok,error){var spinner=plugin.viewer.scene.canvas.spinner;spinner.processes++;var isGLB=src.split('.').pop()==="glb";if(isGLB){plugin.dataSource.getGLB(src,function(arrayBuffer){// OK
26302
26311
  options.basePath=getBasePath(src);parseGLTF(plugin,src,arrayBuffer,metaModelJSON,options,sceneModel,ok,error);spinner.processes--;},function(err){spinner.processes--;error(err);});}else{plugin.dataSource.getGLTF(src,function(gltf){// OK
26303
26312
  options.basePath=getBasePath(src);parseGLTF(plugin,src,gltf,metaModelJSON,options,sceneModel,ok,error);spinner.processes--;},function(err){spinner.processes--;error(err);});}}function getBasePath(src){var i=src.lastIndexOf("/");return i!==0?src.substring(0,i+1):"";}function parseGLTF(plugin,src,gltf,metaModelJSON,options,sceneModel,ok,error){var spinner=plugin.viewer.scene.canvas.spinner;spinner.processes++;parse$4(gltf,GLTFLoader,{baseUri:options.basePath}).then(function(gltfData){var processedGLTF=postProcessGLTF(gltfData);var ctx={src:src,entityId:options.entityId,metaModelJSON:metaModelJSON,autoMetaModel:options.autoMetaModel,globalizeObjectIds:options.globalizeObjectIds,metaObjects:[],loadBuffer:options.loadBuffer,basePath:options.basePath,handlenode:options.handlenode,backfaces:!!options.backfaces,gltfData:processedGLTF,scene:sceneModel.scene,plugin:plugin,sceneModel:sceneModel,//geometryCreated: {},
26304
- numObjects:0,nodes:[],nextId:0,log:function log(msg){plugin.log(msg);}};loadTextures(ctx);loadMaterials(ctx);if(options.autoMetaModel){ctx.metaObjects.push({id:sceneModel.id,type:"Default",name:sceneModel.id});}loadDefaultScene(ctx);sceneModel.finalize();if(options.autoMetaModel){plugin.viewer.metaScene.createMetaModel(sceneModel.id,{metaObjects:ctx.metaObjects});}spinner.processes--;ok();})["catch"](function(err){if(error)error(err);});}function loadTextures(ctx){var gltfData=ctx.gltfData;var textures=gltfData.textures;if(textures){for(var _i319=0,len=textures.length;_i319<len;_i319++){loadTexture(ctx,textures[_i319]);}}}function loadTexture(ctx,texture){if(!texture.source||!texture.source.image){return;}var textureId="texture-".concat(ctx.nextId++);var minFilter=NearestMipMapLinearFilter;switch(texture.sampler.minFilter){case 9728:minFilter=NearestFilter;break;case 9729:minFilter=LinearFilter;break;case 9984:minFilter=NearestMipMapNearestFilter;break;case 9985:minFilter=LinearMipMapNearestFilter;break;case 9986:minFilter=NearestMipMapLinearFilter;break;case 9987:minFilter=LinearMipMapLinearFilter;break;}var magFilter=LinearFilter;switch(texture.sampler.magFilter){case 9728:magFilter=NearestFilter;break;case 9729:magFilter=LinearFilter;break;}var wrapS=RepeatWrapping;switch(texture.sampler.wrapS){case 33071:wrapS=ClampToEdgeWrapping;break;case 33648:wrapS=MirroredRepeatWrapping;break;case 10497:wrapS=RepeatWrapping;break;}var wrapT=RepeatWrapping;switch(texture.sampler.wrapT){case 33071:wrapT=ClampToEdgeWrapping;break;case 33648:wrapT=MirroredRepeatWrapping;break;case 10497:wrapT=RepeatWrapping;break;}var wrapR=RepeatWrapping;switch(texture.sampler.wrapR){case 33071:wrapR=ClampToEdgeWrapping;break;case 33648:wrapR=MirroredRepeatWrapping;break;case 10497:wrapR=RepeatWrapping;break;}ctx.sceneModel.createTexture({id:textureId,image:texture.source.image,flipY:!!texture.flipY,minFilter:minFilter,magFilter:magFilter,wrapS:wrapS,wrapT:wrapT,wrapR:wrapR,encoding:sRGBEncoding});texture._textureId=textureId;}function loadMaterials(ctx){var gltfData=ctx.gltfData;var materials=gltfData.materials;if(materials){for(var _i320=0,len=materials.length;_i320<len;_i320++){var material=materials[_i320];material._textureSetId=loadTextureSet(ctx,material);material._attributes=loadMaterialAttributes(ctx,material);}}}function loadTextureSet(ctx,material){var textureSetCfg={};if(material.normalTexture){textureSetCfg.normalTextureId=material.normalTexture.texture._textureId;}if(material.occlusionTexture){textureSetCfg.occlusionTextureId=material.occlusionTexture.texture._textureId;}if(material.emissiveTexture){textureSetCfg.emissiveTextureId=material.emissiveTexture.texture._textureId;}switch(material.alphaMode){case"OPAQUE":break;case"MASK":var alphaCutoff=material.alphaCutoff;// Default from the spec https://registry.khronos.org/glTF/specs/2.0/glTF-2.0.html#reference-material
26313
+ numObjects:0,nodes:[],nextId:0,log:function log(msg){plugin.log(msg);}};loadTextures(ctx);loadMaterials(ctx);if(options.autoMetaModel){ctx.metaObjects.push({id:sceneModel.id,type:"Default",name:sceneModel.id});}loadDefaultScene(ctx);sceneModel.finalize();if(options.autoMetaModel){plugin.viewer.metaScene.createMetaModel(sceneModel.id,{metaObjects:ctx.metaObjects});}spinner.processes--;ok();})["catch"](function(err){if(error)error(err);});}function loadTextures(ctx){var gltfData=ctx.gltfData;var textures=gltfData.textures;if(textures){for(var _i321=0,len=textures.length;_i321<len;_i321++){loadTexture(ctx,textures[_i321]);}}}function loadTexture(ctx,texture){if(!texture.source||!texture.source.image){return;}var textureId="texture-".concat(ctx.nextId++);var minFilter=NearestMipMapLinearFilter;switch(texture.sampler.minFilter){case 9728:minFilter=NearestFilter;break;case 9729:minFilter=LinearFilter;break;case 9984:minFilter=NearestMipMapNearestFilter;break;case 9985:minFilter=LinearMipMapNearestFilter;break;case 9986:minFilter=NearestMipMapLinearFilter;break;case 9987:minFilter=LinearMipMapLinearFilter;break;}var magFilter=LinearFilter;switch(texture.sampler.magFilter){case 9728:magFilter=NearestFilter;break;case 9729:magFilter=LinearFilter;break;}var wrapS=RepeatWrapping;switch(texture.sampler.wrapS){case 33071:wrapS=ClampToEdgeWrapping;break;case 33648:wrapS=MirroredRepeatWrapping;break;case 10497:wrapS=RepeatWrapping;break;}var wrapT=RepeatWrapping;switch(texture.sampler.wrapT){case 33071:wrapT=ClampToEdgeWrapping;break;case 33648:wrapT=MirroredRepeatWrapping;break;case 10497:wrapT=RepeatWrapping;break;}var wrapR=RepeatWrapping;switch(texture.sampler.wrapR){case 33071:wrapR=ClampToEdgeWrapping;break;case 33648:wrapR=MirroredRepeatWrapping;break;case 10497:wrapR=RepeatWrapping;break;}ctx.sceneModel.createTexture({id:textureId,image:texture.source.image,flipY:!!texture.flipY,minFilter:minFilter,magFilter:magFilter,wrapS:wrapS,wrapT:wrapT,wrapR:wrapR,encoding:sRGBEncoding});texture._textureId=textureId;}function loadMaterials(ctx){var gltfData=ctx.gltfData;var materials=gltfData.materials;if(materials){for(var _i322=0,len=materials.length;_i322<len;_i322++){var material=materials[_i322];material._textureSetId=loadTextureSet(ctx,material);material._attributes=loadMaterialAttributes(ctx,material);}}}function loadTextureSet(ctx,material){var textureSetCfg={};if(material.normalTexture){textureSetCfg.normalTextureId=material.normalTexture.texture._textureId;}if(material.occlusionTexture){textureSetCfg.occlusionTextureId=material.occlusionTexture.texture._textureId;}if(material.emissiveTexture){textureSetCfg.emissiveTextureId=material.emissiveTexture.texture._textureId;}switch(material.alphaMode){case"OPAQUE":break;case"MASK":var alphaCutoff=material.alphaCutoff;// Default from the spec https://registry.khronos.org/glTF/specs/2.0/glTF-2.0.html#reference-material
26305
26314
  textureSetCfg.alphaCutoff=alphaCutoff!==undefined?alphaCutoff:0.5;break;}var metallicPBR=material.pbrMetallicRoughness;if(material.pbrMetallicRoughness){var pbrMetallicRoughness=material.pbrMetallicRoughness;var baseColorTexture=pbrMetallicRoughness.baseColorTexture||pbrMetallicRoughness.colorTexture;if(baseColorTexture){if(baseColorTexture.texture){textureSetCfg.colorTextureId=baseColorTexture.texture._textureId;}else{textureSetCfg.colorTextureId=ctx.gltfData.textures[baseColorTexture.index]._textureId;}}if(metallicPBR.metallicRoughnessTexture){textureSetCfg.metallicRoughnessTextureId=metallicPBR.metallicRoughnessTexture.texture._textureId;}}var extensions=material.extensions;if(extensions){var specularPBR=extensions["KHR_materials_pbrSpecularGlossiness"];if(specularPBR){specularPBR.specularTexture;var specularColorTexture=specularPBR.specularColorTexture;if(specularColorTexture!==null&&specularColorTexture!==undefined){textureSetCfg.colorTextureId=ctx.gltfData.textures[specularColorTexture.index]._textureId;}}}if(textureSetCfg.normalTextureId!==undefined||textureSetCfg.occlusionTextureId!==undefined||textureSetCfg.emissiveTextureId!==undefined||textureSetCfg.colorTextureId!==undefined||textureSetCfg.metallicRoughnessTextureId!==undefined){textureSetCfg.id="textureSet-".concat(ctx.nextId++,";");ctx.sceneModel.createTextureSet(textureSetCfg);return textureSetCfg.id;}return null;}function loadMaterialAttributes(ctx,material){// Substitute RGBA for material, to use fast flat shading instead
26306
26315
  var extensions=material.extensions;var materialAttributes={color:new Float32Array([1,1,1,1]),opacity:1,metallic:0,roughness:1,doubleSided:true};if(extensions){var specularPBR=extensions["KHR_materials_pbrSpecularGlossiness"];if(specularPBR){var diffuseFactor=specularPBR.diffuseFactor;if(diffuseFactor!==null&&diffuseFactor!==undefined){materialAttributes.color.set(diffuseFactor);}}var common=extensions["KHR_materials_common"];if(common){var technique=common.technique;var values=common.values||{};var blinn=technique==="BLINN";var phong=technique==="PHONG";var lambert=technique==="LAMBERT";var diffuse=values.diffuse;if(diffuse&&(blinn||phong||lambert)){if(!utils.isString(diffuse)){materialAttributes.color.set(diffuse);}}var transparency=values.transparency;if(transparency!==null&&transparency!==undefined){materialAttributes.opacity=transparency;}var transparent=values.transparent;if(transparent!==null&&transparent!==undefined){materialAttributes.opacity=transparent;}}}var metallicPBR=material.pbrMetallicRoughness;if(metallicPBR){var baseColorFactor=metallicPBR.baseColorFactor;if(baseColorFactor){materialAttributes.color[0]=baseColorFactor[0];materialAttributes.color[1]=baseColorFactor[1];materialAttributes.color[2]=baseColorFactor[2];materialAttributes.opacity=baseColorFactor[3];}var metallicFactor=metallicPBR.metallicFactor;if(metallicFactor!==null&&metallicFactor!==undefined){materialAttributes.metallic=metallicFactor;}var roughnessFactor=metallicPBR.roughnessFactor;if(roughnessFactor!==null&&roughnessFactor!==undefined){materialAttributes.roughness=roughnessFactor;}}materialAttributes.doubleSided=material.doubleSided!==false;return materialAttributes;}function loadDefaultScene(ctx){var gltfData=ctx.gltfData;var scene=gltfData.scene||gltfData.scenes[0];if(!scene){error(ctx,"glTF has no default scene");return;}var nodes=scene.nodes;if(!nodes){return;}(function accumulateMeshInstantes(nodes){nodes.forEach(function(node){var mesh=node.mesh;if(mesh){mesh.instances||(mesh.instances=0);mesh.instances+=1;}if(node.children){accumulateMeshInstantes(node.children);}});})(nodes);// Create a SceneMesh for each mesh primitive, and a SceneModelEntity for the root node and each named node.
26307
26316
  var meshIdsStack=[];var meshIds=null;(function createSceneMeshesAndEntities(nodes,depth,parentMatrix){nodes.forEach(function(node){var nodeName=node.name;var entityId=nodeName!==undefined&&nodeName!==null&&nodeName||depth===0&&"entity-"+ctx.nextId++;if(entityId){while(ctx.sceneModel.objects[entityId]){entityId="entity-"+ctx.nextId++;}meshIdsStack.push(meshIds);meshIds=[];}var matrix=parseNodeMatrix(node,parentMatrix);if(node.mesh){parseNodeMesh(node,ctx,matrix,meshIds);}if(node.children){createSceneMeshesAndEntities(node.children,depth+1,matrix);}if(entityId){if(meshIds.length>0){var globalId=ctx.globalizeObjectIds?math.globalizeObjectId(ctx.sceneModel.id,entityId):entityId;ctx.sceneModel.createEntity({id:globalId,meshIds:meshIds,isObject:true});if(ctx.autoMetaModel){ctx.metaObjects.push({id:globalId,type:"Default",name:globalId,parent:ctx.sceneModel.id});}}meshIds=meshIdsStack.pop();}});})(nodes,0,null);}/**
@@ -26317,7 +26326,7 @@ var meshIdsStack=[];var meshIds=null;(function createSceneMeshesAndEntities(node
26317
26326
  * @param ctx Parsing context
26318
26327
  * @param matrix Matrix for the XKTMeshes
26319
26328
  * @param meshIds returns IDs of the new XKTMeshes
26320
- */function parseNodeMesh(node,ctx,matrix,meshIds){var mesh=node.mesh;if(!mesh){return;}var numPrimitives=mesh.primitives.length;if(numPrimitives>0){for(var _i321=0;_i321<numPrimitives;_i321++){var primitive=mesh.primitives[_i321];if(primitive.mode<4){continue;}var meshCfg={id:ctx.sceneModel.id+"."+ctx.numObjects++};var material=primitive.material;if(material){meshCfg.textureSetId=material._textureSetId;meshCfg.color=material._attributes.color;meshCfg.opacity=material._attributes.opacity;meshCfg.metallic=material._attributes.metallic;meshCfg.roughness=material._attributes.roughness;}else{meshCfg.color=new Float32Array([1.0,1.0,1.0]);meshCfg.opacity=1.0;}var backfaces=ctx.backfaces!==false||material&&material.doubleSided!==false;switch(primitive.mode){case 0:// POINTS
26329
+ */function parseNodeMesh(node,ctx,matrix,meshIds){var mesh=node.mesh;if(!mesh){return;}var numPrimitives=mesh.primitives.length;if(numPrimitives>0){for(var _i323=0;_i323<numPrimitives;_i323++){var primitive=mesh.primitives[_i323];if(primitive.mode<4){continue;}var meshCfg={id:ctx.sceneModel.id+"."+ctx.numObjects++};var material=primitive.material;if(material){meshCfg.textureSetId=material._textureSetId;meshCfg.color=material._attributes.color;meshCfg.opacity=material._attributes.opacity;meshCfg.metallic=material._attributes.metallic;meshCfg.roughness=material._attributes.roughness;}else{meshCfg.color=new Float32Array([1.0,1.0,1.0]);meshCfg.opacity=1.0;}var backfaces=ctx.backfaces!==false||material&&material.doubleSided!==false;switch(primitive.mode){case 0:// POINTS
26321
26330
  meshCfg.primitive="points";break;case 1:// LINES
26322
26331
  meshCfg.primitive="lines";break;case 2:// LINE_LOOP
26323
26332
  meshCfg.primitive="lines";break;case 3:// LINE_STRIP
@@ -26648,7 +26657,7 @@ if(!params.src&&!params.gltf){this.error("load() param expected: src or gltf");r
26648
26657
  {boundaries:[[11,11,2,2]],"dir":[-0.5,0.7071,-0.5],"up":[0.5,0.7071,0.5]},// Bottom-front-right corner
26649
26658
  {boundaries:[[0,6,1,1],[6,0,1,1],[23,6,1,1]],"dir":[0.5,-0.7071,0.5],"up":[0.5,0.7071,0.5]},// Top-back-left corner
26650
26659
  {boundaries:[[11,5,2,2]],"dir":[-0.5,-0.7071,-0.5],"up":[-0.5,0.7071,-0.5]}// Top-front-right corner
26651
- ];for(var _i322=0,len=areasZUp.length;_i322<len;_i322++){math.normalizeVec3(areasZUp[_i322].dir,areasZUp[_i322].dir);math.normalizeVec3(areasZUp[_i322].up,areasZUp[_i322].up);}for(var _i323=0,_len43=areasYUp.length;_i323<_len43;_i323++){math.normalizeVec3(areasYUp[_i323].dir,areasYUp[_i323].dir);math.normalizeVec3(areasYUp[_i323].up,areasYUp[_i323].up);}var areas=areasYUp;this._textureCanvas=document.createElement('canvas');this._textureCanvas.width=width;this._textureCanvas.height=height;this._textureCanvas.style.width=width+"px";this._textureCanvas.style.height=height+"px";this._textureCanvas.style.padding="0";this._textureCanvas.style.margin="0";this._textureCanvas.style.top="0";this._textureCanvas.style.background=cubeColor;this._textureCanvas.style.position="absolute";this._textureCanvas.style.opacity="1.0";this._textureCanvas.style.visibility="hidden";this._textureCanvas.style["z-index"]=2000000;parentNode.appendChild(this._textureCanvas);var context=this._textureCanvas.getContext("2d");var zUp=false;function paint(){for(var _i324=0,_len44=facesZUp.length;_i324<_len44;_i324++){var face=facesZUp[_i324];var boundary=face.boundary;var xmin=Math.round(boundary[0]*scale);var ymin=Math.round(boundary[1]*scale);var _width=Math.round(boundary[2]*scale);var _height=Math.round(boundary[3]*scale);context.fillStyle=face.color;context.fillRect(xmin,ymin,_width,_height);}for(var _i325=0,_len45=areas.length;_i325<_len45;_i325++){var _xmin=void 0;var _ymin=void 0;var _width2=void 0;var _height2=void 0;var _area=areas[_i325];var boundaries=_area.boundaries;for(var j=0,lenj=boundaries.length;j<lenj;j++){var _boundary=boundaries[j];_xmin=Math.round(_boundary[0]*scale);_ymin=Math.round(_boundary[1]*scale);_width2=Math.round(_boundary[2]*scale);_height2=Math.round(_boundary[3]*scale);if(_area.highlighted){context.fillStyle=_area.highlighted?cubeHighlightColor:_area.color||cubeColor;context.fillRect(_xmin,_ymin,_width2,_height2);}}if(_area.label){context.fillStyle=textColor;context.font='60px sans-serif';context.textAlign="center";var xcenter=_xmin+_width2*0.5;var ycenter=_ymin+_height2*0.7;context.fillText(translateLabel(_area.label),xcenter,ycenter,80);}}navCubeScene.glRedraw();}var translateLabel=function(){var swizzleYUp={"NavCube.front":"NavCube.front","NavCube.back":"NavCube.back","NavCube.right":"NavCube.right","NavCube.left":"NavCube.left","NavCube.top":"NavCube.top","NavCube.bottom":"NavCube.bottom"};var swizzleZUp={"NavCube.front":"NavCube.front","NavCube.back":"NavCube.back","NavCube.right":"NavCube.right","NavCube.left":"NavCube.left","NavCube.top":"NavCube.top","NavCube.bottom":"NavCube.bottom"};var defaultLabels={"NavCube.front":"FRONT","NavCube.back":"BACK","NavCube.right":"RIGHT","NavCube.left":"LEFT","NavCube.top":"TOP","NavCube.bottom":"BOTTOM"};return function(key){var swizzle=zUp?swizzleZUp:swizzleYUp;var swizzledKey=swizzle?swizzle[key]:null;if(swizzledKey){return viewer.localeService.translate(swizzledKey)||defaultLabels[swizzledKey]||swizzledKey;}return key;};}();this.setZUp=function(){zUp=true;areas=areasZUp;this.clear();};this.setYUp=function(){zUp=false;areas=areasYUp;this.clear();};this.clear=function(){context.fillStyle=cubeColor;context.fillRect(0,0,width,height);for(var i=0,len=areas.length;i<len;i++){var _area2=areas[i];_area2.highlighted=false;}paint();};this.getArea=function(uv){var s=uv[0]*width;var t=height-uv[1]*height;// Correct for our texture Y-flipping
26660
+ ];for(var _i324=0,len=areasZUp.length;_i324<len;_i324++){math.normalizeVec3(areasZUp[_i324].dir,areasZUp[_i324].dir);math.normalizeVec3(areasZUp[_i324].up,areasZUp[_i324].up);}for(var _i325=0,_len43=areasYUp.length;_i325<_len43;_i325++){math.normalizeVec3(areasYUp[_i325].dir,areasYUp[_i325].dir);math.normalizeVec3(areasYUp[_i325].up,areasYUp[_i325].up);}var areas=areasYUp;this._textureCanvas=document.createElement('canvas');this._textureCanvas.width=width;this._textureCanvas.height=height;this._textureCanvas.style.width=width+"px";this._textureCanvas.style.height=height+"px";this._textureCanvas.style.padding="0";this._textureCanvas.style.margin="0";this._textureCanvas.style.top="0";this._textureCanvas.style.background=cubeColor;this._textureCanvas.style.position="absolute";this._textureCanvas.style.opacity="1.0";this._textureCanvas.style.visibility="hidden";this._textureCanvas.style["z-index"]=2000000;parentNode.appendChild(this._textureCanvas);var context=this._textureCanvas.getContext("2d");var zUp=false;function paint(){for(var _i326=0,_len44=facesZUp.length;_i326<_len44;_i326++){var face=facesZUp[_i326];var boundary=face.boundary;var xmin=Math.round(boundary[0]*scale);var ymin=Math.round(boundary[1]*scale);var _width=Math.round(boundary[2]*scale);var _height=Math.round(boundary[3]*scale);context.fillStyle=face.color;context.fillRect(xmin,ymin,_width,_height);}for(var _i327=0,_len45=areas.length;_i327<_len45;_i327++){var _xmin=void 0;var _ymin=void 0;var _width2=void 0;var _height2=void 0;var _area=areas[_i327];var boundaries=_area.boundaries;for(var j=0,lenj=boundaries.length;j<lenj;j++){var _boundary=boundaries[j];_xmin=Math.round(_boundary[0]*scale);_ymin=Math.round(_boundary[1]*scale);_width2=Math.round(_boundary[2]*scale);_height2=Math.round(_boundary[3]*scale);if(_area.highlighted){context.fillStyle=_area.highlighted?cubeHighlightColor:_area.color||cubeColor;context.fillRect(_xmin,_ymin,_width2,_height2);}}if(_area.label){context.fillStyle=textColor;context.font='60px sans-serif';context.textAlign="center";var xcenter=_xmin+_width2*0.5;var ycenter=_ymin+_height2*0.7;context.fillText(translateLabel(_area.label),xcenter,ycenter,80);}}navCubeScene.glRedraw();}var translateLabel=function(){var swizzleYUp={"NavCube.front":"NavCube.front","NavCube.back":"NavCube.back","NavCube.right":"NavCube.right","NavCube.left":"NavCube.left","NavCube.top":"NavCube.top","NavCube.bottom":"NavCube.bottom"};var swizzleZUp={"NavCube.front":"NavCube.front","NavCube.back":"NavCube.back","NavCube.right":"NavCube.right","NavCube.left":"NavCube.left","NavCube.top":"NavCube.top","NavCube.bottom":"NavCube.bottom"};var defaultLabels={"NavCube.front":"FRONT","NavCube.back":"BACK","NavCube.right":"RIGHT","NavCube.left":"LEFT","NavCube.top":"TOP","NavCube.bottom":"BOTTOM"};return function(key){var swizzle=zUp?swizzleZUp:swizzleYUp;var swizzledKey=swizzle?swizzle[key]:null;if(swizzledKey){return viewer.localeService.translate(swizzledKey)||defaultLabels[swizzledKey]||swizzledKey;}return key;};}();this.setZUp=function(){zUp=true;areas=areasZUp;this.clear();};this.setYUp=function(){zUp=false;areas=areasYUp;this.clear();};this.clear=function(){context.fillStyle=cubeColor;context.fillRect(0,0,width,height);for(var i=0,len=areas.length;i<len;i++){var _area2=areas[i];_area2.highlighted=false;}paint();};this.getArea=function(uv){var s=uv[0]*width;var t=height-uv[1]*height;// Correct for our texture Y-flipping
26652
26661
  for(var i=0,len=areas.length;i<len;i++){var _area3=areas[i];var boundaries=_area3.boundaries;for(var j=0,lenj=boundaries.length;j<lenj;j++){var boundary=boundaries[j];if(s>=boundary[0]*scale&&s<=(boundary[0]+boundary[2])*scale&&t>=boundary[1]*scale&&t<=(boundary[1]+boundary[3])*scale){return i;}}}return-1;};this.setAreaHighlighted=function(areaId,highlighted){var area=areas[areaId];if(!area){throw"Area not found: "+areaId;}area.highlighted=!!highlighted;paint();};this.getAreaDir=function(areaId){var area=areas[areaId];if(!area){throw"Unknown area: "+areaId;}return area.dir;};this.getAreaUp=function(areaId){var area=areas[areaId];if(!area){throw"Unknown area: "+areaId;}return area.up;};this.getImage=function(){return this._textureCanvas;};this.destroy=function(){if(this._textureCanvas){this._textureCanvas.parentNode.removeChild(this._textureCanvas);this._textureCanvas=null;}};}var tempVec3a$4=math.vec3();var tempVec3b$1=math.vec3();math.mat4();/**
26653
26662
  * {@link Viewer} plugin that lets us look at the entire {@link Scene} from along a chosen axis or diagonal.
26654
26663
  *
@@ -27601,7 +27610,7 @@ for(var _id3 in this._controls){if(this._controls.hasOwnProperty(_id3)){this._co
27601
27610
  * These are created and destroyed automatically as models are loaded and destroyed.
27602
27611
  *
27603
27612
  * @type {{String: {String:Storey}}}
27604
- */_this167.modelStoreys={};_this167._fitStoreyMaps=!!cfg.fitStoreyMaps;_this167._onModelLoaded=_this167.viewer.scene.on("modelLoaded",function(modelId){_this167._registerModelStoreys(modelId);_this167.fire("storeys",_this167.storeys);});return _this167;}_createClass(StoreyViewsPlugin,[{key:"_registerModelStoreys",value:function _registerModelStoreys(modelId){var _this168=this;var viewer=this.viewer;var scene=viewer.scene;var metaScene=viewer.metaScene;var metaModel=metaScene.metaModels[modelId];var model=scene.models[modelId];if(!metaModel||!metaModel.rootMetaObjects){return;}var rootMetaObjects=metaModel.rootMetaObjects;for(var j=0,lenj=rootMetaObjects.length;j<lenj;j++){var storeyIds=rootMetaObjects[j].getObjectIDsInSubtreeByType(["IfcBuildingStorey"]);for(var _i326=0,len=storeyIds.length;_i326<len;_i326++){var storeyId=storeyIds[_i326];var metaObject=metaScene.metaObjects[storeyId];var childObjectIds=metaObject.getObjectIDsInSubtree();var storeyAABB=scene.getAABB(childObjectIds);var numObjects=Math.random()>0.5?childObjectIds.length:0;var storey=new Storey(this,model.aabb,storeyAABB,modelId,storeyId,numObjects);storey._onModelDestroyed=model.once("destroyed",function(){_this168._deregisterModelStoreys(modelId);_this168.fire("storeys",_this168.storeys);});this.storeys[storeyId]=storey;this._storeysList=null;if(!this.modelStoreys[modelId]){this.modelStoreys[modelId]={};}this.modelStoreys[modelId][storeyId]=storey;}}this._clipBoundingBoxes();}},{key:"_clipBoundingBoxes",value:function _clipBoundingBoxes(){var storeysList=this.storeysList;var metaScene=this.viewer.metaScene;var camera=this.viewer.camera;var worldUp=camera.worldUp;var xUp=worldUp[0]>worldUp[1]&&worldUp[0]>worldUp[2];var yUp=!xUp&&worldUp[1]>worldUp[0]&&worldUp[1]>worldUp[2];!xUp&&!yUp&&worldUp[2]>worldUp[0]&&worldUp[2]>worldUp[1];var bbIndex;if(xUp)bbIndex=0;else if(yUp)bbIndex=1;else bbIndex=2;for(var _i327=0,len=storeysList.length;_i327<len;_i327++){var storeyMetaObjectCur=metaScene.metaObjects[storeysList[_i327].storeyId];var elevationCur=storeyMetaObjectCur.attributes.elevation;if(isNaN(elevationCur))return;var bb=storeysList[_i327].storeyAABB;bb[bbIndex]=Math.max(bb[1],parseFloat(elevationCur));if(_i327>0){var storeyMetaObjectNext=metaScene.metaObjects[storeysList[_i327-1].storeyId];var elevationNext=storeyMetaObjectNext.attributes.elevation;bb[4]=Math.min(bb[bbIndex+3],parseFloat(elevationNext));}this.storeys[storeysList[_i327].storeyId].storeyAABB=bb;}}},{key:"_deregisterModelStoreys",value:function _deregisterModelStoreys(modelId){var storeys=this.modelStoreys[modelId];if(storeys){var scene=this.viewer.scene;for(var storyObjectId in storeys){if(storeys.hasOwnProperty(storyObjectId)){var storey=storeys[storyObjectId];var model=scene.models[storey.modelId];if(model){model.off(storey._onModelDestroyed);}delete this.storeys[storyObjectId];this._storeysList=null;}}delete this.modelStoreys[modelId];}}/**
27613
+ */_this167.modelStoreys={};_this167._fitStoreyMaps=!!cfg.fitStoreyMaps;_this167._onModelLoaded=_this167.viewer.scene.on("modelLoaded",function(modelId){_this167._registerModelStoreys(modelId);_this167.fire("storeys",_this167.storeys);});return _this167;}_createClass(StoreyViewsPlugin,[{key:"_registerModelStoreys",value:function _registerModelStoreys(modelId){var _this168=this;var viewer=this.viewer;var scene=viewer.scene;var metaScene=viewer.metaScene;var metaModel=metaScene.metaModels[modelId];var model=scene.models[modelId];if(!metaModel||!metaModel.rootMetaObjects){return;}var rootMetaObjects=metaModel.rootMetaObjects;for(var j=0,lenj=rootMetaObjects.length;j<lenj;j++){var storeyIds=rootMetaObjects[j].getObjectIDsInSubtreeByType(["IfcBuildingStorey"]);for(var _i328=0,len=storeyIds.length;_i328<len;_i328++){var storeyId=storeyIds[_i328];var metaObject=metaScene.metaObjects[storeyId];var childObjectIds=metaObject.getObjectIDsInSubtree();var storeyAABB=scene.getAABB(childObjectIds);var numObjects=Math.random()>0.5?childObjectIds.length:0;var storey=new Storey(this,model.aabb,storeyAABB,modelId,storeyId,numObjects);storey._onModelDestroyed=model.once("destroyed",function(){_this168._deregisterModelStoreys(modelId);_this168.fire("storeys",_this168.storeys);});this.storeys[storeyId]=storey;this._storeysList=null;if(!this.modelStoreys[modelId]){this.modelStoreys[modelId]={};}this.modelStoreys[modelId][storeyId]=storey;}}this._clipBoundingBoxes();}},{key:"_clipBoundingBoxes",value:function _clipBoundingBoxes(){var storeysList=this.storeysList;var metaScene=this.viewer.metaScene;var camera=this.viewer.camera;var worldUp=camera.worldUp;var xUp=worldUp[0]>worldUp[1]&&worldUp[0]>worldUp[2];var yUp=!xUp&&worldUp[1]>worldUp[0]&&worldUp[1]>worldUp[2];!xUp&&!yUp&&worldUp[2]>worldUp[0]&&worldUp[2]>worldUp[1];var bbIndex;if(xUp)bbIndex=0;else if(yUp)bbIndex=1;else bbIndex=2;for(var _i329=0,len=storeysList.length;_i329<len;_i329++){var storeyMetaObjectCur=metaScene.metaObjects[storeysList[_i329].storeyId];var elevationCur=storeyMetaObjectCur.attributes.elevation;if(isNaN(elevationCur))return;var bb=storeysList[_i329].storeyAABB;bb[bbIndex]=Math.max(bb[1],parseFloat(elevationCur));if(_i329>0){var storeyMetaObjectNext=metaScene.metaObjects[storeysList[_i329-1].storeyId];var elevationNext=storeyMetaObjectNext.attributes.elevation;bb[4]=Math.min(bb[bbIndex+3],parseFloat(elevationNext));}this.storeys[storeysList[_i329].storeyId].storeyAABB=bb;}}},{key:"_deregisterModelStoreys",value:function _deregisterModelStoreys(modelId){var storeys=this.modelStoreys[modelId];if(storeys){var scene=this.viewer.scene;for(var storyObjectId in storeys){if(storeys.hasOwnProperty(storyObjectId)){var storey=storeys[storyObjectId];var model=scene.models[storey.modelId];if(model){model.off(storey._onModelDestroyed);}delete this.storeys[storyObjectId];this._storeysList=null;}}delete this.modelStoreys[modelId];}}/**
27605
27614
  * When true, the elements of each floor map image will be proportionally resized to encompass the entire image. This leads to varying scales among different
27606
27615
  * floor map images. If false, each floor map image will display the model's extents, ensuring a consistent scale across all images.
27607
27616
  * @returns {*|boolean}
@@ -27986,7 +27995,7 @@ var sectionPlane=new SectionPlane(this.viewer.scene,{id:params.id,pos:params.pos
27986
27995
  * @param {String} id ID of the {@link SectionPlane}.
27987
27996
  */},{key:"destroySectionPlane",value:function destroySectionPlane(id){var sectionPlane=this.viewer.scene.sectionPlanes[id];if(!sectionPlane){this.error("SectionPlane not found: "+id);return;}this._sectionPlaneDestroyed(sectionPlane);sectionPlane.destroy();if(id===this._shownControlId){this._shownControlId=null;}}},{key:"_sectionPlaneDestroyed",value:function _sectionPlaneDestroyed(sectionPlane){if(this._overview){this._overview.removeSectionPlane(sectionPlane);}var control=this._controls[sectionPlane.id];if(!control){return;}control.setVisible(false);control._setSectionPlane(null);delete this._controls[sectionPlane.id];this._freeControls.push(control);}/**
27988
27997
  * Destroys all {@link SectionPlane}s created by this FaceAlignedSectionPlanesPlugin.
27989
- */},{key:"clear",value:function clear(){var ids=Object.keys(this._sectionPlanes);for(var _i328=0,len=ids.length;_i328<len;_i328++){this.destroySectionPlane(ids[_i328]);}}/**
27998
+ */},{key:"clear",value:function clear(){var ids=Object.keys(this._sectionPlanes);for(var _i330=0,len=ids.length;_i330<len;_i330++){this.destroySectionPlane(ids[_i330]);}}/**
27990
27999
  * @private
27991
28000
  */},{key:"send",value:function send(name,value){switch(name){case"snapshotStarting":// Viewer#getSnapshot() about to take snapshot - hide controls
27992
28001
  for(var id in this._controls){if(this._controls.hasOwnProperty(id)){this._controls[id].setCulled(true);}}break;case"snapshotFinished":// Viewer#getSnapshot() finished taking snapshot - show controls again
@@ -28015,14 +28024,14 @@ roughness:0.5});// var material = new PhongMaterial(modelNode, { // Share materi
28015
28024
  // reflectivity: 1,
28016
28025
  // specular: [0.5, 0.5, 1.0]
28017
28026
  // });
28018
- var dataOffset=84;var faceLength=12*4+2;var positions=[];var normals=[];var splitMeshes=options.splitMeshes;for(var face=0;face<faces;face++){var start=dataOffset+face*faceLength;var normalX=reader.getFloat32(start,true);var normalY=reader.getFloat32(start+4,true);var normalZ=reader.getFloat32(start+8,true);if(hasColors){var packedColor=reader.getUint16(start+48,true);if((packedColor&0x8000)===0){r=(packedColor&0x1F)/31;g=(packedColor>>5&0x1F)/31;b=(packedColor>>10&0x1F)/31;}else{r=defaultR;g=defaultG;b=defaultB;}if(splitMeshes&&r!==lastR||g!==lastG||b!==lastB){if(lastR!==null){newMesh=true;}lastR=r;lastG=g;lastB=b;}}for(var _i329=1;_i329<=3;_i329++){var vertexstart=start+_i329*12;positions.push(reader.getFloat32(vertexstart,true));positions.push(reader.getFloat32(vertexstart+4,true));positions.push(reader.getFloat32(vertexstart+8,true));normals.push(normalX,normalY,normalZ);if(hasColors){colors.push(r,g,b,1);// TODO: handle alpha
28027
+ var dataOffset=84;var faceLength=12*4+2;var positions=[];var normals=[];var splitMeshes=options.splitMeshes;for(var face=0;face<faces;face++){var start=dataOffset+face*faceLength;var normalX=reader.getFloat32(start,true);var normalY=reader.getFloat32(start+4,true);var normalZ=reader.getFloat32(start+8,true);if(hasColors){var packedColor=reader.getUint16(start+48,true);if((packedColor&0x8000)===0){r=(packedColor&0x1F)/31;g=(packedColor>>5&0x1F)/31;b=(packedColor>>10&0x1F)/31;}else{r=defaultR;g=defaultG;b=defaultB;}if(splitMeshes&&r!==lastR||g!==lastG||b!==lastB){if(lastR!==null){newMesh=true;}lastR=r;lastG=g;lastB=b;}}for(var _i331=1;_i331<=3;_i331++){var vertexstart=start+_i331*12;positions.push(reader.getFloat32(vertexstart,true));positions.push(reader.getFloat32(vertexstart+4,true));positions.push(reader.getFloat32(vertexstart+8,true));normals.push(normalX,normalY,normalZ);if(hasColors){colors.push(r,g,b,1);// TODO: handle alpha
28019
28028
  }}if(splitMeshes&&newMesh){addMesh(modelNode,positions,normals,colors,material,options);positions=[];normals=[];colors=colors?[]:null;newMesh=false;}}if(positions.length>0){addMesh(modelNode,positions,normals,colors,material,options);}}function parseASCII(plugin,data,modelNode,options){var faceRegex=/facet([\s\S]*?)endfacet/g;var faceCounter=0;var floatRegex=/[\s]+([+-]?(?:\d+.\d+|\d+.|\d+|.\d+)(?:[eE][+-]?\d+)?)/.source;var vertexRegex=new RegExp('vertex'+floatRegex+floatRegex+floatRegex,'g');var normalRegex=new RegExp('normal'+floatRegex+floatRegex+floatRegex,'g');var positions=[];var normals=[];var colors=null;var normalx;var normaly;var normalz;var result;var verticesPerFace;var normalsPerFace;var text;while((result=faceRegex.exec(data))!==null){verticesPerFace=0;normalsPerFace=0;text=result[0];while((result=normalRegex.exec(text))!==null){normalx=parseFloat(result[1]);normaly=parseFloat(result[2]);normalz=parseFloat(result[3]);normalsPerFace++;}while((result=vertexRegex.exec(text))!==null){positions.push(parseFloat(result[1]),parseFloat(result[2]),parseFloat(result[3]));normals.push(normalx,normaly,normalz);verticesPerFace++;}if(normalsPerFace!==1){plugin.error("Error in normal of face "+faceCounter);}if(verticesPerFace!==3){plugin.error("Error in positions of face "+faceCounter);}faceCounter++;}var material=new MetallicMaterial(modelNode,{roughness:0.5});// var material = new PhongMaterial(modelNode, {
28020
28029
  // diffuse: [0.4, 0.4, 0.4],
28021
28030
  // reflectivity: 1,
28022
28031
  // specular: [0.5, 0.5, 1.0]
28023
28032
  // });
28024
- addMesh(modelNode,positions,normals,colors,material,options);}function addMesh(modelNode,positions,normals,colors,material,options){var indices=new Int32Array(positions.length/3);for(var ni=0,len=indices.length;ni<len;ni++){indices[ni]=ni;}normals=normals&&normals.length>0?normals:null;colors=colors&&colors.length>0?colors:null;if(options.smoothNormals){math.faceToVertexNormals(positions,normals,options);}var origin=tempVec3a$1;worldToRTCPositions(positions,positions,origin);var geometry=new ReadableGeometry(modelNode,{primitive:"triangles",positions:positions,normals:normals,colors:colors,indices:indices});var mesh=new Mesh(modelNode,{origin:origin[0]!==0||origin[1]!==0||origin[2]!==0?origin:null,geometry:geometry,material:material,edges:options.edges});modelNode.addChild(mesh);}function ensureString(buffer){if(typeof buffer!=='string'){return decodeText(new Uint8Array(buffer));}return buffer;}function ensureBinary(buffer){if(typeof buffer==='string'){var arrayBuffer=new Uint8Array(buffer.length);for(var _i330=0;_i330<buffer.length;_i330++){arrayBuffer[_i330]=buffer.charCodeAt(_i330)&0xff;// implicitly assumes little-endian
28025
- }return arrayBuffer.buffer||arrayBuffer;}else{return buffer;}}function decodeText(array){if(typeof TextDecoder!=='undefined'){return new TextDecoder().decode(array);}var s='';for(var _i331=0,il=array.length;_i331<il;_i331++){s+=String.fromCharCode(array[_i331]);// Implicitly assumes little-endian.
28033
+ addMesh(modelNode,positions,normals,colors,material,options);}function addMesh(modelNode,positions,normals,colors,material,options){var indices=new Int32Array(positions.length/3);for(var ni=0,len=indices.length;ni<len;ni++){indices[ni]=ni;}normals=normals&&normals.length>0?normals:null;colors=colors&&colors.length>0?colors:null;if(options.smoothNormals){math.faceToVertexNormals(positions,normals,options);}var origin=tempVec3a$1;worldToRTCPositions(positions,positions,origin);var geometry=new ReadableGeometry(modelNode,{primitive:"triangles",positions:positions,normals:normals,colors:colors,indices:indices});var mesh=new Mesh(modelNode,{origin:origin[0]!==0||origin[1]!==0||origin[2]!==0?origin:null,geometry:geometry,material:material,edges:options.edges});modelNode.addChild(mesh);}function ensureString(buffer){if(typeof buffer!=='string'){return decodeText(new Uint8Array(buffer));}return buffer;}function ensureBinary(buffer){if(typeof buffer==='string'){var arrayBuffer=new Uint8Array(buffer.length);for(var _i332=0;_i332<buffer.length;_i332++){arrayBuffer[_i332]=buffer.charCodeAt(_i332)&0xff;// implicitly assumes little-endian
28034
+ }return arrayBuffer.buffer||arrayBuffer;}else{return buffer;}}function decodeText(array){if(typeof TextDecoder!=='undefined'){return new TextDecoder().decode(array);}var s='';for(var _i333=0,il=array.length;_i333<il;_i333++){s+=String.fromCharCode(array[_i333]);// Implicitly assumes little-endian.
28026
28035
  }return decodeURIComponent(escape(s));}/**
28027
28036
  * {@link Viewer} plugin that loads models from <a href="https://en.wikipedia.org/wiki/STL_(file_format)">STL</a> files.
28028
28037
  *
@@ -28615,12 +28624,12 @@ addMesh(modelNode,positions,normals,colors,material,options);}function addMesh(m
28615
28624
  */_this177.errors=[];/**
28616
28625
  * True if errors were found generating this TreeView.
28617
28626
  * @type {boolean}
28618
- */_this177.valid=true;var containerElement=cfg.containerElement||document.getElementById(cfg.containerElementId);if(!(containerElement instanceof HTMLElement)){_this177.error("Mandatory config expected: valid containerElementId or containerElement");return _possibleConstructorReturn(_this177);}for(var _i332=0;;_i332++){if(!treeViews[_i332]){treeViews[_i332]=_assertThisInitialized(_this177);_this177._index=_i332;_this177._id="tree-".concat(_i332);break;}}_this177._containerElement=containerElement;_this177._metaModels={};_this177._autoAddModels=cfg.autoAddModels!==false;_this177._autoExpandDepth=cfg.autoExpandDepth||0;_this177._sortNodes=cfg.sortNodes!==false;_this177._viewer=viewer;_this177._rootElement=null;_this177._muteSceneEvents=false;_this177._muteTreeEvents=false;_this177._rootNodes=[];_this177._objectNodes={};// Object ID -> Node
28627
+ */_this177.valid=true;var containerElement=cfg.containerElement||document.getElementById(cfg.containerElementId);if(!(containerElement instanceof HTMLElement)){_this177.error("Mandatory config expected: valid containerElementId or containerElement");return _possibleConstructorReturn(_this177);}for(var _i334=0;;_i334++){if(!treeViews[_i334]){treeViews[_i334]=_assertThisInitialized(_this177);_this177._index=_i334;_this177._id="tree-".concat(_i334);break;}}_this177._containerElement=containerElement;_this177._metaModels={};_this177._autoAddModels=cfg.autoAddModels!==false;_this177._autoExpandDepth=cfg.autoExpandDepth||0;_this177._sortNodes=cfg.sortNodes!==false;_this177._viewer=viewer;_this177._rootElement=null;_this177._muteSceneEvents=false;_this177._muteTreeEvents=false;_this177._rootNodes=[];_this177._objectNodes={};// Object ID -> Node
28619
28628
  _this177._nodeNodes={};// Node ID -> Node
28620
28629
  _this177._rootNames={};// Node ID -> Root name
28621
28630
  _this177._sortNodes=cfg.sortNodes;_this177._pruneEmptyNodes=cfg.pruneEmptyNodes;_this177._showListItemElementId=null;_this177._renderService=cfg.renderService||new RenderService(_this177._containerElement);_this177._showIndeterminate=(_cfg$showIndeterminat=cfg.showIndeterminate)!==null&&_cfg$showIndeterminat!==void 0?_cfg$showIndeterminat:false;_this177._showProjectNode=(_cfg$showProjectNode=cfg.showProjectNode)!==null&&_cfg$showProjectNode!==void 0?_cfg$showProjectNode:false;_this177._elevationSortFunction=(_cfg$elevationSortFun=cfg.elevationSortFunction)!==null&&_cfg$elevationSortFun!==void 0?_cfg$elevationSortFun:undefined;_this177._defaultSortFunction=(_cfg$defaultSortFunct=cfg.defaultSortFunction)!==null&&_cfg$defaultSortFunct!==void 0?_cfg$defaultSortFunct:undefined;if(!_this177._renderService){throw new Error('TreeViewPlugin: no render service set');}_this177._containerElement.oncontextmenu=function(e){e.preventDefault();};_this177._onObjectVisibility=_this177._viewer.scene.on("objectVisibility",function(entity){if(_this177._muteSceneEvents){return;}var objectId=entity.id;var node=_this177._objectNodes[objectId];if(!node){return;// Not in this tree
28622
28631
  }var visible=entity.visible;var updated=visible!==node.checked;if(!updated){return;}_this177._muteTreeEvents=true;node.checked=visible;if(visible){node.numVisibleEntities++;}else{node.numVisibleEntities--;}_this177._renderService.setCheckbox(node.nodeId,visible);var parent=node.parent;while(parent){parent.checked=visible;if(visible){parent.numVisibleEntities++;}else{parent.numVisibleEntities--;}var indeterminate=_this177._showIndeterminate&&parent.numVisibleEntities>0&&parent.numVisibleEntities<parent.numEntities;parent.checked=parent.numVisibleEntities>0;_this177._renderService.setCheckbox(parent.nodeId,parent.checked,indeterminate);parent=parent.parent;}_this177._muteTreeEvents=false;});_this177._onObjectXrayed=_this177._viewer.scene.on('objectXRayed',function(entity){if(_this177._muteSceneEvents){return;}var objectId=entity.id;var node=_this177._objectNodes[objectId];if(!node){return;// Not in this tree
28623
- }_this177._muteTreeEvents=true;var xrayed=entity.xrayed;var updated=xrayed!==node.xrayed;if(!updated){return;}node.xrayed=xrayed;_this177._renderService.setXRayed(node.nodeId,xrayed);_this177._muteTreeEvents=false;});_this177._switchExpandHandler=function(event){event.preventDefault();event.stopPropagation();var switchElement=event.target;_this177._expandSwitchElement(switchElement);};_this177._switchCollapseHandler=function(event){event.preventDefault();event.stopPropagation();var switchElement=event.target;_this177._collapseSwitchElement(switchElement);};_this177._checkboxChangeHandler=function(event){if(_this177._muteTreeEvents){return;}_this177._muteSceneEvents=true;var checkbox=event.target;var visible=_this177._renderService.isChecked(checkbox);var nodeId=_this177._renderService.getIdFromCheckbox(checkbox);var checkedNode=_this177._nodeNodes[nodeId];var objects=_this177._viewer.scene.objects;var numUpdated=0;_this177._withNodeTree(checkedNode,function(node){var objectId=node.objectId;var entity=objects[objectId];var isLeaf=node.children.length===0;node.numVisibleEntities=visible?node.numEntities:0;if(isLeaf&&visible!==node.checked){numUpdated++;}node.checked=visible;_this177._renderService.setCheckbox(node.nodeId,visible);if(entity){entity.visible=visible;}});var parent=checkedNode.parent;while(parent){if(visible){parent.numVisibleEntities+=numUpdated;}else{parent.numVisibleEntities-=numUpdated;}var indeterminate=_this177._showIndeterminate&&parent.numVisibleEntities>0&&parent.numVisibleEntities<parent.numEntities;parent.checked=parent.numVisibleEntities>0;_this177._renderService.setCheckbox(parent.nodeId,parent.checked,indeterminate);parent=parent.parent;}_this177._muteSceneEvents=false;};_this177._hierarchy=cfg.hierarchy||"containment";_this177._autoExpandDepth=cfg.autoExpandDepth||0;if(_this177._autoAddModels){var modelIds=Object.keys(_this177.viewer.metaScene.metaModels);for(var _i333=0,len=modelIds.length;_i333<len;_i333++){var modelId=modelIds[_i333];var metaModel=_this177.viewer.metaScene.metaModels[modelId];if(metaModel.finalized){_this177.addModel(modelId);}}_this177.viewer.scene.on("modelLoaded",function(modelId){if(_this177.viewer.metaScene.metaModels[modelId]){_this177.addModel(modelId);}});}_this177.hierarchy=cfg.hierarchy;return _this177;}/**
28632
+ }_this177._muteTreeEvents=true;var xrayed=entity.xrayed;var updated=xrayed!==node.xrayed;if(!updated){return;}node.xrayed=xrayed;_this177._renderService.setXRayed(node.nodeId,xrayed);_this177._muteTreeEvents=false;});_this177._switchExpandHandler=function(event){event.preventDefault();event.stopPropagation();var switchElement=event.target;_this177._expandSwitchElement(switchElement);};_this177._switchCollapseHandler=function(event){event.preventDefault();event.stopPropagation();var switchElement=event.target;_this177._collapseSwitchElement(switchElement);};_this177._checkboxChangeHandler=function(event){if(_this177._muteTreeEvents){return;}_this177._muteSceneEvents=true;var checkbox=event.target;var visible=_this177._renderService.isChecked(checkbox);var nodeId=_this177._renderService.getIdFromCheckbox(checkbox);var checkedNode=_this177._nodeNodes[nodeId];var objects=_this177._viewer.scene.objects;var numUpdated=0;_this177._withNodeTree(checkedNode,function(node){var objectId=node.objectId;var entity=objects[objectId];var isLeaf=node.children.length===0;node.numVisibleEntities=visible?node.numEntities:0;if(isLeaf&&visible!==node.checked){numUpdated++;}node.checked=visible;_this177._renderService.setCheckbox(node.nodeId,visible);if(entity){entity.visible=visible;}});var parent=checkedNode.parent;while(parent){if(visible){parent.numVisibleEntities+=numUpdated;}else{parent.numVisibleEntities-=numUpdated;}var indeterminate=_this177._showIndeterminate&&parent.numVisibleEntities>0&&parent.numVisibleEntities<parent.numEntities;parent.checked=parent.numVisibleEntities>0;_this177._renderService.setCheckbox(parent.nodeId,parent.checked,indeterminate);parent=parent.parent;}_this177._muteSceneEvents=false;};_this177._hierarchy=cfg.hierarchy||"containment";_this177._autoExpandDepth=cfg.autoExpandDepth||0;if(_this177._autoAddModels){var modelIds=Object.keys(_this177.viewer.metaScene.metaModels);for(var _i335=0,len=modelIds.length;_i335<len;_i335++){var modelId=modelIds[_i335];var metaModel=_this177.viewer.metaScene.metaModels[modelId];if(metaModel.finalized){_this177.addModel(modelId);}}_this177.viewer.scene.on("modelLoaded",function(modelId){if(_this177.viewer.metaScene.metaModels[modelId]){_this177.addModel(modelId);}});}_this177.hierarchy=cfg.hierarchy;return _this177;}/**
28624
28633
  * Sets how the nodes are organized within this tree view.
28625
28634
  *
28626
28635
  * Accepted values are:
@@ -28674,7 +28683,7 @@ _this177._sortNodes=cfg.sortNodes;_this177._pruneEmptyNodes=cfg.pruneEmptyNodes;
28674
28683
  *
28675
28684
  * @param {String} objectId ID of the {@link Entity}.
28676
28685
  */},{key:"showNode",value:function showNode(objectId){this.unShowNode();var node=this._objectNodes[objectId];if(!node){return;// Node may not exist for the given object if (this._pruneEmptyNodes == true)
28677
- }this.collapse();var nodeId=node.nodeId;var switchElement=this._renderService.getSwitchElement(nodeId);if(switchElement){this._expandSwitchElement(switchElement);switchElement.scrollIntoView();return true;}var path=[];path.unshift(node);var parent=node.parent;while(parent){path.unshift(parent);parent=parent.parent;}for(var _i334=0,len=path.length;_i334<len;_i334++){var _switchElement=this._renderService.getSwitchElement(path[_i334].nodeId);if(_switchElement){this._expandSwitchElement(_switchElement);}}this._renderService.setHighlighted(nodeId,true);this._showListItemElementId=nodeId;}/**
28686
+ }this.collapse();var nodeId=node.nodeId;var switchElement=this._renderService.getSwitchElement(nodeId);if(switchElement){this._expandSwitchElement(switchElement);switchElement.scrollIntoView();return true;}var path=[];path.unshift(node);var parent=node.parent;while(parent){path.unshift(parent);parent=parent.parent;}for(var _i336=0,len=path.length;_i336<len;_i336++){var _switchElement=this._renderService.getSwitchElement(path[_i336].nodeId);if(_switchElement){this._expandSwitchElement(_switchElement);}}this._renderService.setHighlighted(nodeId,true);this._showListItemElementId=nodeId;}/**
28678
28687
  * De-highlights the node previously shown with {@link TreeViewPlugin#showNode}.
28679
28688
  *
28680
28689
  * Does nothing if no node is currently shown.
@@ -28686,15 +28695,15 @@ _this177._sortNodes=cfg.sortNodes;_this177._pruneEmptyNodes=cfg.pruneEmptyNodes;
28686
28695
  * Collapses the tree first.
28687
28696
  *
28688
28697
  * @param {Number} depth Depth to expand to.
28689
- */},{key:"expandToDepth",value:function expandToDepth(depth){var _this179=this;this.collapse();var expand=function expand(node,countDepth){if(countDepth===depth){return;}var switchElement=_this179._renderService.getSwitchElement(node.nodeId);if(switchElement){_this179._expandSwitchElement(switchElement);var childNodes=node.children;for(var i=0,len=childNodes.length;i<len;i++){var childNode=childNodes[i];expand(childNode,countDepth+1);}}};for(var _i335=0,len=this._rootNodes.length;_i335<len;_i335++){var rootNode=this._rootNodes[_i335];expand(rootNode,0);}}/**
28698
+ */},{key:"expandToDepth",value:function expandToDepth(depth){var _this179=this;this.collapse();var expand=function expand(node,countDepth){if(countDepth===depth){return;}var switchElement=_this179._renderService.getSwitchElement(node.nodeId);if(switchElement){_this179._expandSwitchElement(switchElement);var childNodes=node.children;for(var i=0,len=childNodes.length;i<len;i++){var childNode=childNodes[i];expand(childNode,countDepth+1);}}};for(var _i337=0,len=this._rootNodes.length;_i337<len;_i337++){var rootNode=this._rootNodes[_i337];expand(rootNode,0);}}/**
28690
28699
  * Closes all the nodes in the tree.
28691
- */},{key:"collapse",value:function collapse(){for(var _i336=0,len=this._rootNodes.length;_i336<len;_i336++){var rootNode=this._rootNodes[_i336];var nodeId=rootNode.nodeId;this._collapseNode(nodeId);}}/**
28700
+ */},{key:"collapse",value:function collapse(){for(var _i338=0,len=this._rootNodes.length;_i338<len;_i338++){var rootNode=this._rootNodes[_i338];var nodeId=rootNode.nodeId;this._collapseNode(nodeId);}}/**
28692
28701
  * Iterates over a subtree of the tree view's {@link TreeViewNode}s, calling the given callback for each
28693
28702
  * node in depth-first pre-order.
28694
28703
  *
28695
28704
  * @param {TreeViewNode} node Root of the subtree.
28696
28705
  * @param {Function} callback Callback called at each {@link TreeViewNode}, with the TreeViewNode given as the argument.
28697
- */},{key:"withNodeTree",value:function withNodeTree(node,callback){callback(node);var children=node.children;if(!children){return;}for(var _i337=0,len=children.length;_i337<len;_i337++){this.withNodeTree(children[_i337],callback);}}/**
28706
+ */},{key:"withNodeTree",value:function withNodeTree(node,callback){callback(node);var children=node.children;if(!children){return;}for(var _i339=0,len=children.length;_i339<len;_i339++){this.withNodeTree(children[_i339],callback);}}/**
28698
28707
  * Destroys this TreeViewPlugin.
28699
28708
  */},{key:"destroy",value:function destroy(){if(!this._containerElement){return;}this._metaModels={};if(this._rootElement&&!this._destroyed){this._rootElement.parentNode.removeChild(this._rootElement);this._viewer.scene.off(this._onObjectVisibility);this._destroyed=true;}delete treeViews[this._index];_get(_getPrototypeOf(TreeViewPlugin.prototype),"destroy",this).call(this);}},{key:"_createNodes",value:function _createNodes(){if(this._rootElement){this._rootElement.parentNode.removeChild(this._rootElement);this._rootElement=null;}this._rootNodes=[];this._objectNodes={};this._nodeNodes={};this._validate();if(this.valid||this._hierarchy!=="storeys"){this._createEnabledNodes();}else{this._createDisabledNodes();}}},{key:"_validate",value:function _validate(){this.errors=[];switch(this._hierarchy){case"storeys":this.valid=this._validateMetaModelForStoreysHierarchy();break;case"types":this.valid=this._rootNodes.length>0;break;case"containment":default:this.valid=this._rootNodes.length>0;break;}return this.valid;}},{key:"_validateMetaModelForStoreysHierarchy",value:function _validateMetaModelForStoreysHierarchy(){var level=arguments.length>0&&arguments[0]!==undefined?arguments[0]:0;var ctx=arguments.length>1?arguments[1]:undefined;var buildingNode=arguments.length>2?arguments[2]:undefined;// ctx = ctx || {
28700
28709
  // foundIFCBuildingStoreys: false
@@ -28723,9 +28732,9 @@ _this177._sortNodes=cfg.sortNodes;_this177._pruneEmptyNodes=cfg.pruneEmptyNodes;
28723
28732
  // // errors.push("Can't build storeys hierarchy: no IfcBuildingStoreys found");
28724
28733
  // }
28725
28734
  // }
28726
- return true;}},{key:"_createEnabledNodes",value:function _createEnabledNodes(){if(this._pruneEmptyNodes){this._findEmptyNodes();}switch(this._hierarchy){case"storeys":this._createStoreysNodes();if(this._rootNodes.length===0){this.error("Failed to build storeys hierarchy");}break;case"types":this._createTypesNodes();break;case"containment":default:this._createContainmentNodes();}if(this._sortNodes){this._doSortNodes();}this._synchNodesToEntities();this._createTrees();this.expandToDepth(this._autoExpandDepth);}},{key:"_createDisabledNodes",value:function _createDisabledNodes(){var rootNode=this._renderService.createRootNode();this._rootElement=rootNode;this._containerElement.appendChild(rootNode);var rootMetaObjects=this._viewer.metaScene.rootMetaObjects;for(var objectId in rootMetaObjects){var rootMetaObject=rootMetaObjects[objectId];var metaObjectType=rootMetaObject.type;var metaObjectName=rootMetaObject.name;var rootName=metaObjectName&&metaObjectName!==""&&metaObjectName!=="Undefined"&&metaObjectName!=="Default"?metaObjectName:metaObjectType;var childNode=this._renderService.createDisabledNodeElement(rootName);rootNode.appendChild(childNode);}}},{key:"_findEmptyNodes",value:function _findEmptyNodes(){var rootMetaObjects=this._viewer.metaScene.rootMetaObjects;for(var objectId in rootMetaObjects){this._findEmptyNodes2(rootMetaObjects[objectId]);}}},{key:"_findEmptyNodes2",value:function _findEmptyNodes2(metaObject){var countEntities=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0;var viewer=this.viewer;var scene=viewer.scene;var children=metaObject.children;var objectId=metaObject.id;var entity=scene.objects[objectId];metaObject._countEntities=0;if(entity){metaObject._countEntities++;}if(children){for(var _i338=0,len=children.length;_i338<len;_i338++){var childMetaObject=children[_i338];childMetaObject._countEntities=this._findEmptyNodes2(childMetaObject);metaObject._countEntities+=childMetaObject._countEntities;}}return metaObject._countEntities;}},{key:"_createStoreysNodes",value:function _createStoreysNodes(){var rootMetaObjects=this._viewer.metaScene.rootMetaObjects;for(var id in rootMetaObjects){this._createStoreysNodes2(rootMetaObjects[id],null,null,null,null);}}},{key:"_createStoreysNodes2",value:function _createStoreysNodes2(metaObject,projectNode,buildingNode,storeyNode,typeNodes){if(this._pruneEmptyNodes&&metaObject._countEntities===0){return;}var metaObjectType=metaObject.type;var metaObjectName=metaObject.name;var children=metaObject.children;var objectId=metaObject.id;if(this._showProjectNode&&metaObjectType==='IfcProject'){projectNode={nodeId:"".concat(this._id,"-").concat(objectId),objectId:objectId,title:metaObject.metaModels.length===0?metaObjectName:this._rootNames[metaObject.metaModels[0].id]||(metaObjectName&&metaObjectName!==""&&metaObjectName!=="Undefined"&&metaObjectName!=="Default"?metaObjectName:metaObjectType),type:metaObjectType,parent:null,numEntities:0,numVisibleEntities:0,checked:false,xrayed:false,children:[]};this._rootNodes.push(projectNode);this._objectNodes[projectNode.objectId]=projectNode;this._nodeNodes[projectNode.nodeId]=projectNode;}else if(metaObjectType==="IfcBuilding"){buildingNode={nodeId:"".concat(this._id,"-").concat(objectId),objectId:objectId,title:metaObject.metaModels.length===0?metaObjectName:this._rootNames[metaObject.metaModels[0].id]||(metaObjectName&&metaObjectName!==""&&metaObjectName!=="Undefined"&&metaObjectName!=="Default"?metaObjectName:metaObjectType),type:metaObjectType,parent:projectNode,numEntities:0,numVisibleEntities:0,checked:false,xrayed:false,children:[]};if(projectNode){projectNode.children.push(buildingNode);}else{this._rootNodes.push(buildingNode);}this._objectNodes[buildingNode.objectId]=buildingNode;this._nodeNodes[buildingNode.nodeId]=buildingNode;}else if(metaObjectType==="IfcBuildingStorey"){if(!buildingNode){this.error("Failed to build storeys hierarchy for model - model does not have an IfcBuilding object, or is not an IFC model");return;}storeyNode={nodeId:"".concat(this._id,"-").concat(objectId),objectId:objectId,title:metaObjectName&&metaObjectName!==""&&metaObjectName!=="Undefined"&&metaObjectName!=="Default"?metaObjectName:metaObjectType,type:metaObjectType,parent:buildingNode,numEntities:0,numVisibleEntities:0,checked:false,xrayed:false,children:[]};buildingNode.children.push(storeyNode);this._objectNodes[storeyNode.objectId]=storeyNode;this._nodeNodes[storeyNode.nodeId]=storeyNode;typeNodes={};}else{if(storeyNode){var objects=this._viewer.scene.objects;var object=objects[objectId];if(object){typeNodes=typeNodes||{};var typeNode=typeNodes[metaObjectType];if(!typeNode){typeNode={nodeId:"".concat(this._id,"-").concat(storeyNode.objectId,"-").concat(metaObjectType),objectId:"".concat(storeyNode.objectId,"-").concat(metaObjectType),title:metaObjectType,type:metaObjectType,parent:storeyNode,numEntities:0,numVisibleEntities:0,checked:false,xrayed:false,children:[]};storeyNode.children.push(typeNode);this._objectNodes[typeNode.objectId]=typeNode;this._nodeNodes[typeNode.nodeId]=typeNode;typeNodes[metaObjectType]=typeNode;}var node={nodeId:"".concat(this._id,"-").concat(objectId),objectId:objectId,title:metaObjectName&&metaObjectName!==""&&metaObjectName!=="Undefined"&&metaObjectName!=="Default"?metaObjectName:metaObjectType,type:metaObjectType,parent:typeNode,numEntities:0,numVisibleEntities:0,checked:false,xrayed:false,children:[]};typeNode.children.push(node);this._objectNodes[node.objectId]=node;this._nodeNodes[node.nodeId]=node;}}}if(children){for(var _i339=0,len=children.length;_i339<len;_i339++){var childMetaObject=children[_i339];this._createStoreysNodes2(childMetaObject,projectNode,buildingNode,storeyNode,typeNodes);}}}},{key:"_createTypesNodes",value:function _createTypesNodes(){var rootMetaObjects=this._viewer.metaScene.rootMetaObjects;for(var id in rootMetaObjects){this._createTypesNodes2(rootMetaObjects[id],null,null);}}},{key:"_createTypesNodes2",value:function _createTypesNodes2(metaObject,rootNode,typeNodes){if(this._pruneEmptyNodes&&metaObject._countEntities===0){return;}var metaObjectType=metaObject.type;var metaObjectName=metaObject.name;var children=metaObject.children;var objectId=metaObject.id;if(!metaObject.parent){rootNode={nodeId:"".concat(this._id,"-").concat(objectId),objectId:objectId,title:metaObject.metaModels.length===0?metaObjectName:this._rootNames[metaObject.metaModels[0].id]||(metaObjectName&&metaObjectName!==""&&metaObjectName!=="Undefined"&&metaObjectName!=="Default"?metaObjectName:metaObjectType),type:metaObjectType,parent:null,numEntities:0,numVisibleEntities:0,checked:false,xrayed:false,children:[]};this._rootNodes.push(rootNode);this._objectNodes[rootNode.objectId]=rootNode;this._nodeNodes[rootNode.nodeId]=rootNode;typeNodes={};}else{if(rootNode){var objects=this._viewer.scene.objects;var object=objects[objectId];if(object){var typeNode=typeNodes[metaObjectType];if(!typeNode){typeNode={nodeId:"".concat(this._id,"-").concat(rootNode.objectId,"-").concat(metaObjectType),objectId:"".concat(rootNode.objectId,"-").concat(metaObjectType),title:metaObjectType,type:metaObjectType,parent:rootNode,numEntities:0,numVisibleEntities:0,checked:false,xrayed:false,children:[]};rootNode.children.push(typeNode);this._objectNodes[typeNode.objectId]=typeNode;this._nodeNodes[typeNode.nodeId]=typeNode;typeNodes[metaObjectType]=typeNode;}var node={nodeId:"".concat(this._id,"-").concat(objectId),objectId:objectId,title:metaObjectName&&metaObjectName!==""&&metaObjectName!=="Default"?metaObjectName:metaObjectType,type:metaObjectType,parent:typeNode,numEntities:0,numVisibleEntities:0,checked:false,xrayed:false,children:[]};typeNode.children.push(node);this._objectNodes[node.objectId]=node;this._nodeNodes[node.nodeId]=node;}}}if(children){for(var _i340=0,len=children.length;_i340<len;_i340++){var childMetaObject=children[_i340];this._createTypesNodes2(childMetaObject,rootNode,typeNodes);}}}},{key:"_createContainmentNodes",value:function _createContainmentNodes(){var rootMetaObjects=this._viewer.metaScene.rootMetaObjects;for(var id in rootMetaObjects){this._createContainmentNodes2(rootMetaObjects[id],null);}}},{key:"_createContainmentNodes2",value:function _createContainmentNodes2(metaObject,parent){if(this._pruneEmptyNodes&&metaObject._countEntities===0){return;}var metaObjectType=metaObject.type;var metaObjectName=metaObject.name||metaObjectType;var children=metaObject.children;var objectId=metaObject.id;var node={nodeId:"".concat(this._id,"-").concat(objectId),objectId:objectId,title:!parent?metaObject.metaModels.length===0?metaObjectName:this._rootNames[metaObject.metaModels[0].id]||metaObjectName:metaObjectName&&metaObjectName!==""&&metaObjectName!=="Undefined"&&metaObjectName!=="Default"?metaObjectName:metaObjectType,type:metaObjectType,parent:parent,numEntities:0,numVisibleEntities:0,checked:false,xrayed:false,children:[]};if(parent){parent.children.push(node);}else{this._rootNodes.push(node);}this._objectNodes[node.objectId]=node;this._nodeNodes[node.nodeId]=node;if(children){for(var _i341=0,len=children.length;_i341<len;_i341++){var childMetaObject=children[_i341];this._createContainmentNodes2(childMetaObject,node);}}}},{key:"_doSortNodes",value:function _doSortNodes(){for(var _i342=0,len=this._rootNodes.length;_i342<len;_i342++){var rootNode=this._rootNodes[_i342];this._sortChildren(rootNode);}}},{key:"_sortChildren",value:function _sortChildren(node){var children=node.children;if(!children||children.length===0){return;}var firstChild=children[0];if((this._hierarchy==="storeys"||this._hierarchy==="containment")&&firstChild.type==="IfcBuildingStorey"){if(this._elevationSortFunction)children.sort(this._elevationSortFunction);else children.sort(this._getSpatialSortFunc());}else{if(this._defaultSortFunction)children.sort(this._defaultSortFunction);else children.sort(this._alphaSortFunc);}for(var _i343=0,len=children.length;_i343<len;_i343++){var _node2=children[_i343];this._sortChildren(_node2);}}},{key:"_getSpatialSortFunc",value:function _getSpatialSortFunc(){var _this180=this;var viewer=this.viewer;var scene=viewer.scene;var camera=scene.camera;return this._spatialSortFunc||(this._spatialSortFunc=function(storey1,storey2){if(camera.xUp);else if(camera.yUp);else;var metaScene=_this180.viewer.metaScene;var storey1MetaObject=metaScene.metaObjects[storey1.objectId];var storey2MetaObject=metaScene.metaObjects[storey2.objectId];if(storey1MetaObject&&storey1MetaObject.attributes&&storey1MetaObject.attributes.elevation!==undefined&&storey2MetaObject&&storey2MetaObject.attributes&&storey2MetaObject.attributes.elevation!==undefined){var elevation1=Number.parseFloat(storey1MetaObject.attributes.elevation);var elevation2=Number.parseFloat(storey2MetaObject.attributes.elevation);if(elevation1>elevation2){return-1;}if(elevation1<elevation2){return 1;}return 0;}else{return 0;}});}},{key:"_alphaSortFunc",value:function _alphaSortFunc(node1,node2){var title1=node1.title.toUpperCase();// FIXME: Should be case sensitive?
28727
- var title2=node2.title.toUpperCase();if(title1<title2){return-1;}if(title1>title2){return 1;}return 0;}},{key:"_synchNodesToEntities",value:function _synchNodesToEntities(){var objectIds=Object.keys(this.viewer.metaScene.metaObjects);var metaObjects=this._viewer.metaScene.metaObjects;var objects=this._viewer.scene.objects;for(var _i344=0,len=objectIds.length;_i344<len;_i344++){var objectId=objectIds[_i344];var metaObject=metaObjects[objectId];if(metaObject){var node=this._objectNodes[objectId];if(node){var entity=objects[objectId];if(entity){var visible=entity.visible;node.numEntities=1;node.xrayed=entity.xrayed;if(visible){node.numVisibleEntities=1;node.checked=true;}else{node.numVisibleEntities=0;node.checked=false;}var parent=node.parent;// Synch parents
28728
- while(parent){parent.numEntities++;if(visible){parent.numVisibleEntities++;parent.checked=true;}parent=parent.parent;}}}}}}},{key:"_withNodeTree",value:function _withNodeTree(node,callback){callback(node);var children=node.children;if(!children){return;}for(var _i345=0,len=children.length;_i345<len;_i345++){this._withNodeTree(children[_i345],callback);}}},{key:"_createTrees",value:function _createTrees(){var _this181=this;if(this._rootNodes.length===0){return;}var rootNodeElements=this._rootNodes.map(function(rootNode){return _this181._createNodeElement(rootNode);});var rootNode=this._renderService.createRootNode();rootNodeElements.forEach(function(nodeElement){rootNode.appendChild(nodeElement);});this._containerElement.appendChild(rootNode);this._rootElement=rootNode;}},{key:"_createNodeElement",value:function _createNodeElement(node){var _this182=this;var contextmenuHandler=function contextmenuHandler(event){_this182.fire("contextmenu",{event:event,viewer:_this182._viewer,treeViewPlugin:_this182,treeViewNode:node});event.preventDefault();};var onclickHandler=function onclickHandler(event){_this182.fire("nodeTitleClicked",{event:event,viewer:_this182._viewer,treeViewPlugin:_this182,treeViewNode:node});event.preventDefault();};return this._renderService.createNodeElement(node,this._switchExpandHandler,this._checkboxChangeHandler,contextmenuHandler,onclickHandler);}},{key:"_expandSwitchElement",value:function _expandSwitchElement(switchElement){var _this183=this;var expanded=this._renderService.isExpanded(switchElement);if(expanded){return;}var nodeId=this._renderService.getId(switchElement);var nodeElements=this._nodeNodes[nodeId].children.map(function(node){return _this183._createNodeElement(node);});this._renderService.addChildren(switchElement,nodeElements);this._renderService.expand(switchElement,this._switchExpandHandler,this._switchCollapseHandler);}},{key:"_collapseNode",value:function _collapseNode(nodeId){var switchElement=this._renderService.getSwitchElement(nodeId);this._collapseSwitchElement(switchElement);}},{key:"_collapseSwitchElement",value:function _collapseSwitchElement(switchElement){this._renderService.collapse(switchElement,this._switchExpandHandler,this._switchCollapseHandler);}}]);return TreeViewPlugin;}(Plugin);/**
28735
+ return true;}},{key:"_createEnabledNodes",value:function _createEnabledNodes(){if(this._pruneEmptyNodes){this._findEmptyNodes();}switch(this._hierarchy){case"storeys":this._createStoreysNodes();if(this._rootNodes.length===0){this.error("Failed to build storeys hierarchy");}break;case"types":this._createTypesNodes();break;case"containment":default:this._createContainmentNodes();}if(this._sortNodes){this._doSortNodes();}this._synchNodesToEntities();this._createTrees();this.expandToDepth(this._autoExpandDepth);}},{key:"_createDisabledNodes",value:function _createDisabledNodes(){var rootNode=this._renderService.createRootNode();this._rootElement=rootNode;this._containerElement.appendChild(rootNode);var rootMetaObjects=this._viewer.metaScene.rootMetaObjects;for(var objectId in rootMetaObjects){var rootMetaObject=rootMetaObjects[objectId];var metaObjectType=rootMetaObject.type;var metaObjectName=rootMetaObject.name;var rootName=metaObjectName&&metaObjectName!==""&&metaObjectName!=="Undefined"&&metaObjectName!=="Default"?metaObjectName:metaObjectType;var childNode=this._renderService.createDisabledNodeElement(rootName);rootNode.appendChild(childNode);}}},{key:"_findEmptyNodes",value:function _findEmptyNodes(){var rootMetaObjects=this._viewer.metaScene.rootMetaObjects;for(var objectId in rootMetaObjects){this._findEmptyNodes2(rootMetaObjects[objectId]);}}},{key:"_findEmptyNodes2",value:function _findEmptyNodes2(metaObject){var countEntities=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0;var viewer=this.viewer;var scene=viewer.scene;var children=metaObject.children;var objectId=metaObject.id;var entity=scene.objects[objectId];metaObject._countEntities=0;if(entity){metaObject._countEntities++;}if(children){for(var _i340=0,len=children.length;_i340<len;_i340++){var childMetaObject=children[_i340];childMetaObject._countEntities=this._findEmptyNodes2(childMetaObject);metaObject._countEntities+=childMetaObject._countEntities;}}return metaObject._countEntities;}},{key:"_createStoreysNodes",value:function _createStoreysNodes(){var rootMetaObjects=this._viewer.metaScene.rootMetaObjects;for(var id in rootMetaObjects){this._createStoreysNodes2(rootMetaObjects[id],null,null,null,null);}}},{key:"_createStoreysNodes2",value:function _createStoreysNodes2(metaObject,projectNode,buildingNode,storeyNode,typeNodes){if(this._pruneEmptyNodes&&metaObject._countEntities===0){return;}var metaObjectType=metaObject.type;var metaObjectName=metaObject.name;var children=metaObject.children;var objectId=metaObject.id;if(this._showProjectNode&&metaObjectType==='IfcProject'){projectNode={nodeId:"".concat(this._id,"-").concat(objectId),objectId:objectId,title:metaObject.metaModels.length===0?metaObjectName:this._rootNames[metaObject.metaModels[0].id]||(metaObjectName&&metaObjectName!==""&&metaObjectName!=="Undefined"&&metaObjectName!=="Default"?metaObjectName:metaObjectType),type:metaObjectType,parent:null,numEntities:0,numVisibleEntities:0,checked:false,xrayed:false,children:[]};this._rootNodes.push(projectNode);this._objectNodes[projectNode.objectId]=projectNode;this._nodeNodes[projectNode.nodeId]=projectNode;}else if(metaObjectType==="IfcBuilding"){buildingNode={nodeId:"".concat(this._id,"-").concat(objectId),objectId:objectId,title:metaObject.metaModels.length===0?metaObjectName:this._rootNames[metaObject.metaModels[0].id]||(metaObjectName&&metaObjectName!==""&&metaObjectName!=="Undefined"&&metaObjectName!=="Default"?metaObjectName:metaObjectType),type:metaObjectType,parent:projectNode,numEntities:0,numVisibleEntities:0,checked:false,xrayed:false,children:[]};if(projectNode){projectNode.children.push(buildingNode);}else{this._rootNodes.push(buildingNode);}this._objectNodes[buildingNode.objectId]=buildingNode;this._nodeNodes[buildingNode.nodeId]=buildingNode;}else if(metaObjectType==="IfcBuildingStorey"){if(!buildingNode){this.error("Failed to build storeys hierarchy for model - model does not have an IfcBuilding object, or is not an IFC model");return;}storeyNode={nodeId:"".concat(this._id,"-").concat(objectId),objectId:objectId,title:metaObjectName&&metaObjectName!==""&&metaObjectName!=="Undefined"&&metaObjectName!=="Default"?metaObjectName:metaObjectType,type:metaObjectType,parent:buildingNode,numEntities:0,numVisibleEntities:0,checked:false,xrayed:false,children:[]};buildingNode.children.push(storeyNode);this._objectNodes[storeyNode.objectId]=storeyNode;this._nodeNodes[storeyNode.nodeId]=storeyNode;typeNodes={};}else{if(storeyNode){var objects=this._viewer.scene.objects;var object=objects[objectId];if(object){typeNodes=typeNodes||{};var typeNode=typeNodes[metaObjectType];if(!typeNode){typeNode={nodeId:"".concat(this._id,"-").concat(storeyNode.objectId,"-").concat(metaObjectType),objectId:"".concat(storeyNode.objectId,"-").concat(metaObjectType),title:metaObjectType,type:metaObjectType,parent:storeyNode,numEntities:0,numVisibleEntities:0,checked:false,xrayed:false,children:[]};storeyNode.children.push(typeNode);this._objectNodes[typeNode.objectId]=typeNode;this._nodeNodes[typeNode.nodeId]=typeNode;typeNodes[metaObjectType]=typeNode;}var node={nodeId:"".concat(this._id,"-").concat(objectId),objectId:objectId,title:metaObjectName&&metaObjectName!==""&&metaObjectName!=="Undefined"&&metaObjectName!=="Default"?metaObjectName:metaObjectType,type:metaObjectType,parent:typeNode,numEntities:0,numVisibleEntities:0,checked:false,xrayed:false,children:[]};typeNode.children.push(node);this._objectNodes[node.objectId]=node;this._nodeNodes[node.nodeId]=node;}}}if(children){for(var _i341=0,len=children.length;_i341<len;_i341++){var childMetaObject=children[_i341];this._createStoreysNodes2(childMetaObject,projectNode,buildingNode,storeyNode,typeNodes);}}}},{key:"_createTypesNodes",value:function _createTypesNodes(){var rootMetaObjects=this._viewer.metaScene.rootMetaObjects;for(var id in rootMetaObjects){this._createTypesNodes2(rootMetaObjects[id],null,null);}}},{key:"_createTypesNodes2",value:function _createTypesNodes2(metaObject,rootNode,typeNodes){if(this._pruneEmptyNodes&&metaObject._countEntities===0){return;}var metaObjectType=metaObject.type;var metaObjectName=metaObject.name;var children=metaObject.children;var objectId=metaObject.id;if(!metaObject.parent){rootNode={nodeId:"".concat(this._id,"-").concat(objectId),objectId:objectId,title:metaObject.metaModels.length===0?metaObjectName:this._rootNames[metaObject.metaModels[0].id]||(metaObjectName&&metaObjectName!==""&&metaObjectName!=="Undefined"&&metaObjectName!=="Default"?metaObjectName:metaObjectType),type:metaObjectType,parent:null,numEntities:0,numVisibleEntities:0,checked:false,xrayed:false,children:[]};this._rootNodes.push(rootNode);this._objectNodes[rootNode.objectId]=rootNode;this._nodeNodes[rootNode.nodeId]=rootNode;typeNodes={};}else{if(rootNode){var objects=this._viewer.scene.objects;var object=objects[objectId];if(object){var typeNode=typeNodes[metaObjectType];if(!typeNode){typeNode={nodeId:"".concat(this._id,"-").concat(rootNode.objectId,"-").concat(metaObjectType),objectId:"".concat(rootNode.objectId,"-").concat(metaObjectType),title:metaObjectType,type:metaObjectType,parent:rootNode,numEntities:0,numVisibleEntities:0,checked:false,xrayed:false,children:[]};rootNode.children.push(typeNode);this._objectNodes[typeNode.objectId]=typeNode;this._nodeNodes[typeNode.nodeId]=typeNode;typeNodes[metaObjectType]=typeNode;}var node={nodeId:"".concat(this._id,"-").concat(objectId),objectId:objectId,title:metaObjectName&&metaObjectName!==""&&metaObjectName!=="Default"?metaObjectName:metaObjectType,type:metaObjectType,parent:typeNode,numEntities:0,numVisibleEntities:0,checked:false,xrayed:false,children:[]};typeNode.children.push(node);this._objectNodes[node.objectId]=node;this._nodeNodes[node.nodeId]=node;}}}if(children){for(var _i342=0,len=children.length;_i342<len;_i342++){var childMetaObject=children[_i342];this._createTypesNodes2(childMetaObject,rootNode,typeNodes);}}}},{key:"_createContainmentNodes",value:function _createContainmentNodes(){var rootMetaObjects=this._viewer.metaScene.rootMetaObjects;for(var id in rootMetaObjects){this._createContainmentNodes2(rootMetaObjects[id],null);}}},{key:"_createContainmentNodes2",value:function _createContainmentNodes2(metaObject,parent){if(this._pruneEmptyNodes&&metaObject._countEntities===0){return;}var metaObjectType=metaObject.type;var metaObjectName=metaObject.name||metaObjectType;var children=metaObject.children;var objectId=metaObject.id;var node={nodeId:"".concat(this._id,"-").concat(objectId),objectId:objectId,title:!parent?metaObject.metaModels.length===0?metaObjectName:this._rootNames[metaObject.metaModels[0].id]||metaObjectName:metaObjectName&&metaObjectName!==""&&metaObjectName!=="Undefined"&&metaObjectName!=="Default"?metaObjectName:metaObjectType,type:metaObjectType,parent:parent,numEntities:0,numVisibleEntities:0,checked:false,xrayed:false,children:[]};if(parent){parent.children.push(node);}else{this._rootNodes.push(node);}this._objectNodes[node.objectId]=node;this._nodeNodes[node.nodeId]=node;if(children){for(var _i343=0,len=children.length;_i343<len;_i343++){var childMetaObject=children[_i343];this._createContainmentNodes2(childMetaObject,node);}}}},{key:"_doSortNodes",value:function _doSortNodes(){for(var _i344=0,len=this._rootNodes.length;_i344<len;_i344++){var rootNode=this._rootNodes[_i344];this._sortChildren(rootNode);}}},{key:"_sortChildren",value:function _sortChildren(node){var children=node.children;if(!children||children.length===0){return;}var firstChild=children[0];if((this._hierarchy==="storeys"||this._hierarchy==="containment")&&firstChild.type==="IfcBuildingStorey"){if(this._elevationSortFunction)children.sort(this._elevationSortFunction);else children.sort(this._getSpatialSortFunc());}else{if(this._defaultSortFunction)children.sort(this._defaultSortFunction);else children.sort(this._alphaSortFunc);}for(var _i345=0,len=children.length;_i345<len;_i345++){var _node2=children[_i345];this._sortChildren(_node2);}}},{key:"_getSpatialSortFunc",value:function _getSpatialSortFunc(){var _this180=this;var viewer=this.viewer;var scene=viewer.scene;var camera=scene.camera;return this._spatialSortFunc||(this._spatialSortFunc=function(storey1,storey2){if(camera.xUp);else if(camera.yUp);else;var metaScene=_this180.viewer.metaScene;var storey1MetaObject=metaScene.metaObjects[storey1.objectId];var storey2MetaObject=metaScene.metaObjects[storey2.objectId];if(storey1MetaObject&&storey1MetaObject.attributes&&storey1MetaObject.attributes.elevation!==undefined&&storey2MetaObject&&storey2MetaObject.attributes&&storey2MetaObject.attributes.elevation!==undefined){var elevation1=Number.parseFloat(storey1MetaObject.attributes.elevation);var elevation2=Number.parseFloat(storey2MetaObject.attributes.elevation);if(elevation1>elevation2){return-1;}if(elevation1<elevation2){return 1;}return 0;}else{return 0;}});}},{key:"_alphaSortFunc",value:function _alphaSortFunc(node1,node2){var title1=node1.title.toUpperCase();// FIXME: Should be case sensitive?
28736
+ var title2=node2.title.toUpperCase();if(title1<title2){return-1;}if(title1>title2){return 1;}return 0;}},{key:"_synchNodesToEntities",value:function _synchNodesToEntities(){var objectIds=Object.keys(this.viewer.metaScene.metaObjects);var metaObjects=this._viewer.metaScene.metaObjects;var objects=this._viewer.scene.objects;for(var _i346=0,len=objectIds.length;_i346<len;_i346++){var objectId=objectIds[_i346];var metaObject=metaObjects[objectId];if(metaObject){var node=this._objectNodes[objectId];if(node){var entity=objects[objectId];if(entity){var visible=entity.visible;node.numEntities=1;node.xrayed=entity.xrayed;if(visible){node.numVisibleEntities=1;node.checked=true;}else{node.numVisibleEntities=0;node.checked=false;}var parent=node.parent;// Synch parents
28737
+ while(parent){parent.numEntities++;if(visible){parent.numVisibleEntities++;parent.checked=true;}parent=parent.parent;}}}}}}},{key:"_withNodeTree",value:function _withNodeTree(node,callback){callback(node);var children=node.children;if(!children){return;}for(var _i347=0,len=children.length;_i347<len;_i347++){this._withNodeTree(children[_i347],callback);}}},{key:"_createTrees",value:function _createTrees(){var _this181=this;if(this._rootNodes.length===0){return;}var rootNodeElements=this._rootNodes.map(function(rootNode){return _this181._createNodeElement(rootNode);});var rootNode=this._renderService.createRootNode();rootNodeElements.forEach(function(nodeElement){rootNode.appendChild(nodeElement);});this._containerElement.appendChild(rootNode);this._rootElement=rootNode;}},{key:"_createNodeElement",value:function _createNodeElement(node){var _this182=this;var contextmenuHandler=function contextmenuHandler(event){_this182.fire("contextmenu",{event:event,viewer:_this182._viewer,treeViewPlugin:_this182,treeViewNode:node});event.preventDefault();};var onclickHandler=function onclickHandler(event){_this182.fire("nodeTitleClicked",{event:event,viewer:_this182._viewer,treeViewPlugin:_this182,treeViewNode:node});event.preventDefault();};return this._renderService.createNodeElement(node,this._switchExpandHandler,this._checkboxChangeHandler,contextmenuHandler,onclickHandler);}},{key:"_expandSwitchElement",value:function _expandSwitchElement(switchElement){var _this183=this;var expanded=this._renderService.isExpanded(switchElement);if(expanded){return;}var nodeId=this._renderService.getId(switchElement);var nodeElements=this._nodeNodes[nodeId].children.map(function(node){return _this183._createNodeElement(node);});this._renderService.addChildren(switchElement,nodeElements);this._renderService.expand(switchElement,this._switchExpandHandler,this._switchCollapseHandler);}},{key:"_collapseNode",value:function _collapseNode(nodeId){var switchElement=this._renderService.getSwitchElement(nodeId);this._collapseSwitchElement(switchElement);}},{key:"_collapseSwitchElement",value:function _collapseSwitchElement(switchElement){this._renderService.collapse(switchElement,this._switchExpandHandler,this._switchCollapseHandler);}}]);return TreeViewPlugin;}(Plugin);/**
28729
28738
  * For each Entity in its Scene, efficiently combines updates from multiple culling systems into a single "culled" state.
28730
28739
  *
28731
28740
  * Two culling systems are supported:
@@ -28742,7 +28751,7 @@ this._objectsViewCulled=[];// A flag for each object to indicate its view-cull s
28742
28751
  this._objectsDetailCulled=[];// A flag for each object to indicate its detail-cull status
28743
28752
  this._objectsChanged=[];// A flag for each object, set whenever its cull status has changed since last _applyChanges()
28744
28753
  this._objectsChangedList=[];// A list of objects whose cull status has changed, applied and cleared by _applyChanges()
28745
- this._modelInfos={};this._numObjects=0;this._lenObjectsChangedList=0;this._dirty=true;this._onModelLoaded=scene.on("modelLoaded",function(modelId){var model=scene.models[modelId];if(model){_this184._addModel(model);}});this._onTick=scene.on("tick",function(){if(_this184._dirty){_this184._build();}_this184._applyChanges();});}_createClass(ObjectCullStates,[{key:"_addModel",value:function _addModel(model){var _this185=this;var modelInfo={model:model,onDestroyed:model.on("destroyed",function(){_this185._removeModel(model);})};this._modelInfos[model.id]=modelInfo;this._dirty=true;}},{key:"_removeModel",value:function _removeModel(model){var modelInfo=this._modelInfos[model.id];if(modelInfo){modelInfo.model.off(modelInfo.onDestroyed);delete this._modelInfos[model.id];this._dirty=true;}}},{key:"_build",value:function _build(){if(!this._dirty){return;}this._applyChanges();var objects=this._scene.objects;for(var _i346=0;_i346<this._numObjects;_i346++){this._objects[_i346]=null;}this._numObjects=0;for(var objectId in objects){var entity=objects[objectId];this._objects[this._numObjects++]=entity;}this._lenObjectsChangedList=0;this._dirty=false;}},{key:"_applyChanges",value:function _applyChanges(){if(this._lenObjectsChangedList>0){for(var _i347=0;_i347<this._lenObjectsChangedList;_i347++){var objectIdx=this._objectsChangedList[_i347];var object=this._objects[objectIdx];var viewCulled=this._objectsViewCulled[objectIdx];var detailCulled=this._objectsDetailCulled[objectIdx];var culled=viewCulled||detailCulled;object.culled=culled;this._objectsChanged[objectIdx]=false;}this._lenObjectsChangedList=0;}}/**
28754
+ this._modelInfos={};this._numObjects=0;this._lenObjectsChangedList=0;this._dirty=true;this._onModelLoaded=scene.on("modelLoaded",function(modelId){var model=scene.models[modelId];if(model){_this184._addModel(model);}});this._onTick=scene.on("tick",function(){if(_this184._dirty){_this184._build();}_this184._applyChanges();});}_createClass(ObjectCullStates,[{key:"_addModel",value:function _addModel(model){var _this185=this;var modelInfo={model:model,onDestroyed:model.on("destroyed",function(){_this185._removeModel(model);})};this._modelInfos[model.id]=modelInfo;this._dirty=true;}},{key:"_removeModel",value:function _removeModel(model){var modelInfo=this._modelInfos[model.id];if(modelInfo){modelInfo.model.off(modelInfo.onDestroyed);delete this._modelInfos[model.id];this._dirty=true;}}},{key:"_build",value:function _build(){if(!this._dirty){return;}this._applyChanges();var objects=this._scene.objects;for(var _i348=0;_i348<this._numObjects;_i348++){this._objects[_i348]=null;}this._numObjects=0;for(var objectId in objects){var entity=objects[objectId];this._objects[this._numObjects++]=entity;}this._lenObjectsChangedList=0;this._dirty=false;}},{key:"_applyChanges",value:function _applyChanges(){if(this._lenObjectsChangedList>0){for(var _i349=0;_i349<this._lenObjectsChangedList;_i349++){var objectIdx=this._objectsChangedList[_i349];var object=this._objects[objectIdx];var viewCulled=this._objectsViewCulled[objectIdx];var detailCulled=this._objectsDetailCulled[objectIdx];var culled=viewCulled||detailCulled;object.culled=culled;this._objectsChanged[objectIdx]=false;}this._lenObjectsChangedList=0;}}/**
28746
28755
  * Array of {@link Entity} instances that represent objects in the {@link Scene}.
28747
28756
  *
28748
28757
  * ObjectCullStates rebuilds this from {@link Scene#objects} whenever ````Scene```` fires a ````modelLoaded```` event.
@@ -28818,7 +28827,7 @@ _this186._maxTreeDepth=cfg.maxTreeDepth||MAX_KD_TREE_DEPTH;_this186._modelInfos=
28818
28827
  * Gets whether view culling is enabled.
28819
28828
  *
28820
28829
  * @retutns {Boolean} Whether view culling is enabled.
28821
- */function get(){return this._enabled;},set:function set(enabled){this._enabled=enabled;}},{key:"_addModel",value:function _addModel(model){var _this187=this;var modelInfo={model:model,onDestroyed:model.on("destroyed",function(){_this187._removeModel(model);})};this._modelInfos[model.id]=modelInfo;this._kdTreeDirty=true;}},{key:"_removeModel",value:function _removeModel(model){var modelInfo=this._modelInfos[model.id];if(modelInfo){modelInfo.model.off(modelInfo.onDestroyed);delete this._modelInfos[model.id];this._kdTreeDirty=true;}}},{key:"_doCull",value:function _doCull(){var cullDirty=this._frustumDirty||this._kdTreeDirty;if(this._frustumDirty){this._buildFrustum();}if(this._kdTreeDirty){this._buildKDTree();}if(cullDirty){var kdNode=this._kdRoot;if(kdNode){this._visitKDNode(kdNode);}}}},{key:"_buildFrustum",value:function _buildFrustum(){var camera=this.viewer.scene.camera;setFrustum(this._frustum,camera.viewMatrix,camera.projMatrix);this._frustumDirty=false;}},{key:"_buildKDTree",value:function _buildKDTree(){var viewer=this.viewer;var scene=viewer.scene;var depth=0;if(this._kdRoot);this._kdRoot={aabb:scene.getAABB(),intersection:Frustum$1.INTERSECT};for(var objectIdx=0,len=this._objectCullStates.numObjects;objectIdx<len;objectIdx++){var entity=this._objectCullStates.objects[objectIdx];this._insertEntityIntoKDTree(this._kdRoot,entity,objectIdx,depth+1);}this._kdTreeDirty=false;}},{key:"_insertEntityIntoKDTree",value:function _insertEntityIntoKDTree(kdNode,entity,objectIdx,depth){var entityAABB=entity.aabb;if(depth>=this._maxTreeDepth){kdNode.objects=kdNode.objects||[];kdNode.objects.push(objectIdx);math.expandAABB3(kdNode.aabb,entityAABB);return;}if(kdNode.left){if(math.containsAABB3(kdNode.left.aabb,entityAABB)){this._insertEntityIntoKDTree(kdNode.left,entity,objectIdx,depth+1);return;}}if(kdNode.right){if(math.containsAABB3(kdNode.right.aabb,entityAABB)){this._insertEntityIntoKDTree(kdNode.right,entity,objectIdx,depth+1);return;}}var nodeAABB=kdNode.aabb;kdTreeDimLength[0]=nodeAABB[3]-nodeAABB[0];kdTreeDimLength[1]=nodeAABB[4]-nodeAABB[1];kdTreeDimLength[2]=nodeAABB[5]-nodeAABB[2];var dim=0;if(kdTreeDimLength[1]>kdTreeDimLength[dim]){dim=1;}if(kdTreeDimLength[2]>kdTreeDimLength[dim]){dim=2;}if(!kdNode.left){var aabbLeft=nodeAABB.slice();aabbLeft[dim+3]=(nodeAABB[dim]+nodeAABB[dim+3])/2.0;kdNode.left={aabb:aabbLeft,intersection:Frustum$1.INTERSECT};if(math.containsAABB3(aabbLeft,entityAABB)){this._insertEntityIntoKDTree(kdNode.left,entity,objectIdx,depth+1);return;}}if(!kdNode.right){var aabbRight=nodeAABB.slice();aabbRight[dim]=(nodeAABB[dim]+nodeAABB[dim+3])/2.0;kdNode.right={aabb:aabbRight,intersection:Frustum$1.INTERSECT};if(math.containsAABB3(aabbRight,entityAABB)){this._insertEntityIntoKDTree(kdNode.right,entity,objectIdx,depth+1);return;}}kdNode.objects=kdNode.objects||[];kdNode.objects.push(objectIdx);math.expandAABB3(kdNode.aabb,entityAABB);}},{key:"_visitKDNode",value:function _visitKDNode(kdNode){var intersects=arguments.length>1&&arguments[1]!==undefined?arguments[1]:Frustum$1.INTERSECT;if(intersects!==Frustum$1.INTERSECT&&kdNode.intersects===intersects){return;}if(intersects===Frustum$1.INTERSECT){intersects=frustumIntersectsAABB3(this._frustum,kdNode.aabb);kdNode.intersects=intersects;}var culled=intersects===Frustum$1.OUTSIDE;var objects=kdNode.objects;if(objects&&objects.length>0){for(var _i348=0,len=objects.length;_i348<len;_i348++){var objectIdx=objects[_i348];this._objectCullStates.setObjectViewCulled(objectIdx,culled);}}if(kdNode.left){this._visitKDNode(kdNode.left,intersects);}if(kdNode.right){this._visitKDNode(kdNode.right,intersects);}}/**
28830
+ */function get(){return this._enabled;},set:function set(enabled){this._enabled=enabled;}},{key:"_addModel",value:function _addModel(model){var _this187=this;var modelInfo={model:model,onDestroyed:model.on("destroyed",function(){_this187._removeModel(model);})};this._modelInfos[model.id]=modelInfo;this._kdTreeDirty=true;}},{key:"_removeModel",value:function _removeModel(model){var modelInfo=this._modelInfos[model.id];if(modelInfo){modelInfo.model.off(modelInfo.onDestroyed);delete this._modelInfos[model.id];this._kdTreeDirty=true;}}},{key:"_doCull",value:function _doCull(){var cullDirty=this._frustumDirty||this._kdTreeDirty;if(this._frustumDirty){this._buildFrustum();}if(this._kdTreeDirty){this._buildKDTree();}if(cullDirty){var kdNode=this._kdRoot;if(kdNode){this._visitKDNode(kdNode);}}}},{key:"_buildFrustum",value:function _buildFrustum(){var camera=this.viewer.scene.camera;setFrustum(this._frustum,camera.viewMatrix,camera.projMatrix);this._frustumDirty=false;}},{key:"_buildKDTree",value:function _buildKDTree(){var viewer=this.viewer;var scene=viewer.scene;var depth=0;if(this._kdRoot);this._kdRoot={aabb:scene.getAABB(),intersection:Frustum$1.INTERSECT};for(var objectIdx=0,len=this._objectCullStates.numObjects;objectIdx<len;objectIdx++){var entity=this._objectCullStates.objects[objectIdx];this._insertEntityIntoKDTree(this._kdRoot,entity,objectIdx,depth+1);}this._kdTreeDirty=false;}},{key:"_insertEntityIntoKDTree",value:function _insertEntityIntoKDTree(kdNode,entity,objectIdx,depth){var entityAABB=entity.aabb;if(depth>=this._maxTreeDepth){kdNode.objects=kdNode.objects||[];kdNode.objects.push(objectIdx);math.expandAABB3(kdNode.aabb,entityAABB);return;}if(kdNode.left){if(math.containsAABB3(kdNode.left.aabb,entityAABB)){this._insertEntityIntoKDTree(kdNode.left,entity,objectIdx,depth+1);return;}}if(kdNode.right){if(math.containsAABB3(kdNode.right.aabb,entityAABB)){this._insertEntityIntoKDTree(kdNode.right,entity,objectIdx,depth+1);return;}}var nodeAABB=kdNode.aabb;kdTreeDimLength[0]=nodeAABB[3]-nodeAABB[0];kdTreeDimLength[1]=nodeAABB[4]-nodeAABB[1];kdTreeDimLength[2]=nodeAABB[5]-nodeAABB[2];var dim=0;if(kdTreeDimLength[1]>kdTreeDimLength[dim]){dim=1;}if(kdTreeDimLength[2]>kdTreeDimLength[dim]){dim=2;}if(!kdNode.left){var aabbLeft=nodeAABB.slice();aabbLeft[dim+3]=(nodeAABB[dim]+nodeAABB[dim+3])/2.0;kdNode.left={aabb:aabbLeft,intersection:Frustum$1.INTERSECT};if(math.containsAABB3(aabbLeft,entityAABB)){this._insertEntityIntoKDTree(kdNode.left,entity,objectIdx,depth+1);return;}}if(!kdNode.right){var aabbRight=nodeAABB.slice();aabbRight[dim]=(nodeAABB[dim]+nodeAABB[dim+3])/2.0;kdNode.right={aabb:aabbRight,intersection:Frustum$1.INTERSECT};if(math.containsAABB3(aabbRight,entityAABB)){this._insertEntityIntoKDTree(kdNode.right,entity,objectIdx,depth+1);return;}}kdNode.objects=kdNode.objects||[];kdNode.objects.push(objectIdx);math.expandAABB3(kdNode.aabb,entityAABB);}},{key:"_visitKDNode",value:function _visitKDNode(kdNode){var intersects=arguments.length>1&&arguments[1]!==undefined?arguments[1]:Frustum$1.INTERSECT;if(intersects!==Frustum$1.INTERSECT&&kdNode.intersects===intersects){return;}if(intersects===Frustum$1.INTERSECT){intersects=frustumIntersectsAABB3(this._frustum,kdNode.aabb);kdNode.intersects=intersects;}var culled=intersects===Frustum$1.OUTSIDE;var objects=kdNode.objects;if(objects&&objects.length>0){for(var _i350=0,len=objects.length;_i350<len;_i350++){var objectIdx=objects[_i350];this._objectCullStates.setObjectViewCulled(objectIdx,culled);}}if(kdNode.left){this._visitKDNode(kdNode.left,intersects);}if(kdNode.right){this._visitKDNode(kdNode.right,intersects);}}/**
28822
28831
  * @private
28823
28832
  */},{key:"send",value:function send(name,value){}/**
28824
28833
  * Destroys this ViewCullPlugin.
@@ -28843,7 +28852,7 @@ _this186._maxTreeDepth=cfg.maxTreeDepth||MAX_KD_TREE_DEPTH;_this186._modelInfos=
28843
28852
  * @param {Function} ok Callback fired on success, argument is the ````.xkt```` file in an arraybuffer.
28844
28853
  * @param {Function} error Callback fired on error.
28845
28854
  */},{key:"getXKT",value:function getXKT(src,ok,error){var defaultCallback=function defaultCallback(){};ok=ok||defaultCallback;error=error||defaultCallback;var dataUriRegex=/^data:(.*?)(;base64)?,(.*)$/;var dataUriRegexResult=src.match(dataUriRegex);if(dataUriRegexResult){// Safari can't handle data URIs through XMLHttpRequest
28846
- var isBase64=!!dataUriRegexResult[2];var data=dataUriRegexResult[3];data=window.decodeURIComponent(data);if(isBase64){data=window.atob(data);}try{var buffer=new ArrayBuffer(data.length);var view=new Uint8Array(buffer);for(var i=0;i<data.length;i++){view[i]=data.charCodeAt(i);}ok(buffer);}catch(errMsg){error(errMsg);}}else{var request=new XMLHttpRequest();request.open('GET',this._cacheBusterURL(src),true);request.responseType='arraybuffer';request.onreadystatechange=function(){if(request.readyState===4){if(request.status===200){ok(request.response);}else{error('getXKT error : '+request.response);}}};request.send(null);}}}]);return XKTDefaultDataSource;}();/*! pako 2.1.0 https://github.com/nodeca/pako @license (MIT AND Zlib) */!function(t,e){"object"==(typeof exports==="undefined"?"undefined":_typeof(exports))&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).pako={});}(undefined,function(t){function e(t){var e=t.length;for(;--e>=0;){t[e]=0;}}var a=256,i=286,n=30,s=15,r=new Uint8Array([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0]),o=new Uint8Array([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13]),l=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),h=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),d=new Array(576);e(d);var _=new Array(60);e(_);var f=new Array(512);e(f);var c=new Array(256);e(c);var u=new Array(29);e(u);var w=new Array(n);function m(t,e,a,i,n){this.static_tree=t,this.extra_bits=e,this.extra_base=a,this.elems=i,this.max_length=n,this.has_stree=t&&t.length;}var b,g,p;function k(t,e){this.dyn_tree=t,this.max_code=0,this.stat_desc=e;}e(w);var v=function v(t){return t<256?f[t]:f[256+(t>>>7)];},y=function y(t,e){t.pending_buf[t.pending++]=255&e,t.pending_buf[t.pending++]=e>>>8&255;},x=function x(t,e,a){t.bi_valid>16-a?(t.bi_buf|=e<<t.bi_valid&65535,y(t,t.bi_buf),t.bi_buf=e>>16-t.bi_valid,t.bi_valid+=a-16):(t.bi_buf|=e<<t.bi_valid&65535,t.bi_valid+=a);},z=function z(t,e,a){x(t,a[2*e],a[2*e+1]);},A=function A(t,e){var a=0;do{a|=1&t,t>>>=1,a<<=1;}while(--e>0);return a>>>1;},E=function E(t,e,a){var i=new Array(16);var n,r,o=0;for(n=1;n<=s;n++){o=o+a[n-1]<<1,i[n]=o;}for(r=0;r<=e;r++){var _e3=t[2*r+1];0!==_e3&&(t[2*r]=A(i[_e3]++,_e3));}},R=function R(t){var e;for(e=0;e<i;e++){t.dyn_ltree[2*e]=0;}for(e=0;e<n;e++){t.dyn_dtree[2*e]=0;}for(e=0;e<19;e++){t.bl_tree[2*e]=0;}t.dyn_ltree[512]=1,t.opt_len=t.static_len=0,t.sym_next=t.matches=0;},Z=function Z(t){t.bi_valid>8?y(t,t.bi_buf):t.bi_valid>0&&(t.pending_buf[t.pending++]=t.bi_buf),t.bi_buf=0,t.bi_valid=0;},U=function U(t,e,a,i){var n=2*e,s=2*a;return t[n]<t[s]||t[n]===t[s]&&i[e]<=i[a];},S=function S(t,e,a){var i=t.heap[a];var n=a<<1;for(;n<=t.heap_len&&(n<t.heap_len&&U(e,t.heap[n+1],t.heap[n],t.depth)&&n++,!U(e,i,t.heap[n],t.depth));){t.heap[a]=t.heap[n],a=n,n<<=1;}t.heap[a]=i;},D=function D(t,e,i){var n,s,l,h,d=0;if(0!==t.sym_next)do{n=255&t.pending_buf[t.sym_buf+d++],n+=(255&t.pending_buf[t.sym_buf+d++])<<8,s=t.pending_buf[t.sym_buf+d++],0===n?z(t,s,e):(l=c[s],z(t,l+a+1,e),h=r[l],0!==h&&(s-=u[l],x(t,s,h)),n--,l=v(n),z(t,l,i),h=o[l],0!==h&&(n-=w[l],x(t,n,h)));}while(d<t.sym_next);z(t,256,e);},T=function T(t,e){var a=e.dyn_tree,i=e.stat_desc.static_tree,n=e.stat_desc.has_stree,r=e.stat_desc.elems;var o,l,h,d=-1;for(t.heap_len=0,t.heap_max=573,o=0;o<r;o++){0!==a[2*o]?(t.heap[++t.heap_len]=d=o,t.depth[o]=0):a[2*o+1]=0;}for(;t.heap_len<2;){h=t.heap[++t.heap_len]=d<2?++d:0,a[2*h]=1,t.depth[h]=0,t.opt_len--,n&&(t.static_len-=i[2*h+1]);}for(e.max_code=d,o=t.heap_len>>1;o>=1;o--){S(t,a,o);}h=r;do{o=t.heap[1],t.heap[1]=t.heap[t.heap_len--],S(t,a,1),l=t.heap[1],t.heap[--t.heap_max]=o,t.heap[--t.heap_max]=l,a[2*h]=a[2*o]+a[2*l],t.depth[h]=(t.depth[o]>=t.depth[l]?t.depth[o]:t.depth[l])+1,a[2*o+1]=a[2*l+1]=h,t.heap[1]=h++,S(t,a,1);}while(t.heap_len>=2);t.heap[--t.heap_max]=t.heap[1],function(t,e){var a=e.dyn_tree,i=e.max_code,n=e.stat_desc.static_tree,r=e.stat_desc.has_stree,o=e.stat_desc.extra_bits,l=e.stat_desc.extra_base,h=e.stat_desc.max_length;var d,_,f,c,u,w,m=0;for(c=0;c<=s;c++){t.bl_count[c]=0;}for(a[2*t.heap[t.heap_max]+1]=0,d=t.heap_max+1;d<573;d++){_=t.heap[d],c=a[2*a[2*_+1]+1]+1,c>h&&(c=h,m++),a[2*_+1]=c,_>i||(t.bl_count[c]++,u=0,_>=l&&(u=o[_-l]),w=a[2*_],t.opt_len+=w*(c+u),r&&(t.static_len+=w*(n[2*_+1]+u)));}if(0!==m){do{for(c=h-1;0===t.bl_count[c];){c--;}t.bl_count[c]--,t.bl_count[c+1]+=2,t.bl_count[h]--,m-=2;}while(m>0);for(c=h;0!==c;c--){for(_=t.bl_count[c];0!==_;){f=t.heap[--d],f>i||(a[2*f+1]!==c&&(t.opt_len+=(c-a[2*f+1])*a[2*f],a[2*f+1]=c),_--);}}}}(t,e),E(a,d,t.bl_count);},O=function O(t,e,a){var i,n,s=-1,r=e[1],o=0,l=7,h=4;for(0===r&&(l=138,h=3),e[2*(a+1)+1]=65535,i=0;i<=a;i++){n=r,r=e[2*(i+1)+1],++o<l&&n===r||(o<h?t.bl_tree[2*n]+=o:0!==n?(n!==s&&t.bl_tree[2*n]++,t.bl_tree[32]++):o<=10?t.bl_tree[34]++:t.bl_tree[36]++,o=0,s=n,0===r?(l=138,h=3):n===r?(l=6,h=3):(l=7,h=4));}},I=function I(t,e,a){var i,n,s=-1,r=e[1],o=0,l=7,h=4;for(0===r&&(l=138,h=3),i=0;i<=a;i++){if(n=r,r=e[2*(i+1)+1],!(++o<l&&n===r)){if(o<h)do{z(t,n,t.bl_tree);}while(0!=--o);else 0!==n?(n!==s&&(z(t,n,t.bl_tree),o--),z(t,16,t.bl_tree),x(t,o-3,2)):o<=10?(z(t,17,t.bl_tree),x(t,o-3,3)):(z(t,18,t.bl_tree),x(t,o-11,7));o=0,s=n,0===r?(l=138,h=3):n===r?(l=6,h=3):(l=7,h=4);}}};var F=!1;var L=function L(t,e,a,i){x(t,0+(i?1:0),3),Z(t),y(t,a),y(t,~a),a&&t.pending_buf.set(t.window.subarray(e,e+a),t.pending),t.pending+=a;};var N=function N(t,e,i,n){var s,r,o=0;t.level>0?(2===t.strm.data_type&&(t.strm.data_type=function(t){var e,i=4093624447;for(e=0;e<=31;e++,i>>>=1){if(1&i&&0!==t.dyn_ltree[2*e])return 0;}if(0!==t.dyn_ltree[18]||0!==t.dyn_ltree[20]||0!==t.dyn_ltree[26])return 1;for(e=32;e<a;e++){if(0!==t.dyn_ltree[2*e])return 1;}return 0;}(t)),T(t,t.l_desc),T(t,t.d_desc),o=function(t){var e;for(O(t,t.dyn_ltree,t.l_desc.max_code),O(t,t.dyn_dtree,t.d_desc.max_code),T(t,t.bl_desc),e=18;e>=3&&0===t.bl_tree[2*h[e]+1];e--){;}return t.opt_len+=3*(e+1)+5+5+4,e;}(t),s=t.opt_len+3+7>>>3,r=t.static_len+3+7>>>3,r<=s&&(s=r)):s=r=i+5,i+4<=s&&-1!==e?L(t,e,i,n):4===t.strategy||r===s?(x(t,2+(n?1:0),3),D(t,d,_)):(x(t,4+(n?1:0),3),function(t,e,a,i){var n;for(x(t,e-257,5),x(t,a-1,5),x(t,i-4,4),n=0;n<i;n++){x(t,t.bl_tree[2*h[n]+1],3);}I(t,t.dyn_ltree,e-1),I(t,t.dyn_dtree,a-1);}(t,t.l_desc.max_code+1,t.d_desc.max_code+1,o+1),D(t,t.dyn_ltree,t.dyn_dtree)),R(t),n&&Z(t);},B={_tr_init:function _tr_init(t){F||(function(){var t,e,a,h,k;var v=new Array(16);for(a=0,h=0;h<28;h++){for(u[h]=a,t=0;t<1<<r[h];t++){c[a++]=h;}}for(c[a-1]=h,k=0,h=0;h<16;h++){for(w[h]=k,t=0;t<1<<o[h];t++){f[k++]=h;}}for(k>>=7;h<n;h++){for(w[h]=k<<7,t=0;t<1<<o[h]-7;t++){f[256+k++]=h;}}for(e=0;e<=s;e++){v[e]=0;}for(t=0;t<=143;){d[2*t+1]=8,t++,v[8]++;}for(;t<=255;){d[2*t+1]=9,t++,v[9]++;}for(;t<=279;){d[2*t+1]=7,t++,v[7]++;}for(;t<=287;){d[2*t+1]=8,t++,v[8]++;}for(E(d,287,v),t=0;t<n;t++){_[2*t+1]=5,_[2*t]=A(t,5);}b=new m(d,r,257,i,s),g=new m(_,o,0,n,s),p=new m(new Array(0),l,0,19,7);}(),F=!0),t.l_desc=new k(t.dyn_ltree,b),t.d_desc=new k(t.dyn_dtree,g),t.bl_desc=new k(t.bl_tree,p),t.bi_buf=0,t.bi_valid=0,R(t);},_tr_stored_block:L,_tr_flush_block:N,_tr_tally:function _tr_tally(t,e,i){return t.pending_buf[t.sym_buf+t.sym_next++]=e,t.pending_buf[t.sym_buf+t.sym_next++]=e>>8,t.pending_buf[t.sym_buf+t.sym_next++]=i,0===e?t.dyn_ltree[2*i]++:(t.matches++,e--,t.dyn_ltree[2*(c[i]+a+1)]++,t.dyn_dtree[2*v(e)]++),t.sym_next===t.sym_end;},_tr_align:function _tr_align(t){x(t,2,3),z(t,256,d),function(t){16===t.bi_valid?(y(t,t.bi_buf),t.bi_buf=0,t.bi_valid=0):t.bi_valid>=8&&(t.pending_buf[t.pending++]=255&t.bi_buf,t.bi_buf>>=8,t.bi_valid-=8);}(t);}};var C=function C(t,e,a,i){var n=65535&t|0,s=t>>>16&65535|0,r=0;for(;0!==a;){r=a>2e3?2e3:a,a-=r;do{n=n+e[i++]|0,s=s+n|0;}while(--r);n%=65521,s%=65521;}return n|s<<16|0;};var M=new Uint32Array(function(){var t,e=[];for(var a=0;a<256;a++){t=a;for(var i=0;i<8;i++){t=1&t?3988292384^t>>>1:t>>>1;}e[a]=t;}return e;}());var H=function H(t,e,a,i){var n=M,s=i+a;t^=-1;for(var _a9=i;_a9<s;_a9++){t=t>>>8^n[255&(t^e[_a9])];}return-1^t;},j={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"},K={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8};var P=B._tr_init,Y=B._tr_stored_block,G=B._tr_flush_block,X=B._tr_tally,W=B._tr_align,q=K.Z_NO_FLUSH,J=K.Z_PARTIAL_FLUSH,Q=K.Z_FULL_FLUSH,V=K.Z_FINISH,$=K.Z_BLOCK,tt=K.Z_OK,et=K.Z_STREAM_END,at=K.Z_STREAM_ERROR,it=K.Z_DATA_ERROR,nt=K.Z_BUF_ERROR,st=K.Z_DEFAULT_COMPRESSION,rt=K.Z_FILTERED,ot=K.Z_HUFFMAN_ONLY,lt=K.Z_RLE,ht=K.Z_FIXED,dt=K.Z_DEFAULT_STRATEGY,_t=K.Z_UNKNOWN,ft=K.Z_DEFLATED,ct=258,ut=262,wt=42,mt=113,bt=666,gt=function gt(t,e){return t.msg=j[e],e;},pt=function pt(t){return 2*t-(t>4?9:0);},kt=function kt(t){var e=t.length;for(;--e>=0;){t[e]=0;}},vt=function vt(t){var e,a,i,n=t.w_size;e=t.hash_size,i=e;do{a=t.head[--i],t.head[i]=a>=n?a-n:0;}while(--e);e=n,i=e;do{a=t.prev[--i],t.prev[i]=a>=n?a-n:0;}while(--e);};var yt=function yt(t,e,a){return(e<<t.hash_shift^a)&t.hash_mask;};var xt=function xt(t){var e=t.state;var a=e.pending;a>t.avail_out&&(a=t.avail_out),0!==a&&(t.output.set(e.pending_buf.subarray(e.pending_out,e.pending_out+a),t.next_out),t.next_out+=a,e.pending_out+=a,t.total_out+=a,t.avail_out-=a,e.pending-=a,0===e.pending&&(e.pending_out=0));},zt=function zt(t,e){G(t,t.block_start>=0?t.block_start:-1,t.strstart-t.block_start,e),t.block_start=t.strstart,xt(t.strm);},At=function At(t,e){t.pending_buf[t.pending++]=e;},Et=function Et(t,e){t.pending_buf[t.pending++]=e>>>8&255,t.pending_buf[t.pending++]=255&e;},Rt=function Rt(t,e,a,i){var n=t.avail_in;return n>i&&(n=i),0===n?0:(t.avail_in-=n,e.set(t.input.subarray(t.next_in,t.next_in+n),a),1===t.state.wrap?t.adler=C(t.adler,e,n,a):2===t.state.wrap&&(t.adler=H(t.adler,e,n,a)),t.next_in+=n,t.total_in+=n,n);},Zt=function Zt(t,e){var a,i,n=t.max_chain_length,s=t.strstart,r=t.prev_length,o=t.nice_match;var l=t.strstart>t.w_size-ut?t.strstart-(t.w_size-ut):0,h=t.window,d=t.w_mask,_=t.prev,f=t.strstart+ct;var c=h[s+r-1],u=h[s+r];t.prev_length>=t.good_match&&(n>>=2),o>t.lookahead&&(o=t.lookahead);do{if(a=e,h[a+r]===u&&h[a+r-1]===c&&h[a]===h[s]&&h[++a]===h[s+1]){s+=2,a++;do{}while(h[++s]===h[++a]&&h[++s]===h[++a]&&h[++s]===h[++a]&&h[++s]===h[++a]&&h[++s]===h[++a]&&h[++s]===h[++a]&&h[++s]===h[++a]&&h[++s]===h[++a]&&s<f);if(i=ct-(f-s),s=f-ct,i>r){if(t.match_start=e,r=i,i>=o)break;c=h[s+r-1],u=h[s+r];}}}while((e=_[e&d])>l&&0!=--n);return r<=t.lookahead?r:t.lookahead;},Ut=function Ut(t){var e=t.w_size;var a,i,n;do{if(i=t.window_size-t.lookahead-t.strstart,t.strstart>=e+(e-ut)&&(t.window.set(t.window.subarray(e,e+e-i),0),t.match_start-=e,t.strstart-=e,t.block_start-=e,t.insert>t.strstart&&(t.insert=t.strstart),vt(t),i+=e),0===t.strm.avail_in)break;if(a=Rt(t.strm,t.window,t.strstart+t.lookahead,i),t.lookahead+=a,t.lookahead+t.insert>=3)for(n=t.strstart-t.insert,t.ins_h=t.window[n],t.ins_h=yt(t,t.ins_h,t.window[n+1]);t.insert&&(t.ins_h=yt(t,t.ins_h,t.window[n+3-1]),t.prev[n&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=n,n++,t.insert--,!(t.lookahead+t.insert<3));){;}}while(t.lookahead<ut&&0!==t.strm.avail_in);},St=function St(t,e){var a,i,n,s=t.pending_buf_size-5>t.w_size?t.w_size:t.pending_buf_size-5,r=0,o=t.strm.avail_in;do{if(a=65535,n=t.bi_valid+42>>3,t.strm.avail_out<n)break;if(n=t.strm.avail_out-n,i=t.strstart-t.block_start,a>i+t.strm.avail_in&&(a=i+t.strm.avail_in),a>n&&(a=n),a<s&&(0===a&&e!==V||e===q||a!==i+t.strm.avail_in))break;r=e===V&&a===i+t.strm.avail_in?1:0,Y(t,0,0,r),t.pending_buf[t.pending-4]=a,t.pending_buf[t.pending-3]=a>>8,t.pending_buf[t.pending-2]=~a,t.pending_buf[t.pending-1]=~a>>8,xt(t.strm),i&&(i>a&&(i=a),t.strm.output.set(t.window.subarray(t.block_start,t.block_start+i),t.strm.next_out),t.strm.next_out+=i,t.strm.avail_out-=i,t.strm.total_out+=i,t.block_start+=i,a-=i),a&&(Rt(t.strm,t.strm.output,t.strm.next_out,a),t.strm.next_out+=a,t.strm.avail_out-=a,t.strm.total_out+=a);}while(0===r);return o-=t.strm.avail_in,o&&(o>=t.w_size?(t.matches=2,t.window.set(t.strm.input.subarray(t.strm.next_in-t.w_size,t.strm.next_in),0),t.strstart=t.w_size,t.insert=t.strstart):(t.window_size-t.strstart<=o&&(t.strstart-=t.w_size,t.window.set(t.window.subarray(t.w_size,t.w_size+t.strstart),0),t.matches<2&&t.matches++,t.insert>t.strstart&&(t.insert=t.strstart)),t.window.set(t.strm.input.subarray(t.strm.next_in-o,t.strm.next_in),t.strstart),t.strstart+=o,t.insert+=o>t.w_size-t.insert?t.w_size-t.insert:o),t.block_start=t.strstart),t.high_water<t.strstart&&(t.high_water=t.strstart),r?4:e!==q&&e!==V&&0===t.strm.avail_in&&t.strstart===t.block_start?2:(n=t.window_size-t.strstart,t.strm.avail_in>n&&t.block_start>=t.w_size&&(t.block_start-=t.w_size,t.strstart-=t.w_size,t.window.set(t.window.subarray(t.w_size,t.w_size+t.strstart),0),t.matches<2&&t.matches++,n+=t.w_size,t.insert>t.strstart&&(t.insert=t.strstart)),n>t.strm.avail_in&&(n=t.strm.avail_in),n&&(Rt(t.strm,t.window,t.strstart,n),t.strstart+=n,t.insert+=n>t.w_size-t.insert?t.w_size-t.insert:n),t.high_water<t.strstart&&(t.high_water=t.strstart),n=t.bi_valid+42>>3,n=t.pending_buf_size-n>65535?65535:t.pending_buf_size-n,s=n>t.w_size?t.w_size:n,i=t.strstart-t.block_start,(i>=s||(i||e===V)&&e!==q&&0===t.strm.avail_in&&i<=n)&&(a=i>n?n:i,r=e===V&&0===t.strm.avail_in&&a===i?1:0,Y(t,t.block_start,a,r),t.block_start+=a,xt(t.strm)),r?3:1);},Dt=function Dt(t,e){var a,i;for(;;){if(t.lookahead<ut){if(Ut(t),t.lookahead<ut&&e===q)return 1;if(0===t.lookahead)break;}if(a=0,t.lookahead>=3&&(t.ins_h=yt(t,t.ins_h,t.window[t.strstart+3-1]),a=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),0!==a&&t.strstart-a<=t.w_size-ut&&(t.match_length=Zt(t,a)),t.match_length>=3){if(i=X(t,t.strstart-t.match_start,t.match_length-3),t.lookahead-=t.match_length,t.match_length<=t.max_lazy_match&&t.lookahead>=3){t.match_length--;do{t.strstart++,t.ins_h=yt(t,t.ins_h,t.window[t.strstart+3-1]),a=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart;}while(0!=--t.match_length);t.strstart++;}else t.strstart+=t.match_length,t.match_length=0,t.ins_h=t.window[t.strstart],t.ins_h=yt(t,t.ins_h,t.window[t.strstart+1]);}else i=X(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++;if(i&&(zt(t,!1),0===t.strm.avail_out))return 1;}return t.insert=t.strstart<2?t.strstart:2,e===V?(zt(t,!0),0===t.strm.avail_out?3:4):t.sym_next&&(zt(t,!1),0===t.strm.avail_out)?1:2;},Tt=function Tt(t,e){var a,i,n;for(;;){if(t.lookahead<ut){if(Ut(t),t.lookahead<ut&&e===q)return 1;if(0===t.lookahead)break;}if(a=0,t.lookahead>=3&&(t.ins_h=yt(t,t.ins_h,t.window[t.strstart+3-1]),a=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),t.prev_length=t.match_length,t.prev_match=t.match_start,t.match_length=2,0!==a&&t.prev_length<t.max_lazy_match&&t.strstart-a<=t.w_size-ut&&(t.match_length=Zt(t,a),t.match_length<=5&&(t.strategy===rt||3===t.match_length&&t.strstart-t.match_start>4096)&&(t.match_length=2)),t.prev_length>=3&&t.match_length<=t.prev_length){n=t.strstart+t.lookahead-3,i=X(t,t.strstart-1-t.prev_match,t.prev_length-3),t.lookahead-=t.prev_length-1,t.prev_length-=2;do{++t.strstart<=n&&(t.ins_h=yt(t,t.ins_h,t.window[t.strstart+3-1]),a=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart);}while(0!=--t.prev_length);if(t.match_available=0,t.match_length=2,t.strstart++,i&&(zt(t,!1),0===t.strm.avail_out))return 1;}else if(t.match_available){if(i=X(t,0,t.window[t.strstart-1]),i&&zt(t,!1),t.strstart++,t.lookahead--,0===t.strm.avail_out)return 1;}else t.match_available=1,t.strstart++,t.lookahead--;}return t.match_available&&(i=X(t,0,t.window[t.strstart-1]),t.match_available=0),t.insert=t.strstart<2?t.strstart:2,e===V?(zt(t,!0),0===t.strm.avail_out?3:4):t.sym_next&&(zt(t,!1),0===t.strm.avail_out)?1:2;};function Ot(t,e,a,i,n){this.good_length=t,this.max_lazy=e,this.nice_length=a,this.max_chain=i,this.func=n;}var It=[new Ot(0,0,0,0,St),new Ot(4,4,8,4,Dt),new Ot(4,5,16,8,Dt),new Ot(4,6,32,32,Dt),new Ot(4,4,16,16,Tt),new Ot(8,16,32,32,Tt),new Ot(8,16,128,128,Tt),new Ot(8,32,128,256,Tt),new Ot(32,128,258,1024,Tt),new Ot(32,258,258,4096,Tt)];function Ft(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=ft,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new Uint16Array(1146),this.dyn_dtree=new Uint16Array(122),this.bl_tree=new Uint16Array(78),kt(this.dyn_ltree),kt(this.dyn_dtree),kt(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array(16),this.heap=new Uint16Array(573),kt(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(573),kt(this.depth),this.sym_buf=0,this.lit_bufsize=0,this.sym_next=0,this.sym_end=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0;}var Lt=function Lt(t){if(!t)return 1;var e=t.state;return!e||e.strm!==t||e.status!==wt&&57!==e.status&&69!==e.status&&73!==e.status&&91!==e.status&&103!==e.status&&e.status!==mt&&e.status!==bt?1:0;},Nt=function Nt(t){if(Lt(t))return gt(t,at);t.total_in=t.total_out=0,t.data_type=_t;var e=t.state;return e.pending=0,e.pending_out=0,e.wrap<0&&(e.wrap=-e.wrap),e.status=2===e.wrap?57:e.wrap?wt:mt,t.adler=2===e.wrap?0:1,e.last_flush=-2,P(e),tt;},Bt=function Bt(t){var e=Nt(t);var a;return e===tt&&((a=t.state).window_size=2*a.w_size,kt(a.head),a.max_lazy_match=It[a.level].max_lazy,a.good_match=It[a.level].good_length,a.nice_match=It[a.level].nice_length,a.max_chain_length=It[a.level].max_chain,a.strstart=0,a.block_start=0,a.lookahead=0,a.insert=0,a.match_length=a.prev_length=2,a.match_available=0,a.ins_h=0),e;},Ct=function Ct(t,e,a,i,n,s){if(!t)return at;var r=1;if(e===st&&(e=6),i<0?(r=0,i=-i):i>15&&(r=2,i-=16),n<1||n>9||a!==ft||i<8||i>15||e<0||e>9||s<0||s>ht||8===i&&1!==r)return gt(t,at);8===i&&(i=9);var o=new Ft();return t.state=o,o.strm=t,o.status=wt,o.wrap=r,o.gzhead=null,o.w_bits=i,o.w_size=1<<o.w_bits,o.w_mask=o.w_size-1,o.hash_bits=n+7,o.hash_size=1<<o.hash_bits,o.hash_mask=o.hash_size-1,o.hash_shift=~~((o.hash_bits+3-1)/3),o.window=new Uint8Array(2*o.w_size),o.head=new Uint16Array(o.hash_size),o.prev=new Uint16Array(o.w_size),o.lit_bufsize=1<<n+6,o.pending_buf_size=4*o.lit_bufsize,o.pending_buf=new Uint8Array(o.pending_buf_size),o.sym_buf=o.lit_bufsize,o.sym_end=3*(o.lit_bufsize-1),o.level=e,o.strategy=s,o.method=a,Bt(t);};var Mt={deflateInit:function deflateInit(t,e){return Ct(t,e,ft,15,8,dt);},deflateInit2:Ct,deflateReset:Bt,deflateResetKeep:Nt,deflateSetHeader:function deflateSetHeader(t,e){return Lt(t)||2!==t.state.wrap?at:(t.state.gzhead=e,tt);},deflate:function deflate(t,e){if(Lt(t)||e>$||e<0)return t?gt(t,at):at;var a=t.state;if(!t.output||0!==t.avail_in&&!t.input||a.status===bt&&e!==V)return gt(t,0===t.avail_out?nt:at);var i=a.last_flush;if(a.last_flush=e,0!==a.pending){if(xt(t),0===t.avail_out)return a.last_flush=-1,tt;}else if(0===t.avail_in&&pt(e)<=pt(i)&&e!==V)return gt(t,nt);if(a.status===bt&&0!==t.avail_in)return gt(t,nt);if(a.status===wt&&0===a.wrap&&(a.status=mt),a.status===wt){var _e4=ft+(a.w_bits-8<<4)<<8,_i349=-1;if(_i349=a.strategy>=ot||a.level<2?0:a.level<6?1:6===a.level?2:3,_e4|=_i349<<6,0!==a.strstart&&(_e4|=32),_e4+=31-_e4%31,Et(a,_e4),0!==a.strstart&&(Et(a,t.adler>>>16),Et(a,65535&t.adler)),t.adler=1,a.status=mt,xt(t),0!==a.pending)return a.last_flush=-1,tt;}if(57===a.status)if(t.adler=0,At(a,31),At(a,139),At(a,8),a.gzhead)At(a,(a.gzhead.text?1:0)+(a.gzhead.hcrc?2:0)+(a.gzhead.extra?4:0)+(a.gzhead.name?8:0)+(a.gzhead.comment?16:0)),At(a,255&a.gzhead.time),At(a,a.gzhead.time>>8&255),At(a,a.gzhead.time>>16&255),At(a,a.gzhead.time>>24&255),At(a,9===a.level?2:a.strategy>=ot||a.level<2?4:0),At(a,255&a.gzhead.os),a.gzhead.extra&&a.gzhead.extra.length&&(At(a,255&a.gzhead.extra.length),At(a,a.gzhead.extra.length>>8&255)),a.gzhead.hcrc&&(t.adler=H(t.adler,a.pending_buf,a.pending,0)),a.gzindex=0,a.status=69;else if(At(a,0),At(a,0),At(a,0),At(a,0),At(a,0),At(a,9===a.level?2:a.strategy>=ot||a.level<2?4:0),At(a,3),a.status=mt,xt(t),0!==a.pending)return a.last_flush=-1,tt;if(69===a.status){if(a.gzhead.extra){var _e5=a.pending,_i350=(65535&a.gzhead.extra.length)-a.gzindex;for(;a.pending+_i350>a.pending_buf_size;){var _n3=a.pending_buf_size-a.pending;if(a.pending_buf.set(a.gzhead.extra.subarray(a.gzindex,a.gzindex+_n3),a.pending),a.pending=a.pending_buf_size,a.gzhead.hcrc&&a.pending>_e5&&(t.adler=H(t.adler,a.pending_buf,a.pending-_e5,_e5)),a.gzindex+=_n3,xt(t),0!==a.pending)return a.last_flush=-1,tt;_e5=0,_i350-=_n3;}var _n2=new Uint8Array(a.gzhead.extra);a.pending_buf.set(_n2.subarray(a.gzindex,a.gzindex+_i350),a.pending),a.pending+=_i350,a.gzhead.hcrc&&a.pending>_e5&&(t.adler=H(t.adler,a.pending_buf,a.pending-_e5,_e5)),a.gzindex=0;}a.status=73;}if(73===a.status){if(a.gzhead.name){var _e6,_i351=a.pending;do{if(a.pending===a.pending_buf_size){if(a.gzhead.hcrc&&a.pending>_i351&&(t.adler=H(t.adler,a.pending_buf,a.pending-_i351,_i351)),xt(t),0!==a.pending)return a.last_flush=-1,tt;_i351=0;}_e6=a.gzindex<a.gzhead.name.length?255&a.gzhead.name.charCodeAt(a.gzindex++):0,At(a,_e6);}while(0!==_e6);a.gzhead.hcrc&&a.pending>_i351&&(t.adler=H(t.adler,a.pending_buf,a.pending-_i351,_i351)),a.gzindex=0;}a.status=91;}if(91===a.status){if(a.gzhead.comment){var _e7,_i352=a.pending;do{if(a.pending===a.pending_buf_size){if(a.gzhead.hcrc&&a.pending>_i352&&(t.adler=H(t.adler,a.pending_buf,a.pending-_i352,_i352)),xt(t),0!==a.pending)return a.last_flush=-1,tt;_i352=0;}_e7=a.gzindex<a.gzhead.comment.length?255&a.gzhead.comment.charCodeAt(a.gzindex++):0,At(a,_e7);}while(0!==_e7);a.gzhead.hcrc&&a.pending>_i352&&(t.adler=H(t.adler,a.pending_buf,a.pending-_i352,_i352));}a.status=103;}if(103===a.status){if(a.gzhead.hcrc){if(a.pending+2>a.pending_buf_size&&(xt(t),0!==a.pending))return a.last_flush=-1,tt;At(a,255&t.adler),At(a,t.adler>>8&255),t.adler=0;}if(a.status=mt,xt(t),0!==a.pending)return a.last_flush=-1,tt;}if(0!==t.avail_in||0!==a.lookahead||e!==q&&a.status!==bt){var _i353=0===a.level?St(a,e):a.strategy===ot?function(t,e){var a;for(;;){if(0===t.lookahead&&(Ut(t),0===t.lookahead)){if(e===q)return 1;break;}if(t.match_length=0,a=X(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++,a&&(zt(t,!1),0===t.strm.avail_out))return 1;}return t.insert=0,e===V?(zt(t,!0),0===t.strm.avail_out?3:4):t.sym_next&&(zt(t,!1),0===t.strm.avail_out)?1:2;}(a,e):a.strategy===lt?function(t,e){var a,i,n,s;var r=t.window;for(;;){if(t.lookahead<=ct){if(Ut(t),t.lookahead<=ct&&e===q)return 1;if(0===t.lookahead)break;}if(t.match_length=0,t.lookahead>=3&&t.strstart>0&&(n=t.strstart-1,i=r[n],i===r[++n]&&i===r[++n]&&i===r[++n])){s=t.strstart+ct;do{}while(i===r[++n]&&i===r[++n]&&i===r[++n]&&i===r[++n]&&i===r[++n]&&i===r[++n]&&i===r[++n]&&i===r[++n]&&n<s);t.match_length=ct-(s-n),t.match_length>t.lookahead&&(t.match_length=t.lookahead);}if(t.match_length>=3?(a=X(t,1,t.match_length-3),t.lookahead-=t.match_length,t.strstart+=t.match_length,t.match_length=0):(a=X(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++),a&&(zt(t,!1),0===t.strm.avail_out))return 1;}return t.insert=0,e===V?(zt(t,!0),0===t.strm.avail_out?3:4):t.sym_next&&(zt(t,!1),0===t.strm.avail_out)?1:2;}(a,e):It[a.level].func(a,e);if(3!==_i353&&4!==_i353||(a.status=bt),1===_i353||3===_i353)return 0===t.avail_out&&(a.last_flush=-1),tt;if(2===_i353&&(e===J?W(a):e!==$&&(Y(a,0,0,!1),e===Q&&(kt(a.head),0===a.lookahead&&(a.strstart=0,a.block_start=0,a.insert=0))),xt(t),0===t.avail_out))return a.last_flush=-1,tt;}return e!==V?tt:a.wrap<=0?et:(2===a.wrap?(At(a,255&t.adler),At(a,t.adler>>8&255),At(a,t.adler>>16&255),At(a,t.adler>>24&255),At(a,255&t.total_in),At(a,t.total_in>>8&255),At(a,t.total_in>>16&255),At(a,t.total_in>>24&255)):(Et(a,t.adler>>>16),Et(a,65535&t.adler)),xt(t),a.wrap>0&&(a.wrap=-a.wrap),0!==a.pending?tt:et);},deflateEnd:function deflateEnd(t){if(Lt(t))return at;var e=t.state.status;return t.state=null,e===mt?gt(t,it):tt;},deflateSetDictionary:function deflateSetDictionary(t,e){var a=e.length;if(Lt(t))return at;var i=t.state,n=i.wrap;if(2===n||1===n&&i.status!==wt||i.lookahead)return at;if(1===n&&(t.adler=C(t.adler,e,a,0)),i.wrap=0,a>=i.w_size){0===n&&(kt(i.head),i.strstart=0,i.block_start=0,i.insert=0);var _t2=new Uint8Array(i.w_size);_t2.set(e.subarray(a-i.w_size,a),0),e=_t2,a=i.w_size;}var s=t.avail_in,r=t.next_in,o=t.input;for(t.avail_in=a,t.next_in=0,t.input=e,Ut(i);i.lookahead>=3;){var _t3=i.strstart,_e8=i.lookahead-2;do{i.ins_h=yt(i,i.ins_h,i.window[_t3+3-1]),i.prev[_t3&i.w_mask]=i.head[i.ins_h],i.head[i.ins_h]=_t3,_t3++;}while(--_e8);i.strstart=_t3,i.lookahead=2,Ut(i);}return i.strstart+=i.lookahead,i.block_start=i.strstart,i.insert=i.lookahead,i.lookahead=0,i.match_length=i.prev_length=2,i.match_available=0,t.next_in=r,t.input=o,t.avail_in=s,i.wrap=n,tt;},deflateInfo:"pako deflate (from Nodeca project)"};var Ht=function Ht(t,e){return Object.prototype.hasOwnProperty.call(t,e);};var jt=function jt(t){var e=Array.prototype.slice.call(arguments,1);for(;e.length;){var _a10=e.shift();if(_a10){if("object"!=_typeof(_a10))throw new TypeError(_a10+"must be non-object");for(var _e9 in _a10){Ht(_a10,_e9)&&(t[_e9]=_a10[_e9]);}}}return t;},Kt=function Kt(t){var e=0;for(var _a11=0,_i354=t.length;_a11<_i354;_a11++){e+=t[_a11].length;}var a=new Uint8Array(e);for(var _e10=0,_i355=0,_n4=t.length;_e10<_n4;_e10++){var _n5=t[_e10];a.set(_n5,_i355),_i355+=_n5.length;}return a;};var Pt=!0;try{String.fromCharCode.apply(null,new Uint8Array(1));}catch(t){Pt=!1;}var Yt=new Uint8Array(256);for(var _t4=0;_t4<256;_t4++){Yt[_t4]=_t4>=252?6:_t4>=248?5:_t4>=240?4:_t4>=224?3:_t4>=192?2:1;}Yt[254]=Yt[254]=1;var Gt=function Gt(t){if("function"==typeof TextEncoder&&TextEncoder.prototype.encode)return new TextEncoder().encode(t);var e,a,i,n,s,r=t.length,o=0;for(n=0;n<r;n++){a=t.charCodeAt(n),55296==(64512&a)&&n+1<r&&(i=t.charCodeAt(n+1),56320==(64512&i)&&(a=65536+(a-55296<<10)+(i-56320),n++)),o+=a<128?1:a<2048?2:a<65536?3:4;}for(e=new Uint8Array(o),s=0,n=0;s<o;n++){a=t.charCodeAt(n),55296==(64512&a)&&n+1<r&&(i=t.charCodeAt(n+1),56320==(64512&i)&&(a=65536+(a-55296<<10)+(i-56320),n++)),a<128?e[s++]=a:a<2048?(e[s++]=192|a>>>6,e[s++]=128|63&a):a<65536?(e[s++]=224|a>>>12,e[s++]=128|a>>>6&63,e[s++]=128|63&a):(e[s++]=240|a>>>18,e[s++]=128|a>>>12&63,e[s++]=128|a>>>6&63,e[s++]=128|63&a);}return e;},Xt=function Xt(t,e){var a=e||t.length;if("function"==typeof TextDecoder&&TextDecoder.prototype.decode)return new TextDecoder().decode(t.subarray(0,e));var i,n;var s=new Array(2*a);for(n=0,i=0;i<a;){var _e11=t[i++];if(_e11<128){s[n++]=_e11;continue;}var _r2=Yt[_e11];if(_r2>4)s[n++]=65533,i+=_r2-1;else{for(_e11&=2===_r2?31:3===_r2?15:7;_r2>1&&i<a;){_e11=_e11<<6|63&t[i++],_r2--;}_r2>1?s[n++]=65533:_e11<65536?s[n++]=_e11:(_e11-=65536,s[n++]=55296|_e11>>10&1023,s[n++]=56320|1023&_e11);}}return function(t,e){if(e<65534&&t.subarray&&Pt)return String.fromCharCode.apply(null,t.length===e?t:t.subarray(0,e));var a="";for(var _i356=0;_i356<e;_i356++){a+=String.fromCharCode(t[_i356]);}return a;}(s,n);},Wt=function Wt(t,e){(e=e||t.length)>t.length&&(e=t.length);var a=e-1;for(;a>=0&&128==(192&t[a]);){a--;}return a<0||0===a?e:a+Yt[t[a]]>e?a:e;};var qt=function qt(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0;};var Jt=Object.prototype.toString,Qt=K.Z_NO_FLUSH,Vt=K.Z_SYNC_FLUSH,$t=K.Z_FULL_FLUSH,te=K.Z_FINISH,ee=K.Z_OK,ae=K.Z_STREAM_END,ie=K.Z_DEFAULT_COMPRESSION,ne=K.Z_DEFAULT_STRATEGY,se=K.Z_DEFLATED;function re(t){this.options=jt({level:ie,method:se,chunkSize:16384,windowBits:15,memLevel:8,strategy:ne},t||{});var e=this.options;e.raw&&e.windowBits>0?e.windowBits=-e.windowBits:e.gzip&&e.windowBits>0&&e.windowBits<16&&(e.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new qt(),this.strm.avail_out=0;var a=Mt.deflateInit2(this.strm,e.level,e.method,e.windowBits,e.memLevel,e.strategy);if(a!==ee)throw new Error(j[a]);if(e.header&&Mt.deflateSetHeader(this.strm,e.header),e.dictionary){var _t5;if(_t5="string"==typeof e.dictionary?Gt(e.dictionary):"[object ArrayBuffer]"===Jt.call(e.dictionary)?new Uint8Array(e.dictionary):e.dictionary,a=Mt.deflateSetDictionary(this.strm,_t5),a!==ee)throw new Error(j[a]);this._dict_set=!0;}}function oe(t,e){var a=new re(e);if(a.push(t,!0),a.err)throw a.msg||j[a.err];return a.result;}re.prototype.push=function(t,e){var a=this.strm,i=this.options.chunkSize;var n,s;if(this.ended)return!1;for(s=e===~~e?e:!0===e?te:Qt,"string"==typeof t?a.input=Gt(t):"[object ArrayBuffer]"===Jt.call(t)?a.input=new Uint8Array(t):a.input=t,a.next_in=0,a.avail_in=a.input.length;;){if(0===a.avail_out&&(a.output=new Uint8Array(i),a.next_out=0,a.avail_out=i),(s===Vt||s===$t)&&a.avail_out<=6)this.onData(a.output.subarray(0,a.next_out)),a.avail_out=0;else{if(n=Mt.deflate(a,s),n===ae)return a.next_out>0&&this.onData(a.output.subarray(0,a.next_out)),n=Mt.deflateEnd(this.strm),this.onEnd(n),this.ended=!0,n===ee;if(0!==a.avail_out){if(s>0&&a.next_out>0)this.onData(a.output.subarray(0,a.next_out)),a.avail_out=0;else if(0===a.avail_in)break;}else this.onData(a.output);}}return!0;},re.prototype.onData=function(t){this.chunks.push(t);},re.prototype.onEnd=function(t){t===ee&&(this.result=Kt(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg;};var le={Deflate:re,deflate:oe,deflateRaw:function deflateRaw(t,e){return(e=e||{}).raw=!0,oe(t,e);},gzip:function gzip(t,e){return(e=e||{}).gzip=!0,oe(t,e);},constants:K};var he=16209;var de=function de(t,e){var a,i,n,s,r,o,l,h,d,_,f,c,u,w,m,b,g,p,k,v,y,x,z,A;var E=t.state;a=t.next_in,z=t.input,i=a+(t.avail_in-5),n=t.next_out,A=t.output,s=n-(e-t.avail_out),r=n+(t.avail_out-257),o=E.dmax,l=E.wsize,h=E.whave,d=E.wnext,_=E.window,f=E.hold,c=E.bits,u=E.lencode,w=E.distcode,m=(1<<E.lenbits)-1,b=(1<<E.distbits)-1;t:do{c<15&&(f+=z[a++]<<c,c+=8,f+=z[a++]<<c,c+=8),g=u[f&m];e:for(;;){if(p=g>>>24,f>>>=p,c-=p,p=g>>>16&255,0===p)A[n++]=65535&g;else{if(!(16&p)){if(0==(64&p)){g=u[(65535&g)+(f&(1<<p)-1)];continue e;}if(32&p){E.mode=16191;break t;}t.msg="invalid literal/length code",E.mode=he;break t;}k=65535&g,p&=15,p&&(c<p&&(f+=z[a++]<<c,c+=8),k+=f&(1<<p)-1,f>>>=p,c-=p),c<15&&(f+=z[a++]<<c,c+=8,f+=z[a++]<<c,c+=8),g=w[f&b];a:for(;;){if(p=g>>>24,f>>>=p,c-=p,p=g>>>16&255,!(16&p)){if(0==(64&p)){g=w[(65535&g)+(f&(1<<p)-1)];continue a;}t.msg="invalid distance code",E.mode=he;break t;}if(v=65535&g,p&=15,c<p&&(f+=z[a++]<<c,c+=8,c<p&&(f+=z[a++]<<c,c+=8)),v+=f&(1<<p)-1,v>o){t.msg="invalid distance too far back",E.mode=he;break t;}if(f>>>=p,c-=p,p=n-s,v>p){if(p=v-p,p>h&&E.sane){t.msg="invalid distance too far back",E.mode=he;break t;}if(y=0,x=_,0===d){if(y+=l-p,p<k){k-=p;do{A[n++]=_[y++];}while(--p);y=n-v,x=A;}}else if(d<p){if(y+=l+d-p,p-=d,p<k){k-=p;do{A[n++]=_[y++];}while(--p);if(y=0,d<k){p=d,k-=p;do{A[n++]=_[y++];}while(--p);y=n-v,x=A;}}}else if(y+=d-p,p<k){k-=p;do{A[n++]=_[y++];}while(--p);y=n-v,x=A;}for(;k>2;){A[n++]=x[y++],A[n++]=x[y++],A[n++]=x[y++],k-=3;}k&&(A[n++]=x[y++],k>1&&(A[n++]=x[y++]));}else{y=n-v;do{A[n++]=A[y++],A[n++]=A[y++],A[n++]=A[y++],k-=3;}while(k>2);k&&(A[n++]=A[y++],k>1&&(A[n++]=A[y++]));}break;}}break;}}while(a<i&&n<r);k=c>>3,a-=k,c-=k<<3,f&=(1<<c)-1,t.next_in=a,t.next_out=n,t.avail_in=a<i?i-a+5:5-(a-i),t.avail_out=n<r?r-n+257:257-(n-r),E.hold=f,E.bits=c;};var _e=15,fe=new Uint16Array([3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0]),ce=new Uint8Array([16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78]),ue=new Uint16Array([1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0]),we=new Uint8Array([16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64]);var me=function me(t,e,a,i,n,s,r,o){var l=o.bits;var h,d,_,f,c,u,w=0,m=0,b=0,g=0,p=0,k=0,v=0,y=0,x=0,z=0,A=null;var E=new Uint16Array(16),R=new Uint16Array(16);var Z,U,S,D=null;for(w=0;w<=_e;w++){E[w]=0;}for(m=0;m<i;m++){E[e[a+m]]++;}for(p=l,g=_e;g>=1&&0===E[g];g--){;}if(p>g&&(p=g),0===g)return n[s++]=20971520,n[s++]=20971520,o.bits=1,0;for(b=1;b<g&&0===E[b];b++){;}for(p<b&&(p=b),y=1,w=1;w<=_e;w++){if(y<<=1,y-=E[w],y<0)return-1;}if(y>0&&(0===t||1!==g))return-1;for(R[1]=0,w=1;w<_e;w++){R[w+1]=R[w]+E[w];}for(m=0;m<i;m++){0!==e[a+m]&&(r[R[e[a+m]]++]=m);}if(0===t?(A=D=r,u=20):1===t?(A=fe,D=ce,u=257):(A=ue,D=we,u=0),z=0,m=0,w=b,c=s,k=p,v=0,_=-1,x=1<<p,f=x-1,1===t&&x>852||2===t&&x>592)return 1;for(;;){Z=w-v,r[m]+1<u?(U=0,S=r[m]):r[m]>=u?(U=D[r[m]-u],S=A[r[m]-u]):(U=96,S=0),h=1<<w-v,d=1<<k,b=d;do{d-=h,n[c+(z>>v)+d]=Z<<24|U<<16|S|0;}while(0!==d);for(h=1<<w-1;z&h;){h>>=1;}if(0!==h?(z&=h-1,z+=h):z=0,m++,0==--E[w]){if(w===g)break;w=e[a+r[m]];}if(w>p&&(z&f)!==_){for(0===v&&(v=p),c+=b,k=w-v,y=1<<k;k+v<g&&(y-=E[k+v],!(y<=0));){k++,y<<=1;}if(x+=1<<k,1===t&&x>852||2===t&&x>592)return 1;_=z&f,n[_]=p<<24|k<<16|c-s|0;}}return 0!==z&&(n[c+z]=w-v<<24|64<<16|0),o.bits=p,0;};var be=K.Z_FINISH,ge=K.Z_BLOCK,pe=K.Z_TREES,ke=K.Z_OK,ve=K.Z_STREAM_END,ye=K.Z_NEED_DICT,xe=K.Z_STREAM_ERROR,ze=K.Z_DATA_ERROR,Ae=K.Z_MEM_ERROR,Ee=K.Z_BUF_ERROR,Re=K.Z_DEFLATED,Ze=16180,Ue=16190,Se=16191,De=16192,Te=16194,Oe=16199,Ie=16200,Fe=16206,Le=16209,Ne=function Ne(t){return(t>>>24&255)+(t>>>8&65280)+((65280&t)<<8)+((255&t)<<24);};function Be(){this.strm=null,this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new Uint16Array(320),this.work=new Uint16Array(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0;}var Ce=function Ce(t){if(!t)return 1;var e=t.state;return!e||e.strm!==t||e.mode<Ze||e.mode>16211?1:0;},Me=function Me(t){if(Ce(t))return xe;var e=t.state;return t.total_in=t.total_out=e.total=0,t.msg="",e.wrap&&(t.adler=1&e.wrap),e.mode=Ze,e.last=0,e.havedict=0,e.flags=-1,e.dmax=32768,e.head=null,e.hold=0,e.bits=0,e.lencode=e.lendyn=new Int32Array(852),e.distcode=e.distdyn=new Int32Array(592),e.sane=1,e.back=-1,ke;},He=function He(t){if(Ce(t))return xe;var e=t.state;return e.wsize=0,e.whave=0,e.wnext=0,Me(t);},je=function je(t,e){var a;if(Ce(t))return xe;var i=t.state;return e<0?(a=0,e=-e):(a=5+(e>>4),e<48&&(e&=15)),e&&(e<8||e>15)?xe:(null!==i.window&&i.wbits!==e&&(i.window=null),i.wrap=a,i.wbits=e,He(t));},Ke=function Ke(t,e){if(!t)return xe;var a=new Be();t.state=a,a.strm=t,a.window=null,a.mode=Ze;var i=je(t,e);return i!==ke&&(t.state=null),i;};var Pe,Ye,Ge=!0;var Xe=function Xe(t){if(Ge){Pe=new Int32Array(512),Ye=new Int32Array(32);var _e12=0;for(;_e12<144;){t.lens[_e12++]=8;}for(;_e12<256;){t.lens[_e12++]=9;}for(;_e12<280;){t.lens[_e12++]=7;}for(;_e12<288;){t.lens[_e12++]=8;}for(me(1,t.lens,0,288,Pe,0,t.work,{bits:9}),_e12=0;_e12<32;){t.lens[_e12++]=5;}me(2,t.lens,0,32,Ye,0,t.work,{bits:5}),Ge=!1;}t.lencode=Pe,t.lenbits=9,t.distcode=Ye,t.distbits=5;},We=function We(t,e,a,i){var n;var s=t.state;return null===s.window&&(s.wsize=1<<s.wbits,s.wnext=0,s.whave=0,s.window=new Uint8Array(s.wsize)),i>=s.wsize?(s.window.set(e.subarray(a-s.wsize,a),0),s.wnext=0,s.whave=s.wsize):(n=s.wsize-s.wnext,n>i&&(n=i),s.window.set(e.subarray(a-i,a-i+n),s.wnext),(i-=n)?(s.window.set(e.subarray(a-i,a),0),s.wnext=i,s.whave=s.wsize):(s.wnext+=n,s.wnext===s.wsize&&(s.wnext=0),s.whave<s.wsize&&(s.whave+=n))),0;};var qe={inflateReset:He,inflateReset2:je,inflateResetKeep:Me,inflateInit:function inflateInit(t){return Ke(t,15);},inflateInit2:Ke,inflate:function inflate(t,e){var a,i,n,s,r,o,l,h,d,_,f,c,u,w,m,b,g,p,k,v,y,x,z=0;var A=new Uint8Array(4);var E,R;var Z=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(Ce(t)||!t.output||!t.input&&0!==t.avail_in)return xe;a=t.state,a.mode===Se&&(a.mode=De),r=t.next_out,n=t.output,l=t.avail_out,s=t.next_in,i=t.input,o=t.avail_in,h=a.hold,d=a.bits,_=o,f=l,x=ke;t:for(;;){switch(a.mode){case Ze:if(0===a.wrap){a.mode=De;break;}for(;d<16;){if(0===o)break t;o--,h+=i[s++]<<d,d+=8;}if(2&a.wrap&&35615===h){0===a.wbits&&(a.wbits=15),a.check=0,A[0]=255&h,A[1]=h>>>8&255,a.check=H(a.check,A,2,0),h=0,d=0,a.mode=16181;break;}if(a.head&&(a.head.done=!1),!(1&a.wrap)||(((255&h)<<8)+(h>>8))%31){t.msg="incorrect header check",a.mode=Le;break;}if((15&h)!==Re){t.msg="unknown compression method",a.mode=Le;break;}if(h>>>=4,d-=4,y=8+(15&h),0===a.wbits&&(a.wbits=y),y>15||y>a.wbits){t.msg="invalid window size",a.mode=Le;break;}a.dmax=1<<a.wbits,a.flags=0,t.adler=a.check=1,a.mode=512&h?16189:Se,h=0,d=0;break;case 16181:for(;d<16;){if(0===o)break t;o--,h+=i[s++]<<d,d+=8;}if(a.flags=h,(255&a.flags)!==Re){t.msg="unknown compression method",a.mode=Le;break;}if(57344&a.flags){t.msg="unknown header flags set",a.mode=Le;break;}a.head&&(a.head.text=h>>8&1),512&a.flags&&4&a.wrap&&(A[0]=255&h,A[1]=h>>>8&255,a.check=H(a.check,A,2,0)),h=0,d=0,a.mode=16182;case 16182:for(;d<32;){if(0===o)break t;o--,h+=i[s++]<<d,d+=8;}a.head&&(a.head.time=h),512&a.flags&&4&a.wrap&&(A[0]=255&h,A[1]=h>>>8&255,A[2]=h>>>16&255,A[3]=h>>>24&255,a.check=H(a.check,A,4,0)),h=0,d=0,a.mode=16183;case 16183:for(;d<16;){if(0===o)break t;o--,h+=i[s++]<<d,d+=8;}a.head&&(a.head.xflags=255&h,a.head.os=h>>8),512&a.flags&&4&a.wrap&&(A[0]=255&h,A[1]=h>>>8&255,a.check=H(a.check,A,2,0)),h=0,d=0,a.mode=16184;case 16184:if(1024&a.flags){for(;d<16;){if(0===o)break t;o--,h+=i[s++]<<d,d+=8;}a.length=h,a.head&&(a.head.extra_len=h),512&a.flags&&4&a.wrap&&(A[0]=255&h,A[1]=h>>>8&255,a.check=H(a.check,A,2,0)),h=0,d=0;}else a.head&&(a.head.extra=null);a.mode=16185;case 16185:if(1024&a.flags&&(c=a.length,c>o&&(c=o),c&&(a.head&&(y=a.head.extra_len-a.length,a.head.extra||(a.head.extra=new Uint8Array(a.head.extra_len)),a.head.extra.set(i.subarray(s,s+c),y)),512&a.flags&&4&a.wrap&&(a.check=H(a.check,i,c,s)),o-=c,s+=c,a.length-=c),a.length))break t;a.length=0,a.mode=16186;case 16186:if(2048&a.flags){if(0===o)break t;c=0;do{y=i[s+c++],a.head&&y&&a.length<65536&&(a.head.name+=String.fromCharCode(y));}while(y&&c<o);if(512&a.flags&&4&a.wrap&&(a.check=H(a.check,i,c,s)),o-=c,s+=c,y)break t;}else a.head&&(a.head.name=null);a.length=0,a.mode=16187;case 16187:if(4096&a.flags){if(0===o)break t;c=0;do{y=i[s+c++],a.head&&y&&a.length<65536&&(a.head.comment+=String.fromCharCode(y));}while(y&&c<o);if(512&a.flags&&4&a.wrap&&(a.check=H(a.check,i,c,s)),o-=c,s+=c,y)break t;}else a.head&&(a.head.comment=null);a.mode=16188;case 16188:if(512&a.flags){for(;d<16;){if(0===o)break t;o--,h+=i[s++]<<d,d+=8;}if(4&a.wrap&&h!==(65535&a.check)){t.msg="header crc mismatch",a.mode=Le;break;}h=0,d=0;}a.head&&(a.head.hcrc=a.flags>>9&1,a.head.done=!0),t.adler=a.check=0,a.mode=Se;break;case 16189:for(;d<32;){if(0===o)break t;o--,h+=i[s++]<<d,d+=8;}t.adler=a.check=Ne(h),h=0,d=0,a.mode=Ue;case Ue:if(0===a.havedict)return t.next_out=r,t.avail_out=l,t.next_in=s,t.avail_in=o,a.hold=h,a.bits=d,ye;t.adler=a.check=1,a.mode=Se;case Se:if(e===ge||e===pe)break t;case De:if(a.last){h>>>=7&d,d-=7&d,a.mode=Fe;break;}for(;d<3;){if(0===o)break t;o--,h+=i[s++]<<d,d+=8;}switch(a.last=1&h,h>>>=1,d-=1,3&h){case 0:a.mode=16193;break;case 1:if(Xe(a),a.mode=Oe,e===pe){h>>>=2,d-=2;break t;}break;case 2:a.mode=16196;break;case 3:t.msg="invalid block type",a.mode=Le;}h>>>=2,d-=2;break;case 16193:for(h>>>=7&d,d-=7&d;d<32;){if(0===o)break t;o--,h+=i[s++]<<d,d+=8;}if((65535&h)!=(h>>>16^65535)){t.msg="invalid stored block lengths",a.mode=Le;break;}if(a.length=65535&h,h=0,d=0,a.mode=Te,e===pe)break t;case Te:a.mode=16195;case 16195:if(c=a.length,c){if(c>o&&(c=o),c>l&&(c=l),0===c)break t;n.set(i.subarray(s,s+c),r),o-=c,s+=c,l-=c,r+=c,a.length-=c;break;}a.mode=Se;break;case 16196:for(;d<14;){if(0===o)break t;o--,h+=i[s++]<<d,d+=8;}if(a.nlen=257+(31&h),h>>>=5,d-=5,a.ndist=1+(31&h),h>>>=5,d-=5,a.ncode=4+(15&h),h>>>=4,d-=4,a.nlen>286||a.ndist>30){t.msg="too many length or distance symbols",a.mode=Le;break;}a.have=0,a.mode=16197;case 16197:for(;a.have<a.ncode;){for(;d<3;){if(0===o)break t;o--,h+=i[s++]<<d,d+=8;}a.lens[Z[a.have++]]=7&h,h>>>=3,d-=3;}for(;a.have<19;){a.lens[Z[a.have++]]=0;}if(a.lencode=a.lendyn,a.lenbits=7,E={bits:a.lenbits},x=me(0,a.lens,0,19,a.lencode,0,a.work,E),a.lenbits=E.bits,x){t.msg="invalid code lengths set",a.mode=Le;break;}a.have=0,a.mode=16198;case 16198:for(;a.have<a.nlen+a.ndist;){for(;z=a.lencode[h&(1<<a.lenbits)-1],m=z>>>24,b=z>>>16&255,g=65535&z,!(m<=d);){if(0===o)break t;o--,h+=i[s++]<<d,d+=8;}if(g<16)h>>>=m,d-=m,a.lens[a.have++]=g;else{if(16===g){for(R=m+2;d<R;){if(0===o)break t;o--,h+=i[s++]<<d,d+=8;}if(h>>>=m,d-=m,0===a.have){t.msg="invalid bit length repeat",a.mode=Le;break;}y=a.lens[a.have-1],c=3+(3&h),h>>>=2,d-=2;}else if(17===g){for(R=m+3;d<R;){if(0===o)break t;o--,h+=i[s++]<<d,d+=8;}h>>>=m,d-=m,y=0,c=3+(7&h),h>>>=3,d-=3;}else{for(R=m+7;d<R;){if(0===o)break t;o--,h+=i[s++]<<d,d+=8;}h>>>=m,d-=m,y=0,c=11+(127&h),h>>>=7,d-=7;}if(a.have+c>a.nlen+a.ndist){t.msg="invalid bit length repeat",a.mode=Le;break;}for(;c--;){a.lens[a.have++]=y;}}}if(a.mode===Le)break;if(0===a.lens[256]){t.msg="invalid code -- missing end-of-block",a.mode=Le;break;}if(a.lenbits=9,E={bits:a.lenbits},x=me(1,a.lens,0,a.nlen,a.lencode,0,a.work,E),a.lenbits=E.bits,x){t.msg="invalid literal/lengths set",a.mode=Le;break;}if(a.distbits=6,a.distcode=a.distdyn,E={bits:a.distbits},x=me(2,a.lens,a.nlen,a.ndist,a.distcode,0,a.work,E),a.distbits=E.bits,x){t.msg="invalid distances set",a.mode=Le;break;}if(a.mode=Oe,e===pe)break t;case Oe:a.mode=Ie;case Ie:if(o>=6&&l>=258){t.next_out=r,t.avail_out=l,t.next_in=s,t.avail_in=o,a.hold=h,a.bits=d,de(t,f),r=t.next_out,n=t.output,l=t.avail_out,s=t.next_in,i=t.input,o=t.avail_in,h=a.hold,d=a.bits,a.mode===Se&&(a.back=-1);break;}for(a.back=0;z=a.lencode[h&(1<<a.lenbits)-1],m=z>>>24,b=z>>>16&255,g=65535&z,!(m<=d);){if(0===o)break t;o--,h+=i[s++]<<d,d+=8;}if(b&&0==(240&b)){for(p=m,k=b,v=g;z=a.lencode[v+((h&(1<<p+k)-1)>>p)],m=z>>>24,b=z>>>16&255,g=65535&z,!(p+m<=d);){if(0===o)break t;o--,h+=i[s++]<<d,d+=8;}h>>>=p,d-=p,a.back+=p;}if(h>>>=m,d-=m,a.back+=m,a.length=g,0===b){a.mode=16205;break;}if(32&b){a.back=-1,a.mode=Se;break;}if(64&b){t.msg="invalid literal/length code",a.mode=Le;break;}a.extra=15&b,a.mode=16201;case 16201:if(a.extra){for(R=a.extra;d<R;){if(0===o)break t;o--,h+=i[s++]<<d,d+=8;}a.length+=h&(1<<a.extra)-1,h>>>=a.extra,d-=a.extra,a.back+=a.extra;}a.was=a.length,a.mode=16202;case 16202:for(;z=a.distcode[h&(1<<a.distbits)-1],m=z>>>24,b=z>>>16&255,g=65535&z,!(m<=d);){if(0===o)break t;o--,h+=i[s++]<<d,d+=8;}if(0==(240&b)){for(p=m,k=b,v=g;z=a.distcode[v+((h&(1<<p+k)-1)>>p)],m=z>>>24,b=z>>>16&255,g=65535&z,!(p+m<=d);){if(0===o)break t;o--,h+=i[s++]<<d,d+=8;}h>>>=p,d-=p,a.back+=p;}if(h>>>=m,d-=m,a.back+=m,64&b){t.msg="invalid distance code",a.mode=Le;break;}a.offset=g,a.extra=15&b,a.mode=16203;case 16203:if(a.extra){for(R=a.extra;d<R;){if(0===o)break t;o--,h+=i[s++]<<d,d+=8;}a.offset+=h&(1<<a.extra)-1,h>>>=a.extra,d-=a.extra,a.back+=a.extra;}if(a.offset>a.dmax){t.msg="invalid distance too far back",a.mode=Le;break;}a.mode=16204;case 16204:if(0===l)break t;if(c=f-l,a.offset>c){if(c=a.offset-c,c>a.whave&&a.sane){t.msg="invalid distance too far back",a.mode=Le;break;}c>a.wnext?(c-=a.wnext,u=a.wsize-c):u=a.wnext-c,c>a.length&&(c=a.length),w=a.window;}else w=n,u=r-a.offset,c=a.length;c>l&&(c=l),l-=c,a.length-=c;do{n[r++]=w[u++];}while(--c);0===a.length&&(a.mode=Ie);break;case 16205:if(0===l)break t;n[r++]=a.length,l--,a.mode=Ie;break;case Fe:if(a.wrap){for(;d<32;){if(0===o)break t;o--,h|=i[s++]<<d,d+=8;}if(f-=l,t.total_out+=f,a.total+=f,4&a.wrap&&f&&(t.adler=a.check=a.flags?H(a.check,n,f,r-f):C(a.check,n,f,r-f)),f=l,4&a.wrap&&(a.flags?h:Ne(h))!==a.check){t.msg="incorrect data check",a.mode=Le;break;}h=0,d=0;}a.mode=16207;case 16207:if(a.wrap&&a.flags){for(;d<32;){if(0===o)break t;o--,h+=i[s++]<<d,d+=8;}if(4&a.wrap&&h!==(4294967295&a.total)){t.msg="incorrect length check",a.mode=Le;break;}h=0,d=0;}a.mode=16208;case 16208:x=ve;break t;case Le:x=ze;break t;case 16210:return Ae;default:return xe;}}return t.next_out=r,t.avail_out=l,t.next_in=s,t.avail_in=o,a.hold=h,a.bits=d,(a.wsize||f!==t.avail_out&&a.mode<Le&&(a.mode<Fe||e!==be))&&We(t,t.output,t.next_out,f-t.avail_out),_-=t.avail_in,f-=t.avail_out,t.total_in+=_,t.total_out+=f,a.total+=f,4&a.wrap&&f&&(t.adler=a.check=a.flags?H(a.check,n,f,t.next_out-f):C(a.check,n,f,t.next_out-f)),t.data_type=a.bits+(a.last?64:0)+(a.mode===Se?128:0)+(a.mode===Oe||a.mode===Te?256:0),(0===_&&0===f||e===be)&&x===ke&&(x=Ee),x;},inflateEnd:function inflateEnd(t){if(Ce(t))return xe;var e=t.state;return e.window&&(e.window=null),t.state=null,ke;},inflateGetHeader:function inflateGetHeader(t,e){if(Ce(t))return xe;var a=t.state;return 0==(2&a.wrap)?xe:(a.head=e,e.done=!1,ke);},inflateSetDictionary:function inflateSetDictionary(t,e){var a=e.length;var i,n,s;return Ce(t)?xe:(i=t.state,0!==i.wrap&&i.mode!==Ue?xe:i.mode===Ue&&(n=1,n=C(n,e,a,0),n!==i.check)?ze:(s=We(t,e,a,a),s?(i.mode=16210,Ae):(i.havedict=1,ke)));},inflateInfo:"pako inflate (from Nodeca project)"};var Je=function Je(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1;};var Qe=Object.prototype.toString,Ve=K.Z_NO_FLUSH,$e=K.Z_FINISH,ta=K.Z_OK,ea=K.Z_STREAM_END,aa=K.Z_NEED_DICT,ia=K.Z_STREAM_ERROR,na=K.Z_DATA_ERROR,sa=K.Z_MEM_ERROR;function ra(t){this.options=jt({chunkSize:65536,windowBits:15,to:""},t||{});var e=this.options;e.raw&&e.windowBits>=0&&e.windowBits<16&&(e.windowBits=-e.windowBits,0===e.windowBits&&(e.windowBits=-15)),!(e.windowBits>=0&&e.windowBits<16)||t&&t.windowBits||(e.windowBits+=32),e.windowBits>15&&e.windowBits<48&&0==(15&e.windowBits)&&(e.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new qt(),this.strm.avail_out=0;var a=qe.inflateInit2(this.strm,e.windowBits);if(a!==ta)throw new Error(j[a]);if(this.header=new Je(),qe.inflateGetHeader(this.strm,this.header),e.dictionary&&("string"==typeof e.dictionary?e.dictionary=Gt(e.dictionary):"[object ArrayBuffer]"===Qe.call(e.dictionary)&&(e.dictionary=new Uint8Array(e.dictionary)),e.raw&&(a=qe.inflateSetDictionary(this.strm,e.dictionary),a!==ta)))throw new Error(j[a]);}function oa(t,e){var a=new ra(e);if(a.push(t),a.err)throw a.msg||j[a.err];return a.result;}ra.prototype.push=function(t,e){var a=this.strm,i=this.options.chunkSize,n=this.options.dictionary;var s,r,o;if(this.ended)return!1;for(r=e===~~e?e:!0===e?$e:Ve,"[object ArrayBuffer]"===Qe.call(t)?a.input=new Uint8Array(t):a.input=t,a.next_in=0,a.avail_in=a.input.length;;){for(0===a.avail_out&&(a.output=new Uint8Array(i),a.next_out=0,a.avail_out=i),s=qe.inflate(a,r),s===aa&&n&&(s=qe.inflateSetDictionary(a,n),s===ta?s=qe.inflate(a,r):s===na&&(s=aa));a.avail_in>0&&s===ea&&a.state.wrap>0&&0!==t[a.next_in];){qe.inflateReset(a),s=qe.inflate(a,r);}switch(s){case ia:case na:case aa:case sa:return this.onEnd(s),this.ended=!0,!1;}if(o=a.avail_out,a.next_out&&(0===a.avail_out||s===ea))if("string"===this.options.to){var _t6=Wt(a.output,a.next_out),_e13=a.next_out-_t6,_n6=Xt(a.output,_t6);a.next_out=_e13,a.avail_out=i-_e13,_e13&&a.output.set(a.output.subarray(_t6,_t6+_e13),0),this.onData(_n6);}else this.onData(a.output.length===a.next_out?a.output:a.output.subarray(0,a.next_out));if(s!==ta||0!==o){if(s===ea)return s=qe.inflateEnd(this.strm),this.onEnd(s),this.ended=!0,!0;if(0===a.avail_in)break;}}return!0;},ra.prototype.onData=function(t){this.chunks.push(t);},ra.prototype.onEnd=function(t){t===ta&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=Kt(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg;};var la={Inflate:ra,inflate:oa,inflateRaw:function inflateRaw(t,e){return(e=e||{}).raw=!0,oa(t,e);},ungzip:oa,constants:K};var ha=le.Deflate,da=le.deflate,_a=le.deflateRaw,fa=le.gzip,ca=la.Inflate,ua=la.inflate,wa=la.inflateRaw,ma=la.ungzip;var ba=ha,ga=da,pa=_a,ka=fa,va=ca,ya=ua,xa=wa,za=ma,Aa=K,Ea={Deflate:ba,deflate:ga,deflateRaw:pa,gzip:ka,Inflate:va,inflate:ya,inflateRaw:xa,ungzip:za,constants:Aa};t.Deflate=ba,t.Inflate=va,t.constants=Aa,t["default"]=Ea,t.deflate=ga,t.deflateRaw=pa,t.gzip=ka,t.inflate=ya,t.inflateRaw=xa,t.ungzip=za,Object.defineProperty(t,"__esModule",{value:!0});});var p=/*#__PURE__*/Object.freeze({__proto__:null});/*
28855
+ var isBase64=!!dataUriRegexResult[2];var data=dataUriRegexResult[3];data=window.decodeURIComponent(data);if(isBase64){data=window.atob(data);}try{var buffer=new ArrayBuffer(data.length);var view=new Uint8Array(buffer);for(var i=0;i<data.length;i++){view[i]=data.charCodeAt(i);}ok(buffer);}catch(errMsg){error(errMsg);}}else{var request=new XMLHttpRequest();request.open('GET',this._cacheBusterURL(src),true);request.responseType='arraybuffer';request.onreadystatechange=function(){if(request.readyState===4){if(request.status===200){ok(request.response);}else{error('getXKT error : '+request.response);}}};request.send(null);}}}]);return XKTDefaultDataSource;}();/*! pako 2.1.0 https://github.com/nodeca/pako @license (MIT AND Zlib) */!function(t,e){"object"==(typeof exports==="undefined"?"undefined":_typeof(exports))&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).pako={});}(undefined,function(t){function e(t){var e=t.length;for(;--e>=0;){t[e]=0;}}var a=256,i=286,n=30,s=15,r=new Uint8Array([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0]),o=new Uint8Array([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13]),l=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),h=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),d=new Array(576);e(d);var _=new Array(60);e(_);var f=new Array(512);e(f);var c=new Array(256);e(c);var u=new Array(29);e(u);var w=new Array(n);function m(t,e,a,i,n){this.static_tree=t,this.extra_bits=e,this.extra_base=a,this.elems=i,this.max_length=n,this.has_stree=t&&t.length;}var b,g,p;function k(t,e){this.dyn_tree=t,this.max_code=0,this.stat_desc=e;}e(w);var v=function v(t){return t<256?f[t]:f[256+(t>>>7)];},y=function y(t,e){t.pending_buf[t.pending++]=255&e,t.pending_buf[t.pending++]=e>>>8&255;},x=function x(t,e,a){t.bi_valid>16-a?(t.bi_buf|=e<<t.bi_valid&65535,y(t,t.bi_buf),t.bi_buf=e>>16-t.bi_valid,t.bi_valid+=a-16):(t.bi_buf|=e<<t.bi_valid&65535,t.bi_valid+=a);},z=function z(t,e,a){x(t,a[2*e],a[2*e+1]);},A=function A(t,e){var a=0;do{a|=1&t,t>>>=1,a<<=1;}while(--e>0);return a>>>1;},E=function E(t,e,a){var i=new Array(16);var n,r,o=0;for(n=1;n<=s;n++){o=o+a[n-1]<<1,i[n]=o;}for(r=0;r<=e;r++){var _e3=t[2*r+1];0!==_e3&&(t[2*r]=A(i[_e3]++,_e3));}},R=function R(t){var e;for(e=0;e<i;e++){t.dyn_ltree[2*e]=0;}for(e=0;e<n;e++){t.dyn_dtree[2*e]=0;}for(e=0;e<19;e++){t.bl_tree[2*e]=0;}t.dyn_ltree[512]=1,t.opt_len=t.static_len=0,t.sym_next=t.matches=0;},Z=function Z(t){t.bi_valid>8?y(t,t.bi_buf):t.bi_valid>0&&(t.pending_buf[t.pending++]=t.bi_buf),t.bi_buf=0,t.bi_valid=0;},U=function U(t,e,a,i){var n=2*e,s=2*a;return t[n]<t[s]||t[n]===t[s]&&i[e]<=i[a];},S=function S(t,e,a){var i=t.heap[a];var n=a<<1;for(;n<=t.heap_len&&(n<t.heap_len&&U(e,t.heap[n+1],t.heap[n],t.depth)&&n++,!U(e,i,t.heap[n],t.depth));){t.heap[a]=t.heap[n],a=n,n<<=1;}t.heap[a]=i;},D=function D(t,e,i){var n,s,l,h,d=0;if(0!==t.sym_next)do{n=255&t.pending_buf[t.sym_buf+d++],n+=(255&t.pending_buf[t.sym_buf+d++])<<8,s=t.pending_buf[t.sym_buf+d++],0===n?z(t,s,e):(l=c[s],z(t,l+a+1,e),h=r[l],0!==h&&(s-=u[l],x(t,s,h)),n--,l=v(n),z(t,l,i),h=o[l],0!==h&&(n-=w[l],x(t,n,h)));}while(d<t.sym_next);z(t,256,e);},T=function T(t,e){var a=e.dyn_tree,i=e.stat_desc.static_tree,n=e.stat_desc.has_stree,r=e.stat_desc.elems;var o,l,h,d=-1;for(t.heap_len=0,t.heap_max=573,o=0;o<r;o++){0!==a[2*o]?(t.heap[++t.heap_len]=d=o,t.depth[o]=0):a[2*o+1]=0;}for(;t.heap_len<2;){h=t.heap[++t.heap_len]=d<2?++d:0,a[2*h]=1,t.depth[h]=0,t.opt_len--,n&&(t.static_len-=i[2*h+1]);}for(e.max_code=d,o=t.heap_len>>1;o>=1;o--){S(t,a,o);}h=r;do{o=t.heap[1],t.heap[1]=t.heap[t.heap_len--],S(t,a,1),l=t.heap[1],t.heap[--t.heap_max]=o,t.heap[--t.heap_max]=l,a[2*h]=a[2*o]+a[2*l],t.depth[h]=(t.depth[o]>=t.depth[l]?t.depth[o]:t.depth[l])+1,a[2*o+1]=a[2*l+1]=h,t.heap[1]=h++,S(t,a,1);}while(t.heap_len>=2);t.heap[--t.heap_max]=t.heap[1],function(t,e){var a=e.dyn_tree,i=e.max_code,n=e.stat_desc.static_tree,r=e.stat_desc.has_stree,o=e.stat_desc.extra_bits,l=e.stat_desc.extra_base,h=e.stat_desc.max_length;var d,_,f,c,u,w,m=0;for(c=0;c<=s;c++){t.bl_count[c]=0;}for(a[2*t.heap[t.heap_max]+1]=0,d=t.heap_max+1;d<573;d++){_=t.heap[d],c=a[2*a[2*_+1]+1]+1,c>h&&(c=h,m++),a[2*_+1]=c,_>i||(t.bl_count[c]++,u=0,_>=l&&(u=o[_-l]),w=a[2*_],t.opt_len+=w*(c+u),r&&(t.static_len+=w*(n[2*_+1]+u)));}if(0!==m){do{for(c=h-1;0===t.bl_count[c];){c--;}t.bl_count[c]--,t.bl_count[c+1]+=2,t.bl_count[h]--,m-=2;}while(m>0);for(c=h;0!==c;c--){for(_=t.bl_count[c];0!==_;){f=t.heap[--d],f>i||(a[2*f+1]!==c&&(t.opt_len+=(c-a[2*f+1])*a[2*f],a[2*f+1]=c),_--);}}}}(t,e),E(a,d,t.bl_count);},O=function O(t,e,a){var i,n,s=-1,r=e[1],o=0,l=7,h=4;for(0===r&&(l=138,h=3),e[2*(a+1)+1]=65535,i=0;i<=a;i++){n=r,r=e[2*(i+1)+1],++o<l&&n===r||(o<h?t.bl_tree[2*n]+=o:0!==n?(n!==s&&t.bl_tree[2*n]++,t.bl_tree[32]++):o<=10?t.bl_tree[34]++:t.bl_tree[36]++,o=0,s=n,0===r?(l=138,h=3):n===r?(l=6,h=3):(l=7,h=4));}},I=function I(t,e,a){var i,n,s=-1,r=e[1],o=0,l=7,h=4;for(0===r&&(l=138,h=3),i=0;i<=a;i++){if(n=r,r=e[2*(i+1)+1],!(++o<l&&n===r)){if(o<h)do{z(t,n,t.bl_tree);}while(0!=--o);else 0!==n?(n!==s&&(z(t,n,t.bl_tree),o--),z(t,16,t.bl_tree),x(t,o-3,2)):o<=10?(z(t,17,t.bl_tree),x(t,o-3,3)):(z(t,18,t.bl_tree),x(t,o-11,7));o=0,s=n,0===r?(l=138,h=3):n===r?(l=6,h=3):(l=7,h=4);}}};var F=!1;var L=function L(t,e,a,i){x(t,0+(i?1:0),3),Z(t),y(t,a),y(t,~a),a&&t.pending_buf.set(t.window.subarray(e,e+a),t.pending),t.pending+=a;};var N=function N(t,e,i,n){var s,r,o=0;t.level>0?(2===t.strm.data_type&&(t.strm.data_type=function(t){var e,i=4093624447;for(e=0;e<=31;e++,i>>>=1){if(1&i&&0!==t.dyn_ltree[2*e])return 0;}if(0!==t.dyn_ltree[18]||0!==t.dyn_ltree[20]||0!==t.dyn_ltree[26])return 1;for(e=32;e<a;e++){if(0!==t.dyn_ltree[2*e])return 1;}return 0;}(t)),T(t,t.l_desc),T(t,t.d_desc),o=function(t){var e;for(O(t,t.dyn_ltree,t.l_desc.max_code),O(t,t.dyn_dtree,t.d_desc.max_code),T(t,t.bl_desc),e=18;e>=3&&0===t.bl_tree[2*h[e]+1];e--){;}return t.opt_len+=3*(e+1)+5+5+4,e;}(t),s=t.opt_len+3+7>>>3,r=t.static_len+3+7>>>3,r<=s&&(s=r)):s=r=i+5,i+4<=s&&-1!==e?L(t,e,i,n):4===t.strategy||r===s?(x(t,2+(n?1:0),3),D(t,d,_)):(x(t,4+(n?1:0),3),function(t,e,a,i){var n;for(x(t,e-257,5),x(t,a-1,5),x(t,i-4,4),n=0;n<i;n++){x(t,t.bl_tree[2*h[n]+1],3);}I(t,t.dyn_ltree,e-1),I(t,t.dyn_dtree,a-1);}(t,t.l_desc.max_code+1,t.d_desc.max_code+1,o+1),D(t,t.dyn_ltree,t.dyn_dtree)),R(t),n&&Z(t);},B={_tr_init:function _tr_init(t){F||(function(){var t,e,a,h,k;var v=new Array(16);for(a=0,h=0;h<28;h++){for(u[h]=a,t=0;t<1<<r[h];t++){c[a++]=h;}}for(c[a-1]=h,k=0,h=0;h<16;h++){for(w[h]=k,t=0;t<1<<o[h];t++){f[k++]=h;}}for(k>>=7;h<n;h++){for(w[h]=k<<7,t=0;t<1<<o[h]-7;t++){f[256+k++]=h;}}for(e=0;e<=s;e++){v[e]=0;}for(t=0;t<=143;){d[2*t+1]=8,t++,v[8]++;}for(;t<=255;){d[2*t+1]=9,t++,v[9]++;}for(;t<=279;){d[2*t+1]=7,t++,v[7]++;}for(;t<=287;){d[2*t+1]=8,t++,v[8]++;}for(E(d,287,v),t=0;t<n;t++){_[2*t+1]=5,_[2*t]=A(t,5);}b=new m(d,r,257,i,s),g=new m(_,o,0,n,s),p=new m(new Array(0),l,0,19,7);}(),F=!0),t.l_desc=new k(t.dyn_ltree,b),t.d_desc=new k(t.dyn_dtree,g),t.bl_desc=new k(t.bl_tree,p),t.bi_buf=0,t.bi_valid=0,R(t);},_tr_stored_block:L,_tr_flush_block:N,_tr_tally:function _tr_tally(t,e,i){return t.pending_buf[t.sym_buf+t.sym_next++]=e,t.pending_buf[t.sym_buf+t.sym_next++]=e>>8,t.pending_buf[t.sym_buf+t.sym_next++]=i,0===e?t.dyn_ltree[2*i]++:(t.matches++,e--,t.dyn_ltree[2*(c[i]+a+1)]++,t.dyn_dtree[2*v(e)]++),t.sym_next===t.sym_end;},_tr_align:function _tr_align(t){x(t,2,3),z(t,256,d),function(t){16===t.bi_valid?(y(t,t.bi_buf),t.bi_buf=0,t.bi_valid=0):t.bi_valid>=8&&(t.pending_buf[t.pending++]=255&t.bi_buf,t.bi_buf>>=8,t.bi_valid-=8);}(t);}};var C=function C(t,e,a,i){var n=65535&t|0,s=t>>>16&65535|0,r=0;for(;0!==a;){r=a>2e3?2e3:a,a-=r;do{n=n+e[i++]|0,s=s+n|0;}while(--r);n%=65521,s%=65521;}return n|s<<16|0;};var M=new Uint32Array(function(){var t,e=[];for(var a=0;a<256;a++){t=a;for(var i=0;i<8;i++){t=1&t?3988292384^t>>>1:t>>>1;}e[a]=t;}return e;}());var H=function H(t,e,a,i){var n=M,s=i+a;t^=-1;for(var _a9=i;_a9<s;_a9++){t=t>>>8^n[255&(t^e[_a9])];}return-1^t;},j={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"},K={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8};var P=B._tr_init,Y=B._tr_stored_block,G=B._tr_flush_block,X=B._tr_tally,W=B._tr_align,q=K.Z_NO_FLUSH,J=K.Z_PARTIAL_FLUSH,Q=K.Z_FULL_FLUSH,V=K.Z_FINISH,$=K.Z_BLOCK,tt=K.Z_OK,et=K.Z_STREAM_END,at=K.Z_STREAM_ERROR,it=K.Z_DATA_ERROR,nt=K.Z_BUF_ERROR,st=K.Z_DEFAULT_COMPRESSION,rt=K.Z_FILTERED,ot=K.Z_HUFFMAN_ONLY,lt=K.Z_RLE,ht=K.Z_FIXED,dt=K.Z_DEFAULT_STRATEGY,_t=K.Z_UNKNOWN,ft=K.Z_DEFLATED,ct=258,ut=262,wt=42,mt=113,bt=666,gt=function gt(t,e){return t.msg=j[e],e;},pt=function pt(t){return 2*t-(t>4?9:0);},kt=function kt(t){var e=t.length;for(;--e>=0;){t[e]=0;}},vt=function vt(t){var e,a,i,n=t.w_size;e=t.hash_size,i=e;do{a=t.head[--i],t.head[i]=a>=n?a-n:0;}while(--e);e=n,i=e;do{a=t.prev[--i],t.prev[i]=a>=n?a-n:0;}while(--e);};var yt=function yt(t,e,a){return(e<<t.hash_shift^a)&t.hash_mask;};var xt=function xt(t){var e=t.state;var a=e.pending;a>t.avail_out&&(a=t.avail_out),0!==a&&(t.output.set(e.pending_buf.subarray(e.pending_out,e.pending_out+a),t.next_out),t.next_out+=a,e.pending_out+=a,t.total_out+=a,t.avail_out-=a,e.pending-=a,0===e.pending&&(e.pending_out=0));},zt=function zt(t,e){G(t,t.block_start>=0?t.block_start:-1,t.strstart-t.block_start,e),t.block_start=t.strstart,xt(t.strm);},At=function At(t,e){t.pending_buf[t.pending++]=e;},Et=function Et(t,e){t.pending_buf[t.pending++]=e>>>8&255,t.pending_buf[t.pending++]=255&e;},Rt=function Rt(t,e,a,i){var n=t.avail_in;return n>i&&(n=i),0===n?0:(t.avail_in-=n,e.set(t.input.subarray(t.next_in,t.next_in+n),a),1===t.state.wrap?t.adler=C(t.adler,e,n,a):2===t.state.wrap&&(t.adler=H(t.adler,e,n,a)),t.next_in+=n,t.total_in+=n,n);},Zt=function Zt(t,e){var a,i,n=t.max_chain_length,s=t.strstart,r=t.prev_length,o=t.nice_match;var l=t.strstart>t.w_size-ut?t.strstart-(t.w_size-ut):0,h=t.window,d=t.w_mask,_=t.prev,f=t.strstart+ct;var c=h[s+r-1],u=h[s+r];t.prev_length>=t.good_match&&(n>>=2),o>t.lookahead&&(o=t.lookahead);do{if(a=e,h[a+r]===u&&h[a+r-1]===c&&h[a]===h[s]&&h[++a]===h[s+1]){s+=2,a++;do{}while(h[++s]===h[++a]&&h[++s]===h[++a]&&h[++s]===h[++a]&&h[++s]===h[++a]&&h[++s]===h[++a]&&h[++s]===h[++a]&&h[++s]===h[++a]&&h[++s]===h[++a]&&s<f);if(i=ct-(f-s),s=f-ct,i>r){if(t.match_start=e,r=i,i>=o)break;c=h[s+r-1],u=h[s+r];}}}while((e=_[e&d])>l&&0!=--n);return r<=t.lookahead?r:t.lookahead;},Ut=function Ut(t){var e=t.w_size;var a,i,n;do{if(i=t.window_size-t.lookahead-t.strstart,t.strstart>=e+(e-ut)&&(t.window.set(t.window.subarray(e,e+e-i),0),t.match_start-=e,t.strstart-=e,t.block_start-=e,t.insert>t.strstart&&(t.insert=t.strstart),vt(t),i+=e),0===t.strm.avail_in)break;if(a=Rt(t.strm,t.window,t.strstart+t.lookahead,i),t.lookahead+=a,t.lookahead+t.insert>=3)for(n=t.strstart-t.insert,t.ins_h=t.window[n],t.ins_h=yt(t,t.ins_h,t.window[n+1]);t.insert&&(t.ins_h=yt(t,t.ins_h,t.window[n+3-1]),t.prev[n&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=n,n++,t.insert--,!(t.lookahead+t.insert<3));){;}}while(t.lookahead<ut&&0!==t.strm.avail_in);},St=function St(t,e){var a,i,n,s=t.pending_buf_size-5>t.w_size?t.w_size:t.pending_buf_size-5,r=0,o=t.strm.avail_in;do{if(a=65535,n=t.bi_valid+42>>3,t.strm.avail_out<n)break;if(n=t.strm.avail_out-n,i=t.strstart-t.block_start,a>i+t.strm.avail_in&&(a=i+t.strm.avail_in),a>n&&(a=n),a<s&&(0===a&&e!==V||e===q||a!==i+t.strm.avail_in))break;r=e===V&&a===i+t.strm.avail_in?1:0,Y(t,0,0,r),t.pending_buf[t.pending-4]=a,t.pending_buf[t.pending-3]=a>>8,t.pending_buf[t.pending-2]=~a,t.pending_buf[t.pending-1]=~a>>8,xt(t.strm),i&&(i>a&&(i=a),t.strm.output.set(t.window.subarray(t.block_start,t.block_start+i),t.strm.next_out),t.strm.next_out+=i,t.strm.avail_out-=i,t.strm.total_out+=i,t.block_start+=i,a-=i),a&&(Rt(t.strm,t.strm.output,t.strm.next_out,a),t.strm.next_out+=a,t.strm.avail_out-=a,t.strm.total_out+=a);}while(0===r);return o-=t.strm.avail_in,o&&(o>=t.w_size?(t.matches=2,t.window.set(t.strm.input.subarray(t.strm.next_in-t.w_size,t.strm.next_in),0),t.strstart=t.w_size,t.insert=t.strstart):(t.window_size-t.strstart<=o&&(t.strstart-=t.w_size,t.window.set(t.window.subarray(t.w_size,t.w_size+t.strstart),0),t.matches<2&&t.matches++,t.insert>t.strstart&&(t.insert=t.strstart)),t.window.set(t.strm.input.subarray(t.strm.next_in-o,t.strm.next_in),t.strstart),t.strstart+=o,t.insert+=o>t.w_size-t.insert?t.w_size-t.insert:o),t.block_start=t.strstart),t.high_water<t.strstart&&(t.high_water=t.strstart),r?4:e!==q&&e!==V&&0===t.strm.avail_in&&t.strstart===t.block_start?2:(n=t.window_size-t.strstart,t.strm.avail_in>n&&t.block_start>=t.w_size&&(t.block_start-=t.w_size,t.strstart-=t.w_size,t.window.set(t.window.subarray(t.w_size,t.w_size+t.strstart),0),t.matches<2&&t.matches++,n+=t.w_size,t.insert>t.strstart&&(t.insert=t.strstart)),n>t.strm.avail_in&&(n=t.strm.avail_in),n&&(Rt(t.strm,t.window,t.strstart,n),t.strstart+=n,t.insert+=n>t.w_size-t.insert?t.w_size-t.insert:n),t.high_water<t.strstart&&(t.high_water=t.strstart),n=t.bi_valid+42>>3,n=t.pending_buf_size-n>65535?65535:t.pending_buf_size-n,s=n>t.w_size?t.w_size:n,i=t.strstart-t.block_start,(i>=s||(i||e===V)&&e!==q&&0===t.strm.avail_in&&i<=n)&&(a=i>n?n:i,r=e===V&&0===t.strm.avail_in&&a===i?1:0,Y(t,t.block_start,a,r),t.block_start+=a,xt(t.strm)),r?3:1);},Dt=function Dt(t,e){var a,i;for(;;){if(t.lookahead<ut){if(Ut(t),t.lookahead<ut&&e===q)return 1;if(0===t.lookahead)break;}if(a=0,t.lookahead>=3&&(t.ins_h=yt(t,t.ins_h,t.window[t.strstart+3-1]),a=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),0!==a&&t.strstart-a<=t.w_size-ut&&(t.match_length=Zt(t,a)),t.match_length>=3){if(i=X(t,t.strstart-t.match_start,t.match_length-3),t.lookahead-=t.match_length,t.match_length<=t.max_lazy_match&&t.lookahead>=3){t.match_length--;do{t.strstart++,t.ins_h=yt(t,t.ins_h,t.window[t.strstart+3-1]),a=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart;}while(0!=--t.match_length);t.strstart++;}else t.strstart+=t.match_length,t.match_length=0,t.ins_h=t.window[t.strstart],t.ins_h=yt(t,t.ins_h,t.window[t.strstart+1]);}else i=X(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++;if(i&&(zt(t,!1),0===t.strm.avail_out))return 1;}return t.insert=t.strstart<2?t.strstart:2,e===V?(zt(t,!0),0===t.strm.avail_out?3:4):t.sym_next&&(zt(t,!1),0===t.strm.avail_out)?1:2;},Tt=function Tt(t,e){var a,i,n;for(;;){if(t.lookahead<ut){if(Ut(t),t.lookahead<ut&&e===q)return 1;if(0===t.lookahead)break;}if(a=0,t.lookahead>=3&&(t.ins_h=yt(t,t.ins_h,t.window[t.strstart+3-1]),a=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),t.prev_length=t.match_length,t.prev_match=t.match_start,t.match_length=2,0!==a&&t.prev_length<t.max_lazy_match&&t.strstart-a<=t.w_size-ut&&(t.match_length=Zt(t,a),t.match_length<=5&&(t.strategy===rt||3===t.match_length&&t.strstart-t.match_start>4096)&&(t.match_length=2)),t.prev_length>=3&&t.match_length<=t.prev_length){n=t.strstart+t.lookahead-3,i=X(t,t.strstart-1-t.prev_match,t.prev_length-3),t.lookahead-=t.prev_length-1,t.prev_length-=2;do{++t.strstart<=n&&(t.ins_h=yt(t,t.ins_h,t.window[t.strstart+3-1]),a=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart);}while(0!=--t.prev_length);if(t.match_available=0,t.match_length=2,t.strstart++,i&&(zt(t,!1),0===t.strm.avail_out))return 1;}else if(t.match_available){if(i=X(t,0,t.window[t.strstart-1]),i&&zt(t,!1),t.strstart++,t.lookahead--,0===t.strm.avail_out)return 1;}else t.match_available=1,t.strstart++,t.lookahead--;}return t.match_available&&(i=X(t,0,t.window[t.strstart-1]),t.match_available=0),t.insert=t.strstart<2?t.strstart:2,e===V?(zt(t,!0),0===t.strm.avail_out?3:4):t.sym_next&&(zt(t,!1),0===t.strm.avail_out)?1:2;};function Ot(t,e,a,i,n){this.good_length=t,this.max_lazy=e,this.nice_length=a,this.max_chain=i,this.func=n;}var It=[new Ot(0,0,0,0,St),new Ot(4,4,8,4,Dt),new Ot(4,5,16,8,Dt),new Ot(4,6,32,32,Dt),new Ot(4,4,16,16,Tt),new Ot(8,16,32,32,Tt),new Ot(8,16,128,128,Tt),new Ot(8,32,128,256,Tt),new Ot(32,128,258,1024,Tt),new Ot(32,258,258,4096,Tt)];function Ft(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=ft,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new Uint16Array(1146),this.dyn_dtree=new Uint16Array(122),this.bl_tree=new Uint16Array(78),kt(this.dyn_ltree),kt(this.dyn_dtree),kt(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array(16),this.heap=new Uint16Array(573),kt(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(573),kt(this.depth),this.sym_buf=0,this.lit_bufsize=0,this.sym_next=0,this.sym_end=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0;}var Lt=function Lt(t){if(!t)return 1;var e=t.state;return!e||e.strm!==t||e.status!==wt&&57!==e.status&&69!==e.status&&73!==e.status&&91!==e.status&&103!==e.status&&e.status!==mt&&e.status!==bt?1:0;},Nt=function Nt(t){if(Lt(t))return gt(t,at);t.total_in=t.total_out=0,t.data_type=_t;var e=t.state;return e.pending=0,e.pending_out=0,e.wrap<0&&(e.wrap=-e.wrap),e.status=2===e.wrap?57:e.wrap?wt:mt,t.adler=2===e.wrap?0:1,e.last_flush=-2,P(e),tt;},Bt=function Bt(t){var e=Nt(t);var a;return e===tt&&((a=t.state).window_size=2*a.w_size,kt(a.head),a.max_lazy_match=It[a.level].max_lazy,a.good_match=It[a.level].good_length,a.nice_match=It[a.level].nice_length,a.max_chain_length=It[a.level].max_chain,a.strstart=0,a.block_start=0,a.lookahead=0,a.insert=0,a.match_length=a.prev_length=2,a.match_available=0,a.ins_h=0),e;},Ct=function Ct(t,e,a,i,n,s){if(!t)return at;var r=1;if(e===st&&(e=6),i<0?(r=0,i=-i):i>15&&(r=2,i-=16),n<1||n>9||a!==ft||i<8||i>15||e<0||e>9||s<0||s>ht||8===i&&1!==r)return gt(t,at);8===i&&(i=9);var o=new Ft();return t.state=o,o.strm=t,o.status=wt,o.wrap=r,o.gzhead=null,o.w_bits=i,o.w_size=1<<o.w_bits,o.w_mask=o.w_size-1,o.hash_bits=n+7,o.hash_size=1<<o.hash_bits,o.hash_mask=o.hash_size-1,o.hash_shift=~~((o.hash_bits+3-1)/3),o.window=new Uint8Array(2*o.w_size),o.head=new Uint16Array(o.hash_size),o.prev=new Uint16Array(o.w_size),o.lit_bufsize=1<<n+6,o.pending_buf_size=4*o.lit_bufsize,o.pending_buf=new Uint8Array(o.pending_buf_size),o.sym_buf=o.lit_bufsize,o.sym_end=3*(o.lit_bufsize-1),o.level=e,o.strategy=s,o.method=a,Bt(t);};var Mt={deflateInit:function deflateInit(t,e){return Ct(t,e,ft,15,8,dt);},deflateInit2:Ct,deflateReset:Bt,deflateResetKeep:Nt,deflateSetHeader:function deflateSetHeader(t,e){return Lt(t)||2!==t.state.wrap?at:(t.state.gzhead=e,tt);},deflate:function deflate(t,e){if(Lt(t)||e>$||e<0)return t?gt(t,at):at;var a=t.state;if(!t.output||0!==t.avail_in&&!t.input||a.status===bt&&e!==V)return gt(t,0===t.avail_out?nt:at);var i=a.last_flush;if(a.last_flush=e,0!==a.pending){if(xt(t),0===t.avail_out)return a.last_flush=-1,tt;}else if(0===t.avail_in&&pt(e)<=pt(i)&&e!==V)return gt(t,nt);if(a.status===bt&&0!==t.avail_in)return gt(t,nt);if(a.status===wt&&0===a.wrap&&(a.status=mt),a.status===wt){var _e4=ft+(a.w_bits-8<<4)<<8,_i351=-1;if(_i351=a.strategy>=ot||a.level<2?0:a.level<6?1:6===a.level?2:3,_e4|=_i351<<6,0!==a.strstart&&(_e4|=32),_e4+=31-_e4%31,Et(a,_e4),0!==a.strstart&&(Et(a,t.adler>>>16),Et(a,65535&t.adler)),t.adler=1,a.status=mt,xt(t),0!==a.pending)return a.last_flush=-1,tt;}if(57===a.status)if(t.adler=0,At(a,31),At(a,139),At(a,8),a.gzhead)At(a,(a.gzhead.text?1:0)+(a.gzhead.hcrc?2:0)+(a.gzhead.extra?4:0)+(a.gzhead.name?8:0)+(a.gzhead.comment?16:0)),At(a,255&a.gzhead.time),At(a,a.gzhead.time>>8&255),At(a,a.gzhead.time>>16&255),At(a,a.gzhead.time>>24&255),At(a,9===a.level?2:a.strategy>=ot||a.level<2?4:0),At(a,255&a.gzhead.os),a.gzhead.extra&&a.gzhead.extra.length&&(At(a,255&a.gzhead.extra.length),At(a,a.gzhead.extra.length>>8&255)),a.gzhead.hcrc&&(t.adler=H(t.adler,a.pending_buf,a.pending,0)),a.gzindex=0,a.status=69;else if(At(a,0),At(a,0),At(a,0),At(a,0),At(a,0),At(a,9===a.level?2:a.strategy>=ot||a.level<2?4:0),At(a,3),a.status=mt,xt(t),0!==a.pending)return a.last_flush=-1,tt;if(69===a.status){if(a.gzhead.extra){var _e5=a.pending,_i352=(65535&a.gzhead.extra.length)-a.gzindex;for(;a.pending+_i352>a.pending_buf_size;){var _n3=a.pending_buf_size-a.pending;if(a.pending_buf.set(a.gzhead.extra.subarray(a.gzindex,a.gzindex+_n3),a.pending),a.pending=a.pending_buf_size,a.gzhead.hcrc&&a.pending>_e5&&(t.adler=H(t.adler,a.pending_buf,a.pending-_e5,_e5)),a.gzindex+=_n3,xt(t),0!==a.pending)return a.last_flush=-1,tt;_e5=0,_i352-=_n3;}var _n2=new Uint8Array(a.gzhead.extra);a.pending_buf.set(_n2.subarray(a.gzindex,a.gzindex+_i352),a.pending),a.pending+=_i352,a.gzhead.hcrc&&a.pending>_e5&&(t.adler=H(t.adler,a.pending_buf,a.pending-_e5,_e5)),a.gzindex=0;}a.status=73;}if(73===a.status){if(a.gzhead.name){var _e6,_i353=a.pending;do{if(a.pending===a.pending_buf_size){if(a.gzhead.hcrc&&a.pending>_i353&&(t.adler=H(t.adler,a.pending_buf,a.pending-_i353,_i353)),xt(t),0!==a.pending)return a.last_flush=-1,tt;_i353=0;}_e6=a.gzindex<a.gzhead.name.length?255&a.gzhead.name.charCodeAt(a.gzindex++):0,At(a,_e6);}while(0!==_e6);a.gzhead.hcrc&&a.pending>_i353&&(t.adler=H(t.adler,a.pending_buf,a.pending-_i353,_i353)),a.gzindex=0;}a.status=91;}if(91===a.status){if(a.gzhead.comment){var _e7,_i354=a.pending;do{if(a.pending===a.pending_buf_size){if(a.gzhead.hcrc&&a.pending>_i354&&(t.adler=H(t.adler,a.pending_buf,a.pending-_i354,_i354)),xt(t),0!==a.pending)return a.last_flush=-1,tt;_i354=0;}_e7=a.gzindex<a.gzhead.comment.length?255&a.gzhead.comment.charCodeAt(a.gzindex++):0,At(a,_e7);}while(0!==_e7);a.gzhead.hcrc&&a.pending>_i354&&(t.adler=H(t.adler,a.pending_buf,a.pending-_i354,_i354));}a.status=103;}if(103===a.status){if(a.gzhead.hcrc){if(a.pending+2>a.pending_buf_size&&(xt(t),0!==a.pending))return a.last_flush=-1,tt;At(a,255&t.adler),At(a,t.adler>>8&255),t.adler=0;}if(a.status=mt,xt(t),0!==a.pending)return a.last_flush=-1,tt;}if(0!==t.avail_in||0!==a.lookahead||e!==q&&a.status!==bt){var _i355=0===a.level?St(a,e):a.strategy===ot?function(t,e){var a;for(;;){if(0===t.lookahead&&(Ut(t),0===t.lookahead)){if(e===q)return 1;break;}if(t.match_length=0,a=X(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++,a&&(zt(t,!1),0===t.strm.avail_out))return 1;}return t.insert=0,e===V?(zt(t,!0),0===t.strm.avail_out?3:4):t.sym_next&&(zt(t,!1),0===t.strm.avail_out)?1:2;}(a,e):a.strategy===lt?function(t,e){var a,i,n,s;var r=t.window;for(;;){if(t.lookahead<=ct){if(Ut(t),t.lookahead<=ct&&e===q)return 1;if(0===t.lookahead)break;}if(t.match_length=0,t.lookahead>=3&&t.strstart>0&&(n=t.strstart-1,i=r[n],i===r[++n]&&i===r[++n]&&i===r[++n])){s=t.strstart+ct;do{}while(i===r[++n]&&i===r[++n]&&i===r[++n]&&i===r[++n]&&i===r[++n]&&i===r[++n]&&i===r[++n]&&i===r[++n]&&n<s);t.match_length=ct-(s-n),t.match_length>t.lookahead&&(t.match_length=t.lookahead);}if(t.match_length>=3?(a=X(t,1,t.match_length-3),t.lookahead-=t.match_length,t.strstart+=t.match_length,t.match_length=0):(a=X(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++),a&&(zt(t,!1),0===t.strm.avail_out))return 1;}return t.insert=0,e===V?(zt(t,!0),0===t.strm.avail_out?3:4):t.sym_next&&(zt(t,!1),0===t.strm.avail_out)?1:2;}(a,e):It[a.level].func(a,e);if(3!==_i355&&4!==_i355||(a.status=bt),1===_i355||3===_i355)return 0===t.avail_out&&(a.last_flush=-1),tt;if(2===_i355&&(e===J?W(a):e!==$&&(Y(a,0,0,!1),e===Q&&(kt(a.head),0===a.lookahead&&(a.strstart=0,a.block_start=0,a.insert=0))),xt(t),0===t.avail_out))return a.last_flush=-1,tt;}return e!==V?tt:a.wrap<=0?et:(2===a.wrap?(At(a,255&t.adler),At(a,t.adler>>8&255),At(a,t.adler>>16&255),At(a,t.adler>>24&255),At(a,255&t.total_in),At(a,t.total_in>>8&255),At(a,t.total_in>>16&255),At(a,t.total_in>>24&255)):(Et(a,t.adler>>>16),Et(a,65535&t.adler)),xt(t),a.wrap>0&&(a.wrap=-a.wrap),0!==a.pending?tt:et);},deflateEnd:function deflateEnd(t){if(Lt(t))return at;var e=t.state.status;return t.state=null,e===mt?gt(t,it):tt;},deflateSetDictionary:function deflateSetDictionary(t,e){var a=e.length;if(Lt(t))return at;var i=t.state,n=i.wrap;if(2===n||1===n&&i.status!==wt||i.lookahead)return at;if(1===n&&(t.adler=C(t.adler,e,a,0)),i.wrap=0,a>=i.w_size){0===n&&(kt(i.head),i.strstart=0,i.block_start=0,i.insert=0);var _t2=new Uint8Array(i.w_size);_t2.set(e.subarray(a-i.w_size,a),0),e=_t2,a=i.w_size;}var s=t.avail_in,r=t.next_in,o=t.input;for(t.avail_in=a,t.next_in=0,t.input=e,Ut(i);i.lookahead>=3;){var _t3=i.strstart,_e8=i.lookahead-2;do{i.ins_h=yt(i,i.ins_h,i.window[_t3+3-1]),i.prev[_t3&i.w_mask]=i.head[i.ins_h],i.head[i.ins_h]=_t3,_t3++;}while(--_e8);i.strstart=_t3,i.lookahead=2,Ut(i);}return i.strstart+=i.lookahead,i.block_start=i.strstart,i.insert=i.lookahead,i.lookahead=0,i.match_length=i.prev_length=2,i.match_available=0,t.next_in=r,t.input=o,t.avail_in=s,i.wrap=n,tt;},deflateInfo:"pako deflate (from Nodeca project)"};var Ht=function Ht(t,e){return Object.prototype.hasOwnProperty.call(t,e);};var jt=function jt(t){var e=Array.prototype.slice.call(arguments,1);for(;e.length;){var _a10=e.shift();if(_a10){if("object"!=_typeof(_a10))throw new TypeError(_a10+"must be non-object");for(var _e9 in _a10){Ht(_a10,_e9)&&(t[_e9]=_a10[_e9]);}}}return t;},Kt=function Kt(t){var e=0;for(var _a11=0,_i356=t.length;_a11<_i356;_a11++){e+=t[_a11].length;}var a=new Uint8Array(e);for(var _e10=0,_i357=0,_n4=t.length;_e10<_n4;_e10++){var _n5=t[_e10];a.set(_n5,_i357),_i357+=_n5.length;}return a;};var Pt=!0;try{String.fromCharCode.apply(null,new Uint8Array(1));}catch(t){Pt=!1;}var Yt=new Uint8Array(256);for(var _t4=0;_t4<256;_t4++){Yt[_t4]=_t4>=252?6:_t4>=248?5:_t4>=240?4:_t4>=224?3:_t4>=192?2:1;}Yt[254]=Yt[254]=1;var Gt=function Gt(t){if("function"==typeof TextEncoder&&TextEncoder.prototype.encode)return new TextEncoder().encode(t);var e,a,i,n,s,r=t.length,o=0;for(n=0;n<r;n++){a=t.charCodeAt(n),55296==(64512&a)&&n+1<r&&(i=t.charCodeAt(n+1),56320==(64512&i)&&(a=65536+(a-55296<<10)+(i-56320),n++)),o+=a<128?1:a<2048?2:a<65536?3:4;}for(e=new Uint8Array(o),s=0,n=0;s<o;n++){a=t.charCodeAt(n),55296==(64512&a)&&n+1<r&&(i=t.charCodeAt(n+1),56320==(64512&i)&&(a=65536+(a-55296<<10)+(i-56320),n++)),a<128?e[s++]=a:a<2048?(e[s++]=192|a>>>6,e[s++]=128|63&a):a<65536?(e[s++]=224|a>>>12,e[s++]=128|a>>>6&63,e[s++]=128|63&a):(e[s++]=240|a>>>18,e[s++]=128|a>>>12&63,e[s++]=128|a>>>6&63,e[s++]=128|63&a);}return e;},Xt=function Xt(t,e){var a=e||t.length;if("function"==typeof TextDecoder&&TextDecoder.prototype.decode)return new TextDecoder().decode(t.subarray(0,e));var i,n;var s=new Array(2*a);for(n=0,i=0;i<a;){var _e11=t[i++];if(_e11<128){s[n++]=_e11;continue;}var _r2=Yt[_e11];if(_r2>4)s[n++]=65533,i+=_r2-1;else{for(_e11&=2===_r2?31:3===_r2?15:7;_r2>1&&i<a;){_e11=_e11<<6|63&t[i++],_r2--;}_r2>1?s[n++]=65533:_e11<65536?s[n++]=_e11:(_e11-=65536,s[n++]=55296|_e11>>10&1023,s[n++]=56320|1023&_e11);}}return function(t,e){if(e<65534&&t.subarray&&Pt)return String.fromCharCode.apply(null,t.length===e?t:t.subarray(0,e));var a="";for(var _i358=0;_i358<e;_i358++){a+=String.fromCharCode(t[_i358]);}return a;}(s,n);},Wt=function Wt(t,e){(e=e||t.length)>t.length&&(e=t.length);var a=e-1;for(;a>=0&&128==(192&t[a]);){a--;}return a<0||0===a?e:a+Yt[t[a]]>e?a:e;};var qt=function qt(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0;};var Jt=Object.prototype.toString,Qt=K.Z_NO_FLUSH,Vt=K.Z_SYNC_FLUSH,$t=K.Z_FULL_FLUSH,te=K.Z_FINISH,ee=K.Z_OK,ae=K.Z_STREAM_END,ie=K.Z_DEFAULT_COMPRESSION,ne=K.Z_DEFAULT_STRATEGY,se=K.Z_DEFLATED;function re(t){this.options=jt({level:ie,method:se,chunkSize:16384,windowBits:15,memLevel:8,strategy:ne},t||{});var e=this.options;e.raw&&e.windowBits>0?e.windowBits=-e.windowBits:e.gzip&&e.windowBits>0&&e.windowBits<16&&(e.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new qt(),this.strm.avail_out=0;var a=Mt.deflateInit2(this.strm,e.level,e.method,e.windowBits,e.memLevel,e.strategy);if(a!==ee)throw new Error(j[a]);if(e.header&&Mt.deflateSetHeader(this.strm,e.header),e.dictionary){var _t5;if(_t5="string"==typeof e.dictionary?Gt(e.dictionary):"[object ArrayBuffer]"===Jt.call(e.dictionary)?new Uint8Array(e.dictionary):e.dictionary,a=Mt.deflateSetDictionary(this.strm,_t5),a!==ee)throw new Error(j[a]);this._dict_set=!0;}}function oe(t,e){var a=new re(e);if(a.push(t,!0),a.err)throw a.msg||j[a.err];return a.result;}re.prototype.push=function(t,e){var a=this.strm,i=this.options.chunkSize;var n,s;if(this.ended)return!1;for(s=e===~~e?e:!0===e?te:Qt,"string"==typeof t?a.input=Gt(t):"[object ArrayBuffer]"===Jt.call(t)?a.input=new Uint8Array(t):a.input=t,a.next_in=0,a.avail_in=a.input.length;;){if(0===a.avail_out&&(a.output=new Uint8Array(i),a.next_out=0,a.avail_out=i),(s===Vt||s===$t)&&a.avail_out<=6)this.onData(a.output.subarray(0,a.next_out)),a.avail_out=0;else{if(n=Mt.deflate(a,s),n===ae)return a.next_out>0&&this.onData(a.output.subarray(0,a.next_out)),n=Mt.deflateEnd(this.strm),this.onEnd(n),this.ended=!0,n===ee;if(0!==a.avail_out){if(s>0&&a.next_out>0)this.onData(a.output.subarray(0,a.next_out)),a.avail_out=0;else if(0===a.avail_in)break;}else this.onData(a.output);}}return!0;},re.prototype.onData=function(t){this.chunks.push(t);},re.prototype.onEnd=function(t){t===ee&&(this.result=Kt(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg;};var le={Deflate:re,deflate:oe,deflateRaw:function deflateRaw(t,e){return(e=e||{}).raw=!0,oe(t,e);},gzip:function gzip(t,e){return(e=e||{}).gzip=!0,oe(t,e);},constants:K};var he=16209;var de=function de(t,e){var a,i,n,s,r,o,l,h,d,_,f,c,u,w,m,b,g,p,k,v,y,x,z,A;var E=t.state;a=t.next_in,z=t.input,i=a+(t.avail_in-5),n=t.next_out,A=t.output,s=n-(e-t.avail_out),r=n+(t.avail_out-257),o=E.dmax,l=E.wsize,h=E.whave,d=E.wnext,_=E.window,f=E.hold,c=E.bits,u=E.lencode,w=E.distcode,m=(1<<E.lenbits)-1,b=(1<<E.distbits)-1;t:do{c<15&&(f+=z[a++]<<c,c+=8,f+=z[a++]<<c,c+=8),g=u[f&m];e:for(;;){if(p=g>>>24,f>>>=p,c-=p,p=g>>>16&255,0===p)A[n++]=65535&g;else{if(!(16&p)){if(0==(64&p)){g=u[(65535&g)+(f&(1<<p)-1)];continue e;}if(32&p){E.mode=16191;break t;}t.msg="invalid literal/length code",E.mode=he;break t;}k=65535&g,p&=15,p&&(c<p&&(f+=z[a++]<<c,c+=8),k+=f&(1<<p)-1,f>>>=p,c-=p),c<15&&(f+=z[a++]<<c,c+=8,f+=z[a++]<<c,c+=8),g=w[f&b];a:for(;;){if(p=g>>>24,f>>>=p,c-=p,p=g>>>16&255,!(16&p)){if(0==(64&p)){g=w[(65535&g)+(f&(1<<p)-1)];continue a;}t.msg="invalid distance code",E.mode=he;break t;}if(v=65535&g,p&=15,c<p&&(f+=z[a++]<<c,c+=8,c<p&&(f+=z[a++]<<c,c+=8)),v+=f&(1<<p)-1,v>o){t.msg="invalid distance too far back",E.mode=he;break t;}if(f>>>=p,c-=p,p=n-s,v>p){if(p=v-p,p>h&&E.sane){t.msg="invalid distance too far back",E.mode=he;break t;}if(y=0,x=_,0===d){if(y+=l-p,p<k){k-=p;do{A[n++]=_[y++];}while(--p);y=n-v,x=A;}}else if(d<p){if(y+=l+d-p,p-=d,p<k){k-=p;do{A[n++]=_[y++];}while(--p);if(y=0,d<k){p=d,k-=p;do{A[n++]=_[y++];}while(--p);y=n-v,x=A;}}}else if(y+=d-p,p<k){k-=p;do{A[n++]=_[y++];}while(--p);y=n-v,x=A;}for(;k>2;){A[n++]=x[y++],A[n++]=x[y++],A[n++]=x[y++],k-=3;}k&&(A[n++]=x[y++],k>1&&(A[n++]=x[y++]));}else{y=n-v;do{A[n++]=A[y++],A[n++]=A[y++],A[n++]=A[y++],k-=3;}while(k>2);k&&(A[n++]=A[y++],k>1&&(A[n++]=A[y++]));}break;}}break;}}while(a<i&&n<r);k=c>>3,a-=k,c-=k<<3,f&=(1<<c)-1,t.next_in=a,t.next_out=n,t.avail_in=a<i?i-a+5:5-(a-i),t.avail_out=n<r?r-n+257:257-(n-r),E.hold=f,E.bits=c;};var _e=15,fe=new Uint16Array([3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0]),ce=new Uint8Array([16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78]),ue=new Uint16Array([1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0]),we=new Uint8Array([16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64]);var me=function me(t,e,a,i,n,s,r,o){var l=o.bits;var h,d,_,f,c,u,w=0,m=0,b=0,g=0,p=0,k=0,v=0,y=0,x=0,z=0,A=null;var E=new Uint16Array(16),R=new Uint16Array(16);var Z,U,S,D=null;for(w=0;w<=_e;w++){E[w]=0;}for(m=0;m<i;m++){E[e[a+m]]++;}for(p=l,g=_e;g>=1&&0===E[g];g--){;}if(p>g&&(p=g),0===g)return n[s++]=20971520,n[s++]=20971520,o.bits=1,0;for(b=1;b<g&&0===E[b];b++){;}for(p<b&&(p=b),y=1,w=1;w<=_e;w++){if(y<<=1,y-=E[w],y<0)return-1;}if(y>0&&(0===t||1!==g))return-1;for(R[1]=0,w=1;w<_e;w++){R[w+1]=R[w]+E[w];}for(m=0;m<i;m++){0!==e[a+m]&&(r[R[e[a+m]]++]=m);}if(0===t?(A=D=r,u=20):1===t?(A=fe,D=ce,u=257):(A=ue,D=we,u=0),z=0,m=0,w=b,c=s,k=p,v=0,_=-1,x=1<<p,f=x-1,1===t&&x>852||2===t&&x>592)return 1;for(;;){Z=w-v,r[m]+1<u?(U=0,S=r[m]):r[m]>=u?(U=D[r[m]-u],S=A[r[m]-u]):(U=96,S=0),h=1<<w-v,d=1<<k,b=d;do{d-=h,n[c+(z>>v)+d]=Z<<24|U<<16|S|0;}while(0!==d);for(h=1<<w-1;z&h;){h>>=1;}if(0!==h?(z&=h-1,z+=h):z=0,m++,0==--E[w]){if(w===g)break;w=e[a+r[m]];}if(w>p&&(z&f)!==_){for(0===v&&(v=p),c+=b,k=w-v,y=1<<k;k+v<g&&(y-=E[k+v],!(y<=0));){k++,y<<=1;}if(x+=1<<k,1===t&&x>852||2===t&&x>592)return 1;_=z&f,n[_]=p<<24|k<<16|c-s|0;}}return 0!==z&&(n[c+z]=w-v<<24|64<<16|0),o.bits=p,0;};var be=K.Z_FINISH,ge=K.Z_BLOCK,pe=K.Z_TREES,ke=K.Z_OK,ve=K.Z_STREAM_END,ye=K.Z_NEED_DICT,xe=K.Z_STREAM_ERROR,ze=K.Z_DATA_ERROR,Ae=K.Z_MEM_ERROR,Ee=K.Z_BUF_ERROR,Re=K.Z_DEFLATED,Ze=16180,Ue=16190,Se=16191,De=16192,Te=16194,Oe=16199,Ie=16200,Fe=16206,Le=16209,Ne=function Ne(t){return(t>>>24&255)+(t>>>8&65280)+((65280&t)<<8)+((255&t)<<24);};function Be(){this.strm=null,this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new Uint16Array(320),this.work=new Uint16Array(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0;}var Ce=function Ce(t){if(!t)return 1;var e=t.state;return!e||e.strm!==t||e.mode<Ze||e.mode>16211?1:0;},Me=function Me(t){if(Ce(t))return xe;var e=t.state;return t.total_in=t.total_out=e.total=0,t.msg="",e.wrap&&(t.adler=1&e.wrap),e.mode=Ze,e.last=0,e.havedict=0,e.flags=-1,e.dmax=32768,e.head=null,e.hold=0,e.bits=0,e.lencode=e.lendyn=new Int32Array(852),e.distcode=e.distdyn=new Int32Array(592),e.sane=1,e.back=-1,ke;},He=function He(t){if(Ce(t))return xe;var e=t.state;return e.wsize=0,e.whave=0,e.wnext=0,Me(t);},je=function je(t,e){var a;if(Ce(t))return xe;var i=t.state;return e<0?(a=0,e=-e):(a=5+(e>>4),e<48&&(e&=15)),e&&(e<8||e>15)?xe:(null!==i.window&&i.wbits!==e&&(i.window=null),i.wrap=a,i.wbits=e,He(t));},Ke=function Ke(t,e){if(!t)return xe;var a=new Be();t.state=a,a.strm=t,a.window=null,a.mode=Ze;var i=je(t,e);return i!==ke&&(t.state=null),i;};var Pe,Ye,Ge=!0;var Xe=function Xe(t){if(Ge){Pe=new Int32Array(512),Ye=new Int32Array(32);var _e12=0;for(;_e12<144;){t.lens[_e12++]=8;}for(;_e12<256;){t.lens[_e12++]=9;}for(;_e12<280;){t.lens[_e12++]=7;}for(;_e12<288;){t.lens[_e12++]=8;}for(me(1,t.lens,0,288,Pe,0,t.work,{bits:9}),_e12=0;_e12<32;){t.lens[_e12++]=5;}me(2,t.lens,0,32,Ye,0,t.work,{bits:5}),Ge=!1;}t.lencode=Pe,t.lenbits=9,t.distcode=Ye,t.distbits=5;},We=function We(t,e,a,i){var n;var s=t.state;return null===s.window&&(s.wsize=1<<s.wbits,s.wnext=0,s.whave=0,s.window=new Uint8Array(s.wsize)),i>=s.wsize?(s.window.set(e.subarray(a-s.wsize,a),0),s.wnext=0,s.whave=s.wsize):(n=s.wsize-s.wnext,n>i&&(n=i),s.window.set(e.subarray(a-i,a-i+n),s.wnext),(i-=n)?(s.window.set(e.subarray(a-i,a),0),s.wnext=i,s.whave=s.wsize):(s.wnext+=n,s.wnext===s.wsize&&(s.wnext=0),s.whave<s.wsize&&(s.whave+=n))),0;};var qe={inflateReset:He,inflateReset2:je,inflateResetKeep:Me,inflateInit:function inflateInit(t){return Ke(t,15);},inflateInit2:Ke,inflate:function inflate(t,e){var a,i,n,s,r,o,l,h,d,_,f,c,u,w,m,b,g,p,k,v,y,x,z=0;var A=new Uint8Array(4);var E,R;var Z=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(Ce(t)||!t.output||!t.input&&0!==t.avail_in)return xe;a=t.state,a.mode===Se&&(a.mode=De),r=t.next_out,n=t.output,l=t.avail_out,s=t.next_in,i=t.input,o=t.avail_in,h=a.hold,d=a.bits,_=o,f=l,x=ke;t:for(;;){switch(a.mode){case Ze:if(0===a.wrap){a.mode=De;break;}for(;d<16;){if(0===o)break t;o--,h+=i[s++]<<d,d+=8;}if(2&a.wrap&&35615===h){0===a.wbits&&(a.wbits=15),a.check=0,A[0]=255&h,A[1]=h>>>8&255,a.check=H(a.check,A,2,0),h=0,d=0,a.mode=16181;break;}if(a.head&&(a.head.done=!1),!(1&a.wrap)||(((255&h)<<8)+(h>>8))%31){t.msg="incorrect header check",a.mode=Le;break;}if((15&h)!==Re){t.msg="unknown compression method",a.mode=Le;break;}if(h>>>=4,d-=4,y=8+(15&h),0===a.wbits&&(a.wbits=y),y>15||y>a.wbits){t.msg="invalid window size",a.mode=Le;break;}a.dmax=1<<a.wbits,a.flags=0,t.adler=a.check=1,a.mode=512&h?16189:Se,h=0,d=0;break;case 16181:for(;d<16;){if(0===o)break t;o--,h+=i[s++]<<d,d+=8;}if(a.flags=h,(255&a.flags)!==Re){t.msg="unknown compression method",a.mode=Le;break;}if(57344&a.flags){t.msg="unknown header flags set",a.mode=Le;break;}a.head&&(a.head.text=h>>8&1),512&a.flags&&4&a.wrap&&(A[0]=255&h,A[1]=h>>>8&255,a.check=H(a.check,A,2,0)),h=0,d=0,a.mode=16182;case 16182:for(;d<32;){if(0===o)break t;o--,h+=i[s++]<<d,d+=8;}a.head&&(a.head.time=h),512&a.flags&&4&a.wrap&&(A[0]=255&h,A[1]=h>>>8&255,A[2]=h>>>16&255,A[3]=h>>>24&255,a.check=H(a.check,A,4,0)),h=0,d=0,a.mode=16183;case 16183:for(;d<16;){if(0===o)break t;o--,h+=i[s++]<<d,d+=8;}a.head&&(a.head.xflags=255&h,a.head.os=h>>8),512&a.flags&&4&a.wrap&&(A[0]=255&h,A[1]=h>>>8&255,a.check=H(a.check,A,2,0)),h=0,d=0,a.mode=16184;case 16184:if(1024&a.flags){for(;d<16;){if(0===o)break t;o--,h+=i[s++]<<d,d+=8;}a.length=h,a.head&&(a.head.extra_len=h),512&a.flags&&4&a.wrap&&(A[0]=255&h,A[1]=h>>>8&255,a.check=H(a.check,A,2,0)),h=0,d=0;}else a.head&&(a.head.extra=null);a.mode=16185;case 16185:if(1024&a.flags&&(c=a.length,c>o&&(c=o),c&&(a.head&&(y=a.head.extra_len-a.length,a.head.extra||(a.head.extra=new Uint8Array(a.head.extra_len)),a.head.extra.set(i.subarray(s,s+c),y)),512&a.flags&&4&a.wrap&&(a.check=H(a.check,i,c,s)),o-=c,s+=c,a.length-=c),a.length))break t;a.length=0,a.mode=16186;case 16186:if(2048&a.flags){if(0===o)break t;c=0;do{y=i[s+c++],a.head&&y&&a.length<65536&&(a.head.name+=String.fromCharCode(y));}while(y&&c<o);if(512&a.flags&&4&a.wrap&&(a.check=H(a.check,i,c,s)),o-=c,s+=c,y)break t;}else a.head&&(a.head.name=null);a.length=0,a.mode=16187;case 16187:if(4096&a.flags){if(0===o)break t;c=0;do{y=i[s+c++],a.head&&y&&a.length<65536&&(a.head.comment+=String.fromCharCode(y));}while(y&&c<o);if(512&a.flags&&4&a.wrap&&(a.check=H(a.check,i,c,s)),o-=c,s+=c,y)break t;}else a.head&&(a.head.comment=null);a.mode=16188;case 16188:if(512&a.flags){for(;d<16;){if(0===o)break t;o--,h+=i[s++]<<d,d+=8;}if(4&a.wrap&&h!==(65535&a.check)){t.msg="header crc mismatch",a.mode=Le;break;}h=0,d=0;}a.head&&(a.head.hcrc=a.flags>>9&1,a.head.done=!0),t.adler=a.check=0,a.mode=Se;break;case 16189:for(;d<32;){if(0===o)break t;o--,h+=i[s++]<<d,d+=8;}t.adler=a.check=Ne(h),h=0,d=0,a.mode=Ue;case Ue:if(0===a.havedict)return t.next_out=r,t.avail_out=l,t.next_in=s,t.avail_in=o,a.hold=h,a.bits=d,ye;t.adler=a.check=1,a.mode=Se;case Se:if(e===ge||e===pe)break t;case De:if(a.last){h>>>=7&d,d-=7&d,a.mode=Fe;break;}for(;d<3;){if(0===o)break t;o--,h+=i[s++]<<d,d+=8;}switch(a.last=1&h,h>>>=1,d-=1,3&h){case 0:a.mode=16193;break;case 1:if(Xe(a),a.mode=Oe,e===pe){h>>>=2,d-=2;break t;}break;case 2:a.mode=16196;break;case 3:t.msg="invalid block type",a.mode=Le;}h>>>=2,d-=2;break;case 16193:for(h>>>=7&d,d-=7&d;d<32;){if(0===o)break t;o--,h+=i[s++]<<d,d+=8;}if((65535&h)!=(h>>>16^65535)){t.msg="invalid stored block lengths",a.mode=Le;break;}if(a.length=65535&h,h=0,d=0,a.mode=Te,e===pe)break t;case Te:a.mode=16195;case 16195:if(c=a.length,c){if(c>o&&(c=o),c>l&&(c=l),0===c)break t;n.set(i.subarray(s,s+c),r),o-=c,s+=c,l-=c,r+=c,a.length-=c;break;}a.mode=Se;break;case 16196:for(;d<14;){if(0===o)break t;o--,h+=i[s++]<<d,d+=8;}if(a.nlen=257+(31&h),h>>>=5,d-=5,a.ndist=1+(31&h),h>>>=5,d-=5,a.ncode=4+(15&h),h>>>=4,d-=4,a.nlen>286||a.ndist>30){t.msg="too many length or distance symbols",a.mode=Le;break;}a.have=0,a.mode=16197;case 16197:for(;a.have<a.ncode;){for(;d<3;){if(0===o)break t;o--,h+=i[s++]<<d,d+=8;}a.lens[Z[a.have++]]=7&h,h>>>=3,d-=3;}for(;a.have<19;){a.lens[Z[a.have++]]=0;}if(a.lencode=a.lendyn,a.lenbits=7,E={bits:a.lenbits},x=me(0,a.lens,0,19,a.lencode,0,a.work,E),a.lenbits=E.bits,x){t.msg="invalid code lengths set",a.mode=Le;break;}a.have=0,a.mode=16198;case 16198:for(;a.have<a.nlen+a.ndist;){for(;z=a.lencode[h&(1<<a.lenbits)-1],m=z>>>24,b=z>>>16&255,g=65535&z,!(m<=d);){if(0===o)break t;o--,h+=i[s++]<<d,d+=8;}if(g<16)h>>>=m,d-=m,a.lens[a.have++]=g;else{if(16===g){for(R=m+2;d<R;){if(0===o)break t;o--,h+=i[s++]<<d,d+=8;}if(h>>>=m,d-=m,0===a.have){t.msg="invalid bit length repeat",a.mode=Le;break;}y=a.lens[a.have-1],c=3+(3&h),h>>>=2,d-=2;}else if(17===g){for(R=m+3;d<R;){if(0===o)break t;o--,h+=i[s++]<<d,d+=8;}h>>>=m,d-=m,y=0,c=3+(7&h),h>>>=3,d-=3;}else{for(R=m+7;d<R;){if(0===o)break t;o--,h+=i[s++]<<d,d+=8;}h>>>=m,d-=m,y=0,c=11+(127&h),h>>>=7,d-=7;}if(a.have+c>a.nlen+a.ndist){t.msg="invalid bit length repeat",a.mode=Le;break;}for(;c--;){a.lens[a.have++]=y;}}}if(a.mode===Le)break;if(0===a.lens[256]){t.msg="invalid code -- missing end-of-block",a.mode=Le;break;}if(a.lenbits=9,E={bits:a.lenbits},x=me(1,a.lens,0,a.nlen,a.lencode,0,a.work,E),a.lenbits=E.bits,x){t.msg="invalid literal/lengths set",a.mode=Le;break;}if(a.distbits=6,a.distcode=a.distdyn,E={bits:a.distbits},x=me(2,a.lens,a.nlen,a.ndist,a.distcode,0,a.work,E),a.distbits=E.bits,x){t.msg="invalid distances set",a.mode=Le;break;}if(a.mode=Oe,e===pe)break t;case Oe:a.mode=Ie;case Ie:if(o>=6&&l>=258){t.next_out=r,t.avail_out=l,t.next_in=s,t.avail_in=o,a.hold=h,a.bits=d,de(t,f),r=t.next_out,n=t.output,l=t.avail_out,s=t.next_in,i=t.input,o=t.avail_in,h=a.hold,d=a.bits,a.mode===Se&&(a.back=-1);break;}for(a.back=0;z=a.lencode[h&(1<<a.lenbits)-1],m=z>>>24,b=z>>>16&255,g=65535&z,!(m<=d);){if(0===o)break t;o--,h+=i[s++]<<d,d+=8;}if(b&&0==(240&b)){for(p=m,k=b,v=g;z=a.lencode[v+((h&(1<<p+k)-1)>>p)],m=z>>>24,b=z>>>16&255,g=65535&z,!(p+m<=d);){if(0===o)break t;o--,h+=i[s++]<<d,d+=8;}h>>>=p,d-=p,a.back+=p;}if(h>>>=m,d-=m,a.back+=m,a.length=g,0===b){a.mode=16205;break;}if(32&b){a.back=-1,a.mode=Se;break;}if(64&b){t.msg="invalid literal/length code",a.mode=Le;break;}a.extra=15&b,a.mode=16201;case 16201:if(a.extra){for(R=a.extra;d<R;){if(0===o)break t;o--,h+=i[s++]<<d,d+=8;}a.length+=h&(1<<a.extra)-1,h>>>=a.extra,d-=a.extra,a.back+=a.extra;}a.was=a.length,a.mode=16202;case 16202:for(;z=a.distcode[h&(1<<a.distbits)-1],m=z>>>24,b=z>>>16&255,g=65535&z,!(m<=d);){if(0===o)break t;o--,h+=i[s++]<<d,d+=8;}if(0==(240&b)){for(p=m,k=b,v=g;z=a.distcode[v+((h&(1<<p+k)-1)>>p)],m=z>>>24,b=z>>>16&255,g=65535&z,!(p+m<=d);){if(0===o)break t;o--,h+=i[s++]<<d,d+=8;}h>>>=p,d-=p,a.back+=p;}if(h>>>=m,d-=m,a.back+=m,64&b){t.msg="invalid distance code",a.mode=Le;break;}a.offset=g,a.extra=15&b,a.mode=16203;case 16203:if(a.extra){for(R=a.extra;d<R;){if(0===o)break t;o--,h+=i[s++]<<d,d+=8;}a.offset+=h&(1<<a.extra)-1,h>>>=a.extra,d-=a.extra,a.back+=a.extra;}if(a.offset>a.dmax){t.msg="invalid distance too far back",a.mode=Le;break;}a.mode=16204;case 16204:if(0===l)break t;if(c=f-l,a.offset>c){if(c=a.offset-c,c>a.whave&&a.sane){t.msg="invalid distance too far back",a.mode=Le;break;}c>a.wnext?(c-=a.wnext,u=a.wsize-c):u=a.wnext-c,c>a.length&&(c=a.length),w=a.window;}else w=n,u=r-a.offset,c=a.length;c>l&&(c=l),l-=c,a.length-=c;do{n[r++]=w[u++];}while(--c);0===a.length&&(a.mode=Ie);break;case 16205:if(0===l)break t;n[r++]=a.length,l--,a.mode=Ie;break;case Fe:if(a.wrap){for(;d<32;){if(0===o)break t;o--,h|=i[s++]<<d,d+=8;}if(f-=l,t.total_out+=f,a.total+=f,4&a.wrap&&f&&(t.adler=a.check=a.flags?H(a.check,n,f,r-f):C(a.check,n,f,r-f)),f=l,4&a.wrap&&(a.flags?h:Ne(h))!==a.check){t.msg="incorrect data check",a.mode=Le;break;}h=0,d=0;}a.mode=16207;case 16207:if(a.wrap&&a.flags){for(;d<32;){if(0===o)break t;o--,h+=i[s++]<<d,d+=8;}if(4&a.wrap&&h!==(4294967295&a.total)){t.msg="incorrect length check",a.mode=Le;break;}h=0,d=0;}a.mode=16208;case 16208:x=ve;break t;case Le:x=ze;break t;case 16210:return Ae;default:return xe;}}return t.next_out=r,t.avail_out=l,t.next_in=s,t.avail_in=o,a.hold=h,a.bits=d,(a.wsize||f!==t.avail_out&&a.mode<Le&&(a.mode<Fe||e!==be))&&We(t,t.output,t.next_out,f-t.avail_out),_-=t.avail_in,f-=t.avail_out,t.total_in+=_,t.total_out+=f,a.total+=f,4&a.wrap&&f&&(t.adler=a.check=a.flags?H(a.check,n,f,t.next_out-f):C(a.check,n,f,t.next_out-f)),t.data_type=a.bits+(a.last?64:0)+(a.mode===Se?128:0)+(a.mode===Oe||a.mode===Te?256:0),(0===_&&0===f||e===be)&&x===ke&&(x=Ee),x;},inflateEnd:function inflateEnd(t){if(Ce(t))return xe;var e=t.state;return e.window&&(e.window=null),t.state=null,ke;},inflateGetHeader:function inflateGetHeader(t,e){if(Ce(t))return xe;var a=t.state;return 0==(2&a.wrap)?xe:(a.head=e,e.done=!1,ke);},inflateSetDictionary:function inflateSetDictionary(t,e){var a=e.length;var i,n,s;return Ce(t)?xe:(i=t.state,0!==i.wrap&&i.mode!==Ue?xe:i.mode===Ue&&(n=1,n=C(n,e,a,0),n!==i.check)?ze:(s=We(t,e,a,a),s?(i.mode=16210,Ae):(i.havedict=1,ke)));},inflateInfo:"pako inflate (from Nodeca project)"};var Je=function Je(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1;};var Qe=Object.prototype.toString,Ve=K.Z_NO_FLUSH,$e=K.Z_FINISH,ta=K.Z_OK,ea=K.Z_STREAM_END,aa=K.Z_NEED_DICT,ia=K.Z_STREAM_ERROR,na=K.Z_DATA_ERROR,sa=K.Z_MEM_ERROR;function ra(t){this.options=jt({chunkSize:65536,windowBits:15,to:""},t||{});var e=this.options;e.raw&&e.windowBits>=0&&e.windowBits<16&&(e.windowBits=-e.windowBits,0===e.windowBits&&(e.windowBits=-15)),!(e.windowBits>=0&&e.windowBits<16)||t&&t.windowBits||(e.windowBits+=32),e.windowBits>15&&e.windowBits<48&&0==(15&e.windowBits)&&(e.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new qt(),this.strm.avail_out=0;var a=qe.inflateInit2(this.strm,e.windowBits);if(a!==ta)throw new Error(j[a]);if(this.header=new Je(),qe.inflateGetHeader(this.strm,this.header),e.dictionary&&("string"==typeof e.dictionary?e.dictionary=Gt(e.dictionary):"[object ArrayBuffer]"===Qe.call(e.dictionary)&&(e.dictionary=new Uint8Array(e.dictionary)),e.raw&&(a=qe.inflateSetDictionary(this.strm,e.dictionary),a!==ta)))throw new Error(j[a]);}function oa(t,e){var a=new ra(e);if(a.push(t),a.err)throw a.msg||j[a.err];return a.result;}ra.prototype.push=function(t,e){var a=this.strm,i=this.options.chunkSize,n=this.options.dictionary;var s,r,o;if(this.ended)return!1;for(r=e===~~e?e:!0===e?$e:Ve,"[object ArrayBuffer]"===Qe.call(t)?a.input=new Uint8Array(t):a.input=t,a.next_in=0,a.avail_in=a.input.length;;){for(0===a.avail_out&&(a.output=new Uint8Array(i),a.next_out=0,a.avail_out=i),s=qe.inflate(a,r),s===aa&&n&&(s=qe.inflateSetDictionary(a,n),s===ta?s=qe.inflate(a,r):s===na&&(s=aa));a.avail_in>0&&s===ea&&a.state.wrap>0&&0!==t[a.next_in];){qe.inflateReset(a),s=qe.inflate(a,r);}switch(s){case ia:case na:case aa:case sa:return this.onEnd(s),this.ended=!0,!1;}if(o=a.avail_out,a.next_out&&(0===a.avail_out||s===ea))if("string"===this.options.to){var _t6=Wt(a.output,a.next_out),_e13=a.next_out-_t6,_n6=Xt(a.output,_t6);a.next_out=_e13,a.avail_out=i-_e13,_e13&&a.output.set(a.output.subarray(_t6,_t6+_e13),0),this.onData(_n6);}else this.onData(a.output.length===a.next_out?a.output:a.output.subarray(0,a.next_out));if(s!==ta||0!==o){if(s===ea)return s=qe.inflateEnd(this.strm),this.onEnd(s),this.ended=!0,!0;if(0===a.avail_in)break;}}return!0;},ra.prototype.onData=function(t){this.chunks.push(t);},ra.prototype.onEnd=function(t){t===ta&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=Kt(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg;};var la={Inflate:ra,inflate:oa,inflateRaw:function inflateRaw(t,e){return(e=e||{}).raw=!0,oa(t,e);},ungzip:oa,constants:K};var ha=le.Deflate,da=le.deflate,_a=le.deflateRaw,fa=le.gzip,ca=la.Inflate,ua=la.inflate,wa=la.inflateRaw,ma=la.ungzip;var ba=ha,ga=da,pa=_a,ka=fa,va=ca,ya=ua,xa=wa,za=ma,Aa=K,Ea={Deflate:ba,deflate:ga,deflateRaw:pa,gzip:ka,Inflate:va,inflate:ya,inflateRaw:xa,ungzip:za,constants:Aa};t.Deflate=ba,t.Inflate=va,t.constants=Aa,t["default"]=Ea,t.deflate=ga,t.deflateRaw=pa,t.gzip=ka,t.inflate=ya,t.inflateRaw=xa,t.ungzip=za,Object.defineProperty(t,"__esModule",{value:!0});});var p=/*#__PURE__*/Object.freeze({__proto__:null});/*
28847
28856
 
28848
28857
  Parser for .XKT Format V1
28849
28858
 
@@ -28852,7 +28861,7 @@ var isBase64=!!dataUriRegexResult[2];var data=dataUriRegexResult[3];data=window.
28852
28861
  DEPRECATED
28853
28862
 
28854
28863
  */var pako$a=window.pako||p;if(!pako$a.inflate){// See https://github.com/nodeca/pako/issues/97
28855
- pako$a=pako$a["default"];}var decompressColor$b=function(){var color2=new Float32Array(3);return function(color){color2[0]=color[0]/255.0;color2[1]=color[1]/255.0;color2[2]=color[2]/255.0;return color2;};}();function extract$a(elements){return{positions:elements[0],normals:elements[1],indices:elements[2],edgeIndices:elements[3],meshPositions:elements[4],meshIndices:elements[5],meshEdgesIndices:elements[6],meshColors:elements[7],entityIDs:elements[8],entityMeshes:elements[9],entityIsObjects:elements[10],positionsDecodeMatrix:elements[11]};}function inflate$a(deflatedData){return{positions:new Uint16Array(pako$a.inflate(deflatedData.positions).buffer),normals:new Int8Array(pako$a.inflate(deflatedData.normals).buffer),indices:new Uint32Array(pako$a.inflate(deflatedData.indices).buffer),edgeIndices:new Uint32Array(pako$a.inflate(deflatedData.edgeIndices).buffer),meshPositions:new Uint32Array(pako$a.inflate(deflatedData.meshPositions).buffer),meshIndices:new Uint32Array(pako$a.inflate(deflatedData.meshIndices).buffer),meshEdgesIndices:new Uint32Array(pako$a.inflate(deflatedData.meshEdgesIndices).buffer),meshColors:new Uint8Array(pako$a.inflate(deflatedData.meshColors).buffer),entityIDs:pako$a.inflate(deflatedData.entityIDs,{to:'string'}),entityMeshes:new Uint32Array(pako$a.inflate(deflatedData.entityMeshes).buffer),entityIsObjects:new Uint8Array(pako$a.inflate(deflatedData.entityIsObjects).buffer),positionsDecodeMatrix:new Float32Array(pako$a.inflate(deflatedData.positionsDecodeMatrix).buffer)};}function load$b(viewer,options,inflatedData,sceneModel,metaModel,manifestCtx){manifestCtx.getNextId();sceneModel.positionsCompression="precompressed";sceneModel.normalsCompression="precompressed";var positions=inflatedData.positions;var normals=inflatedData.normals;var indices=inflatedData.indices;var edgeIndices=inflatedData.edgeIndices;var meshPositions=inflatedData.meshPositions;var meshIndices=inflatedData.meshIndices;var meshEdgesIndices=inflatedData.meshEdgesIndices;var meshColors=inflatedData.meshColors;var entityIDs=JSON.parse(inflatedData.entityIDs);var entityMeshes=inflatedData.entityMeshes;var entityIsObjects=inflatedData.entityIsObjects;var numMeshes=meshPositions.length;var numEntities=entityMeshes.length;for(var _i357=0;_i357<numEntities;_i357++){var xktEntityId=entityIDs[_i357];var entityId=options.globalizeObjectIds?math.globalizeObjectId(sceneModel.id,xktEntityId):xktEntityId;var metaObject=viewer.metaScene.metaObjects[entityId];var entityDefaults={};var meshDefaults={};if(metaObject){if(options.excludeTypesMap&&metaObject.type&&options.excludeTypesMap[metaObject.type]){continue;}if(options.includeTypesMap&&metaObject.type&&!options.includeTypesMap[metaObject.type]){continue;}var props=options.objectDefaults?options.objectDefaults[metaObject.type]||options.objectDefaults["DEFAULT"]:null;if(props){if(props.visible===false){entityDefaults.visible=false;}if(props.pickable===false){entityDefaults.pickable=false;}if(props.colorize){meshDefaults.color=props.colorize;}if(props.opacity!==undefined&&props.opacity!==null){meshDefaults.opacity=props.opacity;}}}else{if(options.excludeUnclassifiedObjects){continue;}}var lastEntity=_i357===numEntities-1;var meshIds=[];for(var j=entityMeshes[_i357],jlen=lastEntity?entityMeshes.length:entityMeshes[_i357+1];j<jlen;j++){var lastMesh=j===numMeshes-1;var meshId=entityId+".mesh."+j;var _color8=decompressColor$b(meshColors.subarray(j*4,j*4+3));var _opacity=meshColors[j*4+3]/255.0;sceneModel.createMesh(utils.apply(meshDefaults,{id:meshId,primitive:"triangles",positionsCompressed:positions.subarray(meshPositions[j],lastMesh?positions.length:meshPositions[j+1]),normalsCompressed:normals.subarray(meshPositions[j],lastMesh?positions.length:meshPositions[j+1]),indices:indices.subarray(meshIndices[j],lastMesh?indices.length:meshIndices[j+1]),edgeIndices:edgeIndices.subarray(meshEdgesIndices[j],lastMesh?edgeIndices.length:meshEdgesIndices[j+1]),positionsDecodeMatrix:inflatedData.positionsDecodeMatrix,color:_color8,opacity:_opacity}));meshIds.push(meshId);}sceneModel.createEntity(utils.apply(entityDefaults,{id:entityId,isObject:entityIsObjects[_i357]===1,meshIds:meshIds}));}}/** @private */var ParserV1={version:1,parse:function parse(viewer,options,elements,sceneModel,metaModel,manifestCtx){var deflatedData=extract$a(elements);var inflatedData=inflate$a(deflatedData);load$b(viewer,options,inflatedData,sceneModel,metaModel,manifestCtx);}};/*
28864
+ pako$a=pako$a["default"];}var decompressColor$b=function(){var color2=new Float32Array(3);return function(color){color2[0]=color[0]/255.0;color2[1]=color[1]/255.0;color2[2]=color[2]/255.0;return color2;};}();function extract$a(elements){return{positions:elements[0],normals:elements[1],indices:elements[2],edgeIndices:elements[3],meshPositions:elements[4],meshIndices:elements[5],meshEdgesIndices:elements[6],meshColors:elements[7],entityIDs:elements[8],entityMeshes:elements[9],entityIsObjects:elements[10],positionsDecodeMatrix:elements[11]};}function inflate$a(deflatedData){return{positions:new Uint16Array(pako$a.inflate(deflatedData.positions).buffer),normals:new Int8Array(pako$a.inflate(deflatedData.normals).buffer),indices:new Uint32Array(pako$a.inflate(deflatedData.indices).buffer),edgeIndices:new Uint32Array(pako$a.inflate(deflatedData.edgeIndices).buffer),meshPositions:new Uint32Array(pako$a.inflate(deflatedData.meshPositions).buffer),meshIndices:new Uint32Array(pako$a.inflate(deflatedData.meshIndices).buffer),meshEdgesIndices:new Uint32Array(pako$a.inflate(deflatedData.meshEdgesIndices).buffer),meshColors:new Uint8Array(pako$a.inflate(deflatedData.meshColors).buffer),entityIDs:pako$a.inflate(deflatedData.entityIDs,{to:'string'}),entityMeshes:new Uint32Array(pako$a.inflate(deflatedData.entityMeshes).buffer),entityIsObjects:new Uint8Array(pako$a.inflate(deflatedData.entityIsObjects).buffer),positionsDecodeMatrix:new Float32Array(pako$a.inflate(deflatedData.positionsDecodeMatrix).buffer)};}function load$b(viewer,options,inflatedData,sceneModel,metaModel,manifestCtx){manifestCtx.getNextId();sceneModel.positionsCompression="precompressed";sceneModel.normalsCompression="precompressed";var positions=inflatedData.positions;var normals=inflatedData.normals;var indices=inflatedData.indices;var edgeIndices=inflatedData.edgeIndices;var meshPositions=inflatedData.meshPositions;var meshIndices=inflatedData.meshIndices;var meshEdgesIndices=inflatedData.meshEdgesIndices;var meshColors=inflatedData.meshColors;var entityIDs=JSON.parse(inflatedData.entityIDs);var entityMeshes=inflatedData.entityMeshes;var entityIsObjects=inflatedData.entityIsObjects;var numMeshes=meshPositions.length;var numEntities=entityMeshes.length;for(var _i359=0;_i359<numEntities;_i359++){var xktEntityId=entityIDs[_i359];var entityId=options.globalizeObjectIds?math.globalizeObjectId(sceneModel.id,xktEntityId):xktEntityId;var metaObject=viewer.metaScene.metaObjects[entityId];var entityDefaults={};var meshDefaults={};if(metaObject){if(options.excludeTypesMap&&metaObject.type&&options.excludeTypesMap[metaObject.type]){continue;}if(options.includeTypesMap&&metaObject.type&&!options.includeTypesMap[metaObject.type]){continue;}var props=options.objectDefaults?options.objectDefaults[metaObject.type]||options.objectDefaults["DEFAULT"]:null;if(props){if(props.visible===false){entityDefaults.visible=false;}if(props.pickable===false){entityDefaults.pickable=false;}if(props.colorize){meshDefaults.color=props.colorize;}if(props.opacity!==undefined&&props.opacity!==null){meshDefaults.opacity=props.opacity;}}}else{if(options.excludeUnclassifiedObjects){continue;}}var lastEntity=_i359===numEntities-1;var meshIds=[];for(var j=entityMeshes[_i359],jlen=lastEntity?entityMeshes.length:entityMeshes[_i359+1];j<jlen;j++){var lastMesh=j===numMeshes-1;var meshId=entityId+".mesh."+j;var _color8=decompressColor$b(meshColors.subarray(j*4,j*4+3));var _opacity=meshColors[j*4+3]/255.0;sceneModel.createMesh(utils.apply(meshDefaults,{id:meshId,primitive:"triangles",positionsCompressed:positions.subarray(meshPositions[j],lastMesh?positions.length:meshPositions[j+1]),normalsCompressed:normals.subarray(meshPositions[j],lastMesh?positions.length:meshPositions[j+1]),indices:indices.subarray(meshIndices[j],lastMesh?indices.length:meshIndices[j+1]),edgeIndices:edgeIndices.subarray(meshEdgesIndices[j],lastMesh?edgeIndices.length:meshEdgesIndices[j+1]),positionsDecodeMatrix:inflatedData.positionsDecodeMatrix,color:_color8,opacity:_opacity}));meshIds.push(meshId);}sceneModel.createEntity(utils.apply(entityDefaults,{id:entityId,isObject:entityIsObjects[_i359]===1,meshIds:meshIds}));}}/** @private */var ParserV1={version:1,parse:function parse(viewer,options,elements,sceneModel,metaModel,manifestCtx){var deflatedData=extract$a(elements);var inflatedData=inflate$a(deflatedData);load$b(viewer,options,inflatedData,sceneModel,metaModel,manifestCtx);}};/*
28856
28865
 
28857
28866
  Parser for .XKT Format V2
28858
28867
 
@@ -28861,14 +28870,14 @@ DEPRECATED
28861
28870
  .XKT specifications: https://github.com/xeokit/xeokit-sdk/wiki/XKT-Format
28862
28871
 
28863
28872
  */var pako$9=window.pako||p;if(!pako$9.inflate){// See https://github.com/nodeca/pako/issues/97
28864
- pako$9=pako$9["default"];}function extract$9(elements){return{positions:elements[0],normals:elements[1],indices:elements[2],edgeIndices:elements[3],meshPositions:elements[4],meshIndices:elements[5],meshEdgesIndices:elements[6],meshColors:elements[7],entityIDs:elements[8],entityMeshes:elements[9],entityIsObjects:elements[10],positionsDecodeMatrix:elements[11],entityMeshIds:elements[12],entityMatrices:elements[13],entityUsesInstancing:elements[14]};}function inflate$9(deflatedData){return{positions:new Uint16Array(pako$9.inflate(deflatedData.positions).buffer),normals:new Int8Array(pako$9.inflate(deflatedData.normals).buffer),indices:new Uint32Array(pako$9.inflate(deflatedData.indices).buffer),edgeIndices:new Uint32Array(pako$9.inflate(deflatedData.edgeIndices).buffer),meshPositions:new Uint32Array(pako$9.inflate(deflatedData.meshPositions).buffer),meshIndices:new Uint32Array(pako$9.inflate(deflatedData.meshIndices).buffer),meshEdgesIndices:new Uint32Array(pako$9.inflate(deflatedData.meshEdgesIndices).buffer),meshColors:new Uint8Array(pako$9.inflate(deflatedData.meshColors).buffer),entityIDs:pako$9.inflate(deflatedData.entityIDs,{to:'string'}),entityMeshes:new Uint32Array(pako$9.inflate(deflatedData.entityMeshes).buffer),entityIsObjects:new Uint8Array(pako$9.inflate(deflatedData.entityIsObjects).buffer),positionsDecodeMatrix:new Float32Array(pako$9.inflate(deflatedData.positionsDecodeMatrix).buffer),entityMeshIds:new Uint32Array(pako$9.inflate(deflatedData.entityMeshIds).buffer),entityMatrices:new Float32Array(pako$9.inflate(deflatedData.entityMatrices).buffer),entityUsesInstancing:new Uint8Array(pako$9.inflate(deflatedData.entityUsesInstancing).buffer)};}var decompressColor$a=function(){var color2=new Float32Array(3);return function(color){color2[0]=color[0]/255.0;color2[1]=color[1]/255.0;color2[2]=color[2]/255.0;return color2;};}();function load$a(viewer,options,inflatedData,sceneModel,metaModel,manifestCtx){var modelPartId=manifestCtx.getNextId();sceneModel.positionsCompression="precompressed";sceneModel.normalsCompression="precompressed";var positions=inflatedData.positions;var normals=inflatedData.normals;var indices=inflatedData.indices;var edgeIndices=inflatedData.edgeIndices;var meshPositions=inflatedData.meshPositions;var meshIndices=inflatedData.meshIndices;var meshEdgesIndices=inflatedData.meshEdgesIndices;var meshColors=inflatedData.meshColors;var entityIDs=JSON.parse(inflatedData.entityIDs);var entityMeshes=inflatedData.entityMeshes;var entityIsObjects=inflatedData.entityIsObjects;var entityMeshIds=inflatedData.entityMeshIds;var entityMatrices=inflatedData.entityMatrices;var entityUsesInstancing=inflatedData.entityUsesInstancing;var numMeshes=meshPositions.length;var numEntities=entityMeshes.length;var alreadyCreatedGeometries={};for(var _i358=0;_i358<numEntities;_i358++){var xktEntityId=entityIDs[_i358];var entityId=options.globalizeObjectIds?math.globalizeObjectId(sceneModel.id,xktEntityId):xktEntityId;var metaObject=viewer.metaScene.metaObjects[entityId];var entityDefaults={};var meshDefaults={};var entityMatrix=entityMatrices.subarray(_i358*16,_i358*16+16);if(metaObject){if(options.excludeTypesMap&&metaObject.type&&options.excludeTypesMap[metaObject.type]){continue;}if(options.includeTypesMap&&metaObject.type&&!options.includeTypesMap[metaObject.type]){continue;}var props=options.objectDefaults?options.objectDefaults[metaObject.type]||options.objectDefaults["DEFAULT"]:null;if(props){if(props.visible===false){entityDefaults.visible=false;}if(props.pickable===false){entityDefaults.pickable=false;}if(props.colorize){meshDefaults.color=props.colorize;}if(props.opacity!==undefined&&props.opacity!==null){meshDefaults.opacity=props.opacity;}}}else{if(options.excludeUnclassifiedObjects){continue;}}var lastEntity=_i358===numEntities-1;var meshIds=[];for(var j=entityMeshes[_i358],jlen=lastEntity?entityMeshIds.length:entityMeshes[_i358+1];j<jlen;j++){var jj=entityMeshIds[j];var lastMesh=jj===numMeshes-1;var meshId=manifestCtx.getNextId();var _color9=decompressColor$a(meshColors.subarray(jj*4,jj*4+3));var _opacity2=meshColors[jj*4+3]/255.0;var tmpPositions=positions.subarray(meshPositions[jj],lastMesh?positions.length:meshPositions[jj+1]);var tmpNormals=normals.subarray(meshPositions[jj],lastMesh?positions.length:meshPositions[jj+1]);var tmpIndices=indices.subarray(meshIndices[jj],lastMesh?indices.length:meshIndices[jj+1]);var tmpEdgeIndices=edgeIndices.subarray(meshEdgesIndices[jj],lastMesh?edgeIndices.length:meshEdgesIndices[jj+1]);if(entityUsesInstancing[_i358]===1){var geometryId="".concat(modelPartId,".geometry.").concat(meshId,".").concat(jj);if(!(geometryId in alreadyCreatedGeometries)){sceneModel.createGeometry({id:geometryId,positionsCompressed:tmpPositions,normalsCompressed:tmpNormals,indices:tmpIndices,edgeIndices:tmpEdgeIndices,primitive:"triangles",positionsDecodeMatrix:inflatedData.positionsDecodeMatrix});alreadyCreatedGeometries[geometryId]=true;}sceneModel.createMesh(utils.apply(meshDefaults,{id:meshId,color:_color9,opacity:_opacity2,matrix:entityMatrix,geometryId:geometryId}));meshIds.push(meshId);}else{sceneModel.createMesh(utils.apply(meshDefaults,{id:meshId,primitive:"triangles",positionsCompressed:tmpPositions,normalsCompressed:tmpNormals,indices:tmpIndices,edgeIndices:tmpEdgeIndices,positionsDecodeMatrix:inflatedData.positionsDecodeMatrix,color:_color9,opacity:_opacity2}));meshIds.push(meshId);}}if(meshIds.length){sceneModel.createEntity(utils.apply(entityDefaults,{id:entityId,isObject:entityIsObjects[_i358]===1,meshIds:meshIds}));}}}/** @private */var ParserV2={version:2,parse:function parse(viewer,options,elements,sceneModel,metaModel,manifestCtx){var deflatedData=extract$9(elements);var inflatedData=inflate$9(deflatedData);load$a(viewer,options,inflatedData,sceneModel,metaModel,manifestCtx);}};/*
28873
+ pako$9=pako$9["default"];}function extract$9(elements){return{positions:elements[0],normals:elements[1],indices:elements[2],edgeIndices:elements[3],meshPositions:elements[4],meshIndices:elements[5],meshEdgesIndices:elements[6],meshColors:elements[7],entityIDs:elements[8],entityMeshes:elements[9],entityIsObjects:elements[10],positionsDecodeMatrix:elements[11],entityMeshIds:elements[12],entityMatrices:elements[13],entityUsesInstancing:elements[14]};}function inflate$9(deflatedData){return{positions:new Uint16Array(pako$9.inflate(deflatedData.positions).buffer),normals:new Int8Array(pako$9.inflate(deflatedData.normals).buffer),indices:new Uint32Array(pako$9.inflate(deflatedData.indices).buffer),edgeIndices:new Uint32Array(pako$9.inflate(deflatedData.edgeIndices).buffer),meshPositions:new Uint32Array(pako$9.inflate(deflatedData.meshPositions).buffer),meshIndices:new Uint32Array(pako$9.inflate(deflatedData.meshIndices).buffer),meshEdgesIndices:new Uint32Array(pako$9.inflate(deflatedData.meshEdgesIndices).buffer),meshColors:new Uint8Array(pako$9.inflate(deflatedData.meshColors).buffer),entityIDs:pako$9.inflate(deflatedData.entityIDs,{to:'string'}),entityMeshes:new Uint32Array(pako$9.inflate(deflatedData.entityMeshes).buffer),entityIsObjects:new Uint8Array(pako$9.inflate(deflatedData.entityIsObjects).buffer),positionsDecodeMatrix:new Float32Array(pako$9.inflate(deflatedData.positionsDecodeMatrix).buffer),entityMeshIds:new Uint32Array(pako$9.inflate(deflatedData.entityMeshIds).buffer),entityMatrices:new Float32Array(pako$9.inflate(deflatedData.entityMatrices).buffer),entityUsesInstancing:new Uint8Array(pako$9.inflate(deflatedData.entityUsesInstancing).buffer)};}var decompressColor$a=function(){var color2=new Float32Array(3);return function(color){color2[0]=color[0]/255.0;color2[1]=color[1]/255.0;color2[2]=color[2]/255.0;return color2;};}();function load$a(viewer,options,inflatedData,sceneModel,metaModel,manifestCtx){var modelPartId=manifestCtx.getNextId();sceneModel.positionsCompression="precompressed";sceneModel.normalsCompression="precompressed";var positions=inflatedData.positions;var normals=inflatedData.normals;var indices=inflatedData.indices;var edgeIndices=inflatedData.edgeIndices;var meshPositions=inflatedData.meshPositions;var meshIndices=inflatedData.meshIndices;var meshEdgesIndices=inflatedData.meshEdgesIndices;var meshColors=inflatedData.meshColors;var entityIDs=JSON.parse(inflatedData.entityIDs);var entityMeshes=inflatedData.entityMeshes;var entityIsObjects=inflatedData.entityIsObjects;var entityMeshIds=inflatedData.entityMeshIds;var entityMatrices=inflatedData.entityMatrices;var entityUsesInstancing=inflatedData.entityUsesInstancing;var numMeshes=meshPositions.length;var numEntities=entityMeshes.length;var alreadyCreatedGeometries={};for(var _i360=0;_i360<numEntities;_i360++){var xktEntityId=entityIDs[_i360];var entityId=options.globalizeObjectIds?math.globalizeObjectId(sceneModel.id,xktEntityId):xktEntityId;var metaObject=viewer.metaScene.metaObjects[entityId];var entityDefaults={};var meshDefaults={};var entityMatrix=entityMatrices.subarray(_i360*16,_i360*16+16);if(metaObject){if(options.excludeTypesMap&&metaObject.type&&options.excludeTypesMap[metaObject.type]){continue;}if(options.includeTypesMap&&metaObject.type&&!options.includeTypesMap[metaObject.type]){continue;}var props=options.objectDefaults?options.objectDefaults[metaObject.type]||options.objectDefaults["DEFAULT"]:null;if(props){if(props.visible===false){entityDefaults.visible=false;}if(props.pickable===false){entityDefaults.pickable=false;}if(props.colorize){meshDefaults.color=props.colorize;}if(props.opacity!==undefined&&props.opacity!==null){meshDefaults.opacity=props.opacity;}}}else{if(options.excludeUnclassifiedObjects){continue;}}var lastEntity=_i360===numEntities-1;var meshIds=[];for(var j=entityMeshes[_i360],jlen=lastEntity?entityMeshIds.length:entityMeshes[_i360+1];j<jlen;j++){var jj=entityMeshIds[j];var lastMesh=jj===numMeshes-1;var meshId=manifestCtx.getNextId();var _color9=decompressColor$a(meshColors.subarray(jj*4,jj*4+3));var _opacity2=meshColors[jj*4+3]/255.0;var tmpPositions=positions.subarray(meshPositions[jj],lastMesh?positions.length:meshPositions[jj+1]);var tmpNormals=normals.subarray(meshPositions[jj],lastMesh?positions.length:meshPositions[jj+1]);var tmpIndices=indices.subarray(meshIndices[jj],lastMesh?indices.length:meshIndices[jj+1]);var tmpEdgeIndices=edgeIndices.subarray(meshEdgesIndices[jj],lastMesh?edgeIndices.length:meshEdgesIndices[jj+1]);if(entityUsesInstancing[_i360]===1){var geometryId="".concat(modelPartId,".geometry.").concat(meshId,".").concat(jj);if(!(geometryId in alreadyCreatedGeometries)){sceneModel.createGeometry({id:geometryId,positionsCompressed:tmpPositions,normalsCompressed:tmpNormals,indices:tmpIndices,edgeIndices:tmpEdgeIndices,primitive:"triangles",positionsDecodeMatrix:inflatedData.positionsDecodeMatrix});alreadyCreatedGeometries[geometryId]=true;}sceneModel.createMesh(utils.apply(meshDefaults,{id:meshId,color:_color9,opacity:_opacity2,matrix:entityMatrix,geometryId:geometryId}));meshIds.push(meshId);}else{sceneModel.createMesh(utils.apply(meshDefaults,{id:meshId,primitive:"triangles",positionsCompressed:tmpPositions,normalsCompressed:tmpNormals,indices:tmpIndices,edgeIndices:tmpEdgeIndices,positionsDecodeMatrix:inflatedData.positionsDecodeMatrix,color:_color9,opacity:_opacity2}));meshIds.push(meshId);}}if(meshIds.length){sceneModel.createEntity(utils.apply(entityDefaults,{id:entityId,isObject:entityIsObjects[_i360]===1,meshIds:meshIds}));}}}/** @private */var ParserV2={version:2,parse:function parse(viewer,options,elements,sceneModel,metaModel,manifestCtx){var deflatedData=extract$9(elements);var inflatedData=inflate$9(deflatedData);load$a(viewer,options,inflatedData,sceneModel,metaModel,manifestCtx);}};/*
28865
28874
 
28866
28875
  Parser for .XKT Format V3
28867
28876
 
28868
28877
  .XKT specifications: https://github.com/xeokit/xeokit-sdk/wiki/XKT-Format
28869
28878
 
28870
28879
  */var pako$8=window.pako||p;if(!pako$8.inflate){// See https://github.com/nodeca/pako/issues/97
28871
- pako$8=pako$8["default"];}function extract$8(elements){return{positions:elements[0],normals:elements[1],indices:elements[2],edgeIndices:elements[3],meshPositions:elements[4],meshIndices:elements[5],meshEdgesIndices:elements[6],meshColors:elements[7],entityIDs:elements[8],entityMeshes:elements[9],entityIsObjects:elements[10],instancedPositionsDecodeMatrix:elements[11],batchedPositionsDecodeMatrix:elements[12],entityMeshIds:elements[13],entityMatrices:elements[14],entityUsesInstancing:elements[15]};}function inflate$8(deflatedData){return{positions:new Uint16Array(pako$8.inflate(deflatedData.positions).buffer),normals:new Int8Array(pako$8.inflate(deflatedData.normals).buffer),indices:new Uint32Array(pako$8.inflate(deflatedData.indices).buffer),edgeIndices:new Uint32Array(pako$8.inflate(deflatedData.edgeIndices).buffer),meshPositions:new Uint32Array(pako$8.inflate(deflatedData.meshPositions).buffer),meshIndices:new Uint32Array(pako$8.inflate(deflatedData.meshIndices).buffer),meshEdgesIndices:new Uint32Array(pako$8.inflate(deflatedData.meshEdgesIndices).buffer),meshColors:new Uint8Array(pako$8.inflate(deflatedData.meshColors).buffer),entityIDs:pako$8.inflate(deflatedData.entityIDs,{to:'string'}),entityMeshes:new Uint32Array(pako$8.inflate(deflatedData.entityMeshes).buffer),entityIsObjects:new Uint8Array(pako$8.inflate(deflatedData.entityIsObjects).buffer),instancedPositionsDecodeMatrix:new Float32Array(pako$8.inflate(deflatedData.instancedPositionsDecodeMatrix).buffer),batchedPositionsDecodeMatrix:new Float32Array(pako$8.inflate(deflatedData.batchedPositionsDecodeMatrix).buffer),entityMeshIds:new Uint32Array(pako$8.inflate(deflatedData.entityMeshIds).buffer),entityMatrices:new Float32Array(pako$8.inflate(deflatedData.entityMatrices).buffer),entityUsesInstancing:new Uint8Array(pako$8.inflate(deflatedData.entityUsesInstancing).buffer)};}var decompressColor$9=function(){var color2=new Float32Array(3);return function(color){color2[0]=color[0]/255.0;color2[1]=color[1]/255.0;color2[2]=color[2]/255.0;return color2;};}();function load$9(viewer,options,inflatedData,sceneModel,metaModel,manifestCtx){var modelPartId=manifestCtx.getNextId();sceneModel.positionsCompression="precompressed";sceneModel.normalsCompression="precompressed";var positions=inflatedData.positions;var normals=inflatedData.normals;var indices=inflatedData.indices;var edgeIndices=inflatedData.edgeIndices;var meshPositions=inflatedData.meshPositions;var meshIndices=inflatedData.meshIndices;var meshEdgesIndices=inflatedData.meshEdgesIndices;var meshColors=inflatedData.meshColors;var entityIDs=JSON.parse(inflatedData.entityIDs);var entityMeshes=inflatedData.entityMeshes;var entityIsObjects=inflatedData.entityIsObjects;var entityMeshIds=inflatedData.entityMeshIds;var entityMatrices=inflatedData.entityMatrices;var entityUsesInstancing=inflatedData.entityUsesInstancing;var numMeshes=meshPositions.length;var numEntities=entityMeshes.length;var _alreadyCreatedGeometries={};for(var _i359=0;_i359<numEntities;_i359++){var xktEntityId=entityIDs[_i359];var entityId=options.globalizeObjectIds?math.globalizeObjectId(sceneModel.id,xktEntityId):xktEntityId;var metaObject=viewer.metaScene.metaObjects[entityId];var entityDefaults={};var meshDefaults={};var entityMatrix=entityMatrices.subarray(_i359*16,_i359*16+16);if(metaObject){if(options.excludeTypesMap&&metaObject.type&&options.excludeTypesMap[metaObject.type]){continue;}if(options.includeTypesMap&&metaObject.type&&!options.includeTypesMap[metaObject.type]){continue;}var props=options.objectDefaults?options.objectDefaults[metaObject.type]||options.objectDefaults["DEFAULT"]:null;if(props){if(props.visible===false){entityDefaults.visible=false;}if(props.pickable===false){entityDefaults.pickable=false;}if(props.colorize){meshDefaults.color=props.colorize;}if(props.opacity!==undefined&&props.opacity!==null){meshDefaults.opacity=props.opacity;}}}else{if(options.excludeUnclassifiedObjects){continue;}}var lastEntity=_i359===numEntities-1;var meshIds=[];for(var j=entityMeshes[_i359],jlen=lastEntity?entityMeshIds.length:entityMeshes[_i359+1];j<jlen;j++){var jj=entityMeshIds[j];var lastMesh=jj===numMeshes-1;var meshId="".concat(modelPartId,".").concat(entityId,".mesh.").concat(jj);var _color10=decompressColor$9(meshColors.subarray(jj*4,jj*4+3));var _opacity3=meshColors[jj*4+3]/255.0;var tmpPositions=positions.subarray(meshPositions[jj],lastMesh?positions.length:meshPositions[jj+1]);var tmpNormals=normals.subarray(meshPositions[jj],lastMesh?positions.length:meshPositions[jj+1]);var tmpIndices=indices.subarray(meshIndices[jj],lastMesh?indices.length:meshIndices[jj+1]);var tmpEdgeIndices=edgeIndices.subarray(meshEdgesIndices[jj],lastMesh?edgeIndices.length:meshEdgesIndices[jj+1]);if(entityUsesInstancing[_i359]===1){var geometryId="".concat(modelPartId,".geometry.").concat(meshId,".").concat(jj);if(!(geometryId in _alreadyCreatedGeometries)){sceneModel.createGeometry({id:geometryId,positionsCompressed:tmpPositions,normalsCompressed:tmpNormals,indices:tmpIndices,edgeIndices:tmpEdgeIndices,primitive:"triangles",positionsDecodeMatrix:inflatedData.instancedPositionsDecodeMatrix});_alreadyCreatedGeometries[geometryId]=true;}sceneModel.createMesh(utils.apply(meshDefaults,{id:meshId,color:_color10,opacity:_opacity3,matrix:entityMatrix,geometryId:geometryId}));meshIds.push(meshId);}else{sceneModel.createMesh(utils.apply(meshDefaults,{id:meshId,primitive:"triangles",positionsCompressed:tmpPositions,normalsCompressed:tmpNormals,indices:tmpIndices,edgeIndices:tmpEdgeIndices,positionsDecodeMatrix:inflatedData.batchedPositionsDecodeMatrix,color:_color10,opacity:_opacity3}));meshIds.push(meshId);}}if(meshIds.length){sceneModel.createEntity(utils.apply(entityDefaults,{id:entityId,isObject:entityIsObjects[_i359]===1,meshIds:meshIds}));}}}/** @private */var ParserV3={version:3,parse:function parse(viewer,options,elements,sceneModel,metaModel,manifestCtx){var deflatedData=extract$8(elements);var inflatedData=inflate$8(deflatedData);load$9(viewer,options,inflatedData,sceneModel,metaModel,manifestCtx);}};/*
28880
+ pako$8=pako$8["default"];}function extract$8(elements){return{positions:elements[0],normals:elements[1],indices:elements[2],edgeIndices:elements[3],meshPositions:elements[4],meshIndices:elements[5],meshEdgesIndices:elements[6],meshColors:elements[7],entityIDs:elements[8],entityMeshes:elements[9],entityIsObjects:elements[10],instancedPositionsDecodeMatrix:elements[11],batchedPositionsDecodeMatrix:elements[12],entityMeshIds:elements[13],entityMatrices:elements[14],entityUsesInstancing:elements[15]};}function inflate$8(deflatedData){return{positions:new Uint16Array(pako$8.inflate(deflatedData.positions).buffer),normals:new Int8Array(pako$8.inflate(deflatedData.normals).buffer),indices:new Uint32Array(pako$8.inflate(deflatedData.indices).buffer),edgeIndices:new Uint32Array(pako$8.inflate(deflatedData.edgeIndices).buffer),meshPositions:new Uint32Array(pako$8.inflate(deflatedData.meshPositions).buffer),meshIndices:new Uint32Array(pako$8.inflate(deflatedData.meshIndices).buffer),meshEdgesIndices:new Uint32Array(pako$8.inflate(deflatedData.meshEdgesIndices).buffer),meshColors:new Uint8Array(pako$8.inflate(deflatedData.meshColors).buffer),entityIDs:pako$8.inflate(deflatedData.entityIDs,{to:'string'}),entityMeshes:new Uint32Array(pako$8.inflate(deflatedData.entityMeshes).buffer),entityIsObjects:new Uint8Array(pako$8.inflate(deflatedData.entityIsObjects).buffer),instancedPositionsDecodeMatrix:new Float32Array(pako$8.inflate(deflatedData.instancedPositionsDecodeMatrix).buffer),batchedPositionsDecodeMatrix:new Float32Array(pako$8.inflate(deflatedData.batchedPositionsDecodeMatrix).buffer),entityMeshIds:new Uint32Array(pako$8.inflate(deflatedData.entityMeshIds).buffer),entityMatrices:new Float32Array(pako$8.inflate(deflatedData.entityMatrices).buffer),entityUsesInstancing:new Uint8Array(pako$8.inflate(deflatedData.entityUsesInstancing).buffer)};}var decompressColor$9=function(){var color2=new Float32Array(3);return function(color){color2[0]=color[0]/255.0;color2[1]=color[1]/255.0;color2[2]=color[2]/255.0;return color2;};}();function load$9(viewer,options,inflatedData,sceneModel,metaModel,manifestCtx){var modelPartId=manifestCtx.getNextId();sceneModel.positionsCompression="precompressed";sceneModel.normalsCompression="precompressed";var positions=inflatedData.positions;var normals=inflatedData.normals;var indices=inflatedData.indices;var edgeIndices=inflatedData.edgeIndices;var meshPositions=inflatedData.meshPositions;var meshIndices=inflatedData.meshIndices;var meshEdgesIndices=inflatedData.meshEdgesIndices;var meshColors=inflatedData.meshColors;var entityIDs=JSON.parse(inflatedData.entityIDs);var entityMeshes=inflatedData.entityMeshes;var entityIsObjects=inflatedData.entityIsObjects;var entityMeshIds=inflatedData.entityMeshIds;var entityMatrices=inflatedData.entityMatrices;var entityUsesInstancing=inflatedData.entityUsesInstancing;var numMeshes=meshPositions.length;var numEntities=entityMeshes.length;var _alreadyCreatedGeometries={};for(var _i361=0;_i361<numEntities;_i361++){var xktEntityId=entityIDs[_i361];var entityId=options.globalizeObjectIds?math.globalizeObjectId(sceneModel.id,xktEntityId):xktEntityId;var metaObject=viewer.metaScene.metaObjects[entityId];var entityDefaults={};var meshDefaults={};var entityMatrix=entityMatrices.subarray(_i361*16,_i361*16+16);if(metaObject){if(options.excludeTypesMap&&metaObject.type&&options.excludeTypesMap[metaObject.type]){continue;}if(options.includeTypesMap&&metaObject.type&&!options.includeTypesMap[metaObject.type]){continue;}var props=options.objectDefaults?options.objectDefaults[metaObject.type]||options.objectDefaults["DEFAULT"]:null;if(props){if(props.visible===false){entityDefaults.visible=false;}if(props.pickable===false){entityDefaults.pickable=false;}if(props.colorize){meshDefaults.color=props.colorize;}if(props.opacity!==undefined&&props.opacity!==null){meshDefaults.opacity=props.opacity;}}}else{if(options.excludeUnclassifiedObjects){continue;}}var lastEntity=_i361===numEntities-1;var meshIds=[];for(var j=entityMeshes[_i361],jlen=lastEntity?entityMeshIds.length:entityMeshes[_i361+1];j<jlen;j++){var jj=entityMeshIds[j];var lastMesh=jj===numMeshes-1;var meshId="".concat(modelPartId,".").concat(entityId,".mesh.").concat(jj);var _color10=decompressColor$9(meshColors.subarray(jj*4,jj*4+3));var _opacity3=meshColors[jj*4+3]/255.0;var tmpPositions=positions.subarray(meshPositions[jj],lastMesh?positions.length:meshPositions[jj+1]);var tmpNormals=normals.subarray(meshPositions[jj],lastMesh?positions.length:meshPositions[jj+1]);var tmpIndices=indices.subarray(meshIndices[jj],lastMesh?indices.length:meshIndices[jj+1]);var tmpEdgeIndices=edgeIndices.subarray(meshEdgesIndices[jj],lastMesh?edgeIndices.length:meshEdgesIndices[jj+1]);if(entityUsesInstancing[_i361]===1){var geometryId="".concat(modelPartId,".geometry.").concat(meshId,".").concat(jj);if(!(geometryId in _alreadyCreatedGeometries)){sceneModel.createGeometry({id:geometryId,positionsCompressed:tmpPositions,normalsCompressed:tmpNormals,indices:tmpIndices,edgeIndices:tmpEdgeIndices,primitive:"triangles",positionsDecodeMatrix:inflatedData.instancedPositionsDecodeMatrix});_alreadyCreatedGeometries[geometryId]=true;}sceneModel.createMesh(utils.apply(meshDefaults,{id:meshId,color:_color10,opacity:_opacity3,matrix:entityMatrix,geometryId:geometryId}));meshIds.push(meshId);}else{sceneModel.createMesh(utils.apply(meshDefaults,{id:meshId,primitive:"triangles",positionsCompressed:tmpPositions,normalsCompressed:tmpNormals,indices:tmpIndices,edgeIndices:tmpEdgeIndices,positionsDecodeMatrix:inflatedData.batchedPositionsDecodeMatrix,color:_color10,opacity:_opacity3}));meshIds.push(meshId);}}if(meshIds.length){sceneModel.createEntity(utils.apply(entityDefaults,{id:entityId,isObject:entityIsObjects[_i361]===1,meshIds:meshIds}));}}}/** @private */var ParserV3={version:3,parse:function parse(viewer,options,elements,sceneModel,metaModel,manifestCtx){var deflatedData=extract$8(elements);var inflatedData=inflate$8(deflatedData);load$9(viewer,options,inflatedData,sceneModel,metaModel,manifestCtx);}};/*
28872
28881
 
28873
28882
  Parser for .XKT Format V4
28874
28883
 
@@ -28942,7 +28951,7 @@ indices:elements[3],edgeIndices:elements[4],// Transform matrices
28942
28951
  matrices:elements[5],reusedGeometriesDecodeMatrix:elements[6],// Geometries
28943
28952
  eachGeometryPrimitiveType:elements[7],eachGeometryPositionsPortion:elements[8],eachGeometryNormalsPortion:elements[9],eachGeometryColorsPortion:elements[10],eachGeometryIndicesPortion:elements[11],eachGeometryEdgeIndicesPortion:elements[12],// Meshes are grouped in runs that are shared by the same entities
28944
28953
  eachMeshGeometriesPortion:elements[13],eachMeshMatricesPortion:elements[14],eachMeshMaterial:elements[15],// Entity elements in the following arrays are grouped in runs that are shared by the same tiles
28945
- eachEntityId:elements[16],eachEntityMeshesPortion:elements[17],eachTileAABB:elements[18],eachTileEntitiesPortion:elements[19]};}function inflate$4(deflatedData){function inflate(array,options){return array.length===0?[]:pako$4.inflate(array,options).buffer;}return{positions:new Uint16Array(inflate(deflatedData.positions)),normals:new Int8Array(inflate(deflatedData.normals)),colors:new Uint8Array(inflate(deflatedData.colors)),indices:new Uint32Array(inflate(deflatedData.indices)),edgeIndices:new Uint32Array(inflate(deflatedData.edgeIndices)),matrices:new Float32Array(inflate(deflatedData.matrices)),reusedGeometriesDecodeMatrix:new Float32Array(inflate(deflatedData.reusedGeometriesDecodeMatrix)),eachGeometryPrimitiveType:new Uint8Array(inflate(deflatedData.eachGeometryPrimitiveType)),eachGeometryPositionsPortion:new Uint32Array(inflate(deflatedData.eachGeometryPositionsPortion)),eachGeometryNormalsPortion:new Uint32Array(inflate(deflatedData.eachGeometryNormalsPortion)),eachGeometryColorsPortion:new Uint32Array(inflate(deflatedData.eachGeometryColorsPortion)),eachGeometryIndicesPortion:new Uint32Array(inflate(deflatedData.eachGeometryIndicesPortion)),eachGeometryEdgeIndicesPortion:new Uint32Array(inflate(deflatedData.eachGeometryEdgeIndicesPortion)),eachMeshGeometriesPortion:new Uint32Array(inflate(deflatedData.eachMeshGeometriesPortion)),eachMeshMatricesPortion:new Uint32Array(inflate(deflatedData.eachMeshMatricesPortion)),eachMeshMaterial:new Uint8Array(inflate(deflatedData.eachMeshMaterial)),eachEntityId:pako$4.inflate(deflatedData.eachEntityId,{to:'string'}),eachEntityMeshesPortion:new Uint32Array(inflate(deflatedData.eachEntityMeshesPortion)),eachTileAABB:new Float64Array(inflate(deflatedData.eachTileAABB)),eachTileEntitiesPortion:new Uint32Array(inflate(deflatedData.eachTileEntitiesPortion))};}var decompressColor$5=function(){var floatColor=new Float32Array(3);return function(intColor){floatColor[0]=intColor[0]/255.0;floatColor[1]=intColor[1]/255.0;floatColor[2]=intColor[2]/255.0;return floatColor;};}();function convertColorsRGBToRGBA$1(colorsRGB){var colorsRGBA=[];for(var _i360=0,len=colorsRGB.length;_i360<len;_i360+=3){colorsRGBA.push(colorsRGB[_i360]);colorsRGBA.push(colorsRGB[_i360+1]);colorsRGBA.push(colorsRGB[_i360+2]);colorsRGBA.push(1.0);}return colorsRGBA;}function load$5(viewer,options,inflatedData,sceneModel,metaModel,manifestCtx){var modelPartId=manifestCtx.getNextId();var positions=inflatedData.positions;var normals=inflatedData.normals;var colors=inflatedData.colors;var indices=inflatedData.indices;var edgeIndices=inflatedData.edgeIndices;var matrices=inflatedData.matrices;var reusedGeometriesDecodeMatrix=inflatedData.reusedGeometriesDecodeMatrix;var eachGeometryPrimitiveType=inflatedData.eachGeometryPrimitiveType;var eachGeometryPositionsPortion=inflatedData.eachGeometryPositionsPortion;var eachGeometryNormalsPortion=inflatedData.eachGeometryNormalsPortion;var eachGeometryColorsPortion=inflatedData.eachGeometryColorsPortion;var eachGeometryIndicesPortion=inflatedData.eachGeometryIndicesPortion;var eachGeometryEdgeIndicesPortion=inflatedData.eachGeometryEdgeIndicesPortion;var eachMeshGeometriesPortion=inflatedData.eachMeshGeometriesPortion;var eachMeshMatricesPortion=inflatedData.eachMeshMatricesPortion;var eachMeshMaterial=inflatedData.eachMeshMaterial;var eachEntityId=JSON.parse(inflatedData.eachEntityId);var eachEntityMeshesPortion=inflatedData.eachEntityMeshesPortion;var eachTileAABB=inflatedData.eachTileAABB;var eachTileEntitiesPortion=inflatedData.eachTileEntitiesPortion;var numGeometries=eachGeometryPositionsPortion.length;var numMeshes=eachMeshGeometriesPortion.length;var numEntities=eachEntityId.length;var numTiles=eachTileEntitiesPortion.length;// Count instances of each geometry
28954
+ eachEntityId:elements[16],eachEntityMeshesPortion:elements[17],eachTileAABB:elements[18],eachTileEntitiesPortion:elements[19]};}function inflate$4(deflatedData){function inflate(array,options){return array.length===0?[]:pako$4.inflate(array,options).buffer;}return{positions:new Uint16Array(inflate(deflatedData.positions)),normals:new Int8Array(inflate(deflatedData.normals)),colors:new Uint8Array(inflate(deflatedData.colors)),indices:new Uint32Array(inflate(deflatedData.indices)),edgeIndices:new Uint32Array(inflate(deflatedData.edgeIndices)),matrices:new Float32Array(inflate(deflatedData.matrices)),reusedGeometriesDecodeMatrix:new Float32Array(inflate(deflatedData.reusedGeometriesDecodeMatrix)),eachGeometryPrimitiveType:new Uint8Array(inflate(deflatedData.eachGeometryPrimitiveType)),eachGeometryPositionsPortion:new Uint32Array(inflate(deflatedData.eachGeometryPositionsPortion)),eachGeometryNormalsPortion:new Uint32Array(inflate(deflatedData.eachGeometryNormalsPortion)),eachGeometryColorsPortion:new Uint32Array(inflate(deflatedData.eachGeometryColorsPortion)),eachGeometryIndicesPortion:new Uint32Array(inflate(deflatedData.eachGeometryIndicesPortion)),eachGeometryEdgeIndicesPortion:new Uint32Array(inflate(deflatedData.eachGeometryEdgeIndicesPortion)),eachMeshGeometriesPortion:new Uint32Array(inflate(deflatedData.eachMeshGeometriesPortion)),eachMeshMatricesPortion:new Uint32Array(inflate(deflatedData.eachMeshMatricesPortion)),eachMeshMaterial:new Uint8Array(inflate(deflatedData.eachMeshMaterial)),eachEntityId:pako$4.inflate(deflatedData.eachEntityId,{to:'string'}),eachEntityMeshesPortion:new Uint32Array(inflate(deflatedData.eachEntityMeshesPortion)),eachTileAABB:new Float64Array(inflate(deflatedData.eachTileAABB)),eachTileEntitiesPortion:new Uint32Array(inflate(deflatedData.eachTileEntitiesPortion))};}var decompressColor$5=function(){var floatColor=new Float32Array(3);return function(intColor){floatColor[0]=intColor[0]/255.0;floatColor[1]=intColor[1]/255.0;floatColor[2]=intColor[2]/255.0;return floatColor;};}();function convertColorsRGBToRGBA$1(colorsRGB){var colorsRGBA=[];for(var _i362=0,len=colorsRGB.length;_i362<len;_i362+=3){colorsRGBA.push(colorsRGB[_i362]);colorsRGBA.push(colorsRGB[_i362+1]);colorsRGBA.push(colorsRGB[_i362+2]);colorsRGBA.push(1.0);}return colorsRGBA;}function load$5(viewer,options,inflatedData,sceneModel,metaModel,manifestCtx){var modelPartId=manifestCtx.getNextId();var positions=inflatedData.positions;var normals=inflatedData.normals;var colors=inflatedData.colors;var indices=inflatedData.indices;var edgeIndices=inflatedData.edgeIndices;var matrices=inflatedData.matrices;var reusedGeometriesDecodeMatrix=inflatedData.reusedGeometriesDecodeMatrix;var eachGeometryPrimitiveType=inflatedData.eachGeometryPrimitiveType;var eachGeometryPositionsPortion=inflatedData.eachGeometryPositionsPortion;var eachGeometryNormalsPortion=inflatedData.eachGeometryNormalsPortion;var eachGeometryColorsPortion=inflatedData.eachGeometryColorsPortion;var eachGeometryIndicesPortion=inflatedData.eachGeometryIndicesPortion;var eachGeometryEdgeIndicesPortion=inflatedData.eachGeometryEdgeIndicesPortion;var eachMeshGeometriesPortion=inflatedData.eachMeshGeometriesPortion;var eachMeshMatricesPortion=inflatedData.eachMeshMatricesPortion;var eachMeshMaterial=inflatedData.eachMeshMaterial;var eachEntityId=JSON.parse(inflatedData.eachEntityId);var eachEntityMeshesPortion=inflatedData.eachEntityMeshesPortion;var eachTileAABB=inflatedData.eachTileAABB;var eachTileEntitiesPortion=inflatedData.eachTileEntitiesPortion;var numGeometries=eachGeometryPositionsPortion.length;var numMeshes=eachMeshGeometriesPortion.length;var numEntities=eachEntityId.length;var numTiles=eachTileEntitiesPortion.length;// Count instances of each geometry
28946
28955
  var geometryReuseCounts=new Uint32Array(numGeometries);for(var meshIndex=0;meshIndex<numMeshes;meshIndex++){var geometryIndex=eachMeshGeometriesPortion[meshIndex];if(geometryReuseCounts[geometryIndex]!==undefined){geometryReuseCounts[geometryIndex]++;}else{geometryReuseCounts[geometryIndex]=1;}}// Iterate over tiles
28947
28956
  var tileCenter=math.vec3();var rtcAABB=math.AABB3();for(var tileIndex=0;tileIndex<numTiles;tileIndex++){var lastTileIndex=numTiles-1;var atLastTile=tileIndex===lastTileIndex;var firstTileEntityIndex=eachTileEntitiesPortion[tileIndex];var lastTileEntityIndex=atLastTile?numEntities:eachTileEntitiesPortion[tileIndex+1];var tileAABBIndex=tileIndex*6;var tileAABB=eachTileAABB.subarray(tileAABBIndex,tileAABBIndex+6);math.getAABB3Center(tileAABB,tileCenter);rtcAABB[0]=tileAABB[0]-tileCenter[0];rtcAABB[1]=tileAABB[1]-tileCenter[1];rtcAABB[2]=tileAABB[2]-tileCenter[2];rtcAABB[3]=tileAABB[3]-tileCenter[0];rtcAABB[4]=tileAABB[4]-tileCenter[1];rtcAABB[5]=tileAABB[5]-tileCenter[2];var tileDecodeMatrix=geometryCompressionUtils.createPositionsDecodeMatrix(rtcAABB);var geometryCreated={};// Iterate over each tile's entities
28948
28957
  for(var tileEntityIndex=firstTileEntityIndex;tileEntityIndex<lastTileEntityIndex;tileEntityIndex++){var xktEntityId=eachEntityId[tileEntityIndex];var entityId=options.globalizeObjectIds?math.globalizeObjectId(sceneModel.id,xktEntityId):xktEntityId;var _lastTileEntityIndex2=numEntities-1;var atLastTileEntity=tileEntityIndex===_lastTileEntityIndex2;var firstMeshIndex=eachEntityMeshesPortion[tileEntityIndex];var lastMeshIndex=atLastTileEntity?eachMeshGeometriesPortion.length:eachEntityMeshesPortion[tileEntityIndex+1];var meshIds=[];var metaObject=viewer.metaScene.metaObjects[entityId];var entityDefaults={};var meshDefaults={};if(metaObject){// Mask loading of object types
@@ -28961,7 +28970,7 @@ types:elements[0],eachMetaObjectId:elements[1],eachMetaObjectType:elements[2],ea
28961
28970
  matrices:elements[10],reusedGeometriesDecodeMatrix:elements[11],// Geometries
28962
28971
  eachGeometryPrimitiveType:elements[12],eachGeometryPositionsPortion:elements[13],eachGeometryNormalsPortion:elements[14],eachGeometryColorsPortion:elements[15],eachGeometryIndicesPortion:elements[16],eachGeometryEdgeIndicesPortion:elements[17],// Meshes are grouped in runs that are shared by the same entities
28963
28972
  eachMeshGeometriesPortion:elements[18],eachMeshMatricesPortion:elements[19],eachMeshMaterial:elements[20],// Entity elements in the following arrays are grouped in runs that are shared by the same tiles
28964
- eachEntityMetaObject:elements[21],eachEntityMeshesPortion:elements[22],eachTileAABB:elements[23],eachTileEntitiesPortion:elements[24]};}function inflate$3(deflatedData){function inflate(array,options){return array.length===0?[]:pako$3.inflate(array,options).buffer;}return{types:pako$3.inflate(deflatedData.types,{to:'string'}),eachMetaObjectId:pako$3.inflate(deflatedData.eachMetaObjectId,{to:'string'}),eachMetaObjectType:new Uint32Array(inflate(deflatedData.eachMetaObjectType)),eachMetaObjectName:pako$3.inflate(deflatedData.eachMetaObjectName,{to:'string'}),eachMetaObjectParent:new Uint32Array(inflate(deflatedData.eachMetaObjectParent)),positions:new Uint16Array(inflate(deflatedData.positions)),normals:new Int8Array(inflate(deflatedData.normals)),colors:new Uint8Array(inflate(deflatedData.colors)),indices:new Uint32Array(inflate(deflatedData.indices)),edgeIndices:new Uint32Array(inflate(deflatedData.edgeIndices)),matrices:new Float32Array(inflate(deflatedData.matrices)),reusedGeometriesDecodeMatrix:new Float32Array(inflate(deflatedData.reusedGeometriesDecodeMatrix)),eachGeometryPrimitiveType:new Uint8Array(inflate(deflatedData.eachGeometryPrimitiveType)),eachGeometryPositionsPortion:new Uint32Array(inflate(deflatedData.eachGeometryPositionsPortion)),eachGeometryNormalsPortion:new Uint32Array(inflate(deflatedData.eachGeometryNormalsPortion)),eachGeometryColorsPortion:new Uint32Array(inflate(deflatedData.eachGeometryColorsPortion)),eachGeometryIndicesPortion:new Uint32Array(inflate(deflatedData.eachGeometryIndicesPortion)),eachGeometryEdgeIndicesPortion:new Uint32Array(inflate(deflatedData.eachGeometryEdgeIndicesPortion)),eachMeshGeometriesPortion:new Uint32Array(inflate(deflatedData.eachMeshGeometriesPortion)),eachMeshMatricesPortion:new Uint32Array(inflate(deflatedData.eachMeshMatricesPortion)),eachMeshMaterial:new Uint8Array(inflate(deflatedData.eachMeshMaterial)),eachEntityMetaObject:new Uint32Array(inflate(deflatedData.eachEntityMetaObject)),eachEntityMeshesPortion:new Uint32Array(inflate(deflatedData.eachEntityMeshesPortion)),eachTileAABB:new Float64Array(inflate(deflatedData.eachTileAABB)),eachTileEntitiesPortion:new Uint32Array(inflate(deflatedData.eachTileEntitiesPortion))};}var decompressColor$4=function(){var floatColor=new Float32Array(3);return function(intColor){floatColor[0]=intColor[0]/255.0;floatColor[1]=intColor[1]/255.0;floatColor[2]=intColor[2]/255.0;return floatColor;};}();function convertColorsRGBToRGBA(colorsRGB){var colorsRGBA=[];for(var _i361=0,len=colorsRGB.length;_i361<len;_i361+=3){colorsRGBA.push(colorsRGB[_i361]);colorsRGBA.push(colorsRGB[_i361+1]);colorsRGBA.push(colorsRGB[_i361+2]);colorsRGBA.push(1.0);}return colorsRGBA;}function load$4(viewer,options,inflatedData,sceneModel,metaModel,manifestCtx){var modelPartId=manifestCtx.getNextId();var types=JSON.parse(inflatedData.types);var eachMetaObjectId=JSON.parse(inflatedData.eachMetaObjectId);var eachMetaObjectType=inflatedData.eachMetaObjectType;var eachMetaObjectName=JSON.parse(inflatedData.eachMetaObjectName);var eachMetaObjectParent=inflatedData.eachMetaObjectParent;var positions=inflatedData.positions;var normals=inflatedData.normals;var colors=inflatedData.colors;var indices=inflatedData.indices;var edgeIndices=inflatedData.edgeIndices;var matrices=inflatedData.matrices;var reusedGeometriesDecodeMatrix=inflatedData.reusedGeometriesDecodeMatrix;var eachGeometryPrimitiveType=inflatedData.eachGeometryPrimitiveType;var eachGeometryPositionsPortion=inflatedData.eachGeometryPositionsPortion;var eachGeometryNormalsPortion=inflatedData.eachGeometryNormalsPortion;var eachGeometryColorsPortion=inflatedData.eachGeometryColorsPortion;var eachGeometryIndicesPortion=inflatedData.eachGeometryIndicesPortion;var eachGeometryEdgeIndicesPortion=inflatedData.eachGeometryEdgeIndicesPortion;var eachMeshGeometriesPortion=inflatedData.eachMeshGeometriesPortion;var eachMeshMatricesPortion=inflatedData.eachMeshMatricesPortion;var eachMeshMaterial=inflatedData.eachMeshMaterial;var eachEntityMetaObject=inflatedData.eachEntityMetaObject;var eachEntityMeshesPortion=inflatedData.eachEntityMeshesPortion;var eachTileAABB=inflatedData.eachTileAABB;var eachTileEntitiesPortion=inflatedData.eachTileEntitiesPortion;var numMetaObjects=eachMetaObjectId.length;var numGeometries=eachGeometryPositionsPortion.length;var numMeshes=eachMeshGeometriesPortion.length;var numEntities=eachEntityMetaObject.length;var numTiles=eachTileEntitiesPortion.length;if(metaModel){var metaModelData={metaObjects:[]};for(var metaObjectIndex=0;metaObjectIndex<numMetaObjects;metaObjectIndex++){var metaObjectId=eachMetaObjectId[metaObjectIndex];var typeIndex=eachMetaObjectType[metaObjectIndex];var metaObjectType=types[typeIndex]||"default";var metaObjectName=eachMetaObjectName[metaObjectIndex];var metaObjectParentIndex=eachMetaObjectParent[metaObjectIndex];var metaObjectParentId=metaObjectParentIndex!==metaObjectIndex?eachMetaObjectId[metaObjectParentIndex]:null;metaModelData.metaObjects.push({id:metaObjectId,type:metaObjectType,name:metaObjectName,parent:metaObjectParentId});}metaModel.loadData(metaModelData,{includeTypes:options.includeTypes,excludeTypes:options.excludeTypes,globalizeObjectIds:options.globalizeObjectIds});}// Count instances of each geometry
28973
+ eachEntityMetaObject:elements[21],eachEntityMeshesPortion:elements[22],eachTileAABB:elements[23],eachTileEntitiesPortion:elements[24]};}function inflate$3(deflatedData){function inflate(array,options){return array.length===0?[]:pako$3.inflate(array,options).buffer;}return{types:pako$3.inflate(deflatedData.types,{to:'string'}),eachMetaObjectId:pako$3.inflate(deflatedData.eachMetaObjectId,{to:'string'}),eachMetaObjectType:new Uint32Array(inflate(deflatedData.eachMetaObjectType)),eachMetaObjectName:pako$3.inflate(deflatedData.eachMetaObjectName,{to:'string'}),eachMetaObjectParent:new Uint32Array(inflate(deflatedData.eachMetaObjectParent)),positions:new Uint16Array(inflate(deflatedData.positions)),normals:new Int8Array(inflate(deflatedData.normals)),colors:new Uint8Array(inflate(deflatedData.colors)),indices:new Uint32Array(inflate(deflatedData.indices)),edgeIndices:new Uint32Array(inflate(deflatedData.edgeIndices)),matrices:new Float32Array(inflate(deflatedData.matrices)),reusedGeometriesDecodeMatrix:new Float32Array(inflate(deflatedData.reusedGeometriesDecodeMatrix)),eachGeometryPrimitiveType:new Uint8Array(inflate(deflatedData.eachGeometryPrimitiveType)),eachGeometryPositionsPortion:new Uint32Array(inflate(deflatedData.eachGeometryPositionsPortion)),eachGeometryNormalsPortion:new Uint32Array(inflate(deflatedData.eachGeometryNormalsPortion)),eachGeometryColorsPortion:new Uint32Array(inflate(deflatedData.eachGeometryColorsPortion)),eachGeometryIndicesPortion:new Uint32Array(inflate(deflatedData.eachGeometryIndicesPortion)),eachGeometryEdgeIndicesPortion:new Uint32Array(inflate(deflatedData.eachGeometryEdgeIndicesPortion)),eachMeshGeometriesPortion:new Uint32Array(inflate(deflatedData.eachMeshGeometriesPortion)),eachMeshMatricesPortion:new Uint32Array(inflate(deflatedData.eachMeshMatricesPortion)),eachMeshMaterial:new Uint8Array(inflate(deflatedData.eachMeshMaterial)),eachEntityMetaObject:new Uint32Array(inflate(deflatedData.eachEntityMetaObject)),eachEntityMeshesPortion:new Uint32Array(inflate(deflatedData.eachEntityMeshesPortion)),eachTileAABB:new Float64Array(inflate(deflatedData.eachTileAABB)),eachTileEntitiesPortion:new Uint32Array(inflate(deflatedData.eachTileEntitiesPortion))};}var decompressColor$4=function(){var floatColor=new Float32Array(3);return function(intColor){floatColor[0]=intColor[0]/255.0;floatColor[1]=intColor[1]/255.0;floatColor[2]=intColor[2]/255.0;return floatColor;};}();function convertColorsRGBToRGBA(colorsRGB){var colorsRGBA=[];for(var _i363=0,len=colorsRGB.length;_i363<len;_i363+=3){colorsRGBA.push(colorsRGB[_i363]);colorsRGBA.push(colorsRGB[_i363+1]);colorsRGBA.push(colorsRGB[_i363+2]);colorsRGBA.push(1.0);}return colorsRGBA;}function load$4(viewer,options,inflatedData,sceneModel,metaModel,manifestCtx){var modelPartId=manifestCtx.getNextId();var types=JSON.parse(inflatedData.types);var eachMetaObjectId=JSON.parse(inflatedData.eachMetaObjectId);var eachMetaObjectType=inflatedData.eachMetaObjectType;var eachMetaObjectName=JSON.parse(inflatedData.eachMetaObjectName);var eachMetaObjectParent=inflatedData.eachMetaObjectParent;var positions=inflatedData.positions;var normals=inflatedData.normals;var colors=inflatedData.colors;var indices=inflatedData.indices;var edgeIndices=inflatedData.edgeIndices;var matrices=inflatedData.matrices;var reusedGeometriesDecodeMatrix=inflatedData.reusedGeometriesDecodeMatrix;var eachGeometryPrimitiveType=inflatedData.eachGeometryPrimitiveType;var eachGeometryPositionsPortion=inflatedData.eachGeometryPositionsPortion;var eachGeometryNormalsPortion=inflatedData.eachGeometryNormalsPortion;var eachGeometryColorsPortion=inflatedData.eachGeometryColorsPortion;var eachGeometryIndicesPortion=inflatedData.eachGeometryIndicesPortion;var eachGeometryEdgeIndicesPortion=inflatedData.eachGeometryEdgeIndicesPortion;var eachMeshGeometriesPortion=inflatedData.eachMeshGeometriesPortion;var eachMeshMatricesPortion=inflatedData.eachMeshMatricesPortion;var eachMeshMaterial=inflatedData.eachMeshMaterial;var eachEntityMetaObject=inflatedData.eachEntityMetaObject;var eachEntityMeshesPortion=inflatedData.eachEntityMeshesPortion;var eachTileAABB=inflatedData.eachTileAABB;var eachTileEntitiesPortion=inflatedData.eachTileEntitiesPortion;var numMetaObjects=eachMetaObjectId.length;var numGeometries=eachGeometryPositionsPortion.length;var numMeshes=eachMeshGeometriesPortion.length;var numEntities=eachEntityMetaObject.length;var numTiles=eachTileEntitiesPortion.length;if(metaModel){var metaModelData={metaObjects:[]};for(var metaObjectIndex=0;metaObjectIndex<numMetaObjects;metaObjectIndex++){var metaObjectId=eachMetaObjectId[metaObjectIndex];var typeIndex=eachMetaObjectType[metaObjectIndex];var metaObjectType=types[typeIndex]||"default";var metaObjectName=eachMetaObjectName[metaObjectIndex];var metaObjectParentIndex=eachMetaObjectParent[metaObjectIndex];var metaObjectParentId=metaObjectParentIndex!==metaObjectIndex?eachMetaObjectId[metaObjectParentIndex]:null;metaModelData.metaObjects.push({id:metaObjectId,type:metaObjectType,name:metaObjectName,parent:metaObjectParentId});}metaModel.loadData(metaModelData,{includeTypes:options.includeTypes,excludeTypes:options.excludeTypes,globalizeObjectIds:options.globalizeObjectIds});}// Count instances of each geometry
28965
28974
  var geometryReuseCounts=new Uint32Array(numGeometries);for(var meshIndex=0;meshIndex<numMeshes;meshIndex++){var geometryIndex=eachMeshGeometriesPortion[meshIndex];if(geometryReuseCounts[geometryIndex]!==undefined){geometryReuseCounts[geometryIndex]++;}else{geometryReuseCounts[geometryIndex]=1;}}// Iterate over tiles
28966
28975
  var tileCenter=math.vec3();var rtcAABB=math.AABB3();var geometryArraysCache={};for(var tileIndex=0;tileIndex<numTiles;tileIndex++){var lastTileIndex=numTiles-1;var atLastTile=tileIndex===lastTileIndex;var firstTileEntityIndex=eachTileEntitiesPortion[tileIndex];var lastTileEntityIndex=atLastTile?numEntities:eachTileEntitiesPortion[tileIndex+1];var tileAABBIndex=tileIndex*6;var tileAABB=eachTileAABB.subarray(tileAABBIndex,tileAABBIndex+6);math.getAABB3Center(tileAABB,tileCenter);rtcAABB[0]=tileAABB[0]-tileCenter[0];rtcAABB[1]=tileAABB[1]-tileCenter[1];rtcAABB[2]=tileAABB[2]-tileCenter[2];rtcAABB[3]=tileAABB[3]-tileCenter[0];rtcAABB[4]=tileAABB[4]-tileCenter[1];rtcAABB[5]=tileAABB[5]-tileCenter[2];var tileDecodeMatrix=geometryCompressionUtils.createPositionsDecodeMatrix(rtcAABB);var geometryCreatedInTile={};// Iterate over each tile's entities
28967
28976
  for(var tileEntityIndex=firstTileEntityIndex;tileEntityIndex<lastTileEntityIndex;tileEntityIndex++){var xktMetaObjectIndex=eachEntityMetaObject[tileEntityIndex];var xktMetaObjectId=eachMetaObjectId[xktMetaObjectIndex];var xktEntityId=xktMetaObjectId;var entityId=options.globalizeObjectIds?math.globalizeObjectId(sceneModel.id,xktEntityId):xktEntityId;var _lastTileEntityIndex3=numEntities-1;var atLastTileEntity=tileEntityIndex===_lastTileEntityIndex3;var firstMeshIndex=eachEntityMeshesPortion[tileEntityIndex];var lastMeshIndex=atLastTileEntity?eachMeshGeometriesPortion.length:eachEntityMeshesPortion[tileEntityIndex+1];var meshIds=[];var metaObject=viewer.metaScene.metaObjects[entityId];var entityDefaults={};var meshDefaults={};if(metaObject){// Mask loading of object types
@@ -28970,7 +28979,7 @@ if(options.includeIdsMap&&metaObject.id&&!options.includeIdsMap[metaObject.id]){
28970
28979
  var props=options.objectDefaults?options.objectDefaults[metaObject.type]||options.objectDefaults["DEFAULT"]:null;if(props){if(props.visible===false){entityDefaults.visible=false;}if(props.pickable===false){entityDefaults.pickable=false;}if(props.colorize){meshDefaults.color=props.colorize;}if(props.opacity!==undefined&&props.opacity!==null){meshDefaults.opacity=props.opacity;}if(props.metallic!==undefined&&props.metallic!==null){meshDefaults.metallic=props.metallic;}if(props.roughness!==undefined&&props.roughness!==null){meshDefaults.roughness=props.roughness;}}}else{if(options.excludeUnclassifiedObjects){continue;}}// Iterate each entity's meshes
28971
28980
  for(var _meshIndex2=firstMeshIndex;_meshIndex2<lastMeshIndex;_meshIndex2++){var _geometryIndex2=eachMeshGeometriesPortion[_meshIndex2];var geometryReuseCount=geometryReuseCounts[_geometryIndex2];var isReusedGeometry=geometryReuseCount>1;var atLastGeometry=_geometryIndex2===numGeometries-1;var meshColor=decompressColor$4(eachMeshMaterial.subarray(_meshIndex2*6,_meshIndex2*6+3));var meshOpacity=eachMeshMaterial[_meshIndex2*6+3]/255.0;var meshMetallic=eachMeshMaterial[_meshIndex2*6+4]/255.0;var meshRoughness=eachMeshMaterial[_meshIndex2*6+5]/255.0;var meshId=manifestCtx.getNextId();if(isReusedGeometry){// Create mesh for multi-use geometry - create (or reuse) geometry, create mesh using that geometry
28972
28981
  var meshMatrixIndex=eachMeshMatricesPortion[_meshIndex2];var meshMatrix=matrices.slice(meshMatrixIndex,meshMatrixIndex+16);var geometryId="".concat(modelPartId,"-geometry.").concat(tileIndex,".").concat(_geometryIndex2);// These IDs are local to the SceneModel
28973
- var geometryArrays=geometryArraysCache[geometryId];if(!geometryArrays){geometryArrays={batchThisMesh:!options.reuseGeometries};var primitiveType=eachGeometryPrimitiveType[_geometryIndex2];var geometryValid=false;switch(primitiveType){case 0:geometryArrays.primitiveName="solid";geometryArrays.geometryPositions=positions.subarray(eachGeometryPositionsPortion[_geometryIndex2],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex2+1]);geometryArrays.geometryNormals=normals.subarray(eachGeometryNormalsPortion[_geometryIndex2],atLastGeometry?normals.length:eachGeometryNormalsPortion[_geometryIndex2+1]);geometryArrays.geometryIndices=indices.subarray(eachGeometryIndicesPortion[_geometryIndex2],atLastGeometry?indices.length:eachGeometryIndicesPortion[_geometryIndex2+1]);geometryArrays.geometryEdgeIndices=edgeIndices.subarray(eachGeometryEdgeIndicesPortion[_geometryIndex2],atLastGeometry?edgeIndices.length:eachGeometryEdgeIndicesPortion[_geometryIndex2+1]);geometryValid=geometryArrays.geometryPositions.length>0&&geometryArrays.geometryIndices.length>0;break;case 1:geometryArrays.primitiveName="surface";geometryArrays.geometryPositions=positions.subarray(eachGeometryPositionsPortion[_geometryIndex2],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex2+1]);geometryArrays.geometryNormals=normals.subarray(eachGeometryNormalsPortion[_geometryIndex2],atLastGeometry?normals.length:eachGeometryNormalsPortion[_geometryIndex2+1]);geometryArrays.geometryIndices=indices.subarray(eachGeometryIndicesPortion[_geometryIndex2],atLastGeometry?indices.length:eachGeometryIndicesPortion[_geometryIndex2+1]);geometryArrays.geometryEdgeIndices=edgeIndices.subarray(eachGeometryEdgeIndicesPortion[_geometryIndex2],atLastGeometry?edgeIndices.length:eachGeometryEdgeIndicesPortion[_geometryIndex2+1]);geometryValid=geometryArrays.geometryPositions.length>0&&geometryArrays.geometryIndices.length>0;break;case 2:geometryArrays.primitiveName="points";geometryArrays.geometryPositions=positions.subarray(eachGeometryPositionsPortion[_geometryIndex2],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex2+1]);geometryArrays.geometryColors=convertColorsRGBToRGBA(colors.subarray(eachGeometryColorsPortion[_geometryIndex2],atLastGeometry?colors.length:eachGeometryColorsPortion[_geometryIndex2+1]));geometryValid=geometryArrays.geometryPositions.length>0;break;case 3:geometryArrays.primitiveName="lines";geometryArrays.geometryPositions=positions.subarray(eachGeometryPositionsPortion[_geometryIndex2],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex2+1]);geometryArrays.geometryIndices=indices.subarray(eachGeometryIndicesPortion[_geometryIndex2],atLastGeometry?indices.length:eachGeometryIndicesPortion[_geometryIndex2+1]);geometryValid=geometryArrays.geometryPositions.length>0&&geometryArrays.geometryIndices.length>0;break;default:continue;}if(!geometryValid){geometryArrays=null;}if(geometryArrays){if(geometryArrays.geometryPositions.length>1000);if(geometryArrays.batchThisMesh){geometryArrays.decompressedPositions=new Float32Array(geometryArrays.geometryPositions.length);var geometryPositions=geometryArrays.geometryPositions;var decompressedPositions=geometryArrays.decompressedPositions;for(var _i362=0,len=geometryPositions.length;_i362<len;_i362+=3){decompressedPositions[_i362+0]=geometryPositions[_i362+0]*reusedGeometriesDecodeMatrix[0]+reusedGeometriesDecodeMatrix[12];decompressedPositions[_i362+1]=geometryPositions[_i362+1]*reusedGeometriesDecodeMatrix[5]+reusedGeometriesDecodeMatrix[13];decompressedPositions[_i362+2]=geometryPositions[_i362+2]*reusedGeometriesDecodeMatrix[10]+reusedGeometriesDecodeMatrix[14];}geometryArrays.geometryPositions=null;geometryArraysCache[geometryId]=geometryArrays;}}}if(geometryArrays){if(geometryArrays.batchThisMesh){var _decompressedPositions=geometryArrays.decompressedPositions;var _positions4=new Uint16Array(_decompressedPositions.length);for(var _i363=0,_len46=_decompressedPositions.length;_i363<_len46;_i363+=3){tempVec4a$4[0]=_decompressedPositions[_i363+0];tempVec4a$4[1]=_decompressedPositions[_i363+1];tempVec4a$4[2]=_decompressedPositions[_i363+2];tempVec4a$4[3]=1;math.transformVec4(meshMatrix,tempVec4a$4,tempVec4b$4);geometryCompressionUtils.compressPosition(tempVec4b$4,rtcAABB,tempVec4a$4);_positions4[_i363+0]=tempVec4a$4[0];_positions4[_i363+1]=tempVec4a$4[1];_positions4[_i363+2]=tempVec4a$4[2];}sceneModel.createMesh(utils.apply(meshDefaults,{id:meshId,origin:tileCenter,primitive:geometryArrays.primitiveName,positionsCompressed:_positions4,normalsCompressed:geometryArrays.geometryNormals,colorsCompressed:geometryArrays.geometryColors,indices:geometryArrays.geometryIndices,edgeIndices:geometryArrays.geometryEdgeIndices,positionsDecodeMatrix:tileDecodeMatrix,color:meshColor,metallic:meshMetallic,roughness:meshRoughness,opacity:meshOpacity}));meshIds.push(meshId);}else{if(!geometryCreatedInTile[geometryId]){sceneModel.createGeometry({id:geometryId,primitive:geometryArrays.primitiveName,positionsCompressed:geometryArrays.geometryPositions,normalsCompressed:geometryArrays.geometryNormals,colorsCompressed:geometryArrays.geometryColors,indices:geometryArrays.geometryIndices,edgeIndices:geometryArrays.geometryEdgeIndices,positionsDecodeMatrix:reusedGeometriesDecodeMatrix});geometryCreatedInTile[geometryId]=true;}sceneModel.createMesh(utils.apply(meshDefaults,{id:meshId,geometryId:geometryId,origin:tileCenter,matrix:meshMatrix,color:meshColor,metallic:meshMetallic,roughness:meshRoughness,opacity:meshOpacity}));meshIds.push(meshId);}}}else{var _primitiveType2=eachGeometryPrimitiveType[_geometryIndex2];var primitiveName=void 0;var _geometryPositions2=void 0;var geometryNormals=void 0;var geometryColors=void 0;var geometryIndices=void 0;var geometryEdgeIndices=void 0;var _geometryValid=false;switch(_primitiveType2){case 0:primitiveName="solid";_geometryPositions2=positions.subarray(eachGeometryPositionsPortion[_geometryIndex2],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex2+1]);geometryNormals=normals.subarray(eachGeometryNormalsPortion[_geometryIndex2],atLastGeometry?normals.length:eachGeometryNormalsPortion[_geometryIndex2+1]);geometryIndices=indices.subarray(eachGeometryIndicesPortion[_geometryIndex2],atLastGeometry?indices.length:eachGeometryIndicesPortion[_geometryIndex2+1]);geometryEdgeIndices=edgeIndices.subarray(eachGeometryEdgeIndicesPortion[_geometryIndex2],atLastGeometry?edgeIndices.length:eachGeometryEdgeIndicesPortion[_geometryIndex2+1]);_geometryValid=_geometryPositions2.length>0&&geometryIndices.length>0;break;case 1:primitiveName="surface";_geometryPositions2=positions.subarray(eachGeometryPositionsPortion[_geometryIndex2],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex2+1]);geometryNormals=normals.subarray(eachGeometryNormalsPortion[_geometryIndex2],atLastGeometry?normals.length:eachGeometryNormalsPortion[_geometryIndex2+1]);geometryIndices=indices.subarray(eachGeometryIndicesPortion[_geometryIndex2],atLastGeometry?indices.length:eachGeometryIndicesPortion[_geometryIndex2+1]);geometryEdgeIndices=edgeIndices.subarray(eachGeometryEdgeIndicesPortion[_geometryIndex2],atLastGeometry?edgeIndices.length:eachGeometryEdgeIndicesPortion[_geometryIndex2+1]);_geometryValid=_geometryPositions2.length>0&&geometryIndices.length>0;break;case 2:primitiveName="points";_geometryPositions2=positions.subarray(eachGeometryPositionsPortion[_geometryIndex2],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex2+1]);geometryColors=convertColorsRGBToRGBA(colors.subarray(eachGeometryColorsPortion[_geometryIndex2],atLastGeometry?colors.length:eachGeometryColorsPortion[_geometryIndex2+1]));_geometryValid=_geometryPositions2.length>0;break;case 3:primitiveName="lines";_geometryPositions2=positions.subarray(eachGeometryPositionsPortion[_geometryIndex2],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex2+1]);geometryIndices=indices.subarray(eachGeometryIndicesPortion[_geometryIndex2],atLastGeometry?indices.length:eachGeometryIndicesPortion[_geometryIndex2+1]);_geometryValid=_geometryPositions2.length>0&&geometryIndices.length>0;break;default:continue;}if(_geometryValid){sceneModel.createMesh(utils.apply(meshDefaults,{id:meshId,origin:tileCenter,primitive:primitiveName,positionsCompressed:_geometryPositions2,normalsCompressed:geometryNormals,colorsCompressed:geometryColors,indices:geometryIndices,edgeIndices:geometryEdgeIndices,positionsDecodeMatrix:tileDecodeMatrix,color:meshColor,metallic:meshMetallic,roughness:meshRoughness,opacity:meshOpacity}));meshIds.push(meshId);}}}if(meshIds.length>0){sceneModel.createEntity(utils.apply(entityDefaults,{id:entityId,isObject:true,meshIds:meshIds}));}}}}/** @private */var ParserV8={version:8,parse:function parse(viewer,options,elements,sceneModel,metaModel,manifestCtx){var deflatedData=extract$3(elements);var inflatedData=inflate$3(deflatedData);load$4(viewer,options,inflatedData,sceneModel,metaModel,manifestCtx);}};/*
28982
+ var geometryArrays=geometryArraysCache[geometryId];if(!geometryArrays){geometryArrays={batchThisMesh:!options.reuseGeometries};var primitiveType=eachGeometryPrimitiveType[_geometryIndex2];var geometryValid=false;switch(primitiveType){case 0:geometryArrays.primitiveName="solid";geometryArrays.geometryPositions=positions.subarray(eachGeometryPositionsPortion[_geometryIndex2],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex2+1]);geometryArrays.geometryNormals=normals.subarray(eachGeometryNormalsPortion[_geometryIndex2],atLastGeometry?normals.length:eachGeometryNormalsPortion[_geometryIndex2+1]);geometryArrays.geometryIndices=indices.subarray(eachGeometryIndicesPortion[_geometryIndex2],atLastGeometry?indices.length:eachGeometryIndicesPortion[_geometryIndex2+1]);geometryArrays.geometryEdgeIndices=edgeIndices.subarray(eachGeometryEdgeIndicesPortion[_geometryIndex2],atLastGeometry?edgeIndices.length:eachGeometryEdgeIndicesPortion[_geometryIndex2+1]);geometryValid=geometryArrays.geometryPositions.length>0&&geometryArrays.geometryIndices.length>0;break;case 1:geometryArrays.primitiveName="surface";geometryArrays.geometryPositions=positions.subarray(eachGeometryPositionsPortion[_geometryIndex2],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex2+1]);geometryArrays.geometryNormals=normals.subarray(eachGeometryNormalsPortion[_geometryIndex2],atLastGeometry?normals.length:eachGeometryNormalsPortion[_geometryIndex2+1]);geometryArrays.geometryIndices=indices.subarray(eachGeometryIndicesPortion[_geometryIndex2],atLastGeometry?indices.length:eachGeometryIndicesPortion[_geometryIndex2+1]);geometryArrays.geometryEdgeIndices=edgeIndices.subarray(eachGeometryEdgeIndicesPortion[_geometryIndex2],atLastGeometry?edgeIndices.length:eachGeometryEdgeIndicesPortion[_geometryIndex2+1]);geometryValid=geometryArrays.geometryPositions.length>0&&geometryArrays.geometryIndices.length>0;break;case 2:geometryArrays.primitiveName="points";geometryArrays.geometryPositions=positions.subarray(eachGeometryPositionsPortion[_geometryIndex2],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex2+1]);geometryArrays.geometryColors=convertColorsRGBToRGBA(colors.subarray(eachGeometryColorsPortion[_geometryIndex2],atLastGeometry?colors.length:eachGeometryColorsPortion[_geometryIndex2+1]));geometryValid=geometryArrays.geometryPositions.length>0;break;case 3:geometryArrays.primitiveName="lines";geometryArrays.geometryPositions=positions.subarray(eachGeometryPositionsPortion[_geometryIndex2],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex2+1]);geometryArrays.geometryIndices=indices.subarray(eachGeometryIndicesPortion[_geometryIndex2],atLastGeometry?indices.length:eachGeometryIndicesPortion[_geometryIndex2+1]);geometryValid=geometryArrays.geometryPositions.length>0&&geometryArrays.geometryIndices.length>0;break;default:continue;}if(!geometryValid){geometryArrays=null;}if(geometryArrays){if(geometryArrays.geometryPositions.length>1000);if(geometryArrays.batchThisMesh){geometryArrays.decompressedPositions=new Float32Array(geometryArrays.geometryPositions.length);var geometryPositions=geometryArrays.geometryPositions;var decompressedPositions=geometryArrays.decompressedPositions;for(var _i364=0,len=geometryPositions.length;_i364<len;_i364+=3){decompressedPositions[_i364+0]=geometryPositions[_i364+0]*reusedGeometriesDecodeMatrix[0]+reusedGeometriesDecodeMatrix[12];decompressedPositions[_i364+1]=geometryPositions[_i364+1]*reusedGeometriesDecodeMatrix[5]+reusedGeometriesDecodeMatrix[13];decompressedPositions[_i364+2]=geometryPositions[_i364+2]*reusedGeometriesDecodeMatrix[10]+reusedGeometriesDecodeMatrix[14];}geometryArrays.geometryPositions=null;geometryArraysCache[geometryId]=geometryArrays;}}}if(geometryArrays){if(geometryArrays.batchThisMesh){var _decompressedPositions=geometryArrays.decompressedPositions;var _positions4=new Uint16Array(_decompressedPositions.length);for(var _i365=0,_len46=_decompressedPositions.length;_i365<_len46;_i365+=3){tempVec4a$4[0]=_decompressedPositions[_i365+0];tempVec4a$4[1]=_decompressedPositions[_i365+1];tempVec4a$4[2]=_decompressedPositions[_i365+2];tempVec4a$4[3]=1;math.transformVec4(meshMatrix,tempVec4a$4,tempVec4b$4);geometryCompressionUtils.compressPosition(tempVec4b$4,rtcAABB,tempVec4a$4);_positions4[_i365+0]=tempVec4a$4[0];_positions4[_i365+1]=tempVec4a$4[1];_positions4[_i365+2]=tempVec4a$4[2];}sceneModel.createMesh(utils.apply(meshDefaults,{id:meshId,origin:tileCenter,primitive:geometryArrays.primitiveName,positionsCompressed:_positions4,normalsCompressed:geometryArrays.geometryNormals,colorsCompressed:geometryArrays.geometryColors,indices:geometryArrays.geometryIndices,edgeIndices:geometryArrays.geometryEdgeIndices,positionsDecodeMatrix:tileDecodeMatrix,color:meshColor,metallic:meshMetallic,roughness:meshRoughness,opacity:meshOpacity}));meshIds.push(meshId);}else{if(!geometryCreatedInTile[geometryId]){sceneModel.createGeometry({id:geometryId,primitive:geometryArrays.primitiveName,positionsCompressed:geometryArrays.geometryPositions,normalsCompressed:geometryArrays.geometryNormals,colorsCompressed:geometryArrays.geometryColors,indices:geometryArrays.geometryIndices,edgeIndices:geometryArrays.geometryEdgeIndices,positionsDecodeMatrix:reusedGeometriesDecodeMatrix});geometryCreatedInTile[geometryId]=true;}sceneModel.createMesh(utils.apply(meshDefaults,{id:meshId,geometryId:geometryId,origin:tileCenter,matrix:meshMatrix,color:meshColor,metallic:meshMetallic,roughness:meshRoughness,opacity:meshOpacity}));meshIds.push(meshId);}}}else{var _primitiveType2=eachGeometryPrimitiveType[_geometryIndex2];var primitiveName=void 0;var _geometryPositions2=void 0;var geometryNormals=void 0;var geometryColors=void 0;var geometryIndices=void 0;var geometryEdgeIndices=void 0;var _geometryValid=false;switch(_primitiveType2){case 0:primitiveName="solid";_geometryPositions2=positions.subarray(eachGeometryPositionsPortion[_geometryIndex2],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex2+1]);geometryNormals=normals.subarray(eachGeometryNormalsPortion[_geometryIndex2],atLastGeometry?normals.length:eachGeometryNormalsPortion[_geometryIndex2+1]);geometryIndices=indices.subarray(eachGeometryIndicesPortion[_geometryIndex2],atLastGeometry?indices.length:eachGeometryIndicesPortion[_geometryIndex2+1]);geometryEdgeIndices=edgeIndices.subarray(eachGeometryEdgeIndicesPortion[_geometryIndex2],atLastGeometry?edgeIndices.length:eachGeometryEdgeIndicesPortion[_geometryIndex2+1]);_geometryValid=_geometryPositions2.length>0&&geometryIndices.length>0;break;case 1:primitiveName="surface";_geometryPositions2=positions.subarray(eachGeometryPositionsPortion[_geometryIndex2],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex2+1]);geometryNormals=normals.subarray(eachGeometryNormalsPortion[_geometryIndex2],atLastGeometry?normals.length:eachGeometryNormalsPortion[_geometryIndex2+1]);geometryIndices=indices.subarray(eachGeometryIndicesPortion[_geometryIndex2],atLastGeometry?indices.length:eachGeometryIndicesPortion[_geometryIndex2+1]);geometryEdgeIndices=edgeIndices.subarray(eachGeometryEdgeIndicesPortion[_geometryIndex2],atLastGeometry?edgeIndices.length:eachGeometryEdgeIndicesPortion[_geometryIndex2+1]);_geometryValid=_geometryPositions2.length>0&&geometryIndices.length>0;break;case 2:primitiveName="points";_geometryPositions2=positions.subarray(eachGeometryPositionsPortion[_geometryIndex2],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex2+1]);geometryColors=convertColorsRGBToRGBA(colors.subarray(eachGeometryColorsPortion[_geometryIndex2],atLastGeometry?colors.length:eachGeometryColorsPortion[_geometryIndex2+1]));_geometryValid=_geometryPositions2.length>0;break;case 3:primitiveName="lines";_geometryPositions2=positions.subarray(eachGeometryPositionsPortion[_geometryIndex2],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex2+1]);geometryIndices=indices.subarray(eachGeometryIndicesPortion[_geometryIndex2],atLastGeometry?indices.length:eachGeometryIndicesPortion[_geometryIndex2+1]);_geometryValid=_geometryPositions2.length>0&&geometryIndices.length>0;break;default:continue;}if(_geometryValid){sceneModel.createMesh(utils.apply(meshDefaults,{id:meshId,origin:tileCenter,primitive:primitiveName,positionsCompressed:_geometryPositions2,normalsCompressed:geometryNormals,colorsCompressed:geometryColors,indices:geometryIndices,edgeIndices:geometryEdgeIndices,positionsDecodeMatrix:tileDecodeMatrix,color:meshColor,metallic:meshMetallic,roughness:meshRoughness,opacity:meshOpacity}));meshIds.push(meshId);}}}if(meshIds.length>0){sceneModel.createEntity(utils.apply(entityDefaults,{id:entityId,isObject:true,meshIds:meshIds}));}}}}/** @private */var ParserV8={version:8,parse:function parse(viewer,options,elements,sceneModel,metaModel,manifestCtx){var deflatedData=extract$3(elements);var inflatedData=inflate$3(deflatedData);load$4(viewer,options,inflatedData,sceneModel,metaModel,manifestCtx);}};/*
28974
28983
 
28975
28984
  Parser for .XKT Format V9
28976
28985
 
@@ -28990,7 +28999,7 @@ if(options.includeIdsMap&&metaObject.id&&!options.includeIdsMap[metaObject.id]){
28990
28999
  var props=options.objectDefaults?options.objectDefaults[metaObject.type]||options.objectDefaults["DEFAULT"]:null;if(props){if(props.visible===false){entityDefaults.visible=false;}if(props.pickable===false){entityDefaults.pickable=false;}if(props.colorize){meshDefaults.color=props.colorize;}if(props.opacity!==undefined&&props.opacity!==null){meshDefaults.opacity=props.opacity;}if(props.metallic!==undefined&&props.metallic!==null){meshDefaults.metallic=props.metallic;}if(props.roughness!==undefined&&props.roughness!==null){meshDefaults.roughness=props.roughness;}}}else{if(options.excludeUnclassifiedObjects){continue;}}// Iterate each entity's meshes
28991
29000
  for(var _meshIndex3=firstMeshIndex;_meshIndex3<=lastMeshIndex;_meshIndex3++){var _geometryIndex3=eachMeshGeometriesPortion[_meshIndex3];var geometryReuseCount=geometryReuseCounts[_geometryIndex3];var isReusedGeometry=geometryReuseCount>1;var atLastGeometry=_geometryIndex3===numGeometries-1;var meshColor=decompressColor$3(eachMeshMaterial.subarray(_meshIndex3*6,_meshIndex3*6+3));var meshOpacity=eachMeshMaterial[_meshIndex3*6+3]/255.0;var meshMetallic=eachMeshMaterial[_meshIndex3*6+4]/255.0;var meshRoughness=eachMeshMaterial[_meshIndex3*6+5]/255.0;var meshId=manifestCtx.getNextId();if(isReusedGeometry){// Create mesh for multi-use geometry - create (or reuse) geometry, create mesh using that geometry
28992
29001
  var meshMatrixIndex=eachMeshMatricesPortion[_meshIndex3];var meshMatrix=matrices.slice(meshMatrixIndex,meshMatrixIndex+16);var geometryId="".concat(modelPartId,"-geometry.").concat(tileIndex,".").concat(_geometryIndex3);// These IDs are local to the SceneModel
28993
- var geometryArrays=geometryArraysCache[geometryId];if(!geometryArrays){geometryArrays={batchThisMesh:!options.reuseGeometries};var primitiveType=eachGeometryPrimitiveType[_geometryIndex3];var geometryValid=false;switch(primitiveType){case 0:geometryArrays.primitiveName="solid";geometryArrays.geometryPositions=positions.subarray(eachGeometryPositionsPortion[_geometryIndex3],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex3+1]);geometryArrays.geometryNormals=normals.subarray(eachGeometryNormalsPortion[_geometryIndex3],atLastGeometry?normals.length:eachGeometryNormalsPortion[_geometryIndex3+1]);geometryArrays.geometryIndices=indices.subarray(eachGeometryIndicesPortion[_geometryIndex3],atLastGeometry?indices.length:eachGeometryIndicesPortion[_geometryIndex3+1]);geometryArrays.geometryEdgeIndices=edgeIndices.subarray(eachGeometryEdgeIndicesPortion[_geometryIndex3],atLastGeometry?edgeIndices.length:eachGeometryEdgeIndicesPortion[_geometryIndex3+1]);geometryValid=geometryArrays.geometryPositions.length>0&&geometryArrays.geometryIndices.length>0;break;case 1:geometryArrays.primitiveName="surface";geometryArrays.geometryPositions=positions.subarray(eachGeometryPositionsPortion[_geometryIndex3],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex3+1]);geometryArrays.geometryNormals=normals.subarray(eachGeometryNormalsPortion[_geometryIndex3],atLastGeometry?normals.length:eachGeometryNormalsPortion[_geometryIndex3+1]);geometryArrays.geometryIndices=indices.subarray(eachGeometryIndicesPortion[_geometryIndex3],atLastGeometry?indices.length:eachGeometryIndicesPortion[_geometryIndex3+1]);geometryArrays.geometryEdgeIndices=edgeIndices.subarray(eachGeometryEdgeIndicesPortion[_geometryIndex3],atLastGeometry?edgeIndices.length:eachGeometryEdgeIndicesPortion[_geometryIndex3+1]);geometryValid=geometryArrays.geometryPositions.length>0&&geometryArrays.geometryIndices.length>0;break;case 2:geometryArrays.primitiveName="points";geometryArrays.geometryPositions=positions.subarray(eachGeometryPositionsPortion[_geometryIndex3],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex3+1]);geometryArrays.geometryColors=colors.subarray(eachGeometryColorsPortion[_geometryIndex3],atLastGeometry?colors.length:eachGeometryColorsPortion[_geometryIndex3+1]);geometryValid=geometryArrays.geometryPositions.length>0;break;case 3:geometryArrays.primitiveName="lines";geometryArrays.geometryPositions=positions.subarray(eachGeometryPositionsPortion[_geometryIndex3],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex3+1]);geometryArrays.geometryIndices=indices.subarray(eachGeometryIndicesPortion[_geometryIndex3],atLastGeometry?indices.length:eachGeometryIndicesPortion[_geometryIndex3+1]);geometryValid=geometryArrays.geometryPositions.length>0&&geometryArrays.geometryIndices.length>0;break;default:continue;}if(!geometryValid){geometryArrays=null;}if(geometryArrays){if(geometryArrays.geometryPositions.length>1000);if(geometryArrays.batchThisMesh){geometryArrays.decompressedPositions=new Float32Array(geometryArrays.geometryPositions.length);geometryArrays.transformedAndRecompressedPositions=new Uint16Array(geometryArrays.geometryPositions.length);var geometryPositions=geometryArrays.geometryPositions;var decompressedPositions=geometryArrays.decompressedPositions;for(var _i364=0,len=geometryPositions.length;_i364<len;_i364+=3){decompressedPositions[_i364+0]=geometryPositions[_i364+0]*reusedGeometriesDecodeMatrix[0]+reusedGeometriesDecodeMatrix[12];decompressedPositions[_i364+1]=geometryPositions[_i364+1]*reusedGeometriesDecodeMatrix[5]+reusedGeometriesDecodeMatrix[13];decompressedPositions[_i364+2]=geometryPositions[_i364+2]*reusedGeometriesDecodeMatrix[10]+reusedGeometriesDecodeMatrix[14];}geometryArrays.geometryPositions=null;geometryArraysCache[geometryId]=geometryArrays;}}}if(geometryArrays){if(geometryArrays.batchThisMesh){var _decompressedPositions2=geometryArrays.decompressedPositions;var transformedAndRecompressedPositions=geometryArrays.transformedAndRecompressedPositions;for(var _i365=0,_len47=_decompressedPositions2.length;_i365<_len47;_i365+=3){tempVec4a$3[0]=_decompressedPositions2[_i365+0];tempVec4a$3[1]=_decompressedPositions2[_i365+1];tempVec4a$3[2]=_decompressedPositions2[_i365+2];tempVec4a$3[3]=1;math.transformVec4(meshMatrix,tempVec4a$3,tempVec4b$3);geometryCompressionUtils.compressPosition(tempVec4b$3,rtcAABB,tempVec4a$3);transformedAndRecompressedPositions[_i365+0]=tempVec4a$3[0];transformedAndRecompressedPositions[_i365+1]=tempVec4a$3[1];transformedAndRecompressedPositions[_i365+2]=tempVec4a$3[2];}sceneModel.createMesh(utils.apply(meshDefaults,{id:meshId,origin:tileCenter,primitive:geometryArrays.primitiveName,positionsCompressed:transformedAndRecompressedPositions,normalsCompressed:geometryArrays.geometryNormals,colorsCompressed:geometryArrays.geometryColors,indices:geometryArrays.geometryIndices,edgeIndices:geometryArrays.geometryEdgeIndices,positionsDecodeMatrix:tileDecodeMatrix,color:meshColor,metallic:meshMetallic,roughness:meshRoughness,opacity:meshOpacity}));meshIds.push(meshId);}else{if(!geometryCreatedInTile[geometryId]){sceneModel.createGeometry({id:geometryId,primitive:geometryArrays.primitiveName,positionsCompressed:geometryArrays.geometryPositions,normalsCompressed:geometryArrays.geometryNormals,colorsCompressed:geometryArrays.geometryColors,indices:geometryArrays.geometryIndices,edgeIndices:geometryArrays.geometryEdgeIndices,positionsDecodeMatrix:reusedGeometriesDecodeMatrix});geometryCreatedInTile[geometryId]=true;}sceneModel.createMesh(utils.apply(meshDefaults,{id:meshId,geometryId:geometryId,origin:tileCenter,matrix:meshMatrix,color:meshColor,metallic:meshMetallic,roughness:meshRoughness,opacity:meshOpacity}));meshIds.push(meshId);}}}else{var _primitiveType3=eachGeometryPrimitiveType[_geometryIndex3];var primitiveName=void 0;var _geometryPositions3=void 0;var geometryNormals=void 0;var geometryColors=void 0;var geometryIndices=void 0;var geometryEdgeIndices=void 0;var _geometryValid2=false;switch(_primitiveType3){case 0:primitiveName="solid";_geometryPositions3=positions.subarray(eachGeometryPositionsPortion[_geometryIndex3],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex3+1]);geometryNormals=normals.subarray(eachGeometryNormalsPortion[_geometryIndex3],atLastGeometry?normals.length:eachGeometryNormalsPortion[_geometryIndex3+1]);geometryIndices=indices.subarray(eachGeometryIndicesPortion[_geometryIndex3],atLastGeometry?indices.length:eachGeometryIndicesPortion[_geometryIndex3+1]);geometryEdgeIndices=edgeIndices.subarray(eachGeometryEdgeIndicesPortion[_geometryIndex3],atLastGeometry?edgeIndices.length:eachGeometryEdgeIndicesPortion[_geometryIndex3+1]);_geometryValid2=_geometryPositions3.length>0&&geometryIndices.length>0;break;case 1:primitiveName="surface";_geometryPositions3=positions.subarray(eachGeometryPositionsPortion[_geometryIndex3],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex3+1]);geometryNormals=normals.subarray(eachGeometryNormalsPortion[_geometryIndex3],atLastGeometry?normals.length:eachGeometryNormalsPortion[_geometryIndex3+1]);geometryIndices=indices.subarray(eachGeometryIndicesPortion[_geometryIndex3],atLastGeometry?indices.length:eachGeometryIndicesPortion[_geometryIndex3+1]);geometryEdgeIndices=edgeIndices.subarray(eachGeometryEdgeIndicesPortion[_geometryIndex3],atLastGeometry?edgeIndices.length:eachGeometryEdgeIndicesPortion[_geometryIndex3+1]);_geometryValid2=_geometryPositions3.length>0&&geometryIndices.length>0;break;case 2:primitiveName="points";_geometryPositions3=positions.subarray(eachGeometryPositionsPortion[_geometryIndex3],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex3+1]);geometryColors=colors.subarray(eachGeometryColorsPortion[_geometryIndex3],atLastGeometry?colors.length:eachGeometryColorsPortion[_geometryIndex3+1]);_geometryValid2=_geometryPositions3.length>0;break;case 3:primitiveName="lines";_geometryPositions3=positions.subarray(eachGeometryPositionsPortion[_geometryIndex3],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex3+1]);geometryIndices=indices.subarray(eachGeometryIndicesPortion[_geometryIndex3],atLastGeometry?indices.length:eachGeometryIndicesPortion[_geometryIndex3+1]);_geometryValid2=_geometryPositions3.length>0&&geometryIndices.length>0;break;default:continue;}if(_geometryValid2){sceneModel.createMesh(utils.apply(meshDefaults,{id:meshId,origin:tileCenter,primitive:primitiveName,positionsCompressed:_geometryPositions3,normalsCompressed:geometryNormals,colorsCompressed:geometryColors,indices:geometryIndices,edgeIndices:geometryEdgeIndices,positionsDecodeMatrix:tileDecodeMatrix,color:meshColor,metallic:meshMetallic,roughness:meshRoughness,opacity:meshOpacity}));meshIds.push(meshId);}}}if(meshIds.length>0){sceneModel.createEntity(utils.apply(entityDefaults,{id:entityId,isObject:true,meshIds:meshIds}));}}}}/** @private */var ParserV9={version:9,parse:function parse(viewer,options,elements,sceneModel,metaModel,manifestCtx){var deflatedData=extract$2(elements);var inflatedData=inflate$2(deflatedData);load$3(viewer,options,inflatedData,sceneModel,metaModel,manifestCtx);}};/*
29002
+ var geometryArrays=geometryArraysCache[geometryId];if(!geometryArrays){geometryArrays={batchThisMesh:!options.reuseGeometries};var primitiveType=eachGeometryPrimitiveType[_geometryIndex3];var geometryValid=false;switch(primitiveType){case 0:geometryArrays.primitiveName="solid";geometryArrays.geometryPositions=positions.subarray(eachGeometryPositionsPortion[_geometryIndex3],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex3+1]);geometryArrays.geometryNormals=normals.subarray(eachGeometryNormalsPortion[_geometryIndex3],atLastGeometry?normals.length:eachGeometryNormalsPortion[_geometryIndex3+1]);geometryArrays.geometryIndices=indices.subarray(eachGeometryIndicesPortion[_geometryIndex3],atLastGeometry?indices.length:eachGeometryIndicesPortion[_geometryIndex3+1]);geometryArrays.geometryEdgeIndices=edgeIndices.subarray(eachGeometryEdgeIndicesPortion[_geometryIndex3],atLastGeometry?edgeIndices.length:eachGeometryEdgeIndicesPortion[_geometryIndex3+1]);geometryValid=geometryArrays.geometryPositions.length>0&&geometryArrays.geometryIndices.length>0;break;case 1:geometryArrays.primitiveName="surface";geometryArrays.geometryPositions=positions.subarray(eachGeometryPositionsPortion[_geometryIndex3],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex3+1]);geometryArrays.geometryNormals=normals.subarray(eachGeometryNormalsPortion[_geometryIndex3],atLastGeometry?normals.length:eachGeometryNormalsPortion[_geometryIndex3+1]);geometryArrays.geometryIndices=indices.subarray(eachGeometryIndicesPortion[_geometryIndex3],atLastGeometry?indices.length:eachGeometryIndicesPortion[_geometryIndex3+1]);geometryArrays.geometryEdgeIndices=edgeIndices.subarray(eachGeometryEdgeIndicesPortion[_geometryIndex3],atLastGeometry?edgeIndices.length:eachGeometryEdgeIndicesPortion[_geometryIndex3+1]);geometryValid=geometryArrays.geometryPositions.length>0&&geometryArrays.geometryIndices.length>0;break;case 2:geometryArrays.primitiveName="points";geometryArrays.geometryPositions=positions.subarray(eachGeometryPositionsPortion[_geometryIndex3],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex3+1]);geometryArrays.geometryColors=colors.subarray(eachGeometryColorsPortion[_geometryIndex3],atLastGeometry?colors.length:eachGeometryColorsPortion[_geometryIndex3+1]);geometryValid=geometryArrays.geometryPositions.length>0;break;case 3:geometryArrays.primitiveName="lines";geometryArrays.geometryPositions=positions.subarray(eachGeometryPositionsPortion[_geometryIndex3],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex3+1]);geometryArrays.geometryIndices=indices.subarray(eachGeometryIndicesPortion[_geometryIndex3],atLastGeometry?indices.length:eachGeometryIndicesPortion[_geometryIndex3+1]);geometryValid=geometryArrays.geometryPositions.length>0&&geometryArrays.geometryIndices.length>0;break;default:continue;}if(!geometryValid){geometryArrays=null;}if(geometryArrays){if(geometryArrays.geometryPositions.length>1000);if(geometryArrays.batchThisMesh){geometryArrays.decompressedPositions=new Float32Array(geometryArrays.geometryPositions.length);geometryArrays.transformedAndRecompressedPositions=new Uint16Array(geometryArrays.geometryPositions.length);var geometryPositions=geometryArrays.geometryPositions;var decompressedPositions=geometryArrays.decompressedPositions;for(var _i366=0,len=geometryPositions.length;_i366<len;_i366+=3){decompressedPositions[_i366+0]=geometryPositions[_i366+0]*reusedGeometriesDecodeMatrix[0]+reusedGeometriesDecodeMatrix[12];decompressedPositions[_i366+1]=geometryPositions[_i366+1]*reusedGeometriesDecodeMatrix[5]+reusedGeometriesDecodeMatrix[13];decompressedPositions[_i366+2]=geometryPositions[_i366+2]*reusedGeometriesDecodeMatrix[10]+reusedGeometriesDecodeMatrix[14];}geometryArrays.geometryPositions=null;geometryArraysCache[geometryId]=geometryArrays;}}}if(geometryArrays){if(geometryArrays.batchThisMesh){var _decompressedPositions2=geometryArrays.decompressedPositions;var transformedAndRecompressedPositions=geometryArrays.transformedAndRecompressedPositions;for(var _i367=0,_len47=_decompressedPositions2.length;_i367<_len47;_i367+=3){tempVec4a$3[0]=_decompressedPositions2[_i367+0];tempVec4a$3[1]=_decompressedPositions2[_i367+1];tempVec4a$3[2]=_decompressedPositions2[_i367+2];tempVec4a$3[3]=1;math.transformVec4(meshMatrix,tempVec4a$3,tempVec4b$3);geometryCompressionUtils.compressPosition(tempVec4b$3,rtcAABB,tempVec4a$3);transformedAndRecompressedPositions[_i367+0]=tempVec4a$3[0];transformedAndRecompressedPositions[_i367+1]=tempVec4a$3[1];transformedAndRecompressedPositions[_i367+2]=tempVec4a$3[2];}sceneModel.createMesh(utils.apply(meshDefaults,{id:meshId,origin:tileCenter,primitive:geometryArrays.primitiveName,positionsCompressed:transformedAndRecompressedPositions,normalsCompressed:geometryArrays.geometryNormals,colorsCompressed:geometryArrays.geometryColors,indices:geometryArrays.geometryIndices,edgeIndices:geometryArrays.geometryEdgeIndices,positionsDecodeMatrix:tileDecodeMatrix,color:meshColor,metallic:meshMetallic,roughness:meshRoughness,opacity:meshOpacity}));meshIds.push(meshId);}else{if(!geometryCreatedInTile[geometryId]){sceneModel.createGeometry({id:geometryId,primitive:geometryArrays.primitiveName,positionsCompressed:geometryArrays.geometryPositions,normalsCompressed:geometryArrays.geometryNormals,colorsCompressed:geometryArrays.geometryColors,indices:geometryArrays.geometryIndices,edgeIndices:geometryArrays.geometryEdgeIndices,positionsDecodeMatrix:reusedGeometriesDecodeMatrix});geometryCreatedInTile[geometryId]=true;}sceneModel.createMesh(utils.apply(meshDefaults,{id:meshId,geometryId:geometryId,origin:tileCenter,matrix:meshMatrix,color:meshColor,metallic:meshMetallic,roughness:meshRoughness,opacity:meshOpacity}));meshIds.push(meshId);}}}else{var _primitiveType3=eachGeometryPrimitiveType[_geometryIndex3];var primitiveName=void 0;var _geometryPositions3=void 0;var geometryNormals=void 0;var geometryColors=void 0;var geometryIndices=void 0;var geometryEdgeIndices=void 0;var _geometryValid2=false;switch(_primitiveType3){case 0:primitiveName="solid";_geometryPositions3=positions.subarray(eachGeometryPositionsPortion[_geometryIndex3],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex3+1]);geometryNormals=normals.subarray(eachGeometryNormalsPortion[_geometryIndex3],atLastGeometry?normals.length:eachGeometryNormalsPortion[_geometryIndex3+1]);geometryIndices=indices.subarray(eachGeometryIndicesPortion[_geometryIndex3],atLastGeometry?indices.length:eachGeometryIndicesPortion[_geometryIndex3+1]);geometryEdgeIndices=edgeIndices.subarray(eachGeometryEdgeIndicesPortion[_geometryIndex3],atLastGeometry?edgeIndices.length:eachGeometryEdgeIndicesPortion[_geometryIndex3+1]);_geometryValid2=_geometryPositions3.length>0&&geometryIndices.length>0;break;case 1:primitiveName="surface";_geometryPositions3=positions.subarray(eachGeometryPositionsPortion[_geometryIndex3],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex3+1]);geometryNormals=normals.subarray(eachGeometryNormalsPortion[_geometryIndex3],atLastGeometry?normals.length:eachGeometryNormalsPortion[_geometryIndex3+1]);geometryIndices=indices.subarray(eachGeometryIndicesPortion[_geometryIndex3],atLastGeometry?indices.length:eachGeometryIndicesPortion[_geometryIndex3+1]);geometryEdgeIndices=edgeIndices.subarray(eachGeometryEdgeIndicesPortion[_geometryIndex3],atLastGeometry?edgeIndices.length:eachGeometryEdgeIndicesPortion[_geometryIndex3+1]);_geometryValid2=_geometryPositions3.length>0&&geometryIndices.length>0;break;case 2:primitiveName="points";_geometryPositions3=positions.subarray(eachGeometryPositionsPortion[_geometryIndex3],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex3+1]);geometryColors=colors.subarray(eachGeometryColorsPortion[_geometryIndex3],atLastGeometry?colors.length:eachGeometryColorsPortion[_geometryIndex3+1]);_geometryValid2=_geometryPositions3.length>0;break;case 3:primitiveName="lines";_geometryPositions3=positions.subarray(eachGeometryPositionsPortion[_geometryIndex3],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex3+1]);geometryIndices=indices.subarray(eachGeometryIndicesPortion[_geometryIndex3],atLastGeometry?indices.length:eachGeometryIndicesPortion[_geometryIndex3+1]);_geometryValid2=_geometryPositions3.length>0&&geometryIndices.length>0;break;default:continue;}if(_geometryValid2){sceneModel.createMesh(utils.apply(meshDefaults,{id:meshId,origin:tileCenter,primitive:primitiveName,positionsCompressed:_geometryPositions3,normalsCompressed:geometryNormals,colorsCompressed:geometryColors,indices:geometryIndices,edgeIndices:geometryEdgeIndices,positionsDecodeMatrix:tileDecodeMatrix,color:meshColor,metallic:meshMetallic,roughness:meshRoughness,opacity:meshOpacity}));meshIds.push(meshId);}}}if(meshIds.length>0){sceneModel.createEntity(utils.apply(entityDefaults,{id:entityId,isObject:true,meshIds:meshIds}));}}}}/** @private */var ParserV9={version:9,parse:function parse(viewer,options,elements,sceneModel,metaModel,manifestCtx){var deflatedData=extract$2(elements);var inflatedData=inflate$2(deflatedData);load$3(viewer,options,inflatedData,sceneModel,metaModel,manifestCtx);}};/*
28994
29003
  Parser for .XKT Format V10
28995
29004
  */var pako$1=window.pako||p;if(!pako$1.inflate){// See https://github.com/nodeca/pako/issues/97
28996
29005
  pako$1=pako$1["default"];}var tempVec4a$2=math.vec4();var tempVec4b$2=math.vec4();var NUM_TEXTURE_ATTRIBUTES$2=9;function extract$1(elements){var i=0;return{metadata:elements[i++],textureData:elements[i++],eachTextureDataPortion:elements[i++],eachTextureAttributes:elements[i++],positions:elements[i++],normals:elements[i++],colors:elements[i++],uvs:elements[i++],indices:elements[i++],edgeIndices:elements[i++],eachTextureSetTextures:elements[i++],matrices:elements[i++],reusedGeometriesDecodeMatrix:elements[i++],eachGeometryPrimitiveType:elements[i++],eachGeometryPositionsPortion:elements[i++],eachGeometryNormalsPortion:elements[i++],eachGeometryColorsPortion:elements[i++],eachGeometryUVsPortion:elements[i++],eachGeometryIndicesPortion:elements[i++],eachGeometryEdgeIndicesPortion:elements[i++],eachMeshGeometriesPortion:elements[i++],eachMeshMatricesPortion:elements[i++],eachMeshTextureSet:elements[i++],eachMeshMaterialAttributes:elements[i++],eachEntityId:elements[i++],eachEntityMeshesPortion:elements[i++],eachTileAABB:elements[i++],eachTileEntitiesPortion:elements[i++]};}function inflate$1(deflatedData){function inflate(array,options){return array.length===0?[]:pako$1.inflate(array,options).buffer;}return{metadata:JSON.parse(pako$1.inflate(deflatedData.metadata,{to:'string'})),textureData:new Uint8Array(inflate(deflatedData.textureData)),// <<----------------------------- ??? ZIPPing to blame?
@@ -29012,8 +29021,8 @@ if(options.includeIdsMap&&metaObject.id&&!options.includeIdsMap[metaObject.id]){
29012
29021
  var props=options.objectDefaults?options.objectDefaults[metaObject.type]||options.objectDefaults["DEFAULT"]:null;if(props){if(props.visible===false){entityDefaults.visible=false;}if(props.pickable===false){entityDefaults.pickable=false;}if(props.colorize){meshDefaults.color=props.colorize;}if(props.opacity!==undefined&&props.opacity!==null){meshDefaults.opacity=props.opacity;}if(props.metallic!==undefined&&props.metallic!==null){meshDefaults.metallic=props.metallic;}if(props.roughness!==undefined&&props.roughness!==null){meshDefaults.roughness=props.roughness;}}}else{if(options.excludeUnclassifiedObjects){continue;}}// Iterate each entity's meshes
29013
29022
  for(var _meshIndex4=firstMeshIndex;_meshIndex4<=lastMeshIndex;_meshIndex4++){var _geometryIndex4=eachMeshGeometriesPortion[_meshIndex4];var geometryReuseCount=geometryReuseCounts[_geometryIndex4];var isReusedGeometry=geometryReuseCount>1;var atLastGeometry=_geometryIndex4===numGeometries-1;var _textureSetIndex=eachMeshTextureSet[_meshIndex4];var _textureSetId=_textureSetIndex>=0?"".concat(modelPartId,"-textureSet-").concat(_textureSetIndex):null;var meshColor=decompressColor$2(eachMeshMaterialAttributes.subarray(_meshIndex4*6,_meshIndex4*6+3));var meshOpacity=eachMeshMaterialAttributes[_meshIndex4*6+3]/255.0;var meshMetallic=eachMeshMaterialAttributes[_meshIndex4*6+4]/255.0;var meshRoughness=eachMeshMaterialAttributes[_meshIndex4*6+5]/255.0;var meshId=manifestCtx.getNextId();if(isReusedGeometry){// Create mesh for multi-use geometry - create (or reuse) geometry, create mesh using that geometry
29014
29023
  var meshMatrixIndex=eachMeshMatricesPortion[_meshIndex4];var meshMatrix=matrices.slice(meshMatrixIndex,meshMatrixIndex+16);var geometryId="".concat(modelPartId,"-geometry.").concat(tileIndex,".").concat(_geometryIndex4);// These IDs are local to the SceneModel
29015
- var geometryArrays=geometryArraysCache[geometryId];if(!geometryArrays){geometryArrays={batchThisMesh:!options.reuseGeometries};var primitiveType=eachGeometryPrimitiveType[_geometryIndex4];var geometryValid=false;switch(primitiveType){case 0:geometryArrays.primitiveName="solid";geometryArrays.geometryPositions=positions.subarray(eachGeometryPositionsPortion[_geometryIndex4],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex4+1]);geometryArrays.geometryNormals=normals.subarray(eachGeometryNormalsPortion[_geometryIndex4],atLastGeometry?normals.length:eachGeometryNormalsPortion[_geometryIndex4+1]);geometryArrays.geometryUVs=uvs.subarray(eachGeometryUVsPortion[_geometryIndex4],atLastGeometry?uvs.length:eachGeometryUVsPortion[_geometryIndex4+1]);geometryArrays.geometryIndices=indices.subarray(eachGeometryIndicesPortion[_geometryIndex4],atLastGeometry?indices.length:eachGeometryIndicesPortion[_geometryIndex4+1]);geometryArrays.geometryEdgeIndices=edgeIndices.subarray(eachGeometryEdgeIndicesPortion[_geometryIndex4],atLastGeometry?edgeIndices.length:eachGeometryEdgeIndicesPortion[_geometryIndex4+1]);geometryValid=geometryArrays.geometryPositions.length>0&&geometryArrays.geometryIndices.length>0;break;case 1:geometryArrays.primitiveName="surface";geometryArrays.geometryPositions=positions.subarray(eachGeometryPositionsPortion[_geometryIndex4],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex4+1]);geometryArrays.geometryNormals=normals.subarray(eachGeometryNormalsPortion[_geometryIndex4],atLastGeometry?normals.length:eachGeometryNormalsPortion[_geometryIndex4+1]);geometryArrays.geometryUVs=uvs.subarray(eachGeometryUVsPortion[_geometryIndex4],atLastGeometry?uvs.length:eachGeometryUVsPortion[_geometryIndex4+1]);geometryArrays.geometryIndices=indices.subarray(eachGeometryIndicesPortion[_geometryIndex4],atLastGeometry?indices.length:eachGeometryIndicesPortion[_geometryIndex4+1]);geometryArrays.geometryEdgeIndices=edgeIndices.subarray(eachGeometryEdgeIndicesPortion[_geometryIndex4],atLastGeometry?edgeIndices.length:eachGeometryEdgeIndicesPortion[_geometryIndex4+1]);geometryValid=geometryArrays.geometryPositions.length>0&&geometryArrays.geometryIndices.length>0;break;case 2:geometryArrays.primitiveName="points";geometryArrays.geometryPositions=positions.subarray(eachGeometryPositionsPortion[_geometryIndex4],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex4+1]);geometryArrays.geometryColors=colors.subarray(eachGeometryColorsPortion[_geometryIndex4],atLastGeometry?colors.length:eachGeometryColorsPortion[_geometryIndex4+1]);geometryValid=geometryArrays.geometryPositions.length>0;break;case 3:geometryArrays.primitiveName="lines";geometryArrays.geometryPositions=positions.subarray(eachGeometryPositionsPortion[_geometryIndex4],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex4+1]);geometryArrays.geometryIndices=indices.subarray(eachGeometryIndicesPortion[_geometryIndex4],atLastGeometry?indices.length:eachGeometryIndicesPortion[_geometryIndex4+1]);geometryValid=geometryArrays.geometryPositions.length>0&&geometryArrays.geometryIndices.length>0;break;case 4:geometryArrays.primitiveName="lines";geometryArrays.geometryPositions=positions.subarray(eachGeometryPositionsPortion[_geometryIndex4],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex4+1]);geometryArrays.geometryIndices=lineStripToLines$2(geometryArrays.geometryPositions,indices.subarray(eachGeometryIndicesPortion[_geometryIndex4],atLastGeometry?indices.length:eachGeometryIndicesPortion[_geometryIndex4+1]));geometryValid=geometryArrays.geometryPositions.length>0&&geometryArrays.geometryIndices.length>0;break;default:continue;}if(!geometryValid){geometryArrays=null;}if(geometryArrays){if(geometryArrays.geometryPositions.length>1000);if(geometryArrays.batchThisMesh){geometryArrays.decompressedPositions=new Float32Array(geometryArrays.geometryPositions.length);geometryArrays.transformedAndRecompressedPositions=new Uint16Array(geometryArrays.geometryPositions.length);var geometryPositions=geometryArrays.geometryPositions;var decompressedPositions=geometryArrays.decompressedPositions;for(var _i366=0,len=geometryPositions.length;_i366<len;_i366+=3){decompressedPositions[_i366+0]=geometryPositions[_i366+0]*reusedGeometriesDecodeMatrix[0]+reusedGeometriesDecodeMatrix[12];decompressedPositions[_i366+1]=geometryPositions[_i366+1]*reusedGeometriesDecodeMatrix[5]+reusedGeometriesDecodeMatrix[13];decompressedPositions[_i366+2]=geometryPositions[_i366+2]*reusedGeometriesDecodeMatrix[10]+reusedGeometriesDecodeMatrix[14];}geometryArrays.geometryPositions=null;geometryArraysCache[geometryId]=geometryArrays;}}}if(geometryArrays){if(geometryArrays.batchThisMesh){var _decompressedPositions3=geometryArrays.decompressedPositions;var transformedAndRecompressedPositions=geometryArrays.transformedAndRecompressedPositions;for(var _i367=0,_len48=_decompressedPositions3.length;_i367<_len48;_i367+=3){tempVec4a$2[0]=_decompressedPositions3[_i367+0];tempVec4a$2[1]=_decompressedPositions3[_i367+1];tempVec4a$2[2]=_decompressedPositions3[_i367+2];tempVec4a$2[3]=1;math.transformVec4(meshMatrix,tempVec4a$2,tempVec4b$2);geometryCompressionUtils.compressPosition(tempVec4b$2,rtcAABB,tempVec4a$2);transformedAndRecompressedPositions[_i367+0]=tempVec4a$2[0];transformedAndRecompressedPositions[_i367+1]=tempVec4a$2[1];transformedAndRecompressedPositions[_i367+2]=tempVec4a$2[2];}sceneModel.createMesh(utils.apply(meshDefaults,{id:meshId,textureSetId:_textureSetId,origin:tileCenter,primitive:geometryArrays.primitiveName,positionsCompressed:transformedAndRecompressedPositions,normalsCompressed:geometryArrays.geometryNormals,uv:geometryArrays.geometryUVs,colorsCompressed:geometryArrays.geometryColors,indices:geometryArrays.geometryIndices,edgeIndices:geometryArrays.geometryEdgeIndices,positionsDecodeMatrix:tileDecodeMatrix,color:meshColor,metallic:meshMetallic,roughness:meshRoughness,opacity:meshOpacity}));meshIds.push(meshId);}else{if(!geometryCreatedInTile[geometryId]){sceneModel.createGeometry({id:geometryId,primitive:geometryArrays.primitiveName,positionsCompressed:geometryArrays.geometryPositions,normalsCompressed:geometryArrays.geometryNormals,uv:geometryArrays.geometryUVs,colorsCompressed:geometryArrays.geometryColors,indices:geometryArrays.geometryIndices,edgeIndices:geometryArrays.geometryEdgeIndices,positionsDecodeMatrix:reusedGeometriesDecodeMatrix});geometryCreatedInTile[geometryId]=true;}sceneModel.createMesh(utils.apply(meshDefaults,{id:meshId,geometryId:geometryId,textureSetId:_textureSetId,matrix:meshMatrix,color:meshColor,metallic:meshMetallic,roughness:meshRoughness,opacity:meshOpacity,origin:tileCenter}));meshIds.push(meshId);}}}else{// Do not reuse geometry
29016
- var _primitiveType4=eachGeometryPrimitiveType[_geometryIndex4];var primitiveName=void 0;var _geometryPositions4=void 0;var geometryNormals=void 0;var geometryUVs=void 0;var geometryColors=void 0;var geometryIndices=void 0;var geometryEdgeIndices=void 0;var _geometryValid3=false;switch(_primitiveType4){case 0:primitiveName="solid";_geometryPositions4=positions.subarray(eachGeometryPositionsPortion[_geometryIndex4],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex4+1]);geometryNormals=normals.subarray(eachGeometryNormalsPortion[_geometryIndex4],atLastGeometry?normals.length:eachGeometryNormalsPortion[_geometryIndex4+1]);geometryUVs=uvs.subarray(eachGeometryUVsPortion[_geometryIndex4],atLastGeometry?uvs.length:eachGeometryUVsPortion[_geometryIndex4+1]);geometryIndices=indices.subarray(eachGeometryIndicesPortion[_geometryIndex4],atLastGeometry?indices.length:eachGeometryIndicesPortion[_geometryIndex4+1]);geometryEdgeIndices=edgeIndices.subarray(eachGeometryEdgeIndicesPortion[_geometryIndex4],atLastGeometry?edgeIndices.length:eachGeometryEdgeIndicesPortion[_geometryIndex4+1]);_geometryValid3=_geometryPositions4.length>0&&geometryIndices.length>0;break;case 1:primitiveName="surface";_geometryPositions4=positions.subarray(eachGeometryPositionsPortion[_geometryIndex4],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex4+1]);geometryNormals=normals.subarray(eachGeometryNormalsPortion[_geometryIndex4],atLastGeometry?normals.length:eachGeometryNormalsPortion[_geometryIndex4+1]);geometryUVs=uvs.subarray(eachGeometryUVsPortion[_geometryIndex4],atLastGeometry?uvs.length:eachGeometryUVsPortion[_geometryIndex4+1]);geometryIndices=indices.subarray(eachGeometryIndicesPortion[_geometryIndex4],atLastGeometry?indices.length:eachGeometryIndicesPortion[_geometryIndex4+1]);geometryEdgeIndices=edgeIndices.subarray(eachGeometryEdgeIndicesPortion[_geometryIndex4],atLastGeometry?edgeIndices.length:eachGeometryEdgeIndicesPortion[_geometryIndex4+1]);_geometryValid3=_geometryPositions4.length>0&&geometryIndices.length>0;break;case 2:primitiveName="points";_geometryPositions4=positions.subarray(eachGeometryPositionsPortion[_geometryIndex4],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex4+1]);geometryColors=colors.subarray(eachGeometryColorsPortion[_geometryIndex4],atLastGeometry?colors.length:eachGeometryColorsPortion[_geometryIndex4+1]);_geometryValid3=_geometryPositions4.length>0;break;case 3:primitiveName="lines";_geometryPositions4=positions.subarray(eachGeometryPositionsPortion[_geometryIndex4],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex4+1]);geometryIndices=indices.subarray(eachGeometryIndicesPortion[_geometryIndex4],atLastGeometry?indices.length:eachGeometryIndicesPortion[_geometryIndex4+1]);_geometryValid3=_geometryPositions4.length>0&&geometryIndices.length>0;break;case 4:primitiveName="lines";_geometryPositions4=positions.subarray(eachGeometryPositionsPortion[_geometryIndex4],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex4+1]);geometryIndices=lineStripToLines$2(_geometryPositions4,indices.subarray(eachGeometryIndicesPortion[_geometryIndex4],atLastGeometry?indices.length:eachGeometryIndicesPortion[_geometryIndex4+1]));_geometryValid3=_geometryPositions4.length>0&&geometryIndices.length>0;break;default:continue;}if(_geometryValid3){sceneModel.createMesh(utils.apply(meshDefaults,{id:meshId,textureSetId:_textureSetId,origin:tileCenter,primitive:primitiveName,positionsCompressed:_geometryPositions4,normalsCompressed:geometryNormals,uv:geometryUVs&&geometryUVs.length>0?geometryUVs:null,colorsCompressed:geometryColors,indices:geometryIndices,edgeIndices:geometryEdgeIndices,positionsDecodeMatrix:tileDecodeMatrix,color:meshColor,metallic:meshMetallic,roughness:meshRoughness,opacity:meshOpacity}));meshIds.push(meshId);}}}if(meshIds.length>0){sceneModel.createEntity(utils.apply(entityDefaults,{id:entityId,isObject:true,meshIds:meshIds}));}}}}function lineStripToLines$2(positions,indices){var linesIndices=[];if(indices.length>1){for(var _i368=0,len=indices.length-1;_i368<len;_i368++){linesIndices.push(indices[_i368]);linesIndices.push(indices[_i368+1]);}}else if(positions.length>1){for(var _i369=0,_len49=positions.length/3-1;_i369<_len49;_i369++){linesIndices.push(_i369);linesIndices.push(_i369+1);}}return linesIndices;}/** @private */var ParserV10={version:10,parse:function parse(viewer,options,elements,sceneModel,metaModel,manifestCtx){var deflatedData=extract$1(elements);var inflatedData=inflate$1(deflatedData);load$2(viewer,options,inflatedData,sceneModel,metaModel,manifestCtx);}};/*
29024
+ var geometryArrays=geometryArraysCache[geometryId];if(!geometryArrays){geometryArrays={batchThisMesh:!options.reuseGeometries};var primitiveType=eachGeometryPrimitiveType[_geometryIndex4];var geometryValid=false;switch(primitiveType){case 0:geometryArrays.primitiveName="solid";geometryArrays.geometryPositions=positions.subarray(eachGeometryPositionsPortion[_geometryIndex4],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex4+1]);geometryArrays.geometryNormals=normals.subarray(eachGeometryNormalsPortion[_geometryIndex4],atLastGeometry?normals.length:eachGeometryNormalsPortion[_geometryIndex4+1]);geometryArrays.geometryUVs=uvs.subarray(eachGeometryUVsPortion[_geometryIndex4],atLastGeometry?uvs.length:eachGeometryUVsPortion[_geometryIndex4+1]);geometryArrays.geometryIndices=indices.subarray(eachGeometryIndicesPortion[_geometryIndex4],atLastGeometry?indices.length:eachGeometryIndicesPortion[_geometryIndex4+1]);geometryArrays.geometryEdgeIndices=edgeIndices.subarray(eachGeometryEdgeIndicesPortion[_geometryIndex4],atLastGeometry?edgeIndices.length:eachGeometryEdgeIndicesPortion[_geometryIndex4+1]);geometryValid=geometryArrays.geometryPositions.length>0&&geometryArrays.geometryIndices.length>0;break;case 1:geometryArrays.primitiveName="surface";geometryArrays.geometryPositions=positions.subarray(eachGeometryPositionsPortion[_geometryIndex4],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex4+1]);geometryArrays.geometryNormals=normals.subarray(eachGeometryNormalsPortion[_geometryIndex4],atLastGeometry?normals.length:eachGeometryNormalsPortion[_geometryIndex4+1]);geometryArrays.geometryUVs=uvs.subarray(eachGeometryUVsPortion[_geometryIndex4],atLastGeometry?uvs.length:eachGeometryUVsPortion[_geometryIndex4+1]);geometryArrays.geometryIndices=indices.subarray(eachGeometryIndicesPortion[_geometryIndex4],atLastGeometry?indices.length:eachGeometryIndicesPortion[_geometryIndex4+1]);geometryArrays.geometryEdgeIndices=edgeIndices.subarray(eachGeometryEdgeIndicesPortion[_geometryIndex4],atLastGeometry?edgeIndices.length:eachGeometryEdgeIndicesPortion[_geometryIndex4+1]);geometryValid=geometryArrays.geometryPositions.length>0&&geometryArrays.geometryIndices.length>0;break;case 2:geometryArrays.primitiveName="points";geometryArrays.geometryPositions=positions.subarray(eachGeometryPositionsPortion[_geometryIndex4],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex4+1]);geometryArrays.geometryColors=colors.subarray(eachGeometryColorsPortion[_geometryIndex4],atLastGeometry?colors.length:eachGeometryColorsPortion[_geometryIndex4+1]);geometryValid=geometryArrays.geometryPositions.length>0;break;case 3:geometryArrays.primitiveName="lines";geometryArrays.geometryPositions=positions.subarray(eachGeometryPositionsPortion[_geometryIndex4],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex4+1]);geometryArrays.geometryIndices=indices.subarray(eachGeometryIndicesPortion[_geometryIndex4],atLastGeometry?indices.length:eachGeometryIndicesPortion[_geometryIndex4+1]);geometryValid=geometryArrays.geometryPositions.length>0&&geometryArrays.geometryIndices.length>0;break;case 4:geometryArrays.primitiveName="lines";geometryArrays.geometryPositions=positions.subarray(eachGeometryPositionsPortion[_geometryIndex4],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex4+1]);geometryArrays.geometryIndices=lineStripToLines$2(geometryArrays.geometryPositions,indices.subarray(eachGeometryIndicesPortion[_geometryIndex4],atLastGeometry?indices.length:eachGeometryIndicesPortion[_geometryIndex4+1]));geometryValid=geometryArrays.geometryPositions.length>0&&geometryArrays.geometryIndices.length>0;break;default:continue;}if(!geometryValid){geometryArrays=null;}if(geometryArrays){if(geometryArrays.geometryPositions.length>1000);if(geometryArrays.batchThisMesh){geometryArrays.decompressedPositions=new Float32Array(geometryArrays.geometryPositions.length);geometryArrays.transformedAndRecompressedPositions=new Uint16Array(geometryArrays.geometryPositions.length);var geometryPositions=geometryArrays.geometryPositions;var decompressedPositions=geometryArrays.decompressedPositions;for(var _i368=0,len=geometryPositions.length;_i368<len;_i368+=3){decompressedPositions[_i368+0]=geometryPositions[_i368+0]*reusedGeometriesDecodeMatrix[0]+reusedGeometriesDecodeMatrix[12];decompressedPositions[_i368+1]=geometryPositions[_i368+1]*reusedGeometriesDecodeMatrix[5]+reusedGeometriesDecodeMatrix[13];decompressedPositions[_i368+2]=geometryPositions[_i368+2]*reusedGeometriesDecodeMatrix[10]+reusedGeometriesDecodeMatrix[14];}geometryArrays.geometryPositions=null;geometryArraysCache[geometryId]=geometryArrays;}}}if(geometryArrays){if(geometryArrays.batchThisMesh){var _decompressedPositions3=geometryArrays.decompressedPositions;var transformedAndRecompressedPositions=geometryArrays.transformedAndRecompressedPositions;for(var _i369=0,_len48=_decompressedPositions3.length;_i369<_len48;_i369+=3){tempVec4a$2[0]=_decompressedPositions3[_i369+0];tempVec4a$2[1]=_decompressedPositions3[_i369+1];tempVec4a$2[2]=_decompressedPositions3[_i369+2];tempVec4a$2[3]=1;math.transformVec4(meshMatrix,tempVec4a$2,tempVec4b$2);geometryCompressionUtils.compressPosition(tempVec4b$2,rtcAABB,tempVec4a$2);transformedAndRecompressedPositions[_i369+0]=tempVec4a$2[0];transformedAndRecompressedPositions[_i369+1]=tempVec4a$2[1];transformedAndRecompressedPositions[_i369+2]=tempVec4a$2[2];}sceneModel.createMesh(utils.apply(meshDefaults,{id:meshId,textureSetId:_textureSetId,origin:tileCenter,primitive:geometryArrays.primitiveName,positionsCompressed:transformedAndRecompressedPositions,normalsCompressed:geometryArrays.geometryNormals,uv:geometryArrays.geometryUVs,colorsCompressed:geometryArrays.geometryColors,indices:geometryArrays.geometryIndices,edgeIndices:geometryArrays.geometryEdgeIndices,positionsDecodeMatrix:tileDecodeMatrix,color:meshColor,metallic:meshMetallic,roughness:meshRoughness,opacity:meshOpacity}));meshIds.push(meshId);}else{if(!geometryCreatedInTile[geometryId]){sceneModel.createGeometry({id:geometryId,primitive:geometryArrays.primitiveName,positionsCompressed:geometryArrays.geometryPositions,normalsCompressed:geometryArrays.geometryNormals,uv:geometryArrays.geometryUVs,colorsCompressed:geometryArrays.geometryColors,indices:geometryArrays.geometryIndices,edgeIndices:geometryArrays.geometryEdgeIndices,positionsDecodeMatrix:reusedGeometriesDecodeMatrix});geometryCreatedInTile[geometryId]=true;}sceneModel.createMesh(utils.apply(meshDefaults,{id:meshId,geometryId:geometryId,textureSetId:_textureSetId,matrix:meshMatrix,color:meshColor,metallic:meshMetallic,roughness:meshRoughness,opacity:meshOpacity,origin:tileCenter}));meshIds.push(meshId);}}}else{// Do not reuse geometry
29025
+ var _primitiveType4=eachGeometryPrimitiveType[_geometryIndex4];var primitiveName=void 0;var _geometryPositions4=void 0;var geometryNormals=void 0;var geometryUVs=void 0;var geometryColors=void 0;var geometryIndices=void 0;var geometryEdgeIndices=void 0;var _geometryValid3=false;switch(_primitiveType4){case 0:primitiveName="solid";_geometryPositions4=positions.subarray(eachGeometryPositionsPortion[_geometryIndex4],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex4+1]);geometryNormals=normals.subarray(eachGeometryNormalsPortion[_geometryIndex4],atLastGeometry?normals.length:eachGeometryNormalsPortion[_geometryIndex4+1]);geometryUVs=uvs.subarray(eachGeometryUVsPortion[_geometryIndex4],atLastGeometry?uvs.length:eachGeometryUVsPortion[_geometryIndex4+1]);geometryIndices=indices.subarray(eachGeometryIndicesPortion[_geometryIndex4],atLastGeometry?indices.length:eachGeometryIndicesPortion[_geometryIndex4+1]);geometryEdgeIndices=edgeIndices.subarray(eachGeometryEdgeIndicesPortion[_geometryIndex4],atLastGeometry?edgeIndices.length:eachGeometryEdgeIndicesPortion[_geometryIndex4+1]);_geometryValid3=_geometryPositions4.length>0&&geometryIndices.length>0;break;case 1:primitiveName="surface";_geometryPositions4=positions.subarray(eachGeometryPositionsPortion[_geometryIndex4],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex4+1]);geometryNormals=normals.subarray(eachGeometryNormalsPortion[_geometryIndex4],atLastGeometry?normals.length:eachGeometryNormalsPortion[_geometryIndex4+1]);geometryUVs=uvs.subarray(eachGeometryUVsPortion[_geometryIndex4],atLastGeometry?uvs.length:eachGeometryUVsPortion[_geometryIndex4+1]);geometryIndices=indices.subarray(eachGeometryIndicesPortion[_geometryIndex4],atLastGeometry?indices.length:eachGeometryIndicesPortion[_geometryIndex4+1]);geometryEdgeIndices=edgeIndices.subarray(eachGeometryEdgeIndicesPortion[_geometryIndex4],atLastGeometry?edgeIndices.length:eachGeometryEdgeIndicesPortion[_geometryIndex4+1]);_geometryValid3=_geometryPositions4.length>0&&geometryIndices.length>0;break;case 2:primitiveName="points";_geometryPositions4=positions.subarray(eachGeometryPositionsPortion[_geometryIndex4],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex4+1]);geometryColors=colors.subarray(eachGeometryColorsPortion[_geometryIndex4],atLastGeometry?colors.length:eachGeometryColorsPortion[_geometryIndex4+1]);_geometryValid3=_geometryPositions4.length>0;break;case 3:primitiveName="lines";_geometryPositions4=positions.subarray(eachGeometryPositionsPortion[_geometryIndex4],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex4+1]);geometryIndices=indices.subarray(eachGeometryIndicesPortion[_geometryIndex4],atLastGeometry?indices.length:eachGeometryIndicesPortion[_geometryIndex4+1]);_geometryValid3=_geometryPositions4.length>0&&geometryIndices.length>0;break;case 4:primitiveName="lines";_geometryPositions4=positions.subarray(eachGeometryPositionsPortion[_geometryIndex4],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex4+1]);geometryIndices=lineStripToLines$2(_geometryPositions4,indices.subarray(eachGeometryIndicesPortion[_geometryIndex4],atLastGeometry?indices.length:eachGeometryIndicesPortion[_geometryIndex4+1]));_geometryValid3=_geometryPositions4.length>0&&geometryIndices.length>0;break;default:continue;}if(_geometryValid3){sceneModel.createMesh(utils.apply(meshDefaults,{id:meshId,textureSetId:_textureSetId,origin:tileCenter,primitive:primitiveName,positionsCompressed:_geometryPositions4,normalsCompressed:geometryNormals,uv:geometryUVs&&geometryUVs.length>0?geometryUVs:null,colorsCompressed:geometryColors,indices:geometryIndices,edgeIndices:geometryEdgeIndices,positionsDecodeMatrix:tileDecodeMatrix,color:meshColor,metallic:meshMetallic,roughness:meshRoughness,opacity:meshOpacity}));meshIds.push(meshId);}}}if(meshIds.length>0){sceneModel.createEntity(utils.apply(entityDefaults,{id:entityId,isObject:true,meshIds:meshIds}));}}}}function lineStripToLines$2(positions,indices){var linesIndices=[];if(indices.length>1){for(var _i370=0,len=indices.length-1;_i370<len;_i370++){linesIndices.push(indices[_i370]);linesIndices.push(indices[_i370+1]);}}else if(positions.length>1){for(var _i371=0,_len49=positions.length/3-1;_i371<_len49;_i371++){linesIndices.push(_i371);linesIndices.push(_i371+1);}}return linesIndices;}/** @private */var ParserV10={version:10,parse:function parse(viewer,options,elements,sceneModel,metaModel,manifestCtx){var deflatedData=extract$1(elements);var inflatedData=inflate$1(deflatedData);load$2(viewer,options,inflatedData,sceneModel,metaModel,manifestCtx);}};/*
29017
29026
  Parser for .XKT Format V11
29018
29027
  */var tempVec4a$1=math.vec4();var tempVec4b$1=math.vec4();var NUM_TEXTURE_ATTRIBUTES$1=9;function decodeData$1(arrayBuffer){var requiresSwapFromLittleEndian=function(){var buffer=new ArrayBuffer(2);new Uint16Array(buffer)[0]=1;return new Uint8Array(buffer)[0]!==1;}();var nextArray=function(){var i=0;var dataView=new DataView(arrayBuffer);return function(type){var idx=1+2*i++;// `1' for the version nr
29019
29028
  var byteOffset=dataView.getUint32(idx*4,true);var byteLength=dataView.getUint32((idx+1)*4,true);var BPE=type.BYTES_PER_ELEMENT;if(requiresSwapFromLittleEndian&&BPE>1){var subarray=new Uint8Array(arrayBuffer,byteOffset,byteLength);var swaps=BPE/2;var cnt=subarray.length/BPE;for(var b=0;b<cnt;b++){var offset=b*BPE;for(var j=0;j<swaps;j++){var i1=offset+j;var i2=offset-j+BPE-1;var tmp=subarray[i1];subarray[i1]=subarray[i2];subarray[i2]=tmp;}}}return new type(arrayBuffer,byteOffset,byteLength/BPE);};}();var nextObject=function(){var decoder=new TextDecoder();return function(){return JSON.parse(decoder.decode(nextArray(Uint8Array)));};}();return{metadata:nextObject(),textureData:nextArray(Uint8Array),// <<----------------------------- ??? ZIPPing to blame?
@@ -29035,8 +29044,8 @@ if(options.includeIdsMap&&metaObject.id&&!options.includeIdsMap[metaObject.id]){
29035
29044
  var props=options.objectDefaults?options.objectDefaults[metaObject.type]||options.objectDefaults["DEFAULT"]:null;if(props){if(props.visible===false){entityDefaults.visible=false;}if(props.pickable===false){entityDefaults.pickable=false;}if(props.colorize){meshDefaults.color=props.colorize;}if(props.opacity!==undefined&&props.opacity!==null){meshDefaults.opacity=props.opacity;}if(props.metallic!==undefined&&props.metallic!==null){meshDefaults.metallic=props.metallic;}if(props.roughness!==undefined&&props.roughness!==null){meshDefaults.roughness=props.roughness;}}}else{if(options.excludeUnclassifiedObjects){continue;}}// Iterate each entity's meshes
29036
29045
  for(var _meshIndex5=firstMeshIndex;_meshIndex5<=lastMeshIndex;_meshIndex5++){var _geometryIndex5=eachMeshGeometriesPortion[_meshIndex5];var geometryReuseCount=geometryReuseCounts[_geometryIndex5];var isReusedGeometry=geometryReuseCount>1;var atLastGeometry=_geometryIndex5===numGeometries-1;var _textureSetIndex2=eachMeshTextureSet[_meshIndex5];var _textureSetId2=_textureSetIndex2>=0?"".concat(modelPartId,"-textureSet-").concat(_textureSetIndex2):null;var meshColor=decompressColor$1(eachMeshMaterialAttributes.subarray(_meshIndex5*6,_meshIndex5*6+3));var meshOpacity=eachMeshMaterialAttributes[_meshIndex5*6+3]/255.0;var meshMetallic=eachMeshMaterialAttributes[_meshIndex5*6+4]/255.0;var meshRoughness=eachMeshMaterialAttributes[_meshIndex5*6+5]/255.0;var meshId=manifestCtx.getNextId();if(isReusedGeometry){// Create mesh for multi-use geometry - create (or reuse) geometry, create mesh using that geometry
29037
29046
  var meshMatrixIndex=eachMeshMatricesPortion[_meshIndex5];var meshMatrix=matrices.slice(meshMatrixIndex,meshMatrixIndex+16);var geometryId="".concat(modelPartId,"-geometry.").concat(tileIndex,".").concat(_geometryIndex5);// These IDs are local to the SceneModel
29038
- var geometryArrays=geometryArraysCache[geometryId];if(!geometryArrays){geometryArrays={batchThisMesh:!options.reuseGeometries};var primitiveType=eachGeometryPrimitiveType[_geometryIndex5];var geometryValid=false;switch(primitiveType){case 0:geometryArrays.primitiveName="solid";geometryArrays.geometryPositions=positions.subarray(eachGeometryPositionsPortion[_geometryIndex5],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex5+1]);geometryArrays.geometryNormals=normals.subarray(eachGeometryNormalsPortion[_geometryIndex5],atLastGeometry?normals.length:eachGeometryNormalsPortion[_geometryIndex5+1]);geometryArrays.geometryUVs=uvs.subarray(eachGeometryUVsPortion[_geometryIndex5],atLastGeometry?uvs.length:eachGeometryUVsPortion[_geometryIndex5+1]);geometryArrays.geometryIndices=indices.subarray(eachGeometryIndicesPortion[_geometryIndex5],atLastGeometry?indices.length:eachGeometryIndicesPortion[_geometryIndex5+1]);geometryArrays.geometryEdgeIndices=edgeIndices.subarray(eachGeometryEdgeIndicesPortion[_geometryIndex5],atLastGeometry?edgeIndices.length:eachGeometryEdgeIndicesPortion[_geometryIndex5+1]);geometryValid=geometryArrays.geometryPositions.length>0&&geometryArrays.geometryIndices.length>0;break;case 1:geometryArrays.primitiveName="surface";geometryArrays.geometryPositions=positions.subarray(eachGeometryPositionsPortion[_geometryIndex5],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex5+1]);geometryArrays.geometryNormals=normals.subarray(eachGeometryNormalsPortion[_geometryIndex5],atLastGeometry?normals.length:eachGeometryNormalsPortion[_geometryIndex5+1]);geometryArrays.geometryUVs=uvs.subarray(eachGeometryUVsPortion[_geometryIndex5],atLastGeometry?uvs.length:eachGeometryUVsPortion[_geometryIndex5+1]);geometryArrays.geometryIndices=indices.subarray(eachGeometryIndicesPortion[_geometryIndex5],atLastGeometry?indices.length:eachGeometryIndicesPortion[_geometryIndex5+1]);geometryArrays.geometryEdgeIndices=edgeIndices.subarray(eachGeometryEdgeIndicesPortion[_geometryIndex5],atLastGeometry?edgeIndices.length:eachGeometryEdgeIndicesPortion[_geometryIndex5+1]);geometryValid=geometryArrays.geometryPositions.length>0&&geometryArrays.geometryIndices.length>0;break;case 2:geometryArrays.primitiveName="points";geometryArrays.geometryPositions=positions.subarray(eachGeometryPositionsPortion[_geometryIndex5],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex5+1]);geometryArrays.geometryColors=colors.subarray(eachGeometryColorsPortion[_geometryIndex5],atLastGeometry?colors.length:eachGeometryColorsPortion[_geometryIndex5+1]);geometryValid=geometryArrays.geometryPositions.length>0;break;case 3:geometryArrays.primitiveName="lines";geometryArrays.geometryPositions=positions.subarray(eachGeometryPositionsPortion[_geometryIndex5],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex5+1]);geometryArrays.geometryIndices=indices.subarray(eachGeometryIndicesPortion[_geometryIndex5],atLastGeometry?indices.length:eachGeometryIndicesPortion[_geometryIndex5+1]);geometryValid=geometryArrays.geometryPositions.length>0&&geometryArrays.geometryIndices.length>0;break;case 4:geometryArrays.primitiveName="lines";geometryArrays.geometryPositions=positions.subarray(eachGeometryPositionsPortion[_geometryIndex5],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex5+1]);geometryArrays.geometryIndices=lineStripToLines$1(geometryArrays.geometryPositions,indices.subarray(eachGeometryIndicesPortion[_geometryIndex5],atLastGeometry?indices.length:eachGeometryIndicesPortion[_geometryIndex5+1]));geometryValid=geometryArrays.geometryPositions.length>0&&geometryArrays.geometryIndices.length>0;break;default:continue;}if(!geometryValid){geometryArrays=null;}if(geometryArrays){if(geometryArrays.geometryPositions.length>1000);if(geometryArrays.batchThisMesh){geometryArrays.decompressedPositions=new Float32Array(geometryArrays.geometryPositions.length);geometryArrays.transformedAndRecompressedPositions=new Uint16Array(geometryArrays.geometryPositions.length);var geometryPositions=geometryArrays.geometryPositions;var decompressedPositions=geometryArrays.decompressedPositions;for(var _i370=0,len=geometryPositions.length;_i370<len;_i370+=3){decompressedPositions[_i370+0]=geometryPositions[_i370+0]*reusedGeometriesDecodeMatrix[0]+reusedGeometriesDecodeMatrix[12];decompressedPositions[_i370+1]=geometryPositions[_i370+1]*reusedGeometriesDecodeMatrix[5]+reusedGeometriesDecodeMatrix[13];decompressedPositions[_i370+2]=geometryPositions[_i370+2]*reusedGeometriesDecodeMatrix[10]+reusedGeometriesDecodeMatrix[14];}geometryArrays.geometryPositions=null;geometryArraysCache[geometryId]=geometryArrays;}}}if(geometryArrays){if(geometryArrays.batchThisMesh){var _decompressedPositions4=geometryArrays.decompressedPositions;var transformedAndRecompressedPositions=geometryArrays.transformedAndRecompressedPositions;for(var _i371=0,_len50=_decompressedPositions4.length;_i371<_len50;_i371+=3){tempVec4a$1[0]=_decompressedPositions4[_i371+0];tempVec4a$1[1]=_decompressedPositions4[_i371+1];tempVec4a$1[2]=_decompressedPositions4[_i371+2];tempVec4a$1[3]=1;math.transformVec4(meshMatrix,tempVec4a$1,tempVec4b$1);geometryCompressionUtils.compressPosition(tempVec4b$1,rtcAABB,tempVec4a$1);transformedAndRecompressedPositions[_i371+0]=tempVec4a$1[0];transformedAndRecompressedPositions[_i371+1]=tempVec4a$1[1];transformedAndRecompressedPositions[_i371+2]=tempVec4a$1[2];}sceneModel.createMesh(utils.apply(meshDefaults,{id:meshId,textureSetId:_textureSetId2,origin:tileCenter,primitive:geometryArrays.primitiveName,positionsCompressed:transformedAndRecompressedPositions,normalsCompressed:geometryArrays.geometryNormals,uv:geometryArrays.geometryUVs,colorsCompressed:geometryArrays.geometryColors,indices:geometryArrays.geometryIndices,edgeIndices:geometryArrays.geometryEdgeIndices,positionsDecodeMatrix:tileDecodeMatrix,color:meshColor,metallic:meshMetallic,roughness:meshRoughness,opacity:meshOpacity}));meshIds.push(meshId);}else{if(!geometryCreatedInTile[geometryId]){sceneModel.createGeometry({id:geometryId,primitive:geometryArrays.primitiveName,positionsCompressed:geometryArrays.geometryPositions,normalsCompressed:geometryArrays.geometryNormals,uv:geometryArrays.geometryUVs,colorsCompressed:geometryArrays.geometryColors,indices:geometryArrays.geometryIndices,edgeIndices:geometryArrays.geometryEdgeIndices,positionsDecodeMatrix:reusedGeometriesDecodeMatrix});geometryCreatedInTile[geometryId]=true;}sceneModel.createMesh(utils.apply(meshDefaults,{id:meshId,geometryId:geometryId,textureSetId:_textureSetId2,matrix:meshMatrix,color:meshColor,metallic:meshMetallic,roughness:meshRoughness,opacity:meshOpacity,origin:tileCenter}));meshIds.push(meshId);}}}else{// Do not reuse geometry
29039
- var _primitiveType5=eachGeometryPrimitiveType[_geometryIndex5];var primitiveName=void 0;var _geometryPositions5=void 0;var geometryNormals=void 0;var geometryUVs=void 0;var geometryColors=void 0;var geometryIndices=void 0;var geometryEdgeIndices=void 0;var _geometryValid4=false;switch(_primitiveType5){case 0:primitiveName="solid";_geometryPositions5=positions.subarray(eachGeometryPositionsPortion[_geometryIndex5],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex5+1]);geometryNormals=normals.subarray(eachGeometryNormalsPortion[_geometryIndex5],atLastGeometry?normals.length:eachGeometryNormalsPortion[_geometryIndex5+1]);geometryUVs=uvs.subarray(eachGeometryUVsPortion[_geometryIndex5],atLastGeometry?uvs.length:eachGeometryUVsPortion[_geometryIndex5+1]);geometryIndices=indices.subarray(eachGeometryIndicesPortion[_geometryIndex5],atLastGeometry?indices.length:eachGeometryIndicesPortion[_geometryIndex5+1]);geometryEdgeIndices=edgeIndices.subarray(eachGeometryEdgeIndicesPortion[_geometryIndex5],atLastGeometry?edgeIndices.length:eachGeometryEdgeIndicesPortion[_geometryIndex5+1]);_geometryValid4=_geometryPositions5.length>0&&geometryIndices.length>0;break;case 1:primitiveName="surface";_geometryPositions5=positions.subarray(eachGeometryPositionsPortion[_geometryIndex5],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex5+1]);geometryNormals=normals.subarray(eachGeometryNormalsPortion[_geometryIndex5],atLastGeometry?normals.length:eachGeometryNormalsPortion[_geometryIndex5+1]);geometryUVs=uvs.subarray(eachGeometryUVsPortion[_geometryIndex5],atLastGeometry?uvs.length:eachGeometryUVsPortion[_geometryIndex5+1]);geometryIndices=indices.subarray(eachGeometryIndicesPortion[_geometryIndex5],atLastGeometry?indices.length:eachGeometryIndicesPortion[_geometryIndex5+1]);geometryEdgeIndices=edgeIndices.subarray(eachGeometryEdgeIndicesPortion[_geometryIndex5],atLastGeometry?edgeIndices.length:eachGeometryEdgeIndicesPortion[_geometryIndex5+1]);_geometryValid4=_geometryPositions5.length>0&&geometryIndices.length>0;break;case 2:primitiveName="points";_geometryPositions5=positions.subarray(eachGeometryPositionsPortion[_geometryIndex5],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex5+1]);geometryColors=colors.subarray(eachGeometryColorsPortion[_geometryIndex5],atLastGeometry?colors.length:eachGeometryColorsPortion[_geometryIndex5+1]);_geometryValid4=_geometryPositions5.length>0;break;case 3:primitiveName="lines";_geometryPositions5=positions.subarray(eachGeometryPositionsPortion[_geometryIndex5],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex5+1]);geometryIndices=indices.subarray(eachGeometryIndicesPortion[_geometryIndex5],atLastGeometry?indices.length:eachGeometryIndicesPortion[_geometryIndex5+1]);_geometryValid4=_geometryPositions5.length>0&&geometryIndices.length>0;break;case 4:primitiveName="lines";_geometryPositions5=positions.subarray(eachGeometryPositionsPortion[_geometryIndex5],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex5+1]);geometryIndices=lineStripToLines$1(_geometryPositions5,indices.subarray(eachGeometryIndicesPortion[_geometryIndex5],atLastGeometry?indices.length:eachGeometryIndicesPortion[_geometryIndex5+1]));_geometryValid4=_geometryPositions5.length>0&&geometryIndices.length>0;break;default:continue;}if(_geometryValid4){sceneModel.createMesh(utils.apply(meshDefaults,{id:meshId,textureSetId:_textureSetId2,origin:tileCenter,primitive:primitiveName,positionsCompressed:_geometryPositions5,normalsCompressed:geometryNormals,uv:geometryUVs&&geometryUVs.length>0?geometryUVs:null,colorsCompressed:geometryColors,indices:geometryIndices,edgeIndices:geometryEdgeIndices,positionsDecodeMatrix:tileDecodeMatrix,color:meshColor,metallic:meshMetallic,roughness:meshRoughness,opacity:meshOpacity}));meshIds.push(meshId);}}}if(meshIds.length>0){sceneModel.createEntity(utils.apply(entityDefaults,{id:entityId,isObject:true,meshIds:meshIds}));}}}}function lineStripToLines$1(positions,indices){var linesIndices=[];if(indices.length>1){for(var _i372=0,len=indices.length-1;_i372<len;_i372++){linesIndices.push(indices[_i372]);linesIndices.push(indices[_i372+1]);}}else if(positions.length>1){for(var _i373=0,_len51=positions.length/3-1;_i373<_len51;_i373++){linesIndices.push(_i373);linesIndices.push(_i373+1);}}return linesIndices;}/** @private */ // V11 uses a single uncompressed Uint8Array buffer to store arrays of different types.
29047
+ var geometryArrays=geometryArraysCache[geometryId];if(!geometryArrays){geometryArrays={batchThisMesh:!options.reuseGeometries};var primitiveType=eachGeometryPrimitiveType[_geometryIndex5];var geometryValid=false;switch(primitiveType){case 0:geometryArrays.primitiveName="solid";geometryArrays.geometryPositions=positions.subarray(eachGeometryPositionsPortion[_geometryIndex5],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex5+1]);geometryArrays.geometryNormals=normals.subarray(eachGeometryNormalsPortion[_geometryIndex5],atLastGeometry?normals.length:eachGeometryNormalsPortion[_geometryIndex5+1]);geometryArrays.geometryUVs=uvs.subarray(eachGeometryUVsPortion[_geometryIndex5],atLastGeometry?uvs.length:eachGeometryUVsPortion[_geometryIndex5+1]);geometryArrays.geometryIndices=indices.subarray(eachGeometryIndicesPortion[_geometryIndex5],atLastGeometry?indices.length:eachGeometryIndicesPortion[_geometryIndex5+1]);geometryArrays.geometryEdgeIndices=edgeIndices.subarray(eachGeometryEdgeIndicesPortion[_geometryIndex5],atLastGeometry?edgeIndices.length:eachGeometryEdgeIndicesPortion[_geometryIndex5+1]);geometryValid=geometryArrays.geometryPositions.length>0&&geometryArrays.geometryIndices.length>0;break;case 1:geometryArrays.primitiveName="surface";geometryArrays.geometryPositions=positions.subarray(eachGeometryPositionsPortion[_geometryIndex5],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex5+1]);geometryArrays.geometryNormals=normals.subarray(eachGeometryNormalsPortion[_geometryIndex5],atLastGeometry?normals.length:eachGeometryNormalsPortion[_geometryIndex5+1]);geometryArrays.geometryUVs=uvs.subarray(eachGeometryUVsPortion[_geometryIndex5],atLastGeometry?uvs.length:eachGeometryUVsPortion[_geometryIndex5+1]);geometryArrays.geometryIndices=indices.subarray(eachGeometryIndicesPortion[_geometryIndex5],atLastGeometry?indices.length:eachGeometryIndicesPortion[_geometryIndex5+1]);geometryArrays.geometryEdgeIndices=edgeIndices.subarray(eachGeometryEdgeIndicesPortion[_geometryIndex5],atLastGeometry?edgeIndices.length:eachGeometryEdgeIndicesPortion[_geometryIndex5+1]);geometryValid=geometryArrays.geometryPositions.length>0&&geometryArrays.geometryIndices.length>0;break;case 2:geometryArrays.primitiveName="points";geometryArrays.geometryPositions=positions.subarray(eachGeometryPositionsPortion[_geometryIndex5],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex5+1]);geometryArrays.geometryColors=colors.subarray(eachGeometryColorsPortion[_geometryIndex5],atLastGeometry?colors.length:eachGeometryColorsPortion[_geometryIndex5+1]);geometryValid=geometryArrays.geometryPositions.length>0;break;case 3:geometryArrays.primitiveName="lines";geometryArrays.geometryPositions=positions.subarray(eachGeometryPositionsPortion[_geometryIndex5],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex5+1]);geometryArrays.geometryIndices=indices.subarray(eachGeometryIndicesPortion[_geometryIndex5],atLastGeometry?indices.length:eachGeometryIndicesPortion[_geometryIndex5+1]);geometryValid=geometryArrays.geometryPositions.length>0&&geometryArrays.geometryIndices.length>0;break;case 4:geometryArrays.primitiveName="lines";geometryArrays.geometryPositions=positions.subarray(eachGeometryPositionsPortion[_geometryIndex5],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex5+1]);geometryArrays.geometryIndices=lineStripToLines$1(geometryArrays.geometryPositions,indices.subarray(eachGeometryIndicesPortion[_geometryIndex5],atLastGeometry?indices.length:eachGeometryIndicesPortion[_geometryIndex5+1]));geometryValid=geometryArrays.geometryPositions.length>0&&geometryArrays.geometryIndices.length>0;break;default:continue;}if(!geometryValid){geometryArrays=null;}if(geometryArrays){if(geometryArrays.geometryPositions.length>1000);if(geometryArrays.batchThisMesh){geometryArrays.decompressedPositions=new Float32Array(geometryArrays.geometryPositions.length);geometryArrays.transformedAndRecompressedPositions=new Uint16Array(geometryArrays.geometryPositions.length);var geometryPositions=geometryArrays.geometryPositions;var decompressedPositions=geometryArrays.decompressedPositions;for(var _i372=0,len=geometryPositions.length;_i372<len;_i372+=3){decompressedPositions[_i372+0]=geometryPositions[_i372+0]*reusedGeometriesDecodeMatrix[0]+reusedGeometriesDecodeMatrix[12];decompressedPositions[_i372+1]=geometryPositions[_i372+1]*reusedGeometriesDecodeMatrix[5]+reusedGeometriesDecodeMatrix[13];decompressedPositions[_i372+2]=geometryPositions[_i372+2]*reusedGeometriesDecodeMatrix[10]+reusedGeometriesDecodeMatrix[14];}geometryArrays.geometryPositions=null;geometryArraysCache[geometryId]=geometryArrays;}}}if(geometryArrays){if(geometryArrays.batchThisMesh){var _decompressedPositions4=geometryArrays.decompressedPositions;var transformedAndRecompressedPositions=geometryArrays.transformedAndRecompressedPositions;for(var _i373=0,_len50=_decompressedPositions4.length;_i373<_len50;_i373+=3){tempVec4a$1[0]=_decompressedPositions4[_i373+0];tempVec4a$1[1]=_decompressedPositions4[_i373+1];tempVec4a$1[2]=_decompressedPositions4[_i373+2];tempVec4a$1[3]=1;math.transformVec4(meshMatrix,tempVec4a$1,tempVec4b$1);geometryCompressionUtils.compressPosition(tempVec4b$1,rtcAABB,tempVec4a$1);transformedAndRecompressedPositions[_i373+0]=tempVec4a$1[0];transformedAndRecompressedPositions[_i373+1]=tempVec4a$1[1];transformedAndRecompressedPositions[_i373+2]=tempVec4a$1[2];}sceneModel.createMesh(utils.apply(meshDefaults,{id:meshId,textureSetId:_textureSetId2,origin:tileCenter,primitive:geometryArrays.primitiveName,positionsCompressed:transformedAndRecompressedPositions,normalsCompressed:geometryArrays.geometryNormals,uv:geometryArrays.geometryUVs,colorsCompressed:geometryArrays.geometryColors,indices:geometryArrays.geometryIndices,edgeIndices:geometryArrays.geometryEdgeIndices,positionsDecodeMatrix:tileDecodeMatrix,color:meshColor,metallic:meshMetallic,roughness:meshRoughness,opacity:meshOpacity}));meshIds.push(meshId);}else{if(!geometryCreatedInTile[geometryId]){sceneModel.createGeometry({id:geometryId,primitive:geometryArrays.primitiveName,positionsCompressed:geometryArrays.geometryPositions,normalsCompressed:geometryArrays.geometryNormals,uv:geometryArrays.geometryUVs,colorsCompressed:geometryArrays.geometryColors,indices:geometryArrays.geometryIndices,edgeIndices:geometryArrays.geometryEdgeIndices,positionsDecodeMatrix:reusedGeometriesDecodeMatrix});geometryCreatedInTile[geometryId]=true;}sceneModel.createMesh(utils.apply(meshDefaults,{id:meshId,geometryId:geometryId,textureSetId:_textureSetId2,matrix:meshMatrix,color:meshColor,metallic:meshMetallic,roughness:meshRoughness,opacity:meshOpacity,origin:tileCenter}));meshIds.push(meshId);}}}else{// Do not reuse geometry
29048
+ var _primitiveType5=eachGeometryPrimitiveType[_geometryIndex5];var primitiveName=void 0;var _geometryPositions5=void 0;var geometryNormals=void 0;var geometryUVs=void 0;var geometryColors=void 0;var geometryIndices=void 0;var geometryEdgeIndices=void 0;var _geometryValid4=false;switch(_primitiveType5){case 0:primitiveName="solid";_geometryPositions5=positions.subarray(eachGeometryPositionsPortion[_geometryIndex5],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex5+1]);geometryNormals=normals.subarray(eachGeometryNormalsPortion[_geometryIndex5],atLastGeometry?normals.length:eachGeometryNormalsPortion[_geometryIndex5+1]);geometryUVs=uvs.subarray(eachGeometryUVsPortion[_geometryIndex5],atLastGeometry?uvs.length:eachGeometryUVsPortion[_geometryIndex5+1]);geometryIndices=indices.subarray(eachGeometryIndicesPortion[_geometryIndex5],atLastGeometry?indices.length:eachGeometryIndicesPortion[_geometryIndex5+1]);geometryEdgeIndices=edgeIndices.subarray(eachGeometryEdgeIndicesPortion[_geometryIndex5],atLastGeometry?edgeIndices.length:eachGeometryEdgeIndicesPortion[_geometryIndex5+1]);_geometryValid4=_geometryPositions5.length>0&&geometryIndices.length>0;break;case 1:primitiveName="surface";_geometryPositions5=positions.subarray(eachGeometryPositionsPortion[_geometryIndex5],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex5+1]);geometryNormals=normals.subarray(eachGeometryNormalsPortion[_geometryIndex5],atLastGeometry?normals.length:eachGeometryNormalsPortion[_geometryIndex5+1]);geometryUVs=uvs.subarray(eachGeometryUVsPortion[_geometryIndex5],atLastGeometry?uvs.length:eachGeometryUVsPortion[_geometryIndex5+1]);geometryIndices=indices.subarray(eachGeometryIndicesPortion[_geometryIndex5],atLastGeometry?indices.length:eachGeometryIndicesPortion[_geometryIndex5+1]);geometryEdgeIndices=edgeIndices.subarray(eachGeometryEdgeIndicesPortion[_geometryIndex5],atLastGeometry?edgeIndices.length:eachGeometryEdgeIndicesPortion[_geometryIndex5+1]);_geometryValid4=_geometryPositions5.length>0&&geometryIndices.length>0;break;case 2:primitiveName="points";_geometryPositions5=positions.subarray(eachGeometryPositionsPortion[_geometryIndex5],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex5+1]);geometryColors=colors.subarray(eachGeometryColorsPortion[_geometryIndex5],atLastGeometry?colors.length:eachGeometryColorsPortion[_geometryIndex5+1]);_geometryValid4=_geometryPositions5.length>0;break;case 3:primitiveName="lines";_geometryPositions5=positions.subarray(eachGeometryPositionsPortion[_geometryIndex5],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex5+1]);geometryIndices=indices.subarray(eachGeometryIndicesPortion[_geometryIndex5],atLastGeometry?indices.length:eachGeometryIndicesPortion[_geometryIndex5+1]);_geometryValid4=_geometryPositions5.length>0&&geometryIndices.length>0;break;case 4:primitiveName="lines";_geometryPositions5=positions.subarray(eachGeometryPositionsPortion[_geometryIndex5],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex5+1]);geometryIndices=lineStripToLines$1(_geometryPositions5,indices.subarray(eachGeometryIndicesPortion[_geometryIndex5],atLastGeometry?indices.length:eachGeometryIndicesPortion[_geometryIndex5+1]));_geometryValid4=_geometryPositions5.length>0&&geometryIndices.length>0;break;default:continue;}if(_geometryValid4){sceneModel.createMesh(utils.apply(meshDefaults,{id:meshId,textureSetId:_textureSetId2,origin:tileCenter,primitive:primitiveName,positionsCompressed:_geometryPositions5,normalsCompressed:geometryNormals,uv:geometryUVs&&geometryUVs.length>0?geometryUVs:null,colorsCompressed:geometryColors,indices:geometryIndices,edgeIndices:geometryEdgeIndices,positionsDecodeMatrix:tileDecodeMatrix,color:meshColor,metallic:meshMetallic,roughness:meshRoughness,opacity:meshOpacity}));meshIds.push(meshId);}}}if(meshIds.length>0){sceneModel.createEntity(utils.apply(entityDefaults,{id:entityId,isObject:true,meshIds:meshIds}));}}}}function lineStripToLines$1(positions,indices){var linesIndices=[];if(indices.length>1){for(var _i374=0,len=indices.length-1;_i374<len;_i374++){linesIndices.push(indices[_i374]);linesIndices.push(indices[_i374+1]);}}else if(positions.length>1){for(var _i375=0,_len51=positions.length/3-1;_i375<_len51;_i375++){linesIndices.push(_i375);linesIndices.push(_i375+1);}}return linesIndices;}/** @private */ // V11 uses a single uncompressed Uint8Array buffer to store arrays of different types.
29040
29049
  // To efficiently create typed arrays from this buffer,
29041
29050
  // each typed array's source data needs to be aligned with its element byte size.
29042
29051
  // This sometimes requires padding subarrays inside the single Uint8Array, so the byteOffset needs to be stored alongside element count.
@@ -29066,9 +29075,9 @@ if(options.includeIdsMap&&metaObject.id&&!options.includeIdsMap[metaObject.id]){
29066
29075
  var props=options.objectDefaults?options.objectDefaults[metaObject.type]||options.objectDefaults["DEFAULT"]:null;if(props){if(props.visible===false){entityDefaults.visible=false;}if(props.pickable===false){entityDefaults.pickable=false;}if(props.colorize){meshDefaults.color=props.colorize;}if(props.opacity!==undefined&&props.opacity!==null){meshDefaults.opacity=props.opacity;}if(props.metallic!==undefined&&props.metallic!==null){meshDefaults.metallic=props.metallic;}if(props.roughness!==undefined&&props.roughness!==null){meshDefaults.roughness=props.roughness;}}}else{if(options.excludeUnclassifiedObjects){continue;}}// Iterate each entity's meshes
29067
29076
  for(var _meshIndex6=firstMeshIndex;_meshIndex6<=lastMeshIndex;_meshIndex6++){var _geometryIndex6=eachMeshGeometriesPortion[_meshIndex6];var geometryReuseCount=geometryReuseCounts[_geometryIndex6];var isReusedGeometry=geometryReuseCount>1;var atLastGeometry=_geometryIndex6===numGeometries-1;var _textureSetIndex3=eachMeshTextureSet[_meshIndex6];var _textureSetId3=_textureSetIndex3>=0?"".concat(modelPartId,"-textureSet-").concat(_textureSetIndex3):null;var meshColor=decompressColor(eachMeshMaterialAttributes.subarray(_meshIndex6*6,_meshIndex6*6+3));var meshOpacity=eachMeshMaterialAttributes[_meshIndex6*6+3]/255.0;var meshMetallic=eachMeshMaterialAttributes[_meshIndex6*6+4]/255.0;var meshRoughness=eachMeshMaterialAttributes[_meshIndex6*6+5]/255.0;var meshId=manifestCtx.getNextId();if(isReusedGeometry){// Create mesh for multi-use geometry - create (or reuse) geometry, create mesh using that geometry
29068
29077
  var meshMatrixIndex=eachMeshMatricesPortion[_meshIndex6];var meshMatrix=matrices.slice(meshMatrixIndex,meshMatrixIndex+16);var geometryId="".concat(modelPartId,"-geometry.").concat(tileIndex,".").concat(_geometryIndex6);// These IDs are local to the SceneModel
29069
- var geometryArrays=geometryArraysCache[geometryId];if(!geometryArrays){geometryArrays={batchThisMesh:!options.reuseGeometries};var primitiveType=eachGeometryPrimitiveType[_geometryIndex6];var axisLabel=eachGeometryAxisLabel[_geometryIndex6];var geometryValid=false;var ifcLabel=void 0;switch(primitiveType){case 0:geometryArrays.primitiveName="solid";geometryArrays.geometryPositions=positions.subarray(eachGeometryPositionsPortion[_geometryIndex6],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex6+1]);geometryArrays.geometryNormals=normals.subarray(eachGeometryNormalsPortion[_geometryIndex6],atLastGeometry?normals.length:eachGeometryNormalsPortion[_geometryIndex6+1]);geometryArrays.geometryUVs=uvs.subarray(eachGeometryUVsPortion[_geometryIndex6],atLastGeometry?uvs.length:eachGeometryUVsPortion[_geometryIndex6+1]);geometryArrays.geometryIndices=indices.subarray(eachGeometryIndicesPortion[_geometryIndex6],atLastGeometry?indices.length:eachGeometryIndicesPortion[_geometryIndex6+1]);geometryArrays.geometryEdgeIndices=edgeIndices.subarray(eachGeometryEdgeIndicesPortion[_geometryIndex6],atLastGeometry?edgeIndices.length:eachGeometryEdgeIndicesPortion[_geometryIndex6+1]);geometryValid=geometryArrays.geometryPositions.length>0&&geometryArrays.geometryIndices.length>0;break;case 1:geometryArrays.primitiveName="surface";geometryArrays.geometryPositions=positions.subarray(eachGeometryPositionsPortion[_geometryIndex6],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex6+1]);geometryArrays.geometryNormals=normals.subarray(eachGeometryNormalsPortion[_geometryIndex6],atLastGeometry?normals.length:eachGeometryNormalsPortion[_geometryIndex6+1]);geometryArrays.geometryUVs=uvs.subarray(eachGeometryUVsPortion[_geometryIndex6],atLastGeometry?uvs.length:eachGeometryUVsPortion[_geometryIndex6+1]);geometryArrays.geometryIndices=indices.subarray(eachGeometryIndicesPortion[_geometryIndex6],atLastGeometry?indices.length:eachGeometryIndicesPortion[_geometryIndex6+1]);geometryArrays.geometryEdgeIndices=edgeIndices.subarray(eachGeometryEdgeIndicesPortion[_geometryIndex6],atLastGeometry?edgeIndices.length:eachGeometryEdgeIndicesPortion[_geometryIndex6+1]);geometryValid=geometryArrays.geometryPositions.length>0&&geometryArrays.geometryIndices.length>0;break;case 2:geometryArrays.primitiveName="points";geometryArrays.geometryPositions=positions.subarray(eachGeometryPositionsPortion[_geometryIndex6],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex6+1]);geometryArrays.geometryColors=colors.subarray(eachGeometryColorsPortion[_geometryIndex6],atLastGeometry?colors.length:eachGeometryColorsPortion[_geometryIndex6+1]);geometryValid=geometryArrays.geometryPositions.length>0;break;case 3:geometryArrays.primitiveName="lines";geometryArrays.geometryPositions=positions.subarray(eachGeometryPositionsPortion[_geometryIndex6],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex6+1]);geometryArrays.geometryIndices=indices.subarray(eachGeometryIndicesPortion[_geometryIndex6],atLastGeometry?indices.length:eachGeometryIndicesPortion[_geometryIndex6+1]);geometryValid=geometryArrays.geometryPositions.length>0&&geometryArrays.geometryIndices.length>0;break;case 4:geometryArrays.primitiveName="lines";geometryArrays.geometryPositions=positions.subarray(eachGeometryPositionsPortion[_geometryIndex6],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex6+1]);geometryArrays.geometryIndices=lineStripToLines(geometryArrays.geometryPositions,indices.subarray(eachGeometryIndicesPortion[_geometryIndex6],atLastGeometry?indices.length:eachGeometryIndicesPortion[_geometryIndex6+1]));geometryValid=geometryArrays.geometryPositions.length>0&&geometryArrays.geometryIndices.length>0;break;case 7:geometryArrays.primitiveName="lines";geometryArrays.geometryPositions=positions.subarray(eachGeometryPositionsPortion[_geometryIndex6],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex6+1]);geometryArrays.decompressedPositions=geometryCompressionUtils.decompressPositions(geometryArrays.geometryPositions,reusedGeometriesDecodeMatrix);ifcLabel=buildVectorTextGeometry({origin:geometryArrays.decompressedPositions,text:axisLabel,size:2});geometryArrays.decompressedPositions=ifcLabel.positions;geometryArrays.geometryIndices=ifcLabel.indices;geometryArrays.geometryPositions=null;geometryValid=geometryArrays.decompressedPositions.length>0&&geometryArrays.geometryIndices.length>0;break;default:continue;}if(!geometryValid){geometryArrays=null;}if(geometryArrays){if(geometryArrays.geometryPositions&&geometryArrays.geometryPositions.length>1000);if(geometryArrays.batchThisMesh){if(primitiveType===7){geometryArrays.transformedAndRecompressedPositions=new Uint16Array(geometryArrays.decompressedPositions.length);}else{geometryArrays.decompressedPositions=new Float32Array(geometryArrays.geometryPositions.length);geometryArrays.transformedAndRecompressedPositions=new Uint16Array(geometryArrays.geometryPositions.length);var geometryPositions=geometryArrays.geometryPositions;var decompressedPositions=geometryArrays.decompressedPositions;for(var _i374=0,len=geometryPositions.length;_i374<len;_i374+=3){decompressedPositions[_i374+0]=geometryPositions[_i374+0]*reusedGeometriesDecodeMatrix[0]+reusedGeometriesDecodeMatrix[12];decompressedPositions[_i374+1]=geometryPositions[_i374+1]*reusedGeometriesDecodeMatrix[5]+reusedGeometriesDecodeMatrix[13];decompressedPositions[_i374+2]=geometryPositions[_i374+2]*reusedGeometriesDecodeMatrix[10]+reusedGeometriesDecodeMatrix[14];}geometryArrays.geometryPositions=null;}geometryArraysCache[geometryId]=geometryArrays;}}}if(geometryArrays){if(geometryArrays.batchThisMesh){var _decompressedPositions5=geometryArrays.decompressedPositions;var transformedAndRecompressedPositions=geometryArrays.transformedAndRecompressedPositions;for(var _i375=0,_len52=_decompressedPositions5.length;_i375<_len52;_i375+=3){tempVec4a[0]=_decompressedPositions5[_i375+0];tempVec4a[1]=_decompressedPositions5[_i375+1];tempVec4a[2]=_decompressedPositions5[_i375+2];tempVec4a[3]=1;math.transformVec4(meshMatrix,tempVec4a,tempVec4b);geometryCompressionUtils.compressPosition(tempVec4b,rtcAABB,tempVec4a);transformedAndRecompressedPositions[_i375+0]=tempVec4a[0];transformedAndRecompressedPositions[_i375+1]=tempVec4a[1];transformedAndRecompressedPositions[_i375+2]=tempVec4a[2];}sceneModel.createMesh(utils.apply(meshDefaults,{id:meshId,textureSetId:_textureSetId3,origin:tileCenter,primitive:geometryArrays.primitiveName,positionsCompressed:transformedAndRecompressedPositions,normalsCompressed:geometryArrays.geometryNormals,uv:geometryArrays.geometryUVs,colorsCompressed:geometryArrays.geometryColors,indices:geometryArrays.geometryIndices,edgeIndices:geometryArrays.geometryEdgeIndices,positionsDecodeMatrix:tileDecodeMatrix,color:meshColor,metallic:meshMetallic,roughness:meshRoughness,opacity:meshOpacity}));meshIds.push(meshId);}else{if(!geometryCreatedInTile[geometryId]){var geometryCfg={id:geometryId,primitive:geometryArrays.primitiveName,normalsCompressed:geometryArrays.geometryNormals,uv:geometryArrays.geometryUVs,colorsCompressed:geometryArrays.geometryColors,indices:geometryArrays.geometryIndices,edgeIndices:geometryArrays.geometryEdgeIndices};if(geometryArrays.geometryPositions){geometryCfg=_objectSpread(_objectSpread({},geometryCfg),{},{positionsCompressed:geometryArrays.geometryPositions,positionsDecodeMatrix:reusedGeometriesDecodeMatrix});}else{geometryCfg=_objectSpread(_objectSpread({},geometryCfg),{},{positions:geometryArrays.decompressedPositions});}sceneModel.createGeometry(geometryCfg);geometryCreatedInTile[geometryId]=true;}sceneModel.createMesh(utils.apply(meshDefaults,{id:meshId,geometryId:geometryId,textureSetId:_textureSetId3,matrix:meshMatrix,color:meshColor,metallic:meshMetallic,roughness:meshRoughness,opacity:meshOpacity,origin:tileCenter}));meshIds.push(meshId);}}}else{// Do not reuse geometry
29078
+ var geometryArrays=geometryArraysCache[geometryId];if(!geometryArrays){geometryArrays={batchThisMesh:!options.reuseGeometries};var primitiveType=eachGeometryPrimitiveType[_geometryIndex6];var axisLabel=eachGeometryAxisLabel[_geometryIndex6];var geometryValid=false;var ifcLabel=void 0;switch(primitiveType){case 0:geometryArrays.primitiveName="solid";geometryArrays.geometryPositions=positions.subarray(eachGeometryPositionsPortion[_geometryIndex6],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex6+1]);geometryArrays.geometryNormals=normals.subarray(eachGeometryNormalsPortion[_geometryIndex6],atLastGeometry?normals.length:eachGeometryNormalsPortion[_geometryIndex6+1]);geometryArrays.geometryUVs=uvs.subarray(eachGeometryUVsPortion[_geometryIndex6],atLastGeometry?uvs.length:eachGeometryUVsPortion[_geometryIndex6+1]);geometryArrays.geometryIndices=indices.subarray(eachGeometryIndicesPortion[_geometryIndex6],atLastGeometry?indices.length:eachGeometryIndicesPortion[_geometryIndex6+1]);geometryArrays.geometryEdgeIndices=edgeIndices.subarray(eachGeometryEdgeIndicesPortion[_geometryIndex6],atLastGeometry?edgeIndices.length:eachGeometryEdgeIndicesPortion[_geometryIndex6+1]);geometryValid=geometryArrays.geometryPositions.length>0&&geometryArrays.geometryIndices.length>0;break;case 1:geometryArrays.primitiveName="surface";geometryArrays.geometryPositions=positions.subarray(eachGeometryPositionsPortion[_geometryIndex6],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex6+1]);geometryArrays.geometryNormals=normals.subarray(eachGeometryNormalsPortion[_geometryIndex6],atLastGeometry?normals.length:eachGeometryNormalsPortion[_geometryIndex6+1]);geometryArrays.geometryUVs=uvs.subarray(eachGeometryUVsPortion[_geometryIndex6],atLastGeometry?uvs.length:eachGeometryUVsPortion[_geometryIndex6+1]);geometryArrays.geometryIndices=indices.subarray(eachGeometryIndicesPortion[_geometryIndex6],atLastGeometry?indices.length:eachGeometryIndicesPortion[_geometryIndex6+1]);geometryArrays.geometryEdgeIndices=edgeIndices.subarray(eachGeometryEdgeIndicesPortion[_geometryIndex6],atLastGeometry?edgeIndices.length:eachGeometryEdgeIndicesPortion[_geometryIndex6+1]);geometryValid=geometryArrays.geometryPositions.length>0&&geometryArrays.geometryIndices.length>0;break;case 2:geometryArrays.primitiveName="points";geometryArrays.geometryPositions=positions.subarray(eachGeometryPositionsPortion[_geometryIndex6],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex6+1]);geometryArrays.geometryColors=colors.subarray(eachGeometryColorsPortion[_geometryIndex6],atLastGeometry?colors.length:eachGeometryColorsPortion[_geometryIndex6+1]);geometryValid=geometryArrays.geometryPositions.length>0;break;case 3:geometryArrays.primitiveName="lines";geometryArrays.geometryPositions=positions.subarray(eachGeometryPositionsPortion[_geometryIndex6],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex6+1]);geometryArrays.geometryIndices=indices.subarray(eachGeometryIndicesPortion[_geometryIndex6],atLastGeometry?indices.length:eachGeometryIndicesPortion[_geometryIndex6+1]);geometryValid=geometryArrays.geometryPositions.length>0&&geometryArrays.geometryIndices.length>0;break;case 4:geometryArrays.primitiveName="lines";geometryArrays.geometryPositions=positions.subarray(eachGeometryPositionsPortion[_geometryIndex6],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex6+1]);geometryArrays.geometryIndices=lineStripToLines(geometryArrays.geometryPositions,indices.subarray(eachGeometryIndicesPortion[_geometryIndex6],atLastGeometry?indices.length:eachGeometryIndicesPortion[_geometryIndex6+1]));geometryValid=geometryArrays.geometryPositions.length>0&&geometryArrays.geometryIndices.length>0;break;case 7:geometryArrays.primitiveName="lines";geometryArrays.geometryPositions=positions.subarray(eachGeometryPositionsPortion[_geometryIndex6],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex6+1]);geometryArrays.decompressedPositions=geometryCompressionUtils.decompressPositions(geometryArrays.geometryPositions,reusedGeometriesDecodeMatrix);ifcLabel=buildVectorTextGeometry({origin:geometryArrays.decompressedPositions,text:axisLabel,size:2});geometryArrays.decompressedPositions=ifcLabel.positions;geometryArrays.geometryIndices=ifcLabel.indices;geometryArrays.geometryPositions=null;geometryValid=geometryArrays.decompressedPositions.length>0&&geometryArrays.geometryIndices.length>0;break;default:continue;}if(!geometryValid){geometryArrays=null;}if(geometryArrays){if(geometryArrays.geometryPositions&&geometryArrays.geometryPositions.length>1000);if(geometryArrays.batchThisMesh){if(primitiveType===7){geometryArrays.transformedAndRecompressedPositions=new Uint16Array(geometryArrays.decompressedPositions.length);}else{geometryArrays.decompressedPositions=new Float32Array(geometryArrays.geometryPositions.length);geometryArrays.transformedAndRecompressedPositions=new Uint16Array(geometryArrays.geometryPositions.length);var geometryPositions=geometryArrays.geometryPositions;var decompressedPositions=geometryArrays.decompressedPositions;for(var _i376=0,len=geometryPositions.length;_i376<len;_i376+=3){decompressedPositions[_i376+0]=geometryPositions[_i376+0]*reusedGeometriesDecodeMatrix[0]+reusedGeometriesDecodeMatrix[12];decompressedPositions[_i376+1]=geometryPositions[_i376+1]*reusedGeometriesDecodeMatrix[5]+reusedGeometriesDecodeMatrix[13];decompressedPositions[_i376+2]=geometryPositions[_i376+2]*reusedGeometriesDecodeMatrix[10]+reusedGeometriesDecodeMatrix[14];}geometryArrays.geometryPositions=null;}geometryArraysCache[geometryId]=geometryArrays;}}}if(geometryArrays){if(geometryArrays.batchThisMesh){var _decompressedPositions5=geometryArrays.decompressedPositions;var transformedAndRecompressedPositions=geometryArrays.transformedAndRecompressedPositions;for(var _i377=0,_len52=_decompressedPositions5.length;_i377<_len52;_i377+=3){tempVec4a[0]=_decompressedPositions5[_i377+0];tempVec4a[1]=_decompressedPositions5[_i377+1];tempVec4a[2]=_decompressedPositions5[_i377+2];tempVec4a[3]=1;math.transformVec4(meshMatrix,tempVec4a,tempVec4b);geometryCompressionUtils.compressPosition(tempVec4b,rtcAABB,tempVec4a);transformedAndRecompressedPositions[_i377+0]=tempVec4a[0];transformedAndRecompressedPositions[_i377+1]=tempVec4a[1];transformedAndRecompressedPositions[_i377+2]=tempVec4a[2];}sceneModel.createMesh(utils.apply(meshDefaults,{id:meshId,textureSetId:_textureSetId3,origin:tileCenter,primitive:geometryArrays.primitiveName,positionsCompressed:transformedAndRecompressedPositions,normalsCompressed:geometryArrays.geometryNormals,uv:geometryArrays.geometryUVs,colorsCompressed:geometryArrays.geometryColors,indices:geometryArrays.geometryIndices,edgeIndices:geometryArrays.geometryEdgeIndices,positionsDecodeMatrix:tileDecodeMatrix,color:meshColor,metallic:meshMetallic,roughness:meshRoughness,opacity:meshOpacity}));meshIds.push(meshId);}else{if(!geometryCreatedInTile[geometryId]){var geometryCfg={id:geometryId,primitive:geometryArrays.primitiveName,normalsCompressed:geometryArrays.geometryNormals,uv:geometryArrays.geometryUVs,colorsCompressed:geometryArrays.geometryColors,indices:geometryArrays.geometryIndices,edgeIndices:geometryArrays.geometryEdgeIndices};if(geometryArrays.geometryPositions){geometryCfg=_objectSpread(_objectSpread({},geometryCfg),{},{positionsCompressed:geometryArrays.geometryPositions,positionsDecodeMatrix:reusedGeometriesDecodeMatrix});}else{geometryCfg=_objectSpread(_objectSpread({},geometryCfg),{},{positions:geometryArrays.decompressedPositions});}sceneModel.createGeometry(geometryCfg);geometryCreatedInTile[geometryId]=true;}sceneModel.createMesh(utils.apply(meshDefaults,{id:meshId,geometryId:geometryId,textureSetId:_textureSetId3,matrix:meshMatrix,color:meshColor,metallic:meshMetallic,roughness:meshRoughness,opacity:meshOpacity,origin:tileCenter}));meshIds.push(meshId);}}}else{// Do not reuse geometry
29070
29079
  var _primitiveType6=eachGeometryPrimitiveType[_geometryIndex6];var _axisLabel=eachGeometryAxisLabel[_geometryIndex6];var primitiveName=void 0;var _geometryPositions6=void 0;var geometryNormals=void 0;var geometryUVs=void 0;var geometryColors=void 0;var geometryIndices=void 0;var geometryEdgeIndices=void 0;var _geometryValid5=false;var _ifcLabel=void 0;switch(_primitiveType6){case 0:primitiveName="solid";_geometryPositions6=positions.subarray(eachGeometryPositionsPortion[_geometryIndex6],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex6+1]);geometryNormals=normals.subarray(eachGeometryNormalsPortion[_geometryIndex6],atLastGeometry?normals.length:eachGeometryNormalsPortion[_geometryIndex6+1]);geometryUVs=uvs.subarray(eachGeometryUVsPortion[_geometryIndex6],atLastGeometry?uvs.length:eachGeometryUVsPortion[_geometryIndex6+1]);geometryIndices=indices.subarray(eachGeometryIndicesPortion[_geometryIndex6],atLastGeometry?indices.length:eachGeometryIndicesPortion[_geometryIndex6+1]);geometryEdgeIndices=edgeIndices.subarray(eachGeometryEdgeIndicesPortion[_geometryIndex6],atLastGeometry?edgeIndices.length:eachGeometryEdgeIndicesPortion[_geometryIndex6+1]);_geometryValid5=_geometryPositions6.length>0&&geometryIndices.length>0;break;case 1:primitiveName="surface";_geometryPositions6=positions.subarray(eachGeometryPositionsPortion[_geometryIndex6],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex6+1]);geometryNormals=normals.subarray(eachGeometryNormalsPortion[_geometryIndex6],atLastGeometry?normals.length:eachGeometryNormalsPortion[_geometryIndex6+1]);geometryUVs=uvs.subarray(eachGeometryUVsPortion[_geometryIndex6],atLastGeometry?uvs.length:eachGeometryUVsPortion[_geometryIndex6+1]);geometryIndices=indices.subarray(eachGeometryIndicesPortion[_geometryIndex6],atLastGeometry?indices.length:eachGeometryIndicesPortion[_geometryIndex6+1]);geometryEdgeIndices=edgeIndices.subarray(eachGeometryEdgeIndicesPortion[_geometryIndex6],atLastGeometry?edgeIndices.length:eachGeometryEdgeIndicesPortion[_geometryIndex6+1]);_geometryValid5=_geometryPositions6.length>0&&geometryIndices.length>0;break;case 2:primitiveName="points";_geometryPositions6=positions.subarray(eachGeometryPositionsPortion[_geometryIndex6],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex6+1]);geometryColors=colors.subarray(eachGeometryColorsPortion[_geometryIndex6],atLastGeometry?colors.length:eachGeometryColorsPortion[_geometryIndex6+1]);_geometryValid5=_geometryPositions6.length>0;break;case 3:primitiveName="lines";_geometryPositions6=positions.subarray(eachGeometryPositionsPortion[_geometryIndex6],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex6+1]);geometryIndices=indices.subarray(eachGeometryIndicesPortion[_geometryIndex6],atLastGeometry?indices.length:eachGeometryIndicesPortion[_geometryIndex6+1]);_geometryValid5=_geometryPositions6.length>0&&geometryIndices.length>0;break;case 4:primitiveName="lines";_geometryPositions6=positions.subarray(eachGeometryPositionsPortion[_geometryIndex6],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex6+1]);geometryIndices=lineStripToLines(_geometryPositions6,indices.subarray(eachGeometryIndicesPortion[_geometryIndex6],atLastGeometry?indices.length:eachGeometryIndicesPortion[_geometryIndex6+1]));_geometryValid5=_geometryPositions6.length>0&&geometryIndices.length>0;break;//Ifc Labels
29071
- case 7:primitiveName="lines";_geometryPositions6=positions.subarray(eachGeometryPositionsPortion[_geometryIndex6],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex6+1]);_geometryPositions6=geometryCompressionUtils.decompressPositions(_geometryPositions6,tileDecodeMatrix);_ifcLabel=buildVectorTextGeometry({origin:_geometryPositions6,text:_axisLabel,size:2});_geometryPositions6=_ifcLabel.positions;geometryIndices=_ifcLabel.indices;_geometryValid5=_geometryPositions6.length>0&&geometryIndices.length>0;break;default:continue;}if(_geometryValid5){var meshCfg=utils.apply(meshDefaults,{id:meshId,textureSetId:_textureSetId3,origin:tileCenter,primitive:primitiveName,normalsCompressed:geometryNormals,uv:geometryUVs&&geometryUVs.length>0?geometryUVs:null,colorsCompressed:geometryColors,indices:geometryIndices,edgeIndices:geometryEdgeIndices,color:meshColor,metallic:meshMetallic,roughness:meshRoughness,opacity:meshOpacity});if(_primitiveType6!==7){meshCfg=_objectSpread(_objectSpread({},meshCfg),{},{positionsCompressed:_geometryPositions6,positionsDecodeMatrix:tileDecodeMatrix});}else{meshCfg=_objectSpread(_objectSpread({},meshCfg),{},{positions:_geometryPositions6});}sceneModel.createMesh(meshCfg);meshIds.push(meshId);}}}if(meshIds.length>0){sceneModel.createEntity(utils.apply(entityDefaults,{id:entityId,isObject:true,meshIds:meshIds}));}}}}function lineStripToLines(positions,indices){var linesIndices=[];if(indices.length>1){for(var _i376=0,len=indices.length-1;_i376<len;_i376++){linesIndices.push(indices[_i376]);linesIndices.push(indices[_i376+1]);}}else if(positions.length>1){for(var _i377=0,_len53=positions.length/3-1;_i377<_len53;_i377++){linesIndices.push(_i377);linesIndices.push(_i377+1);}}return linesIndices;}/** @private */ // V11 uses a single uncompressed Uint8Array buffer to store arrays of different types.
29080
+ case 7:primitiveName="lines";_geometryPositions6=positions.subarray(eachGeometryPositionsPortion[_geometryIndex6],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex6+1]);_geometryPositions6=geometryCompressionUtils.decompressPositions(_geometryPositions6,tileDecodeMatrix);_ifcLabel=buildVectorTextGeometry({origin:_geometryPositions6,text:_axisLabel,size:2});_geometryPositions6=_ifcLabel.positions;geometryIndices=_ifcLabel.indices;_geometryValid5=_geometryPositions6.length>0&&geometryIndices.length>0;break;default:continue;}if(_geometryValid5){var meshCfg=utils.apply(meshDefaults,{id:meshId,textureSetId:_textureSetId3,origin:tileCenter,primitive:primitiveName,normalsCompressed:geometryNormals,uv:geometryUVs&&geometryUVs.length>0?geometryUVs:null,colorsCompressed:geometryColors,indices:geometryIndices,edgeIndices:geometryEdgeIndices,color:meshColor,metallic:meshMetallic,roughness:meshRoughness,opacity:meshOpacity});if(_primitiveType6!==7){meshCfg=_objectSpread(_objectSpread({},meshCfg),{},{positionsCompressed:_geometryPositions6,positionsDecodeMatrix:tileDecodeMatrix});}else{meshCfg=_objectSpread(_objectSpread({},meshCfg),{},{positions:_geometryPositions6});}sceneModel.createMesh(meshCfg);meshIds.push(meshId);}}}if(meshIds.length>0){sceneModel.createEntity(utils.apply(entityDefaults,{id:entityId,isObject:true,meshIds:meshIds}));}}}}function lineStripToLines(positions,indices){var linesIndices=[];if(indices.length>1){for(var _i378=0,len=indices.length-1;_i378<len;_i378++){linesIndices.push(indices[_i378]);linesIndices.push(indices[_i378+1]);}}else if(positions.length>1){for(var _i379=0,_len53=positions.length/3-1;_i379<_len53;_i379++){linesIndices.push(_i379);linesIndices.push(_i379+1);}}return linesIndices;}/** @private */ // V11 uses a single uncompressed Uint8Array buffer to store arrays of different types.
29072
29081
  // To efficiently create typed arrays from this buffer,
29073
29082
  // each typed array's source data needs to be aligned with its element byte size.
29074
29083
  // This sometimes requires padding subarrays inside the single Uint8Array, so the byteOffset needs to be stored alongside element count.
@@ -29856,13 +29865,13 @@ var ParserV12={version:12,parseArrayBuffer:function parseArrayBuffer(viewer,opti
29856
29865
  * SceneModels are drawn when they have transparent objects, to give control over the order in which those objects are blended within the transparent
29857
29866
  * render pass.
29858
29867
  * @returns {Entity} Entity representing the model, which will have {@link Entity#isModel} set ````true```` and will be registered by {@link Entity#id} in {@link Scene#models}.
29859
- */},{key:"load",value:function load(){var _this189=this;var params=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};if(params.id&&this.viewer.scene.components[params.id]){this.error("Component with this ID already exists in viewer: "+params.id+" - will autogenerate this ID");delete params.id;}if(!params.src&&!params.xkt&&!params.manifestSrc&&!params.manifest)throw new Error("XKTLoaderPlugin: load() param expected: src, xkt, manifestSrc or manifestData");var options={};var includeTypes=params.includeTypes||this._includeTypes;var excludeTypes=params.excludeTypes||this._excludeTypes;var includeIds=params.includeIds||this._includeIds;var objectDefaults=params.objectDefaults||this._objectDefaults;options.reuseGeometries=params.reuseGeometries!==null&&params.reuseGeometries!==undefined?params.reuseGeometries:this._reuseGeometries!==false;if(includeTypes){options.includeTypesMap={};for(var _i378=0,len=includeTypes.length;_i378<len;_i378++){options.includeTypesMap[includeTypes[_i378]]=true;}}if(excludeTypes){options.excludeTypesMap={};for(var _i379=0,_len54=excludeTypes.length;_i379<_len54;_i379++){options.excludeTypesMap[excludeTypes[_i379]]=true;}}if(includeIds){options.includeIdsMap={};for(var _i380=0,_len55=includeIds.length;_i380<_len55;_i380++){options.includeIdsMap[includeIds[_i380]]=true;}}if(objectDefaults){options.objectDefaults=objectDefaults;}options.excludeUnclassifiedObjects=params.excludeUnclassifiedObjects!==undefined?!!params.excludeUnclassifiedObjects:this._excludeUnclassifiedObjects;options.globalizeObjectIds=params.globalizeObjectIds!==undefined&&params.globalizeObjectIds!==null?!!params.globalizeObjectIds:this._globalizeObjectIds;var sceneModel=new SceneModel(this.viewer.scene,utils.apply(params,{isModel:true,textureTranscoder:this._textureTranscoder,maxGeometryBatchSize:this._maxGeometryBatchSize,origin:params.origin,disableVertexWelding:params.disableVertexWelding||false,disableIndexRebucketing:params.disableIndexRebucketing||false,dtxEnabled:params.dtxEnabled,renderOrder:params.renderOrder}));var modelId=sceneModel.id;// In case ID was auto-generated
29868
+ */},{key:"load",value:function load(){var _this189=this;var params=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};if(params.id&&this.viewer.scene.components[params.id]){this.error("Component with this ID already exists in viewer: "+params.id+" - will autogenerate this ID");delete params.id;}if(!params.src&&!params.xkt&&!params.manifestSrc&&!params.manifest)throw new Error("XKTLoaderPlugin: load() param expected: src, xkt, manifestSrc or manifestData");var options={};var includeTypes=params.includeTypes||this._includeTypes;var excludeTypes=params.excludeTypes||this._excludeTypes;var includeIds=params.includeIds||this._includeIds;var objectDefaults=params.objectDefaults||this._objectDefaults;options.reuseGeometries=params.reuseGeometries!==null&&params.reuseGeometries!==undefined?params.reuseGeometries:this._reuseGeometries!==false;if(includeTypes){options.includeTypesMap={};for(var _i380=0,len=includeTypes.length;_i380<len;_i380++){options.includeTypesMap[includeTypes[_i380]]=true;}}if(excludeTypes){options.excludeTypesMap={};for(var _i381=0,_len54=excludeTypes.length;_i381<_len54;_i381++){options.excludeTypesMap[excludeTypes[_i381]]=true;}}if(includeIds){options.includeIdsMap={};for(var _i382=0,_len55=includeIds.length;_i382<_len55;_i382++){options.includeIdsMap[includeIds[_i382]]=true;}}if(objectDefaults){options.objectDefaults=objectDefaults;}options.excludeUnclassifiedObjects=params.excludeUnclassifiedObjects!==undefined?!!params.excludeUnclassifiedObjects:this._excludeUnclassifiedObjects;options.globalizeObjectIds=params.globalizeObjectIds!==undefined&&params.globalizeObjectIds!==null?!!params.globalizeObjectIds:this._globalizeObjectIds;var sceneModel=new SceneModel(this.viewer.scene,utils.apply(params,{isModel:true,textureTranscoder:this._textureTranscoder,maxGeometryBatchSize:this._maxGeometryBatchSize,origin:params.origin,disableVertexWelding:params.disableVertexWelding||false,disableIndexRebucketing:params.disableIndexRebucketing||false,dtxEnabled:params.dtxEnabled,renderOrder:params.renderOrder}));var modelId=sceneModel.id;// In case ID was auto-generated
29860
29869
  var metaModel=new MetaModel({metaScene:this.viewer.metaScene,id:modelId});this.viewer.scene.canvas.spinner.processes++;var finish=function finish(){if(sceneModel.destroyed){return;}// this._createDefaultMetaModelIfNeeded(sceneModel, params, options);
29861
29870
  sceneModel.finalize();metaModel.finalize();_this189.viewer.scene.canvas.spinner.processes--;sceneModel.once("destroyed",function(){_this189.viewer.metaScene.destroyMetaModel(metaModel.id);});_this189.scheduleTask(function(){if(sceneModel.destroyed){return;}sceneModel.scene.fire("modelLoaded",sceneModel.id);// FIXME: Assumes listeners know order of these two events
29862
29871
  sceneModel.fire("loaded",true,false);// Don't forget the event, for late subscribers
29863
29872
  });};var error=function error(errMsg){_this189.viewer.scene.canvas.spinner.processes--;_this189.error(errMsg);sceneModel.fire("error",errMsg);};var nextId=0;var manifestCtx={getNextId:function getNextId(){return"".concat(modelId,".").concat(nextId++);}};if(params.metaModelSrc||params.metaModelData){if(params.metaModelSrc){var metaModelSrc=params.metaModelSrc;this._dataSource.getMetaModel(metaModelSrc,function(metaModelData){if(sceneModel.destroyed){return;}metaModel.loadData(metaModelData,{includeTypes:includeTypes,excludeTypes:excludeTypes,globalizeObjectIds:options.globalizeObjectIds});if(params.src){_this189._loadModel(params.src,options,sceneModel,null,manifestCtx,finish,error);}else{_this189._parseModel(params.xkt,options,sceneModel,null,manifestCtx);finish();}},function(errMsg){error("load(): Failed to load model metadata for model '".concat(modelId," from '").concat(metaModelSrc,"' - ").concat(errMsg));});}else if(params.metaModelData){metaModel.loadData(params.metaModelData,{includeTypes:includeTypes,excludeTypes:excludeTypes,globalizeObjectIds:options.globalizeObjectIds});if(params.src){this._loadModel(params.src,options,sceneModel,null,manifestCtx,finish,error);}else{this._parseModel(params.xkt,options,sceneModel,null,manifestCtx);finish();}}}else{if(params.src){this._loadModel(params.src,options,sceneModel,metaModel,manifestCtx,finish,error);}else if(params.xkt){this._parseModel(params.xkt,options,sceneModel,metaModel,manifestCtx);finish();}else if(params.manifestSrc||params.manifest){var baseDir=params.manifestSrc?getBaseDirectory$1(params.manifestSrc):"";var loadJSONs=function loadJSONs(metaDataFiles,done,error){var i=0;var loadNext=function loadNext(){if(sceneModel.destroyed){done();}else if(i>=metaDataFiles.length){done();}else{_this189._dataSource.getMetaModel("".concat(baseDir).concat(metaDataFiles[i]),function(metaModelData){metaModel.loadData(metaModelData,{includeTypes:includeTypes,excludeTypes:excludeTypes,globalizeObjectIds:options.globalizeObjectIds});i++;_this189.scheduleTask(loadNext,200);},error);}};loadNext();};var loadXKTs_excludeTheirMetaModels=function loadXKTs_excludeTheirMetaModels(xktFiles,done,error){// Load XKTs, ignore metamodels in the XKT
29864
29873
  var i=0;var loadNext=function loadNext(){if(sceneModel.destroyed){done();}else if(i>=xktFiles.length){done();}else{_this189._dataSource.getXKT("".concat(baseDir).concat(xktFiles[i]),function(arrayBuffer){_this189._parseModel(arrayBuffer,options,sceneModel,null/* Ignore metamodel in XKT */,manifestCtx);sceneModel.preFinalize();i++;_this189.scheduleTask(loadNext,200);},error);}};loadNext();};var loadXKTs_includeTheirMetaModels=function loadXKTs_includeTheirMetaModels(xktFiles,done,error){// Load XKTs, parse metamodels from the XKT
29865
- var i=0;var loadNext=function loadNext(){if(sceneModel.destroyed){done();}else if(i>=xktFiles.length){done();}else{_this189._dataSource.getXKT("".concat(baseDir).concat(xktFiles[i]),function(arrayBuffer){_this189._parseModel(arrayBuffer,options,sceneModel,metaModel,manifestCtx);sceneModel.preFinalize();i++;_this189.scheduleTask(loadNext,200);},error);}};loadNext();};if(params.manifest){var manifestData=params.manifest;var xktFiles=manifestData.xktFiles;if(!xktFiles||xktFiles.length===0){error("load(): Failed to load model manifest - manifest not valid");return;}var metaModelFiles=manifestData.metaModelFiles;if(metaModelFiles){loadJSONs(metaModelFiles,function(){loadXKTs_excludeTheirMetaModels(xktFiles,finish,error);},error);}else{loadXKTs_includeTheirMetaModels(xktFiles,finish,error);}}else{this._dataSource.getManifest(params.manifestSrc,function(manifestData){if(sceneModel.destroyed){return;}var xktFiles=manifestData.xktFiles;if(!xktFiles||xktFiles.length===0){error("load(): Failed to load model manifest - manifest not valid");return;}var metaModelFiles=manifestData.metaModelFiles;if(metaModelFiles){loadJSONs(metaModelFiles,function(){loadXKTs_excludeTheirMetaModels(xktFiles,finish,error);},error);}else{loadXKTs_includeTheirMetaModels(xktFiles,finish,error);}},error);}}}return sceneModel;}},{key:"_loadModel",value:function _loadModel(src,options,sceneModel,metaModel,manifestCtx,done,error){var _this190=this;this._dataSource.getXKT(src,function(arrayBuffer){_this190._parseModel(arrayBuffer,options,sceneModel,metaModel,manifestCtx);sceneModel.preFinalize();done();},error);}},{key:"_parseModel",value:function(){var _parseModel2=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee8(arrayBuffer,options,sceneModel,metaModel,manifestCtx){var dataView,dataArray,firstUint,xktVersion,zipped,parser,numElements,elements,byteOffset,_i381,elementSize;return _regeneratorRuntime().wrap(function _callee8$(_context12){while(1){switch(_context12.prev=_context12.next){case 0:if(!sceneModel.destroyed){_context12.next=2;break;}return _context12.abrupt("return");case 2:dataView=new DataView(arrayBuffer);dataArray=new Uint8Array(arrayBuffer);firstUint=dataView.getUint32(0,true);xktVersion=firstUint&0x7fffffff;zipped=xktVersion<11||xktVersion>=12&&firstUint>>>31;parser=parsers[xktVersion];if(parser){_context12.next=11;break;}this.error("Unsupported .XKT file version: "+xktVersion+" - this XKTLoaderPlugin supports versions "+Object.keys(parsers));return _context12.abrupt("return");case 11:if(zipped){_context12.next=14;break;}parser.parseArrayBuffer(this.viewer,options,arrayBuffer,sceneModel,metaModel,manifestCtx);return _context12.abrupt("return");case 14:numElements=dataView.getUint32(4,true);elements=[];byteOffset=(numElements+2)*4;for(_i381=0;_i381<numElements;_i381++){elementSize=dataView.getUint32((_i381+2)*4,true);elements.push(dataArray.subarray(byteOffset,byteOffset+elementSize));byteOffset+=elementSize;}parser.parse(this.viewer,options,elements,sceneModel,metaModel,manifestCtx);case 19:case"end":return _context12.stop();}}},_callee8,this);}));function _parseModel(_x117,_x118,_x119,_x120,_x121){return _parseModel2.apply(this,arguments);}return _parseModel;}()}]);return XKTLoaderPlugin;}(Plugin);function getBaseDirectory$1(filePath){if(filePath.indexOf('?')>-1){filePath=filePath.split('?')[0];}var pathArray=filePath.split('/');pathArray.pop();// Remove the file name or the last segment of the path
29874
+ var i=0;var loadNext=function loadNext(){if(sceneModel.destroyed){done();}else if(i>=xktFiles.length){done();}else{_this189._dataSource.getXKT("".concat(baseDir).concat(xktFiles[i]),function(arrayBuffer){_this189._parseModel(arrayBuffer,options,sceneModel,metaModel,manifestCtx);sceneModel.preFinalize();i++;_this189.scheduleTask(loadNext,200);},error);}};loadNext();};if(params.manifest){var manifestData=params.manifest;var xktFiles=manifestData.xktFiles;if(!xktFiles||xktFiles.length===0){error("load(): Failed to load model manifest - manifest not valid");return;}var metaModelFiles=manifestData.metaModelFiles;if(metaModelFiles){loadJSONs(metaModelFiles,function(){loadXKTs_excludeTheirMetaModels(xktFiles,finish,error);},error);}else{loadXKTs_includeTheirMetaModels(xktFiles,finish,error);}}else{this._dataSource.getManifest(params.manifestSrc,function(manifestData){if(sceneModel.destroyed){return;}var xktFiles=manifestData.xktFiles;if(!xktFiles||xktFiles.length===0){error("load(): Failed to load model manifest - manifest not valid");return;}var metaModelFiles=manifestData.metaModelFiles;if(metaModelFiles){loadJSONs(metaModelFiles,function(){loadXKTs_excludeTheirMetaModels(xktFiles,finish,error);},error);}else{loadXKTs_includeTheirMetaModels(xktFiles,finish,error);}},error);}}}return sceneModel;}},{key:"_loadModel",value:function _loadModel(src,options,sceneModel,metaModel,manifestCtx,done,error){var _this190=this;this._dataSource.getXKT(src,function(arrayBuffer){_this190._parseModel(arrayBuffer,options,sceneModel,metaModel,manifestCtx);sceneModel.preFinalize();done();},error);}},{key:"_parseModel",value:function(){var _parseModel2=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee8(arrayBuffer,options,sceneModel,metaModel,manifestCtx){var dataView,dataArray,firstUint,xktVersion,zipped,parser,numElements,elements,byteOffset,_i383,elementSize;return _regeneratorRuntime().wrap(function _callee8$(_context12){while(1){switch(_context12.prev=_context12.next){case 0:if(!sceneModel.destroyed){_context12.next=2;break;}return _context12.abrupt("return");case 2:dataView=new DataView(arrayBuffer);dataArray=new Uint8Array(arrayBuffer);firstUint=dataView.getUint32(0,true);xktVersion=firstUint&0x7fffffff;zipped=xktVersion<11||xktVersion>=12&&firstUint>>>31;parser=parsers[xktVersion];if(parser){_context12.next=11;break;}this.error("Unsupported .XKT file version: "+xktVersion+" - this XKTLoaderPlugin supports versions "+Object.keys(parsers));return _context12.abrupt("return");case 11:if(zipped){_context12.next=14;break;}parser.parseArrayBuffer(this.viewer,options,arrayBuffer,sceneModel,metaModel,manifestCtx);return _context12.abrupt("return");case 14:numElements=dataView.getUint32(4,true);elements=[];byteOffset=(numElements+2)*4;for(_i383=0;_i383<numElements;_i383++){elementSize=dataView.getUint32((_i383+2)*4,true);elements.push(dataArray.subarray(byteOffset,byteOffset+elementSize));byteOffset+=elementSize;}parser.parse(this.viewer,options,elements,sceneModel,metaModel,manifestCtx);case 19:case"end":return _context12.stop();}}},_callee8,this);}));function _parseModel(_x117,_x118,_x119,_x120,_x121){return _parseModel2.apply(this,arguments);}return _parseModel;}()}]);return XKTLoaderPlugin;}(Plugin);function getBaseDirectory$1(filePath){if(filePath.indexOf('?')>-1){filePath=filePath.split('?')[0];}var pathArray=filePath.split('/');pathArray.pop();// Remove the file name or the last segment of the path
29866
29875
  return pathArray.join('/')+'/';}/*
29867
29876
  Copyright (c) 2013 Gildas Lormeau. All rights reserved.
29868
29877
 
@@ -30730,9 +30739,9 @@ var isBase64=!!dataUriRegexResult[2];var data=dataUriRegexResult[3];data=window.
30730
30739
  * primitives. Only works while {@link DTX#enabled} is also ````true````.
30731
30740
  * @returns {Entity} Entity representing the model, which will have {@link Entity#isModel} set ````true```` and will be registered by {@link Entity#id} in {@link Scene#models}.
30732
30741
  */},{key:"load",value:function load(){var params=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};if(params.id&&this.viewer.scene.components[params.id]){this.error("Component with this ID already exists in viewer: "+params.id+" - will autogenerate this ID");delete params.id;}var sceneModel=new SceneModel(this.viewer.scene,utils.apply(params,{isModel:true}));if(!params.src&&!params.ifc){this.error("load() param expected: src or IFC");return sceneModel;// Return new empty model
30733
- }var options={autoNormals:true};if(params.loadMetadata!==false){var includeTypes=params.includeTypes||this._includeTypes;var excludeTypes=params.excludeTypes||this._excludeTypes;var objectDefaults=params.objectDefaults||this._objectDefaults;if(includeTypes){options.includeTypesMap={};for(var _i382=0,len=includeTypes.length;_i382<len;_i382++){options.includeTypesMap[includeTypes[_i382]]=true;}}if(excludeTypes){options.excludeTypesMap={};for(var _i383=0,_len56=excludeTypes.length;_i383<_len56;_i383++){options.excludeTypesMap[excludeTypes[_i383]]=true;}}if(objectDefaults){options.objectDefaults=objectDefaults;}options.excludeUnclassifiedObjects=params.excludeUnclassifiedObjects!==undefined?!!params.excludeUnclassifiedObjects:this._excludeUnclassifiedObjects;options.globalizeObjectIds=params.globalizeObjectIds!==undefined?!!params.globalizeObjectIds:this._globalizeObjectIds;}try{if(params.src){this._loadModel(params.src,params,options,sceneModel);}else{this._parseModel(params.ifc,params,options,sceneModel);}}catch(e){this.error(e);sceneModel.fire("error",e);}return sceneModel;}},{key:"_loadModel",value:function _loadModel(src,params,options,sceneModel){var _this193=this;var spinner=this.viewer.scene.canvas.spinner;spinner.processes++;this._dataSource.getIFC(params.src,function(arrayBuffer){_this193._parseModel(arrayBuffer,params,options,sceneModel);spinner.processes--;},function(errMsg){spinner.processes--;_this193.error(errMsg);sceneModel.fire("error",errMsg);});}},{key:"_parseModel",value:function _parseModel(arrayBuffer,params,options,sceneModel){if(sceneModel.destroyed){return;}var stats=params.stats||{};stats.sourceFormat="IFC";stats.schemaVersion="";stats.title="";stats.author="";stats.created="";stats.numMetaObjects=0;stats.numPropertySets=0;stats.numObjects=0;stats.numGeometries=0;stats.numTriangles=0;stats.numVertices=0;if(!this._ifcAPI){throw"WebIFCLoaderPlugin has no WebIFC instance configured - please inject via WebIFCLoaderPlugin constructor";}var dataArray=new Uint8Array(arrayBuffer);var modelID=this._ifcAPI.OpenModel(dataArray);var modelSchema=this._ifcAPI.GetModelSchema(modelID);var lines=this._ifcAPI.GetLineIDsWithType(modelID,this._webIFC.IFCPROJECT);var ifcProjectId=lines.get(0);var loadMetadata=params.loadMetadata!==false;var metadata=loadMetadata?{id:"",projectId:""+ifcProjectId,author:"",createdAt:"",schema:"",creatingApplication:"",metaObjects:[],propertySets:[]}:null;var ctx={modelID:modelID,modelSchema:modelSchema,sceneModel:sceneModel,loadMetadata:loadMetadata,metadata:metadata,metaObjects:{},options:options,log:function log(msg){},nextId:0,stats:stats};if(loadMetadata){if(options.includeTypes){ctx.includeTypes={};for(var _i384=0,len=options.includeTypes.length;_i384<len;_i384++){ctx.includeTypes[options.includeTypes[_i384]]=true;}}if(options.excludeTypes){ctx.excludeTypes={};for(var _i385=0,_len57=options.excludeTypes.length;_i385<_len57;_i385++){ctx.excludeTypes[options.excludeTypes[_i385]]=true;}}this._parseMetaObjects(ctx);this._parsePropertySets(ctx);}this._parseGeometry(ctx);sceneModel.finalize();if(loadMetadata){var metaModelId=sceneModel.id;this.viewer.metaScene.createMetaModel(metaModelId,ctx.metadata,options);}sceneModel.scene.once("tick",function(){if(sceneModel.destroyed){return;}sceneModel.scene.fire("modelLoaded",sceneModel.id);// FIXME: Assumes listeners know order of these two events
30742
+ }var options={autoNormals:true};if(params.loadMetadata!==false){var includeTypes=params.includeTypes||this._includeTypes;var excludeTypes=params.excludeTypes||this._excludeTypes;var objectDefaults=params.objectDefaults||this._objectDefaults;if(includeTypes){options.includeTypesMap={};for(var _i384=0,len=includeTypes.length;_i384<len;_i384++){options.includeTypesMap[includeTypes[_i384]]=true;}}if(excludeTypes){options.excludeTypesMap={};for(var _i385=0,_len56=excludeTypes.length;_i385<_len56;_i385++){options.excludeTypesMap[excludeTypes[_i385]]=true;}}if(objectDefaults){options.objectDefaults=objectDefaults;}options.excludeUnclassifiedObjects=params.excludeUnclassifiedObjects!==undefined?!!params.excludeUnclassifiedObjects:this._excludeUnclassifiedObjects;options.globalizeObjectIds=params.globalizeObjectIds!==undefined?!!params.globalizeObjectIds:this._globalizeObjectIds;}try{if(params.src){this._loadModel(params.src,params,options,sceneModel);}else{this._parseModel(params.ifc,params,options,sceneModel);}}catch(e){this.error(e);sceneModel.fire("error",e);}return sceneModel;}},{key:"_loadModel",value:function _loadModel(src,params,options,sceneModel){var _this193=this;var spinner=this.viewer.scene.canvas.spinner;spinner.processes++;this._dataSource.getIFC(params.src,function(arrayBuffer){_this193._parseModel(arrayBuffer,params,options,sceneModel);spinner.processes--;},function(errMsg){spinner.processes--;_this193.error(errMsg);sceneModel.fire("error",errMsg);});}},{key:"_parseModel",value:function _parseModel(arrayBuffer,params,options,sceneModel){if(sceneModel.destroyed){return;}var stats=params.stats||{};stats.sourceFormat="IFC";stats.schemaVersion="";stats.title="";stats.author="";stats.created="";stats.numMetaObjects=0;stats.numPropertySets=0;stats.numObjects=0;stats.numGeometries=0;stats.numTriangles=0;stats.numVertices=0;if(!this._ifcAPI){throw"WebIFCLoaderPlugin has no WebIFC instance configured - please inject via WebIFCLoaderPlugin constructor";}var dataArray=new Uint8Array(arrayBuffer);var modelID=this._ifcAPI.OpenModel(dataArray);var modelSchema=this._ifcAPI.GetModelSchema(modelID);var lines=this._ifcAPI.GetLineIDsWithType(modelID,this._webIFC.IFCPROJECT);var ifcProjectId=lines.get(0);var loadMetadata=params.loadMetadata!==false;var metadata=loadMetadata?{id:"",projectId:""+ifcProjectId,author:"",createdAt:"",schema:"",creatingApplication:"",metaObjects:[],propertySets:[]}:null;var ctx={modelID:modelID,modelSchema:modelSchema,sceneModel:sceneModel,loadMetadata:loadMetadata,metadata:metadata,metaObjects:{},options:options,log:function log(msg){},nextId:0,stats:stats};if(loadMetadata){if(options.includeTypes){ctx.includeTypes={};for(var _i386=0,len=options.includeTypes.length;_i386<len;_i386++){ctx.includeTypes[options.includeTypes[_i386]]=true;}}if(options.excludeTypes){ctx.excludeTypes={};for(var _i387=0,_len57=options.excludeTypes.length;_i387<_len57;_i387++){ctx.excludeTypes[options.excludeTypes[_i387]]=true;}}this._parseMetaObjects(ctx);this._parsePropertySets(ctx);}this._parseGeometry(ctx);sceneModel.finalize();if(loadMetadata){var metaModelId=sceneModel.id;this.viewer.metaScene.createMetaModel(metaModelId,ctx.metadata,options);}sceneModel.scene.once("tick",function(){if(sceneModel.destroyed){return;}sceneModel.scene.fire("modelLoaded",sceneModel.id);// FIXME: Assumes listeners know order of these two events
30734
30743
  sceneModel.fire("loaded",true,false);// Don't forget the event, for late subscribers
30735
- });}},{key:"_parseMetaObjects",value:function _parseMetaObjects(ctx){var lines=this._ifcAPI.GetLineIDsWithType(ctx.modelID,this._webIFC.IFCPROJECT);var ifcProjectId=lines.get(0);var ifcProject=this._ifcAPI.GetLine(ctx.modelID,ifcProjectId);this._parseSpatialChildren(ctx,ifcProject);}},{key:"_parseSpatialChildren",value:function _parseSpatialChildren(ctx,ifcElement,parentMetaObjectId){var metaObjectType=this._ifcAPI.GetNameFromTypeCode(ifcElement.type);if(ctx.includeTypes&&!ctx.includeTypes[metaObjectType]){return;}if(ctx.excludeTypes&&ctx.excludeTypes[metaObjectType]){return;}this._createMetaObject(ctx,ifcElement,parentMetaObjectId);var metaObjectId=ifcElement.GlobalId.value;this._parseRelatedItemsOfType(ctx,ifcElement.expressID,'RelatingObject','RelatedObjects',this._webIFC.IFCRELAGGREGATES,metaObjectId);this._parseRelatedItemsOfType(ctx,ifcElement.expressID,'RelatingStructure','RelatedElements',this._webIFC.IFCRELCONTAINEDINSPATIALSTRUCTURE,metaObjectId);}},{key:"_createMetaObject",value:function _createMetaObject(ctx,ifcElement,parentMetaObjectId){var id=ifcElement.GlobalId.value;var metaObjectType=this._ifcAPI.GetNameFromTypeCode(ifcElement.type);var metaObjectName=ifcElement.Name&&ifcElement.Name.value!==""?ifcElement.Name.value:metaObjectType;var metaObject={id:id,name:metaObjectName,type:metaObjectType,parent:parentMetaObjectId};ctx.metadata.metaObjects.push(metaObject);ctx.metaObjects[id]=metaObject;ctx.stats.numMetaObjects++;}},{key:"_parseRelatedItemsOfType",value:function _parseRelatedItemsOfType(ctx,id,relation,related,type,parentMetaObjectId){var _this194=this;var lines=this._ifcAPI.GetLineIDsWithType(ctx.modelID,type);for(var _i386=0;_i386<lines.size();_i386++){var relID=lines.get(_i386);var rel=this._ifcAPI.GetLine(ctx.modelID,relID);var relatedItems=rel[relation];var foundElement=false;if(Array.isArray(relatedItems)){var values=relatedItems.map(function(item){return item.value;});foundElement=values.includes(id);}else{foundElement=relatedItems.value===id;}if(foundElement){var element=rel[related];if(!Array.isArray(element)){var ifcElement=this._ifcAPI.GetLine(ctx.modelID,element.value);this._parseSpatialChildren(ctx,ifcElement,parentMetaObjectId);}else{element.forEach(function(element2){var ifcElement=_this194._ifcAPI.GetLine(ctx.modelID,element2.value);_this194._parseSpatialChildren(ctx,ifcElement,parentMetaObjectId);});}}}}},{key:"_parsePropertySets",value:function _parsePropertySets(ctx){var lines=this._ifcAPI.GetLineIDsWithType(ctx.modelID,this._webIFC.IFCRELDEFINESBYPROPERTIES);for(var _i387=0;_i387<lines.size();_i387++){var relID=lines.get(_i387);var rel=this._ifcAPI.GetLine(ctx.modelID,relID,true);if(rel){var relatingPropertyDefinition=rel.RelatingPropertyDefinition;if(!relatingPropertyDefinition){continue;}var propertySetId=relatingPropertyDefinition.GlobalId.value;var props=relatingPropertyDefinition.HasProperties;if(props&&props.length>0){var propertySetType="Default";var propertySetName=relatingPropertyDefinition.Name.value;var properties=[];for(var _i388=0,len=props.length;_i388<len;_i388++){var prop=props[_i388];var _name7=prop.Name;var nominalValue=prop.NominalValue;if(_name7&&nominalValue){var property={name:_name7.value,type:nominalValue.type,value:nominalValue.value,valueType:nominalValue.valueType};if(prop.Description){property.description=prop.Description.value;}else if(nominalValue.description){property.description=nominalValue.description;}properties.push(property);}}var propertySet={id:propertySetId,type:propertySetType,name:propertySetName,properties:properties};ctx.metadata.propertySets.push(propertySet);ctx.stats.numPropertySets++;var relatedObjects=rel.RelatedObjects;if(!relatedObjects||relatedObjects.length===0){return;}for(var _i389=0,_len58=relatedObjects.length;_i389<_len58;_i389++){var relatedObject=relatedObjects[_i389];var metaObjectId=relatedObject.GlobalId.value;var metaObject=ctx.metaObjects[metaObjectId];if(metaObject){if(!metaObject.propertySetIds){metaObject.propertySetIds=[];}metaObject.propertySetIds.push(propertySetId);}}}}}}},{key:"_parseGeometry",value:function _parseGeometry(ctx){var _this195=this;this._ifcAPI.StreamAllMeshes(ctx.modelID,function(flatMesh){// TODO: Can we do geometry reuse with web-ifc?
30744
+ });}},{key:"_parseMetaObjects",value:function _parseMetaObjects(ctx){var lines=this._ifcAPI.GetLineIDsWithType(ctx.modelID,this._webIFC.IFCPROJECT);var ifcProjectId=lines.get(0);var ifcProject=this._ifcAPI.GetLine(ctx.modelID,ifcProjectId);this._parseSpatialChildren(ctx,ifcProject);}},{key:"_parseSpatialChildren",value:function _parseSpatialChildren(ctx,ifcElement,parentMetaObjectId){var metaObjectType=this._ifcAPI.GetNameFromTypeCode(ifcElement.type);if(ctx.includeTypes&&!ctx.includeTypes[metaObjectType]){return;}if(ctx.excludeTypes&&ctx.excludeTypes[metaObjectType]){return;}this._createMetaObject(ctx,ifcElement,parentMetaObjectId);var metaObjectId=ifcElement.GlobalId.value;this._parseRelatedItemsOfType(ctx,ifcElement.expressID,'RelatingObject','RelatedObjects',this._webIFC.IFCRELAGGREGATES,metaObjectId);this._parseRelatedItemsOfType(ctx,ifcElement.expressID,'RelatingStructure','RelatedElements',this._webIFC.IFCRELCONTAINEDINSPATIALSTRUCTURE,metaObjectId);}},{key:"_createMetaObject",value:function _createMetaObject(ctx,ifcElement,parentMetaObjectId){var id=ifcElement.GlobalId.value;var metaObjectType=this._ifcAPI.GetNameFromTypeCode(ifcElement.type);var metaObjectName=ifcElement.Name&&ifcElement.Name.value!==""?ifcElement.Name.value:metaObjectType;var metaObject={id:id,name:metaObjectName,type:metaObjectType,parent:parentMetaObjectId};ctx.metadata.metaObjects.push(metaObject);ctx.metaObjects[id]=metaObject;ctx.stats.numMetaObjects++;}},{key:"_parseRelatedItemsOfType",value:function _parseRelatedItemsOfType(ctx,id,relation,related,type,parentMetaObjectId){var _this194=this;var lines=this._ifcAPI.GetLineIDsWithType(ctx.modelID,type);for(var _i388=0;_i388<lines.size();_i388++){var relID=lines.get(_i388);var rel=this._ifcAPI.GetLine(ctx.modelID,relID);var relatedItems=rel[relation];var foundElement=false;if(Array.isArray(relatedItems)){var values=relatedItems.map(function(item){return item.value;});foundElement=values.includes(id);}else{foundElement=relatedItems.value===id;}if(foundElement){var element=rel[related];if(!Array.isArray(element)){var ifcElement=this._ifcAPI.GetLine(ctx.modelID,element.value);this._parseSpatialChildren(ctx,ifcElement,parentMetaObjectId);}else{element.forEach(function(element2){var ifcElement=_this194._ifcAPI.GetLine(ctx.modelID,element2.value);_this194._parseSpatialChildren(ctx,ifcElement,parentMetaObjectId);});}}}}},{key:"_parsePropertySets",value:function _parsePropertySets(ctx){var lines=this._ifcAPI.GetLineIDsWithType(ctx.modelID,this._webIFC.IFCRELDEFINESBYPROPERTIES);for(var _i389=0;_i389<lines.size();_i389++){var relID=lines.get(_i389);var rel=this._ifcAPI.GetLine(ctx.modelID,relID,true);if(rel){var relatingPropertyDefinition=rel.RelatingPropertyDefinition;if(!relatingPropertyDefinition){continue;}var propertySetId=relatingPropertyDefinition.GlobalId.value;var props=relatingPropertyDefinition.HasProperties;if(props&&props.length>0){var propertySetType="Default";var propertySetName=relatingPropertyDefinition.Name.value;var properties=[];for(var _i390=0,len=props.length;_i390<len;_i390++){var prop=props[_i390];var _name7=prop.Name;var nominalValue=prop.NominalValue;if(_name7&&nominalValue){var property={name:_name7.value,type:nominalValue.type,value:nominalValue.value,valueType:nominalValue.valueType};if(prop.Description){property.description=prop.Description.value;}else if(nominalValue.description){property.description=nominalValue.description;}properties.push(property);}}var propertySet={id:propertySetId,type:propertySetType,name:propertySetName,properties:properties};ctx.metadata.propertySets.push(propertySet);ctx.stats.numPropertySets++;var relatedObjects=rel.RelatedObjects;if(!relatedObjects||relatedObjects.length===0){return;}for(var _i391=0,_len58=relatedObjects.length;_i391<_len58;_i391++){var relatedObject=relatedObjects[_i391];var metaObjectId=relatedObject.GlobalId.value;var metaObject=ctx.metaObjects[metaObjectId];if(metaObject){if(!metaObject.propertySetIds){metaObject.propertySetIds=[];}metaObject.propertySetIds.push(propertySetId);}}}}}}},{key:"_parseGeometry",value:function _parseGeometry(ctx){var _this195=this;this._ifcAPI.StreamAllMeshes(ctx.modelID,function(flatMesh){// TODO: Can we do geometry reuse with web-ifc?
30736
30745
  var flatMeshExpressID=flatMesh.expressID;var placedGeometries=flatMesh.geometries;var meshIds=[];var properties=_this195._ifcAPI.GetLine(ctx.modelID,flatMeshExpressID);var globalId=properties.GlobalId.value;if(ctx.loadMetadata){var metaObjectId=globalId;var metaObject=ctx.metaObjects[metaObjectId];if(ctx.includeTypes&&(!metaObject||!ctx.includeTypes[metaObject.type])){return;}if(ctx.excludeTypes&&(!metaObject||ctx.excludeTypes[metaObject.type])){return;}}var matrix=math.mat4();var origin=math.vec3();for(var j=0,lenj=placedGeometries.size();j<lenj;j++){var placedGeometry=placedGeometries.get(j);var geometry=_this195._ifcAPI.GetGeometry(ctx.modelID,placedGeometry.geometryExpressID);var vertexData=_this195._ifcAPI.GetVertexArray(geometry.GetVertexData(),geometry.GetVertexDataSize());var indices=_this195._ifcAPI.GetIndexArray(geometry.GetIndexData(),geometry.GetIndexDataSize());// De-interleave vertex arrays
30737
30746
  var positions=new Float64Array(vertexData.length/2);var normals=new Float32Array(vertexData.length/2);for(var k=0,l=0,lenk=vertexData.length/6;k<lenk;k++,l+=3){positions[l+0]=vertexData[k*6+0];positions[l+1]=vertexData[k*6+1];positions[l+2]=vertexData[k*6+2];}matrix.set(placedGeometry.flatTransformation);math.transformPositions3(matrix,positions);var rtcNeeded=worldToRTCPositions(positions,positions,origin);if(!ctx.options.autoNormals){for(var _k2=0,_l2=0,_lenk=vertexData.length/6;_k2<_lenk;_k2++,_l2+=3){normals[_l2+0]=vertexData[_k2*6+3];normals[_l2+1]=vertexData[_k2*6+4];normals[_l2+2]=vertexData[_k2*6+5];}}ctx.stats.numGeometries++;ctx.stats.numVertices+=positions.length/3;ctx.stats.numTriangles+=indices.length/3;var meshId="mesh"+ctx.nextId++;ctx.sceneModel.createMesh({id:meshId,primitive:"triangles",// TODO
30738
30747
  origin:rtcNeeded?origin:null,positions:positions,normals:ctx.options.autoNormals?null:normals,indices:indices,color:[placedGeometry.color.x,placedGeometry.color.y,placedGeometry.color.z],opacity:placedGeometry.color.w});meshIds.push(meshId);}var entityId=ctx.options.globalizeObjectIds?math.globalizeObjectId(ctx.sceneModel.id,globalId):globalId;ctx.sceneModel.createEntity({id:entityId,meshIds:meshIds,isObject:true});ctx.stats.numObjects++;});}}]);return WebIFCLoaderPlugin;}(Plugin);/**
@@ -31053,18 +31062,18 @@ var isBase64=!!dataUriRegexResult[2];var data=dataUriRegexResult[3];data=window.
31053
31062
  * @returns {Entity}
31054
31063
  */},{key:"load",value:function(){var _load2=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee10(){var _this198=this;var params,id,_params$backfaces,backfaces,_params$dtxEnabled,dtxEnabled,position,rotation,origin,loadMetadata,loadMetadataPropertySets,edges,saoEnabled,globalizeObjectIds,excludeTypes,sceneModel,modelId,spinner,loadIFC,_args13=arguments;return _regeneratorRuntime().wrap(function _callee10$(_context14){while(1){switch(_context14.prev=_context14.next){case 0:params=_args13.length>0&&_args13[0]!==undefined?_args13[0]:{};id=params.id,_params$backfaces=params.backfaces,backfaces=_params$backfaces===void 0?true:_params$backfaces,_params$dtxEnabled=params.dtxEnabled,dtxEnabled=_params$dtxEnabled===void 0?true:_params$dtxEnabled,position=params.position,rotation=params.rotation,origin=params.origin,loadMetadata=params.loadMetadata,loadMetadataPropertySets=params.loadMetadataPropertySets,edges=params.edges,saoEnabled=params.saoEnabled,globalizeObjectIds=params.globalizeObjectIds,excludeTypes=params.excludeTypes;if(id&&this.viewer.scene.components[id]){this.error("Component with this ID already exists: ".concat(id," - autogenerating SceneModel ID"));id=null;}sceneModel=new SceneModel(this.viewer.scene,{id:id,isModel:true,globalizeObjectIds:globalizeObjectIds,backfaces:backfaces,dtxEnabled:dtxEnabled,position:position,rotation:rotation,origin:origin,edges:edges,saoEnabled:saoEnabled});modelId=sceneModel.id;if(!(!params.src&&!params.text)){_context14.next=8;break;}this.error("load() expected 'src' or 'text'");return _context14.abrupt("return",sceneModel);case 8:spinner=this.viewer.scene.canvas.spinner;spinner.processes++;loadIFC=function loadIFC(fileData){var ifc=_this198.ifcopenshell.file.from_string(fileData);var ctx={loadMetadataPropertySets:loadMetadataPropertySets!==false,globalizeObjectIds:globalizeObjectIds||_this198._globalizeObjectIds,geometryCache:new Map(),ifc:ifc,sceneModel:sceneModel};if(excludeTypes){ctx.excludeTypes=excludeTypes;}_this198._loadIFCGeometry(ctx);if(loadMetadata!==false){var metaModelData=_this198._loadIFCMetaModel(ctx,ifc);_this198.viewer.metaScene.createMetaModel(modelId,metaModelData);}_this198.viewer.scene.canvas.spinner.processes--;};if(params.src){this.viewer.scene.canvas.spinner.processes++;this._dataSource.getIFC(params.src,function(fileData){loadIFC(fileData);_this198.viewer.scene.canvas.spinner.processes--;},function(err){_this198.viewer.scene.canvas.spinner.processes--;_this198.error(err);});}else{loadIFC(params.text);}sceneModel.once("destroyed",function(){_this198.viewer.metaScene.destroyMetaModel(modelId);});return _context14.abrupt("return",sceneModel);case 14:case"end":return _context14.stop();}}},_callee10,this);}));function load(){return _load2.apply(this,arguments);}return load;}()},{key:"_loadIFCGeometry",value:function _loadIFCGeometry(ctx){var ifc=ctx.ifc,sceneModel=ctx.sceneModel;var ifcopenshell_geom=this.ifcopenshell_geom;var settings=ifcopenshell_geom.settings();settings.set(settings.WELD_VERTICES,false);var iterator=ifcopenshell_geom.iterator.callKwargs({settings:settings,file_or_filename:ifc,exclude:ctx.excludeTypes,geometry_library:"hybrid-cgal-simple-opencascade"});if(iterator.initialize()){do{var obj=iterator.get();if(obj){var entity=ifc.by_id(obj.id);this._parseIFCEntity(ctx,obj,entity);}}while(iterator.next());}sceneModel.finalize();sceneModel.scene.once("tick",function(){if(!sceneModel.destroyed){sceneModel.scene.fire("modelLoaded",sceneModel.id);sceneModel.fire("loaded",true,false);}});}},{key:"_parseIFCEntity",value:function _parseIFCEntity(ctx,obj,ifcEntity){var sceneModel=ctx.sceneModel,geometryCache=ctx.geometryCache;var geometry_id=obj.geometry.id;var M=obj.transformation.data().components.toJs();var _extractRTCTransform=extractRTCTransform(M),origin=_extractRTCTransform.origin,matrix=_extractRTCTransform.matrix;if(!geometryCache.get(geometry_id)){var srcMaterials=obj.geometry.materials.toJs();var materials=srcMaterials.map(function(m){return{diffuse:m.diffuse.components.toJs(),transparency:m.transparency&&!isNaN(m.transparency)?m.transparency:0.0};});var materialIds=new Int32Array(obj.geometry.material_ids.toJs());// Build mapping: materialIndex -> [faceIdx...]
31055
31064
  var mapping=buildMaterialMapping(materialIds);// Create sub-geometry per materialIndex, once
31056
- var subGeoms=new Map();for(var _i390=0,_Object$entries6=Object.entries(mapping);_i390<_Object$entries6.length;_i390++){var _Object$entries6$_i=_slicedToArray(_Object$entries6[_i390],2),matIndexStr=_Object$entries6$_i[0],faceList=_Object$entries6$_i[1];if(!faceList||faceList.length===0){continue;}// xeokit auto-generates normals on the GPU side
31065
+ var subGeoms=new Map();for(var _i392=0,_Object$entries6=Object.entries(mapping);_i392<_Object$entries6.length;_i392++){var _Object$entries6$_i=_slicedToArray(_Object$entries6[_i392],2),matIndexStr=_Object$entries6$_i[0],faceList=_Object$entries6$_i[1];if(!faceList||faceList.length===0){continue;}// xeokit auto-generates normals on the GPU side
31057
31066
  var positions=new Float32Array(obj.geometry.verts.toJs());var edgeIndices=new Uint32Array(obj.geometry.edges.toJs());var faces=new Uint32Array(obj.geometry.faces.toJs());var matIndex=Number(matIndexStr);var indices=buildIndicesForFaces(faceList,faces);var sceneGeometryId=makeSubGeometryId(geometry_id,matIndex);// deterministic
31058
31067
  sceneModel.createGeometry({id:sceneGeometryId,primitive:"triangles",positions:positions,indices:indices,edgeIndices:edgeIndices});subGeoms.set(matIndex,sceneGeometryId);}geometryCache.set(geometry_id,{subGeoms:subGeoms,materials:materials,// store mapping as Map<number, Uint32Array> to avoid recomputing
31059
31068
  mapping:new Map(Object.entries(mapping).map(function(_ref23){var _ref24=_slicedToArray(_ref23,2),k=_ref24[0],v=_ref24[1];return[Number(k),new Uint32Array(v)];}))});}// Reuse cached sub-geometries to create per-object meshes
31060
31069
  var cached=geometryCache.get(geometry_id);var meshIds=[];var _iterator60=_createForOfIteratorHelper(cached.subGeoms.entries()),_step60;try{for(_iterator60.s();!(_step60=_iterator60.n()).done;){var _step60$value=_slicedToArray(_step60.value,2),_matIndex=_step60$value[0],_sceneGeometryId=_step60$value[1];var material=cached.materials[_matIndex]||{diffuse:[0.6,0.6,0.6],transparency:0.0};var meshId=generateUUID();var diffuse=material.diffuse;sceneModel.createMesh({id:meshId,geometryId:_sceneGeometryId,origin:origin,matrix:matrix,color:[diffuse[0],diffuse[1],diffuse[2]],opacity:1.0-material.transparency});meshIds.push(meshId);}}catch(err){_iterator60.e(err);}finally{_iterator60.f();}sceneModel.createEntity({id:ctx.globalizeObjectIds?math.globalizeObjectId(ctx.sceneModel.id,ifcEntity.GlobalId):ifcEntity.GlobalId,isObject:true,meshIds:meshIds});}},{key:"_loadIFCMetaModel",value:function _loadIFCMetaModel(ctx,ifc){var _projects2$destroy;var visited=new Set();var metaObjects=[];var propertySets=[];// ---- helpers -----------------------------------------------------------
31061
31070
  var toStr=function toStr(v){return v===undefined||v===null?"":String(v);};function getGlobalId(entity){try{return String(entity.GlobalId);}catch(_unused2){return null;}}function addNode(entity,parent){var id=getGlobalId(entity);if(!id||visited.has(id))return false;visited.add(id);var globalizeObjectIds=ctx.globalizeObjectIds;var modelId=ctx.sceneModel.id;var propertySetIds=[];if(ctx.loadMetadataPropertySets){// Try all possible association fields
31062
- var associationFields=["HasAssociations","IsDefinedBy","IsDecomposedBy","ContainsElements"];for(var _i391=0,_associationFields=associationFields;_i391<_associationFields.length;_i391++){var field=_associationFields[_i391];var associations=entity[field];if(associations&&associations.length>0){var _associations$destroy;for(var j=0;j<associations.length;j++){var rel=associations.get(j);if(rel.is_a&&rel.is_a()==="IfcRelDefinesByProperties"){var _rel$destroy;var propSet=rel.RelatingPropertyDefinition;if(propSet&&propSet.is_a){// Accept both IfcPropertySet and IfcElementQuantity
31071
+ var associationFields=["HasAssociations","IsDefinedBy","IsDecomposedBy","ContainsElements"];for(var _i393=0,_associationFields=associationFields;_i393<_associationFields.length;_i393++){var field=_associationFields[_i393];var associations=entity[field];if(associations&&associations.length>0){var _associations$destroy;for(var j=0;j<associations.length;j++){var rel=associations.get(j);if(rel.is_a&&rel.is_a()==="IfcRelDefinesByProperties"){var _rel$destroy;var propSet=rel.RelatingPropertyDefinition;if(propSet&&propSet.is_a){// Accept both IfcPropertySet and IfcElementQuantity
31063
31072
  if(["IfcPropertySet","IfcElementQuantity"].includes(propSet.is_a())){var _propSet$destroy;var propSetId=propSet.GlobalId?String(propSet.GlobalId):null;var propSetName=propSet.Name?String(propSet.Name):"";var propSetType=propSet.is_a?String(propSet.is_a()):"";var properties=[];var props=propSet.HasProperties||propSet.Quantities;if(props&&props.length>0){var _props$destroy;for(var k=0;k<props.length;k++){var _p6$destroy;var _p6=props.get(k);var propName=_p6.Name?String(_p6.Name):"";var propValue="";var propType=_p6.is_a?String(_p6.is_a()):"";if(_p6.is_a&&_p6.is_a()==="IfcPropertySingleValue"){try{propValue=_p6.NominalValue?String(_p6.NominalValue.wrappedValue):"";}catch(_unused3){propValue="";}}else if(_p6.is_a&&_p6.is_a()==="IfcPropertyEnumeratedValue"){try{var values=_p6.EnumerationValues;if(values&&values.length>0){var arr=[];for(var vi=0;vi<values.length;vi++){arr.push(String(values.get(vi).wrappedValue));}propValue=arr.join(", ");}}catch(_unused4){propValue="";}}else if(_p6.is_a&&_p6.is_a()==="IfcQuantityArea"){propValue=_p6.AreaValue?String(_p6.AreaValue):"";}else if(_p6.is_a&&_p6.is_a()==="IfcQuantityLength"){propValue=_p6.LengthValue?String(_p6.LengthValue):"";}else if(_p6.is_a&&_p6.is_a()==="IfcQuantityVolume"){propValue=_p6.VolumeValue?String(_p6.VolumeValue):"";}else{try{propValue=_p6.NominalValue?String(_p6.NominalValue):"";}catch(_unused5){propValue="";}}properties.push({name:propName,value:propValue,type:propType});(_p6$destroy=_p6.destroy)===null||_p6$destroy===void 0?void 0:_p6$destroy.call(_p6);}(_props$destroy=props.destroy)===null||_props$destroy===void 0?void 0:_props$destroy.call(props);}propertySets.push({id:propSetId,// objectId: ctx.globalizeObjectIds ? math.globalizeObjectId(ctx.sceneModel.id, objectId) : objectId,
31064
31073
  name:propSetName,type:propSetType,properties:properties});propertySetIds.push(propSetId);(_propSet$destroy=propSet.destroy)===null||_propSet$destroy===void 0?void 0:_propSet$destroy.call(propSet);}}(_rel$destroy=rel.destroy)===null||_rel$destroy===void 0?void 0:_rel$destroy.call(rel);}}(_associations$destroy=associations.destroy)===null||_associations$destroy===void 0?void 0:_associations$destroy.call(associations);}}}metaObjects.push({id:globalizeObjectIds?math.globalizeObjectId(modelId,id):id,type:String(entity.is_a()),parent:parent?globalizeObjectIds?math.globalizeObjectId(modelId,getGlobalId(parent)):getGlobalId(parent):null,propertySetIds:propertySetIds});return true;}function walk(entity){var _entity$destroy2;var parent=arguments.length>1&&arguments[1]!==undefined?arguments[1]:null;if(!entity)return;// add current node (skip children if already visited)
31065
31074
  if(!addNode(entity,parent)){var _entity$destroy;(_entity$destroy=entity.destroy)===null||_entity$destroy===void 0?void 0:_entity$destroy.call(entity);return;}// 1) Decomposition (IfcRelAggregates / IfcRelNests)
31066
- var decos=entity.IsDecomposedBy;if(decos){for(var _i392=0;_i392<decos.length;_i392++){var _rel$destroy2;var rel=decos.get(_i392);var children=rel.RelatedObjects;if(children){var _children$destroy;for(var j=0;j<children.length;j++){var _child$destroy;var child=children.get(j);walk(child,entity);(_child$destroy=child.destroy)===null||_child$destroy===void 0?void 0:_child$destroy.call(child);}(_children$destroy=children.destroy)===null||_children$destroy===void 0?void 0:_children$destroy.call(children);}(_rel$destroy2=rel.destroy)===null||_rel$destroy2===void 0?void 0:_rel$destroy2.call(rel);}}// 2) Spatial containment (IfcRelContainedInSpatialStructure)
31067
- var contains=entity.ContainsElements;if(contains){for(var _i393=0;_i393<contains.length;_i393++){var _rel$destroy3;var _rel=contains.get(_i393);var elems=_rel.RelatedElements;if(elems){var _elems$destroy;for(var _j5=0;_j5<elems.length;_j5++){var _elem$destroy;var elem=elems.get(_j5);walk(elem,entity);(_elem$destroy=elem.destroy)===null||_elem$destroy===void 0?void 0:_elem$destroy.call(elem);}(_elems$destroy=elems.destroy)===null||_elems$destroy===void 0?void 0:_elems$destroy.call(elems);}(_rel$destroy3=_rel.destroy)===null||_rel$destroy3===void 0?void 0:_rel$destroy3.call(_rel);}}(_entity$destroy2=entity.destroy)===null||_entity$destroy2===void 0?void 0:_entity$destroy2.call(entity);}// ---- metadata extraction ----------------------------------------------
31075
+ var decos=entity.IsDecomposedBy;if(decos){for(var _i394=0;_i394<decos.length;_i394++){var _rel$destroy2;var rel=decos.get(_i394);var children=rel.RelatedObjects;if(children){var _children$destroy;for(var j=0;j<children.length;j++){var _child$destroy;var child=children.get(j);walk(child,entity);(_child$destroy=child.destroy)===null||_child$destroy===void 0?void 0:_child$destroy.call(child);}(_children$destroy=children.destroy)===null||_children$destroy===void 0?void 0:_children$destroy.call(children);}(_rel$destroy2=rel.destroy)===null||_rel$destroy2===void 0?void 0:_rel$destroy2.call(rel);}}// 2) Spatial containment (IfcRelContainedInSpatialStructure)
31076
+ var contains=entity.ContainsElements;if(contains){for(var _i395=0;_i395<contains.length;_i395++){var _rel$destroy3;var _rel=contains.get(_i395);var elems=_rel.RelatedElements;if(elems){var _elems$destroy;for(var _j5=0;_j5<elems.length;_j5++){var _elem$destroy;var elem=elems.get(_j5);walk(elem,entity);(_elem$destroy=elem.destroy)===null||_elem$destroy===void 0?void 0:_elem$destroy.call(elem);}(_elems$destroy=elems.destroy)===null||_elems$destroy===void 0?void 0:_elems$destroy.call(elems);}(_rel$destroy3=_rel.destroy)===null||_rel$destroy3===void 0?void 0:_rel$destroy3.call(_rel);}}(_entity$destroy2=entity.destroy)===null||_entity$destroy2===void 0?void 0:_entity$destroy2.call(entity);}// ---- metadata extraction ----------------------------------------------
31068
31077
  var projectId="";var author="";var createdAt="";// ISO string
31069
31078
  var schema="";var creatingApplication="";// Schema (primary)
31070
31079
  try{// ifcopenshell.file usually exposes a `schema` string property
@@ -31078,13 +31087,13 @@ try{var ts=oh===null||oh===void 0?void 0:oh.CreationDate;if(typeof ts==="number"
31078
31087
  try{var app=oh===null||oh===void 0?void 0:oh.OwningApplication;var appName=app!==null&&app!==void 0&&app.ApplicationFullName?toStr(app.ApplicationFullName):app!==null&&app!==void 0&&app.ApplicationIdentifier?toStr(app.ApplicationIdentifier):"";var appVer=app!==null&&app!==void 0&&app.Version?toStr(app.Version):"";creatingApplication=[appName,appVer].filter(Boolean).join(" ");}catch(_unused10){}}}catch(_unused11){}// Clean first project (we’ll traverse below with a fresh pointer anyway)
31079
31088
  (_project$destroy=project.destroy)===null||_project$destroy===void 0?void 0:_project$destroy.call(project);}// Fallbacks via STEP header if OwnerHistory wasn’t there / incomplete
31080
31089
  try{var fileName=ifc.wrapped_data.header.file_name;if(!author){try{var authors=fileName.author;if(authors&&authors.length>0){// `author` is a LIST in the STEP header; join if multiple
31081
- var parts=[];for(var _i394=0;_i394<authors.length;_i394++){parts.push(toStr(authors.get(_i394)));}author=parts.filter(Boolean).join(", ");}}catch(_unused12){}}if(!createdAt){var _ts=toStr(fileName.time_stamp);// already a string like "2023-08-10T12:34:56"
31090
+ var parts=[];for(var _i396=0;_i396<authors.length;_i396++){parts.push(toStr(authors.get(_i396)));}author=parts.filter(Boolean).join(", ");}}catch(_unused12){}}if(!createdAt){var _ts=toStr(fileName.time_stamp);// already a string like "2023-08-10T12:34:56"
31082
31091
  if(_ts){// normalize to ISO if possible
31083
31092
  var maybe=new Date(_ts);if(!isNaN(maybe.getTime()))createdAt=maybe.toISOString();}}if(!creatingApplication){// STEP header carries "originating_system" and "preprocessor_version"
31084
31093
  var orig=toStr(fileName.originating_system);var prep=toStr(fileName.preprocessor_version);creatingApplication=[orig,prep].filter(Boolean).join(" / ");}}catch(_unused13){}// If createdAt still missing, sweep for earliest OwnerHistory timestamp across roots
31085
- if(!createdAt){try{var _roots$destroy;var minTs=Infinity;var roots=ifc.by_type("IfcRoot");for(var _i395=0;_i395<roots.length;_i395++){var _r$destroy;var r=roots.get(_i395);var _oh=r===null||r===void 0?void 0:r.OwnerHistory;var _ts2=_oh===null||_oh===void 0?void 0:_oh.CreationDate;if(typeof _ts2==="number"&&isFinite(_ts2)&&_ts2>0&&_ts2<minTs){minTs=_ts2;}(_r$destroy=r.destroy)===null||_r$destroy===void 0?void 0:_r$destroy.call(r);}(_roots$destroy=roots.destroy)===null||_roots$destroy===void 0?void 0:_roots$destroy.call(roots);if(isFinite(minTs))createdAt=new Date(minTs*1000).toISOString();}catch(_unused14){}}// ---- hierarchy walk ----------------------------------------------------
31094
+ if(!createdAt){try{var _roots$destroy;var minTs=Infinity;var roots=ifc.by_type("IfcRoot");for(var _i397=0;_i397<roots.length;_i397++){var _r$destroy;var r=roots.get(_i397);var _oh=r===null||r===void 0?void 0:r.OwnerHistory;var _ts2=_oh===null||_oh===void 0?void 0:_oh.CreationDate;if(typeof _ts2==="number"&&isFinite(_ts2)&&_ts2>0&&_ts2<minTs){minTs=_ts2;}(_r$destroy=r.destroy)===null||_r$destroy===void 0?void 0:_r$destroy.call(r);}(_roots$destroy=roots.destroy)===null||_roots$destroy===void 0?void 0:_roots$destroy.call(roots);if(isFinite(minTs))createdAt=new Date(minTs*1000).toISOString();}catch(_unused14){}}// ---- hierarchy walk ----------------------------------------------------
31086
31095
  // Re-query projects since we destroyed the first pointer above
31087
- var projects2=ifc.by_type("IfcProject");for(var _i396=0;_i396<projects2.length;_i396++){var _project$destroy2;var _project=projects2.get(_i396);walk(_project,null);(_project$destroy2=_project.destroy)===null||_project$destroy2===void 0?void 0:_project$destroy2.call(_project);}(_projects2$destroy=projects2.destroy)===null||_projects2$destroy===void 0?void 0:_projects2$destroy.call(projects2);return{id:"",projectId:projectId,author:author,createdAt:createdAt,schema:schema,creatingApplication:creatingApplication,metaObjects:metaObjects,propertySets:propertySets};}/**
31096
+ var projects2=ifc.by_type("IfcProject");for(var _i398=0;_i398<projects2.length;_i398++){var _project$destroy2;var _project=projects2.get(_i398);walk(_project,null);(_project$destroy2=_project.destroy)===null||_project$destroy2===void 0?void 0:_project$destroy2.call(_project);}(_projects2$destroy=projects2.destroy)===null||_projects2$destroy===void 0?void 0:_projects2$destroy.call(projects2);return{id:"",projectId:projectId,author:author,createdAt:createdAt,schema:schema,creatingApplication:creatingApplication,metaObjects:metaObjects,propertySets:propertySets};}/**
31088
31097
  * Destroys this IFCOpenShellLoaderPlugin instance.
31089
31098
  */},{key:"destroy",value:function destroy(){_get(_getPrototypeOf(IFCOpenShellLoaderPlugin.prototype),"destroy",this).call(this);}}]);return IFCOpenShellLoaderPlugin;}(Plugin);function makeSubGeometryId(geometry_id,matIndex){return"".concat(geometry_id,":").concat(matIndex,"#geom");}function buildMaterialMapping(materialIds){var mapping={};for(var faceIdx=0;faceIdx<materialIds.length;faceIdx++){var materialId=materialIds[faceIdx];if(materialId==null||materialId<0)continue;// skip invalid / missing
31090
31099
  (mapping[materialId]||(mapping[materialId]=[])).push(faceIdx);}return mapping;}function buildIndicesForFaces(faceList,faceIndices){var indices=new Uint32Array(faceList.length*3);var k=0;var _iterator61=_createForOfIteratorHelper(faceList),_step61;try{for(_iterator61.s();!(_step61=_iterator61.n()).done;){var faceIdx=_step61.value;var base=faceIdx*3;indices[k++]=faceIndices[base+0];indices[k++]=faceIndices[base+1];indices[k++]=faceIndices[base+2];}}catch(err){_iterator61.e(err);}finally{_iterator61.f();}return indices;}function generateUUID(){return Math.random().toString(36).substr(2,9);}function extractRTCTransform(transform){var matrix=flattenMatrixArray(transform);var origin=[];var worldOrigin=matrix.slice(12,15);// translation xyz
@@ -31102,7 +31111,7 @@ var headerBlockItems=[{item:'FileSignature',format:'char',size:4},{item:'FileSou
31102
31111
  * @private
31103
31112
  * @param arrayBuffer
31104
31113
  * @returns {{}}
31105
- */var loadLASHeader=function loadLASHeader(arrayBuffer){var currentByte=0;var numOfVarLenRecords=0;var projectionStart=0;var dataView=new DataView(arrayBuffer);var buffer=new Uint8Array(6000);var getGeoKeys=function getGeoKeys(geoRecord){if(geoRecord===undefined){return undefined;}var projectionEnd=projectionStart+geoRecord["RecordLengthAfterHeader"];var geoTag=buffer.slice(projectionStart,projectionEnd);var arrayBuffer=bufferFlipper(geoTag);var dataView=new DataView(arrayBuffer);var byteCount=6;var numberOfKeys=Number(dataView.getUint16(byteCount,true));var geoKeys=[];while(numberOfKeys--){var keyTmp={};keyTmp.key=dataView.getUint16(byteCount+=2,true);keyTmp.tiffTagLocation=dataView.getUint16(byteCount+=2,true);keyTmp.count=dataView.getUint16(byteCount+=2,true);keyTmp.valueOffset=dataView.getUint16(byteCount+=2,true);geoKeys.push(keyTmp);}var projRecord=geoKeys.find(function(x){return x.key===3072;});if(projRecord&&projRecord.hasOwnProperty('valueOffset')){var epsg=projRecord.valueOffset;{return epsg;}}return undefined;};var getValue=function getValue(_ref25){var item=_ref25.item,format=_ref25.format,size=_ref25.size;var str,array;switch(format){case'char':array=new Uint8Array(arrayBuffer,currentByte,size);currentByte+=size;str=uint8arrayToString(array);return[item,str];case'uShort':str=dataView.getUint16(currentByte,true);currentByte+=size;return[item,str];case'uLong':str=dataView.getUint32(currentByte,true);if(item==='NumberOfVariableLengthRecords'){numOfVarLenRecords=str;}currentByte+=size;return[item,str];case'uChar':str=dataView.getUint8(currentByte);currentByte+=size;return[item,str];case'double':str=dataView.getFloat64(currentByte,true);currentByte+=size;return[item,str];default:currentByte+=size;}};var getValues=function getValues(){var publicHeaderBlock={};headerBlockItems.forEach(function(obj){var myObj=getValue(_objectSpread({},obj));if(myObj!==undefined){if(myObj[0]==='FileSignature'&&myObj[1]!=='LASF'){throw new Error('Ivalid FileSignature. Is this a LAS/LAZ file');}publicHeaderBlock[myObj[0]]=myObj[1];}});var variableRecords=[];var variableLengthRecords=numOfVarLenRecords;var _loop14=function _loop14(){var variableObj={};variableLengthRecord.forEach(function(obj){var myObj=getValue(_objectSpread({},obj));variableObj[myObj[0]]=myObj[1];if(myObj[0]==='UserId'&&myObj[1]==='LASF_Projection'){projectionStart=currentByte-18+54;}});variableRecords.push(variableObj);};while(variableLengthRecords--){_loop14();}var geoRecord=variableRecords.find(function(x){return x.UserId==='LASF_Projection';});var epsg=getGeoKeys(geoRecord);if(epsg){publicHeaderBlock['epsg']=epsg;}return publicHeaderBlock;};return getValues();};var bufferFlipper=function bufferFlipper(buf){var ab=new ArrayBuffer(buf.length);var view=new Uint8Array(ab);for(var _i397=0;_i397<buf.length;++_i397){view[_i397]=buf[_i397];}return ab;};var uint8arrayToString=function uint8arrayToString(array){var str='';array.forEach(function(item){var c=String.fromCharCode(item);if(c!=="\0"){str+=c;}});return str.trim();};var MAX_VERTICES=500000;// TODO: Rough estimate
31114
+ */var loadLASHeader=function loadLASHeader(arrayBuffer){var currentByte=0;var numOfVarLenRecords=0;var projectionStart=0;var dataView=new DataView(arrayBuffer);var buffer=new Uint8Array(6000);var getGeoKeys=function getGeoKeys(geoRecord){if(geoRecord===undefined){return undefined;}var projectionEnd=projectionStart+geoRecord["RecordLengthAfterHeader"];var geoTag=buffer.slice(projectionStart,projectionEnd);var arrayBuffer=bufferFlipper(geoTag);var dataView=new DataView(arrayBuffer);var byteCount=6;var numberOfKeys=Number(dataView.getUint16(byteCount,true));var geoKeys=[];while(numberOfKeys--){var keyTmp={};keyTmp.key=dataView.getUint16(byteCount+=2,true);keyTmp.tiffTagLocation=dataView.getUint16(byteCount+=2,true);keyTmp.count=dataView.getUint16(byteCount+=2,true);keyTmp.valueOffset=dataView.getUint16(byteCount+=2,true);geoKeys.push(keyTmp);}var projRecord=geoKeys.find(function(x){return x.key===3072;});if(projRecord&&projRecord.hasOwnProperty('valueOffset')){var epsg=projRecord.valueOffset;{return epsg;}}return undefined;};var getValue=function getValue(_ref25){var item=_ref25.item,format=_ref25.format,size=_ref25.size;var str,array;switch(format){case'char':array=new Uint8Array(arrayBuffer,currentByte,size);currentByte+=size;str=uint8arrayToString(array);return[item,str];case'uShort':str=dataView.getUint16(currentByte,true);currentByte+=size;return[item,str];case'uLong':str=dataView.getUint32(currentByte,true);if(item==='NumberOfVariableLengthRecords'){numOfVarLenRecords=str;}currentByte+=size;return[item,str];case'uChar':str=dataView.getUint8(currentByte);currentByte+=size;return[item,str];case'double':str=dataView.getFloat64(currentByte,true);currentByte+=size;return[item,str];default:currentByte+=size;}};var getValues=function getValues(){var publicHeaderBlock={};headerBlockItems.forEach(function(obj){var myObj=getValue(_objectSpread({},obj));if(myObj!==undefined){if(myObj[0]==='FileSignature'&&myObj[1]!=='LASF'){throw new Error('Ivalid FileSignature. Is this a LAS/LAZ file');}publicHeaderBlock[myObj[0]]=myObj[1];}});var variableRecords=[];var variableLengthRecords=numOfVarLenRecords;var _loop14=function _loop14(){var variableObj={};variableLengthRecord.forEach(function(obj){var myObj=getValue(_objectSpread({},obj));variableObj[myObj[0]]=myObj[1];if(myObj[0]==='UserId'&&myObj[1]==='LASF_Projection'){projectionStart=currentByte-18+54;}});variableRecords.push(variableObj);};while(variableLengthRecords--){_loop14();}var geoRecord=variableRecords.find(function(x){return x.UserId==='LASF_Projection';});var epsg=getGeoKeys(geoRecord);if(epsg){publicHeaderBlock['epsg']=epsg;}return publicHeaderBlock;};return getValues();};var bufferFlipper=function bufferFlipper(buf){var ab=new ArrayBuffer(buf.length);var view=new Uint8Array(ab);for(var _i399=0;_i399<buf.length;++_i399){view[_i399]=buf[_i399];}return ab;};var uint8arrayToString=function uint8arrayToString(array){var str='';array.forEach(function(item){var c=String.fromCharCode(item);if(c!=="\0"){str+=c;}});return str.trim();};var MAX_VERTICES=500000;// TODO: Rough estimate
31106
31115
  /**
31107
31116
  * {@link Viewer} plugin that loads lidar point cloud geometry from LAS files.
31108
31117
  *
@@ -31441,7 +31450,7 @@ var headerBlockItems=[{item:'FileSignature',format:'char',size:4},{item:'FileSou
31441
31450
  sceneModel.fire("loaded",true,false);// Don't forget the event, for late subscribers
31442
31451
  });spinner.processes--;};var error=function error(errMsg){spinner.processes--;_this200.error(errMsg);sceneModel.fire("error",errMsg);};if(params.src){this._loadModel(params.src,params,options,sceneModel);}else if(params.las){spinner.processes++;this._parseModel(params.las,params,options,sceneModel).then(done,error);}else if(params.manifest||params.manifestSrc){var baseDir=params.manifestSrc?getBaseDirectory(params.manifestSrc):"";var loadAllFiles=function loadAllFiles(lasFiles){var i=0;var modelsLoaded=new Array(lasFiles.length);var loadNext=function loadNext(){if(sceneModel.destroyed){done();}else if(i>=lasFiles.length){return;}else{modelsLoaded[i]=false;_this200._dataSource.getLAS("".concat(baseDir).concat(lasFiles[i]),function(arrayBuffer){var modelParams=utils.apply(params,{isManifest:true,index:i});_this200._parseModel(arrayBuffer,modelParams,options,sceneModel).then(function(){modelsLoaded[modelParams.index]=true;var allLoaded=true;modelsLoaded.forEach(function(loaded){if(!loaded)allLoaded=false;});if(allLoaded)done();});i++;_this200.scheduleTask(loadNext,200);},error);}};loadNext();};var loadManifestData=function loadManifestData(manifestData){if(sceneModel.destroyed)return;var files=manifestData.lasFiles||manifestData.lazFiles;if(!files||files.length<=0){_this200.error("load(): Failed to load model manifest - manifest not valid");return;}loadAllFiles(files);};if(params.manifestSrc){this._dataSource.getManifest(params.manifestSrc,function(manifestData){loadManifestData(manifestData);},function(errMsg){_this200.error(errMsg);sceneModel.fire("error",errMsg);});}else{var manifestData=params.manifest;loadManifestData(manifestData);}}return sceneModel;}},{key:"_loadModel",value:function _loadModel(src,params,options,sceneModel){var _this201=this;var spinner=this.viewer.scene.canvas.spinner;spinner.processes++;this._dataSource.getLAS(params.src,function(arrayBuffer){_this201._parseModel(arrayBuffer,params,options,sceneModel).then(function(){sceneModel.scene.once("tick",function(){if(sceneModel.destroyed){return;}sceneModel.scene.fire("modelLoaded",sceneModel.id);// FIXME: Assumes listeners know order of these two events
31443
31452
  sceneModel.fire("loaded",true,false);// Don't forget the event, for late subscribers
31444
- });spinner.processes--;},function(errMsg){spinner.processes--;_this201.error(errMsg);sceneModel.fire("error",errMsg);});},function(errMsg){spinner.processes--;_this201.error(errMsg);sceneModel.fire("error",errMsg);});}},{key:"_parseModel",value:function _parseModel(arrayBuffer,params,options,sceneModel){var _this202=this;var readPositions=function readPositions(attributesPosition){var positionsValue=attributesPosition.value;if(_this202._center){var centerPos=math.vec3();var numPoints=positionsValue.length;for(var _i398=0,len=positionsValue.length;_i398<len;_i398+=3){centerPos[0]+=positionsValue[_i398+0];centerPos[1]+=positionsValue[_i398+1];centerPos[2]+=positionsValue[_i398+2];}centerPos[0]/=numPoints;centerPos[1]/=numPoints;centerPos[2]/=numPoints;for(var _i399=0,_len59=positionsValue.length;_i399<_len59;_i399+=3){positionsValue[_i399+0]-=centerPos[0];positionsValue[_i399+1]-=centerPos[1];positionsValue[_i399+2]-=centerPos[2];}}if(_this202._rotateX){if(positionsValue){for(var _i400=0,_len60=positionsValue.length;_i400<_len60;_i400+=3){var temp=positionsValue[_i400+1];positionsValue[_i400+1]=positionsValue[_i400+2];positionsValue[_i400+2]=temp;}}}if(_this202._rotate){var quaternion=math.identityQuaternion();var mat=math.mat4();math.eulerToQuaternion(_this202._rotate,"XYZ",quaternion);math.quaternionToRotationMat4(quaternion,mat);var pos=math.vec3();for(var _i401=0,_len61=positionsValue.length;_i401<_len61;_i401+=3){pos[0]=positionsValue[_i401+0];pos[1]=positionsValue[_i401+1];pos[2]=positionsValue[_i401+2];math.transformPoint3(mat,pos,pos);positionsValue[_i401+0]=pos[0];positionsValue[_i401+1]=pos[1];positionsValue[_i401+2]=pos[2];}}if(_this202._transform){var _mat=math.mat4(_this202._transform);var _pos=math.vec3();for(var _i402=0,_len62=positionsValue.length;_i402<_len62;_i402+=3){_pos[0]=positionsValue[_i402+0];_pos[1]=positionsValue[_i402+1];_pos[2]=positionsValue[_i402+2];math.transformPoint3(_mat,_pos,_pos);positionsValue[_i402+0]=_pos[0];positionsValue[_i402+1]=_pos[1];positionsValue[_i402+2]=_pos[2];}}return positionsValue;};function readColorsAndIntensities(attributesColor,attributesIntensity){var colors=attributesColor.value;var colorSize=attributesColor.size;var intensities=attributesIntensity.value;var colorsCompressedSize=intensities.length*4;var colorsCompressed=new Uint8Array(colorsCompressedSize);for(var _i403=0,j=0,k=0,len=intensities.length;_i403<len;_i403++,k+=colorSize,j+=4){colorsCompressed[j+0]=colors[k+0];colorsCompressed[j+1]=colors[k+1];colorsCompressed[j+2]=colors[k+2];colorsCompressed[j+3]=Math.round(intensities[_i403]/65536*255);}return colorsCompressed;}function readIntensities(attributesIntensity){var intensities=attributesIntensity.value;var colorsCompressedSize=intensities.length*4;var colorsCompressed=new Uint8Array(colorsCompressedSize);for(var _i404=0,j=0,len=intensities.length;_i404<len;_i404++,j+=4){colorsCompressed[j+0]=0;colorsCompressed[j+1]=0;colorsCompressed[j+2]=0;colorsCompressed[j+3]=Math.round(intensities[_i404]/65536*255);}return colorsCompressed;}return new Promise(function(resolve,reject){if(sceneModel.destroyed){reject();return;}var stats=params.stats||{};stats.sourceFormat="LAS";stats.schemaVersion="";stats.title="";stats.author="";stats.created="";stats.numMetaObjects=0;stats.numPropertySets=0;stats.numObjects=0;stats.numGeometries=0;stats.numTriangles=0;stats.numVertices=0;try{var lasHeader=loadLASHeader(arrayBuffer);parse$4(arrayBuffer,LASLoader,options).then(function(parsedData){var attributes=parsedData.attributes;var loaderData=parsedData.loaderData;var pointsFormatId=loaderData.pointsFormatId!==undefined?loaderData.pointsFormatId:-1;if(!attributes.POSITION){sceneModel.finalize();reject("No positions found in file");return;}var positionsValue;var colorsCompressed;switch(pointsFormatId){case 0:positionsValue=readPositions(attributes.POSITION);colorsCompressed=readIntensities(attributes.intensity);break;case 1:if(!attributes.intensity){sceneModel.finalize();reject("No positions found in file");return;}positionsValue=readPositions(attributes.POSITION);colorsCompressed=readIntensities(attributes.intensity);break;case 2:if(!attributes.intensity){sceneModel.finalize();reject("No positions found in file");return;}positionsValue=readPositions(attributes.POSITION);colorsCompressed=readColorsAndIntensities(attributes.COLOR_0,attributes.intensity);break;case 3:if(!attributes.intensity){sceneModel.finalize();reject("No positions found in file");return;}positionsValue=readPositions(attributes.POSITION);colorsCompressed=readColorsAndIntensities(attributes.COLOR_0,attributes.intensity);break;}var pointsChunks=chunkArray(positionsValue,MAX_VERTICES*3);var colorsChunks=chunkArray(colorsCompressed,MAX_VERTICES*4);var meshIds=[];for(var _i405=0,len=pointsChunks.length;_i405<len;_i405++){var meshId="".concat(params.isManifest?'model'+params.index:'',"pointsMesh").concat(_i405);meshIds.push(meshId);sceneModel.createMesh({id:meshId,primitive:"points",positions:pointsChunks[_i405],colorsCompressed:_i405<colorsChunks.length?colorsChunks[_i405]:null});}var pointsObjectId=params.entityId||math.createUUID();sceneModel.createEntity({id:pointsObjectId,meshIds:meshIds,isObject:true});sceneModel.finalize();if(params.metaModelJSON){var metaModelId=sceneModel.id;_this202.viewer.metaScene.createMetaModel(metaModelId,params.metaModelJSON,options);}else if(params.loadMetadata!==false){var rootMetaObjectId=math.createUUID();var metadata={projectId:"",author:"",createdAt:"",schema:"",creatingApplication:"",metaObjects:[{id:rootMetaObjectId,name:"Model",type:"Model"},{id:pointsObjectId,name:"PointCloud (LAS)",type:"PointCloud",parent:rootMetaObjectId,attributes:lasHeader||{}}],propertySets:[]};var _metaModelId=sceneModel.id;_this202.viewer.metaScene.createMetaModel(_metaModelId,metadata,options);}resolve();});}catch(e){sceneModel.finalize();reject(e);}});}}]);return LASLoaderPlugin;}(Plugin);function chunkArray(array,chunkSize){if(chunkSize>=array.length){return[array];}var result=[];for(var _i406=0;_i406<array.length;_i406+=chunkSize){result.push(array.slice(_i406,_i406+chunkSize));}return result;}function getBaseDirectory(filePath){if(filePath.indexOf('?')>-1){filePath=filePath.split('?')[0];}var pathArray=filePath.split('/');pathArray.pop();// Remove the file name or the last segment of the path
31453
+ });spinner.processes--;},function(errMsg){spinner.processes--;_this201.error(errMsg);sceneModel.fire("error",errMsg);});},function(errMsg){spinner.processes--;_this201.error(errMsg);sceneModel.fire("error",errMsg);});}},{key:"_parseModel",value:function _parseModel(arrayBuffer,params,options,sceneModel){var _this202=this;var readPositions=function readPositions(attributesPosition){var positionsValue=attributesPosition.value;if(_this202._center){var centerPos=math.vec3();var numPoints=positionsValue.length;for(var _i400=0,len=positionsValue.length;_i400<len;_i400+=3){centerPos[0]+=positionsValue[_i400+0];centerPos[1]+=positionsValue[_i400+1];centerPos[2]+=positionsValue[_i400+2];}centerPos[0]/=numPoints;centerPos[1]/=numPoints;centerPos[2]/=numPoints;for(var _i401=0,_len59=positionsValue.length;_i401<_len59;_i401+=3){positionsValue[_i401+0]-=centerPos[0];positionsValue[_i401+1]-=centerPos[1];positionsValue[_i401+2]-=centerPos[2];}}if(_this202._rotateX){if(positionsValue){for(var _i402=0,_len60=positionsValue.length;_i402<_len60;_i402+=3){var temp=positionsValue[_i402+1];positionsValue[_i402+1]=positionsValue[_i402+2];positionsValue[_i402+2]=temp;}}}if(_this202._rotate){var quaternion=math.identityQuaternion();var mat=math.mat4();math.eulerToQuaternion(_this202._rotate,"XYZ",quaternion);math.quaternionToRotationMat4(quaternion,mat);var pos=math.vec3();for(var _i403=0,_len61=positionsValue.length;_i403<_len61;_i403+=3){pos[0]=positionsValue[_i403+0];pos[1]=positionsValue[_i403+1];pos[2]=positionsValue[_i403+2];math.transformPoint3(mat,pos,pos);positionsValue[_i403+0]=pos[0];positionsValue[_i403+1]=pos[1];positionsValue[_i403+2]=pos[2];}}if(_this202._transform){var _mat=math.mat4(_this202._transform);var _pos=math.vec3();for(var _i404=0,_len62=positionsValue.length;_i404<_len62;_i404+=3){_pos[0]=positionsValue[_i404+0];_pos[1]=positionsValue[_i404+1];_pos[2]=positionsValue[_i404+2];math.transformPoint3(_mat,_pos,_pos);positionsValue[_i404+0]=_pos[0];positionsValue[_i404+1]=_pos[1];positionsValue[_i404+2]=_pos[2];}}return positionsValue;};function readColorsAndIntensities(attributesColor,attributesIntensity){var colors=attributesColor.value;var colorSize=attributesColor.size;var intensities=attributesIntensity.value;var colorsCompressedSize=intensities.length*4;var colorsCompressed=new Uint8Array(colorsCompressedSize);for(var _i405=0,j=0,k=0,len=intensities.length;_i405<len;_i405++,k+=colorSize,j+=4){colorsCompressed[j+0]=colors[k+0];colorsCompressed[j+1]=colors[k+1];colorsCompressed[j+2]=colors[k+2];colorsCompressed[j+3]=Math.round(intensities[_i405]/65536*255);}return colorsCompressed;}function readIntensities(attributesIntensity){var intensities=attributesIntensity.value;var colorsCompressedSize=intensities.length*4;var colorsCompressed=new Uint8Array(colorsCompressedSize);for(var _i406=0,j=0,len=intensities.length;_i406<len;_i406++,j+=4){colorsCompressed[j+0]=0;colorsCompressed[j+1]=0;colorsCompressed[j+2]=0;colorsCompressed[j+3]=Math.round(intensities[_i406]/65536*255);}return colorsCompressed;}return new Promise(function(resolve,reject){if(sceneModel.destroyed){reject();return;}var stats=params.stats||{};stats.sourceFormat="LAS";stats.schemaVersion="";stats.title="";stats.author="";stats.created="";stats.numMetaObjects=0;stats.numPropertySets=0;stats.numObjects=0;stats.numGeometries=0;stats.numTriangles=0;stats.numVertices=0;try{var lasHeader=loadLASHeader(arrayBuffer);parse$4(arrayBuffer,LASLoader,options).then(function(parsedData){var attributes=parsedData.attributes;var loaderData=parsedData.loaderData;var pointsFormatId=loaderData.pointsFormatId!==undefined?loaderData.pointsFormatId:-1;if(!attributes.POSITION){sceneModel.finalize();reject("No positions found in file");return;}var positionsValue;var colorsCompressed;switch(pointsFormatId){case 0:positionsValue=readPositions(attributes.POSITION);colorsCompressed=readIntensities(attributes.intensity);break;case 1:if(!attributes.intensity){sceneModel.finalize();reject("No positions found in file");return;}positionsValue=readPositions(attributes.POSITION);colorsCompressed=readIntensities(attributes.intensity);break;case 2:if(!attributes.intensity){sceneModel.finalize();reject("No positions found in file");return;}positionsValue=readPositions(attributes.POSITION);colorsCompressed=readColorsAndIntensities(attributes.COLOR_0,attributes.intensity);break;case 3:if(!attributes.intensity){sceneModel.finalize();reject("No positions found in file");return;}positionsValue=readPositions(attributes.POSITION);colorsCompressed=readColorsAndIntensities(attributes.COLOR_0,attributes.intensity);break;}var pointsChunks=chunkArray(positionsValue,MAX_VERTICES*3);var colorsChunks=chunkArray(colorsCompressed,MAX_VERTICES*4);var meshIds=[];for(var _i407=0,len=pointsChunks.length;_i407<len;_i407++){var meshId="".concat(params.isManifest?'model'+params.index:'',"pointsMesh").concat(_i407);meshIds.push(meshId);sceneModel.createMesh({id:meshId,primitive:"points",positions:pointsChunks[_i407],colorsCompressed:_i407<colorsChunks.length?colorsChunks[_i407]:null});}var pointsObjectId=params.entityId||math.createUUID();sceneModel.createEntity({id:pointsObjectId,meshIds:meshIds,isObject:true});sceneModel.finalize();if(params.metaModelJSON){var metaModelId=sceneModel.id;_this202.viewer.metaScene.createMetaModel(metaModelId,params.metaModelJSON,options);}else if(params.loadMetadata!==false){var rootMetaObjectId=math.createUUID();var metadata={projectId:"",author:"",createdAt:"",schema:"",creatingApplication:"",metaObjects:[{id:rootMetaObjectId,name:"Model",type:"Model"},{id:pointsObjectId,name:"PointCloud (LAS)",type:"PointCloud",parent:rootMetaObjectId,attributes:lasHeader||{}}],propertySets:[]};var _metaModelId=sceneModel.id;_this202.viewer.metaScene.createMetaModel(_metaModelId,metadata,options);}resolve();});}catch(e){sceneModel.finalize();reject(e);}});}}]);return LASLoaderPlugin;}(Plugin);function chunkArray(array,chunkSize){if(chunkSize>=array.length){return[array];}var result=[];for(var _i408=0;_i408<array.length;_i408+=chunkSize){result.push(array.slice(_i408,_i408+chunkSize));}return result;}function getBaseDirectory(filePath){if(filePath.indexOf('?')>-1){filePath=filePath.split('?')[0];}var pathArray=filePath.split('/');pathArray.pop();// Remove the file name or the last segment of the path
31445
31454
  return pathArray.join('/')+'/';}/**
31446
31455
  * Default data access strategy for {@link CityJSONLoaderPlugin}.
31447
31456
  */var CityJSONDefaultDataSource=/*#__PURE__*/function(){function CityJSONDefaultDataSource(){var cfg=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};_classCallCheck(this,CityJSONDefaultDataSource);this.cacheBuster=cfg.cacheBuster!==false;}_createClass(CityJSONDefaultDataSource,[{key:"_cacheBusterURL",value:function _cacheBusterURL(url){if(!this.cacheBuster){return url;}var timestamp=new Date().getTime();if(url.indexOf('?')>-1){return url+'&_='+timestamp;}else{return url+'?_='+timestamp;}}/**
@@ -31594,16 +31603,16 @@ return pathArray.join('/')+'/';}/**
31594
31603
  */},{key:"load",value:function load(){var params=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};if(params.id&&this.viewer.scene.components[params.id]){this.error("Component with this ID already exists in viewer: "+params.id+" - will autogenerate this ID");delete params.id;}var sceneModel=new SceneModel(this.viewer.scene,utils.apply(params,{isModel:true,edges:true}));if(!params.src&&!params.cityJSON){this.error("load() param expected: src or cityJSON");return sceneModel;// Return new empty model
31595
31604
  }var options={};if(params.src){this._loadModel(params.src,params,options,sceneModel);}else{var spinner=this.viewer.scene.canvas.spinner;spinner.processes++;this._parseModel(params.cityJSON,params,options,sceneModel);spinner.processes--;}return sceneModel;}},{key:"_loadModel",value:function _loadModel(src,params,options,sceneModel){var _this204=this;var spinner=this.viewer.scene.canvas.spinner;spinner.processes++;this._dataSource.getCityJSON(params.src,function(data){_this204._parseModel(data,params,options,sceneModel);spinner.processes--;},function(errMsg){spinner.processes--;_this204.error(errMsg);sceneModel.fire("error",errMsg);});}},{key:"_parseModel",value:function _parseModel(data,params,options,sceneModel){if(sceneModel.destroyed){return;}var vertices=data.transform?this._transformVertices(data.vertices,data.transform,options.rotateX):data.vertices;var stats=params.stats||{};stats.sourceFormat=data.type||"CityJSON";stats.schemaVersion=data.version||"";stats.title="";stats.author="";stats.created="";stats.numMetaObjects=0;stats.numPropertySets=0;stats.numObjects=0;stats.numGeometries=0;stats.numTriangles=0;stats.numVertices=0;var loadMetadata=params.loadMetadata!==false;var rootMetaObject=loadMetadata?{id:math.createUUID(),name:"Model",type:"Model"}:null;var metadata=loadMetadata?{id:"",projectId:"",author:"",createdAt:"",schema:data.version||"",creatingApplication:"",metaObjects:[rootMetaObject],propertySets:[]}:null;var ctx={data:data,vertices:vertices,sceneModel:sceneModel,loadMetadata:loadMetadata,metadata:metadata,rootMetaObject:rootMetaObject,nextId:0,stats:stats};this._parseCityJSON(ctx);sceneModel.finalize();if(loadMetadata){var metaModelId=sceneModel.id;this.viewer.metaScene.createMetaModel(metaModelId,ctx.metadata,options);}sceneModel.scene.once("tick",function(){if(sceneModel.destroyed){return;}sceneModel.scene.fire("modelLoaded",sceneModel.id);// FIXME: Assumes listeners know order of these two events
31596
31605
  sceneModel.fire("loaded",true,false);// Don't forget the event, for late subscribers
31597
- });}},{key:"_transformVertices",value:function _transformVertices(vertices,transform,rotateX){var transformedVertices=[];var scale=transform.scale||math.vec3([1,1,1]);var translate=transform.translate||math.vec3([0,0,0]);for(var _i407=0,j=0;_i407<vertices.length;_i407++,j+=3){var x=vertices[_i407][0]*scale[0]+translate[0];var y=vertices[_i407][1]*scale[1]+translate[1];var _z5=vertices[_i407][2]*scale[2]+translate[2];if(rotateX){transformedVertices.push([x,_z5,y]);}else{transformedVertices.push([x,y,_z5]);}}return transformedVertices;}},{key:"_parseCityJSON",value:function _parseCityJSON(ctx){var data=ctx.data;var cityObjects=data.CityObjects;for(var objectId in cityObjects){if(cityObjects.hasOwnProperty(objectId)){var cityObject=cityObjects[objectId];this._parseCityObject(ctx,cityObject,objectId);}}}},{key:"_parseCityObject",value:function _parseCityObject(ctx,cityObject,objectId){var sceneModel=ctx.sceneModel;var data=ctx.data;if(ctx.loadMetadata){var metaObjectId=objectId;var metaObjectType=cityObject.type;var metaObjectName=metaObjectType+" : "+objectId;var parentMetaObjectId=cityObject.parents?cityObject.parents[0]:ctx.rootMetaObject.id;ctx.metadata.metaObjects.push({id:metaObjectId,name:metaObjectName,type:metaObjectType,parent:parentMetaObjectId});}ctx.stats.numMetaObjects++;if(!(cityObject.geometry&&cityObject.geometry.length>0)){return;}var meshIds=[];for(var _i408=0,len=cityObject.geometry.length;_i408<len;_i408++){var geometry=cityObject.geometry[_i408];var objectMaterial=void 0;var surfaceMaterials=void 0;var appearance=data.appearance;if(appearance){var materials=appearance.materials;if(materials){var geometryMaterial=geometry.material;if(geometryMaterial){var themeIds=Object.keys(geometryMaterial);if(themeIds.length>0){var themeId=themeIds[0];var theme=geometryMaterial[themeId];if(theme.value!==undefined){objectMaterial=materials[theme.value];}else{var values=theme.values;if(values){surfaceMaterials=[];for(var j=0,lenj=values.length;j<lenj;j++){var value=values[_i408];var surfaceMaterial=materials[value];surfaceMaterials.push(surfaceMaterial);}}}}}}}if(surfaceMaterials){this._parseGeometrySurfacesWithOwnMaterials(ctx,geometry,surfaceMaterials,meshIds);}else{this._parseGeometrySurfacesWithSharedMaterial(ctx,geometry,objectMaterial,meshIds);}}if(meshIds.length>0){sceneModel.createEntity({id:objectId,meshIds:meshIds,isObject:true});ctx.stats.numObjects++;}}},{key:"_parseGeometrySurfacesWithOwnMaterials",value:function _parseGeometrySurfacesWithOwnMaterials(ctx,geometry,surfaceMaterials,meshIds){var geomType=geometry.type;switch(geomType){case"MultiPoint":break;case"MultiLineString":break;case"MultiSurface":case"CompositeSurface":var surfaces=geometry.boundaries;this._parseSurfacesWithOwnMaterials(ctx,surfaceMaterials,surfaces,meshIds);break;case"Solid":var shells=geometry.boundaries;for(var j=0;j<shells.length;j++){var _surfaces=shells[j];this._parseSurfacesWithOwnMaterials(ctx,surfaceMaterials,_surfaces,meshIds);}break;case"MultiSolid":case"CompositeSolid":var solids=geometry.boundaries;for(var _j6=0;_j6<solids.length;_j6++){for(var k=0;k<solids[_j6].length;k++){var _surfaces2=solids[_j6][k];this._parseSurfacesWithOwnMaterials(ctx,surfaceMaterials,_surfaces2,meshIds);}}break;}}},{key:"_parseSurfacesWithOwnMaterials",value:function _parseSurfacesWithOwnMaterials(ctx,surfaceMaterials,surfaces,meshIds){var vertices=ctx.vertices;var sceneModel=ctx.sceneModel;for(var _i409=0;_i409<surfaces.length;_i409++){var surface=surfaces[_i409];var surfaceMaterial=surfaceMaterials[_i409]||{diffuseColor:[0.8,0.8,0.8],transparency:1.0};var face=[];var holes=[];var sharedIndices=[];var geometryCfg={positions:[],indices:[]};for(var j=0;j<surface.length;j++){if(face.length>0){holes.push(face.length);}var newFace=this._extractLocalIndices(ctx,surface[j],sharedIndices,geometryCfg);face.push.apply(face,_toConsumableArray(newFace));}if(face.length===3){// Triangle
31606
+ });}},{key:"_transformVertices",value:function _transformVertices(vertices,transform,rotateX){var transformedVertices=[];var scale=transform.scale||math.vec3([1,1,1]);var translate=transform.translate||math.vec3([0,0,0]);for(var _i409=0,j=0;_i409<vertices.length;_i409++,j+=3){var x=vertices[_i409][0]*scale[0]+translate[0];var y=vertices[_i409][1]*scale[1]+translate[1];var _z5=vertices[_i409][2]*scale[2]+translate[2];if(rotateX){transformedVertices.push([x,_z5,y]);}else{transformedVertices.push([x,y,_z5]);}}return transformedVertices;}},{key:"_parseCityJSON",value:function _parseCityJSON(ctx){var data=ctx.data;var cityObjects=data.CityObjects;for(var objectId in cityObjects){if(cityObjects.hasOwnProperty(objectId)){var cityObject=cityObjects[objectId];this._parseCityObject(ctx,cityObject,objectId);}}}},{key:"_parseCityObject",value:function _parseCityObject(ctx,cityObject,objectId){var sceneModel=ctx.sceneModel;var data=ctx.data;if(ctx.loadMetadata){var metaObjectId=objectId;var metaObjectType=cityObject.type;var metaObjectName=metaObjectType+" : "+objectId;var parentMetaObjectId=cityObject.parents?cityObject.parents[0]:ctx.rootMetaObject.id;ctx.metadata.metaObjects.push({id:metaObjectId,name:metaObjectName,type:metaObjectType,parent:parentMetaObjectId});}ctx.stats.numMetaObjects++;if(!(cityObject.geometry&&cityObject.geometry.length>0)){return;}var meshIds=[];for(var _i410=0,len=cityObject.geometry.length;_i410<len;_i410++){var geometry=cityObject.geometry[_i410];var objectMaterial=void 0;var surfaceMaterials=void 0;var appearance=data.appearance;if(appearance){var materials=appearance.materials;if(materials){var geometryMaterial=geometry.material;if(geometryMaterial){var themeIds=Object.keys(geometryMaterial);if(themeIds.length>0){var themeId=themeIds[0];var theme=geometryMaterial[themeId];if(theme.value!==undefined){objectMaterial=materials[theme.value];}else{var values=theme.values;if(values){surfaceMaterials=[];for(var j=0,lenj=values.length;j<lenj;j++){var value=values[_i410];var surfaceMaterial=materials[value];surfaceMaterials.push(surfaceMaterial);}}}}}}}if(surfaceMaterials){this._parseGeometrySurfacesWithOwnMaterials(ctx,geometry,surfaceMaterials,meshIds);}else{this._parseGeometrySurfacesWithSharedMaterial(ctx,geometry,objectMaterial,meshIds);}}if(meshIds.length>0){sceneModel.createEntity({id:objectId,meshIds:meshIds,isObject:true});ctx.stats.numObjects++;}}},{key:"_parseGeometrySurfacesWithOwnMaterials",value:function _parseGeometrySurfacesWithOwnMaterials(ctx,geometry,surfaceMaterials,meshIds){var geomType=geometry.type;switch(geomType){case"MultiPoint":break;case"MultiLineString":break;case"MultiSurface":case"CompositeSurface":var surfaces=geometry.boundaries;this._parseSurfacesWithOwnMaterials(ctx,surfaceMaterials,surfaces,meshIds);break;case"Solid":var shells=geometry.boundaries;for(var j=0;j<shells.length;j++){var _surfaces=shells[j];this._parseSurfacesWithOwnMaterials(ctx,surfaceMaterials,_surfaces,meshIds);}break;case"MultiSolid":case"CompositeSolid":var solids=geometry.boundaries;for(var _j6=0;_j6<solids.length;_j6++){for(var k=0;k<solids[_j6].length;k++){var _surfaces2=solids[_j6][k];this._parseSurfacesWithOwnMaterials(ctx,surfaceMaterials,_surfaces2,meshIds);}}break;}}},{key:"_parseSurfacesWithOwnMaterials",value:function _parseSurfacesWithOwnMaterials(ctx,surfaceMaterials,surfaces,meshIds){var vertices=ctx.vertices;var sceneModel=ctx.sceneModel;for(var _i411=0;_i411<surfaces.length;_i411++){var surface=surfaces[_i411];var surfaceMaterial=surfaceMaterials[_i411]||{diffuseColor:[0.8,0.8,0.8],transparency:1.0};var face=[];var holes=[];var sharedIndices=[];var geometryCfg={positions:[],indices:[]};for(var j=0;j<surface.length;j++){if(face.length>0){holes.push(face.length);}var newFace=this._extractLocalIndices(ctx,surface[j],sharedIndices,geometryCfg);face.push.apply(face,_toConsumableArray(newFace));}if(face.length===3){// Triangle
31598
31607
  geometryCfg.indices.push(face[0]);geometryCfg.indices.push(face[1]);geometryCfg.indices.push(face[2]);}else if(face.length>3){// Polygon
31599
31608
  // Prepare to triangulate
31600
31609
  var pList=[];for(var k=0;k<face.length;k++){pList.push({x:vertices[sharedIndices[face[k]]][0],y:vertices[sharedIndices[face[k]]][1],z:vertices[sharedIndices[face[k]]][2]});}var normal=this._getNormalOfPositions(pList,math.vec3());// Convert to 2D
31601
31610
  var pv=[];for(var _k3=0;_k3<pList.length;_k3++){this._to2D(pList[_k3],normal,tempVec2a);pv.unshift(tempVec2a[0]);pv.unshift(tempVec2a[1]);}// Triangulate
31602
31611
  var tr=earcut(pv,holes,2);// Create triangles
31603
31612
  for(var _k4=0;_k4<tr.length;_k4+=3){geometryCfg.indices.unshift(face[tr[_k4]]);geometryCfg.indices.unshift(face[tr[_k4+1]]);geometryCfg.indices.unshift(face[tr[_k4+2]]);}}var meshId=""+ctx.nextId++;sceneModel.createMesh({id:meshId,primitive:"triangles",positions:geometryCfg.positions,indices:geometryCfg.indices,color:surfaceMaterial&&surfaceMaterial.diffuseColor?surfaceMaterial.diffuseColor:[0.8,0.8,0.8],opacity:surfaceMaterial&&surfaceMaterial.transparency!==undefined?1.0-surfaceMaterial.transparency:1.0});meshIds.push(meshId);ctx.stats.numGeometries++;ctx.stats.numVertices+=geometryCfg.positions.length/3;ctx.stats.numTriangles+=geometryCfg.indices.length/3;}}},{key:"_parseGeometrySurfacesWithSharedMaterial",value:function _parseGeometrySurfacesWithSharedMaterial(ctx,geometry,objectMaterial,meshIds){var sceneModel=ctx.sceneModel;var sharedIndices=[];var geometryCfg={positions:[],indices:[]};var geomType=geometry.type;switch(geomType){case"MultiPoint":break;case"MultiLineString":break;case"MultiSurface":case"CompositeSurface":var surfaces=geometry.boundaries;this._parseSurfacesWithSharedMaterial(ctx,surfaces,sharedIndices,geometryCfg);break;case"Solid":var shells=geometry.boundaries;for(var j=0;j<shells.length;j++){var _surfaces3=shells[j];this._parseSurfacesWithSharedMaterial(ctx,_surfaces3,sharedIndices,geometryCfg);}break;case"MultiSolid":case"CompositeSolid":var solids=geometry.boundaries;for(var _j7=0;_j7<solids.length;_j7++){for(var k=0;k<solids[_j7].length;k++){var _surfaces4=solids[_j7][k];this._parseSurfacesWithSharedMaterial(ctx,_surfaces4,sharedIndices,geometryCfg);}}break;}if(geometryCfg.positions.length>0&&geometryCfg.indices.length>0){var meshId=""+ctx.nextId++;sceneModel.createMesh({id:meshId,primitive:"triangles",positions:geometryCfg.positions,indices:geometryCfg.indices,color:objectMaterial&&objectMaterial.diffuseColor?objectMaterial.diffuseColor:[0.8,0.8,0.8],opacity:1.0//opacity: (objectMaterial && objectMaterial.transparency !== undefined) ? (1.0 - objectMaterial.transparency) : 1.0
31604
- });meshIds.push(meshId);ctx.stats.numGeometries++;ctx.stats.numVertices+=geometryCfg.positions.length/3;ctx.stats.numTriangles+=geometryCfg.indices.length/3;}}},{key:"_parseSurfacesWithSharedMaterial",value:function _parseSurfacesWithSharedMaterial(ctx,surfaces,sharedIndices,primitiveCfg){var vertices=ctx.vertices;for(var _i410=0;_i410<surfaces.length;_i410++){var boundary=[];var holes=[];for(var j=0;j<surfaces[_i410].length;j++){if(boundary.length>0){holes.push(boundary.length);}var newBoundary=this._extractLocalIndices(ctx,surfaces[_i410][j],sharedIndices,primitiveCfg);boundary.push.apply(boundary,_toConsumableArray(newBoundary));}if(boundary.length===3){// Triangle
31613
+ });meshIds.push(meshId);ctx.stats.numGeometries++;ctx.stats.numVertices+=geometryCfg.positions.length/3;ctx.stats.numTriangles+=geometryCfg.indices.length/3;}}},{key:"_parseSurfacesWithSharedMaterial",value:function _parseSurfacesWithSharedMaterial(ctx,surfaces,sharedIndices,primitiveCfg){var vertices=ctx.vertices;for(var _i412=0;_i412<surfaces.length;_i412++){var boundary=[];var holes=[];for(var j=0;j<surfaces[_i412].length;j++){if(boundary.length>0){holes.push(boundary.length);}var newBoundary=this._extractLocalIndices(ctx,surfaces[_i412][j],sharedIndices,primitiveCfg);boundary.push.apply(boundary,_toConsumableArray(newBoundary));}if(boundary.length===3){// Triangle
31605
31614
  primitiveCfg.indices.push(boundary[0]);primitiveCfg.indices.push(boundary[1]);primitiveCfg.indices.push(boundary[2]);}else if(boundary.length>3){// Polygon
31606
- var pList=[];for(var k=0;k<boundary.length;k++){pList.push({x:vertices[sharedIndices[boundary[k]]][0],y:vertices[sharedIndices[boundary[k]]][1],z:vertices[sharedIndices[boundary[k]]][2]});}var normal=this._getNormalOfPositions(pList,math.vec3());var pv=[];for(var _k5=0;_k5<pList.length;_k5++){this._to2D(pList[_k5],normal,tempVec2a);pv.unshift(tempVec2a[0]);pv.unshift(tempVec2a[1]);}var tr=earcut(pv,holes,2);for(var _k6=0;_k6<tr.length;_k6+=3){primitiveCfg.indices.unshift(boundary[tr[_k6]]);primitiveCfg.indices.unshift(boundary[tr[_k6+1]]);primitiveCfg.indices.unshift(boundary[tr[_k6+2]]);}}}}},{key:"_extractLocalIndices",value:function _extractLocalIndices(ctx,boundary,sharedIndices,geometryCfg){var vertices=ctx.vertices;var newBoundary=[];for(var _i411=0,len=boundary.length;_i411<len;_i411++){var index=boundary[_i411];if(sharedIndices.includes(index)){var vertexIndex=sharedIndices.indexOf(index);newBoundary.push(vertexIndex);}else{geometryCfg.positions.push(vertices[index][0]);geometryCfg.positions.push(vertices[index][1]);geometryCfg.positions.push(vertices[index][2]);newBoundary.push(sharedIndices.length);sharedIndices.push(index);}}return newBoundary;}},{key:"_getNormalOfPositions",value:function _getNormalOfPositions(positions,normal){for(var _i412=0;_i412<positions.length;_i412++){var nexti=_i412+1;if(nexti===positions.length){nexti=0;}normal[0]+=(positions[_i412].y-positions[nexti].y)*(positions[_i412].z+positions[nexti].z);normal[1]+=(positions[_i412].z-positions[nexti].z)*(positions[_i412].x+positions[nexti].x);normal[2]+=(positions[_i412].x-positions[nexti].x)*(positions[_i412].y+positions[nexti].y);}return math.normalizeVec3(normal);}},{key:"_to2D",value:function _to2D(_p,_n,re){var p=tempVec3a;var n=tempVec3b;var x3=tempVec3c;p[0]=_p.x;p[1]=_p.y;p[2]=_p.z;n[0]=_n.x;n[1]=_n.y;n[2]=_n.z;x3[0]=1.1;x3[1]=1.1;x3[2]=1.1;var dist=math.lenVec3(math.subVec3(x3,n));if(dist<0.01){x3[0]+=1.0;x3[1]+=2.0;x3[2]+=3.0;}var dot=math.dotVec3(x3,n);var tmp2=math.mulVec3Scalar(n,dot,math.vec3());x3[0]-=tmp2[0];x3[1]-=tmp2[1];x3[2]-=tmp2[2];math.normalizeVec3(x3);var y3=math.cross3Vec3(n,x3,math.vec3());var x=math.dotVec3(p,x3);var y=math.dotVec3(p,y3);re[0]=x;re[1]=y;}}]);return CityJSONLoaderPlugin;}(Plugin);/**
31615
+ var pList=[];for(var k=0;k<boundary.length;k++){pList.push({x:vertices[sharedIndices[boundary[k]]][0],y:vertices[sharedIndices[boundary[k]]][1],z:vertices[sharedIndices[boundary[k]]][2]});}var normal=this._getNormalOfPositions(pList,math.vec3());var pv=[];for(var _k5=0;_k5<pList.length;_k5++){this._to2D(pList[_k5],normal,tempVec2a);pv.unshift(tempVec2a[0]);pv.unshift(tempVec2a[1]);}var tr=earcut(pv,holes,2);for(var _k6=0;_k6<tr.length;_k6+=3){primitiveCfg.indices.unshift(boundary[tr[_k6]]);primitiveCfg.indices.unshift(boundary[tr[_k6+1]]);primitiveCfg.indices.unshift(boundary[tr[_k6+2]]);}}}}},{key:"_extractLocalIndices",value:function _extractLocalIndices(ctx,boundary,sharedIndices,geometryCfg){var vertices=ctx.vertices;var newBoundary=[];for(var _i413=0,len=boundary.length;_i413<len;_i413++){var index=boundary[_i413];if(sharedIndices.includes(index)){var vertexIndex=sharedIndices.indexOf(index);newBoundary.push(vertexIndex);}else{geometryCfg.positions.push(vertices[index][0]);geometryCfg.positions.push(vertices[index][1]);geometryCfg.positions.push(vertices[index][2]);newBoundary.push(sharedIndices.length);sharedIndices.push(index);}}return newBoundary;}},{key:"_getNormalOfPositions",value:function _getNormalOfPositions(positions,normal){for(var _i414=0;_i414<positions.length;_i414++){var nexti=_i414+1;if(nexti===positions.length){nexti=0;}normal[0]+=(positions[_i414].y-positions[nexti].y)*(positions[_i414].z+positions[nexti].z);normal[1]+=(positions[_i414].z-positions[nexti].z)*(positions[_i414].x+positions[nexti].x);normal[2]+=(positions[_i414].x-positions[nexti].x)*(positions[_i414].y+positions[nexti].y);}return math.normalizeVec3(normal);}},{key:"_to2D",value:function _to2D(_p,_n,re){var p=tempVec3a;var n=tempVec3b;var x3=tempVec3c;p[0]=_p.x;p[1]=_p.y;p[2]=_p.z;n[0]=_n.x;n[1]=_n.y;n[2]=_n.z;x3[0]=1.1;x3[1]=1.1;x3[2]=1.1;var dist=math.lenVec3(math.subVec3(x3,n));if(dist<0.01){x3[0]+=1.0;x3[1]+=2.0;x3[2]+=3.0;}var dot=math.dotVec3(x3,n);var tmp2=math.mulVec3Scalar(n,dot,math.vec3());x3[0]-=tmp2[0];x3[1]-=tmp2[1];x3[2]-=tmp2[2];math.normalizeVec3(x3);var y3=math.cross3Vec3(n,x3,math.vec3());var x=math.dotVec3(p,x3);var y=math.dotVec3(p,y3);re[0]=x;re[1]=y;}}]);return CityJSONLoaderPlugin;}(Plugin);/**
31607
31616
  * Default data access strategy for {@link DotBIMLoaderPlugin}.
31608
31617
  *
31609
31618
  * This just loads assets using XMLHttpRequest.
@@ -31878,7 +31887,7 @@ var pList=[];for(var k=0;k<boundary.length;k++){pList.push({x:vertices[sharedInd
31878
31887
  * @returns {Entity} Entity representing the model, which will have {@link Entity#isModel} set ````true```` and will be registered by {@link Entity#id} in {@link Scene#models}
31879
31888
  */,set:function set(value){this._objectDefaults=value||IFCObjectDefaults;}},{key:"load",value:function load(){var _this206=this;var params=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};if(params.id&&this.viewer.scene.components[params.id]){this.error("Component with this ID already exists in viewer: "+params.id+" - will autogenerate this ID");delete params.id;}var sceneModel=new SceneModel(this.viewer.scene,utils.apply(params,{isModel:true,backfaces:params.backfaces,dtxEnabled:params.dtxEnabled,rotation:params.rotation,origin:params.origin}));var modelId=sceneModel.id;// In case ID was auto-generated
31880
31889
  if(!params.src&&!params.dotBIM){this.error("load() param expected: src or dotBIM");return sceneModel;// Return new empty model
31881
- }var objectDefaults=params.objectDefaults||this._objectDefaults||IFCObjectDefaults;var includeTypes;if(params.includeTypes){includeTypes={};for(var _i413=0,len=params.includeTypes.length;_i413<len;_i413++){includeTypes[params.includeTypes[_i413]]=true;}}var excludeTypes;if(params.excludeTypes){excludeTypes={};if(!includeTypes){includeTypes={};}for(var _i414=0,_len63=params.excludeTypes.length;_i414<_len63;_i414++){includeTypes[params.excludeTypes[_i414]]=true;}}var parseDotBIM=function parseDotBIM(ctx){var fileData=ctx.fileData;var sceneModel=ctx.sceneModel;var dbMeshLoaded={};var projectId=math.createUUID();var siteId=math.createUUID();var buildingId=math.createUUID();var buildingStoryId=math.createUUID();var metaModelData={metaObjects:[{id:projectId,name:"Project",type:"Project",parent:null},{id:siteId,name:"Site",type:"Site",parent:projectId},{id:buildingId,name:"Building",type:"Building",parent:siteId},{id:buildingStoryId,name:"BuildingStorey",type:"BuildingStorey",parent:buildingId}],propertySets:[]};var parseDBMesh=function parseDBMesh(dbMeshId,element){if(dbMeshLoaded[dbMeshId]){return;}var dbMesh=fileData.meshes.find(function(obj){return obj.mesh_id===element.mesh_id;});sceneModel.createGeometry({id:dbMeshId,primitive:"triangles",positions:dbMesh.coordinates,indices:dbMesh.indices});dbMeshLoaded[dbMeshId]=true;};var dbElements=fileData.elements;var _loop15=function _loop15(_i415,_len64){var element=dbElements[_i415];var elementType=element.type;if(excludeTypes&&excludeTypes[elementType]){return"continue";}if(includeTypes&&!includeTypes[elementType]){return"continue";}var info=element.info;var objectId=element.guid!==undefined?"".concat(element.guid):info!==undefined&&info.id!==undefined?info.id:_i415;var dbMeshId=element.mesh_id;var vector=element.vector;var rotation=element.rotation;var props=objectDefaults?objectDefaults[elementType]||objectDefaults["DEFAULT"]:null;var visible=true;var pickable=true;if(element.face_colors===undefined){parseDBMesh(dbMeshId,element);var meshId="".concat(objectId,"-mesh-").concat(dbMeshId);var _color14=element.color?[element.color.r/255.0,element.color.g/255.0,element.color.b/255.0]:[1,1,1];var _opacity7=element.color?element.color.a/255.0:1.0;if(props){if(props.visible===false){visible=false;}if(props.pickable===false){pickable=false;}if(props.colorize){_color14=props.colorize;}if(props.opacity!==undefined&&props.opacity!==null){_opacity7=props.opacity;}}sceneModel.createMesh({id:meshId,geometryId:dbMeshId,color:_color14,opacity:_opacity7,quaternion:rotation&&(rotation.qz!==0||rotation.qy!==0||rotation.qx!==0||rotation.qw!==1.0)?[rotation.qx,rotation.qy,rotation.qz,rotation.qw]:undefined,position:vector?[vector.x,vector.y,vector.z]:undefined});sceneModel.createEntity({id:objectId,meshIds:[meshId],visible:visible,pickable:pickable,isObject:true});}else{var faceColors=element.face_colors;var coloredTrianglesDictionary={};var currentTriangleIndicesCount=0;var dbMesh=fileData.meshes.find(function(obj){return obj.mesh_id===element.mesh_id;});for(var _i416=0,_len65=faceColors.length;_i416<_len65;_i416+=4){var faceColor=[faceColors[_i416],faceColors[_i416+1],faceColors[_i416+2],faceColors[_i416+3]];if(coloredTrianglesDictionary[faceColor]===undefined){coloredTrianglesDictionary[faceColor]=[];}var indexForPoint0=dbMesh.indices[currentTriangleIndicesCount];var x0=dbMesh.coordinates[indexForPoint0*3];var y0=dbMesh.coordinates[indexForPoint0*3+1];var z0=dbMesh.coordinates[indexForPoint0*3+2];var indexForPoint1=dbMesh.indices[currentTriangleIndicesCount+1];var x1=dbMesh.coordinates[indexForPoint1*3];var y1=dbMesh.coordinates[indexForPoint1*3+1];var z1=dbMesh.coordinates[indexForPoint1*3+2];var indexForPoint2=dbMesh.indices[currentTriangleIndicesCount+2];var x2=dbMesh.coordinates[indexForPoint2*3];var y2=dbMesh.coordinates[indexForPoint2*3+1];var z2=dbMesh.coordinates[indexForPoint2*3+2];coloredTrianglesDictionary[faceColor].push(x0,y0,z0,x1,y1,z1,x2,y2,z2);currentTriangleIndicesCount+=3;}var meshIds=[];for(var _i417=0,_Object$entries7=Object.entries(coloredTrianglesDictionary);_i417<_Object$entries7.length;_i417++){var _Object$entries7$_i=_slicedToArray(_Object$entries7[_i417],2),_faceColor=_Object$entries7$_i[0],trianglesCoordinates=_Object$entries7$_i[1];sceneModel.createGeometry({id:"".concat(dbMeshId,"-").concat(_faceColor),primitive:"triangles",positions:trianglesCoordinates,indices:_toConsumableArray(Array(trianglesCoordinates.length/3).keys())});var _meshId3="".concat(objectId,"-mesh-").concat(dbMeshId,"-").concat(_faceColor);var faceColorArray=_faceColor.split(',').map(Number);var _color15=[faceColorArray[0]/255.0,faceColorArray[1]/255.0,faceColorArray[2]/255.0];var _opacity8=faceColorArray[3]/255.0;if(props){if(props.visible===false){visible=false;}if(props.pickable===false){pickable=false;}if(props.colorize){_color15=props.colorize;}if(props.opacity!==undefined&&props.opacity!==null){_opacity8=props.opacity;}}sceneModel.createMesh({id:_meshId3,geometryId:"".concat(dbMeshId,"-").concat(_faceColor),color:_color15,opacity:_opacity8,quaternion:rotation&&(rotation.qz!==0||rotation.qy!==0||rotation.qx!==0||rotation.qw!==1.0)?[rotation.qx,rotation.qy,rotation.qz,rotation.qw]:undefined,position:vector?[vector.x,vector.y,vector.z]:undefined});meshIds.push(_meshId3);}sceneModel.createEntity({id:objectId,meshIds:meshIds,visible:visible,pickable:pickable,isObject:true});}var properties=[];for(var infoKey in info){properties.push({name:infoKey,value:info[infoKey]});}metaModelData.propertySets.push({id:objectId,name:"Properties",properties:properties});metaModelData.metaObjects.push({id:objectId,name:info&&info.Name&&info.Name!=="None"?info.Name:"".concat(element.type," ").concat(objectId),type:element.type,parent:buildingStoryId,propertySetIds:[objectId]});};for(var _i415=0,_len64=dbElements.length;_i415<_len64;_i415++){var _ret4=_loop15(_i415,_len64);if(_ret4==="continue")continue;}sceneModel.finalize();_this206.viewer.metaScene.createMetaModel(modelId,metaModelData);sceneModel.scene.once("tick",function(){if(sceneModel.destroyed){return;}sceneModel.scene.fire("modelLoaded",sceneModel.id);// FIXME: Assumes listeners know order of these two events
31890
+ }var objectDefaults=params.objectDefaults||this._objectDefaults||IFCObjectDefaults;var includeTypes;if(params.includeTypes){includeTypes={};for(var _i415=0,len=params.includeTypes.length;_i415<len;_i415++){includeTypes[params.includeTypes[_i415]]=true;}}var excludeTypes;if(params.excludeTypes){excludeTypes={};if(!includeTypes){includeTypes={};}for(var _i416=0,_len63=params.excludeTypes.length;_i416<_len63;_i416++){includeTypes[params.excludeTypes[_i416]]=true;}}var parseDotBIM=function parseDotBIM(ctx){var fileData=ctx.fileData;var sceneModel=ctx.sceneModel;var dbMeshLoaded={};var projectId=math.createUUID();var siteId=math.createUUID();var buildingId=math.createUUID();var buildingStoryId=math.createUUID();var metaModelData={metaObjects:[{id:projectId,name:"Project",type:"Project",parent:null},{id:siteId,name:"Site",type:"Site",parent:projectId},{id:buildingId,name:"Building",type:"Building",parent:siteId},{id:buildingStoryId,name:"BuildingStorey",type:"BuildingStorey",parent:buildingId}],propertySets:[]};var parseDBMesh=function parseDBMesh(dbMeshId,element){if(dbMeshLoaded[dbMeshId]){return;}var dbMesh=fileData.meshes.find(function(obj){return obj.mesh_id===element.mesh_id;});sceneModel.createGeometry({id:dbMeshId,primitive:"triangles",positions:dbMesh.coordinates,indices:dbMesh.indices});dbMeshLoaded[dbMeshId]=true;};var dbElements=fileData.elements;var _loop15=function _loop15(_i417,_len64){var element=dbElements[_i417];var elementType=element.type;if(excludeTypes&&excludeTypes[elementType]){return"continue";}if(includeTypes&&!includeTypes[elementType]){return"continue";}var info=element.info;var objectId=element.guid!==undefined?"".concat(element.guid):info!==undefined&&info.id!==undefined?info.id:_i417;var dbMeshId=element.mesh_id;var vector=element.vector;var rotation=element.rotation;var props=objectDefaults?objectDefaults[elementType]||objectDefaults["DEFAULT"]:null;var visible=true;var pickable=true;if(element.face_colors===undefined){parseDBMesh(dbMeshId,element);var meshId="".concat(objectId,"-mesh-").concat(dbMeshId);var _color14=element.color?[element.color.r/255.0,element.color.g/255.0,element.color.b/255.0]:[1,1,1];var _opacity7=element.color?element.color.a/255.0:1.0;if(props){if(props.visible===false){visible=false;}if(props.pickable===false){pickable=false;}if(props.colorize){_color14=props.colorize;}if(props.opacity!==undefined&&props.opacity!==null){_opacity7=props.opacity;}}sceneModel.createMesh({id:meshId,geometryId:dbMeshId,color:_color14,opacity:_opacity7,quaternion:rotation&&(rotation.qz!==0||rotation.qy!==0||rotation.qx!==0||rotation.qw!==1.0)?[rotation.qx,rotation.qy,rotation.qz,rotation.qw]:undefined,position:vector?[vector.x,vector.y,vector.z]:undefined});sceneModel.createEntity({id:objectId,meshIds:[meshId],visible:visible,pickable:pickable,isObject:true});}else{var faceColors=element.face_colors;var coloredTrianglesDictionary={};var currentTriangleIndicesCount=0;var dbMesh=fileData.meshes.find(function(obj){return obj.mesh_id===element.mesh_id;});for(var _i418=0,_len65=faceColors.length;_i418<_len65;_i418+=4){var faceColor=[faceColors[_i418],faceColors[_i418+1],faceColors[_i418+2],faceColors[_i418+3]];if(coloredTrianglesDictionary[faceColor]===undefined){coloredTrianglesDictionary[faceColor]=[];}var indexForPoint0=dbMesh.indices[currentTriangleIndicesCount];var x0=dbMesh.coordinates[indexForPoint0*3];var y0=dbMesh.coordinates[indexForPoint0*3+1];var z0=dbMesh.coordinates[indexForPoint0*3+2];var indexForPoint1=dbMesh.indices[currentTriangleIndicesCount+1];var x1=dbMesh.coordinates[indexForPoint1*3];var y1=dbMesh.coordinates[indexForPoint1*3+1];var z1=dbMesh.coordinates[indexForPoint1*3+2];var indexForPoint2=dbMesh.indices[currentTriangleIndicesCount+2];var x2=dbMesh.coordinates[indexForPoint2*3];var y2=dbMesh.coordinates[indexForPoint2*3+1];var z2=dbMesh.coordinates[indexForPoint2*3+2];coloredTrianglesDictionary[faceColor].push(x0,y0,z0,x1,y1,z1,x2,y2,z2);currentTriangleIndicesCount+=3;}var meshIds=[];for(var _i419=0,_Object$entries7=Object.entries(coloredTrianglesDictionary);_i419<_Object$entries7.length;_i419++){var _Object$entries7$_i=_slicedToArray(_Object$entries7[_i419],2),_faceColor=_Object$entries7$_i[0],trianglesCoordinates=_Object$entries7$_i[1];sceneModel.createGeometry({id:"".concat(dbMeshId,"-").concat(_faceColor),primitive:"triangles",positions:trianglesCoordinates,indices:_toConsumableArray(Array(trianglesCoordinates.length/3).keys())});var _meshId3="".concat(objectId,"-mesh-").concat(dbMeshId,"-").concat(_faceColor);var faceColorArray=_faceColor.split(',').map(Number);var _color15=[faceColorArray[0]/255.0,faceColorArray[1]/255.0,faceColorArray[2]/255.0];var _opacity8=faceColorArray[3]/255.0;if(props){if(props.visible===false){visible=false;}if(props.pickable===false){pickable=false;}if(props.colorize){_color15=props.colorize;}if(props.opacity!==undefined&&props.opacity!==null){_opacity8=props.opacity;}}sceneModel.createMesh({id:_meshId3,geometryId:"".concat(dbMeshId,"-").concat(_faceColor),color:_color15,opacity:_opacity8,quaternion:rotation&&(rotation.qz!==0||rotation.qy!==0||rotation.qx!==0||rotation.qw!==1.0)?[rotation.qx,rotation.qy,rotation.qz,rotation.qw]:undefined,position:vector?[vector.x,vector.y,vector.z]:undefined});meshIds.push(_meshId3);}sceneModel.createEntity({id:objectId,meshIds:meshIds,visible:visible,pickable:pickable,isObject:true});}var properties=[];for(var infoKey in info){properties.push({name:infoKey,value:info[infoKey]});}metaModelData.propertySets.push({id:objectId,name:"Properties",properties:properties});metaModelData.metaObjects.push({id:objectId,name:info&&info.Name&&info.Name!=="None"?info.Name:"".concat(element.type," ").concat(objectId),type:element.type,parent:buildingStoryId,propertySetIds:[objectId]});};for(var _i417=0,_len64=dbElements.length;_i417<_len64;_i417++){var _ret4=_loop15(_i417,_len64);if(_ret4==="continue")continue;}sceneModel.finalize();_this206.viewer.metaScene.createMetaModel(modelId,metaModelData);sceneModel.scene.once("tick",function(){if(sceneModel.destroyed){return;}sceneModel.scene.fire("modelLoaded",sceneModel.id);// FIXME: Assumes listeners know order of these two events
31882
31891
  sceneModel.fire("loaded",true,false);// Don't forget the event, for late subscribers
31883
31892
  });};if(params.src){var src=params.src;this.viewer.scene.canvas.spinner.processes++;this._dataSource.getDotBIM(src,function(fileData){// OK
31884
31893
  var ctx={fileData:fileData,sceneModel:sceneModel,nextId:0,error:function error(errMsg){}};parseDotBIM(ctx);_this206.viewer.scene.canvas.spinner.processes--;},function(err){_this206.viewer.scene.canvas.spinner.processes--;_this206.error(err);});}else if(params.dotBIM){var ctx={fileData:params.dotBIM,sceneModel:sceneModel,nextId:0,error:function error(errMsg){}};parseDotBIM(ctx);}sceneModel.once("destroyed",function(){_this206.viewer.metaScene.destroyMetaModel(modelId);});return sceneModel;}/**
@@ -31901,13 +31910,13 @@ marker2.update(point2WorldPos);marker1.destroy();marker2.destroy();updatePointer
31901
31910
  var pos=[];var ind=[];var addPlane=function addPlane(isCeiling){var baseIdx=pos.length;var _iterator62=_createForOfIteratorHelper(baseVertices),_step62;try{for(_iterator62.s();!(_step62=_iterator62.n()).done;){var c=_step62.value;pos.push([c[0],altitude+(isCeiling?height:0),c[1]]);}}catch(err){_iterator62.e(err);}finally{_iterator62.f();}var _iterator63=_createForOfIteratorHelper(baseTriangles),_step63;try{for(_iterator63.s();!(_step63=_iterator63.n()).done;){var t=_step63.value;ind.push.apply(ind,_toConsumableArray((isCeiling?t:t.slice(0).reverse()).map(function(i){return i+baseIdx;})));}}catch(err){_iterator63.e(err);}finally{_iterator63.f();}};addPlane(false);// floor
31902
31911
  addPlane(true);// ceiling
31903
31912
  // sides
31904
- var _loop16=function _loop16(_i418){var a=baseVertices[_i418];var b=baseVertices[(baseVertices.length+_i418+(isCCW?1:-1))%baseVertices.length];var f=altitude;var c=altitude+height;var baseIdx=pos.length;pos.push([a[0],f,a[1]],[b[0],f,b[1]],[b[0],c,b[1]],[a[0],c,a[1]]);ind.push.apply(ind,_toConsumableArray([0,1,2,0,2,3].map(function(i){return i+baseIdx;})));};for(var _i418=0;_i418<baseVertices.length;++_i418){_loop16(_i418);}if(this._zoneMesh){this._zoneMesh.destroy();}var min=function min(idx){return Math.min.apply(Math,_toConsumableArray(pos.map(function(p){return p[idx];})));};var max=function max(idx){return Math.max.apply(Math,_toConsumableArray(pos.map(function(p){return p[idx];})));};var xmin=min(0);var ymin=min(1);var zmin=min(2);var xmax=max(0);var ymax=max(1);var zmax=max(2);this._center=math.vec3([(xmin+xmax)/2,(ymin+ymax)/2,(zmin+zmax)/2]);var positions=(_ref28=[]).concat.apply(_ref28,_toConsumableArray(pos.map(function(p){return math.subVec3(p,_this208._center,p);})));this._zoneMesh=new Mesh(scene,{origin:this._center,edges:this._edges,geometry:new ReadableGeometry(scene,{positions:positions,indices:ind,normals:math.buildNormals(positions,ind)}),material:new PhongMaterial(scene,{alpha:this._alpha,backfaces:true,diffuse:hex2rgb(this._color)}),visible:this._visible});this._zoneMesh.highlighted=this._highlighted;this._zoneMesh.zone=this;{var _u2=math.vec2();var v=math.vec2();var baseArea=0;var _iterator64=_createForOfIteratorHelper(baseTriangles),_step64;try{for(_iterator64.s();!(_step64=_iterator64.n()).done;){var t=_step64.value;var p0=baseVertices[t[0]];var p1=baseVertices[t[1]];var p2=baseVertices[t[2]];math.subVec2(p1,p0,_u2);math.subVec2(p2,p0,v);baseArea+=Math.abs(_u2[0]*v[1]-_u2[1]*v[0]);}}catch(err){_iterator64.e(err);}finally{_iterator64.f();}this._baseArea=baseArea/2;}this._metrics=null;}},{key:"baseArea",get:function get(){return this._baseArea;}},{key:"area",get:function get(){return this._getMetrics().area;}},{key:"volume",get:function get(){return this._getMetrics().volume;}},{key:"_getMetrics",value:function _getMetrics(){if(this._metrics===null){// Sum the volume of tetrahedrons formed by the origin and face triangles
31905
- var volume=0;var _area4=0;var geo=this._zoneMesh.geometry;var pts=[math.vec3(),math.vec3(),math.vec3()];var tmpVec3=math.vec3();for(var _i419=0;_i419<geo.indices.length;_i419+=3){for(var off=0;off<3;++off){var _p7=pts[off];var pIdx=3*geo.indices[_i419+off];for(var c=0;c<3;++c){_p7[c]=geo.positions[pIdx+c];}}volume+=math.dotVec3(pts[0],math.cross3Vec3(pts[1],pts[2],tmpVec3));math.subVec3(pts[1],pts[0],pts[1]);math.subVec3(pts[2],pts[0],pts[2]);_area4+=math.lenVec3(math.cross3Vec3(pts[1],pts[2],tmpVec3));}this._metrics={area:_area4/2,volume:volume/6};}return this._metrics;}},{key:"sectionedAverage",value:function sectionedAverage(sectionPlanes){var planeCoords=this._geometry.planeCoordinates.slice();var faces=[];{var h=this._geometry.height;var _a12=this._geometry.altitude;var c=_a12+Math.max(0,h);var _f2=_a12+Math.min(0,h);var addPlane=function addPlane(isCeiling){var face=planeCoords.map(function(p){return[p[0],isCeiling?c:_f2,p[1]];});faces.push(isCeiling?face:face.slice(0).reverse());};addPlane(true);// ceiling
31913
+ var _loop16=function _loop16(_i420){var a=baseVertices[_i420];var b=baseVertices[(baseVertices.length+_i420+(isCCW?1:-1))%baseVertices.length];var f=altitude;var c=altitude+height;var baseIdx=pos.length;pos.push([a[0],f,a[1]],[b[0],f,b[1]],[b[0],c,b[1]],[a[0],c,a[1]]);ind.push.apply(ind,_toConsumableArray([0,1,2,0,2,3].map(function(i){return i+baseIdx;})));};for(var _i420=0;_i420<baseVertices.length;++_i420){_loop16(_i420);}if(this._zoneMesh){this._zoneMesh.destroy();}var min=function min(idx){return Math.min.apply(Math,_toConsumableArray(pos.map(function(p){return p[idx];})));};var max=function max(idx){return Math.max.apply(Math,_toConsumableArray(pos.map(function(p){return p[idx];})));};var xmin=min(0);var ymin=min(1);var zmin=min(2);var xmax=max(0);var ymax=max(1);var zmax=max(2);this._center=math.vec3([(xmin+xmax)/2,(ymin+ymax)/2,(zmin+zmax)/2]);var positions=(_ref28=[]).concat.apply(_ref28,_toConsumableArray(pos.map(function(p){return math.subVec3(p,_this208._center,p);})));this._zoneMesh=new Mesh(scene,{origin:this._center,edges:this._edges,geometry:new ReadableGeometry(scene,{positions:positions,indices:ind,normals:math.buildNormals(positions,ind)}),material:new PhongMaterial(scene,{alpha:this._alpha,backfaces:true,diffuse:hex2rgb(this._color)}),visible:this._visible});this._zoneMesh.highlighted=this._highlighted;this._zoneMesh.zone=this;{var _u2=math.vec2();var v=math.vec2();var baseArea=0;var _iterator64=_createForOfIteratorHelper(baseTriangles),_step64;try{for(_iterator64.s();!(_step64=_iterator64.n()).done;){var t=_step64.value;var p0=baseVertices[t[0]];var p1=baseVertices[t[1]];var p2=baseVertices[t[2]];math.subVec2(p1,p0,_u2);math.subVec2(p2,p0,v);baseArea+=Math.abs(_u2[0]*v[1]-_u2[1]*v[0]);}}catch(err){_iterator64.e(err);}finally{_iterator64.f();}this._baseArea=baseArea/2;}this._metrics=null;}},{key:"baseArea",get:function get(){return this._baseArea;}},{key:"area",get:function get(){return this._getMetrics().area;}},{key:"volume",get:function get(){return this._getMetrics().volume;}},{key:"_getMetrics",value:function _getMetrics(){if(this._metrics===null){// Sum the volume of tetrahedrons formed by the origin and face triangles
31914
+ var volume=0;var _area4=0;var geo=this._zoneMesh.geometry;var pts=[math.vec3(),math.vec3(),math.vec3()];var tmpVec3=math.vec3();for(var _i421=0;_i421<geo.indices.length;_i421+=3){for(var off=0;off<3;++off){var _p7=pts[off];var pIdx=3*geo.indices[_i421+off];for(var c=0;c<3;++c){_p7[c]=geo.positions[pIdx+c];}}volume+=math.dotVec3(pts[0],math.cross3Vec3(pts[1],pts[2],tmpVec3));math.subVec3(pts[1],pts[0],pts[1]);math.subVec3(pts[2],pts[0],pts[2]);_area4+=math.lenVec3(math.cross3Vec3(pts[1],pts[2],tmpVec3));}this._metrics={area:_area4/2,volume:volume/6};}return this._metrics;}},{key:"sectionedAverage",value:function sectionedAverage(sectionPlanes){var planeCoords=this._geometry.planeCoordinates.slice();var faces=[];{var h=this._geometry.height;var _a12=this._geometry.altitude;var c=_a12+Math.max(0,h);var _f2=_a12+Math.min(0,h);var addPlane=function addPlane(isCeiling){var face=planeCoords.map(function(p){return[p[0],isCeiling?c:_f2,p[1]];});faces.push(isCeiling?face:face.slice(0).reverse());};addPlane(true);// ceiling
31906
31915
  addPlane(false);// floor
31907
31916
  // sides
31908
- var _p8=function _p8(idx,y){return[planeCoords[idx][0],y,planeCoords[idx][1]];};for(var _i420=0;_i420<planeCoords.length;++_i420){var _j8=(_i420+1)%planeCoords.length;faces.push([_p8(_i420,_f2),_p8(_j8,_f2),_p8(_j8,c),_p8(_i420,c)]);}}var _iterator65=_createForOfIteratorHelper(sectionPlanes),_step65;try{for(_iterator65.s();!(_step65=_iterator65.n()).done;){var s=_step65.value;var dir=s.dir;var dist=s.dist;var newFaces=[];var _iterator68=_createForOfIteratorHelper(faces),_step68;try{for(_iterator68.s();!(_step68=_iterator68.n()).done;){var face=_step68.value;var _EPSILON=1e-5;var COPLANAR=0;var FRONT=1;var BACK=2;var SPANNING=3;// Classify each point as well as the entire polygon into one of the above four classes.
31909
- var polygonType=0;var types=[];for(var _i421=0;_i421<face.length;_i421++){var t=math.dotVec3(dir,face[_i421])+dist;var type=t<-_EPSILON?BACK:t>_EPSILON?FRONT:COPLANAR;polygonType|=type;types.push(type);}// Put the polygon in the correct list, splitting it when necessary.
31910
- switch(polygonType){case COPLANAR:newFaces.push(face);break;case FRONT:newFaces.push(face);break;case BACK:break;case SPANNING:var _f4=[];for(var _i422=0;_i422<face.length;_i422++){var j=(_i422+1)%face.length;var ti=types[_i422];var tj=types[j];var vi=face[_i422];var vj=face[j];if(ti!==BACK){_f4.push(vi);}if((ti|tj)===SPANNING){var diff=math.vec3();math.subVec3(vj,vi,diff);var _t7=-(dist+math.dotVec3(dir,vi))/math.dotVec3(dir,diff);var v=[0,0,0];math.lerpVec3(_t7,0,1,vi,vj,v);_f4.push(v);}}if(_f4.length>=3){newFaces.push(_f4);}break;}}}catch(err){_iterator68.e(err);}finally{_iterator68.f();}faces=newFaces;}}catch(err){_iterator65.e(err);}finally{_iterator65.f();}if(faces.length===0){return null;}else{var avg=math.vec3([0,0,0]);var unique=new Set();var _iterator66=_createForOfIteratorHelper(faces),_step66;try{for(_iterator66.s();!(_step66=_iterator66.n()).done;){var _f3=_step66.value;var _iterator67=_createForOfIteratorHelper(_f3),_step67;try{for(_iterator67.s();!(_step67=_iterator67.n()).done;){var _p9=_step67.value;var id=_p9.map(function(x){return x.toFixed(3);}).join(":");if(!unique.has(id)){unique.add(id);math.addVec3(avg,_p9,avg);}}}catch(err){_iterator67.e(err);}finally{_iterator67.f();}}}catch(err){_iterator66.e(err);}finally{_iterator66.f();}math.mulVec3Scalar(avg,1/unique.size,avg);return avg;}}},{key:"center",get:function get(){return this._center;}},{key:"altitude",get:function get(){return this._geometry.altitude;},set:function set(value){this._geometry.altitude=value;this._rebuildMesh();}},{key:"height",get:function get(){return this._geometry.height;},set:function set(value){this._geometry.height=value;this._rebuildMesh();}},{key:"highlighted",get:function get(){return this._highlighted;},set:function set(value){this._highlighted=value;if(this._zoneMesh){this._zoneMesh.highlighted=value;}}},{key:"color",get:function get(){return this._color;},set:function set(value){this._color=value;if(this._zoneMesh){this._zoneMesh.material.diffuse=hex2rgb(this._color);}}},{key:"alpha",get:function get(){return this._alpha;},set:function set(value){this._alpha=value;if(this._zoneMesh){this._zoneMesh.material.alpha=this._alpha;}}},{key:"edges",get:function get(){return this._edges;},set:function set(edges){this._edges=edges;if(this._zoneMesh){this._zoneMesh.edges=this._edges;}}/**
31917
+ var _p8=function _p8(idx,y){return[planeCoords[idx][0],y,planeCoords[idx][1]];};for(var _i422=0;_i422<planeCoords.length;++_i422){var _j8=(_i422+1)%planeCoords.length;faces.push([_p8(_i422,_f2),_p8(_j8,_f2),_p8(_j8,c),_p8(_i422,c)]);}}var _iterator65=_createForOfIteratorHelper(sectionPlanes),_step65;try{for(_iterator65.s();!(_step65=_iterator65.n()).done;){var s=_step65.value;var dir=s.dir;var dist=s.dist;var newFaces=[];var _iterator68=_createForOfIteratorHelper(faces),_step68;try{for(_iterator68.s();!(_step68=_iterator68.n()).done;){var face=_step68.value;var _EPSILON=1e-5;var COPLANAR=0;var FRONT=1;var BACK=2;var SPANNING=3;// Classify each point as well as the entire polygon into one of the above four classes.
31918
+ var polygonType=0;var types=[];for(var _i423=0;_i423<face.length;_i423++){var t=math.dotVec3(dir,face[_i423])+dist;var type=t<-_EPSILON?BACK:t>_EPSILON?FRONT:COPLANAR;polygonType|=type;types.push(type);}// Put the polygon in the correct list, splitting it when necessary.
31919
+ switch(polygonType){case COPLANAR:newFaces.push(face);break;case FRONT:newFaces.push(face);break;case BACK:break;case SPANNING:var _f4=[];for(var _i424=0;_i424<face.length;_i424++){var j=(_i424+1)%face.length;var ti=types[_i424];var tj=types[j];var vi=face[_i424];var vj=face[j];if(ti!==BACK){_f4.push(vi);}if((ti|tj)===SPANNING){var diff=math.vec3();math.subVec3(vj,vi,diff);var _t7=-(dist+math.dotVec3(dir,vi))/math.dotVec3(dir,diff);var v=[0,0,0];math.lerpVec3(_t7,0,1,vi,vj,v);_f4.push(v);}}if(_f4.length>=3){newFaces.push(_f4);}break;}}}catch(err){_iterator68.e(err);}finally{_iterator68.f();}faces=newFaces;}}catch(err){_iterator65.e(err);}finally{_iterator65.f();}if(faces.length===0){return null;}else{var avg=math.vec3([0,0,0]);var unique=new Set();var _iterator66=_createForOfIteratorHelper(faces),_step66;try{for(_iterator66.s();!(_step66=_iterator66.n()).done;){var _f3=_step66.value;var _iterator67=_createForOfIteratorHelper(_f3),_step67;try{for(_iterator67.s();!(_step67=_iterator67.n()).done;){var _p9=_step67.value;var id=_p9.map(function(x){return x.toFixed(3);}).join(":");if(!unique.has(id)){unique.add(id);math.addVec3(avg,_p9,avg);}}}catch(err){_iterator67.e(err);}finally{_iterator67.f();}}}catch(err){_iterator66.e(err);}finally{_iterator66.f();}math.mulVec3Scalar(avg,1/unique.size,avg);return avg;}}},{key:"center",get:function get(){return this._center;}},{key:"altitude",get:function get(){return this._geometry.altitude;},set:function set(value){this._geometry.altitude=value;this._rebuildMesh();}},{key:"height",get:function get(){return this._geometry.height;},set:function set(value){this._geometry.height=value;this._rebuildMesh();}},{key:"highlighted",get:function get(){return this._highlighted;},set:function set(value){this._highlighted=value;if(this._zoneMesh){this._zoneMesh.highlighted=value;}}},{key:"color",get:function get(){return this._color;},set:function set(value){this._color=value;if(this._zoneMesh){this._zoneMesh.material.diffuse=hex2rgb(this._color);}}},{key:"alpha",get:function get(){return this._alpha;},set:function set(value){this._alpha=value;if(this._zoneMesh){this._zoneMesh.material.alpha=this._alpha;}}},{key:"edges",get:function get(){return this._edges;},set:function set(edges){this._edges=edges;if(this._zoneMesh){this._zoneMesh.edges=this._edges;}}/**
31911
31920
  * Sets whether this Zone is visible or not.
31912
31921
  *
31913
31922
  * @type {Boolean}
@@ -31995,7 +32004,7 @@ switch(polygonType){case COPLANAR:newFaces.push(face);break;case FRONT:newFaces.
31995
32004
  */},{key:"destroy",value:function destroy(){_get(_getPrototypeOf(ZonesPlugin.prototype),"destroy",this).call(this);}}]);return ZonesPlugin;}(Plugin);var startPolysurfaceZoneCreateUI=function startPolysurfaceZoneCreateUI(scene,zoneAltitude,zoneHeight,zoneColor,zoneAlpha,pointerLens,zonesPlugin,select3dPoint,onZoneCreated){var updatePointerLens=pointerLens?function(canvasPos){pointerLens.visible=!!canvasPos;if(canvasPos){pointerLens.canvasPos=canvasPos;}}:function(){};var deactivatePointSelection;var cleanups=[function(){return updatePointerLens(null);}];var basePolygon=basePolygon3D(scene,zoneColor,zoneAlpha);cleanups.push(function(){return basePolygon.destroy();});(function selectNextPoint(markers){var marker=marker3D(scene,zoneColor);var wire=markers.length>0&&wire3D(scene,zoneColor);var wireStart=wire&&markers[markers.length-1].getWorldPos();cleanups.push(function(){marker.destroy();wire&&wire.destroy();});var firstMarker=markers.length>0&&markers[0];var getSnappedFirst=function getSnappedFirst(canvasPos){var firstCanvasPos=firstMarker&&firstMarker.getCanvasPos();var snapToFirst=firstCanvasPos&&math.distVec2(firstCanvasPos,canvasPos)<10;return snapToFirst&&{canvasPos:firstCanvasPos,worldPos:firstMarker.getWorldPos()};};var lastSegmentIntersects=function(){var onSegment=function onSegment(p,q,r){return q[0]<=Math.max(p[0],r[0])&&q[0]>=Math.min(p[0],r[0])&&q[1]<=Math.max(p[1],r[1])&&q[1]>=Math.min(p[1],r[1]);};var orient=function orient(p,q,r){var val=(q[1]-p[1])*(r[0]-q[0])-(q[0]-p[0])*(r[1]-q[1]);// collinear
31996
32005
  // clockwise
31997
32006
  // counterclockwise
31998
- return val===0?0:val>0?1:2;};return function(pos2D,excludeFirstSegment){var a=pos2D[pos2D.length-2];var b=pos2D[pos2D.length-1];for(var _i423=excludeFirstSegment?1:0;_i423<pos2D.length-2-1;++_i423){var c=pos2D[_i423];var d=pos2D[_i423+1];var o1=orient(a,b,c);var o2=orient(a,b,d);var o3=orient(c,d,a);var o4=orient(c,d,b);if(o1!==o2&&o3!==o4||// General case
32007
+ return val===0?0:val>0?1:2;};return function(pos2D,excludeFirstSegment){var a=pos2D[pos2D.length-2];var b=pos2D[pos2D.length-1];for(var _i425=excludeFirstSegment?1:0;_i425<pos2D.length-2-1;++_i425){var c=pos2D[_i425];var d=pos2D[_i425+1];var o1=orient(a,b,c);var o2=orient(a,b,d);var o3=orient(c,d,a);var o4=orient(c,d,b);if(o1!==o2&&o3!==o4||// General case
31999
32008
  o1===0&&onSegment(a,c,b)||// a, b and c are collinear and c lies on segment ab
32000
32009
  o2===0&&onSegment(a,d,b)||// a, b and d are collinear and d lies on segment ab
32001
32010
  o3===0&&onSegment(c,a,d)||// c, d and a are collinear and a lies on segment cd