@xeokit/xeokit-sdk 2.6.87-renderers-refactor-v3 → 2.6.87-renderers-refactor-v4

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,7 +1,7 @@
1
1
  /**
2
- * xeokit-sdk v2.6.87-renderers-refactor-v3
3
- * Commit: eea8b0fafbb9aae708346dcff68ecada4774dbc5
4
- * Built: 2025-08-01T10:41:45.912Z
2
+ * xeokit-sdk v2.6.87-renderers-refactor-v4
3
+ * Commit: 5caed07165a5e87253766624958029a6267642df
4
+ * Built: 2025-08-04T16:35:27.323Z
5
5
  */
6
6
 
7
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);}/** @private */var Map$1=/*#__PURE__*/function(){function Map$1(items,baseId){_classCallCheck(this,Map$1);this.items=items||[];this._lastUniqueId=(baseId||0)+1;}/**
@@ -9009,7 +9009,8 @@ var uv="".concat(gl_FragCoord,".xy / ").concat(uSAOParams,".xy");// / viewportWH
9009
9009
  var blendCutoff="".concat(uSAOParams,".z");var blendFactor="".concat(uSAOParams,".w");var unPackFactors="(255. / 256.) / vec4(256. * 256. * 256., 256. * 256., 256., 1.)";return"(smoothstep(".concat(blendCutoff,", 1.0, dot(").concat(uOcclusionTexture(uv),", ").concat(unPackFactors,")) * ").concat(blendFactor,")");}};};var saoRenderers=function saoRenderers(useSao){var makeColorTextureProgram=function makeColorTextureProgram(vars,geo,useAlphaCutoff){return ColorTextureProgram(vars,geo,scene,createLights(vars),useSao&&createSAO(vars),useAlphaCutoff,scene.gammaOutput);};// If gammaOutput set, then it expects that all textures and colors need to be outputted in premultiplied gamma. Default is false.
9010
9010
  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.
9011
9011
  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
9012
- 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");}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
9012
+ 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)
9013
+ 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
9013
9014
  var backfaces=true;// See XCD-230
9014
9015
  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)?
9015
9016
  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 -----------------------------------
@@ -9019,7 +9020,7 @@ var renderer=this._renderers.depthRenderer;if(renderer&&this._numTransparentLaye
9019
9020
  },{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 -----------------------------------
9020
9021
  },{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 ----------------------------------------------------------------------------------------------------
9021
9022
  },{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
9022
- 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){Object.values(this._countsByFlag).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;/**
9023
+ 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;/**
9023
9024
  * Manages global configurations for all {@link Viewer}s.
9024
9025
  *
9025
9026
  * ## Example
@@ -11723,9 +11724,10 @@ cfg.metallic=Math.floor(((_cfg$metallic2=cfg.metallic)!==null&&_cfg$metallic2!==
11723
11724
  // cfg.textureSetId = cfg.textureSetId || DEFAULT_TEXTURE_SET_ID;
11724
11725
  if(textureSetId){cfg.textureSet=this._textureSets[textureSetId];if(!instancing&&!cfg.textureSet){this.error("[createMesh] Texture set not found: ".concat(textureSetId," - ensure that you create it first with createTextureSet()"));return false;}}}cfg.numPrimitives=this._getNumPrimitives(cfg);var mesh=new SceneModelMesh(this,cfg.id,cfg.color,cfg.opacity,cfg.transform,cfg.textureSet);var pickId=this.scene._renderer.getPickID(mesh);mesh.pickId=pickId;mesh.origin=math.vec3(cfg.origin);mesh.layer=cfg.type===DTX?this._getDTXLayer(cfg):this._getVBOLayer(cfg.type===VBO_INSTANCED,cfg);mesh.aabb=cfg.aabb;cfg.pickColor=new Uint8Array([pickId&0xFF,pickId>>8&0xFF,pickId>>16&0xFF,pickId>>24&0xFF]);// Quantized pick color
11725
11726
  cfg.solid=cfg.primitive==="solid";cfg.meshMatrix=cfg.transform?cfg.transform.worldMatrix:cfg.meshMatrix;mesh.portionId=mesh.layer.createPortion(mesh,cfg);mesh.numPrimitives=cfg.numPrimitives;this._meshes[cfg.id]=mesh;this._unusedMeshes[cfg.id]=mesh;this._meshList.push(mesh);return mesh;}},{key:"_getNumPrimitives",value:function _getNumPrimitives(cfg){var countIndices=0;var primitive=cfg.geometry?cfg.geometry.primitive:cfg.primitive;switch(primitive){case"triangles":case"solid":case"surface":switch(cfg.type){case DTX:for(var _i158=0,len=cfg.buckets.length;_i158<len;_i158++){countIndices+=cfg.buckets[_i158].indices.length;}break;case VBO_BATCHED:countIndices+=cfg.indices.length;break;case VBO_INSTANCED:countIndices+=cfg.geometry.indices.length;break;}return Math.round(countIndices/3);case"points":switch(cfg.type){case DTX:for(var _i159=0,_len18=cfg.buckets.length;_i159<_len18;_i159++){countIndices+=cfg.buckets[_i159].positionsCompressed.length;}break;case VBO_BATCHED:countIndices+=cfg.positions?cfg.positions.length:cfg.positionsCompressed.length;break;case VBO_INSTANCED:var geometry=cfg.geometry;countIndices+=geometry.positions?geometry.positions.length:geometry.positionsCompressed.length;break;}return Math.round(countIndices);case"lines":case"line-strip":switch(cfg.type){case DTX:for(var _i160=0,_len19=cfg.buckets.length;_i160<_len19;_i160++){countIndices+=cfg.buckets[_i160].indices.length;}break;case VBO_BATCHED:countIndices+=cfg.indices.length;break;case VBO_INSTANCED:countIndices+=cfg.geometry.indices.length;break;}return Math.round(countIndices/2);}return 0;}},{key:"_getDTXLayer",value:function _getDTXLayer(cfg){var origin=cfg.origin;var primitive=cfg.geometry?cfg.geometry.primitive:cfg.primitive;var layerId=".".concat(primitive,".").concat(Math.round(origin[0]),".").concat(Math.round(origin[1]),".").concat(Math.round(origin[2]));var dtxLayer=this._dtxLayers[layerId];if(dtxLayer){if(!dtxLayer.canCreatePortion(cfg)){// dtxLayer.finalize();
11726
- delete this._dtxLayers[layerId];dtxLayer=null;}else{return dtxLayer;}}switch(primitive){case"triangles":case"solid":case"surface":dtxLayer=new DTXLayer(this,primitive,origin);break;default:return;}this._dtxLayers[layerId]=dtxLayer;this.layerList.push(dtxLayer);this._layersToFinalize.push(dtxLayer);return dtxLayer;}},{key:"_getVBOLayer",value:function _getVBOLayer(instancing,cfg){var geometry=instancing&&cfg.geometry;var primitive=instancing?geometry.primitive:cfg.primitive;var origin=cfg.origin;var posDecode=!instancing&&(cfg.positionsDecodeMatrix||cfg.positionsDecodeBoundary);var positionsDecodeHash=posDecode?(JSON.stringify(posDecode).split("").reduce(function(hash,_char){return(hash<<5)-hash+_char.charCodeAt(0)|0;},0)>>>0).toString(16):"-";var textureSetId=cfg.textureSetId||"-";var geometryId=instancing?cfg.geometryId:"-";var layerId=(instancing?"instancing":"batching")+".".concat(Math.round(origin[0]),".").concat(Math.round(origin[1]),".").concat(Math.round(origin[2]),".").concat(primitive,".").concat(positionsDecodeHash,".").concat(textureSetId,".").concat(geometryId);if(!instancing&&layerId in this._vboLayers){var layer=this._vboLayers[layerId];var lenPositions=cfg.positionsCompressed?cfg.positionsCompressed.length:cfg.positions.length;if(!layer.canCreatePortion(lenPositions,primitive==="points"?0:cfg.indices.length)){layer.finalize();delete this._vboLayers[layerId];}}if(!(layerId in this._vboLayers)){var _layer=new VBOLayer(this,primitive,origin,_objectSpread({textureSet:cfg.textureSet},instancing?{geometry:geometry}:{maxGeometryBatchSize:this._maxGeometryBatchSize,positionsDecodeMatrix:cfg.positionsDecodeMatrix,// Can be undefined
11727
+ delete this._dtxLayers[layerId];dtxLayer=null;}else{return dtxLayer;}}switch(primitive){case"triangles":case"solid":case"surface":dtxLayer=new DTXLayer(this,primitive,origin);break;default:return;}this._dtxLayers[layerId]=dtxLayer;this.layerList.push(dtxLayer);this._layersToFinalize.push(dtxLayer);return dtxLayer;}},{key:"_getVBOLayer",value:function _getVBOLayer(instancing,cfg){var geometry=instancing&&cfg.geometry;var primitive=instancing?geometry.primitive:cfg.primitive;var origin=cfg.origin;var posDecode=!instancing&&(cfg.positionsDecodeMatrix||cfg.positionsDecodeBoundary);var positionsDecodeHash=posDecode?this._createHashStringFromMatrix(posDecode):"-";var textureSetId=cfg.textureSetId||"-";var geometryId=instancing?cfg.geometryId:"-";var layerId=(instancing?"instancing":"batching")+".".concat(Math.round(origin[0]),".").concat(Math.round(origin[1]),".").concat(Math.round(origin[2]),".").concat(primitive,".").concat(positionsDecodeHash,".").concat(textureSetId,".").concat(geometryId);if(!instancing&&layerId in this._vboLayers){var layer=this._vboLayers[layerId];var lenPositions=cfg.positionsCompressed?cfg.positionsCompressed.length:cfg.positions.length;if(!layer.canCreatePortion(lenPositions,primitive==="points"?0:cfg.indices.length)){layer.finalize();delete this._vboLayers[layerId];}}if(!(layerId in this._vboLayers)){var _layer=new VBOLayer(this,primitive,origin,_objectSpread({textureSet:cfg.textureSet},instancing?{geometry:geometry}:{maxGeometryBatchSize:this._maxGeometryBatchSize,positionsDecodeMatrix:cfg.positionsDecodeMatrix,// Can be undefined
11727
11728
  uvDecodeMatrix:cfg.uvDecodeMatrix// Can be undefined
11728
- }));this.layerList.push(_layer);this._layersToFinalize.push(_layer);this._vboLayers[layerId]=_layer;}return this._vboLayers[layerId];}/**
11729
+ }));this.layerList.push(_layer);this._layersToFinalize.push(_layer);this._vboLayers[layerId]=_layer;}return this._vboLayers[layerId];}},{key:"_createHashStringFromMatrix",value:function _createHashStringFromMatrix(matrix){var matrixString=matrix.join(";");var hash=0;for(var _i161=0;_i161<matrixString.length;_i161++){var _char=matrixString.charCodeAt(_i161);hash=(hash<<5)-hash+_char;hash|=0;// Convert to 32-bit integer
11730
+ }var hashString=(hash>>>0).toString(16);return hashString;}/**
11729
11731
  * Creates a {@link SceneModelEntity} within this SceneModel.
11730
11732
  *
11731
11733
  * * Gives the SceneModelEntity one or more {@link SceneModelMesh}es previously created with
@@ -11752,7 +11754,7 @@ uvDecodeMatrix:cfg.uvDecodeMatrix// Can be undefined
11752
11754
  * @param {Boolean} [cfg.selected=false] Indicates if the SceneModelEntity is initially selected. Selected appearance is configured by {@link SceneModel#selectedMaterial}.
11753
11755
  * @param {Boolean} [cfg.edges=false] Indicates if the SceneModelEntity's edges are initially emphasized. Edges appearance is configured by {@link SceneModel#edgeMaterial}.
11754
11756
  * @returns {SceneModelEntity} The new SceneModelEntity.
11755
- */},{key:"createEntity",value:function createEntity(cfg){if(cfg.id===undefined){cfg.id=math.createUUID();}else if(this.scene.components[cfg.id]){this.error("Scene already has a Component with this ID: ".concat(cfg.id," - will assign random ID"));cfg.id=math.createUUID();}if(cfg.meshIds===undefined){this.error("Config missing: meshIds");return null;}var notFalse=function notFalse(v){return v!==false;};var flags=0;flags|=this._visible&&notFalse(cfg.visible)&&ENTITY_FLAGS.VISIBLE;flags|=this._pickable&&notFalse(cfg.pickable)&&ENTITY_FLAGS.PICKABLE;flags|=this._culled&&notFalse(cfg.culled)&&ENTITY_FLAGS.CULLED;flags|=this._clippable&&notFalse(cfg.clippable)&&ENTITY_FLAGS.CLIPPABLE;flags|=this._collidable&&notFalse(cfg.collidable)&&ENTITY_FLAGS.COLLIDABLE;flags|=this._xrayed&&notFalse(cfg.xrayed)&&ENTITY_FLAGS.XRAYED;flags|=this._highlighted&&notFalse(cfg.highlighted)&&ENTITY_FLAGS.HIGHLIGHTED;flags|=this._selected&&notFalse(cfg.selected)&&ENTITY_FLAGS.SELECTED;flags|=this._edges&&notFalse(cfg.edges)&&ENTITY_FLAGS.EDGES;cfg.flags=flags;var meshes=[];for(var _i161=0,len=cfg.meshIds.length;_i161<len;_i161++){var meshId=cfg.meshIds[_i161];var mesh=this._meshes[meshId];// Trying to get already created mesh
11757
+ */},{key:"createEntity",value:function createEntity(cfg){if(cfg.id===undefined){cfg.id=math.createUUID();}else if(this.scene.components[cfg.id]){this.error("Scene already has a Component with this ID: ".concat(cfg.id," - will assign random ID"));cfg.id=math.createUUID();}if(cfg.meshIds===undefined){this.error("Config missing: meshIds");return null;}var notFalse=function notFalse(v){return v!==false;};var flags=0;flags|=this._visible&&notFalse(cfg.visible)&&ENTITY_FLAGS.VISIBLE;flags|=this._pickable&&notFalse(cfg.pickable)&&ENTITY_FLAGS.PICKABLE;flags|=this._culled&&notFalse(cfg.culled)&&ENTITY_FLAGS.CULLED;flags|=this._clippable&&notFalse(cfg.clippable)&&ENTITY_FLAGS.CLIPPABLE;flags|=this._collidable&&notFalse(cfg.collidable)&&ENTITY_FLAGS.COLLIDABLE;flags|=this._xrayed&&notFalse(cfg.xrayed)&&ENTITY_FLAGS.XRAYED;flags|=this._highlighted&&notFalse(cfg.highlighted)&&ENTITY_FLAGS.HIGHLIGHTED;flags|=this._selected&&notFalse(cfg.selected)&&ENTITY_FLAGS.SELECTED;flags|=this._edges&&notFalse(cfg.edges)&&ENTITY_FLAGS.EDGES;cfg.flags=flags;var meshes=[];for(var _i162=0,len=cfg.meshIds.length;_i162<len;_i162++){var meshId=cfg.meshIds[_i162];var mesh=this._meshes[meshId];// Trying to get already created mesh
11756
11758
  if(!mesh){// Checks if there is already created mesh for this meshId
11757
11759
  this.error("Mesh with this ID not found: \"".concat(meshId,"\" - ignoring this mesh"));// There is no such cfg
11758
11760
  continue;}if(mesh.parent){this.error("Mesh with ID \"".concat(meshId,"\" already belongs to object with ID \"").concat(mesh.parent.id,"\" - ignoring this mesh"));continue;}meshes.push(mesh);delete this._unusedMeshes[meshId];}var lodCullable=true;var entity=new SceneModelEntity(this,cfg.isObject,cfg.id,meshes,cfg.flags,lodCullable);// Internally sets SceneModelEntity#parent to this SceneModel
@@ -11760,20 +11762,20 @@ this._entityList.push(entity);this._entities[cfg.id]=entity;this._entitiesToFina
11760
11762
  * Pre-renders all meshes that have been added, even if the SceneModel has not bee finalized yet.
11761
11763
  * This is use for progressively showing the SceneModel while it is being loaded or constructed.
11762
11764
  * @returns {boolean}
11763
- */},{key:"preFinalize",value:function preFinalize(){if(this.destroyed){return false;}if(this._layersToFinalize.length===0){return false;}this._createDummyEntityForUnusedMeshes();for(var _i162=0,len=this._layersToFinalize.length;_i162<len;_i162++){var layer=this._layersToFinalize[_i162];layer.finalize();}this._vboLayers={};this._dtxLayers={};this._layersToFinalize=[];for(var _i163=0,_len20=this._entitiesToFinalize.length;_i163<_len20;_i163++){var entity=this._entitiesToFinalize[_i163];entity._finalize();}for(var _i164=0,_len21=this._entitiesToFinalize.length;_i164<_len21;_i164++){var _entity=this._entitiesToFinalize[_i164];_entity._finalize2();}this._entitiesToFinalize=[];this.scene._aabbDirty=true;this._viewMatrixDirty=true;this._matrixDirty=true;this._aabbDirty=true;this._setWorldMatrixDirty();this._sceneModelDirty();this.position=this._position;// Sort layers to reduce WebGL shader switching when rendering them
11764
- this.layerList.sort(function(a,b){if(a.sortId<b.sortId){return-1;}if(a.sortId>b.sortId){return 1;}return 0;});for(var _i165=0,_len22=this.layerList.length;_i165<_len22;_i165++){var _layer2=this.layerList[_i165];_layer2.layerIndex=_i165;}this.glRedraw();this._layersFinalized=true;}/**
11765
+ */},{key:"preFinalize",value:function preFinalize(){if(this.destroyed){return false;}if(this._layersToFinalize.length===0){return false;}this._createDummyEntityForUnusedMeshes();for(var _i163=0,len=this._layersToFinalize.length;_i163<len;_i163++){var layer=this._layersToFinalize[_i163];layer.finalize();}this._vboLayers={};this._dtxLayers={};this._layersToFinalize=[];for(var _i164=0,_len20=this._entitiesToFinalize.length;_i164<_len20;_i164++){var entity=this._entitiesToFinalize[_i164];entity._finalize();}for(var _i165=0,_len21=this._entitiesToFinalize.length;_i165<_len21;_i165++){var _entity=this._entitiesToFinalize[_i165];_entity._finalize2();}this._entitiesToFinalize=[];this.scene._aabbDirty=true;this._viewMatrixDirty=true;this._matrixDirty=true;this._aabbDirty=true;this._setWorldMatrixDirty();this._sceneModelDirty();this.position=this._position;// Sort layers to reduce WebGL shader switching when rendering them
11766
+ this.layerList.sort(function(a,b){if(a.sortId<b.sortId){return-1;}if(a.sortId>b.sortId){return 1;}return 0;});for(var _i166=0,_len22=this.layerList.length;_i166<_len22;_i166++){var _layer2=this.layerList[_i166];_layer2.layerIndex=_i166;}this.glRedraw();this._layersFinalized=true;}/**
11765
11767
  * Finalizes this SceneModel.
11766
11768
  *
11767
11769
  * Once finalized, you can't add anything more to this SceneModel.
11768
11770
  */},{key:"finalize",value:function finalize(){if(this.destroyed){return;}this.preFinalize();this._geometries={};this._dtxBuckets={};this._textures={};this._textureSets={};}/** @private */},{key:"stateSortCompare",value:function stateSortCompare(drawable1,drawable2){}/** @private */},{key:"rebuildRenderFlags",value:function rebuildRenderFlags(){this.renderFlags.reset();this._updateRenderFlagsVisibleLayers();if(this.renderFlags.numLayers>0&&this.renderFlags.numVisibleLayers===0){this.renderFlags.culled=true;return;}this._updateRenderFlags();}/**
11769
11771
  * @private
11770
- */},{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 _i166=0;_i166<numSectionPlanes;_i166++){var sectionPlane=sectionPlanes[_i166];if(!sectionPlane.active){renderFlags.sectionPlanesActivePerLayer[baseIndex+_i166]=false;}else{renderFlags.sectionPlanesActivePerLayer[baseIndex+_i166]=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 ---------------------------------------------------------------------------------------
11772
+ */},{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 _i167=0;_i167<numSectionPlanes;_i167++){var sectionPlane=sectionPlanes[_i167];if(!sectionPlane.active){renderFlags.sectionPlanesActivePerLayer[baseIndex+_i167]=false;}else{renderFlags.sectionPlanesActivePerLayer[baseIndex+_i167]=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 ---------------------------------------------------------------------------------------
11771
11773
  /**
11772
11774
  * @private
11773
- */},{key:"_withEachVisibleLayer",value:function _withEachVisibleLayer(testNumVisibleLayerPortions,cb){if(testNumVisibleLayerPortions&&this.numVisibleLayerPortions===0){return;}var renderFlags=this.renderFlags;for(var _i167=0,len=renderFlags.visibleLayers.length;_i167<len;_i167++){var layerIndex=renderFlags.visibleLayers[_i167];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
11775
+ */},{key:"_withEachVisibleLayer",value:function _withEachVisibleLayer(testNumVisibleLayerPortions,cb){if(testNumVisibleLayerPortions&&this.numVisibleLayerPortions===0){return;}var renderFlags=this.renderFlags;for(var _i168=0,len=renderFlags.visibleLayers.length;_i168<len;_i168++){var layerIndex=renderFlags.visibleLayers[_i168];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
11774
11776
  },{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);}/**
11775
11777
  * Destroys this SceneModel.
11776
- */},{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 _i168=0,len=this.layerList.length;_i168<len;_i168++){this.layerList[_i168].destroy();}this.layerList=[];for(var _i169=0,_len23=this._entityList.length;_i169<_len23;_i169++){this._entityList[_i169]._destroy();}this._layersToFinalize=[];// Object.entries(this._geometries).forEach(([id, geometry]) => {
11778
+ */},{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 _i169=0,len=this.layerList.length;_i169<len;_i169++){this.layerList[_i169].destroy();}this.layerList=[];for(var _i170=0,_len23=this._entityList.length;_i170<_len23;_i170++){this._entityList[_i170]._destroy();}this._layersToFinalize=[];// Object.entries(this._geometries).forEach(([id, geometry]) => {
11777
11779
  // geometry.destroy();
11778
11780
  // });
11779
11781
  this._geometries={};this._dtxBuckets={};this._textures={};this._textureSets={};this._meshes={};this._entities={};this.scene._aabbDirty=true;if(this._isModel){this.scene._deregisterModel(this);}_get(_getPrototypeOf(SceneModel.prototype),"destroy",this).call(this);}}]);return SceneModel;}(Component);/**
@@ -11865,7 +11867,7 @@ var _uniquifyPositions=uniquifyPositions({positionsCompressed:geometry.positions
11865
11867
  * @param {Number[]} [cfg.color=[1,1,1]] The color of this ````LineSet````. This is both emissive and diffuse.
11866
11868
  * @param {Boolean} [cfg.visible=true] Indicates whether or not this ````LineSet```` is visible.
11867
11869
  * @param {Number} [cfg.opacity=1.0] ````LineSet````'s initial opacity factor.
11868
- */function LineSet(owner){var _this68;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,LineSet);_this68=_super29.call(this,owner,cfg);_this68._positions=cfg.positions||[];if(cfg.indices){_this68._indices=cfg.indices;}else{_this68._indices=[];for(var _i170=0,len=_this68._positions.length/3-1;_i170<len;_i170+=2){_this68._indices.push(_i170);_this68._indices.push(_i170+1);}}_this68._color=cfg.color||[1,1,1];_this68._opacity=cfg.opacity||1.0;_this68._sceneModel=new SceneModel(_assertThisInitialized(_this68),{isModel:false// Don't register in Scene.models
11870
+ */function LineSet(owner){var _this68;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,LineSet);_this68=_super29.call(this,owner,cfg);_this68._positions=cfg.positions||[];if(cfg.indices){_this68._indices=cfg.indices;}else{_this68._indices=[];for(var _i171=0,len=_this68._positions.length/3-1;_i171<len;_i171+=2){_this68._indices.push(_i171);_this68._indices.push(_i171+1);}}_this68._color=cfg.color||[1,1,1];_this68._opacity=cfg.opacity||1.0;_this68._sceneModel=new SceneModel(_assertThisInitialized(_this68),{isModel:false// Don't register in Scene.models
11869
11871
  });_this68._sceneModel.createMesh({id:"linesMesh",primitive:"lines",positions:_this68._positions,indices:_this68._indices,color:_this68._color,opacity:_this68._opacity});_this68._sceneModel.createEntity({meshIds:["linesMesh"],visible:cfg.visible,clippable:cfg.clippable,collidable:cfg.collidable});_this68._sceneModel.finalize();_this68.scene._lineSetCreated(_assertThisInitialized(_this68));return _this68;}/**
11870
11872
  * Sets if this ````LineSet```` is visible.
11871
11873
  *
@@ -12021,7 +12023,7 @@ this.scene._lineSetDestroyed(this);}}]);return LineSet;}(Component);/**
12021
12023
  */,set:function set(intensity){this._state.intensity=intensity!==undefined?intensity:1.0;this.glRedraw();}},{key:"destroy",value:function destroy(){_get(_getPrototypeOf(AmbientLight.prototype),"destroy",this).call(this);this.scene._lightDestroyed(this);}}]);return AmbientLight;}(Light);/**
12022
12024
  * @desc Represents a WebGL render buffer.
12023
12025
  * @private
12024
- */var RenderBuffer=/*#__PURE__*/function(){function RenderBuffer(gl,colorFormats,hasDepthTexture){_classCallCheck(this,RenderBuffer);/** @type {WebGL2RenderingContext} */this.gl=gl;this.allocated=false;this.buffer=null;this.bound=false;this._colorFormats=colorFormats;this._hasDepthTexture=hasDepthTexture;}_createClass(RenderBuffer,[{key:"setSize",value:function setSize(size){this.size=size;}},{key:"bind",value:function bind(){var width=this.size[0];var height=this.size[1];if(this.buffer&&(this.buffer.width!==width||this.buffer.height!==height)){this.buffer.cleanup();this.buffer=null;}if(!this.buffer){this._allocateBuffer(width,height);this.bound=false;}if(!this.bound){var gl=this.gl;gl.bindFramebuffer(gl.FRAMEBUFFER,this.buffer.framebuf);this.bound=true;}}},{key:"_allocateBuffer",value:function _allocateBuffer(width,height){var internalformats=this._colorFormats||[];var gl=this.gl;var createTexture=function createTexture(){var tex=gl.createTexture();gl.bindTexture(gl.TEXTURE_2D,tex);gl.texParameteri(gl.TEXTURE_2D,gl.TEXTURE_MIN_FILTER,gl.NEAREST);gl.texParameteri(gl.TEXTURE_2D,gl.TEXTURE_MAG_FILTER,gl.NEAREST);gl.texParameteri(gl.TEXTURE_2D,gl.TEXTURE_WRAP_S,gl.CLAMP_TO_EDGE);gl.texParameteri(gl.TEXTURE_2D,gl.TEXTURE_WRAP_T,gl.CLAMP_TO_EDGE);return tex;};var colorTextures=(internalformats.length>0?internalformats:[null]).map(function(internalformat){var tex=createTexture();if(internalformat){gl.texStorage2D(gl.TEXTURE_2D,1,internalformat,width,height);}else{gl.texImage2D(gl.TEXTURE_2D,0,gl.RGBA,width,height,0,gl.RGBA,gl.UNSIGNED_BYTE,null);}return tex;});var renderbuf=gl.createRenderbuffer();gl.bindRenderbuffer(gl.RENDERBUFFER,renderbuf);gl.renderbufferStorage(gl.RENDERBUFFER,gl.DEPTH_COMPONENT32F,width,height);var framebuf=gl.createFramebuffer();gl.bindFramebuffer(gl.FRAMEBUFFER,framebuf);for(var _i171=0;_i171<colorTextures.length;_i171++){gl.framebufferTexture2D(gl.FRAMEBUFFER,gl.COLOR_ATTACHMENT0+_i171,gl.TEXTURE_2D,colorTextures[_i171],0);}if(internalformats.length>0){gl.drawBuffers(colorTextures.map(function(_,i){return gl.COLOR_ATTACHMENT0+i;}));}var depthTexture=this._hasDepthTexture&&createTexture();if(depthTexture){gl.texImage2D(gl.TEXTURE_2D,0,gl.DEPTH_COMPONENT32F,width,height,0,gl.DEPTH_COMPONENT,gl.FLOAT,null);gl.framebufferTexture2D(gl.FRAMEBUFFER,gl.DEPTH_ATTACHMENT,gl.TEXTURE_2D,depthTexture,0);}else{gl.framebufferRenderbuffer(gl.FRAMEBUFFER,gl.DEPTH_ATTACHMENT,gl.RENDERBUFFER,renderbuf);}gl.bindTexture(gl.TEXTURE_2D,null);gl.bindRenderbuffer(gl.RENDERBUFFER,null);gl.bindFramebuffer(gl.FRAMEBUFFER,null);// Verify framebuffer is OK
12026
+ */var RenderBuffer=/*#__PURE__*/function(){function RenderBuffer(gl,colorFormats,hasDepthTexture){_classCallCheck(this,RenderBuffer);/** @type {WebGL2RenderingContext} */this.gl=gl;this.allocated=false;this.buffer=null;this.bound=false;this._colorFormats=colorFormats;this._hasDepthTexture=hasDepthTexture;}_createClass(RenderBuffer,[{key:"setSize",value:function setSize(size){this.size=size;}},{key:"bind",value:function bind(){var width=this.size[0];var height=this.size[1];if(this.buffer&&(this.buffer.width!==width||this.buffer.height!==height)){this.buffer.cleanup();this.buffer=null;}if(!this.buffer){this._allocateBuffer(width,height);this.bound=false;}if(!this.bound){var gl=this.gl;gl.bindFramebuffer(gl.FRAMEBUFFER,this.buffer.framebuf);this.bound=true;}}},{key:"_allocateBuffer",value:function _allocateBuffer(width,height){var internalformats=this._colorFormats||[];var gl=this.gl;var createTexture=function createTexture(){var tex=gl.createTexture();gl.bindTexture(gl.TEXTURE_2D,tex);gl.texParameteri(gl.TEXTURE_2D,gl.TEXTURE_MIN_FILTER,gl.NEAREST);gl.texParameteri(gl.TEXTURE_2D,gl.TEXTURE_MAG_FILTER,gl.NEAREST);gl.texParameteri(gl.TEXTURE_2D,gl.TEXTURE_WRAP_S,gl.CLAMP_TO_EDGE);gl.texParameteri(gl.TEXTURE_2D,gl.TEXTURE_WRAP_T,gl.CLAMP_TO_EDGE);return tex;};var colorTextures=(internalformats.length>0?internalformats:[null]).map(function(internalformat){var tex=createTexture();if(internalformat){gl.texStorage2D(gl.TEXTURE_2D,1,internalformat,width,height);}else{gl.texImage2D(gl.TEXTURE_2D,0,gl.RGBA,width,height,0,gl.RGBA,gl.UNSIGNED_BYTE,null);}return tex;});var renderbuf=gl.createRenderbuffer();gl.bindRenderbuffer(gl.RENDERBUFFER,renderbuf);gl.renderbufferStorage(gl.RENDERBUFFER,gl.DEPTH_COMPONENT32F,width,height);var framebuf=gl.createFramebuffer();gl.bindFramebuffer(gl.FRAMEBUFFER,framebuf);for(var _i172=0;_i172<colorTextures.length;_i172++){gl.framebufferTexture2D(gl.FRAMEBUFFER,gl.COLOR_ATTACHMENT0+_i172,gl.TEXTURE_2D,colorTextures[_i172],0);}if(internalformats.length>0){gl.drawBuffers(colorTextures.map(function(_,i){return gl.COLOR_ATTACHMENT0+i;}));}var depthTexture=this._hasDepthTexture&&createTexture();if(depthTexture){gl.texImage2D(gl.TEXTURE_2D,0,gl.DEPTH_COMPONENT32F,width,height,0,gl.DEPTH_COMPONENT,gl.FLOAT,null);gl.framebufferTexture2D(gl.FRAMEBUFFER,gl.DEPTH_ATTACHMENT,gl.TEXTURE_2D,depthTexture,0);}else{gl.framebufferRenderbuffer(gl.FRAMEBUFFER,gl.DEPTH_ATTACHMENT,gl.RENDERBUFFER,renderbuf);}gl.bindTexture(gl.TEXTURE_2D,null);gl.bindRenderbuffer(gl.RENDERBUFFER,null);gl.bindFramebuffer(gl.FRAMEBUFFER,null);// Verify framebuffer is OK
12025
12027
  gl.bindFramebuffer(gl.FRAMEBUFFER,framebuf);if(!gl.isFramebuffer(framebuf)){throw"Invalid framebuffer";}gl.bindFramebuffer(gl.FRAMEBUFFER,null);var status=gl.checkFramebufferStatus(gl.FRAMEBUFFER);switch(status){case gl.FRAMEBUFFER_COMPLETE:break;case gl.FRAMEBUFFER_INCOMPLETE_ATTACHMENT:throw"Incomplete framebuffer: FRAMEBUFFER_INCOMPLETE_ATTACHMENT";case gl.FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT:throw"Incomplete framebuffer: FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT";case gl.FRAMEBUFFER_INCOMPLETE_DIMENSIONS:throw"Incomplete framebuffer: FRAMEBUFFER_INCOMPLETE_DIMENSIONS";case gl.FRAMEBUFFER_UNSUPPORTED:throw"Incomplete framebuffer: FRAMEBUFFER_UNSUPPORTED";default:throw"Incomplete framebuffer: "+status;}this.buffer={cleanup:function cleanup(){colorTextures.forEach(function(texture){return gl.deleteTexture(texture);});depthTexture&&gl.deleteTexture(depthTexture);gl.deleteFramebuffer(framebuf);gl.deleteRenderbuffer(renderbuf);},framebuf:framebuf,width:width,height:height};this.colorTextures=colorTextures.map(function(tex){return{bind:function bind(unit){gl.activeTexture(gl["TEXTURE"+unit]);gl.bindTexture(gl.TEXTURE_2D,tex);return true;}};});this.depthTexture=depthTexture&&{bind:function bind(unit){gl.activeTexture(gl["TEXTURE"+unit]);gl.bindTexture(gl.TEXTURE_2D,depthTexture);return true;}};}},{key:"read",value:function read(pickX,pickY){var glFormat=arguments.length>2&&arguments[2]!==undefined?arguments[2]:null;var glType=arguments.length>3&&arguments[3]!==undefined?arguments[3]:null;var arrayType=arguments.length>4&&arguments[4]!==undefined?arguments[4]:Uint8Array;var arrayMultiplier=arguments.length>5&&arguments[5]!==undefined?arguments[5]:4;var colorBufferIndex=arguments.length>6&&arguments[6]!==undefined?arguments[6]:0;var pix=new arrayType(arrayMultiplier);var gl=this.gl;gl.readBuffer(gl.COLOR_ATTACHMENT0+colorBufferIndex);gl.readPixels(pickX,this.buffer.height-pickY-1,1,1,glFormat||gl.RGBA,glType||gl.UNSIGNED_BYTE,pix,0);return pix;}},{key:"unbind",value:function unbind(){var gl=this.gl;gl.bindFramebuffer(gl.FRAMEBUFFER,null);this.bound=false;}},{key:"destroy",value:function destroy(){if(this.allocated){this.buffer.cleanup();this.allocated=false;this.buffer=null;this.bound=false;}this.colorTextures=null;this.depthTexture=null;}}]);return RenderBuffer;}();/**
12026
12028
  * @desc A directional light source that illuminates all {@link Mesh}es equally from a given direction.
12027
12029
  *
@@ -12374,7 +12376,7 @@ self._shadowRenderBuf.setSize([1024,1024]);}return self._shadowRenderBuf;}});_th
12374
12376
  * @returns {Boolean} ````true```` if this PointLight casts shadows.
12375
12377
  */function get(){return this._state.castsShadow;}/**
12376
12378
  * Destroys this PointLight.
12377
- */,set:function set(castsShadow){castsShadow=!!castsShadow;if(this._state.castsShadow===castsShadow){return;}this._state.castsShadow=castsShadow;this._shadowViewMatrixDirty=true;this.glRedraw();}},{key:"destroy",value:function destroy(){var camera=this.scene.camera;var canvas=this.scene.canvas;camera.off(this._onCameraViewMatrix);camera.off(this._onCameraProjMatrix);canvas.off(this._onCanvasBoundary);_get(_getPrototypeOf(PointLight.prototype),"destroy",this).call(this);this._state.destroy();if(this._shadowRenderBuf){this._shadowRenderBuf.destroy();}this.scene._lightDestroyed(this);this.glRedraw();}}]);return PointLight;}(Light);function ensureImageSizePowerOfTwo(image){if(!isPowerOfTwo(image.width)||!isPowerOfTwo(image.height)){var _canvas4=document.createElement("canvas");_canvas4.width=nextHighestPowerOfTwo(image.width);_canvas4.height=nextHighestPowerOfTwo(image.height);var ctx=_canvas4.getContext("2d");ctx.drawImage(image,0,0,image.width,image.height,0,0,_canvas4.width,_canvas4.height);image=_canvas4;}return image;}function isPowerOfTwo(x){return(x&x-1)===0;}function nextHighestPowerOfTwo(x){--x;for(var _i172=1;_i172<32;_i172<<=1){x=x|x>>_i172;}return x+1;}/**
12379
+ */,set:function set(castsShadow){castsShadow=!!castsShadow;if(this._state.castsShadow===castsShadow){return;}this._state.castsShadow=castsShadow;this._shadowViewMatrixDirty=true;this.glRedraw();}},{key:"destroy",value:function destroy(){var camera=this.scene.camera;var canvas=this.scene.canvas;camera.off(this._onCameraViewMatrix);camera.off(this._onCameraProjMatrix);canvas.off(this._onCanvasBoundary);_get(_getPrototypeOf(PointLight.prototype),"destroy",this).call(this);this._state.destroy();if(this._shadowRenderBuf){this._shadowRenderBuf.destroy();}this.scene._lightDestroyed(this);this.glRedraw();}}]);return PointLight;}(Light);function ensureImageSizePowerOfTwo(image){if(!isPowerOfTwo(image.width)||!isPowerOfTwo(image.height)){var _canvas4=document.createElement("canvas");_canvas4.width=nextHighestPowerOfTwo(image.width);_canvas4.height=nextHighestPowerOfTwo(image.height);var ctx=_canvas4.getContext("2d");ctx.drawImage(image,0,0,image.width,image.height,0,0,_canvas4.width,_canvas4.height);image=_canvas4;}return image;}function isPowerOfTwo(x){return(x&x-1)===0;}function nextHighestPowerOfTwo(x){--x;for(var _i173=1;_i173<32;_i173<<=1){x=x|x>>_i173;}return x+1;}/**
12378
12380
  * @desc A cube texture map.
12379
12381
  */var CubeTexture=/*#__PURE__*/function(_Component18){_inherits(CubeTexture,_Component18);var _super34=_createSuper(CubeTexture);/**
12380
12382
  * @constructor
@@ -12386,7 +12388,7 @@ self._shadowRenderBuf.setSize([1024,1024]);}return self._shadowRenderBuf;}});_th
12386
12388
  * @param {Number} [cfg.encoding=LinearEncoding] Encoding format. Supported values are {@link LinearEncoding} and {@link sRGBEncoding}.
12387
12389
  */function CubeTexture(owner){var _this72;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,CubeTexture);_this72=_super34.call(this,owner,cfg);var gl=_this72.scene.canvas.gl;_this72._state=new RenderState({texture:new Texture2D({gl:gl,target:gl.TEXTURE_CUBE_MAP}),flipY:_this72._checkFlipY(cfg.minFilter),encoding:_this72._checkEncoding(cfg.encoding),minFilter:LinearMipmapLinearFilter,magFilter:LinearFilter,wrapS:ClampToEdgeWrapping,wrapT:ClampToEdgeWrapping,mipmaps:true});_this72._src=cfg.src;_this72._images=[];_this72._loadSrc(cfg.src);stats.memory.textures++;return _this72;}_createClass(CubeTexture,[{key:"type",get:/**
12388
12390
  @private
12389
- */function get(){return"CubeTexture";}},{key:"_checkFlipY",value:function _checkFlipY(value){return!!value;}},{key:"_checkEncoding",value:function _checkEncoding(value){value=value||LinearEncoding;if(value!==LinearEncoding&&value!==sRGBEncoding){this.error("Unsupported value for 'encoding' - supported values are LinearEncoding and sRGBEncoding. Defaulting to LinearEncoding.");value=LinearEncoding;}return value;}},{key:"_loadSrc",value:function _loadSrc(src){var self=this;var gl=this.scene.canvas.gl;this._images=[];var loadFailed=false;var numLoaded=0;var _loop6=function _loop6(_i173){var image=new Image();image.onload=function(){var _image=image;var index=_i173;return function(){if(loadFailed){return;}_image=ensureImageSizePowerOfTwo(_image);self._images[index]=_image;numLoaded++;if(numLoaded===6){var texture=self._state.texture;if(!texture){texture=new Texture2D({gl:gl,target:gl.TEXTURE_CUBE_MAP});self._state.texture=texture;}texture.setImage(self._images,self._state);self.fire("loaded",self._src,false);self.glRedraw();}};}();image.onerror=function(){loadFailed=true;};image.src=src[_i173];};for(var _i173=0;_i173<src.length;_i173++){_loop6(_i173);}}/**
12391
+ */function get(){return"CubeTexture";}},{key:"_checkFlipY",value:function _checkFlipY(value){return!!value;}},{key:"_checkEncoding",value:function _checkEncoding(value){value=value||LinearEncoding;if(value!==LinearEncoding&&value!==sRGBEncoding){this.error("Unsupported value for 'encoding' - supported values are LinearEncoding and sRGBEncoding. Defaulting to LinearEncoding.");value=LinearEncoding;}return value;}},{key:"_loadSrc",value:function _loadSrc(src){var self=this;var gl=this.scene.canvas.gl;this._images=[];var loadFailed=false;var numLoaded=0;var _loop6=function _loop6(_i174){var image=new Image();image.onload=function(){var _image=image;var index=_i174;return function(){if(loadFailed){return;}_image=ensureImageSizePowerOfTwo(_image);self._images[index]=_image;numLoaded++;if(numLoaded===6){var texture=self._state.texture;if(!texture){texture=new Texture2D({gl:gl,target:gl.TEXTURE_CUBE_MAP});self._state.texture=texture;}texture.setImage(self._images,self._state);self.fire("loaded",self._src,false);self.glRedraw();}};}();image.onerror=function(){loadFailed=true;};image.src=src[_i174];};for(var _i174=0;_i174<src.length;_i174++){_loop6(_i174);}}/**
12390
12392
  * Destroys this CubeTexture
12391
12393
  *
12392
12394
  */},{key:"destroy",value:function destroy(){_get(_getPrototypeOf(CubeTexture.prototype),"destroy",this).call(this);if(this._state.texture){this._state.texture.destroy();}stats.memory.textures--;this._state.destroy();}}]);return CubeTexture;}(Component);/**
@@ -13003,14 +13005,14 @@ this._occluded=!visible;this._mesh.visible=this._visible&&!this._occluded;_get(_
13003
13005
  * @param {boolean} [mask.pickable] Saves {@link Entity#pickable} values when ````true````.
13004
13006
  * @param {boolean} [mask.colorize] Saves {@link Entity#colorize} values when ````true````.
13005
13007
  * @param {boolean} [mask.opacity] Saves {@link Entity#opacity} values when ````true````.
13006
- */_createClass(ModelMemento,[{key:"saveObjects",value:function saveObjects(scene,metaModel,mask){this.numObjects=0;this._mask=mask?utils.apply(mask,{}):null;var visible=!mask||mask.visible;var edges=!mask||mask.edges;var xrayed=!mask||mask.xrayed;var highlighted=!mask||mask.highlighted;var selected=!mask||mask.selected;var clippable=!mask||mask.clippable;var pickable=!mask||mask.pickable;var colorize=!mask||mask.colorize;var opacity=!mask||mask.opacity;var metaObjects=metaModel.metaObjects;var objects=scene.objects;for(var _i174=0,len=metaObjects.length;_i174<len;_i174++){var metaObject=metaObjects[_i174];var objectId=metaObject.id;var object=objects[objectId];if(!object){continue;}if(visible){this.objectsVisible[_i174]=object.visible;}if(edges){this.objectsEdges[_i174]=object.edges;}if(xrayed){this.objectsXrayed[_i174]=object.xrayed;}if(highlighted){this.objectsHighlighted[_i174]=object.highlighted;}if(selected){this.objectsSelected[_i174]=object.selected;}if(clippable){this.objectsClippable[_i174]=object.clippable;}if(pickable){this.objectsPickable[_i174]=object.pickable;}if(colorize){var objectColor=object.colorize;this.objectsColorize[_i174*3+0]=objectColor[0];this.objectsColorize[_i174*3+1]=objectColor[1];this.objectsColorize[_i174*3+2]=objectColor[2];}if(opacity){this.objectsOpacity[_i174]=object.opacity;}this.numObjects++;}}/**
13008
+ */_createClass(ModelMemento,[{key:"saveObjects",value:function saveObjects(scene,metaModel,mask){this.numObjects=0;this._mask=mask?utils.apply(mask,{}):null;var visible=!mask||mask.visible;var edges=!mask||mask.edges;var xrayed=!mask||mask.xrayed;var highlighted=!mask||mask.highlighted;var selected=!mask||mask.selected;var clippable=!mask||mask.clippable;var pickable=!mask||mask.pickable;var colorize=!mask||mask.colorize;var opacity=!mask||mask.opacity;var metaObjects=metaModel.metaObjects;var objects=scene.objects;for(var _i175=0,len=metaObjects.length;_i175<len;_i175++){var metaObject=metaObjects[_i175];var objectId=metaObject.id;var object=objects[objectId];if(!object){continue;}if(visible){this.objectsVisible[_i175]=object.visible;}if(edges){this.objectsEdges[_i175]=object.edges;}if(xrayed){this.objectsXrayed[_i175]=object.xrayed;}if(highlighted){this.objectsHighlighted[_i175]=object.highlighted;}if(selected){this.objectsSelected[_i175]=object.selected;}if(clippable){this.objectsClippable[_i175]=object.clippable;}if(pickable){this.objectsPickable[_i175]=object.pickable;}if(colorize){var objectColor=object.colorize;this.objectsColorize[_i175*3+0]=objectColor[0];this.objectsColorize[_i175*3+1]=objectColor[1];this.objectsColorize[_i175*3+2]=objectColor[2];}if(opacity){this.objectsOpacity[_i175]=object.opacity;}this.numObjects++;}}/**
13007
13009
  * Restores a {@link Scene}'s {@link Entity}'s to their state previously captured with {@link ModelMemento#saveObjects}.
13008
13010
  *
13009
13011
  * Assumes that the model has not been destroyed or modified since saving.
13010
13012
  *
13011
13013
  * @param {Scene} scene The scene that was given to {@link ModelMemento#saveObjects}.
13012
13014
  * @param {MetaModel} metaModel The metamodel that was given to {@link ModelMemento#saveObjects}.
13013
- */},{key:"restoreObjects",value:function restoreObjects(scene,metaModel){var mask=this._mask;var visible=!mask||mask.visible;var edges=!mask||mask.edges;var xrayed=!mask||mask.xrayed;var highlighted=!mask||mask.highlighted;var selected=!mask||mask.selected;var clippable=!mask||mask.clippable;var pickable=!mask||mask.pickable;var colorize=!mask||mask.colorize;var opacity=!mask||mask.opacity;var metaObjects=metaModel.metaObjects;var objects=scene.objects;for(var _i175=0,len=metaObjects.length;_i175<len;_i175++){var metaObject=metaObjects[_i175];var objectId=metaObject.id;var object=objects[objectId];if(!object){continue;}if(visible){object.visible=this.objectsVisible[_i175];}if(edges){object.edges=this.objectsEdges[_i175];}if(xrayed){object.xrayed=this.objectsXrayed[_i175];}if(highlighted){object.highlighted=this.objectsHighlighted[_i175];}if(selected){object.selected=this.objectsSelected[_i175];}if(clippable){object.clippable=this.objectsClippable[_i175];}if(pickable){object.pickable=this.objectsPickable[_i175];}if(colorize){color$3[0]=this.objectsColorize[_i175*3+0];color$3[1]=this.objectsColorize[_i175*3+1];color$3[2]=this.objectsColorize[_i175*3+2];object.colorize=color$3;}if(opacity){object.opacity=this.objectsOpacity[_i175];}}}}]);return ModelMemento;}();var color$2=math.vec3();/**
13015
+ */},{key:"restoreObjects",value:function restoreObjects(scene,metaModel){var mask=this._mask;var visible=!mask||mask.visible;var edges=!mask||mask.edges;var xrayed=!mask||mask.xrayed;var highlighted=!mask||mask.highlighted;var selected=!mask||mask.selected;var clippable=!mask||mask.clippable;var pickable=!mask||mask.pickable;var colorize=!mask||mask.colorize;var opacity=!mask||mask.opacity;var metaObjects=metaModel.metaObjects;var objects=scene.objects;for(var _i176=0,len=metaObjects.length;_i176<len;_i176++){var metaObject=metaObjects[_i176];var objectId=metaObject.id;var object=objects[objectId];if(!object){continue;}if(visible){object.visible=this.objectsVisible[_i176];}if(edges){object.edges=this.objectsEdges[_i176];}if(xrayed){object.xrayed=this.objectsXrayed[_i176];}if(highlighted){object.highlighted=this.objectsHighlighted[_i176];}if(selected){object.selected=this.objectsSelected[_i176];}if(clippable){object.clippable=this.objectsClippable[_i176];}if(pickable){object.pickable=this.objectsPickable[_i176];}if(colorize){color$3[0]=this.objectsColorize[_i176*3+0];color$3[1]=this.objectsColorize[_i176*3+1];color$3[2]=this.objectsColorize[_i176*3+2];object.colorize=color$3;}if(opacity){object.opacity=this.objectsOpacity[_i176];}}}}]);return ModelMemento;}();var color$2=math.vec3();/**
13014
13016
  * @desc Saves and restores a snapshot of the visual state of the {@link Entity}'s that represent objects within a {@link Scene}.
13015
13017
  *
13016
13018
  * * An Entity represents an object when {@link Entity#isObject} is ````true````.
@@ -13096,7 +13098,7 @@ this._occluded=!visible;this._mesh.visible=this._visible&&!this._occluded;_get(_
13096
13098
  * @param {boolean} [mask.pickable] Saves {@link Entity#pickable} values when ````true````.
13097
13099
  * @param {boolean} [mask.colorize] Saves {@link Entity#colorize} values when ````true````.
13098
13100
  * @param {boolean} [mask.opacity] Saves {@link Entity#opacity} values when ````true````.
13099
- */_createClass(ObjectsMemento,[{key:"saveObjects",value:function saveObjects(scene,mask){this.numObjects=0;this._mask=mask?utils.apply(mask,{}):null;var objects=scene.objects;var visible=!mask||mask.visible;var edges=!mask||mask.edges;var xrayed=!mask||mask.xrayed;var highlighted=!mask||mask.highlighted;var selected=!mask||mask.selected;var clippable=!mask||mask.clippable;var pickable=!mask||mask.pickable;var colorize=!mask||mask.colorize;var opacity=!mask||mask.opacity;for(var objectId in objects){if(objects.hasOwnProperty(objectId)){var object=objects[objectId];var _i176=this.numObjects;if(visible){this.objectsVisible[_i176]=object.visible;}if(edges){this.objectsEdges[_i176]=object.edges;}if(xrayed){this.objectsXrayed[_i176]=object.xrayed;}if(highlighted){this.objectsHighlighted[_i176]=object.highlighted;}if(selected){this.objectsSelected[_i176]=object.selected;}if(clippable){this.objectsClippable[_i176]=object.clippable;}if(pickable){this.objectsPickable[_i176]=object.pickable;}if(colorize){var objectColor=object.colorize;if(objectColor){this.objectsColorize[_i176*3+0]=objectColor[0];this.objectsColorize[_i176*3+1]=objectColor[1];this.objectsColorize[_i176*3+2]=objectColor[2];this.objectsHasColorize[_i176]=true;}else{this.objectsHasColorize[_i176]=false;}}if(opacity){this.objectsOpacity[_i176]=object.opacity;}this.numObjects++;}}}/**
13101
+ */_createClass(ObjectsMemento,[{key:"saveObjects",value:function saveObjects(scene,mask){this.numObjects=0;this._mask=mask?utils.apply(mask,{}):null;var objects=scene.objects;var visible=!mask||mask.visible;var edges=!mask||mask.edges;var xrayed=!mask||mask.xrayed;var highlighted=!mask||mask.highlighted;var selected=!mask||mask.selected;var clippable=!mask||mask.clippable;var pickable=!mask||mask.pickable;var colorize=!mask||mask.colorize;var opacity=!mask||mask.opacity;for(var objectId in objects){if(objects.hasOwnProperty(objectId)){var object=objects[objectId];var _i177=this.numObjects;if(visible){this.objectsVisible[_i177]=object.visible;}if(edges){this.objectsEdges[_i177]=object.edges;}if(xrayed){this.objectsXrayed[_i177]=object.xrayed;}if(highlighted){this.objectsHighlighted[_i177]=object.highlighted;}if(selected){this.objectsSelected[_i177]=object.selected;}if(clippable){this.objectsClippable[_i177]=object.clippable;}if(pickable){this.objectsPickable[_i177]=object.pickable;}if(colorize){var objectColor=object.colorize;if(objectColor){this.objectsColorize[_i177*3+0]=objectColor[0];this.objectsColorize[_i177*3+1]=objectColor[1];this.objectsColorize[_i177*3+2]=objectColor[2];this.objectsHasColorize[_i177]=true;}else{this.objectsHasColorize[_i177]=false;}}if(opacity){this.objectsOpacity[_i177]=object.opacity;}this.numObjects++;}}}/**
13100
13102
  * Restores a {@link Scene}'s {@link Entity}'s to their state previously captured with {@link ObjectsMemento#saveObjects}.
13101
13103
  * @param {Scene} scene The scene.
13102
13104
  */},{key:"restoreObjects",value:function restoreObjects(scene){var mask=this._mask;var visible=!mask||mask.visible;var edges=!mask||mask.edges;var xrayed=!mask||mask.xrayed;var highlighted=!mask||mask.highlighted;var selected=!mask||mask.selected;var clippable=!mask||mask.clippable;var pickable=!mask||mask.pickable;var colorize=!mask||mask.colorize;var opacity=!mask||mask.opacity;var i=0;var objects=scene.objects;for(var objectId in objects){if(objects.hasOwnProperty(objectId)){var object=objects[objectId];if(visible){object.visible=this.objectsVisible[i];}if(edges){object.edges=this.objectsEdges[i];}if(xrayed){object.xrayed=this.objectsXrayed[i];}if(highlighted){object.highlighted=this.objectsHighlighted[i];}if(selected){object.selected=this.objectsSelected[i];}if(clippable){object.clippable=this.objectsClippable[i];}if(pickable){object.pickable=this.objectsPickable[i];}if(colorize){if(this.objectsHasColorize[i]){color$2[0]=this.objectsColorize[i*3+0];color$2[1]=this.objectsColorize[i*3+1];color$2[2]=this.objectsColorize[i*3+2];object.colorize=color$2;}else{object.colorize=null;}}if(opacity){object.opacity=this.objectsOpacity[i];}i++;}}}}]);return ObjectsMemento;}();/**
@@ -14044,7 +14046,7 @@ self.boundary[0]=self.canvas.offsetLeft;self.boundary[1]=self.canvas.offsetTop;s
14044
14046
  * Initialises the WebGL context
14045
14047
  * @private
14046
14048
  */},{key:"_initWebGL",value:function _initWebGL(){// Default context attribute values
14047
- if(!this.gl){for(var _i177=0;!this.gl&&_i177<WEBGL_CONTEXT_NAMES.length;_i177++){try{this.gl=this.canvas.getContext(WEBGL_CONTEXT_NAMES[_i177],this.contextAttr);}catch(e){// Try with next context name
14049
+ if(!this.gl){for(var _i178=0;!this.gl&&_i178<WEBGL_CONTEXT_NAMES.length;_i178++){try{this.gl=this.canvas.getContext(WEBGL_CONTEXT_NAMES[_i178],this.contextAttr);}catch(e){// Try with next context name
14048
14050
  }}}if(!this.gl){this.error('Failed to get a WebGL context');/**
14049
14051
  * Fired whenever the canvas failed to get a WebGL context, which probably means that WebGL
14050
14052
  * is either unsupported or has been disabled.
@@ -14226,8 +14228,8 @@ this.positionsBuf=null;this.lenPositionsBuf=0;this.indicesBuf=null;this.sectionP
14226
14228
  this.lenOcclusionTestList=0;this.pixels=[];this.markerListDirty=false;this.positionsDirty=true;this.occlusionTestListDirty=false;}_createClass(OcclusionLayer,[{key:"addMarker",value:function addMarker(marker){this.markers[marker.id]=marker;this.markerListDirty=true;this.numMarkers++;}},{key:"markerWorldPosUpdated",value:function markerWorldPosUpdated(marker){if(!this.markers[marker.id]){// Not added
14227
14229
  return;}var i=this.markerIndices[marker.id];this.positions[i*3+0]=marker.worldPos[0];this.positions[i*3+1]=marker.worldPos[1];this.positions[i*3+2]=marker.worldPos[2];this.positionsDirty=true;// TODO: avoid reallocating VBO each time
14228
14230
  }},{key:"removeMarker",value:function removeMarker(marker){delete this.markers[marker.id];this.markerListDirty=true;this.numMarkers--;}},{key:"update",value:function update(gl,markerInView){if(this.markerListDirty){this.numMarkers=0;for(var id in this.markers){if(this.markers.hasOwnProperty(id)){this.markerList[this.numMarkers]=this.markers[id];this.markerIndices[id]=this.numMarkers;this.numMarkers++;}}this.markerList.length=this.numMarkers;this.markerListDirty=false;this.positionsDirty=true;this.occlusionTestListDirty=true;}if(this.positionsDirty){////////////// TODO: Don't rebuild this when positions change, very wasteful
14229
- var j=0;for(var _i178=0;_i178<this.numMarkers;_i178++){if(this.markerList[_i178]){var marker=this.markerList[_i178];var worldPos=marker.rtcPos;this.positions[j++]=worldPos[0];this.positions[j++]=worldPos[1];this.positions[j++]=worldPos[2];this.indices[_i178]=_i178;}}this.positions.length=this.numMarkers*3;this.indices.length=this.numMarkers;this.positionsDirty=false;var aabb=this.aabb;math.collapseAABB3(aabb);math.expandAABB3Points3(aabb,this.positions);var origin=this.origin;aabb[0]+=origin[0];aabb[1]+=origin[1];aabb[2]+=origin[2];aabb[3]+=origin[0];aabb[4]+=origin[1];aabb[5]+=origin[2];if(this.positionsBuf&&this.lenPositionsBuf!==this.positions.length){this.positionsBuf.destroy();this.positionsBuf=null;this.indicesBuf.destroy();this.indicesBuf=null;}var positionsArr=new Float32Array(this.positions);if(this.positionsBuf){this.positionsBuf.setData(positionsArr);// Just updating buffer elements, don't need to reallocate; Indices don't need updating
14230
- }else{this.positionsBuf=new ArrayBuf(gl,gl.ARRAY_BUFFER,positionsArr,positionsArr.length,3,gl.STATIC_DRAW);this.indicesBuf=new ArrayBuf(gl,gl.ELEMENT_ARRAY_BUFFER,new Uint16Array(this.indices),this.indices.length,1,gl.STATIC_DRAW);this.lenPositionsBuf=this.positions.length;}}if(this.occlusionTestListDirty){var lenPixels=0;this.lenOcclusionTestList=0;for(var _i179=0;_i179<this.numMarkers;_i179++){var _marker=this.markerList[_i179];if(_marker.entity&&!_marker.entity.visible||!markerInView(_marker)){_marker._setVisible(false);}else if(_marker.occludable){this.occlusionTestList[this.lenOcclusionTestList++]=_marker;this.pixels[lenPixels++]=_marker.canvasPos[0];this.pixels[lenPixels++]=_marker.canvasPos[1];}else{_marker._setVisible(true);}}}}},{key:"destroy",value:function destroy(){this.markers={};this.markerList.length=0;if(this.positionsBuf){this.positionsBuf.destroy();}if(this.indicesBuf){this.indicesBuf.destroy();}}}]);return OcclusionLayer;}();var MARKER_COLOR=math.vec3([255,0,0]);math.vec3();/**
14231
+ var j=0;for(var _i179=0;_i179<this.numMarkers;_i179++){if(this.markerList[_i179]){var marker=this.markerList[_i179];var worldPos=marker.rtcPos;this.positions[j++]=worldPos[0];this.positions[j++]=worldPos[1];this.positions[j++]=worldPos[2];this.indices[_i179]=_i179;}}this.positions.length=this.numMarkers*3;this.indices.length=this.numMarkers;this.positionsDirty=false;var aabb=this.aabb;math.collapseAABB3(aabb);math.expandAABB3Points3(aabb,this.positions);var origin=this.origin;aabb[0]+=origin[0];aabb[1]+=origin[1];aabb[2]+=origin[2];aabb[3]+=origin[0];aabb[4]+=origin[1];aabb[5]+=origin[2];if(this.positionsBuf&&this.lenPositionsBuf!==this.positions.length){this.positionsBuf.destroy();this.positionsBuf=null;this.indicesBuf.destroy();this.indicesBuf=null;}var positionsArr=new Float32Array(this.positions);if(this.positionsBuf){this.positionsBuf.setData(positionsArr);// Just updating buffer elements, don't need to reallocate; Indices don't need updating
14232
+ }else{this.positionsBuf=new ArrayBuf(gl,gl.ARRAY_BUFFER,positionsArr,positionsArr.length,3,gl.STATIC_DRAW);this.indicesBuf=new ArrayBuf(gl,gl.ELEMENT_ARRAY_BUFFER,new Uint16Array(this.indices),this.indices.length,1,gl.STATIC_DRAW);this.lenPositionsBuf=this.positions.length;}}if(this.occlusionTestListDirty){var lenPixels=0;this.lenOcclusionTestList=0;for(var _i180=0;_i180<this.numMarkers;_i180++){var _marker=this.markerList[_i180];if(_marker.entity&&!_marker.entity.visible||!markerInView(_marker)){_marker._setVisible(false);}else if(_marker.occludable){this.occlusionTestList[this.lenOcclusionTestList++]=_marker;this.pixels[lenPixels++]=_marker.canvasPos[0];this.pixels[lenPixels++]=_marker.canvasPos[1];}else{_marker._setVisible(true);}}}}},{key:"destroy",value:function destroy(){this.markers={};this.markerList.length=0;if(this.positionsBuf){this.positionsBuf.destroy();}if(this.indicesBuf){this.indicesBuf.destroy();}}}]);return OcclusionLayer;}();var MARKER_COLOR=math.vec3([255,0,0]);math.vec3();/**
14231
14233
  * Manages occlusion testing. Private member of a Renderer.
14232
14234
  * @private
14233
14235
  */var OcclusionTester=/*#__PURE__*/function(){function OcclusionTester(scene){var _this85=this;_classCallCheck(this,OcclusionTester);this._scene=scene;this._occlusionLayers={};this._occlusionLayersList=[];this._occlusionLayersListDirty=false;this._drawable=null;this._markersToOcclusionLayersMap={};var camera=scene.camera;var markOcclusionTestListDirty=function markOcclusionTestListDirty(){_this85._occlusionTestListDirty=true;};this._onCameraViewMatrix=camera.on("viewMatrix",markOcclusionTestListDirty);this._onCameraProjMatrix=camera.on("projMatrix",markOcclusionTestListDirty);this._onCanvasBoundary=scene.canvas.on("boundary",markOcclusionTestListDirty);}_createClass(OcclusionTester,[{key:"_addMarker",value:function _addMarker(marker,originHash){if(!this._occlusionLayers[originHash]){this._occlusionLayers[originHash]=new OcclusionLayer(marker.origin);this._occlusionLayersListDirty=true;}var occlusionLayer=this._occlusionLayers[originHash];occlusionLayer.addMarker(marker);this._markersToOcclusionLayersMap[marker.id]=occlusionLayer;}},{key:"_removeMarker",value:function _removeMarker(occlusionLayer,marker){if(occlusionLayer.numMarkers===1){occlusionLayer.destroy();delete this._occlusionLayers[occlusionLayer.originHash];this._occlusionLayersListDirty=true;}else{occlusionLayer.removeMarker(marker);}delete this._markersToOcclusionLayersMap[marker.id];}/**
@@ -14247,17 +14249,17 @@ var j=0;for(var _i178=0;_i178<this.numMarkers;_i178++){if(this.markerList[_i178]
14247
14249
  * Draws {@link Marker}s to the render buffer.
14248
14250
  */},{key:"drawMarkers",value:function drawMarkers(){var _this86=this;var scene=this._scene;var canvas=scene.canvas;var gl=canvas.gl;var sectionPlanesState=scene._sectionPlanesState;var shaderSourceHash=[canvas.canvas.id,sectionPlanesState.getHash()].join(";");if(!this._drawable||shaderSourceHash!==this._drawable.shaderSourceHash){if(this._drawable){this._drawable.destroy();}var programVariablesState=createProgramVariablesState();var programVariables=programVariablesState.programVariables;var viewMatrix=programVariables.createUniform("mat4","viewMatrix");var projMatrix=programVariables.createUniform("mat4","projMatrix");var _position3=programVariables.createAttribute("vec3","position");var outColor=programVariables.createOutput("vec4","outColor");var clipPos="clipPos";var _programVariablesStat5=programVariablesState.buildProgram(gl,"OcclusionTester",{sectionPlanesState:sectionPlanesState,getLogDepth:scene.logarithmicDepthBufferEnabled&&function(vFragDepth){return vFragDepth;},clippableTest:function clippableTest(){return"true";},getVertexData:function getVertexData(){var src=[];src.push("vec4 worldPosition = vec4(".concat(_position3,", 1.0);"));src.push("vec4 ".concat(clipPos," = ").concat(projMatrix," * ").concat(viewMatrix," * worldPosition;"));if(!scene.logarithmicDepthBufferEnabled&&scene.markerZOffset<0.000){src.push("".concat(clipPos,".z += ").concat(scene.markerZOffset,";"));}return src;},worldPositionAttribute:"worldPosition",getPointSize:function getPointSize(){return"20.0";},clipPos:clipPos,appendFragmentOutputs:function appendFragmentOutputs(src){return src.push("".concat(outColor," = vec4(1.0, 0.0, 0.0, 1.0);"));}}),_programVariablesStat6=_slicedToArray(_programVariablesStat5,2),program=_programVariablesStat6[0],errors=_programVariablesStat6[1];if(errors){console.error(errors.join("\n"));throw errors.join("\n");}else{this._occlusionTestListDirty=true;this._drawable={shaderSourceHash:shaderSourceHash,destroy:function destroy(){return program.destroy();},drawCall:function drawCall(){var camera=scene.camera;var project=camera.project;program.bind();projMatrix.setInputValue(project.matrix);var boundary=canvas.boundary;var canvasWidth=boundary[2];var canvasHeight=boundary[3];var near=camera.perspective.near;// Assume near enough to ortho near
14249
14251
  var markerInView=function markerInView(marker){var viewPos=marker.viewPos;var canvasPos=marker.canvasPos;var canvasX=canvasPos[0];var canvasY=canvasPos[1];return viewPos[2]<=-near&&canvasX>=-10&&canvasY>=-10&&canvasX<=canvasWidth+10&&canvasY<=canvasHeight+10;};_this86._occlusionLayersList.forEach(function(occlusionLayer){occlusionLayer.update(gl,markerInView);var culled=sectionPlanesState.sectionPlanes.some(function(sectionPlane,i){var intersect=sectionPlane.active?math.planeAABB3Intersect(sectionPlane.dir,sectionPlane.dist,occlusionLayer.aabb):1;var outside=intersect===-1;occlusionLayer.sectionPlanesActive[i]=intersect===0;// if outside, then sectionPlanesActive won't be even tested
14250
- return outside;});if(!culled){var origin=occlusionLayer.origin;viewMatrix.setInputValue(createRTCViewMat(camera.viewMatrix,origin));program.inputSetters.setUniforms(null,{view:{far:project.far},mesh:{origin:origin,renderFlags:{sectionPlanesActivePerLayer:occlusionLayer.sectionPlanesActive}}});_position3.setInputValue(occlusionLayer.positionsBuf);var indicesBuf=occlusionLayer.indicesBuf;indicesBuf.bind();gl.drawElements(gl.POINTS,indicesBuf.numItems,indicesBuf.itemType,0);}});}};}}if(this._occlusionLayersListDirty){var numOcclusionLayers=0;for(var originHash in this._occlusionLayers){if(this._occlusionLayers.hasOwnProperty(originHash)){this._occlusionLayersList[numOcclusionLayers++]=this._occlusionLayers[originHash];}}this._occlusionLayersList.length=numOcclusionLayers;this._occlusionLayersListDirty=false;}if(this._occlusionTestListDirty){for(var _i180=0,len=this._occlusionLayersList.length;_i180<len;_i180++){var occlusionLayer=this._occlusionLayersList[_i180];occlusionLayer.occlusionTestListDirty=true;}this._occlusionTestListDirty=false;}this._drawable.drawCall();}/**
14252
+ return outside;});if(!culled){var origin=occlusionLayer.origin;viewMatrix.setInputValue(createRTCViewMat(camera.viewMatrix,origin));program.inputSetters.setUniforms(null,{view:{far:project.far},mesh:{origin:origin,renderFlags:{sectionPlanesActivePerLayer:occlusionLayer.sectionPlanesActive}}});_position3.setInputValue(occlusionLayer.positionsBuf);var indicesBuf=occlusionLayer.indicesBuf;indicesBuf.bind();gl.drawElements(gl.POINTS,indicesBuf.numItems,indicesBuf.itemType,0);}});}};}}if(this._occlusionLayersListDirty){var numOcclusionLayers=0;for(var originHash in this._occlusionLayers){if(this._occlusionLayers.hasOwnProperty(originHash)){this._occlusionLayersList[numOcclusionLayers++]=this._occlusionLayers[originHash];}}this._occlusionLayersList.length=numOcclusionLayers;this._occlusionLayersListDirty=false;}if(this._occlusionTestListDirty){for(var _i181=0,len=this._occlusionLayersList.length;_i181<len;_i181++){var occlusionLayer=this._occlusionLayersList[_i181];occlusionLayer.occlusionTestListDirty=true;}this._occlusionTestListDirty=false;}this._drawable.drawCall();}/**
14251
14253
  * Sets visibilities of {@link Marker}s according to whether or not they are obscured by anything in the render buffer.
14252
- */},{key:"doOcclusionTest",value:function doOcclusionTest(readColorPixel){this._occlusionLayersList.forEach(function(occlusionLayer){for(var _i181=0;_i181<occlusionLayer.lenOcclusionTestList;_i181++){var j=_i181*2;var _color3=readColorPixel(occlusionLayer.pixels[j],occlusionLayer.pixels[j+1]);occlusionLayer.occlusionTestList[_i181]._setVisible(math.compareVec3(MARKER_COLOR,_color3));}});}/**
14254
+ */},{key:"doOcclusionTest",value:function doOcclusionTest(readColorPixel){this._occlusionLayersList.forEach(function(occlusionLayer){for(var _i182=0;_i182<occlusionLayer.lenOcclusionTestList;_i182++){var j=_i182*2;var _color3=readColorPixel(occlusionLayer.pixels[j],occlusionLayer.pixels[j+1]);occlusionLayer.occlusionTestList[_i182]._setVisible(math.compareVec3(MARKER_COLOR,_color3));}});}/**
14253
14255
  * Destroys this OcclusionTester.
14254
- */},{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 _i182=0;_i182<n;++_i182){ret.push(_i182);}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]]);};/**
14256
+ */},{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 _i183=0;_i183<n;++_i183){ret.push(_i183);}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]]);};/**
14255
14257
  * @private
14256
14258
  */var Renderer$1=function Renderer$1(scene,options){var _this87=this;options=options||{};var frameCtx=new FrameContext();var canvas=scene.canvas.canvas;/**
14257
14259
  * @type {WebGL2RenderingContext}
14258
14260
  */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
14259
14261
  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
14260
- 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 _i183=0;_i183<=KERNEL_RADIUS+1;_i183++){offsets.push(uvIncrement[0]*_i183);offsets.push(uvIncrement[1]*_i183);}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
14262
+ 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 _i184=0;_i184<=KERNEL_RADIUS+1;_i184++){offsets.push(uvIncrement[0]*_i184);offsets.push(uvIncrement[1]*_i184);}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
14261
14263
  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
14262
14264
  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()
14263
14265
  this.capabilities={astcSupported:!!getExtension(gl,'WEBGL_compressed_texture_astc'),etc1Supported:true,// WebGL2
@@ -14292,7 +14294,7 @@ blurSAO(occlusionRenderBuffer2,occlusionRenderBuffer1,1);// vertically
14292
14294
  }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;//------------------------------------------------------------------------------------------------------
14293
14295
  // Render normal opaque solids, defer others to bins to render after
14294
14296
  //------------------------------------------------------------------------------------------------------
14295
- for(var _i184=0,len=drawables.length;_i184<len;_i184++){drawable=drawables[_i184];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;}}}//------------------------------------------------------------------------------------------------------
14297
+ for(var _i185=0,len=drawables.length;_i185<len;_i185++){drawable=drawables[_i185];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;}}}//------------------------------------------------------------------------------------------------------
14296
14298
  // Render deferred bins
14297
14299
  //------------------------------------------------------------------------------------------------------
14298
14300
  // Opaque color with SAO
@@ -14350,7 +14352,7 @@ frameCtx.snapPickLayerParams=[];gl.depthMask(false);gl.drawBuffers([gl.COLOR_ATT
14350
14352
  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
14351
14353
  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
14352
14354
  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
14353
- var snapPickResult=[];for(var _i185=0;_i185<snapPickResultArray.length;_i185+=4){var layerNumber=snapPickResultArray[_i185+3];if(layerNumber>0){var pixelNumber=Math.floor(_i185/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(_i185,_i185+4),normal:snapPickNormalResultArray.subarray(_i185,_i185+4),id:snapPickIdResultArray.subarray(_i185,_i185+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
14355
+ var snapPickResult=[];for(var _i186=0;_i186<snapPickResultArray.length;_i186+=4){var layerNumber=snapPickResultArray[_i186+3];if(layerNumber>0){var pixelNumber=Math.floor(_i186/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(_i186,_i186+4),normal:snapPickNormalResultArray.subarray(_i186,_i186+4),id:snapPickIdResultArray.subarray(_i186,_i186+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
14354
14356
  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;}};}();/**
14355
14357
  * Adds a {@link Marker} for occlusion testing.
14356
14358
  * @param marker
@@ -14372,7 +14374,7 @@ function(x,y){return readPixelBuf.read(Math.round(resolutionScale*x),Math.round(
14372
14374
  * @param colors
14373
14375
  * @param len
14374
14376
  * @private
14375
- */readPixels:function readPixels(pixels,colors,len){snapshotBuffer.bind();gl.clear(gl.COLOR_BUFFER_BIT|gl.DEPTH_BUFFER_BIT);imageDirty=true;_this87.render();for(var _i186=0;_i186<len;_i186++){var j=_i186*2;var k=_i186*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;},/**
14377
+ */readPixels:function readPixels(pixels,colors,len){snapshotBuffer.bind();gl.clear(gl.COLOR_BUFFER_BIT|gl.DEPTH_BUFFER_BIT);imageDirty=true;_this87.render();for(var _i187=0;_i187<len;_i187++){var j=_i187*2;var k=_i187*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;},/**
14376
14378
  * Enter snapshot mode.
14377
14379
  *
14378
14380
  * Switches rendering to a hidden snapshot canvas.
@@ -16914,9 +16916,9 @@ _this100.preset=cfg.preset;if(cfg.lineWidth!==undefined){_this100.lineWidth=cfg.
16914
16916
  */,set:function set(value){value=value||"default";if(this._preset===value){return;}var preset=PRESETS[value];if(!preset){this.error("unsupported preset: '"+value+"' - supported values are "+Object.keys(PRESETS).join(", "));return;}this.lineWidth=preset.lineWidth;this._preset=value;}},{key:"hash",get:function get(){return[""+this.lineWidth].join(";");}/**
16915
16917
  * Destroys this LinesMaterial.
16916
16918
  */},{key:"destroy",value:function destroy(){_get(_getPrototypeOf(LinesMaterial.prototype),"destroy",this).call(this);this._state.destroy();}}]);return LinesMaterial;}(Material);function earcut(data,holeIndices){var dim=arguments.length>2&&arguments[2]!==undefined?arguments[2]:2;var hasHoles=holeIndices&&holeIndices.length;var outerLen=hasHoles?holeIndices[0]*dim:data.length;var outerNode=linkedList(data,0,outerLen,dim,true);var triangles=[];if(!outerNode||outerNode.next===outerNode.prev)return triangles;var minX,minY,invSize;if(hasHoles)outerNode=eliminateHoles(data,holeIndices,outerNode,dim);// if the shape is not too simple, we'll use z-order curve hash later; calculate polygon bbox
16917
- if(data.length>80*dim){minX=Infinity;minY=Infinity;var maxX=-Infinity;var maxY=-Infinity;for(var _i187=dim;_i187<outerLen;_i187+=dim){var x=data[_i187];var y=data[_i187+1];if(x<minX)minX=x;if(y<minY)minY=y;if(x>maxX)maxX=x;if(y>maxY)maxY=y;}// minX, minY and invSize are later used to transform coords into integers for z-order calculation
16919
+ if(data.length>80*dim){minX=Infinity;minY=Infinity;var maxX=-Infinity;var maxY=-Infinity;for(var _i188=dim;_i188<outerLen;_i188+=dim){var x=data[_i188];var y=data[_i188+1];if(x<minX)minX=x;if(y<minY)minY=y;if(x>maxX)maxX=x;if(y>maxY)maxY=y;}// minX, minY and invSize are later used to transform coords into integers for z-order calculation
16918
16920
  invSize=Math.max(maxX-minX,maxY-minY);invSize=invSize!==0?32767/invSize:0;}earcutLinked(outerNode,triangles,dim,minX,minY,invSize,0);return triangles;}// create a circular doubly linked list from polygon points in the specified winding order
16919
- function linkedList(data,start,end,dim,clockwise){var last;if(clockwise===signedArea(data,start,end,dim)>0){for(var _i188=start;_i188<end;_i188+=dim){last=insertNode(_i188/dim|0,data[_i188],data[_i188+1],last);}}else{for(var _i189=end-dim;_i189>=start;_i189-=dim){last=insertNode(_i189/dim|0,data[_i189],data[_i189+1],last);}}if(last&&equals$1(last,last.next)){removeNode(last);last=last.next;}return last;}// eliminate colinear or duplicate points
16921
+ function linkedList(data,start,end,dim,clockwise){var last;if(clockwise===signedArea(data,start,end,dim)>0){for(var _i189=start;_i189<end;_i189+=dim){last=insertNode(_i189/dim|0,data[_i189],data[_i189+1],last);}}else{for(var _i190=end-dim;_i190>=start;_i190-=dim){last=insertNode(_i190/dim|0,data[_i190],data[_i190+1],last);}}if(last&&equals$1(last,last.next)){removeNode(last);last=last.next;}return last;}// eliminate colinear or duplicate points
16920
16922
  function filterPoints(start,end){if(!start)return start;if(!end)end=start;var p=start,again;do{again=false;if(!p.steiner&&(equals$1(p,p.next)||area(p.prev,p,p.next)===0)){removeNode(p);p=end=p.prev;if(p===p.next)break;again=true;}else{p=p.next;}}while(again||p!==end);return end;}// main ear slicing loop which triangulates a polygon (given as a linked list)
16921
16923
  function earcutLinked(ear,triangles,dim,minX,minY,invSize,pass){if(!ear)return;// interlink polygon nodes in z-order
16922
16924
  if(!pass&&invSize)indexCurve(ear,minX,minY,invSize);var stop=ear;// iterate through ears, slicing them one by one
@@ -16944,8 +16946,8 @@ var a=start;do{var b=a.next.next;while(b!==a.prev){if(a.i!==b.i&&isValidDiagonal
16944
16946
  var c=splitPolygon(a,b);// filter colinear points around the cuts
16945
16947
  a=filterPoints(a,a.next);c=filterPoints(c,c.next);// run earcut on each half
16946
16948
  earcutLinked(a,triangles,dim,minX,minY,invSize,0);earcutLinked(c,triangles,dim,minX,minY,invSize,0);return;}b=b.next;}a=a.next;}while(a!==start);}// link every hole into the outer loop, producing a single-ring polygon without holes
16947
- function eliminateHoles(data,holeIndices,outerNode,dim){var queue=[];for(var _i190=0,len=holeIndices.length;_i190<len;_i190++){var start=holeIndices[_i190]*dim;var end=_i190<len-1?holeIndices[_i190+1]*dim:data.length;var list=linkedList(data,start,end,dim,false);if(list===list.next)list.steiner=true;queue.push(getLeftmost(list));}queue.sort(compareXYSlope);// process holes from left to right
16948
- for(var _i191=0;_i191<queue.length;_i191++){outerNode=eliminateHole(queue[_i191],outerNode);}return outerNode;}function compareXYSlope(a,b){var result=a.x-b.x;// when the left-most point of 2 holes meet at a vertex, sort the holes counterclockwise so that when we find
16949
+ function eliminateHoles(data,holeIndices,outerNode,dim){var queue=[];for(var _i191=0,len=holeIndices.length;_i191<len;_i191++){var start=holeIndices[_i191]*dim;var end=_i191<len-1?holeIndices[_i191+1]*dim:data.length;var list=linkedList(data,start,end,dim,false);if(list===list.next)list.steiner=true;queue.push(getLeftmost(list));}queue.sort(compareXYSlope);// process holes from left to right
16950
+ for(var _i192=0;_i192<queue.length;_i192++){outerNode=eliminateHole(queue[_i192],outerNode);}return outerNode;}function compareXYSlope(a,b){var result=a.x-b.x;// when the left-most point of 2 holes meet at a vertex, sort the holes counterclockwise so that when we find
16949
16951
  // the bridge to the outer shell is always the point that they meet at.
16950
16952
  if(result===0){result=a.y-b.y;if(result===0){var aSlope=(a.next.y-a.y)/(a.next.x-a.x);var bSlope=(b.next.y-b.y)/(b.next.x-b.x);result=aSlope-bSlope;}}return result;}// find a bridge between vertices that connects hole with an outer ring and and link it
16951
16953
  function eliminateHole(hole,outerNode){var bridge=findHoleBridge(hole,outerNode);if(!bridge){return outerNode;}var bridgeReverse=splitPolygon(bridge,hole);// filter collinear points around the cuts
@@ -16962,7 +16964,7 @@ if(locallyInside(p,hole)&&(tan<tanMin||tan===tanMin&&(p.x>m.x||p.x===m.x&&sector
16962
16964
  function sectorContainsSector(m,p){return area(m.prev,m,p.prev)<0&&area(p.next,m,m.next)<0;}// interlink polygon nodes in z-order
16963
16965
  function indexCurve(start,minX,minY,invSize){var p=start;do{if(p.z===0)p.z=zOrder(p.x,p.y,minX,minY,invSize);p.prevZ=p.prev;p.nextZ=p.next;p=p.next;}while(p!==start);p.prevZ.nextZ=null;p.prevZ=null;sortLinked(p);}// Simon Tatham's linked list merge sort algorithm
16964
16966
  // http://www.chiark.greenend.org.uk/~sgtatham/algorithms/listsort.html
16965
- function sortLinked(list){var numMerges;var inSize=1;do{var _p2=list;var _e2=void 0;list=null;var tail=null;numMerges=0;while(_p2){numMerges++;var q=_p2;var pSize=0;for(var _i192=0;_i192<inSize;_i192++){pSize++;q=q.nextZ;if(!q)break;}var qSize=inSize;while(pSize>0||qSize>0&&q){if(pSize!==0&&(qSize===0||!q||_p2.z<=q.z)){_e2=_p2;_p2=_p2.nextZ;pSize--;}else{_e2=q;q=q.nextZ;qSize--;}if(tail)tail.nextZ=_e2;else list=_e2;_e2.prevZ=tail;tail=_e2;}_p2=q;}tail.nextZ=null;inSize*=2;}while(numMerges>1);return list;}// z-order of a point given coords and inverse of the longer side of data bbox
16967
+ function sortLinked(list){var numMerges;var inSize=1;do{var _p2=list;var _e2=void 0;list=null;var tail=null;numMerges=0;while(_p2){numMerges++;var q=_p2;var pSize=0;for(var _i193=0;_i193<inSize;_i193++){pSize++;q=q.nextZ;if(!q)break;}var qSize=inSize;while(pSize>0||qSize>0&&q){if(pSize!==0&&(qSize===0||!q||_p2.z<=q.z)){_e2=_p2;_p2=_p2.nextZ;pSize--;}else{_e2=q;q=q.nextZ;qSize--;}if(tail)tail.nextZ=_e2;else list=_e2;_e2.prevZ=tail;tail=_e2;}_p2=q;}tail.nextZ=null;inSize*=2;}while(numMerges>1);return list;}// z-order of a point given coords and inverse of the longer side of data bbox
16966
16968
  function zOrder(x,y,minX,minY,invSize){// coords are transformed into non-negative 15-bit integer range
16967
16969
  x=(x-minX)*invSize|0;y=(y-minY)*invSize|0;x=(x|x<<8)&0x00FF00FF;x=(x|x<<4)&0x0F0F0F0F;x=(x|x<<2)&0x33333333;x=(x|x<<1)&0x55555555;y=(y|y<<8)&0x00FF00FF;y=(y|y<<4)&0x0F0F0F0F;y=(y|y<<2)&0x33333333;y=(y|y<<1)&0x55555555;return x|y<<1;}// find the leftmost node of a polygon ring
16968
16970
  function getLeftmost(start){var p=start,leftmost=start;do{if(p.x<leftmost.x||p.x===leftmost.x&&p.y<leftmost.y)leftmost=p;p=p.next;}while(p!==start);return leftmost;}// check if a point lies within a convex triangle
@@ -16993,7 +16995,7 @@ prev:null,// previous and next vertex nodes in a polygon ring
16993
16995
  next:null,z:0,// z-order curve value
16994
16996
  prevZ:null,// previous and next nodes in z-order
16995
16997
  nextZ:null,steiner:false// indicates whether this is a steiner point
16996
- };}function signedArea(data,start,end,dim){var sum=0;for(var _i193=start,j=end-dim;_i193<end;_i193+=dim){sum+=(data[j]-data[_i193])*(data[_i193+1]+data[j+1]);j=_i193;}return sum;}var epsilon=1e-6;var worldUp=[0,1,0];var worldRight=[1,0,0];var tempVec3a$a=math.vec3();var tempVec3b$7=math.vec3();var tempVec3c$6=math.vec3();var tempVec3d$1=math.vec3();var planeOff=math.vec3();function pointsEqual(p1,p2){return Math.abs(p1[0]-p2[0])<epsilon&&Math.abs(p1[1]-p2[1])<epsilon&&Math.abs(p1[2]-p2[2])<epsilon;}/**
16998
+ };}function signedArea(data,start,end,dim){var sum=0;for(var _i194=start,j=end-dim;_i194<end;_i194+=dim){sum+=(data[j]-data[_i194])*(data[_i194+1]+data[j+1]);j=_i194;}return sum;}var epsilon=1e-6;var worldUp=[0,1,0];var worldRight=[1,0,0];var tempVec3a$a=math.vec3();var tempVec3b$7=math.vec3();var tempVec3c$6=math.vec3();var tempVec3d$1=math.vec3();var planeOff=math.vec3();function pointsEqual(p1,p2){return Math.abs(p1[0]-p2[0])<epsilon&&Math.abs(p1[1]-p2[1])<epsilon&&Math.abs(p1[2]-p2[2])<epsilon;}/**
16997
16999
  * @desc Implements hatching for Solid objects on a {@link Scene}.
16998
17000
  *
16999
17001
  * [[Run this example](https://xeokit.github.io/xeokit-sdk/examples/slicing/SectionPlanesPlugin_Duplex_SectionCaps.html)]
@@ -17093,30 +17095,30 @@ var dirty=false;for(var sceneModelId in _this101._sceneModelsData){if(!_this101.
17093
17095
  var unsortedSegments=new Map();var objects=sceneModel.objects;// Preallocate arrays for triangle vertices to avoid repeated allocation
17094
17096
  var triangle=[math.vec3(),math.vec3(),math.vec3()];_this104._dirtyMap[sceneModel.id].forEach(function(isDirty,objectId){if(!isDirty){return;}var object=objects[objectId];if(!_this104._doesPlaneIntersectBoundingBox(object.aabb,plane))return;if(!_this104._sceneModelsData[sceneModel.id]){var aabb=sceneModel.aabb;_this104._sceneModelsData[sceneModel.id]={verticesMap:new Map(),indicesMap:new Map(),// modelOrigin is critical to use when handling models with large coordinates.
17095
17097
  // See XCD-306 and examples/slicing/SectionCaps_at_distance.html for more details.
17096
- modelOrigin:math.vec3([(aabb[0]+aabb[3])/2,(aabb[1]+aabb[4])/2,(aabb[2]+aabb[5])/2])};}var sceneModelData=_this104._sceneModelsData[sceneModel.id];var modelOrigin=sceneModelData.modelOrigin;if(!sceneModelData.verticesMap.has(objectId)){var isSolid=object.meshes[0].isSolid();var _vertices=[];var _indices3=[];if(isSolid&&object.capMaterial){object.getEachVertex(function(v){return _vertices.push(v[0]-modelOrigin[0],v[1]-modelOrigin[1],v[2]-modelOrigin[2]);});object.getEachIndex(function(i){return _indices3.push(i);});}sceneModelData.verticesMap.set(objectId,_vertices);sceneModelData.indicesMap.set(objectId,_indices3);}var vertices=sceneModelData.verticesMap.get(objectId);var indices=sceneModelData.indicesMap.get(objectId);var planeDist=-math.dotVec3(math.subVec3(plane.pos,modelOrigin,tempVec3a$a),plane.dir);var capSegments=[];var vertCount=indices.length;for(var _i194=0;_i194<vertCount;_i194+=3){// Reuse triangle buffer instead of creating new arrays
17097
- for(var j=0;j<3;j++){var idx=indices[_i194+j]*3;triangle[j][0]=vertices[idx];triangle[j][1]=vertices[idx+1];triangle[j][2]=vertices[idx+2];}// Early null check
17098
- if(!triangle[0][0]&&!triangle[0][1]&&!triangle[0][2])continue;var intersections=[];for(var _i195=0;_i195<3;_i195++){var p1=triangle[_i195];var p2=triangle[(_i195+1)%3];var d1=planeDist+math.dotVec3(plane.dir,p1);var d2=planeDist+math.dotVec3(plane.dir,p2);if(d1*d2>0)continue;var t=-d1/(d2-d1);intersections.push(math.lerpVec3(t,0,1,p1,p2,math.vec3()));}if(intersections.length===2)capSegments.push(intersections);}if(capSegments.length>0){unsortedSegments.set(objectId,capSegments);}});//#endregion
17098
+ modelOrigin:math.vec3([(aabb[0]+aabb[3])/2,(aabb[1]+aabb[4])/2,(aabb[2]+aabb[5])/2])};}var sceneModelData=_this104._sceneModelsData[sceneModel.id];var modelOrigin=sceneModelData.modelOrigin;if(!sceneModelData.verticesMap.has(objectId)){var isSolid=object.meshes[0].isSolid();var _vertices=[];var _indices3=[];if(isSolid&&object.capMaterial){object.getEachVertex(function(v){return _vertices.push(v[0]-modelOrigin[0],v[1]-modelOrigin[1],v[2]-modelOrigin[2]);});object.getEachIndex(function(i){return _indices3.push(i);});}sceneModelData.verticesMap.set(objectId,_vertices);sceneModelData.indicesMap.set(objectId,_indices3);}var vertices=sceneModelData.verticesMap.get(objectId);var indices=sceneModelData.indicesMap.get(objectId);var planeDist=-math.dotVec3(math.subVec3(plane.pos,modelOrigin,tempVec3a$a),plane.dir);var capSegments=[];var vertCount=indices.length;for(var _i195=0;_i195<vertCount;_i195+=3){// Reuse triangle buffer instead of creating new arrays
17099
+ for(var j=0;j<3;j++){var idx=indices[_i195+j]*3;triangle[j][0]=vertices[idx];triangle[j][1]=vertices[idx+1];triangle[j][2]=vertices[idx+2];}// Early null check
17100
+ if(!triangle[0][0]&&!triangle[0][1]&&!triangle[0][2])continue;var intersections=[];for(var _i196=0;_i196<3;_i196++){var p1=triangle[_i196];var p2=triangle[(_i196+1)%3];var d1=planeDist+math.dotVec3(plane.dir,p1);var d2=planeDist+math.dotVec3(plane.dir,p2);if(d1*d2>0)continue;var t=-d1/(d2-d1);intersections.push(math.lerpVec3(t,0,1,p1,p2,math.vec3()));}if(intersections.length===2)capSegments.push(intersections);}if(capSegments.length>0){unsortedSegments.set(objectId,capSegments);}});//#endregion
17099
17101
  //#region sorting the segments
17100
17102
  var orderedSegments=new Map();unsortedSegments.forEach(function(unsortedSegment,segmentedId){orderedSegments.set(segmentedId,[[unsortedSegment[0]//this is also an array of two vectors
17101
- ]]);unsortedSegment.splice(0,1);var index=0;while(unsortedSegment.length>0){var lastPoint=orderedSegments.get(segmentedId)[index][orderedSegments.get(segmentedId)[index].length-1][1];var found=false;for(var _i196=0;_i196<unsortedSegment.length;_i196++){var _unsortedSegment$_i=_slicedToArray(unsortedSegment[_i196],2),start=_unsortedSegment$_i[0],end=_unsortedSegment$_i[1];if(pointsEqual(lastPoint,start)){orderedSegments.get(segmentedId)[index].push(unsortedSegment[_i196]);unsortedSegment.splice(_i196,1);found=true;break;}else if(pointsEqual(lastPoint,end)){orderedSegments.get(segmentedId)[index].push([end,start]);unsortedSegment.splice(_i196,1);found=true;break;}}if(!found){if(pointsEqual(lastPoint,orderedSegments.get(segmentedId)[index][0][0])){if(unsortedSegment.length>1){orderedSegments.get(segmentedId).push([unsortedSegments.get(segmentedId)[0]]);unsortedSegment.splice(0,1);index++;continue;}}}if(!found){// console.error(`Could not find a matching segment. Loop may not be closed. Key: ${key}`);
17103
+ ]]);unsortedSegment.splice(0,1);var index=0;while(unsortedSegment.length>0){var lastPoint=orderedSegments.get(segmentedId)[index][orderedSegments.get(segmentedId)[index].length-1][1];var found=false;for(var _i197=0;_i197<unsortedSegment.length;_i197++){var _unsortedSegment$_i=_slicedToArray(unsortedSegment[_i197],2),start=_unsortedSegment$_i[0],end=_unsortedSegment$_i[1];if(pointsEqual(lastPoint,start)){orderedSegments.get(segmentedId)[index].push(unsortedSegment[_i197]);unsortedSegment.splice(_i197,1);found=true;break;}else if(pointsEqual(lastPoint,end)){orderedSegments.get(segmentedId)[index].push([end,start]);unsortedSegment.splice(_i197,1);found=true;break;}}if(!found){if(pointsEqual(lastPoint,orderedSegments.get(segmentedId)[index][0][0])){if(unsortedSegment.length>1){orderedSegments.get(segmentedId).push([unsortedSegments.get(segmentedId)[0]]);unsortedSegment.splice(0,1);index++;continue;}}}if(!found){// console.error(`Could not find a matching segment. Loop may not be closed. Key: ${key}`);
17102
17104
  break;}}});//#endregion
17103
17105
  //#region projecting the segments to 2D
17104
- var projectedSegments=new Map();orderedSegments.forEach(function(orderedSegment,key){var arr=[];var _loop8=function _loop8(_i197){arr.push([]);orderedSegment[_i197].forEach(function(segment){arr[_i197].push([_this104._projectTo2D(segment[0],plane.dir),_this104._projectTo2D(segment[1],plane.dir)]);});};for(var _i197=0;_i197<orderedSegment.length;_i197++){_loop8(_i197);}projectedSegments.set(key,arr);});//#endregion
17106
+ var projectedSegments=new Map();orderedSegments.forEach(function(orderedSegment,key){var arr=[];var _loop8=function _loop8(_i198){arr.push([]);orderedSegment[_i198].forEach(function(segment){arr[_i198].push([_this104._projectTo2D(segment[0],plane.dir),_this104._projectTo2D(segment[1],plane.dir)]);});};for(var _i198=0;_i198<orderedSegment.length;_i198++){_loop8(_i198);}projectedSegments.set(key,arr);});//#endregion
17105
17107
  //#region creating caps using earcut and then projecting them back to 3D
17106
17108
  var caps=new Map();var arr;projectedSegments.forEach(function(segment,segmentId){var modelOrigin=_this104._sceneModelsData[sceneModel.id].modelOrigin;arr=[];var loops=segment;// Group related loops (outer boundaries with their holes)
17107
- var groupedLoops=[];var used=new Set();for(var _i198=0;_i198<loops.length;_i198++){if(used.has(_i198))continue;var group=[loops[_i198]];used.add(_i198);// Check remaining loops
17108
- for(var j=_i198+1;j<loops.length;j++){if(used.has(j))continue;if(_this104._isLoopInside(loops[_i198],loops[j])||_this104._isLoopInside(loops[j],loops[_i198])){group.push(loops[j]);used.add(j);}}groupedLoops.push(group);}// Process each group separately
17109
+ var groupedLoops=[];var used=new Set();for(var _i199=0;_i199<loops.length;_i199++){if(used.has(_i199))continue;var group=[loops[_i199]];used.add(_i199);// Check remaining loops
17110
+ for(var j=_i199+1;j<loops.length;j++){if(used.has(j))continue;if(_this104._isLoopInside(loops[_i199],loops[j])||_this104._isLoopInside(loops[j],loops[_i199])){group.push(loops[j]);used.add(j);}}groupedLoops.push(group);}// Process each group separately
17109
17111
  groupedLoops.forEach(function(group){// Convert the segments into a flat array of vertices and find holes
17110
17112
  var vertices=[];var holes=[];var currentIndex=0;// First, determine which loop has the largest area - this will be our outer boundary
17111
- var areas=group.map(function(loop){var area=0;for(var _i199=0;_i199<loop.length;_i199++){var _j5=(_i199+1)%loop.length;area+=loop[_i199][0][0]*loop[_j5][0][1];area-=loop[_j5][0][0]*loop[_i199][0][1];}return Math.abs(area)/2;});// Find index of the loop with maximum area
17113
+ var areas=group.map(function(loop){var area=0;for(var _i200=0;_i200<loop.length;_i200++){var _j5=(_i200+1)%loop.length;area+=loop[_i200][0][0]*loop[_j5][0][1];area-=loop[_j5][0][0]*loop[_i200][0][1];}return Math.abs(area)/2;});// Find index of the loop with maximum area
17112
17114
  var outerLoopIndex=areas.indexOf(Math.max.apply(Math,_toConsumableArray(areas)));// Add the outer boundary first
17113
17115
  group[outerLoopIndex].forEach(function(segment){vertices.push(segment[0][0],segment[0][1]);currentIndex+=2;});// Then add all other loops as holes
17114
- for(var _i200=0;_i200<group.length;_i200++){if(_i200!==outerLoopIndex){// Store the starting vertex index for this hole
17115
- holes.push(currentIndex/2);group[_i200].forEach(function(segment){vertices.push(segment[0][0],segment[0][1]);currentIndex+=2;});}}// Triangulate using earcut
17116
+ for(var _i201=0;_i201<group.length;_i201++){if(_i201!==outerLoopIndex){// Store the starting vertex index for this hole
17117
+ holes.push(currentIndex/2);group[_i201].forEach(function(segment){vertices.push(segment[0][0],segment[0][1]);currentIndex+=2;});}}// Triangulate using earcut
17116
17118
  var triangles=earcut(vertices,holes);// // Convert triangulated 2D points back to 3D
17117
17119
  var cap3D=[];// Process each triangle
17118
- for(var _i201=0;_i201<triangles.length;_i201+=3){var _triangle=[];// Convert each vertex
17119
- for(var _j6=0;_j6<3;_j6++){var idx=triangles[_i201+_j6]*2;var point2D=[vertices[idx],vertices[idx+1]];var point3D=_this104._convertTo3D(point2D,plane,modelOrigin);_triangle.push(point3D);}cap3D.push(_triangle);}arr.push(cap3D);});caps.set(segmentId,arr);});//#endregion
17120
+ for(var _i202=0;_i202<triangles.length;_i202+=3){var _triangle=[];// Convert each vertex
17121
+ for(var _j6=0;_j6<3;_j6++){var idx=triangles[_i202+_j6]*2;var point2D=[vertices[idx],vertices[idx+1]];var point3D=_this104._convertTo3D(point2D,plane,modelOrigin);_triangle.push(point3D);}cap3D.push(_triangle);}arr.push(cap3D);});caps.set(segmentId,arr);});//#endregion
17120
17122
  //#region converting caps to geometry
17121
17123
  var geometryData=new Map();caps.forEach(function(cap,capId){arr=[];cap.forEach(function(capTriangles){// Create a vertex map to reuse vertices
17122
17124
  var vertexMap=new Map();var vertices=[];var indices=[];var currentIndex=0;capTriangles.forEach(function(triangle){var triangleIndices=[];// Process each vertex of the triangle
@@ -17142,17 +17144,17 @@ indices:indices,normals:meshNormals,uv:uvs}),origin:math.addVec3(modelOrigin,pla
17142
17144
  [min[0],max[1],max[2]],// 011
17143
17145
  [max[0],max[1],max[2]]// 111
17144
17146
  ];// Calculate distance from each corner to the plane
17145
- var hasPositive=false;var hasNegative=false;for(var _i202=0,_corners=corners;_i202<_corners.length;_i202++){var corner=_corners[_i202];var _distance=plane.dist+math.dotVec3(plane.dir,corner);if(_distance>0)hasPositive=true;if(_distance<0)hasNegative=true;// If we found points on both sides, the plane intersects the box
17147
+ var hasPositive=false;var hasNegative=false;for(var _i203=0,_corners=corners;_i203<_corners.length;_i203++){var corner=_corners[_i203];var _distance=plane.dist+math.dotVec3(plane.dir,corner);if(_distance>0)hasPositive=true;if(_distance<0)hasNegative=true;// If we found points on both sides, the plane intersects the box
17146
17148
  if(hasPositive&&hasNegative)return true;}// If all points are on the same side, no intersection
17147
17149
  return false;}//not used but kept for debugging
17148
- },{key:"_buildLines",value:function _buildLines(sortedSegments){var _this105=this;for(var key in sortedSegments){for(var _i203=0;_i203<sortedSegments[key].length;_i203++){var segments=sortedSegments[key][_i203];if(segments.length<=0)continue;segments.forEach(function(segment,index){new Mesh(_this105.scene,{clippable:false,geometry:new ReadableGeometry(_this105.scene,buildLineGeometry({startPoint:segment[0],endPoint:segment[1]})),material:new PhongMaterial(_this105.scene,{emissive:[1,0,0]})});});}}}},{key:"_projectTo2D",value:function _projectTo2D(point,normal){var u;if(Math.abs(normal[0])>Math.abs(normal[1]))u=[-normal[2],0,normal[0]];else u=[0,normal[2],-normal[1]];u=math.normalizeVec3(u);var normalTemp=math.vec3(normal);var cross=math.cross3Vec3(normalTemp,u);var v=math.normalizeVec3(cross);var x=math.dotVec3(point,u);var y=math.dotVec3(point,v);return[x,y];}},{key:"_isLoopInside",value:function _isLoopInside(loop1,loop2){// Simple point-in-polygon test using the first point of loop1
17150
+ },{key:"_buildLines",value:function _buildLines(sortedSegments){var _this105=this;for(var key in sortedSegments){for(var _i204=0;_i204<sortedSegments[key].length;_i204++){var segments=sortedSegments[key][_i204];if(segments.length<=0)continue;segments.forEach(function(segment,index){new Mesh(_this105.scene,{clippable:false,geometry:new ReadableGeometry(_this105.scene,buildLineGeometry({startPoint:segment[0],endPoint:segment[1]})),material:new PhongMaterial(_this105.scene,{emissive:[1,0,0]})});});}}}},{key:"_projectTo2D",value:function _projectTo2D(point,normal){var u;if(Math.abs(normal[0])>Math.abs(normal[1]))u=[-normal[2],0,normal[0]];else u=[0,normal[2],-normal[1]];u=math.normalizeVec3(u);var normalTemp=math.vec3(normal);var cross=math.cross3Vec3(normalTemp,u);var v=math.normalizeVec3(cross);var x=math.dotVec3(point,u);var y=math.dotVec3(point,v);return[x,y];}},{key:"_isLoopInside",value:function _isLoopInside(loop1,loop2){// Simple point-in-polygon test using the first point of loop1
17149
17151
  var point=loop1[0][0];// First point of first segment
17150
- var inside=false;for(var _i204=0,j=loop2.length-1;_i204<loop2.length;j=_i204++){var xi=loop2[_i204][0][0],yi=loop2[_i204][0][1];var xj=loop2[j][0][0],yj=loop2[j][0][1];var intersect=yi>point[1]!==yj>point[1]&&point[0]<(xj-xi)*(point[1]-yi)/(yj-yi)+xi;if(intersect)inside=!inside;}return inside;}},{key:"_convertTo3D",value:function _convertTo3D(point2D,plane,origin){// Reconstruct the same basis vectors used in _projectTo2D
17152
+ var inside=false;for(var _i205=0,j=loop2.length-1;_i205<loop2.length;j=_i205++){var xi=loop2[_i205][0][0],yi=loop2[_i205][0][1];var xj=loop2[j][0][0],yj=loop2[j][0][1];var intersect=yi>point[1]!==yj>point[1]&&point[0]<(xj-xi)*(point[1]-yi)/(yj-yi)+xi;if(intersect)inside=!inside;}return inside;}},{key:"_convertTo3D",value:function _convertTo3D(point2D,plane,origin){// Reconstruct the same basis vectors used in _projectTo2D
17151
17153
  var u,normal=plane.dir,planePosition=plane.pos;if(Math.abs(normal[0])>Math.abs(normal[1])){u=[-normal[2],0,normal[0]];}else{u=[0,normal[2],-normal[1]];}u=math.normalizeVec3(u);var normalTemp=math.vec3(normal);var cross=math.cross3Vec3(normalTemp,u);var v=math.normalizeVec3(cross);// Reconstruct 3D point using the basis vectors
17152
17154
  var x=point2D[0];var y=point2D[1];var result=[u[0]*x+v[0]*y,u[1]*x+v[1]*y,u[2]*x+v[2]*y];// Project the point onto the cutting plane
17153
- var t=math.dotVec3(normal,[planePosition[0]-result[0]-origin[0],planePosition[1]-result[1]-origin[1],planePosition[2]-result[2]-origin[2]]);return[result[0]+normal[0]*t,result[1]+normal[1]*t,result[2]+normal[2]*t];}},{key:"_deletePreviousModels",value:function _deletePreviousModels(){var _this106=this;var _loop9=function _loop9(sceneModelId){var objects=_this106._prevIntersectionModelsMap[sceneModelId];objects.forEach(function(value,objectId){if(_this106._dirtyMap[sceneModelId].get(objectId)){value.forEach(function(mesh){mesh.destroy();});_this106._prevIntersectionModelsMap[sceneModelId]["delete"](objectId);}});if(_this106._prevIntersectionModelsMap[sceneModelId].size<=0)delete _this106._prevIntersectionModelsMap[sceneModelId];};for(var sceneModelId in this._prevIntersectionModelsMap){_loop9(sceneModelId);}}},{key:"_createUVs",value:function _createUVs(vertices,plane,origin){var O=plane.pos;var D=tempVec3a$a;D.set(plane.dir);math.normalizeVec3(D);var P=tempVec3b$7;var uvs=[];for(var _i205=0;_i205<vertices.length;_i205+=3){P[0]=vertices[_i205]+origin[0];P[1]=vertices[_i205+1]+origin[1];P[2]=vertices[_i205+2]+origin[2];// Project P onto the plane
17155
+ var t=math.dotVec3(normal,[planePosition[0]-result[0]-origin[0],planePosition[1]-result[1]-origin[1],planePosition[2]-result[2]-origin[2]]);return[result[0]+normal[0]*t,result[1]+normal[1]*t,result[2]+normal[2]*t];}},{key:"_deletePreviousModels",value:function _deletePreviousModels(){var _this106=this;var _loop9=function _loop9(sceneModelId){var objects=_this106._prevIntersectionModelsMap[sceneModelId];objects.forEach(function(value,objectId){if(_this106._dirtyMap[sceneModelId].get(objectId)){value.forEach(function(mesh){mesh.destroy();});_this106._prevIntersectionModelsMap[sceneModelId]["delete"](objectId);}});if(_this106._prevIntersectionModelsMap[sceneModelId].size<=0)delete _this106._prevIntersectionModelsMap[sceneModelId];};for(var sceneModelId in this._prevIntersectionModelsMap){_loop9(sceneModelId);}}},{key:"_createUVs",value:function _createUVs(vertices,plane,origin){var O=plane.pos;var D=tempVec3a$a;D.set(plane.dir);math.normalizeVec3(D);var P=tempVec3b$7;var uvs=[];for(var _i206=0;_i206<vertices.length;_i206+=3){P[0]=vertices[_i206]+origin[0];P[1]=vertices[_i206+1]+origin[1];P[2]=vertices[_i206+2]+origin[2];// Project P onto the plane
17154
17156
  var _OP=math.subVec3(P,O,tempVec3c$6);var dist=math.dotVec3(_OP,D);math.subVec3(P,math.mulVec3Scalar(D,dist,tempVec3c$6),P);var right=Math.abs(math.dotVec3(D,worldUp))<0.999?math.cross3Vec3(D,worldUp,tempVec3c$6):worldRight;var v=math.cross3Vec3(D,right,tempVec3c$6);math.normalizeVec3(v,v);var OP_proj=math.subVec3(P,O,P);uvs.push(math.dotVec3(OP_proj,math.normalizeVec3(math.cross3Vec3(v,D,tempVec3d$1))),math.dotVec3(OP_proj,v));}return uvs;}},{key:"destroy",value:function destroy(){this._deletePreviousModels();if(this._resourcesAllocated){this.scene.off(this._onModelLoaded);this.scene.off(this._onModelUnloaded);this.scene.off(this._onSectionPlaneCreated);this.scene.off(this._onTick);}}}]);return SectionCaps;}();// Cached vars to avoid garbage collection
17155
- function getEntityIDMap(scene,entityIds){var map={};var entityId;var entity;for(var _i206=0,len=entityIds.length;_i206<len;_i206++){entityId=entityIds[_i206];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;}/**
17157
+ function getEntityIDMap(scene,entityIds){var map={};var entityId;var entity;for(var _i207=0,len=entityIds.length;_i207<len;_i207++){entityId=entityIds[_i207];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;}/**
17156
17158
  * Fired whenever a debug message is logged on a component within this Scene.
17157
17159
  * @event log
17158
17160
  * @param {String} value The debug message
@@ -17588,7 +17590,7 @@ _this107._needRecompile=false;/**
17588
17590
  *
17589
17591
  * @type {Canvas}
17590
17592
  */_this107.canvas=new Canvas(_assertThisInitialized(_this107),{dontClear:true,// Never destroy this component with Scene#clear();
17591
- 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 _this107.viewer.destroy();};canvas.addEventListener("webglcontextlost",onContextLost,false);_this107._removeWebglcontextlostListener=function(){return canvas.removeEventListener("webglcontextlost",onContextLost,false);};_this107.canvas.on("boundary",function(){_this107.glRedraw();});_this107.canvas.on("webglContextFailed",function(){alert("xeokit failed to find WebGL!");});_this107._renderer=new Renderer$1(_assertThisInitialized(_this107),{transparent:transparent,alphaDepthMask:alphaDepthMask});_this107._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 _i207=0,len=numAllocatedSectionPlanes;_i207<len;_i207++){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 _i208=0,len=this.sectionPlanes.length;_i208<len;_i208++){if(this.sectionPlanes[_i208].id===sectionPlane.id){this.sectionPlanes.splice(_i208,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;};}();_this107._sectionPlanesState.setNumCachedSectionPlanes(cfg.numCachedSectionPlanes||0);_this107._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 _i209=0,len=lights.length;_i209<len;_i209++){light=lights[_i209];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 _i210=0,len=this.lights.length;_i210<len;_i210++){var light=this.lights[_i210];if(light.id===state.id){this.lights.splice(_i210,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 _i211=0,len=this.reflectionMaps.length;_i211<len;_i211++){if(this.reflectionMaps[_i211].id===state.id){this.reflectionMaps.splice(_i211,1);hash=null;return;}}};this.addLightMap=function(state){this.lightMaps.push(state);hash=null;};this.removeLightMap=function(state){for(var _i212=0,len=this.lightMaps.length;_i212<len;_i212++){if(this.lightMaps[_i212].id===state.id){this.lightMaps.splice(_i212,1);hash=null;return;}}};this.getAmbientColorAndIntensity=function(){if(!ambientLight){for(var _i213=0,len=this.lights.length;_i213<len;_i213++){var light=this.lights[_i213];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;}};}();/**
17593
+ 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 _this107.viewer.destroy();};canvas.addEventListener("webglcontextlost",onContextLost,false);_this107._removeWebglcontextlostListener=function(){return canvas.removeEventListener("webglcontextlost",onContextLost,false);};_this107.canvas.on("boundary",function(){_this107.glRedraw();});_this107.canvas.on("webglContextFailed",function(){alert("xeokit failed to find WebGL!");});_this107._renderer=new Renderer$1(_assertThisInitialized(_this107),{transparent:transparent,alphaDepthMask:alphaDepthMask});_this107._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 _i208=0,len=numAllocatedSectionPlanes;_i208<len;_i208++){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 _i209=0,len=this.sectionPlanes.length;_i209<len;_i209++){if(this.sectionPlanes[_i209].id===sectionPlane.id){this.sectionPlanes.splice(_i209,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;};}();_this107._sectionPlanesState.setNumCachedSectionPlanes(cfg.numCachedSectionPlanes||0);_this107._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 _i210=0,len=lights.length;_i210<len;_i210++){light=lights[_i210];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 _i211=0,len=this.lights.length;_i211<len;_i211++){var light=this.lights[_i211];if(light.id===state.id){this.lights.splice(_i211,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 _i212=0,len=this.reflectionMaps.length;_i212<len;_i212++){if(this.reflectionMaps[_i212].id===state.id){this.reflectionMaps.splice(_i212,1);hash=null;return;}}};this.addLightMap=function(state){this.lightMaps.push(state);hash=null;};this.removeLightMap=function(state){for(var _i213=0,len=this.lightMaps.length;_i213<len;_i213++){if(this.lightMaps[_i213].id===state.id){this.lightMaps.splice(_i213,1);hash=null;return;}}};this.getAmbientColorAndIntensity=function(){if(!ambientLight){for(var _i214=0,len=this.lights.length;_i214<len;_i214++){var light=this.lights[_i214];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;}};}();/**
17592
17594
  * Publishes input events that occur on this Scene's canvas.
17593
17595
  *
17594
17596
  * @property input
@@ -18120,13 +18122,13 @@ if(excludeEntities){params.excludeEntityIds=getEntityIDMap(this,excludeEntities)
18120
18122
  */},{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.
18121
18123
  component.destroy();}}}}/**
18122
18124
  * Destroys all {@link Light}s in this Scene..
18123
- */},{key:"clearLights",value:function clearLights(){var ids=Object.keys(this.lights);for(var _i214=0,len=ids.length;_i214<len;_i214++){this.lights[ids[_i214]].destroy();}}/**
18125
+ */},{key:"clearLights",value:function clearLights(){var ids=Object.keys(this.lights);for(var _i215=0,len=ids.length;_i215<len;_i215++){this.lights[ids[_i215]].destroy();}}/**
18124
18126
  * Destroys all {@link SectionPlane}s in this Scene.
18125
- */},{key:"clearSectionPlanes",value:function clearSectionPlanes(){var ids=Object.keys(this.sectionPlanes);for(var _i215=0,len=ids.length;_i215<len;_i215++){this.sectionPlanes[ids[_i215]].destroy();}}/**
18127
+ */},{key:"clearSectionPlanes",value:function clearSectionPlanes(){var ids=Object.keys(this.sectionPlanes);for(var _i216=0,len=ids.length;_i216<len;_i216++){this.sectionPlanes[ids[_i216]].destroy();}}/**
18126
18128
  * Destroys all {@link Line}s in this Scene.
18127
- */},{key:"clearBitmaps",value:function clearBitmaps(){var ids=Object.keys(this.bitmaps);for(var _i216=0,len=ids.length;_i216<len;_i216++){this.bitmaps[ids[_i216]].destroy();}}/**
18129
+ */},{key:"clearBitmaps",value:function clearBitmaps(){var ids=Object.keys(this.bitmaps);for(var _i217=0,len=ids.length;_i217<len;_i217++){this.bitmaps[ids[_i217]].destroy();}}/**
18128
18130
  * Destroys all {@link Line}s in this Scene.
18129
- */},{key:"clearLines",value:function clearLines(){var ids=Object.keys(this.lineSets);for(var _i217=0,len=ids.length;_i217<len;_i217++){this.lineSets[ids[_i217]].destroy();}}/**
18131
+ */},{key:"clearLines",value:function clearLines(){var ids=Object.keys(this.lineSets);for(var _i218=0,len=ids.length;_i218<len;_i218++){this.lineSets[ids[_i218]].destroy();}}/**
18130
18132
  * Gets the collective axis-aligned boundary (AABB) of a batch of {@link Entity}s that represent objects.
18131
18133
  *
18132
18134
  * An {@link Entity} represents an object when {@link Entity#isObject} is ````true````.
@@ -18244,7 +18246,7 @@ return entity.aabb;}ids=[ids];// Must be an entity type
18244
18246
  * @param {String[]} ids Array of {@link Entity#id} values.
18245
18247
  * @param {Function} callback Callback to execute on eacn {@link Entity}.
18246
18248
  * @returns {Boolean} True if any {@link Entity}s were updated, else false if all updates were redundant and not applied.
18247
- */},{key:"withObjects",value:function withObjects(ids,callback){if(utils.isString(ids)){ids=[ids];}var changed=false;for(var _i218=0,len=ids.length;_i218<len;_i218++){var id=ids[_i218];var entity=this.objects[id];if(entity){changed=callback(entity)||changed;}else{var modelIds=this.modelIds;for(var _i219=0,_len24=modelIds.length;_i219<_len24;_i219++){var modelId=modelIds[_i219];var globalObjectId=math.globalizeObjectId(modelId,id);entity=this.objects[globalObjectId];if(entity){changed=callback(entity)||changed;}}}}return changed;}/**
18249
+ */},{key:"withObjects",value:function withObjects(ids,callback){if(utils.isString(ids)){ids=[ids];}var changed=false;for(var _i219=0,len=ids.length;_i219<len;_i219++){var id=ids[_i219];var entity=this.objects[id];if(entity){changed=callback(entity)||changed;}else{var modelIds=this.modelIds;for(var _i220=0,_len24=modelIds.length;_i220<_len24;_i220++){var modelId=modelIds[_i220];var globalObjectId=math.globalizeObjectId(modelId,id);entity=this.objects[globalObjectId];if(entity){changed=callback(entity)||changed;}}}}return changed;}/**
18248
18250
  * This method will "tickify" the provided `cb` function.
18249
18251
  *
18250
18252
  * This means, the function will be wrapped so:
@@ -18465,7 +18467,7 @@ if(configs.followPointer){var _dolliedThroughSurface2=panController.dollyToCanva
18465
18467
  * @private
18466
18468
  */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);});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,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;};/**
18467
18469
  * @private
18468
- */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],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 _i220=0,len=touches.length;_i220<len;++_i220){getCanvasPosFromEvent$1(touches[_i220],lastCanvasTouchPosList[_i220]);}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
18470
+ */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],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 _i221=0,len=touches.length;_i221<len;++_i221){getCanvasPosFromEvent$1(touches[_i221],lastCanvasTouchPosList[_i221]);}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
18469
18471
  return;}waitForTick=true;// Scaling drag-rotate to canvas boundary
18470
18472
  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
18471
18473
  // We don't want to rotate in this case (weird behavior)
@@ -18490,16 +18492,16 @@ updates.rotateDeltaX+=yPanDelta/canvasHeight*(configs.dragRotationRate*1.5);// H
18490
18492
  // }
18491
18493
  }}else if(numTouches===2){var touch0=touches[0];var touch1=touches[1];getCanvasPosFromEvent$1(touch0,tapCanvasPos0);getCanvasPosFromEvent$1(touch1,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
18492
18494
  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;if(Math.abs(dollyDelta)<1.0){// We use only canvasHeight here so that aspect ratio does not distort speed
18493
- 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 _i221=0;_i221<numTouches;++_i221){getCanvasPosFromEvent$1(touches[_i221],lastCanvasTouchPosList[_i221]);}});}_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;};/**
18495
+ 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 _i222=0;_i222<numTouches;++_i222){getCanvasPosFromEvent$1(touches[_i222],lastCanvasTouchPosList[_i222]);}});}_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;};/**
18494
18496
  * @private
18495
18497
  */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
18496
18498
  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
18497
18499
  }else{// Fly to fit target boundary in view
18498
18500
  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
18499
- 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 _i222=0,len=touches.length;_i222<len;++_i222){getCanvasPosFromEvent(touches[_i222],activeTouches[_i222]);}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
18501
+ 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 _i223=0,len=touches.length;_i223<len;++_i223){getCanvasPosFromEvent(touches[_i223],activeTouches[_i223]);}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
18500
18502
  if(touches.length===0&&changedTouches.length===1){if(tapStartTime>-1&&currentTime-tapStartTime<TAP_INTERVAL){if(lastTapTime>-1&&tapStartTime-lastTapTime<DBL_TAP_INTERVAL){// Double-tap
18501
18503
  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
18502
- 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 _i223=0,len=touches.length;_i223<len;++_i223){activeTouches[_i223][0]=touches[_i223].pageX;activeTouches[_i223][1]=touches[_i223].pageY;}// e.stopPropagation();
18504
+ 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 _i224=0,len=touches.length;_i224<len;++_i224){activeTouches[_i224][0]=touches[_i224].pageX;activeTouches[_i224][1]=touches[_i224].pageY;}// e.stopPropagation();
18503
18505
  },{passive:true});}_createClass(TouchPickHandler,[{key:"reset",value:function reset(){// TODO
18504
18506
  // tapStartTime = -1;
18505
18507
  // lastTapTime = -1;
@@ -19146,12 +19148,12 @@ _this110.navMode=cfg.navMode;if(cfg.planView){_this110.planView=cfg.planView;}_t
19146
19148
  *
19147
19149
  * @returns {{Number:Number}} Current key mappings.
19148
19150
  */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"
19149
- 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 _i224=0,len=keys.length;_i224<len;_i224++){var key=keys[_i224];if(!keyDownMap[key])return false;}return true;}},{key:"_isAnyOtherKeyDown",value:function _isAnyOtherKeyDown(keyDownMap,keyMap){for(var _i225=0,len=keyDownMap.length;_i225<len;_i225++){if(keyDownMap[_i225]){if(Array.isArray(keyMap)){if(keyMap.indexOf(_i225)<0)return true;}else if(_i225!==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;}}/**
19151
+ 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 _i225=0,len=keys.length;_i225<len;_i225++){var key=keys[_i225];if(!keyDownMap[key])return false;}return true;}},{key:"_isAnyOtherKeyDown",value:function _isAnyOtherKeyDown(keyDownMap,keyMap){for(var _i226=0,len=keyDownMap.length;_i226<len;_i226++){if(keyDownMap[_i226]){if(Array.isArray(keyMap)){if(keyMap.indexOf(_i226)<0)return true;}else if(_i226!==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;}}/**
19150
19152
  * Returns true if any keys configured for the given action are down.
19151
19153
  * @param action
19152
19154
  * @param keyDownMap
19153
19155
  * @private
19154
- */},{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 _i226=0,len=keys.length;_i226<len;_i226++){var key=keys[_i226];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;}/**
19156
+ */},{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 _i227=0,len=keys.length;_i227<len;_i227++){var key=keys[_i227];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;}/**
19155
19157
  * Sets the HTMl element to represent the pivot point when {@link CameraControl#followPointer} is true.
19156
19158
  *
19157
19159
  * See class comments for an example.
@@ -19273,7 +19275,7 @@ case"qwerty":keyMap[this.PAN_LEFT]=[input.KEY_A];keyMap[this.PAN_RIGHT]=[input.K
19273
19275
  *
19274
19276
  * @param {String} action To get the style for
19275
19277
  * @returns {String} style set on the cursor for action
19276
- */},{key:"getCursorStyle",value:function getCursorStyle(action){return this._cursors[action]||null;}},{key:"_reset",value:function _reset(){for(var _i227=0,len=this._handlers.length;_i227<len;_i227++){var handler=this._handlers[_i227];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:/**
19278
+ */},{key:"getCursorStyle",value:function getCursorStyle(action){return this._cursors[action]||null;}},{key:"_reset",value:function _reset(){for(var _i228=0,len=this._handlers.length;_i228<len;_i228++){var handler=this._handlers[_i228];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:/**
19277
19279
  * Sets whether the {@link Camera} follows the mouse/touch pointer.
19278
19280
  *
19279
19281
  * In orbiting mode, the Camera will orbit about the pointer, and will dolly to and from the pointer.
@@ -19414,7 +19416,7 @@ case"qwerty":keyMap[this.PAN_LEFT]=[input.KEY_A];keyMap[this.PAN_RIGHT]=[input.K
19414
19416
  * Does not apply when {@link CameraControl#navMode} is ````"planView"````, which disallows rotation.
19415
19417
  *
19416
19418
  * @param {Number} rotationInertia New inertial factor.
19417
- */,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 _i228=0,len=panKeyMap.length;_i228<len;_i228++){if(this._configs.panRightClick&&panKeyMap[_i228]===input.MOUSE_MIDDLE_BUTTON)this._keyMap[this.MOUSE_PAN][_i228]=input.MOUSE_RIGHT_BUTTON;else if(!this._configs.panRightClick&&panKeyMap[_i228]===input.MOUSE_RIGHT_BUTTON)this._keyMap[this.MOUSE_PAN][_i228]=input.MOUSE_MIDDLE_BUTTON;}}}},{key:"rotationInertia",get:/**
19419
+ */,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 _i229=0,len=panKeyMap.length;_i229<len;_i229++){if(this._configs.panRightClick&&panKeyMap[_i229]===input.MOUSE_MIDDLE_BUTTON)this._keyMap[this.MOUSE_PAN][_i229]=input.MOUSE_RIGHT_BUTTON;else if(!this._configs.panRightClick&&panKeyMap[_i229]===input.MOUSE_RIGHT_BUTTON)this._keyMap[this.MOUSE_PAN][_i229]=input.MOUSE_MIDDLE_BUTTON;}}}},{key:"rotationInertia",get:/**
19418
19420
  * Gets the rotation inertia factor.
19419
19421
  *
19420
19422
  * Default is ````0.0````.
@@ -19672,7 +19674,7 @@ value=value||"qwerty";if(value!=="qwerty"&&value!=="azerty"){this.error("Unsuppo
19672
19674
  */function get(){return this._configs.zoomOnMouseWheel;}/**
19673
19675
  * Destroys this ````CameraControl````.
19674
19676
  * @private
19675
- */,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 _i229=0,len=this._handlers.length;_i229<len;_i229++){var handler=this._handlers[_i229];if(handler.destroy){handler.destroy();}}}},{key:"_destroyControllers",value:function _destroyControllers(){for(var _i230=0,len=this._controllers.length;_i230<len;_i230++){var controller=this._controllers[_i230];if(controller.destroy){controller.destroy();}}}}]);return CameraControl;}(Component);/**
19677
+ */,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 _i230=0,len=this._handlers.length;_i230<len;_i230++){var handler=this._handlers[_i230];if(handler.destroy){handler.destroy();}}}},{key:"_destroyControllers",value:function _destroyControllers(){for(var _i231=0,len=this._controllers.length;_i231<len;_i231++){var controller=this._controllers[_i231];if(controller.destroy){controller.destroy();}}}}]);return CameraControl;}(Component);/**
19676
19678
  * @desc A property within a {@link PropertySet}.
19677
19679
  *
19678
19680
  * @class Property
@@ -19743,7 +19745,7 @@ value=value||"qwerty";if(value!=="qwerty"&&value!=="azerty"){this.error("Unsuppo
19743
19745
  *
19744
19746
  * @property properties
19745
19747
  * @type {Property[]}
19746
- */this.properties=[];if(params.properties){var properties=params.properties;for(var _i231=0,len=properties.length;_i231<len;_i231++){var property=properties[_i231];if(Number.isInteger(property)){// Will decompress in MetaModel.finalize();
19748
+ */this.properties=[];if(params.properties){var properties=params.properties;for(var _i232=0,len=properties.length;_i232<len;_i232++){var property=properties[_i232];if(Number.isInteger(property)){// Will decompress in MetaModel.finalize();
19747
19749
  this.properties.push(property);}else{this.properties.push(new Property(property.name,property.value,property.type,property.valueType,property.description));}}}});/**
19748
19750
  * @desc Metadata corresponding to an {@link Entity} that represents an object.
19749
19751
  *
@@ -19935,20 +19937,20 @@ this.properties.push(property);}else{this.properties.push(new Property(property.
19935
19937
  */_createClass(MetaModel,[{key:"rootMetaObject",get:function get(){if(this.rootMetaObjects.length===1){return this.rootMetaObjects[0];}return null;}/**
19936
19938
  * Load metamodel data into this MetaModel.
19937
19939
  * @param metaModelData
19938
- */},{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 _i232=0,len=propertyLookup.length;_i232<len;_i232++){this._propertyLookup.push(propertyLookup[_i232]);}}// Create global Property Sets
19939
- if(metaModelData.propertySets){for(var _i233=0,_len26=metaModelData.propertySets.length;_i233<_len26;_i233++){var propertySetData=metaModelData.propertySets[_i233];if(!propertySetData.properties){// HACK: https://github.com/Creoox/creoox-ifc2gltfcxconverter/issues/8
19940
- 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 _i234=0,_len27=metaModelData.metaObjects.length;_i234<_len27;_i234++){var metaObjectData=metaModelData.metaObjects[_i234];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 _i235=0,len=properties.length;_i235<len;_i235++){var property=properties[_i235];if(Number.isInteger(property)){var lookupProperty=propertyLookup[property];if(lookupProperty){properties[_i235]=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
19940
+ */},{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 _i233=0,len=propertyLookup.length;_i233<len;_i233++){this._propertyLookup.push(propertyLookup[_i233]);}}// Create global Property Sets
19941
+ if(metaModelData.propertySets){for(var _i234=0,_len26=metaModelData.propertySets.length;_i234<_len26;_i234++){var propertySetData=metaModelData.propertySets[_i234];if(!propertySetData.properties){// HACK: https://github.com/Creoox/creoox-ifc2gltfcxconverter/issues/8
19942
+ 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 _i235=0,_len27=metaModelData.metaObjects.length;_i235<_len27;_i235++){var metaObjectData=metaModelData.metaObjects[_i235];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 _i236=0,len=properties.length;_i236<len;_i236++){var property=properties[_i236];if(Number.isInteger(property)){var lookupProperty=propertyLookup[property];if(lookupProperty){properties[_i236]=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
19941
19943
  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
19942
- if(metaObject.propertySets){metaObject.propertySets=[];}if(metaObject.propertySetIds){for(var _i236=0,len=metaObject.propertySetIds.length;_i236<len;_i236++){var propertySetId=metaObject.propertySetIds[_i236];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
19944
+ if(metaObject.propertySets){metaObject.propertySets=[];}if(metaObject.propertySetIds){for(var _i237=0,len=metaObject.propertySetIds.length;_i237<len;_i237++){var propertySetId=metaObject.propertySetIds[_i237];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
19943
19945
  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
19944
19946
  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
19945
- if(this.propertySets){for(var _i237=0,_len28=this.propertySets.length;_i237<_len28;_i237++){var _propertySet=this.propertySets[_i237];this._decompressProperties(this._propertyLookup,_propertySet.properties);}}this._propertyLookup=[];this.finalized=true;this.metaScene.fire("metaModelCreated",this.id);}/**
19947
+ if(this.propertySets){for(var _i238=0,_len28=this.propertySets.length;_i238<_len28;_i238++){var _propertySet=this.propertySets[_i238];this._decompressProperties(this._propertyLookup,_propertySet.properties);}}this._propertyLookup=[];this.finalized=true;this.metaScene.fire("metaModelCreated",this.id);}/**
19946
19948
  * Gets this MetaModel as JSON.
19947
19949
  * @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: *[]}}
19948
- */},{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 _i238=0,len=metaObjectsList.length;_i238<len;_i238++){var metaObject=metaObjectsList[_i238];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 _i239=0,_len29=this.propertySets.length;_i239<_len29;_i239++){var propertySet=this.propertySets[_i239];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 _i240=0,len=metaModelData.metaObjects.length;_i240<len;_i240++){var metaObjectData=metaModelData.metaObjects[_i240];// Globalize MetaObject IDs and parent IDs
19950
+ */},{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 _i239=0,len=metaObjectsList.length;_i239<len;_i239++){var metaObject=metaObjectsList[_i239];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 _i240=0,_len29=this.propertySets.length;_i240<_len29;_i240++){var propertySet=this.propertySets[_i240];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 _i241=0,len=metaModelData.metaObjects.length;_i241<len;_i241++){var metaObjectData=metaModelData.metaObjects[_i241];// Globalize MetaObject IDs and parent IDs
19949
19951
  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
19950
19952
  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
19951
- if(metaModelData.propertySets){for(var _i241=0,_len30=metaModelData.propertySets.length;_i241<_len30;_i241++){var propertySet=metaModelData.propertySets[_i241];propertySet.originalSystemId=propertySet.id;if(globalize){propertySet.id=math.globalizeObjectId(this.id,propertySet.id);}}}}}]);return MetaModel;}();/**
19953
+ if(metaModelData.propertySets){for(var _i242=0,_len30=metaModelData.propertySets.length;_i242<_len30;_i242++){var propertySet=metaModelData.propertySets[_i242];propertySet.originalSystemId=propertySet.id;if(globalize){propertySet.id=math.globalizeObjectId(this.id,propertySet.id);}}}}}]);return MetaModel;}();/**
19952
19954
  * @desc Metadata corresponding to a {@link Scene}.
19953
19955
  *
19954
19956
  * * Located in {@link Viewer#metaScene}.
@@ -19997,7 +19999,7 @@ if(metaModelData.propertySets){for(var _i241=0,_len30=metaModelData.propertySets
19997
19999
  *
19998
20000
  * @param {String} event Event name
19999
20001
  * @param {Object} value Event parameters
20000
- */},{key:"fire",value:function fire(event,value){var subs=this._eventSubs[event];if(subs){for(var _i242=0,len=subs.length;_i242<len;_i242++){subs[_i242](value);}}}/**
20002
+ */},{key:"fire",value:function fire(event,value){var subs=this._eventSubs[event];if(subs){for(var _i243=0,len=subs.length;_i243<len;_i243++){subs[_i243](value);}}}/**
20001
20003
  * Unsubscribes from an event fired at this Viewer.
20002
20004
  * @param event
20003
20005
  */},{key:"off",value:function off(event){// TODO
@@ -20026,12 +20028,12 @@ metaScene:this,id:modelId,projectId:metaModelData.projectId||"none",revisionId:m
20026
20028
  *
20027
20029
  * @param {String} metaModelId ID of the target {@link MetaModel}.
20028
20030
  */},{key:"destroyMetaModel",value:function destroyMetaModel(metaModelId){var metaModel=this.metaModels[metaModelId];if(!metaModel){return;}// Remove global PropertySets
20029
- if(metaModel.propertySets){for(var _i243=0,len=metaModel.propertySets.length;_i243<len;_i243++){var propertySet=metaModel.propertySets[_i243];if(propertySet.metaModels.length===1&&propertySet.metaModels[0].id===metaModelId){// Property set owned only by this model, delete
20031
+ if(metaModel.propertySets){for(var _i244=0,len=metaModel.propertySets.length;_i244<len;_i244++){var propertySet=metaModel.propertySets[_i244];if(propertySet.metaModels.length===1&&propertySet.metaModels[0].id===metaModelId){// Property set owned only by this model, delete
20030
20032
  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
20031
20033
  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
20032
20034
  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
20033
20035
  for(var _objectId5 in this.metaObjects){var _metaObject5=this.metaObjects[_objectId5];if(_metaObject5.children){_metaObject5.children=[];}// Re-link each MetaObject's property sets
20034
- if(_metaObject5.propertySets){_metaObject5.propertySets=[];}if(_metaObject5.propertySetIds){for(var _i244=0,_len31=_metaObject5.propertySetIds.length;_i244<_len31;_i244++){var propertySetId=_metaObject5.propertySetIds[_i244];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
20036
+ if(_metaObject5.propertySets){_metaObject5.propertySets=[];}if(_metaObject5.propertySetIds){for(var _i245=0,_len31=_metaObject5.propertySetIds.length;_i245<_len31;_i245++){var propertySetId=_metaObject5.propertySetIds[_i245];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
20035
20037
  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);}/**
20036
20038
  * Gets the {@link MetaObject#id}s of the {@link MetaObject}s that have the given {@link MetaObject#type}.
20037
20039
  *
@@ -20397,19 +20399,19 @@ math.mulMat4v4(camera.viewMatrix,p,p);math.mulMat4v4(camera.projMatrix,p,p);};va
20397
20399
  // Calculate the interpolation factor t where the line segment crosses the near plane
20398
20400
  var _delta=math.subVec4(p1,p0,tmpVec4c);math.mulVec4Scalar(_delta,t,_delta);math.addVec4(p0,_delta,p0Behind?p0:p1);}// normalize clip space coords
20399
20401
  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
20400
- for(var _i245=0;_i245<2;++_i245){var denom=p1[_i245]-p0[_i245];var l=(-p0[3]-p0[_i245])/denom;var r=(p0[3]-p0[_i245])/denom;if(denom>0){t_min=Math.max(t_min,l);t_max=Math.min(t_max,r);}else{t_min=Math.max(t_min,r);t_max=Math.min(t_max,l);}}if(t_min>=t_max){return false;}// Calculate the clipped start and end points
20402
+ for(var _i246=0;_i246<2;++_i246){var denom=p1[_i246]-p0[_i246];var l=(-p0[3]-p0[_i246])/denom;var r=(p0[3]-p0[_i246])/denom;if(denom>0){t_min=Math.max(t_min,l);t_max=Math.min(t_max,r);}else{t_min=Math.max(t_min,r);t_max=Math.min(t_max,l);}}if(t_min>=t_max){return false;}// Calculate the clipped start and end points
20401
20403
  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 _super60=_createSuper(Dot3D);function Dot3D(scene,markerCfg,parentElement){var _this114;var cfg=arguments.length>3&&arguments[3]!==undefined?arguments[3]:{};_classCallCheck(this,Dot3D);var camera=scene.camera;_this114=_super60.call(this,scene,markerCfg);_this114.__visible=true;// "__" to not interfere with Marker::_visible
20402
20404
  var handler=function handler(cfgEvent,componentEvent){return function(event){if(cfgEvent){cfgEvent(event);}_this114.fire(componentEvent,event,true);};};_this114._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
20403
20405
  p.set(worldPos);p[3]=1;// to clip space
20404
20406
  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(!_this114.__visible){return;}var p0=tmpVec4c;toClipSpace(_this114.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,_this114.worldPos,tmpVec3a$2))>0;});_this114._dot.setCulled(culled);if(!culled){toCanvasSpace(p0);_this114._dot.setPos(p0[0],p0[1]);}};_this114.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);_this114._updatePosition=updateDotPos;_this114._cleanup=function(){camera.off(onViewMatrix);camera.off(onProjMatrix);scene.canvas.off(onCanvasBnd);scene.off(planesUpdate);scene.off(planeCreated);scene.off(planeDestroyed);_this114._dot.destroy();};return _this114;}_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 _this115=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,_this115._start,tmpVec4a);math.mulVec4Scalar(tmpVec4a,1.0/tmpVec4a[3]);toCanvasSpace(scene.canvas.canvas,parentElement,tmpVec4a,tmpVec2a);_this115._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);_this115._label.setPos(p0[0],p0[1]+yOff);};this._updatePosBetween=function(){var visibleA=clipSegment(scene,parentElement,_this115._start,_this115._mid,tmpVec2a,tmpVec2b);var visibleB=clipSegment(scene,parentElement,_this115._end,_this115._mid,tmpVec2c,tmpVec2d);_this115._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);_this115._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,_this115._start,_this115._end,tmpVec2a,tmpVec2b)&&math.distVec2(tmpVec2a,tmpVec2b)>=_this115._labelMinAxisLength;_this115._label.setCulled(!visible);if(visible){setPosOnWire(tmpVec2a,tmpVec2b,_this115._yOff);}};var posUpdate=function posUpdate(){};this._setUpdatePositions=function(_posUpdate){posUpdate=_posUpdate;_this115._updatePositions();};this._updatePositions=function(){if(_this115.__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);_this115._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 _this116=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(!_this116.__visible){return;}var visible=clipSegment(scene,parentElement,_this116._start,_this116._end,tmpVec2a,tmpVec2b);_this116._wire.setCulled(!visible);if(visible){_this116._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);_this116._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?
20405
20407
  });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});
20406
- 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 _i246=0;_i246<planeCoords.length;++_i246){polygonVertices.push(_i246);}var isCCW=function(){var ba=math.vec2();var bc=math.vec2();var anglesSum=0;for(var _i247=0;_i247<polygonVertices.length;++_i247){var _a5=planeCoords[polygonVertices[_i247]];var b=planeCoords[polygonVertices[(_i247+1)%polygonVertices.length]];var c=planeCoords[polygonVertices[(_i247+2)%polygonVertices.length]];math.subVec2(_a5,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 _loop10=function _loop10(){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
20408
+ 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 _i247=0;_i247<planeCoords.length;++_i247){polygonVertices.push(_i247);}var isCCW=function(){var ba=math.vec2();var bc=math.vec2();var anglesSum=0;for(var _i248=0;_i248<polygonVertices.length;++_i248){var _a5=planeCoords[polygonVertices[_i248]];var b=planeCoords[polygonVertices[(_i248+1)%polygonVertices.length]];var c=planeCoords[polygonVertices[(_i248+2)%polygonVertices.length]];math.subVec2(_a5,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 _loop10=function _loop10(){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
20407
20409
  &&vertices.every(// no other vertices inside
20408
20410
  function(vv){return vv===v||vv===v.prev||vv===v.next||!pointInTriangle(planeCoords[vv.idx],a,b,c);}))return"break";++earIdx;};while(true){var _ret2=_loop10();if(_ret2==="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});
20409
20411
  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
20410
20412
  // clockwise
20411
20413
  // counterclockwise
20412
- 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 _i248=s;_i248<pos2D.length-2-1+s;++_i248){var c=pos2D[_i248];var d=pos2D[_i248+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
20414
+ 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 _i249=s;_i249<pos2D.length-2-1+s;++_i249){var c=pos2D[_i249];var d=pos2D[_i249+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
20413
20415
  o1===0&&onSegment(a,c,b)||// a, b and c are collinear and c lies on segment ab
20414
20416
  o2===0&&onSegment(a,d,b)||// a, b and d are collinear and d lies on segment ab
20415
20417
  o3===0&&onSegment(c,a,d)||// c, d and a are collinear and a lies on segment cd
@@ -20531,7 +20533,7 @@ doublePickFlyTo:true});this._plugins=[];/**
20531
20533
  *
20532
20534
  * @param {String} event Event name
20533
20535
  * @param {Object} value Event parameters
20534
- */},{key:"fire",value:function fire(event,value){var subs=this._eventSubs[event];if(subs){for(var _i249=0,len=subs.length;_i249<len;_i249++){subs[_i249](value);}}}/**
20536
+ */},{key:"fire",value:function fire(event,value){var subs=this._eventSubs[event];if(subs){for(var _i250=0,len=subs.length;_i250<len;_i250++){subs[_i250](value);}}}/**
20535
20537
  * Unsubscribes from an event fired at this Viewer.
20536
20538
  * @param event
20537
20539
  */},{key:"off",value:function off(event){// TODO
@@ -20551,12 +20553,12 @@ doublePickFlyTo:true});this._plugins=[];/**
20551
20553
  * Uninstalls a Plugin, clearing content from it first.
20552
20554
  *
20553
20555
  * @private
20554
- */},{key:"removePlugin",value:function removePlugin(plugin){for(var _i250=0,len=this._plugins.length;_i250<len;_i250++){var _p3=this._plugins[_i250];if(_p3===plugin){if(_p3.clear){_p3.clear();}this._plugins.splice(_i250,1);return;}}}/**
20556
+ */},{key:"removePlugin",value:function removePlugin(plugin){for(var _i251=0,len=this._plugins.length;_i251<len;_i251++){var _p3=this._plugins[_i251];if(_p3===plugin){if(_p3.clear){_p3.clear();}this._plugins.splice(_i251,1);return;}}}/**
20555
20557
  * Sends a message to installed Plugins.
20556
20558
  *
20557
20559
  * The message can optionally be accompanied by a value.
20558
20560
  * @private
20559
- */},{key:"sendToPlugins",value:function sendToPlugins(name,value){for(var _i251=0,len=this._plugins.length;_i251<len;_i251++){var _p4=this._plugins[_i251];if(_p4.send){_p4.send(name,value);}}}/**
20561
+ */},{key:"sendToPlugins",value:function sendToPlugins(name,value){for(var _i252=0,len=this._plugins.length;_i252<len;_i252++){var _p4=this._plugins[_i252];if(_p4.send){_p4.send(name,value);}}}/**
20560
20562
  * @private
20561
20563
  * @deprecated
20562
20564
  */},{key:"clear",value:function clear(){throw"Viewer#clear() no longer implemented - use '#sendToPlugins(\"clear\") instead";}/**
@@ -20613,7 +20615,7 @@ this.scene.fire("rendering",{},true);return this._renderSnapshotToCanvas(params)
20613
20615
  * @param {String} [params.format="jpeg"] Desired format; "jpeg", "png" or "bmp".
20614
20616
  * @param {Boolean} [params.includeGizmos=false] When true, will include gizmos like {@link SectionPlane} in the snapshot.
20615
20617
  * @returns {Promise} Promise which returns a string-encoded image data URI.
20616
- */},{key:"getSnapshotWithPlugins",value:function(){var _getSnapshotWithPlugins=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(){var _style$sheet;var params,snapshotResult,pluginToCapture,pluginContainerElements,_i252,len,plugin,containerElement,style,snapshotCanvas,_i253,_len32,_containerElement,_args=arguments;return _regeneratorRuntime().wrap(function _callee$(_context2){while(1){switch(_context2.prev=_context2.next){case 0:params=_args.length>0&&_args[0]!==undefined?_args[0]:{};// We use gl.readPixels to get the WebGL canvas snapshot in a new
20618
+ */},{key:"getSnapshotWithPlugins",value:function(){var _getSnapshotWithPlugins=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(){var _style$sheet;var params,snapshotResult,pluginToCapture,pluginContainerElements,_i253,len,plugin,containerElement,style,snapshotCanvas,_i254,_len32,_containerElement,_args=arguments;return _regeneratorRuntime().wrap(function _callee$(_context2){while(1){switch(_context2.prev=_context2.next){case 0:params=_args.length>0&&_args[0]!==undefined?_args[0]:{};// We use gl.readPixels to get the WebGL canvas snapshot in a new
20617
20619
  // HTMLCanvas element, scaled to the target snapshot size, then
20618
20620
  // use html2canvas to render each plugin's container element into
20619
20621
  // that HTMLCanvas. Finally, we save the HTMLCanvas to a bitmap.
@@ -20622,20 +20624,20 @@ this.scene.fire("rendering",{},true);return this._renderSnapshotToCanvas(params)
20622
20624
  // blurring. Instead, we manage the scale and redraw of the WebGL
20623
20625
  // canvas ourselves, in order to allow the Viewer to render the
20624
20626
  // right amount of pixels, for a sharper image.
20625
- snapshotResult=this._renderSnapshotToCanvas(params);pluginToCapture={};pluginContainerElements=[];for(_i252=0,len=this._plugins.length;_i252<len;_i252++){// Find plugin container elements
20626
- plugin=this._plugins[_i252];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)
20627
+ snapshotResult=this._renderSnapshotToCanvas(params);pluginToCapture={};pluginContainerElements=[];for(_i253=0,len=this._plugins.length;_i253<len;_i253++){// Find plugin container elements
20628
+ plugin=this._plugins[_i253];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)
20627
20629
  // based on https://github.com/niklasvh/html2canvas/issues/2775#issuecomment-1316356991
20628
- 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;_i253=0,_len32=pluginContainerElements.length;case 10:if(!(_i253<_len32)){_context2.next=18;break;}_containerElement=pluginContainerElements[_i253];_context2.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
20630
+ 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;_i254=0,_len32=pluginContainerElements.length;case 10:if(!(_i254<_len32)){_context2.next=18;break;}_containerElement=pluginContainerElements[_i254];_context2.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
20629
20631
  // by the html2canvas call (inside the ForeignObjectRenderer's constructor)
20630
20632
  // (implemented to compensate XCD-153 issue)
20631
- snapshotCanvas.getContext("2d").resetTransform();case 15:_i253++;_context2.next=10;break;case 18:style.remove();return _context2.abrupt("return",snapshotResult.toDataURL());case 20:case"end":return _context2.stop();}}},_callee,this);}));function getSnapshotWithPlugins(){return _getSnapshotWithPlugins.apply(this,arguments);}return getSnapshotWithPlugins;}()/**
20633
+ snapshotCanvas.getContext("2d").resetTransform();case 15:_i254++;_context2.next=10;break;case 18:style.remove();return _context2.abrupt("return",snapshotResult.toDataURL());case 20:case"end":return _context2.stop();}}},_callee,this);}));function getSnapshotWithPlugins(){return _getSnapshotWithPlugins.apply(this,arguments);}return getSnapshotWithPlugins;}()/**
20632
20634
  * Exits snapshot mode.
20633
20635
  *
20634
20636
  * Switches rendering back to the main canvas.
20635
20637
  *
20636
20638
  */},{key:"endSnapshot",value:function endSnapshot(){if(this._snapshotBegun){this.scene._renderer.snapshot.endSnapshot();this._snapshotBegun=false;}}/** Destroys this Viewer.
20637
20639
  */},{key:"destroy",value:function destroy(){var plugins=this._plugins.slice();// Array will modify as we delete plugins
20638
- for(var _i254=0,len=plugins.length;_i254<len;_i254++){var plugin=plugins[_i254];plugin.destroy();}this.scene.destroy();}}]);return Viewer;}();/**
20640
+ for(var _i255=0,len=plugins.length;_i255<len;_i255++){var plugin=plugins[_i255];plugin.destroy();}this.scene.destroy();}}]);return Viewer;}();/**
20639
20641
  * @param {Component} scene
20640
20642
  * @param {*} [cfg] Texture configuration
20641
20643
  * @param {String[]} [cfg.src=null] Path to 6 images
@@ -21218,7 +21220,7 @@ primitive:"triangles",positions:[1,1,1,-1,1,1,-1,-1,1,1,-1,1,// v0-v1-v2-v3 fron
21218
21220
  * Shows all or hides the angle label of each {@link AngleMeasurement}.
21219
21221
  *
21220
21222
  * @param {Boolean} labelsShown Whether or not to show the labels.
21221
- */},{key:"setLabelsShown",value:function setLabelsShown(labelsShown){for(var _i255=0,_Object$entries=Object.entries(this.measurements);_i255<_Object$entries.length;_i255++){var _Object$entries$_i=_slicedToArray(_Object$entries[_i255],2),key=_Object$entries$_i[0],measurement=_Object$entries$_i[1];measurement.labelShown=labelsShown;}}/**
21223
+ */},{key:"setLabelsShown",value:function setLabelsShown(labelsShown){for(var _i256=0,_Object$entries=Object.entries(this.measurements);_i256<_Object$entries.length;_i256++){var _Object$entries$_i=_slicedToArray(_Object$entries[_i256],2),key=_Object$entries$_i[0],measurement=_Object$entries$_i[1];measurement.labelShown=labelsShown;}}/**
21222
21224
  * Destroys all {@link AngleMeasurement}s.
21223
21225
  */},{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]);}}/**
21224
21226
  * Destroys this AngleMeasurementsPlugin.
@@ -21943,7 +21945,7 @@ geometry:arrowShaft,material:zAxisMaterial,pickable:false,collidable:false,visib
21943
21945
  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 _this132;}/** Shows or hides this AxisGizmoPlugin.
21944
21946
  *
21945
21947
  * @param visible
21946
- */_createClass(AxisGizmoPlugin,[{key:"setVisible",value:function setVisible(visible){for(var _i256=0;_i256<this._meshes.length;_i256++){this._meshes[_i256].visible=visible;}}/**
21948
+ */_createClass(AxisGizmoPlugin,[{key:"setVisible",value:function setVisible(visible){for(var _i257=0;_i257<this._meshes.length;_i257++){this._meshes[_i257].visible=visible;}}/**
21947
21949
  * Destroys this AxisGizmoPlugin.
21948
21950
  */},{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();/**
21949
21951
  * {@link Viewer} plugin that saves and loads BCF viewpoints as JSON objects.
@@ -22280,11 +22282,11 @@ var lookDirection=math.normalizeVec3(math.subVec3(camera.look,camera.eye,math.ve
22280
22282
  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
22281
22283
  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
22282
22284
  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
22283
- 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 _i257=0,len=indices.length/2;_i257<len;_i257++){var _a6=indices[_i257*2];var b=indices[_i257*2+1];bcfViewpoint.lines.push({start_point:{x:positions[_a6*3+0],y:positions[_a6*3+1],z:positions[_a6*3+2]},end_point:{x:positions[b*3+0],y:positions[b*3+1],z:positions[b*3+2]}});}}}// Bitmaps
22285
+ 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 _i258=0,len=indices.length/2;_i258<len;_i258++){var _a6=indices[_i258*2];var b=indices[_i258*2+1];bcfViewpoint.lines.push({start_point:{x:positions[_a6*3+0],y:positions[_a6*3+1],z:positions[_a6*3+2]},end_point:{x:positions[b*3+0],y:positions[b*3+1],z:positions[b*3+2]}});}}}// Bitmaps
22284
22286
  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
22285
22287
  _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
22286
22288
  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
22287
- 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:_this134.originatingSystem};if(originalSystemId!==objectId){component.authoring_tool_id=objectId;}coloringMap[color].push(component);return coloringMap;},{});var coloringArray=Object.entries(coloringMap).map(function(_ref11){var _ref12=_slicedToArray(_ref11,2),color=_ref12[0],components=_ref12[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 _i258=0,len=objectIds.length;_i258<len;_i258++){var objectId=objectIds[_i258];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;}/**
22289
+ 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:_this134.originatingSystem};if(originalSystemId!==objectId){component.authoring_tool_id=objectId;}coloringMap[color].push(component);return coloringMap;},{});var coloringArray=Object.entries(coloringMap).map(function(_ref11){var _ref12=_slicedToArray(_ref11,2),color=_ref12[0],components=_ref12[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 _i259=0,len=objectIds.length;_i259<len;_i259++){var objectId=objectIds[_i259];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;}/**
22288
22290
  * Sets viewer state to the given BCF viewpoint.
22289
22291
  *
22290
22292
  * Note that xeokit's {@link Camera#look} is the **point-of-interest**, whereas the BCF ````camera_direction```` is a
@@ -22306,7 +22308,7 @@ alpha=0.1;}else{alpha=scene.xrayMaterial.fillAlpha;}alpha=Math.round(alpha*255).
22306
22308
  * @param {Boolean} [options.reverseClippingPlanes=false] When ````true````, clipping planes are reversed (https://github.com/buildingSMART/BCF-XML/issues/193)
22307
22309
  * @param {Boolean} [options.updateCompositeObjects=false] When ````true````, then when visibility and selection updates refer to composite objects (eg. an IfcBuildingStorey),
22308
22310
  * then this method will apply the updates to objects within those composites.
22309
- */},{key:"setViewpoint",value:function setViewpoint(bcfViewpoint){var _this135=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 _i259=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(_i259++);indices.push(_i259++);});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"
22311
+ */},{key:"setViewpoint",value:function setViewpoint(bcfViewpoint){var _this135=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 _i260=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(_i260++);indices.push(_i260++);});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"
22310
22312
  var bitmap_data=e.bitmap_data;// base64
22311
22313
  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 _this135._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 _this135._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 _this135._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 _this135._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 _this135._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
22312
22314
  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);}}});}}/**
@@ -23018,11 +23020,11 @@ origin:eye,direction:look});look=hit?hit.worldPos:math.addVec3(eye,look,tempVec3
23018
23020
  * Shows all or hides the distance label of each {@link DistanceMeasurement}.
23019
23021
  *
23020
23022
  * @param {Boolean} labelsShown Whether or not to show the labels.
23021
- */},{key:"setLabelsShown",value:function setLabelsShown(labelsShown){for(var _i260=0,_Object$entries2=Object.entries(this.measurements);_i260<_Object$entries2.length;_i260++){var _Object$entries2$_i=_slicedToArray(_Object$entries2[_i260],2),key=_Object$entries2$_i[0],measurement=_Object$entries2$_i[1];measurement.labelShown=labelsShown;}}/**
23023
+ */},{key:"setLabelsShown",value:function setLabelsShown(labelsShown){for(var _i261=0,_Object$entries2=Object.entries(this.measurements);_i261<_Object$entries2.length;_i261++){var _Object$entries2$_i=_slicedToArray(_Object$entries2[_i261],2),key=_Object$entries2$_i[0],measurement=_Object$entries2$_i[1];measurement.labelShown=labelsShown;}}/**
23022
23024
  * Shows all or hides the axis wires of each {@link DistanceMeasurement}.
23023
23025
  *
23024
23026
  * @param {Boolean} labelsShown Whether or not to show the axis wires.
23025
- */},{key:"setAxisVisible",value:function setAxisVisible(axisVisible){for(var _i261=0,_Object$entries3=Object.entries(this.measurements);_i261<_Object$entries3.length;_i261++){var _Object$entries3$_i=_slicedToArray(_Object$entries3[_i261],2),key=_Object$entries3$_i[0],measurement=_Object$entries3$_i[1];measurement.axisVisible=axisVisible;}this.defaultAxisVisible=axisVisible;}/**
23027
+ */},{key:"setAxisVisible",value:function setAxisVisible(axisVisible){for(var _i262=0,_Object$entries3=Object.entries(this.measurements);_i262<_Object$entries3.length;_i262++){var _Object$entries3$_i=_slicedToArray(_Object$entries3[_i262],2),key=_Object$entries3$_i[0],measurement=_Object$entries3$_i[1];measurement.axisVisible=axisVisible;}this.defaultAxisVisible=axisVisible;}/**
23026
23028
  * Gets if the axis wires of each {@link DistanceMeasurement} are visible.
23027
23029
  *
23028
23030
  * @returns {Boolean} Whether or not the axis wires are visible.
@@ -23531,7 +23533,7 @@ function createLog(){var log=new Log({id:'loaders.gl'});globalThis.loaders=globa
23531
23533
  * @param newOptions
23532
23534
  * @returns
23533
23535
  */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)
23534
- if(level>3){return newOptions;}var options=_objectSpread({},baseOptions);for(var _i262=0,_Object$entries4=Object.entries(newOptions);_i262<_Object$entries4.length;_i262++){var _Object$entries4$_i=_slicedToArray(_Object$entries4[_i262],2),key=_Object$entries4$_i[0],newValue=_Object$entries4$_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]);
23536
+ if(level>3){return newOptions;}var options=_objectSpread({},baseOptions);for(var _i263=0,_Object$entries4=Object.entries(newOptions);_i263<_Object$entries4.length;_i263++){var _Object$entries4$_i=_slicedToArray(_Object$entries4[_i263],2),key=_Object$entries4$_i[0],newValue=_Object$entries4$_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]);
23535
23537
  }else{options[key]=newOptions[key];}}return options;}// loaders.gl
23536
23538
  /**
23537
23539
  * Register application-imported modules
@@ -23858,14 +23860,14 @@ return getMagicString$2(data.buffer,data.byteOffset,length);}else if(data instan
23858
23860
  * @param byteOffset
23859
23861
  * @param length
23860
23862
  * @returns
23861
- */function getMagicString$2(arrayBuffer,byteOffset,length){if(arrayBuffer.byteLength<=byteOffset+length){return'';}var dataView=new DataView(arrayBuffer);var magic='';for(var _i263=0;_i263<length;_i263++){magic+=String.fromCharCode(dataView.getUint8(byteOffset+_i263));}return magic;}/**
23863
+ */function getMagicString$2(arrayBuffer,byteOffset,length){if(arrayBuffer.byteLength<=byteOffset+length){return'';}var dataView=new DataView(arrayBuffer);var magic='';for(var _i264=0;_i264<length;_i264++){magic+=String.fromCharCode(dataView.getUint8(byteOffset+_i264));}return magic;}/**
23862
23864
  * Minimal JSON parser that throws more meaningful error messages
23863
23865
  */function parseJSON(string){try{return JSON.parse(string);}catch(_){throw new Error("Failed to parse JSON from data starting with \"".concat(getFirstCharacters$1(string),"\""));}}/**
23864
23866
  * compare two binary arrays for equality
23865
23867
  * @param a
23866
23868
  * @param b
23867
23869
  * @param byteLength
23868
- */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 _i264=0;_i264<array1.length;++_i264){if(array1[_i264]!==array2[_i264]){return false;}}return true;}/**
23870
+ */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 _i265=0;_i265<array1.length;++_i265){if(array1[_i265]!==array2[_i265]){return false;}}return true;}/**
23869
23871
  * Concatenate a sequence of ArrayBuffers from arguments
23870
23872
  * @return A concatenated ArrayBuffer
23871
23873
  */function concatenateArrayBuffers(){for(var _len33=arguments.length,sources=new Array(_len33),_key4=0;_key4<_len33;_key4++){sources[_key4]=arguments[_key4];}return concatenateArrayBuffersFromArray(sources);}/**
@@ -24022,7 +24024,7 @@ response=new Response(resource,{headers:headers});// We can't control `Response.
24022
24024
  Object.defineProperty(response,'url',{value:url});return _context32.abrupt("return",response);case 16:case"end":return _context32.stop();}}},_callee28);}));return _makeResponse.apply(this,arguments);}function checkResponse(_x29){return _checkResponse.apply(this,arguments);}// HELPERS
24023
24025
  function _checkResponse(){_checkResponse=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee29(response){var _error3;return _regeneratorRuntime().wrap(function _callee29$(_context33){while(1){switch(_context33.prev=_context33.next){case 0:if(response.ok){_context33.next=5;break;}_context33.next=3;return getResponseError(response);case 3:_error3=_context33.sent;throw _error3;case 5:case"end":return _context33.stop();}}},_callee29);}));return _checkResponse.apply(this,arguments);}function getResponseError(_x30){return _getResponseError.apply(this,arguments);}function _getResponseError(){_getResponseError=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee30(response){var shortUrl,message,info,contentType;return _regeneratorRuntime().wrap(function _callee30$(_context34){while(1){switch(_context34.prev=_context34.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
24024
24026
  _context34.prev=4;contentType=response.headers.get('Content-Type');if(!(!response.bodyUsed&&contentType!==null&&contentType!==void 0&&contentType.includes('application/json'))){_context34.next=12;break;}_context34.next=9;return response.json();case 9:_context34.t0=_context34.sent;_context34.next=15;break;case 12:_context34.next=14;return response.text();case 14:_context34.t0=_context34.sent;case 15:info.reason=_context34.t0;_context34.next=20;break;case 18:_context34.prev=18;_context34.t1=_context34["catch"](4);case 20:return _context34.abrupt("return",new FetchError(message,info));case 21:case"end":return _context34.stop();}}},_callee30,null,[[4,18]]);}));return _getResponseError.apply(this,arguments);}function getInitialDataUrl(_x31){return _getInitialDataUrl.apply(this,arguments);}// https://stackoverflow.com/questions/9267899/arraybuffer-to-base64-encoded-string
24025
- function _getInitialDataUrl(){_getInitialDataUrl=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee31(resource){var INITIAL_DATA_LENGTH,blobSlice,slice,_base;return _regeneratorRuntime().wrap(function _callee31$(_context35){while(1){switch(_context35.prev=_context35.next){case 0:INITIAL_DATA_LENGTH=5;if(!(typeof resource==='string')){_context35.next=3;break;}return _context35.abrupt("return","data:,".concat(resource.slice(0,INITIAL_DATA_LENGTH)));case 3:if(!(resource instanceof Blob)){_context35.next=8;break;}blobSlice=resource.slice(0,5);_context35.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 _context35.abrupt("return",_context35.sent);case 8:if(!(resource instanceof ArrayBuffer)){_context35.next=12;break;}slice=resource.slice(0,INITIAL_DATA_LENGTH);_base=arrayBufferToBase64(slice);return _context35.abrupt("return","data:base64,".concat(_base));case 12:return _context35.abrupt("return",null);case 13:case"end":return _context35.stop();}}},_callee31);}));return _getInitialDataUrl.apply(this,arguments);}function arrayBufferToBase64(buffer){var binary='';var bytes=new Uint8Array(buffer);for(var _i265=0;_i265<bytes.byteLength;_i265++){binary+=String.fromCharCode(bytes[_i265]);}return btoa(binary);}// loaders.gl
24027
+ function _getInitialDataUrl(){_getInitialDataUrl=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee31(resource){var INITIAL_DATA_LENGTH,blobSlice,slice,_base;return _regeneratorRuntime().wrap(function _callee31$(_context35){while(1){switch(_context35.prev=_context35.next){case 0:INITIAL_DATA_LENGTH=5;if(!(typeof resource==='string')){_context35.next=3;break;}return _context35.abrupt("return","data:,".concat(resource.slice(0,INITIAL_DATA_LENGTH)));case 3:if(!(resource instanceof Blob)){_context35.next=8;break;}blobSlice=resource.slice(0,5);_context35.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 _context35.abrupt("return",_context35.sent);case 8:if(!(resource instanceof ArrayBuffer)){_context35.next=12;break;}slice=resource.slice(0,INITIAL_DATA_LENGTH);_base=arrayBufferToBase64(slice);return _context35.abrupt("return","data:base64,".concat(_base));case 12:return _context35.abrupt("return",null);case 13:case"end":return _context35.stop();}}},_callee31);}));return _getInitialDataUrl.apply(this,arguments);}function arrayBufferToBase64(buffer){var binary='';var bytes=new Uint8Array(buffer);for(var _i266=0;_i266<bytes.byteLength;_i266++){binary+=String.fromCharCode(bytes[_i266]);}return btoa(binary);}// loaders.gl
24026
24028
  // import {FetchError} from './fetch-error';
24027
24029
  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:');}/**
24028
24030
  * fetch API compatible function
@@ -24161,7 +24163,7 @@ if(compareMIMETypes(mimeType,"application/x.".concat(loader.id))){return loader;
24161
24163
  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)
24162
24164
  }}catch(err){_iterator15.e(err);}finally{_iterator15.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
24163
24165
  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
24164
- 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 _i266=0;_i266<length;_i266++){magic+=String.fromCharCode(dataView.getUint8(byteOffset+_i266));}return magic;}// loaders.gl
24166
+ 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 _i267=0;_i267<length;_i267++){magic+=String.fromCharCode(dataView.getUint8(byteOffset+_i267));}return magic;}// loaders.gl
24165
24167
  // SPDX-License-Identifier: MIT
24166
24168
  // Copyright (c) vis.gl contributors
24167
24169
  var DEFAULT_CHUNK_SIZE$2=256*1024;/**
@@ -24332,7 +24334,7 @@ throw new Error("".concat(loader.id," loader - no parser found and worker is dis
24332
24334
  * @param attributes
24333
24335
  * @returns array of two vectors representing the axis aligned bounding box
24334
24336
  */ // eslint-disable-next-line complexity
24335
- 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 _i267=0;_i267<len;_i267+=3){var x=positions[_i267];var y=positions[_i267+1];var _z4=positions[_i267+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
24337
+ 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 _i268=0;_i268<len;_i268+=3){var x=positions[_i268];var y=positions[_i268+1];var _z4=positions[_i268+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
24336
24338
  /**
24337
24339
  * Create a schema for mesh attributes data
24338
24340
  * @param attributes
@@ -24460,7 +24462,7 @@ return decodeMajorBrand(buffer);}/**
24460
24462
  // return {ext: '3gp', mime: 'video/3gpp'};
24461
24463
  // }
24462
24464
  // return {ext: 'mp4', mime: 'video/mp4'};
24463
- }/** 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 _i268=0;_i268<headerBytes.length;++_i268){if(headerBytes[_i268]!==buffer[_i268+offset]){return false;}}return true;}// Attributions
24465
+ }/** 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 _i269=0;_i269<headerBytes.length;++_i269){if(headerBytes[_i269]!==buffer[_i269+offset]){return false;}}return true;}// Attributions
24464
24466
  var BIG_ENDIAN=false;var LITTLE_ENDIAN$1=true;/**
24465
24467
  * Extracts `{mimeType, width and height}` from a memory buffer containing a known image format
24466
24468
  * Currently supports `image/png`, `image/jpeg`, `image/bmp` and `image/gif`.
@@ -24493,7 +24495,7 @@ width:dataView.getUint16(i+7,BIG_ENDIAN)// Number of pixels per line
24493
24495
  if(!tableMarkers.has(marker)){return null;}// Length includes size of length parameter but not the two byte header.
24494
24496
  i+=2;i+=dataView.getUint16(i,BIG_ENDIAN);}return null;}function getJpegMarkers(){// Tables/misc header markers.
24495
24497
  // DQT, DHT, DAC, DRI, COM, APP_n
24496
- var tableMarkers=new Set([0xffdb,0xffc4,0xffcc,0xffdd,0xfffe]);for(var _i269=0xffe0;_i269<0xfff0;++_i269){tableMarkers.add(_i269);}// SOF markers and DHP marker.
24498
+ var tableMarkers=new Set([0xffdb,0xffc4,0xffcc,0xffdd,0xfffe]);for(var _i270=0xffe0;_i270<0xfff0;++_i270){tableMarkers.add(_i270);}// SOF markers and DHP marker.
24497
24499
  // These markers are after tables/misc data.
24498
24500
  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?
24499
24501
  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?
@@ -24563,7 +24565,7 @@ var _getAccessorArrayType=getAccessorArrayTypeAndLength(gltfAccessor,bufferView)
24563
24565
  var elementByteSize=componentByteSize*numberOfComponentsInElement;var elementAddressScale=bufferView.byteStride||elementByteSize;// Creare an array of component's type where all components (not just elements) will reside
24564
24566
  if(typeof bufferView.byteStride==='undefined'||bufferView.byteStride===elementByteSize){// No iterleaving
24565
24567
  var _result3=new ArrayType(arrayBuffer,byteOffset,length);return _result3;}// Iterleaving
24566
- var result=new ArrayType(length);for(var _i270=0;_i270<gltfAccessor.count;_i270++){var values=new ArrayType(arrayBuffer,byteOffset+_i270*elementAddressScale,numberOfComponentsInElement);result.set(values,_i270*numberOfComponentsInElement);}return result;}// loaders.gl
24568
+ var result=new ArrayType(length);for(var _i271=0;_i271<gltfAccessor.count;_i271++){var values=new ArrayType(arrayBuffer,byteOffset+_i271*elementAddressScale,numberOfComponentsInElement);result.set(values,_i271*numberOfComponentsInElement);}return result;}// loaders.gl
24567
24569
  function makeDefaultGLTFJson(){return{asset:{version:'2.0',generator:'loaders.gl'},buffers:[],extensions:{},extensionsRequired:[],extensionsUsed:[]};}/**
24568
24570
  * Class for structured access to GLTF data
24569
24571
  */var GLTFScenegraph=/*#__PURE__*/function(){// internal
@@ -25046,9 +25048,9 @@ return getEnumsArray(valuesData,0,numberOfElements,enumEntry);}/**
25046
25048
  * @param count - Values length to parse.
25047
25049
  * @param enumEntry - Enums dictionary.
25048
25050
  * @returns Array of strings with parsed ENUM names.
25049
- */function getEnumsArray(valuesData,offset,count,enumEntry){var array=[];for(var _i271=0;_i271<count;_i271++){// At the moment we don't support BigInt. It requires additional calculations logic
25051
+ */function getEnumsArray(valuesData,offset,count,enumEntry){var array=[];for(var _i272=0;_i272<count;_i272++){// At the moment we don't support BigInt. It requires additional calculations logic
25050
25052
  // and might be an issue in Safari
25051
- if(valuesData instanceof BigInt64Array||valuesData instanceof BigUint64Array){array.push('');}else{var value=valuesData[offset+_i271];var enumObject=getEnumByValue(enumEntry,value);if(enumObject){array.push(enumObject.name);}else{array.push('');}}}return array;}/**
25053
+ if(valuesData instanceof BigInt64Array||valuesData instanceof BigUint64Array){array.push('');}else{var value=valuesData[offset+_i272];var enumObject=getEnumByValue(enumEntry,value);if(enumObject){array.push(enumObject.name);}else{array.push('');}}}return array;}/**
25052
25054
  * Looks up ENUM whose `value` property matches the specified number in the parameter `value`.
25053
25055
  * @param {GLTF_EXT_structural_metadata_Enum} enumEntry - ENUM entry containing the array of possible enums.
25054
25056
  * @param {number} value - The value of the ENUM to locate.
@@ -25066,7 +25068,7 @@ var count=0;var schemaClass=(_schema$classes2=schema.classes)===null||_schema$cl
25066
25068
  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);
25067
25069
  if(!table.properties){table.properties={};}// values is a required field. Its real value will be set while encoding data
25068
25070
  table.properties[attribute.name]={values:0,data:attribute.values};}}}catch(err){_iterator33.e(err);}finally{_iterator33.f();}table.count=count;return table;}function createPropertyTableProperty(// attribute: PropertyAttribute,
25069
- 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 _iterator34=_createForOfIteratorHelper(array),_step34;try{for(_iterator34.s();!(_step34=_iterator34.n()).done;){var value=_step34.value;numberArray.push(Number(value));}}catch(err){_iterator34.e(err);}finally{_iterator34.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 _iterator35=_createForOfIteratorHelper(strings),_step35;try{for(_iterator35.s();!(_step35=_iterator35.n()).done;){var _str=_step35.value;var uint8Array=utf8Encode.encode(_str);len+=uint8Array.length;arr.push(uint8Array);}}catch(err){_iterator35.e(err);}finally{_iterator35.f();}var strArray=new Uint8Array(len);var strOffsets=[];var offset=0;for(var _i272=0,_arr2=arr;_i272<_arr2.length;_i272++){var str=_arr2[_i272];strArray.set(str,offset);strOffsets.push(offset);offset+=str.length;}strOffsets.push(offset);// The last offset represents the byte offset after the last string.
25071
+ 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 _iterator34=_createForOfIteratorHelper(array),_step34;try{for(_iterator34.s();!(_step34=_iterator34.n()).done;){var value=_step34.value;numberArray.push(Number(value));}}catch(err){_iterator34.e(err);}finally{_iterator34.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 _iterator35=_createForOfIteratorHelper(strings),_step35;try{for(_iterator35.s();!(_step35=_iterator35.n()).done;){var _str=_step35.value;var uint8Array=utf8Encode.encode(_str);len+=uint8Array.length;arr.push(uint8Array);}}catch(err){_iterator35.e(err);}finally{_iterator35.f();}var strArray=new Uint8Array(len);var strOffsets=[];var offset=0;for(var _i273=0,_arr2=arr;_i273<_arr2.length;_i273++){var str=_arr2[_i273];strArray.set(str,offset);strOffsets.push(offset);offset+=str.length;}strOffsets.push(offset);// The last offset represents the byte offset after the last string.
25070
25072
  var stringOffsetsTypedArray=new Uint32Array(strOffsets);// Its length = len+1
25071
25073
  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$a,decode:decode$8,encode:encode$4,createExtStructuralMetadata:createExtStructuralMetadata});/** Extension name */var EXT_FEATURE_METADATA_NAME='EXT_feature_metadata';var name$9=EXT_FEATURE_METADATA_NAME;function decode$7(_x64,_x65){return _decode$3.apply(this,arguments);}/**
25072
25074
  * Decodes feature metadata from extension.
@@ -25356,7 +25358,7 @@ NONE:'',OCTAHEDRAL:'meshopt_decodeFilterOct',QUATERNION:'meshopt_decodeFilterQua
25356
25358
  ATTRIBUTES:'meshopt_decodeVertexBuffer',TRIANGLES:'meshopt_decodeIndexBuffer',INDICES:'meshopt_decodeIndexSequence'};// eslint-disable-next-line max-params
25357
25359
  function meshoptDecodeGltfBuffer(_x72,_x73,_x74,_x75,_x76){return _meshoptDecodeGltfBuffer.apply(this,arguments);}function _meshoptDecodeGltfBuffer(){_meshoptDecodeGltfBuffer=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee51(target,count,size,source,mode){var filter,instance,_args54=arguments;return _regeneratorRuntime().wrap(function _callee51$(_context55){while(1){switch(_context55.prev=_context55.next){case 0:filter=_args54.length>5&&_args54[5]!==undefined?_args54[5]:'NONE';_context55.next=3;return loadWasmInstance();case 3:instance=_context55.sent;decode$6(instance,instance.exports[DECODERS[mode]],target,count,size,source,instance.exports[FILTERS[filter||'NONE']]);case 5:case"end":return _context55.stop();}}},_callee51);}));return _meshoptDecodeGltfBuffer.apply(this,arguments);}var wasmPromise;function loadWasmInstance(){return _loadWasmInstance.apply(this,arguments);}function _loadWasmInstance(){_loadWasmInstance=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee52(){return _regeneratorRuntime().wrap(function _callee52$(_context56){while(1){switch(_context56.prev=_context56.next){case 0:// eslint-disable-next-line
25358
25360
  if(!wasmPromise){wasmPromise=loadWasmModule();}return _context56.abrupt("return",wasmPromise);case 2:case"end":return _context56.stop();}}},_callee52);}));return _loadWasmInstance.apply(this,arguments);}function loadWasmModule(){return _loadWasmModule.apply(this,arguments);}function _loadWasmModule(){_loadWasmModule=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee53(){var wasm,result;return _regeneratorRuntime().wrap(function _callee53$(_context57){while(1){switch(_context57.prev=_context57.next){case 0:wasm=wasm_base;if(WebAssembly.validate(detector)){wasm=wasm_simd;// eslint-disable-next-line no-console
25359
- console.log('Warning: meshopt_decoder is using experimental SIMD support');}_context57.next=4;return WebAssembly.instantiate(unpack(wasm),{});case 4:result=_context57.sent;_context57.next=7;return result.instance.exports.__wasm_call_ctors();case 7:return _context57.abrupt("return",result.instance);case 8:case"end":return _context57.stop();}}},_callee53);}));return _loadWasmModule.apply(this,arguments);}function unpack(data){var result=new Uint8Array(data.length);for(var _i273=0;_i273<data.length;++_i273){var ch=data.charCodeAt(_i273);result[_i273]=ch>96?ch-71:ch>64?ch-65:ch>47?ch+4:ch>46?63:62;}var write=0;for(var _i274=0;_i274<data.length;++_i274){result[write++]=result[_i274]<60?wasmpack[result[_i274]]:(result[_i274]-60)*64+result[++_i274];}return result.buffer.slice(0,write);}// eslint-disable-next-line max-params
25361
+ console.log('Warning: meshopt_decoder is using experimental SIMD support');}_context57.next=4;return WebAssembly.instantiate(unpack(wasm),{});case 4:result=_context57.sent;_context57.next=7;return result.instance.exports.__wasm_call_ctors();case 7:return _context57.abrupt("return",result.instance);case 8:case"end":return _context57.stop();}}},_callee53);}));return _loadWasmModule.apply(this,arguments);}function unpack(data){var result=new Uint8Array(data.length);for(var _i274=0;_i274<data.length;++_i274){var ch=data.charCodeAt(_i274);result[_i274]=ch>96?ch-71:ch>64?ch-65:ch>47?ch+4:ch>46?63:62;}var write=0;for(var _i275=0;_i275<data.length;++_i275){result[write++]=result[_i275]<60?wasmpack[result[_i275]]:(result[_i275]-60)*64+result[++_i275];}return result.buffer.slice(0,write);}// eslint-disable-next-line max-params
25360
25362
  function decode$6(instance,fun,target,count,size,source,filter){var sbrk=instance.exports.sbrk;var count4=count+3&~3;// pad for SIMD filter
25361
25363
  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$8=EXT_MESHOPT_COMPRESSION;function decode$5(_x77,_x78){return _decode$4.apply(this,arguments);}/** Decode one meshopt buffer view */function _decode$4(){_decode$4=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee54(gltfData,options){var _options$gltf8,_options$gltf9;var scenegraph,promises,_iterator71,_step71,bufferViewIndex;return _regeneratorRuntime().wrap(function _callee54$(_context58){while(1){switch(_context58.prev=_context58.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))){_context58.next=3;break;}return _context58.abrupt("return");case 3:promises=[];_iterator71=_createForOfIteratorHelper(gltfData.json.bufferViews||[]);try{for(_iterator71.s();!(_step71=_iterator71.n()).done;){bufferViewIndex=_step71.value;promises.push(decodeMeshoptBufferView(scenegraph,bufferViewIndex));}// Decompress meshes in parallel
25362
25364
  }catch(err){_iterator71.e(err);}finally{_iterator71.f();}_context58.next=8;return Promise.all(promises);case 8:// We have now decompressed all primitives, so remove the top-level extension
@@ -25418,7 +25420,7 @@ if(dracoGeometry instanceof this.draco.Mesh){switch(options.topology){case'trian
25418
25420
  attributes:attributes,indices:{value:this._getTriangleStripIndices(dracoGeometry),size:1}};case'triangle-list':default:return{topology:'triangle-list',mode:5,// GL.TRIANGLE_STRIP
25419
25421
  attributes:attributes,indices:{value:this._getTriangleListIndices(dracoGeometry),size:1}};}}// PointCloud - must come last as Mesh inherits from PointCloud
25420
25422
  return{topology:'point-list',mode:0,// GL.POINTS
25421
- attributes:attributes};}},{key:"_getMeshAttributes",value:function _getMeshAttributes(loaderData,dracoGeometry,options){var attributes={};for(var _i275=0,_Object$values=Object.values(loaderData.attributes);_i275<_Object$values.length;_i275++){var loaderAttribute=_Object$values[_i275];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
25423
+ attributes:attributes};}},{key:"_getMeshAttributes",value:function _getMeshAttributes(loaderData,dracoGeometry,options){var attributes={};for(var _i276=0,_Object$values=Object.values(loaderData.attributes);_i276<_Object$values.length;_i276++){var loaderAttribute=_Object$values[_i276];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
25422
25424
  /**
25423
25425
  * For meshes, we need indices to define the faces.
25424
25426
  * @param dracoGeometry
@@ -25455,7 +25457,7 @@ console.warn("DRACO: Unsupported attribute type ".concat(attribute.data_type));r
25455
25457
  * types
25456
25458
  * @param attributeData
25457
25459
  */},{key:"_deduceAttributeName",value:function _deduceAttributeName(attribute,options){// Deduce name based on application provided map
25458
- var uniqueId=attribute.unique_id;for(var _i276=0,_Object$entries5=Object.entries(options.extraAttributes||{});_i276<_Object$entries5.length;_i276++){var _Object$entries5$_i=_slicedToArray(_Object$entries5[_i276],2),attributeName=_Object$entries5$_i[0],attributeUniqueId=_Object$entries5$_i[1];if(attributeUniqueId===uniqueId){return attributeName;}}// Deduce name based on attribute type
25460
+ var uniqueId=attribute.unique_id;for(var _i277=0,_Object$entries5=Object.entries(options.extraAttributes||{});_i277<_Object$entries5.length;_i277++){var _Object$entries5$_i=_slicedToArray(_Object$entries5[_i277],2),attributeName=_Object$entries5$_i[0],attributeUniqueId=_Object$entries5$_i[1];if(attributeUniqueId===uniqueId){return attributeName;}}// Deduce name based on attribute type
25459
25461
  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
25460
25462
  // (e.g. multiple TEX_COORDS or COLORS)
25461
25463
  return DRACO_TO_GLTF_ATTRIBUTE_NAME_MAP[dracoAttributeConstant];}}// Look up in metadata
@@ -25482,9 +25484,9 @@ this.metadataQuerier.GetIntEntryArray(dracoMetadata,entryName,dracoArray);var in
25482
25484
  * @returns draco specific data type
25483
25485
  */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;}}/**
25484
25486
  * Copy a Draco int32 array into a JS typed array
25485
- */function getInt32Array(dracoArray){var numValues=dracoArray.size();var intArray=new Int32Array(numValues);for(var _i277=0;_i277<numValues;_i277++){intArray[_i277]=dracoArray.GetValue(_i277);}return intArray;}/**
25487
+ */function getInt32Array(dracoArray){var numValues=dracoArray.size();var intArray=new Int32Array(numValues);for(var _i278=0;_i278<numValues;_i278++){intArray[_i278]=dracoArray.GetValue(_i278);}return intArray;}/**
25486
25488
  * Copy a Draco int32 array into a JS typed array
25487
- */function getUint32Array(dracoArray){var numValues=dracoArray.size();var intArray=new Int32Array(numValues);for(var _i278=0;_i278<numValues;_i278++){intArray[_i278]=dracoArray.GetValue(_i278);}return intArray;}// Dynamic DRACO module loading inspired by THREE.DRACOLoader
25489
+ */function getUint32Array(dracoArray){var numValues=dracoArray.size();var intArray=new Int32Array(numValues);for(var _i279=0;_i279<numValues;_i279++){intArray[_i279]=dracoArray.GetValue(_i279);}return intArray;}// Dynamic DRACO module loading inspired by THREE.DRACOLoader
25488
25490
  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(_x81){return _loadDracoDecoderModule.apply(this,arguments);}// DRACO DECODER LOADING
25489
25491
  function _loadDracoDecoderModule(){_loadDracoDecoderModule=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee56(options){var modules;return _regeneratorRuntime().wrap(function _callee56$(_context60){while(1){switch(_context60.prev=_context60.next){case 0:modules=options.modules||{};// Check if a bundled draco3d library has been supplied by application
25490
25492
  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
@@ -25527,12 +25529,12 @@ scenegraph.addRequiredExtension(KHR_DRACO_MESH_COMPRESSION);}}catch(err){_iterat
25527
25529
  function decompressPrimitive(_x88,_x89,_x90,_x91){return _decompressPrimitive.apply(this,arguments);}// ENCODE
25528
25530
  // eslint-disable-next-line max-len
25529
25531
  // Only TRIANGLES: 0x0004 and TRIANGLE_STRIP: 0x0005 are supported
25530
- function _decompressPrimitive(){_decompressPrimitive=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee60(scenegraph,primitive,options,context){var dracoExtension,buffer,bufferCopy,dracoOptions,decodedData,decodedAttributes,_i423,_Object$entries9,_Object$entries9$_i,attributeName,decodedAttribute,accessorIndex,accessor;return _regeneratorRuntime().wrap(function _callee60$(_context64){while(1){switch(_context64.prev=_context64.next){case 0:dracoExtension=scenegraph.getObjectExtension(primitive,KHR_DRACO_MESH_COMPRESSION);if(dracoExtension){_context64.next=3;break;}return _context64.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
25532
+ function _decompressPrimitive(){_decompressPrimitive=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee60(scenegraph,primitive,options,context){var dracoExtension,buffer,bufferCopy,dracoOptions,decodedData,decodedAttributes,_i424,_Object$entries9,_Object$entries9$_i,attributeName,decodedAttribute,accessorIndex,accessor;return _regeneratorRuntime().wrap(function _callee60$(_context64){while(1){switch(_context64.prev=_context64.next){case 0:dracoExtension=scenegraph.getObjectExtension(primitive,KHR_DRACO_MESH_COMPRESSION);if(dracoExtension){_context64.next=3;break;}return _context64.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
25531
25533
  // TODO - remove when `parse` is fixed to handle `byteOffset`s
25532
25534
  bufferCopy=sliceArrayBuffer(buffer.buffer,buffer.byteOffset);// , buffer.byteLength);
25533
25535
  dracoOptions=_objectSpread({},options);// TODO - remove hack: The entire tileset might be included, too expensive to serialize
25534
25536
  delete dracoOptions['3d-tiles'];_context64.next=9;return parseFromContext(bufferCopy,DracoLoader,dracoOptions,context);case 9:decodedData=_context64.sent;decodedAttributes=getGLTFAccessors(decodedData.attributes);// Restore min/max values
25535
- for(_i423=0,_Object$entries9=Object.entries(decodedAttributes);_i423<_Object$entries9.length;_i423++){_Object$entries9$_i=_slicedToArray(_Object$entries9[_i423],2),attributeName=_Object$entries9$_i[0],decodedAttribute=_Object$entries9$_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
25537
+ for(_i424=0,_Object$entries9=Object.entries(decodedAttributes);_i424<_Object$entries9.length;_i424++){_Object$entries9$_i=_slicedToArray(_Object$entries9[_i424],2),attributeName=_Object$entries9$_i[0],decodedAttribute=_Object$entries9$_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
25536
25538
  primitive.attributes=decodedAttributes;if(decodedData.indices){// @ts-ignore
25537
25539
  primitive.indices=getGLTFAccessor(decodedData.indices);}// Extension has been processed, delete it
25538
25540
  scenegraph.removeObjectExtension(primitive,KHR_DRACO_MESH_COMPRESSION);checkPrimitive(primitive);case 16:case"end":return _context64.stop();}}},_callee60);}));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...
@@ -25566,8 +25568,8 @@ return"".concat(parseFloat(value.toPrecision(precision)));}/**
25566
25568
  * @param b
25567
25569
  * @param epsilon
25568
25570
  * @returns
25569
- */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 _i279=0;_i279<a.length;++_i279){// eslint-disable-next-line max-depth
25570
- if(!_equals(a[_i279],b[_i279])){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
25571
+ */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 _i280=0;_i280<a.length;++_i280){// eslint-disable-next-line max-depth
25572
+ if(!_equals(a[_i280],b[_i280])){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
25571
25573
  function round(value){return Math.round(value/config.EPSILON)*config.EPSILON;}// math.gl
25572
25574
  /** Base class for vectors and matrices */var MathArray=/*#__PURE__*/function(_Array){_inherits(MathArray,_Array);var _super83=_createSuper(MathArray);function MathArray(){_classCallCheck(this,MathArray);return _super83.apply(this,arguments);}_createClass(MathArray,[{key:"clone",value:// Common methods
25573
25575
  /**
@@ -25575,20 +25577,20 @@ function round(value){return Math.round(value/config.EPSILON)*config.EPSILON;}//
25575
25577
  * @returns a new copy of this object
25576
25578
  */function clone(){// @ts-expect-error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature.
25577
25579
  return new this.constructor().copy(this);// eslint-disable-line
25578
- }},{key:"fromArray",value:function fromArray(array){var offset=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0;for(var _i280=0;_i280<this.ELEMENTS;++_i280){this[_i280]=array[_i280+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 _i281=0;_i281<this.ELEMENTS;++_i281){targetArray[offset+_i281]=this[_i281];}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
25580
+ }},{key:"fromArray",value:function fromArray(array){var offset=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0;for(var _i281=0;_i281<this.ELEMENTS;++_i281){this[_i281]=array[_i281+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 _i282=0;_i282<this.ELEMENTS;++_i282){targetArray[offset+_i282]=this[_i282];}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
25579
25581
  this.fromObject(arrayOrObject);}},{key:"to",value:function to(arrayOrObject){// @ts-ignore
25580
25582
  if(arrayOrObject===this){return this;}// @ts-expect-error TS2339: Property 'toObject' does not exist on type 'MathArray'.
25581
- 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 _i282=0;_i282<this.ELEMENTS;++_i282){string+=(_i282>0?', ':'')+formatValue(this[_i282],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 _i283=0;_i283<this.ELEMENTS;++_i283){if(!_equals(this[_i283],array[_i283])){return false;}}return true;}},{key:"exactEquals",value:function exactEquals(array){if(!array||this.length!==array.length){return false;}for(var _i284=0;_i284<this.ELEMENTS;++_i284){if(this[_i284]!==array[_i284]){return false;}}return true;}// Modifiers
25582
- /** Negates all values in this object */},{key:"negate",value:function negate(){for(var _i285=0;_i285<this.ELEMENTS;++_i285){this[_i285]=-this[_i285];}return this.check();}},{key:"lerp",value:function lerp(a,b,t){if(t===undefined){return this.lerp(this,a,b);}for(var _i286=0;_i286<this.ELEMENTS;++_i286){var ai=a[_i286];var endValue=typeof b==='number'?b:b[_i286];this[_i286]=ai+t*(endValue-ai);}return this.check();}/** Minimal */},{key:"min",value:function min(vector){for(var _i287=0;_i287<this.ELEMENTS;++_i287){this[_i287]=Math.min(vector[_i287],this[_i287]);}return this.check();}/** Maximal */},{key:"max",value:function max(vector){for(var _i288=0;_i288<this.ELEMENTS;++_i288){this[_i288]=Math.max(vector[_i288],this[_i288]);}return this.check();}},{key:"clamp",value:function clamp(minVector,maxVector){for(var _i289=0;_i289<this.ELEMENTS;++_i289){this[_i289]=Math.min(Math.max(this[_i289],minVector[_i289]),maxVector[_i289]);}return this.check();}},{key:"add",value:function add(){for(var _len38=arguments.length,vectors=new Array(_len38),_key9=0;_key9<_len38;_key9++){vectors[_key9]=arguments[_key9];}for(var _i290=0,_vectors=vectors;_i290<_vectors.length;_i290++){var vector=_vectors[_i290];for(var _i291=0;_i291<this.ELEMENTS;++_i291){this[_i291]+=vector[_i291];}}return this.check();}},{key:"subtract",value:function subtract(){for(var _len39=arguments.length,vectors=new Array(_len39),_key10=0;_key10<_len39;_key10++){vectors[_key10]=arguments[_key10];}for(var _i292=0,_vectors2=vectors;_i292<_vectors2.length;_i292++){var vector=_vectors2[_i292];for(var _i293=0;_i293<this.ELEMENTS;++_i293){this[_i293]-=vector[_i293];}}return this.check();}},{key:"scale",value:function scale(_scale3){if(typeof _scale3==='number'){for(var _i294=0;_i294<this.ELEMENTS;++_i294){this[_i294]*=_scale3;}}else{for(var _i295=0;_i295<this.ELEMENTS&&_i295<_scale3.length;++_i295){this[_i295]*=_scale3[_i295];}}return this.check();}/**
25583
+ 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 _i283=0;_i283<this.ELEMENTS;++_i283){string+=(_i283>0?', ':'')+formatValue(this[_i283],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 _i284=0;_i284<this.ELEMENTS;++_i284){if(!_equals(this[_i284],array[_i284])){return false;}}return true;}},{key:"exactEquals",value:function exactEquals(array){if(!array||this.length!==array.length){return false;}for(var _i285=0;_i285<this.ELEMENTS;++_i285){if(this[_i285]!==array[_i285]){return false;}}return true;}// Modifiers
25584
+ /** Negates all values in this object */},{key:"negate",value:function negate(){for(var _i286=0;_i286<this.ELEMENTS;++_i286){this[_i286]=-this[_i286];}return this.check();}},{key:"lerp",value:function lerp(a,b,t){if(t===undefined){return this.lerp(this,a,b);}for(var _i287=0;_i287<this.ELEMENTS;++_i287){var ai=a[_i287];var endValue=typeof b==='number'?b:b[_i287];this[_i287]=ai+t*(endValue-ai);}return this.check();}/** Minimal */},{key:"min",value:function min(vector){for(var _i288=0;_i288<this.ELEMENTS;++_i288){this[_i288]=Math.min(vector[_i288],this[_i288]);}return this.check();}/** Maximal */},{key:"max",value:function max(vector){for(var _i289=0;_i289<this.ELEMENTS;++_i289){this[_i289]=Math.max(vector[_i289],this[_i289]);}return this.check();}},{key:"clamp",value:function clamp(minVector,maxVector){for(var _i290=0;_i290<this.ELEMENTS;++_i290){this[_i290]=Math.min(Math.max(this[_i290],minVector[_i290]),maxVector[_i290]);}return this.check();}},{key:"add",value:function add(){for(var _len38=arguments.length,vectors=new Array(_len38),_key9=0;_key9<_len38;_key9++){vectors[_key9]=arguments[_key9];}for(var _i291=0,_vectors=vectors;_i291<_vectors.length;_i291++){var vector=_vectors[_i291];for(var _i292=0;_i292<this.ELEMENTS;++_i292){this[_i292]+=vector[_i292];}}return this.check();}},{key:"subtract",value:function subtract(){for(var _len39=arguments.length,vectors=new Array(_len39),_key10=0;_key10<_len39;_key10++){vectors[_key10]=arguments[_key10];}for(var _i293=0,_vectors2=vectors;_i293<_vectors2.length;_i293++){var vector=_vectors2[_i293];for(var _i294=0;_i294<this.ELEMENTS;++_i294){this[_i294]-=vector[_i294];}}return this.check();}},{key:"scale",value:function scale(_scale3){if(typeof _scale3==='number'){for(var _i295=0;_i295<this.ELEMENTS;++_i295){this[_i295]*=_scale3;}}else{for(var _i296=0;_i296<this.ELEMENTS&&_i296<_scale3.length;++_i296){this[_i296]*=_scale3[_i296];}}return this.check();}/**
25583
25585
  * Multiplies all elements by `scale`
25584
25586
  * Note: `Matrix4.multiplyByScalar` only scales its 3x3 "minor"
25585
- */},{key:"multiplyByScalar",value:function multiplyByScalar(scalar){for(var _i296=0;_i296<this.ELEMENTS;++_i296){this[_i296]*=scalar;}return this.check();}// Debug checks
25586
- /** 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 _i297=0;_i297<this.ELEMENTS;++_i297){valid=valid&&Number.isFinite(this[_i297]);}return valid;}// three.js compatibility
25587
- /** @deprecated */},{key:"sub",value:function sub(a){return this.subtract(a);}/** @deprecated */},{key:"setScalar",value:function setScalar(a){for(var _i298=0;_i298<this.ELEMENTS;++_i298){this[_i298]=a;}return this.check();}/** @deprecated */},{key:"addScalar",value:function addScalar(a){for(var _i299=0;_i299<this.ELEMENTS;++_i299){this[_i299]+=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
25587
+ */},{key:"multiplyByScalar",value:function multiplyByScalar(scalar){for(var _i297=0;_i297<this.ELEMENTS;++_i297){this[_i297]*=scalar;}return this.check();}// Debug checks
25588
+ /** 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 _i298=0;_i298<this.ELEMENTS;++_i298){valid=valid&&Number.isFinite(this[_i298]);}return valid;}// three.js compatibility
25589
+ /** @deprecated */},{key:"sub",value:function sub(a){return this.subtract(a);}/** @deprecated */},{key:"setScalar",value:function setScalar(a){for(var _i299=0;_i299<this.ELEMENTS;++_i299){this[_i299]=a;}return this.check();}/** @deprecated */},{key:"addScalar",value:function addScalar(a){for(var _i300=0;_i300<this.ELEMENTS;++_i300){this[_i300]+=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
25588
25590
  // `Matrix4.scale` only scales its 3x3 "minor"
25589
- for(var _i300=0;_i300<this.ELEMENTS;++_i300){this[_i300]*=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 _i301=0;_i301<this.ELEMENTS;++_i301){this[_i301]=Math.min(Math.max(this[_i301],min),max);}return this.check();}/** @deprecated */},{key:"elements",get:function get(){return this;}}]);return MathArray;}(/*#__PURE__*/_wrapNativeSuper(Array));// math.gl
25591
+ for(var _i301=0;_i301<this.ELEMENTS;++_i301){this[_i301]*=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 _i302=0;_i302<this.ELEMENTS;++_i302){this[_i302]=Math.min(Math.max(this[_i302],min),max);}return this.check();}/** @deprecated */},{key:"elements",get:function get(){return this;}}]);return MathArray;}(/*#__PURE__*/_wrapNativeSuper(Array));// math.gl
25590
25592
  function validateVector(v,length){if(v.length!==length){return false;}// Could be arguments "array" (v.every not availasble)
25591
- for(var _i302=0;_i302<v.length;++_i302){if(!Number.isFinite(v[_i302])){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
25593
+ for(var _i303=0;_i303<v.length;++_i303){if(!Number.isFinite(v[_i303])){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
25592
25594
  // SPDX-License-Identifier: MIT
25593
25595
  // Copyright (c) vis.gl contributors
25594
25596
  function assert(condition,message){if(!condition){throw new Error("math.gl assertion ".concat(message));}}// math.gl
@@ -25602,10 +25604,10 @@ function get(){return this[0];},set:function set(value){this[0]=checkNumber(valu
25602
25604
  * Returns the length of the vector from the origin to the point described by this vector
25603
25605
  */},{key:"magnitude",value:function magnitude(){return this.len();}/**
25604
25606
  * Returns the squared length of the vector from the origin to the point described by this vector
25605
- */},{key:"lengthSquared",value:function lengthSquared(){var length=0;for(var _i303=0;_i303<this.ELEMENTS;++_i303){length+=this[_i303]*this[_i303];}return length;}/**
25607
+ */},{key:"lengthSquared",value:function lengthSquared(){var length=0;for(var _i304=0;_i304<this.ELEMENTS;++_i304){length+=this[_i304]*this[_i304];}return length;}/**
25606
25608
  * Returns the squared length of the vector from the origin to the point described by this vector
25607
- */},{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 _i304=0;_i304<this.ELEMENTS;++_i304){var dist=this[_i304]-mathArray[_i304];length+=dist*dist;}return checkNumber(length);}},{key:"dot",value:function dot(mathArray){var product=0;for(var _i305=0;_i305<this.ELEMENTS;++_i305){product+=this[_i305]*mathArray[_i305];}return checkNumber(product);}// MODIFIERS
25608
- },{key:"normalize",value:function normalize(){var length=this.magnitude();if(length!==0){for(var _i306=0;_i306<this.ELEMENTS;++_i306){this[_i306]/=length;}}return this.check();}},{key:"multiply",value:function multiply(){for(var _len40=arguments.length,vectors=new Array(_len40),_key11=0;_key11<_len40;_key11++){vectors[_key11]=arguments[_key11];}for(var _i307=0,_vectors3=vectors;_i307<_vectors3.length;_i307++){var vector=_vectors3[_i307];for(var _i308=0;_i308<this.ELEMENTS;++_i308){this[_i308]*=vector[_i308];}}return this.check();}},{key:"divide",value:function divide(){for(var _len41=arguments.length,vectors=new Array(_len41),_key12=0;_key12<_len41;_key12++){vectors[_key12]=arguments[_key12];}for(var _i309=0,_vectors4=vectors;_i309<_vectors4.length;_i309++){var vector=_vectors4[_i309];for(var _i310=0;_i310<this.ELEMENTS;++_i310){this[_i310]/=vector[_i310];}}return this.check();}// THREE.js compatibility
25609
+ */},{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 _i305=0;_i305<this.ELEMENTS;++_i305){var dist=this[_i305]-mathArray[_i305];length+=dist*dist;}return checkNumber(length);}},{key:"dot",value:function dot(mathArray){var product=0;for(var _i306=0;_i306<this.ELEMENTS;++_i306){product+=this[_i306]*mathArray[_i306];}return checkNumber(product);}// MODIFIERS
25610
+ },{key:"normalize",value:function normalize(){var length=this.magnitude();if(length!==0){for(var _i307=0;_i307<this.ELEMENTS;++_i307){this[_i307]/=length;}}return this.check();}},{key:"multiply",value:function multiply(){for(var _len40=arguments.length,vectors=new Array(_len40),_key11=0;_key11<_len40;_key11++){vectors[_key11]=arguments[_key11];}for(var _i308=0,_vectors3=vectors;_i308<_vectors3.length;_i308++){var vector=_vectors3[_i308];for(var _i309=0;_i309<this.ELEMENTS;++_i309){this[_i309]*=vector[_i309];}}return this.check();}},{key:"divide",value:function divide(){for(var _len41=arguments.length,vectors=new Array(_len41),_key12=0;_key12<_len41;_key12++){vectors[_key12]=arguments[_key12];}for(var _i310=0,_vectors4=vectors;_i310<_vectors4.length;_i310++){var vector=_vectors4[_i310];for(var _i311=0;_i311<this.ELEMENTS;++_i311){this[_i311]/=vector[_i311];}}return this.check();}// THREE.js compatibility
25609
25611
  },{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.
25610
25612
  return this.add(new this.constructor(a).multiplyScalar(b));}}]);return Vector;}(MathArray);// @eslint-disable
25611
25613
  var ARRAY_TYPE=typeof Float32Array!=='undefined'?Float32Array:Array;// @eslint-disable
@@ -25765,9 +25767,9 @@ _this154[0]=x;_this154[1]=y;_this154[2]=z;}return _this154;}_createClass(Vector3
25765
25767
  // return object;
25766
25768
  // }
25767
25769
  // TODO better override formatString?
25768
- 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 _i311=0;_i311<this.ELEMENTS;++_i311){string+=" ".concat(this[_i311]);}}string+=']';return string;}},{key:"getElementIndex",value:function getElementIndex(row,col){return col*this.RANK+row;}// By default assumes row major indices
25770
+ 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 _i312=0;_i312<this.ELEMENTS;++_i312){string+=" ".concat(this[_i312]);}}string+=']';return string;}},{key:"getElementIndex",value:function getElementIndex(row,col){return col*this.RANK+row;}// By default assumes row major indices
25769
25771
  },{key:"getElement",value:function getElement(row,col){return this[col*this.RANK+row];}// By default assumes row major indices
25770
- },{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 _i312=0;_i312<this.RANK;++_i312){result[_i312]=this[firstIndex+_i312];}return result;}},{key:"setColumn",value:function setColumn(columnIndex,columnVector){var firstIndex=columnIndex*this.RANK;for(var _i313=0;_i313<this.RANK;++_i313){this[firstIndex+_i313]=columnVector[_i313];}return this;}}]);return Matrix;}(MathArray);/**
25772
+ },{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 _i313=0;_i313<this.RANK;++_i313){result[_i313]=this[firstIndex+_i313];}return result;}},{key:"setColumn",value:function setColumn(columnIndex,columnVector){var firstIndex=columnIndex*this.RANK;for(var _i314=0;_i314<this.RANK;++_i314){this[firstIndex+_i314]=columnVector[_i314];}return this;}}]);return Matrix;}(MathArray);/**
25771
25773
  * Transpose the values of a mat3
25772
25774
  *
25773
25775
  * @param {mat3} out the receiving matrix
@@ -25856,8 +25858,8 @@ this[0]=array[0];this[1]=array[1];this[2]=array[2];this[3]=array[3];this[4]=arra
25856
25858
  * Transform TEXCOORD by material
25857
25859
  * @param materialIndex processing material index
25858
25860
  * @param gltfData gltf buffers and json
25859
- */function _decode$6(){_decode$6=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee61(gltfData,options){var _options$gltf11;var gltfScenegraph,hasExtension,materials,_i424;return _regeneratorRuntime().wrap(function _callee61$(_context65){while(1){switch(_context65.prev=_context65.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))){_context65.next=4;break;}return _context65.abrupt("return");case 4:materials=gltfData.json.materials||[];for(_i424=0;_i424<materials.length;_i424++){transformTexCoords(_i424,gltfData);}case 6:case"end":return _context65.stop();}}},_callee61);}));return _decode$6.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
25860
- var processedTexCoords=[];for(var _i314=0,_materialTextures=materialTextures;_i314<_materialTextures.length;_i314++){var _textureInfo$extensio;var textureInfo=_materialTextures[_i314];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);}}}/**
25861
+ */function _decode$6(){_decode$6=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee61(gltfData,options){var _options$gltf11;var gltfScenegraph,hasExtension,materials,_i425;return _regeneratorRuntime().wrap(function _callee61$(_context65){while(1){switch(_context65.prev=_context65.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))){_context65.next=4;break;}return _context65.abrupt("return");case 4:materials=gltfData.json.materials||[];for(_i425=0;_i425<materials.length;_i425++){transformTexCoords(_i425,gltfData);}case 6:case"end":return _context65.stop();}}},_callee61);}));return _decode$6.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
25862
+ var processedTexCoords=[];for(var _i315=0,_materialTextures=materialTextures;_i315<_materialTextures.length;_i315++){var _textureInfo$extensio;var textureInfo=_materialTextures[_i315];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);}}}/**
25861
25863
  * Transform primitives of the particular material
25862
25864
  * @param gltfData gltf data
25863
25865
  * @param materialIndex primitives with this material will be transformed
@@ -25884,10 +25886,10 @@ var _getAccessorArrayType2=getAccessorArrayTypeAndLength(accessor,bufferView),Ar
25884
25886
  var bytes=BYTES$1[accessor.componentType];// Number of components. For the `TEXCOORD_0` with `VEC2` type, it must return 2
25885
25887
  var components=COMPONENTS$1[accessor.type];// Multiplier to calculate the address of the `TEXCOORD_0` element in the arrayBuffer
25886
25888
  var elementAddressScale=bufferView.byteStride||bytes*components;// Data transform to Float32Array
25887
- var result=new Float32Array(length);for(var _i315=0;_i315<accessor.count;_i315++){// Take [u, v] couple from the arrayBuffer
25888
- var uv=new ArrayType(arrayBuffer,byteOffset+_i315*elementAddressScale,2);// Set and transform Vector3 per https://github.com/KhronosGroup/glTF/tree/main/extensions/2.0/Khronos/KHR_texture_transform#overview
25889
+ var result=new Float32Array(length);for(var _i316=0;_i316<accessor.count;_i316++){// Take [u, v] couple from the arrayBuffer
25890
+ var uv=new ArrayType(arrayBuffer,byteOffset+_i316*elementAddressScale,2);// Set and transform Vector3 per https://github.com/KhronosGroup/glTF/tree/main/extensions/2.0/Khronos/KHR_texture_transform#overview
25889
25891
  scratchVector.set(uv[0],uv[1],1);scratchVector.transformByMatrix3(matrix);// Save result in Float32Array
25890
- result.set([scratchVector[0],scratchVector[1]],_i315*components);}// If texCoord the same, replace gltf structural data
25892
+ result.set([scratchVector[0],scratchVector[1]],_i316*components);}// If texCoord the same, replace gltf structural data
25891
25893
  if(originalTexCoord===texCoord){updateGltf(accessor,bufferView,gltfData.buffers,result);}else{// If texCoord change, create new attribute
25892
25894
  createAttribute(texCoord,accessor,primitive,gltfData,result);}}}}}/**
25893
25895
  * Update GLTF structural objects with new data as we create new `Float32Array` for `TEXCOORD_0`.
@@ -26071,8 +26073,8 @@ var images=gltf.json.images||[];gltf.images=new Array(images.length).fill({});}/
26071
26073
  * @param options
26072
26074
  * @param context
26073
26075
  * @returns
26074
- */function _loadBuffers(){_loadBuffers=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee69(gltf,options,context){var buffers,_i425,buffer,_context$fetch,_response$arrayBuffer,_fetch,uri,response,arrayBuffer;return _regeneratorRuntime().wrap(function _callee69$(_context73){while(1){switch(_context73.prev=_context73.next){case 0:// TODO
26075
- buffers=gltf.json.buffers||[];_i425=0;case 2:if(!(_i425<buffers.length)){_context73.next=22;break;}buffer=buffers[_i425];if(!buffer.uri){_context73.next=18;break;}_fetch=context.fetch;assert$1(_fetch);uri=resolveUrl(buffer.uri,options);_context73.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=_context73.sent;_context73.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=_context73.sent;gltf.buffers[_i425]={arrayBuffer:arrayBuffer,byteOffset:0,byteLength:arrayBuffer.byteLength};delete buffer.uri;_context73.next=19;break;case 18:if(gltf.buffers[_i425]===null){gltf.buffers[_i425]={arrayBuffer:new ArrayBuffer(buffer.byteLength),byteOffset:0,byteLength:buffer.byteLength};}case 19:++_i425;_context73.next=2;break;case 22:case"end":return _context73.stop();}}},_callee69);}));return _loadBuffers.apply(this,arguments);}function loadImages(_x106,_x107,_x108){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 _callee70(gltf,options,context){var imageIndices,images,promises,_iterator78,_step78,imageIndex;return _regeneratorRuntime().wrap(function _callee70$(_context74){while(1){switch(_context74.prev=_context74.next){case 0:imageIndices=getReferencesImageIndices(gltf);images=gltf.json.images||[];promises=[];_iterator78=_createForOfIteratorHelper(imageIndices);try{for(_iterator78.s();!(_step78=_iterator78.n()).done;){imageIndex=_step78.value;promises.push(loadImage(gltf,images[imageIndex],imageIndex,options,context));}}catch(err){_iterator78.e(err);}finally{_iterator78.f();}_context74.next=7;return Promise.all(promises);case 7:return _context74.abrupt("return",_context74.sent);case 8:case"end":return _context74.stop();}}},_callee70);}));return _loadImages.apply(this,arguments);}function getReferencesImageIndices(gltf){var imageIndices=new Set();var textures=gltf.json.textures||[];var _iterator59=_createForOfIteratorHelper(textures),_step59;try{for(_iterator59.s();!(_step59=_iterator59.n()).done;){var texture=_step59.value;if(texture.source!==undefined){imageIndices.add(texture.source);}}}catch(err){_iterator59.e(err);}finally{_iterator59.f();}return Array.from(imageIndices).sort();}/** Asynchronously fetches and parses one image, store in images array outside of json */function loadImage(_x109,_x110,_x111,_x112,_x113){return _loadImage.apply(this,arguments);}/**
26076
+ */function _loadBuffers(){_loadBuffers=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee69(gltf,options,context){var buffers,_i426,buffer,_context$fetch,_response$arrayBuffer,_fetch,uri,response,arrayBuffer;return _regeneratorRuntime().wrap(function _callee69$(_context73){while(1){switch(_context73.prev=_context73.next){case 0:// TODO
26077
+ buffers=gltf.json.buffers||[];_i426=0;case 2:if(!(_i426<buffers.length)){_context73.next=22;break;}buffer=buffers[_i426];if(!buffer.uri){_context73.next=18;break;}_fetch=context.fetch;assert$1(_fetch);uri=resolveUrl(buffer.uri,options);_context73.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=_context73.sent;_context73.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=_context73.sent;gltf.buffers[_i426]={arrayBuffer:arrayBuffer,byteOffset:0,byteLength:arrayBuffer.byteLength};delete buffer.uri;_context73.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;_context73.next=2;break;case 22:case"end":return _context73.stop();}}},_callee69);}));return _loadBuffers.apply(this,arguments);}function loadImages(_x106,_x107,_x108){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 _callee70(gltf,options,context){var imageIndices,images,promises,_iterator78,_step78,imageIndex;return _regeneratorRuntime().wrap(function _callee70$(_context74){while(1){switch(_context74.prev=_context74.next){case 0:imageIndices=getReferencesImageIndices(gltf);images=gltf.json.images||[];promises=[];_iterator78=_createForOfIteratorHelper(imageIndices);try{for(_iterator78.s();!(_step78=_iterator78.n()).done;){imageIndex=_step78.value;promises.push(loadImage(gltf,images[imageIndex],imageIndex,options,context));}}catch(err){_iterator78.e(err);}finally{_iterator78.f();}_context74.next=7;return Promise.all(promises);case 7:return _context74.abrupt("return",_context74.sent);case 8:case"end":return _context74.stop();}}},_callee70);}));return _loadImages.apply(this,arguments);}function getReferencesImageIndices(gltf){var imageIndices=new Set();var textures=gltf.json.textures||[];var _iterator59=_createForOfIteratorHelper(textures),_step59;try{for(_iterator59.s();!(_step59=_iterator59.n()).done;){var texture=_step59.value;if(texture.source!==undefined){imageIndices.add(texture.source);}}}catch(err){_iterator59.e(err);}finally{_iterator59.f();}return Array.from(imageIndices).sort();}/** Asynchronously fetches and parses one image, store in images array outside of json */function loadImage(_x109,_x110,_x111,_x112,_x113){return _loadImage.apply(this,arguments);}/**
26076
26078
  * GLTF loader
26077
26079
  */function _loadImage(){_loadImage=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee71(gltf,image,index,options,context){var arrayBuffer,uri,_fetch2,response,array,parsedImage;return _regeneratorRuntime().wrap(function _callee71$(_context75){while(1){switch(_context75.prev=_context75.next){case 0:if(!(image.uri&&!image.hasOwnProperty('bufferView'))){_context75.next=10;break;}uri=resolveUrl(image.uri,options);_fetch2=context.fetch;_context75.next=5;return _fetch2(uri);case 5:response=_context75.sent;_context75.next=8;return response.arrayBuffer();case 8:arrayBuffer=_context75.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`
26078
26080
  _context75.next=14;return parseFromContext(arrayBuffer,[ImageLoader,BasisLoader],_objectSpread(_objectSpread({},options),{},{mimeType:image.mimeType,basis:options.basis||{format:selectSupportedBasisFormat()}}),context);case 14:parsedImage=_context75.sent;if(parsedImage&&parsedImage[0]){parsedImage={compressed:true,// @ts-expect-error
@@ -26139,7 +26141,7 @@ if(accessor.bufferView){var buffer=accessor.bufferView.buffer;var _getAccessorAr
26139
26141
  * @param bytesPerElement
26140
26142
  * @param count
26141
26143
  * @returns
26142
- */},{key:"_getValueFromInterleavedBuffer",value:function _getValueFromInterleavedBuffer(buffer,byteOffset,byteStride,bytesPerElement,count){var result=new Uint8Array(count*bytesPerElement);for(var _i316=0;_i316<count;_i316++){var elementOffset=byteOffset+_i316*byteStride;result.set(new Uint8Array(buffer.arrayBuffer.slice(elementOffset,elementOffset+bytesPerElement)),_i316*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
26144
+ */},{key:"_getValueFromInterleavedBuffer",value:function _getValueFromInterleavedBuffer(buffer,byteOffset,byteStride,bytesPerElement,count){var result=new Uint8Array(count*bytesPerElement);for(var _i317=0;_i317<count;_i317++){var elementOffset=byteOffset+_i317*byteStride;result.set(new Uint8Array(buffer.arrayBuffer.slice(elementOffset,elementOffset+bytesPerElement)),_i317*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
26143
26145
  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
26144
26146
  id:gltfSampler.id||"sampler-".concat(index)},gltfSampler),{},{parameters:{}});// Map textual parameters to GL parameter values
26145
26147
  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
@@ -26156,7 +26158,7 @@ sceneModel.fire("loaded",true,false);});if(ok){ok();}},function(msg){plugin.erro
26156
26158
  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
26157
26159
  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
26158
26160
  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$3(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: {},
26159
- 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 _i317=0,len=textures.length;_i317<len;_i317++){loadTexture(ctx,textures[_i317]);}}}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 _i318=0,len=materials.length;_i318<len;_i318++){var material=materials[_i318];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
26161
+ 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 _i318=0,len=textures.length;_i318<len;_i318++){loadTexture(ctx,textures[_i318]);}}}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 _i319=0,len=materials.length;_i319<len;_i319++){var material=materials[_i319];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
26160
26162
  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
26161
26163
  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.
26162
26164
  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);}/**
@@ -26172,7 +26174,7 @@ var meshIdsStack=[];var meshIds=null;(function createSceneMeshesAndEntities(node
26172
26174
  * @param ctx Parsing context
26173
26175
  * @param matrix Matrix for the XKTMeshes
26174
26176
  * @param meshIds returns IDs of the new XKTMeshes
26175
- */function parseNodeMesh(node,ctx,matrix,meshIds){var mesh=node.mesh;if(!mesh){return;}var numPrimitives=mesh.primitives.length;if(numPrimitives>0){for(var _i319=0;_i319<numPrimitives;_i319++){var primitive=mesh.primitives[_i319];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
26177
+ */function parseNodeMesh(node,ctx,matrix,meshIds){var mesh=node.mesh;if(!mesh){return;}var numPrimitives=mesh.primitives.length;if(numPrimitives>0){for(var _i320=0;_i320<numPrimitives;_i320++){var primitive=mesh.primitives[_i320];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
26176
26178
  meshCfg.primitive="points";break;case 1:// LINES
26177
26179
  meshCfg.primitive="lines";break;case 2:// LINE_LOOP
26178
26180
  meshCfg.primitive="lines";break;case 3:// LINE_STRIP
@@ -26503,7 +26505,7 @@ if(!params.src&&!params.gltf){this.error("load() param expected: src or gltf");r
26503
26505
  {boundaries:[[11,11,2,2]],"dir":[-0.5,0.7071,-0.5],"up":[0.5,0.7071,0.5]},// Bottom-front-right corner
26504
26506
  {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
26505
26507
  {boundaries:[[11,5,2,2]],"dir":[-0.5,-0.7071,-0.5],"up":[-0.5,0.7071,-0.5]}// Top-front-right corner
26506
- ];for(var _i320=0,len=areasZUp.length;_i320<len;_i320++){math.normalizeVec3(areasZUp[_i320].dir,areasZUp[_i320].dir);math.normalizeVec3(areasZUp[_i320].up,areasZUp[_i320].up);}for(var _i321=0,_len43=areasYUp.length;_i321<_len43;_i321++){math.normalizeVec3(areasYUp[_i321].dir,areasYUp[_i321].dir);math.normalizeVec3(areasYUp[_i321].up,areasYUp[_i321].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 _i322=0,_len44=facesZUp.length;_i322<_len44;_i322++){var face=facesZUp[_i322];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 _i323=0,_len45=areas.length;_i323<_len45;_i323++){var _xmin=void 0;var _ymin=void 0;var _width2=void 0;var _height2=void 0;var _area=areas[_i323];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
26508
+ ];for(var _i321=0,len=areasZUp.length;_i321<len;_i321++){math.normalizeVec3(areasZUp[_i321].dir,areasZUp[_i321].dir);math.normalizeVec3(areasZUp[_i321].up,areasZUp[_i321].up);}for(var _i322=0,_len43=areasYUp.length;_i322<_len43;_i322++){math.normalizeVec3(areasYUp[_i322].dir,areasYUp[_i322].dir);math.normalizeVec3(areasYUp[_i322].up,areasYUp[_i322].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 _i323=0,_len44=facesZUp.length;_i323<_len44;_i323++){var face=facesZUp[_i323];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 _i324=0,_len45=areas.length;_i324<_len45;_i324++){var _xmin=void 0;var _ymin=void 0;var _width2=void 0;var _height2=void 0;var _area=areas[_i324];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
26507
26509
  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();/**
26508
26510
  * {@link Viewer} plugin that lets us look at the entire {@link Scene} from along a chosen axis or diagonal.
26509
26511
  *
@@ -27456,7 +27458,7 @@ for(var _id3 in this._controls){if(this._controls.hasOwnProperty(_id3)){this._co
27456
27458
  * These are created and destroyed automatically as models are loaded and destroyed.
27457
27459
  *
27458
27460
  * @type {{String: {String:Storey}}}
27459
- */_this173.modelStoreys={};_this173._fitStoreyMaps=!!cfg.fitStoreyMaps;_this173._onModelLoaded=_this173.viewer.scene.on("modelLoaded",function(modelId){_this173._registerModelStoreys(modelId);_this173.fire("storeys",_this173.storeys);});return _this173;}_createClass(StoreyViewsPlugin,[{key:"_registerModelStoreys",value:function _registerModelStoreys(modelId){var _this174=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 _i324=0,len=storeyIds.length;_i324<len;_i324++){var storeyId=storeyIds[_i324];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(){_this174._deregisterModelStoreys(modelId);_this174.fire("storeys",_this174.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 _i325=0,len=storeysList.length;_i325<len;_i325++){var storeyMetaObjectCur=metaScene.metaObjects[storeysList[_i325].storeyId];var elevationCur=storeyMetaObjectCur.attributes.elevation;if(isNaN(elevationCur))return;var bb=storeysList[_i325].storeyAABB;bb[bbIndex]=Math.max(bb[1],parseFloat(elevationCur));if(_i325>0){var storeyMetaObjectNext=metaScene.metaObjects[storeysList[_i325-1].storeyId];var elevationNext=storeyMetaObjectNext.attributes.elevation;bb[4]=Math.min(bb[bbIndex+3],parseFloat(elevationNext));}this.storeys[storeysList[_i325].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];}}/**
27461
+ */_this173.modelStoreys={};_this173._fitStoreyMaps=!!cfg.fitStoreyMaps;_this173._onModelLoaded=_this173.viewer.scene.on("modelLoaded",function(modelId){_this173._registerModelStoreys(modelId);_this173.fire("storeys",_this173.storeys);});return _this173;}_createClass(StoreyViewsPlugin,[{key:"_registerModelStoreys",value:function _registerModelStoreys(modelId){var _this174=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 _i325=0,len=storeyIds.length;_i325<len;_i325++){var storeyId=storeyIds[_i325];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(){_this174._deregisterModelStoreys(modelId);_this174.fire("storeys",_this174.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 _i326=0,len=storeysList.length;_i326<len;_i326++){var storeyMetaObjectCur=metaScene.metaObjects[storeysList[_i326].storeyId];var elevationCur=storeyMetaObjectCur.attributes.elevation;if(isNaN(elevationCur))return;var bb=storeysList[_i326].storeyAABB;bb[bbIndex]=Math.max(bb[1],parseFloat(elevationCur));if(_i326>0){var storeyMetaObjectNext=metaScene.metaObjects[storeysList[_i326-1].storeyId];var elevationNext=storeyMetaObjectNext.attributes.elevation;bb[4]=Math.min(bb[bbIndex+3],parseFloat(elevationNext));}this.storeys[storeysList[_i326].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];}}/**
27460
27462
  * 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
27461
27463
  * floor map images. If false, each floor map image will display the model's extents, ensuring a consistent scale across all images.
27462
27464
  * @returns {*|boolean}
@@ -27841,7 +27843,7 @@ var sectionPlane=new SectionPlane(this.viewer.scene,{id:params.id,pos:params.pos
27841
27843
  * @param {String} id ID of the {@link SectionPlane}.
27842
27844
  */},{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);}/**
27843
27845
  * Destroys all {@link SectionPlane}s created by this FaceAlignedSectionPlanesPlugin.
27844
- */},{key:"clear",value:function clear(){var ids=Object.keys(this._sectionPlanes);for(var _i326=0,len=ids.length;_i326<len;_i326++){this.destroySectionPlane(ids[_i326]);}}/**
27846
+ */},{key:"clear",value:function clear(){var ids=Object.keys(this._sectionPlanes);for(var _i327=0,len=ids.length;_i327<len;_i327++){this.destroySectionPlane(ids[_i327]);}}/**
27845
27847
  * @private
27846
27848
  */},{key:"send",value:function send(name,value){switch(name){case"snapshotStarting":// Viewer#getSnapshot() about to take snapshot - hide controls
27847
27849
  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
@@ -27870,14 +27872,14 @@ roughness:0.5});// var material = new PhongMaterial(modelNode, { // Share materi
27870
27872
  // reflectivity: 1,
27871
27873
  // specular: [0.5, 0.5, 1.0]
27872
27874
  // });
27873
- 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 _i327=1;_i327<=3;_i327++){var vertexstart=start+_i327*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
27875
+ 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 _i328=1;_i328<=3;_i328++){var vertexstart=start+_i328*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
27874
27876
  }}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, {
27875
27877
  // diffuse: [0.4, 0.4, 0.4],
27876
27878
  // reflectivity: 1,
27877
27879
  // specular: [0.5, 0.5, 1.0]
27878
27880
  // });
27879
- 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 _i328=0;_i328<buffer.length;_i328++){arrayBuffer[_i328]=buffer.charCodeAt(_i328)&0xff;// implicitly assumes little-endian
27880
- }return arrayBuffer.buffer||arrayBuffer;}else{return buffer;}}function decodeText(array){if(typeof TextDecoder!=='undefined'){return new TextDecoder().decode(array);}var s='';for(var _i329=0,il=array.length;_i329<il;_i329++){s+=String.fromCharCode(array[_i329]);// Implicitly assumes little-endian.
27881
+ 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 _i329=0;_i329<buffer.length;_i329++){arrayBuffer[_i329]=buffer.charCodeAt(_i329)&0xff;// implicitly assumes little-endian
27882
+ }return arrayBuffer.buffer||arrayBuffer;}else{return buffer;}}function decodeText(array){if(typeof TextDecoder!=='undefined'){return new TextDecoder().decode(array);}var s='';for(var _i330=0,il=array.length;_i330<il;_i330++){s+=String.fromCharCode(array[_i330]);// Implicitly assumes little-endian.
27881
27883
  }return decodeURIComponent(escape(s));}/**
27882
27884
  * {@link Viewer} plugin that loads models from <a href="https://en.wikipedia.org/wiki/STL_(file_format)">STL</a> files.
27883
27885
  *
@@ -28470,12 +28472,12 @@ addMesh(modelNode,positions,normals,colors,material,options);}function addMesh(m
28470
28472
  */_this183.errors=[];/**
28471
28473
  * True if errors were found generating this TreeView.
28472
28474
  * @type {boolean}
28473
- */_this183.valid=true;var containerElement=cfg.containerElement||document.getElementById(cfg.containerElementId);if(!(containerElement instanceof HTMLElement)){_this183.error("Mandatory config expected: valid containerElementId or containerElement");return _possibleConstructorReturn(_this183);}for(var _i330=0;;_i330++){if(!treeViews[_i330]){treeViews[_i330]=_assertThisInitialized(_this183);_this183._index=_i330;_this183._id="tree-".concat(_i330);break;}}_this183._containerElement=containerElement;_this183._metaModels={};_this183._autoAddModels=cfg.autoAddModels!==false;_this183._autoExpandDepth=cfg.autoExpandDepth||0;_this183._sortNodes=cfg.sortNodes!==false;_this183._viewer=viewer;_this183._rootElement=null;_this183._muteSceneEvents=false;_this183._muteTreeEvents=false;_this183._rootNodes=[];_this183._objectNodes={};// Object ID -> Node
28475
+ */_this183.valid=true;var containerElement=cfg.containerElement||document.getElementById(cfg.containerElementId);if(!(containerElement instanceof HTMLElement)){_this183.error("Mandatory config expected: valid containerElementId or containerElement");return _possibleConstructorReturn(_this183);}for(var _i331=0;;_i331++){if(!treeViews[_i331]){treeViews[_i331]=_assertThisInitialized(_this183);_this183._index=_i331;_this183._id="tree-".concat(_i331);break;}}_this183._containerElement=containerElement;_this183._metaModels={};_this183._autoAddModels=cfg.autoAddModels!==false;_this183._autoExpandDepth=cfg.autoExpandDepth||0;_this183._sortNodes=cfg.sortNodes!==false;_this183._viewer=viewer;_this183._rootElement=null;_this183._muteSceneEvents=false;_this183._muteTreeEvents=false;_this183._rootNodes=[];_this183._objectNodes={};// Object ID -> Node
28474
28476
  _this183._nodeNodes={};// Node ID -> Node
28475
28477
  _this183._rootNames={};// Node ID -> Root name
28476
28478
  _this183._sortNodes=cfg.sortNodes;_this183._pruneEmptyNodes=cfg.pruneEmptyNodes;_this183._showListItemElementId=null;_this183._renderService=cfg.renderService||new RenderService(_this183._containerElement);_this183._showIndeterminate=(_cfg$showIndeterminat=cfg.showIndeterminate)!==null&&_cfg$showIndeterminat!==void 0?_cfg$showIndeterminat:false;_this183._showProjectNode=(_cfg$showProjectNode=cfg.showProjectNode)!==null&&_cfg$showProjectNode!==void 0?_cfg$showProjectNode:false;_this183._elevationSortFunction=(_cfg$elevationSortFun=cfg.elevationSortFunction)!==null&&_cfg$elevationSortFun!==void 0?_cfg$elevationSortFun:undefined;_this183._defaultSortFunction=(_cfg$defaultSortFunct=cfg.defaultSortFunction)!==null&&_cfg$defaultSortFunct!==void 0?_cfg$defaultSortFunct:undefined;if(!_this183._renderService){throw new Error('TreeViewPlugin: no render service set');}_this183._containerElement.oncontextmenu=function(e){e.preventDefault();};_this183._onObjectVisibility=_this183._viewer.scene.on("objectVisibility",function(entity){if(_this183._muteSceneEvents){return;}var objectId=entity.id;var node=_this183._objectNodes[objectId];if(!node){return;// Not in this tree
28477
28479
  }var visible=entity.visible;var updated=visible!==node.checked;if(!updated){return;}_this183._muteTreeEvents=true;node.checked=visible;if(visible){node.numVisibleEntities++;}else{node.numVisibleEntities--;}_this183._renderService.setCheckbox(node.nodeId,visible);var parent=node.parent;while(parent){parent.checked=visible;if(visible){parent.numVisibleEntities++;}else{parent.numVisibleEntities--;}var indeterminate=_this183._showIndeterminate&&parent.numVisibleEntities>0&&parent.numVisibleEntities<parent.numEntities;parent.checked=parent.numVisibleEntities>0;_this183._renderService.setCheckbox(parent.nodeId,parent.checked,indeterminate);parent=parent.parent;}_this183._muteTreeEvents=false;});_this183._onObjectXrayed=_this183._viewer.scene.on('objectXRayed',function(entity){if(_this183._muteSceneEvents){return;}var objectId=entity.id;var node=_this183._objectNodes[objectId];if(!node){return;// Not in this tree
28478
- }_this183._muteTreeEvents=true;var xrayed=entity.xrayed;var updated=xrayed!==node.xrayed;if(!updated){return;}node.xrayed=xrayed;_this183._renderService.setXRayed(node.nodeId,xrayed);_this183._muteTreeEvents=false;});_this183._switchExpandHandler=function(event){event.preventDefault();event.stopPropagation();var switchElement=event.target;_this183._expandSwitchElement(switchElement);};_this183._switchCollapseHandler=function(event){event.preventDefault();event.stopPropagation();var switchElement=event.target;_this183._collapseSwitchElement(switchElement);};_this183._checkboxChangeHandler=function(event){if(_this183._muteTreeEvents){return;}_this183._muteSceneEvents=true;var checkbox=event.target;var visible=_this183._renderService.isChecked(checkbox);var nodeId=_this183._renderService.getIdFromCheckbox(checkbox);var checkedNode=_this183._nodeNodes[nodeId];var objects=_this183._viewer.scene.objects;var numUpdated=0;_this183._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;_this183._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=_this183._showIndeterminate&&parent.numVisibleEntities>0&&parent.numVisibleEntities<parent.numEntities;parent.checked=parent.numVisibleEntities>0;_this183._renderService.setCheckbox(parent.nodeId,parent.checked,indeterminate);parent=parent.parent;}_this183._muteSceneEvents=false;};_this183._hierarchy=cfg.hierarchy||"containment";_this183._autoExpandDepth=cfg.autoExpandDepth||0;if(_this183._autoAddModels){var modelIds=Object.keys(_this183.viewer.metaScene.metaModels);for(var _i331=0,len=modelIds.length;_i331<len;_i331++){var modelId=modelIds[_i331];var metaModel=_this183.viewer.metaScene.metaModels[modelId];if(metaModel.finalized){_this183.addModel(modelId);}}_this183.viewer.scene.on("modelLoaded",function(modelId){if(_this183.viewer.metaScene.metaModels[modelId]){_this183.addModel(modelId);}});}_this183.hierarchy=cfg.hierarchy;return _this183;}/**
28480
+ }_this183._muteTreeEvents=true;var xrayed=entity.xrayed;var updated=xrayed!==node.xrayed;if(!updated){return;}node.xrayed=xrayed;_this183._renderService.setXRayed(node.nodeId,xrayed);_this183._muteTreeEvents=false;});_this183._switchExpandHandler=function(event){event.preventDefault();event.stopPropagation();var switchElement=event.target;_this183._expandSwitchElement(switchElement);};_this183._switchCollapseHandler=function(event){event.preventDefault();event.stopPropagation();var switchElement=event.target;_this183._collapseSwitchElement(switchElement);};_this183._checkboxChangeHandler=function(event){if(_this183._muteTreeEvents){return;}_this183._muteSceneEvents=true;var checkbox=event.target;var visible=_this183._renderService.isChecked(checkbox);var nodeId=_this183._renderService.getIdFromCheckbox(checkbox);var checkedNode=_this183._nodeNodes[nodeId];var objects=_this183._viewer.scene.objects;var numUpdated=0;_this183._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;_this183._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=_this183._showIndeterminate&&parent.numVisibleEntities>0&&parent.numVisibleEntities<parent.numEntities;parent.checked=parent.numVisibleEntities>0;_this183._renderService.setCheckbox(parent.nodeId,parent.checked,indeterminate);parent=parent.parent;}_this183._muteSceneEvents=false;};_this183._hierarchy=cfg.hierarchy||"containment";_this183._autoExpandDepth=cfg.autoExpandDepth||0;if(_this183._autoAddModels){var modelIds=Object.keys(_this183.viewer.metaScene.metaModels);for(var _i332=0,len=modelIds.length;_i332<len;_i332++){var modelId=modelIds[_i332];var metaModel=_this183.viewer.metaScene.metaModels[modelId];if(metaModel.finalized){_this183.addModel(modelId);}}_this183.viewer.scene.on("modelLoaded",function(modelId){if(_this183.viewer.metaScene.metaModels[modelId]){_this183.addModel(modelId);}});}_this183.hierarchy=cfg.hierarchy;return _this183;}/**
28479
28481
  * Sets how the nodes are organized within this tree view.
28480
28482
  *
28481
28483
  * Accepted values are:
@@ -28529,7 +28531,7 @@ _this183._sortNodes=cfg.sortNodes;_this183._pruneEmptyNodes=cfg.pruneEmptyNodes;
28529
28531
  *
28530
28532
  * @param {String} objectId ID of the {@link Entity}.
28531
28533
  */},{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)
28532
- }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 _i332=0,len=path.length;_i332<len;_i332++){var _switchElement=this._renderService.getSwitchElement(path[_i332].nodeId);if(_switchElement){this._expandSwitchElement(_switchElement);}}this._renderService.setHighlighted(nodeId,true);this._showListItemElementId=nodeId;}/**
28534
+ }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 _i333=0,len=path.length;_i333<len;_i333++){var _switchElement=this._renderService.getSwitchElement(path[_i333].nodeId);if(_switchElement){this._expandSwitchElement(_switchElement);}}this._renderService.setHighlighted(nodeId,true);this._showListItemElementId=nodeId;}/**
28533
28535
  * De-highlights the node previously shown with {@link TreeViewPlugin#showNode}.
28534
28536
  *
28535
28537
  * Does nothing if no node is currently shown.
@@ -28541,15 +28543,15 @@ _this183._sortNodes=cfg.sortNodes;_this183._pruneEmptyNodes=cfg.pruneEmptyNodes;
28541
28543
  * Collapses the tree first.
28542
28544
  *
28543
28545
  * @param {Number} depth Depth to expand to.
28544
- */},{key:"expandToDepth",value:function expandToDepth(depth){var _this185=this;this.collapse();var expand=function expand(node,countDepth){if(countDepth===depth){return;}var switchElement=_this185._renderService.getSwitchElement(node.nodeId);if(switchElement){_this185._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 _i333=0,len=this._rootNodes.length;_i333<len;_i333++){var rootNode=this._rootNodes[_i333];expand(rootNode,0);}}/**
28546
+ */},{key:"expandToDepth",value:function expandToDepth(depth){var _this185=this;this.collapse();var expand=function expand(node,countDepth){if(countDepth===depth){return;}var switchElement=_this185._renderService.getSwitchElement(node.nodeId);if(switchElement){_this185._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 _i334=0,len=this._rootNodes.length;_i334<len;_i334++){var rootNode=this._rootNodes[_i334];expand(rootNode,0);}}/**
28545
28547
  * Closes all the nodes in the tree.
28546
- */},{key:"collapse",value:function collapse(){for(var _i334=0,len=this._rootNodes.length;_i334<len;_i334++){var rootNode=this._rootNodes[_i334];var nodeId=rootNode.nodeId;this._collapseNode(nodeId);}}/**
28548
+ */},{key:"collapse",value:function collapse(){for(var _i335=0,len=this._rootNodes.length;_i335<len;_i335++){var rootNode=this._rootNodes[_i335];var nodeId=rootNode.nodeId;this._collapseNode(nodeId);}}/**
28547
28549
  * Iterates over a subtree of the tree view's {@link TreeViewNode}s, calling the given callback for each
28548
28550
  * node in depth-first pre-order.
28549
28551
  *
28550
28552
  * @param {TreeViewNode} node Root of the subtree.
28551
28553
  * @param {Function} callback Callback called at each {@link TreeViewNode}, with the TreeViewNode given as the argument.
28552
- */},{key:"withNodeTree",value:function withNodeTree(node,callback){callback(node);var children=node.children;if(!children){return;}for(var _i335=0,len=children.length;_i335<len;_i335++){this.withNodeTree(children[_i335],callback);}}/**
28554
+ */},{key:"withNodeTree",value:function withNodeTree(node,callback){callback(node);var children=node.children;if(!children){return;}for(var _i336=0,len=children.length;_i336<len;_i336++){this.withNodeTree(children[_i336],callback);}}/**
28553
28555
  * Destroys this TreeViewPlugin.
28554
28556
  */},{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 || {
28555
28557
  // foundIFCBuildingStoreys: false
@@ -28578,9 +28580,9 @@ _this183._sortNodes=cfg.sortNodes;_this183._pruneEmptyNodes=cfg.pruneEmptyNodes;
28578
28580
  // // errors.push("Can't build storeys hierarchy: no IfcBuildingStoreys found");
28579
28581
  // }
28580
28582
  // }
28581
- 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 _i336=0,len=children.length;_i336<len;_i336++){var childMetaObject=children[_i336];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 _i337=0,len=children.length;_i337<len;_i337++){var childMetaObject=children[_i337];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 _i338=0,len=children.length;_i338<len;_i338++){var childMetaObject=children[_i338];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 _i339=0,len=children.length;_i339<len;_i339++){var childMetaObject=children[_i339];this._createContainmentNodes2(childMetaObject,node);}}}},{key:"_doSortNodes",value:function _doSortNodes(){for(var _i340=0,len=this._rootNodes.length;_i340<len;_i340++){var rootNode=this._rootNodes[_i340];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 _i341=0,len=children.length;_i341<len;_i341++){var _node2=children[_i341];this._sortChildren(_node2);}}},{key:"_getSpatialSortFunc",value:function _getSpatialSortFunc(){var _this186=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=_this186.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?
28582
- 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 _i342=0,len=objectIds.length;_i342<len;_i342++){var objectId=objectIds[_i342];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
28583
- 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 _i343=0,len=children.length;_i343<len;_i343++){this._withNodeTree(children[_i343],callback);}}},{key:"_createTrees",value:function _createTrees(){var _this187=this;if(this._rootNodes.length===0){return;}var rootNodeElements=this._rootNodes.map(function(rootNode){return _this187._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 _this188=this;var contextmenuHandler=function contextmenuHandler(event){_this188.fire("contextmenu",{event:event,viewer:_this188._viewer,treeViewPlugin:_this188,treeViewNode:node});event.preventDefault();};var onclickHandler=function onclickHandler(event){_this188.fire("nodeTitleClicked",{event:event,viewer:_this188._viewer,treeViewPlugin:_this188,treeViewNode:node});event.preventDefault();};return this._renderService.createNodeElement(node,this._switchExpandHandler,this._checkboxChangeHandler,contextmenuHandler,onclickHandler);}},{key:"_expandSwitchElement",value:function _expandSwitchElement(switchElement){var _this189=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 _this189._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);/**
28583
+ 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 _i337=0,len=children.length;_i337<len;_i337++){var childMetaObject=children[_i337];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 _i338=0,len=children.length;_i338<len;_i338++){var childMetaObject=children[_i338];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 _i339=0,len=children.length;_i339<len;_i339++){var childMetaObject=children[_i339];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 _i340=0,len=children.length;_i340<len;_i340++){var childMetaObject=children[_i340];this._createContainmentNodes2(childMetaObject,node);}}}},{key:"_doSortNodes",value:function _doSortNodes(){for(var _i341=0,len=this._rootNodes.length;_i341<len;_i341++){var rootNode=this._rootNodes[_i341];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 _i342=0,len=children.length;_i342<len;_i342++){var _node2=children[_i342];this._sortChildren(_node2);}}},{key:"_getSpatialSortFunc",value:function _getSpatialSortFunc(){var _this186=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=_this186.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?
28584
+ 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 _i343=0,len=objectIds.length;_i343<len;_i343++){var objectId=objectIds[_i343];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
28585
+ 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 _i344=0,len=children.length;_i344<len;_i344++){this._withNodeTree(children[_i344],callback);}}},{key:"_createTrees",value:function _createTrees(){var _this187=this;if(this._rootNodes.length===0){return;}var rootNodeElements=this._rootNodes.map(function(rootNode){return _this187._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 _this188=this;var contextmenuHandler=function contextmenuHandler(event){_this188.fire("contextmenu",{event:event,viewer:_this188._viewer,treeViewPlugin:_this188,treeViewNode:node});event.preventDefault();};var onclickHandler=function onclickHandler(event){_this188.fire("nodeTitleClicked",{event:event,viewer:_this188._viewer,treeViewPlugin:_this188,treeViewNode:node});event.preventDefault();};return this._renderService.createNodeElement(node,this._switchExpandHandler,this._checkboxChangeHandler,contextmenuHandler,onclickHandler);}},{key:"_expandSwitchElement",value:function _expandSwitchElement(switchElement){var _this189=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 _this189._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);/**
28584
28586
  * For each Entity in its Scene, efficiently combines updates from multiple culling systems into a single "culled" state.
28585
28587
  *
28586
28588
  * Two culling systems are supported:
@@ -28597,7 +28599,7 @@ this._objectsViewCulled=[];// A flag for each object to indicate its view-cull s
28597
28599
  this._objectsDetailCulled=[];// A flag for each object to indicate its detail-cull status
28598
28600
  this._objectsChanged=[];// A flag for each object, set whenever its cull status has changed since last _applyChanges()
28599
28601
  this._objectsChangedList=[];// A list of objects whose cull status has changed, applied and cleared by _applyChanges()
28600
- 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){_this190._addModel(model);}});this._onTick=scene.on("tick",function(){if(_this190._dirty){_this190._build();}_this190._applyChanges();});}_createClass(ObjectCullStates,[{key:"_addModel",value:function _addModel(model){var _this191=this;var modelInfo={model:model,onDestroyed:model.on("destroyed",function(){_this191._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 _i344=0;_i344<this._numObjects;_i344++){this._objects[_i344]=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 _i345=0;_i345<this._lenObjectsChangedList;_i345++){var objectIdx=this._objectsChangedList[_i345];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;}}/**
28602
+ 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){_this190._addModel(model);}});this._onTick=scene.on("tick",function(){if(_this190._dirty){_this190._build();}_this190._applyChanges();});}_createClass(ObjectCullStates,[{key:"_addModel",value:function _addModel(model){var _this191=this;var modelInfo={model:model,onDestroyed:model.on("destroyed",function(){_this191._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 _i345=0;_i345<this._numObjects;_i345++){this._objects[_i345]=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 _i346=0;_i346<this._lenObjectsChangedList;_i346++){var objectIdx=this._objectsChangedList[_i346];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;}}/**
28601
28603
  * Array of {@link Entity} instances that represent objects in the {@link Scene}.
28602
28604
  *
28603
28605
  * ObjectCullStates rebuilds this from {@link Scene#objects} whenever ````Scene```` fires a ````modelLoaded```` event.
@@ -28673,7 +28675,7 @@ _this192._maxTreeDepth=cfg.maxTreeDepth||MAX_KD_TREE_DEPTH;_this192._modelInfos=
28673
28675
  * Gets whether view culling is enabled.
28674
28676
  *
28675
28677
  * @retutns {Boolean} Whether view culling is enabled.
28676
- */function get(){return this._enabled;},set:function set(enabled){this._enabled=enabled;}},{key:"_addModel",value:function _addModel(model){var _this193=this;var modelInfo={model:model,onDestroyed:model.on("destroyed",function(){_this193._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 _i346=0,len=objects.length;_i346<len;_i346++){var objectIdx=objects[_i346];this._objectCullStates.setObjectViewCulled(objectIdx,culled);}}if(kdNode.left){this._visitKDNode(kdNode.left,intersects);}if(kdNode.right){this._visitKDNode(kdNode.right,intersects);}}/**
28678
+ */function get(){return this._enabled;},set:function set(enabled){this._enabled=enabled;}},{key:"_addModel",value:function _addModel(model){var _this193=this;var modelInfo={model:model,onDestroyed:model.on("destroyed",function(){_this193._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 _i347=0,len=objects.length;_i347<len;_i347++){var objectIdx=objects[_i347];this._objectCullStates.setObjectViewCulled(objectIdx,culled);}}if(kdNode.left){this._visitKDNode(kdNode.left,intersects);}if(kdNode.right){this._visitKDNode(kdNode.right,intersects);}}/**
28677
28679
  * @private
28678
28680
  */},{key:"send",value:function send(name,value){}/**
28679
28681
  * Destroys this ViewCullPlugin.
@@ -28698,7 +28700,7 @@ _this192._maxTreeDepth=cfg.maxTreeDepth||MAX_KD_TREE_DEPTH;_this192._modelInfos=
28698
28700
  * @param {Function} ok Callback fired on success, argument is the ````.xkt```` file in an arraybuffer.
28699
28701
  * @param {Function} error Callback fired on error.
28700
28702
  */},{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
28701
- 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 _a8=i;_a8<s;_a8++){t=t>>>8^n[255&(t^e[_a8])];}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,_i347=-1;if(_i347=a.strategy>=ot||a.level<2?0:a.level<6?1:6===a.level?2:3,_e4|=_i347<<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,_i348=(65535&a.gzhead.extra.length)-a.gzindex;for(;a.pending+_i348>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,_i348-=_n3;}var _n2=new Uint8Array(a.gzhead.extra);a.pending_buf.set(_n2.subarray(a.gzindex,a.gzindex+_i348),a.pending),a.pending+=_i348,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,_i349=a.pending;do{if(a.pending===a.pending_buf_size){if(a.gzhead.hcrc&&a.pending>_i349&&(t.adler=H(t.adler,a.pending_buf,a.pending-_i349,_i349)),xt(t),0!==a.pending)return a.last_flush=-1,tt;_i349=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>_i349&&(t.adler=H(t.adler,a.pending_buf,a.pending-_i349,_i349)),a.gzindex=0;}a.status=91;}if(91===a.status){if(a.gzhead.comment){var _e7,_i350=a.pending;do{if(a.pending===a.pending_buf_size){if(a.gzhead.hcrc&&a.pending>_i350&&(t.adler=H(t.adler,a.pending_buf,a.pending-_i350,_i350)),xt(t),0!==a.pending)return a.last_flush=-1,tt;_i350=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>_i350&&(t.adler=H(t.adler,a.pending_buf,a.pending-_i350,_i350));}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 _i351=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!==_i351&&4!==_i351||(a.status=bt),1===_i351||3===_i351)return 0===t.avail_out&&(a.last_flush=-1),tt;if(2===_i351&&(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 _a9=e.shift();if(_a9){if("object"!=_typeof(_a9))throw new TypeError(_a9+"must be non-object");for(var _e9 in _a9){Ht(_a9,_e9)&&(t[_e9]=_a9[_e9]);}}}return t;},Kt=function Kt(t){var e=0;for(var _a10=0,_i352=t.length;_a10<_i352;_a10++){e+=t[_a10].length;}var a=new Uint8Array(e);for(var _e10=0,_i353=0,_n4=t.length;_e10<_n4;_e10++){var _n5=t[_e10];a.set(_n5,_i353),_i353+=_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 _i354=0;_i354<e;_i354++){a+=String.fromCharCode(t[_i354]);}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});/*
28703
+ 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 _a8=i;_a8<s;_a8++){t=t>>>8^n[255&(t^e[_a8])];}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,_i348=-1;if(_i348=a.strategy>=ot||a.level<2?0:a.level<6?1:6===a.level?2:3,_e4|=_i348<<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,_i349=(65535&a.gzhead.extra.length)-a.gzindex;for(;a.pending+_i349>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,_i349-=_n3;}var _n2=new Uint8Array(a.gzhead.extra);a.pending_buf.set(_n2.subarray(a.gzindex,a.gzindex+_i349),a.pending),a.pending+=_i349,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,_i350=a.pending;do{if(a.pending===a.pending_buf_size){if(a.gzhead.hcrc&&a.pending>_i350&&(t.adler=H(t.adler,a.pending_buf,a.pending-_i350,_i350)),xt(t),0!==a.pending)return a.last_flush=-1,tt;_i350=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>_i350&&(t.adler=H(t.adler,a.pending_buf,a.pending-_i350,_i350)),a.gzindex=0;}a.status=91;}if(91===a.status){if(a.gzhead.comment){var _e7,_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;}_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>_i351&&(t.adler=H(t.adler,a.pending_buf,a.pending-_i351,_i351));}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 _i352=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!==_i352&&4!==_i352||(a.status=bt),1===_i352||3===_i352)return 0===t.avail_out&&(a.last_flush=-1),tt;if(2===_i352&&(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 _a9=e.shift();if(_a9){if("object"!=_typeof(_a9))throw new TypeError(_a9+"must be non-object");for(var _e9 in _a9){Ht(_a9,_e9)&&(t[_e9]=_a9[_e9]);}}}return t;},Kt=function Kt(t){var e=0;for(var _a10=0,_i353=t.length;_a10<_i353;_a10++){e+=t[_a10].length;}var a=new Uint8Array(e);for(var _e10=0,_i354=0,_n4=t.length;_e10<_n4;_e10++){var _n5=t[_e10];a.set(_n5,_i354),_i354+=_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 _i355=0;_i355<e;_i355++){a+=String.fromCharCode(t[_i355]);}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});/*
28702
28704
 
28703
28705
  Parser for .XKT Format V1
28704
28706
 
@@ -28707,7 +28709,7 @@ var isBase64=!!dataUriRegexResult[2];var data=dataUriRegexResult[3];data=window.
28707
28709
  DEPRECATED
28708
28710
 
28709
28711
  */var pako$a=window.pako||p;if(!pako$a.inflate){// See https://github.com/nodeca/pako/issues/97
28710
- 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 _i355=0;_i355<numEntities;_i355++){var xktEntityId=entityIDs[_i355];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=_i355===numEntities-1;var meshIds=[];for(var j=entityMeshes[_i355],jlen=lastEntity?entityMeshes.length:entityMeshes[_i355+1];j<jlen;j++){var lastMesh=j===numMeshes-1;var meshId=entityId+".mesh."+j;var _color6=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:_color6,opacity:_opacity}));meshIds.push(meshId);}sceneModel.createEntity(utils.apply(entityDefaults,{id:entityId,isObject:entityIsObjects[_i355]===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);}};/*
28712
+ 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 _i356=0;_i356<numEntities;_i356++){var xktEntityId=entityIDs[_i356];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=_i356===numEntities-1;var meshIds=[];for(var j=entityMeshes[_i356],jlen=lastEntity?entityMeshes.length:entityMeshes[_i356+1];j<jlen;j++){var lastMesh=j===numMeshes-1;var meshId=entityId+".mesh."+j;var _color6=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:_color6,opacity:_opacity}));meshIds.push(meshId);}sceneModel.createEntity(utils.apply(entityDefaults,{id:entityId,isObject:entityIsObjects[_i356]===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);}};/*
28711
28713
 
28712
28714
  Parser for .XKT Format V2
28713
28715
 
@@ -28716,14 +28718,14 @@ DEPRECATED
28716
28718
  .XKT specifications: https://github.com/xeokit/xeokit-sdk/wiki/XKT-Format
28717
28719
 
28718
28720
  */var pako$9=window.pako||p;if(!pako$9.inflate){// See https://github.com/nodeca/pako/issues/97
28719
- 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 _i356=0;_i356<numEntities;_i356++){var xktEntityId=entityIDs[_i356];var entityId=options.globalizeObjectIds?math.globalizeObjectId(sceneModel.id,xktEntityId):xktEntityId;var metaObject=viewer.metaScene.metaObjects[entityId];var entityDefaults={};var meshDefaults={};var entityMatrix=entityMatrices.subarray(_i356*16,_i356*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=_i356===numEntities-1;var meshIds=[];for(var j=entityMeshes[_i356],jlen=lastEntity?entityMeshIds.length:entityMeshes[_i356+1];j<jlen;j++){var jj=entityMeshIds[j];var lastMesh=jj===numMeshes-1;var meshId=manifestCtx.getNextId();var _color7=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[_i356]===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:_color7,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:_color7,opacity:_opacity2}));meshIds.push(meshId);}}if(meshIds.length){sceneModel.createEntity(utils.apply(entityDefaults,{id:entityId,isObject:entityIsObjects[_i356]===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);}};/*
28721
+ 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 _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={};var entityMatrix=entityMatrices.subarray(_i357*16,_i357*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=_i357===numEntities-1;var meshIds=[];for(var j=entityMeshes[_i357],jlen=lastEntity?entityMeshIds.length:entityMeshes[_i357+1];j<jlen;j++){var jj=entityMeshIds[j];var lastMesh=jj===numMeshes-1;var meshId=manifestCtx.getNextId();var _color7=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[_i357]===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:_color7,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:_color7,opacity:_opacity2}));meshIds.push(meshId);}}if(meshIds.length){sceneModel.createEntity(utils.apply(entityDefaults,{id:entityId,isObject:entityIsObjects[_i357]===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);}};/*
28720
28722
 
28721
28723
  Parser for .XKT Format V3
28722
28724
 
28723
28725
  .XKT specifications: https://github.com/xeokit/xeokit-sdk/wiki/XKT-Format
28724
28726
 
28725
28727
  */var pako$8=window.pako||p;if(!pako$8.inflate){// See https://github.com/nodeca/pako/issues/97
28726
- 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 _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={};var entityMatrix=entityMatrices.subarray(_i357*16,_i357*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=_i357===numEntities-1;var meshIds=[];for(var j=entityMeshes[_i357],jlen=lastEntity?entityMeshIds.length:entityMeshes[_i357+1];j<jlen;j++){var jj=entityMeshIds[j];var lastMesh=jj===numMeshes-1;var meshId="".concat(modelPartId,".").concat(entityId,".mesh.").concat(jj);var _color8=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[_i357]===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:_color8,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:_color8,opacity:_opacity3}));meshIds.push(meshId);}}if(meshIds.length){sceneModel.createEntity(utils.apply(entityDefaults,{id:entityId,isObject:entityIsObjects[_i357]===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);}};/*
28728
+ 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 _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="".concat(modelPartId,".").concat(entityId,".mesh.").concat(jj);var _color8=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[_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.instancedPositionsDecodeMatrix});_alreadyCreatedGeometries[geometryId]=true;}sceneModel.createMesh(utils.apply(meshDefaults,{id:meshId,color:_color8,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:_color8,opacity:_opacity3}));meshIds.push(meshId);}}if(meshIds.length){sceneModel.createEntity(utils.apply(entityDefaults,{id:entityId,isObject:entityIsObjects[_i358]===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);}};/*
28727
28729
 
28728
28730
  Parser for .XKT Format V4
28729
28731
 
@@ -28797,7 +28799,7 @@ indices:elements[3],edgeIndices:elements[4],// Transform matrices
28797
28799
  matrices:elements[5],reusedGeometriesDecodeMatrix:elements[6],// Geometries
28798
28800
  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
28799
28801
  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
28800
- 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 _i358=0,len=colorsRGB.length;_i358<len;_i358+=3){colorsRGBA.push(colorsRGB[_i358]);colorsRGBA.push(colorsRGB[_i358+1]);colorsRGBA.push(colorsRGB[_i358+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
28802
+ 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 _i359=0,len=colorsRGB.length;_i359<len;_i359+=3){colorsRGBA.push(colorsRGB[_i359]);colorsRGBA.push(colorsRGB[_i359+1]);colorsRGBA.push(colorsRGB[_i359+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
28801
28803
  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
28802
28804
  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
28803
28805
  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
@@ -28816,7 +28818,7 @@ types:elements[0],eachMetaObjectId:elements[1],eachMetaObjectType:elements[2],ea
28816
28818
  matrices:elements[10],reusedGeometriesDecodeMatrix:elements[11],// Geometries
28817
28819
  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
28818
28820
  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
28819
- 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 _i359=0,len=colorsRGB.length;_i359<len;_i359+=3){colorsRGBA.push(colorsRGB[_i359]);colorsRGBA.push(colorsRGB[_i359+1]);colorsRGBA.push(colorsRGB[_i359+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
28821
+ 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 _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$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
28820
28822
  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
28821
28823
  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
28822
28824
  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
@@ -28825,7 +28827,7 @@ if(options.includeIdsMap&&metaObject.id&&!options.includeIdsMap[metaObject.id]){
28825
28827
  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
28826
28828
  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
28827
28829
  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
28828
- 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 _i360=0,len=geometryPositions.length;_i360<len;_i360+=3){decompressedPositions[_i360+0]=geometryPositions[_i360+0]*reusedGeometriesDecodeMatrix[0]+reusedGeometriesDecodeMatrix[12];decompressedPositions[_i360+1]=geometryPositions[_i360+1]*reusedGeometriesDecodeMatrix[5]+reusedGeometriesDecodeMatrix[13];decompressedPositions[_i360+2]=geometryPositions[_i360+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 _i361=0,_len46=_decompressedPositions.length;_i361<_len46;_i361+=3){tempVec4a$4[0]=_decompressedPositions[_i361+0];tempVec4a$4[1]=_decompressedPositions[_i361+1];tempVec4a$4[2]=_decompressedPositions[_i361+2];tempVec4a$4[3]=1;math.transformVec4(meshMatrix,tempVec4a$4,tempVec4b$4);geometryCompressionUtils.compressPosition(tempVec4b$4,rtcAABB,tempVec4a$4);_positions4[_i361+0]=tempVec4a$4[0];_positions4[_i361+1]=tempVec4a$4[1];_positions4[_i361+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);}};/*
28830
+ 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 _i361=0,len=geometryPositions.length;_i361<len;_i361+=3){decompressedPositions[_i361+0]=geometryPositions[_i361+0]*reusedGeometriesDecodeMatrix[0]+reusedGeometriesDecodeMatrix[12];decompressedPositions[_i361+1]=geometryPositions[_i361+1]*reusedGeometriesDecodeMatrix[5]+reusedGeometriesDecodeMatrix[13];decompressedPositions[_i361+2]=geometryPositions[_i361+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 _i362=0,_len46=_decompressedPositions.length;_i362<_len46;_i362+=3){tempVec4a$4[0]=_decompressedPositions[_i362+0];tempVec4a$4[1]=_decompressedPositions[_i362+1];tempVec4a$4[2]=_decompressedPositions[_i362+2];tempVec4a$4[3]=1;math.transformVec4(meshMatrix,tempVec4a$4,tempVec4b$4);geometryCompressionUtils.compressPosition(tempVec4b$4,rtcAABB,tempVec4a$4);_positions4[_i362+0]=tempVec4a$4[0];_positions4[_i362+1]=tempVec4a$4[1];_positions4[_i362+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);}};/*
28829
28831
 
28830
28832
  Parser for .XKT Format V9
28831
28833
 
@@ -28845,7 +28847,7 @@ if(options.includeIdsMap&&metaObject.id&&!options.includeIdsMap[metaObject.id]){
28845
28847
  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
28846
28848
  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
28847
28849
  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
28848
- 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 _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 _decompressedPositions2=geometryArrays.decompressedPositions;var transformedAndRecompressedPositions=geometryArrays.transformedAndRecompressedPositions;for(var _i363=0,_len47=_decompressedPositions2.length;_i363<_len47;_i363+=3){tempVec4a$3[0]=_decompressedPositions2[_i363+0];tempVec4a$3[1]=_decompressedPositions2[_i363+1];tempVec4a$3[2]=_decompressedPositions2[_i363+2];tempVec4a$3[3]=1;math.transformVec4(meshMatrix,tempVec4a$3,tempVec4b$3);geometryCompressionUtils.compressPosition(tempVec4b$3,rtcAABB,tempVec4a$3);transformedAndRecompressedPositions[_i363+0]=tempVec4a$3[0];transformedAndRecompressedPositions[_i363+1]=tempVec4a$3[1];transformedAndRecompressedPositions[_i363+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);}};/*
28850
+ 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 _i363=0,len=geometryPositions.length;_i363<len;_i363+=3){decompressedPositions[_i363+0]=geometryPositions[_i363+0]*reusedGeometriesDecodeMatrix[0]+reusedGeometriesDecodeMatrix[12];decompressedPositions[_i363+1]=geometryPositions[_i363+1]*reusedGeometriesDecodeMatrix[5]+reusedGeometriesDecodeMatrix[13];decompressedPositions[_i363+2]=geometryPositions[_i363+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 _i364=0,_len47=_decompressedPositions2.length;_i364<_len47;_i364+=3){tempVec4a$3[0]=_decompressedPositions2[_i364+0];tempVec4a$3[1]=_decompressedPositions2[_i364+1];tempVec4a$3[2]=_decompressedPositions2[_i364+2];tempVec4a$3[3]=1;math.transformVec4(meshMatrix,tempVec4a$3,tempVec4b$3);geometryCompressionUtils.compressPosition(tempVec4b$3,rtcAABB,tempVec4a$3);transformedAndRecompressedPositions[_i364+0]=tempVec4a$3[0];transformedAndRecompressedPositions[_i364+1]=tempVec4a$3[1];transformedAndRecompressedPositions[_i364+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);}};/*
28849
28851
  Parser for .XKT Format V10
28850
28852
  */var pako$1=window.pako||p;if(!pako$1.inflate){// See https://github.com/nodeca/pako/issues/97
28851
28853
  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?
@@ -28867,8 +28869,8 @@ if(options.includeIdsMap&&metaObject.id&&!options.includeIdsMap[metaObject.id]){
28867
28869
  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
28868
28870
  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
28869
28871
  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
28870
- 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 _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 _decompressedPositions3=geometryArrays.decompressedPositions;var transformedAndRecompressedPositions=geometryArrays.transformedAndRecompressedPositions;for(var _i365=0,_len48=_decompressedPositions3.length;_i365<_len48;_i365+=3){tempVec4a$2[0]=_decompressedPositions3[_i365+0];tempVec4a$2[1]=_decompressedPositions3[_i365+1];tempVec4a$2[2]=_decompressedPositions3[_i365+2];tempVec4a$2[3]=1;math.transformVec4(meshMatrix,tempVec4a$2,tempVec4b$2);geometryCompressionUtils.compressPosition(tempVec4b$2,rtcAABB,tempVec4a$2);transformedAndRecompressedPositions[_i365+0]=tempVec4a$2[0];transformedAndRecompressedPositions[_i365+1]=tempVec4a$2[1];transformedAndRecompressedPositions[_i365+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
28871
- 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 _i366=0,len=indices.length-1;_i366<len;_i366++){linesIndices.push(indices[_i366]);linesIndices.push(indices[_i366+1]);}}else if(positions.length>1){for(var _i367=0,_len49=positions.length/3-1;_i367<_len49;_i367++){linesIndices.push(_i367);linesIndices.push(_i367+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);}};/*
28872
+ 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 _i365=0,len=geometryPositions.length;_i365<len;_i365+=3){decompressedPositions[_i365+0]=geometryPositions[_i365+0]*reusedGeometriesDecodeMatrix[0]+reusedGeometriesDecodeMatrix[12];decompressedPositions[_i365+1]=geometryPositions[_i365+1]*reusedGeometriesDecodeMatrix[5]+reusedGeometriesDecodeMatrix[13];decompressedPositions[_i365+2]=geometryPositions[_i365+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 _i366=0,_len48=_decompressedPositions3.length;_i366<_len48;_i366+=3){tempVec4a$2[0]=_decompressedPositions3[_i366+0];tempVec4a$2[1]=_decompressedPositions3[_i366+1];tempVec4a$2[2]=_decompressedPositions3[_i366+2];tempVec4a$2[3]=1;math.transformVec4(meshMatrix,tempVec4a$2,tempVec4b$2);geometryCompressionUtils.compressPosition(tempVec4b$2,rtcAABB,tempVec4a$2);transformedAndRecompressedPositions[_i366+0]=tempVec4a$2[0];transformedAndRecompressedPositions[_i366+1]=tempVec4a$2[1];transformedAndRecompressedPositions[_i366+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
28873
+ 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 _i367=0,len=indices.length-1;_i367<len;_i367++){linesIndices.push(indices[_i367]);linesIndices.push(indices[_i367+1]);}}else if(positions.length>1){for(var _i368=0,_len49=positions.length/3-1;_i368<_len49;_i368++){linesIndices.push(_i368);linesIndices.push(_i368+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);}};/*
28872
28874
  Parser for .XKT Format V11
28873
28875
  */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
28874
28876
  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?
@@ -28890,8 +28892,8 @@ if(options.includeIdsMap&&metaObject.id&&!options.includeIdsMap[metaObject.id]){
28890
28892
  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
28891
28893
  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
28892
28894
  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
28893
- 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 _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 _decompressedPositions4=geometryArrays.decompressedPositions;var transformedAndRecompressedPositions=geometryArrays.transformedAndRecompressedPositions;for(var _i369=0,_len50=_decompressedPositions4.length;_i369<_len50;_i369+=3){tempVec4a$1[0]=_decompressedPositions4[_i369+0];tempVec4a$1[1]=_decompressedPositions4[_i369+1];tempVec4a$1[2]=_decompressedPositions4[_i369+2];tempVec4a$1[3]=1;math.transformVec4(meshMatrix,tempVec4a$1,tempVec4b$1);geometryCompressionUtils.compressPosition(tempVec4b$1,rtcAABB,tempVec4a$1);transformedAndRecompressedPositions[_i369+0]=tempVec4a$1[0];transformedAndRecompressedPositions[_i369+1]=tempVec4a$1[1];transformedAndRecompressedPositions[_i369+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
28894
- 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 _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,_len51=positions.length/3-1;_i371<_len51;_i371++){linesIndices.push(_i371);linesIndices.push(_i371+1);}}return linesIndices;}/** @private */ // V11 uses a single uncompressed Uint8Array buffer to store arrays of different types.
28895
+ 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 _i369=0,len=geometryPositions.length;_i369<len;_i369+=3){decompressedPositions[_i369+0]=geometryPositions[_i369+0]*reusedGeometriesDecodeMatrix[0]+reusedGeometriesDecodeMatrix[12];decompressedPositions[_i369+1]=geometryPositions[_i369+1]*reusedGeometriesDecodeMatrix[5]+reusedGeometriesDecodeMatrix[13];decompressedPositions[_i369+2]=geometryPositions[_i369+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 _i370=0,_len50=_decompressedPositions4.length;_i370<_len50;_i370+=3){tempVec4a$1[0]=_decompressedPositions4[_i370+0];tempVec4a$1[1]=_decompressedPositions4[_i370+1];tempVec4a$1[2]=_decompressedPositions4[_i370+2];tempVec4a$1[3]=1;math.transformVec4(meshMatrix,tempVec4a$1,tempVec4b$1);geometryCompressionUtils.compressPosition(tempVec4b$1,rtcAABB,tempVec4a$1);transformedAndRecompressedPositions[_i370+0]=tempVec4a$1[0];transformedAndRecompressedPositions[_i370+1]=tempVec4a$1[1];transformedAndRecompressedPositions[_i370+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
28896
+ 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 _i371=0,len=indices.length-1;_i371<len;_i371++){linesIndices.push(indices[_i371]);linesIndices.push(indices[_i371+1]);}}else if(positions.length>1){for(var _i372=0,_len51=positions.length/3-1;_i372<_len51;_i372++){linesIndices.push(_i372);linesIndices.push(_i372+1);}}return linesIndices;}/** @private */ // V11 uses a single uncompressed Uint8Array buffer to store arrays of different types.
28895
28897
  // To efficiently create typed arrays from this buffer,
28896
28898
  // each typed array's source data needs to be aligned with its element byte size.
28897
28899
  // This sometimes requires padding subarrays inside the single Uint8Array, so the byteOffset needs to be stored alongside element count.
@@ -28921,9 +28923,9 @@ if(options.includeIdsMap&&metaObject.id&&!options.includeIdsMap[metaObject.id]){
28921
28923
  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
28922
28924
  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
28923
28925
  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
28924
- 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 _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 _decompressedPositions5=geometryArrays.decompressedPositions;var transformedAndRecompressedPositions=geometryArrays.transformedAndRecompressedPositions;for(var _i373=0,_len52=_decompressedPositions5.length;_i373<_len52;_i373+=3){tempVec4a[0]=_decompressedPositions5[_i373+0];tempVec4a[1]=_decompressedPositions5[_i373+1];tempVec4a[2]=_decompressedPositions5[_i373+2];tempVec4a[3]=1;math.transformVec4(meshMatrix,tempVec4a,tempVec4b);geometryCompressionUtils.compressPosition(tempVec4b,rtcAABB,tempVec4a);transformedAndRecompressedPositions[_i373+0]=tempVec4a[0];transformedAndRecompressedPositions[_i373+1]=tempVec4a[1];transformedAndRecompressedPositions[_i373+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
28926
+ 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 _i373=0,len=geometryPositions.length;_i373<len;_i373+=3){decompressedPositions[_i373+0]=geometryPositions[_i373+0]*reusedGeometriesDecodeMatrix[0]+reusedGeometriesDecodeMatrix[12];decompressedPositions[_i373+1]=geometryPositions[_i373+1]*reusedGeometriesDecodeMatrix[5]+reusedGeometriesDecodeMatrix[13];decompressedPositions[_i373+2]=geometryPositions[_i373+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 _i374=0,_len52=_decompressedPositions5.length;_i374<_len52;_i374+=3){tempVec4a[0]=_decompressedPositions5[_i374+0];tempVec4a[1]=_decompressedPositions5[_i374+1];tempVec4a[2]=_decompressedPositions5[_i374+2];tempVec4a[3]=1;math.transformVec4(meshMatrix,tempVec4a,tempVec4b);geometryCompressionUtils.compressPosition(tempVec4b,rtcAABB,tempVec4a);transformedAndRecompressedPositions[_i374+0]=tempVec4a[0];transformedAndRecompressedPositions[_i374+1]=tempVec4a[1];transformedAndRecompressedPositions[_i374+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
28925
28927
  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
28926
- 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 _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,_len53=positions.length/3-1;_i375<_len53;_i375++){linesIndices.push(_i375);linesIndices.push(_i375+1);}}return linesIndices;}/** @private */ // V11 uses a single uncompressed Uint8Array buffer to store arrays of different types.
28928
+ 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 _i375=0,len=indices.length-1;_i375<len;_i375++){linesIndices.push(indices[_i375]);linesIndices.push(indices[_i375+1]);}}else if(positions.length>1){for(var _i376=0,_len53=positions.length/3-1;_i376<_len53;_i376++){linesIndices.push(_i376);linesIndices.push(_i376+1);}}return linesIndices;}/** @private */ // V11 uses a single uncompressed Uint8Array buffer to store arrays of different types.
28927
28929
  // To efficiently create typed arrays from this buffer,
28928
28930
  // each typed array's source data needs to be aligned with its element byte size.
28929
28931
  // This sometimes requires padding subarrays inside the single Uint8Array, so the byteOffset needs to be stored alongside element count.
@@ -29711,13 +29713,13 @@ var ParserV12={version:12,parseArrayBuffer:function parseArrayBuffer(viewer,opti
29711
29713
  * SceneModels are drawn when they have transparent objects, to give control over the order in which those objects are blended within the transparent
29712
29714
  * render pass.
29713
29715
  * @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}.
29714
- */},{key:"load",value:function load(){var _this195=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 _i376=0,len=includeTypes.length;_i376<len;_i376++){options.includeTypesMap[includeTypes[_i376]]=true;}}if(excludeTypes){options.excludeTypesMap={};for(var _i377=0,_len54=excludeTypes.length;_i377<_len54;_i377++){options.excludeTypesMap[excludeTypes[_i377]]=true;}}if(includeIds){options.includeIdsMap={};for(var _i378=0,_len55=includeIds.length;_i378<_len55;_i378++){options.includeIdsMap[includeIds[_i378]]=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
29716
+ */},{key:"load",value:function load(){var _this195=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 _i377=0,len=includeTypes.length;_i377<len;_i377++){options.includeTypesMap[includeTypes[_i377]]=true;}}if(excludeTypes){options.excludeTypesMap={};for(var _i378=0,_len54=excludeTypes.length;_i378<_len54;_i378++){options.excludeTypesMap[excludeTypes[_i378]]=true;}}if(includeIds){options.includeIdsMap={};for(var _i379=0,_len55=includeIds.length;_i379<_len55;_i379++){options.includeIdsMap[includeIds[_i379]]=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
29715
29717
  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);
29716
29718
  sceneModel.finalize();metaModel.finalize();_this195.viewer.scene.canvas.spinner.processes--;sceneModel.once("destroyed",function(){_this195.viewer.metaScene.destroyMetaModel(metaModel.id);});_this195.scheduleTask(function(){if(sceneModel.destroyed){return;}sceneModel.scene.fire("modelLoaded",sceneModel.id);// FIXME: Assumes listeners know order of these two events
29717
29719
  sceneModel.fire("loaded",true,false);// Don't forget the event, for late subscribers
29718
29720
  });};var error=function error(errMsg){_this195.viewer.scene.canvas.spinner.processes--;_this195.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){_this195._loadModel(params.src,options,sceneModel,null,manifestCtx,finish,error);}else{_this195._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{_this195._dataSource.getMetaModel("".concat(baseDir).concat(metaDataFiles[i]),function(metaModelData){metaModel.loadData(metaModelData,{includeTypes:includeTypes,excludeTypes:excludeTypes,globalizeObjectIds:options.globalizeObjectIds});i++;_this195.scheduleTask(loadNext,200);},error);}};loadNext();};var loadXKTs_excludeTheirMetaModels=function loadXKTs_excludeTheirMetaModels(xktFiles,done,error){// Load XKTs, ignore metamodels in the XKT
29719
29721
  var i=0;var loadNext=function loadNext(){if(sceneModel.destroyed){done();}else if(i>=xktFiles.length){done();}else{_this195._dataSource.getXKT("".concat(baseDir).concat(xktFiles[i]),function(arrayBuffer){_this195._parseModel(arrayBuffer,options,sceneModel,null/* Ignore metamodel in XKT */,manifestCtx);sceneModel.preFinalize();i++;_this195.scheduleTask(loadNext,200);},error);}};loadNext();};var loadXKTs_includeTheirMetaModels=function loadXKTs_includeTheirMetaModels(xktFiles,done,error){// Load XKTs, parse metamodels from the XKT
29720
- var i=0;var loadNext=function loadNext(){if(sceneModel.destroyed){done();}else if(i>=xktFiles.length){done();}else{_this195._dataSource.getXKT("".concat(baseDir).concat(xktFiles[i]),function(arrayBuffer){_this195._parseModel(arrayBuffer,options,sceneModel,metaModel,manifestCtx);sceneModel.preFinalize();i++;_this195.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 _this196=this;this._dataSource.getXKT(src,function(arrayBuffer){_this196._parseModel(arrayBuffer,options,sceneModel,metaModel,manifestCtx);sceneModel.preFinalize();done();},error);}},{key:"_parseModel",value:function(){var _parseModel2=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee7(arrayBuffer,options,sceneModel,metaModel,manifestCtx){var dataView,dataArray,firstUint,xktVersion,zipped,parser,numElements,elements,byteOffset,_i379,elementSize;return _regeneratorRuntime().wrap(function _callee7$(_context11){while(1){switch(_context11.prev=_context11.next){case 0:if(!sceneModel.destroyed){_context11.next=2;break;}return _context11.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){_context11.next=11;break;}this.error("Unsupported .XKT file version: "+xktVersion+" - this XKTLoaderPlugin supports versions "+Object.keys(parsers));return _context11.abrupt("return");case 11:if(zipped){_context11.next=14;break;}parser.parseArrayBuffer(this.viewer,options,arrayBuffer,sceneModel,metaModel,manifestCtx);return _context11.abrupt("return");case 14:numElements=dataView.getUint32(4,true);elements=[];byteOffset=(numElements+2)*4;for(_i379=0;_i379<numElements;_i379++){elementSize=dataView.getUint32((_i379+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 _context11.stop();}}},_callee7,this);}));function _parseModel(_x115,_x116,_x117,_x118,_x119){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
29722
+ var i=0;var loadNext=function loadNext(){if(sceneModel.destroyed){done();}else if(i>=xktFiles.length){done();}else{_this195._dataSource.getXKT("".concat(baseDir).concat(xktFiles[i]),function(arrayBuffer){_this195._parseModel(arrayBuffer,options,sceneModel,metaModel,manifestCtx);sceneModel.preFinalize();i++;_this195.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 _this196=this;this._dataSource.getXKT(src,function(arrayBuffer){_this196._parseModel(arrayBuffer,options,sceneModel,metaModel,manifestCtx);sceneModel.preFinalize();done();},error);}},{key:"_parseModel",value:function(){var _parseModel2=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee7(arrayBuffer,options,sceneModel,metaModel,manifestCtx){var dataView,dataArray,firstUint,xktVersion,zipped,parser,numElements,elements,byteOffset,_i380,elementSize;return _regeneratorRuntime().wrap(function _callee7$(_context11){while(1){switch(_context11.prev=_context11.next){case 0:if(!sceneModel.destroyed){_context11.next=2;break;}return _context11.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){_context11.next=11;break;}this.error("Unsupported .XKT file version: "+xktVersion+" - this XKTLoaderPlugin supports versions "+Object.keys(parsers));return _context11.abrupt("return");case 11:if(zipped){_context11.next=14;break;}parser.parseArrayBuffer(this.viewer,options,arrayBuffer,sceneModel,metaModel,manifestCtx);return _context11.abrupt("return");case 14:numElements=dataView.getUint32(4,true);elements=[];byteOffset=(numElements+2)*4;for(_i380=0;_i380<numElements;_i380++){elementSize=dataView.getUint32((_i380+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 _context11.stop();}}},_callee7,this);}));function _parseModel(_x115,_x116,_x117,_x118,_x119){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
29721
29723
  return pathArray.join('/')+'/';}/*
29722
29724
  Copyright (c) 2013 Gildas Lormeau. All rights reserved.
29723
29725
 
@@ -30585,12 +30587,12 @@ var isBase64=!!dataUriRegexResult[2];var data=dataUriRegexResult[3];data=window.
30585
30587
  * primitives. Only works while {@link DTX#enabled} is also ````true````.
30586
30588
  * @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}.
30587
30589
  */},{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
30588
- }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 _i380=0,len=includeTypes.length;_i380<len;_i380++){options.includeTypesMap[includeTypes[_i380]]=true;}}if(excludeTypes){options.excludeTypesMap={};for(var _i381=0,_len56=excludeTypes.length;_i381<_len56;_i381++){options.excludeTypesMap[excludeTypes[_i381]]=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 _this199=this;var spinner=this.viewer.scene.canvas.spinner;spinner.processes++;this._dataSource.getIFC(params.src,function(arrayBuffer){_this199._parseModel(arrayBuffer,params,options,sceneModel);spinner.processes--;},function(errMsg){spinner.processes--;_this199.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 _i382=0,len=options.includeTypes.length;_i382<len;_i382++){ctx.includeTypes[options.includeTypes[_i382]]=true;}}if(options.excludeTypes){ctx.excludeTypes={};for(var _i383=0,_len57=options.excludeTypes.length;_i383<_len57;_i383++){ctx.excludeTypes[options.excludeTypes[_i383]]=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
30590
+ }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 _i381=0,len=includeTypes.length;_i381<len;_i381++){options.includeTypesMap[includeTypes[_i381]]=true;}}if(excludeTypes){options.excludeTypesMap={};for(var _i382=0,_len56=excludeTypes.length;_i382<_len56;_i382++){options.excludeTypesMap[excludeTypes[_i382]]=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 _this199=this;var spinner=this.viewer.scene.canvas.spinner;spinner.processes++;this._dataSource.getIFC(params.src,function(arrayBuffer){_this199._parseModel(arrayBuffer,params,options,sceneModel);spinner.processes--;},function(errMsg){spinner.processes--;_this199.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 _i383=0,len=options.includeTypes.length;_i383<len;_i383++){ctx.includeTypes[options.includeTypes[_i383]]=true;}}if(options.excludeTypes){ctx.excludeTypes={};for(var _i384=0,_len57=options.excludeTypes.length;_i384<_len57;_i384++){ctx.excludeTypes[options.excludeTypes[_i384]]=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
30589
30591
  sceneModel.fire("loaded",true,false);// Don't forget the event, for late subscribers
30590
- });}},{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 _this200=this;var lines=this._ifcAPI.GetLineIDsWithType(ctx.modelID,type);for(var _i384=0;_i384<lines.size();_i384++){var relID=lines.get(_i384);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=_this200._ifcAPI.GetLine(ctx.modelID,element2.value);_this200._parseSpatialChildren(ctx,ifcElement,parentMetaObjectId);});}}}}},{key:"_parsePropertySets",value:function _parsePropertySets(ctx){var lines=this._ifcAPI.GetLineIDsWithType(ctx.modelID,this._webIFC.IFCRELDEFINESBYPROPERTIES);for(var _i385=0;_i385<lines.size();_i385++){var relID=lines.get(_i385);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 _i386=0,len=props.length;_i386<len;_i386++){var prop=props[_i386];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 _i387=0,_len58=relatedObjects.length;_i387<_len58;_i387++){var relatedObject=relatedObjects[_i387];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 _this201=this;this._ifcAPI.StreamAllMeshes(ctx.modelID,function(flatMesh){// TODO: Can we do geometry reuse with web-ifc?
30592
+ });}},{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 _this200=this;var lines=this._ifcAPI.GetLineIDsWithType(ctx.modelID,type);for(var _i385=0;_i385<lines.size();_i385++){var relID=lines.get(_i385);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=_this200._ifcAPI.GetLine(ctx.modelID,element2.value);_this200._parseSpatialChildren(ctx,ifcElement,parentMetaObjectId);});}}}}},{key:"_parsePropertySets",value:function _parsePropertySets(ctx){var lines=this._ifcAPI.GetLineIDsWithType(ctx.modelID,this._webIFC.IFCRELDEFINESBYPROPERTIES);for(var _i386=0;_i386<lines.size();_i386++){var relID=lines.get(_i386);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 _i387=0,len=props.length;_i387<len;_i387++){var prop=props[_i387];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 _i388=0,_len58=relatedObjects.length;_i388<_len58;_i388++){var relatedObject=relatedObjects[_i388];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 _this201=this;this._ifcAPI.StreamAllMeshes(ctx.modelID,function(flatMesh){// TODO: Can we do geometry reuse with web-ifc?
30591
30593
  var flatMeshExpressID=flatMesh.expressID;var placedGeometries=flatMesh.geometries;var meshIds=[];var properties=_this201._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=_this201._ifcAPI.GetGeometry(ctx.modelID,placedGeometry.geometryExpressID);var vertexData=_this201._ifcAPI.GetVertexArray(geometry.GetVertexData(),geometry.GetVertexDataSize());var indices=_this201._ifcAPI.GetIndexArray(geometry.GetIndexData(),geometry.GetIndexDataSize());// De-interleave vertex arrays
30592
30594
  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
30593
- 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);var name="@creooxag/cxconverter";var version="0.0.3-alpha";var description="";var exports$1={".":{types:"./dist/index.d.ts","import":"./dist/index.mjs",require:"./dist/index.cjs"}};var main="./dist/index.mjs";var module$1="./dist/index.mjs";var types="./dist/index.d.ts";var typesVersions={"*":{"*":["./dist/*","./dist/index.d.ts"]}};var files=["dist/"];var scripts={"clean-dist":"rm -rf ./dist","clean-cmake":"rm -rf ./cmake-build","build-wasm-release":"emcmake cmake -S . -B ../cmake-build -DCMAKE_BUILD_TYPE=Release && cmake --build ../cmake-build","publish-npm":"npm publish --access public",build:"unbuild",dev:"unbuild --stub",lint:"eslint .",start:"esno examples/node/nodeExport.ts","example-html":"http-server -c-1 -p8237 --cors"};var keywords=[];var devDependencies={"@types/node":"^22.10.2",esno:"^4.8.0","fast-glob":"^3.3.2",globals:"^15.8.0","http-server":"^14.1.1",prettier:"^3.3.3","prettier-eslint":"^16.3.0",typescript:"^5.7.2",unbuild:"^2.0.0","@eslint/eslintrc":"^3.2.0","@eslint/js":"^9.20.0","@typescript-eslint/eslint-plugin":"^8.24.0","@typescript-eslint/parser":"^8.24.0",eslint:"^9.20.1","eslint-config-prettier":"^10.0.1","eslint-plugin-import":"^2.31.0","eslint-plugin-prettier":"^5.2.3"};var packageJSON={name:name,version:version,description:description,exports:exports$1,main:main,module:module$1,types:types,typesVersions:typesVersions,files:files,scripts:scripts,keywords:keywords,devDependencies:devDependencies};var __defProp$2=Object.defineProperty;var __defNormalProp$2=function __defNormalProp$2(obj,key,value){return key in obj?__defProp$2(obj,key,{enumerable:true,configurable:true,writable:true,value:value}):obj[key]=value;};var __publicField$2=function __publicField$2(obj,key,value){__defNormalProp$2(obj,_typeof(key)!=="symbol"?key+"":key,value);return value;};var IfcDbWasm=/* @__PURE__ */function(){return/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee14(){var moduleArg,moduleRtn,Module,readyPromiseResolve,readyPromiseReject,readyPromise,arguments_,thisProgram,quit_,_scriptName,scriptDirectory,locateFile,readAsync,readBinary,out,err,wasmBinary,wasmMemory,ABORT,EXITSTATUS,HEAP8,HEAPU8,HEAP16,HEAPU16,HEAP32,HEAPU32,HEAPF32,HEAP64,HEAPU64,HEAPF64,updateMemoryViews,preRun,initRuntime,postRun,runDependencies,dependenciesFulfilled,addRunDependency,removeRunDependency,abort,wasmBinaryFile,findWasmBinary,getBinarySync,getWasmBinary,_getWasmBinary,instantiateArrayBuffer,_instantiateArrayBuffer,instantiateAsync,_instantiateAsync,getWasmImports,createWasm,_createWasm,ExitStatus,callRuntimeCallbacks,onPostRuns,addOnPostRun,onPreRuns,addOnPreRun,dynCallLegacy,dynCall,noExitRuntime,ExceptionInfo,exceptionLast,___cxa_throw,syscallGetVarargI,syscallGetVarargP,PATH,initRandomFill,_randomFill,PATH_FS,UTF8Decoder,UTF8ArrayToString,FS_stdin_getChar_buffer,lengthBytesUTF8,stringToUTF8Array,intArrayFromString,FS_stdin_getChar,TTY,mmapAlloc,MEMFS,asyncLoad,FS_createDataFile,preloadPlugins,FS_handledByPreloadPlugin,FS_createPreloadedFile,FS_modeStringToFlags,FS_getMode,FS,UTF8ToString,SYSCALLS,___syscall_fcntl64,___syscall_ioctl,___syscall_openat,___syscall_renameat,___syscall_rmdir,___syscall_stat64,___syscall_unlinkat,__abort_js,structRegistrations,runDestructors,readPointer,awaitingDependencies,registeredTypes,typeDependencies,InternalError,throwInternalError,whenDependentTypesAreResolved,__embind_finalize_value_object,embind_init_charCodes,embind_charCodes,readLatin1String,BindingError,throwBindingError,sharedRegisterType,registerType,integerReadValueFromPointer,__embind_register_bigint,GenericWireTypeSize,__embind_register_bool,emval_freelist,emval_handles,__emval_decref,Emval,EmValType,__embind_register_emval,floatReadValueFromPointer,__embind_register_float,createNamedFunction,usesDestructorStack,createJsInvoker,runAndAbortIfError,handleException,runtimeKeepaliveCounter,keepRuntimeAlive,_proc_exit,exitJS,_exit,maybeExit,callUserCallback,Asyncify,craftInvokerFunction,ensureOverloadTable,exposePublicSymbol,heap32VectorToArray,replacePublicSymbol,getDynCaller,embind__requireFunction,UnboundTypeError,getTypeName,throwUnboundTypeError,getFunctionName,__embind_register_function,__embind_register_integer,__embind_register_memory_view,stringToUTF8,__embind_register_std_string,UTF16Decoder,UTF16ToString,stringToUTF16,lengthBytesUTF16,UTF32ToString,stringToUTF32,lengthBytesUTF32,__embind_register_std_wstring,__embind_register_value_object,__embind_register_value_object_field,__embind_register_void,requireRegisteredType,emval_returnValue,__emval_as,emval_methodCallers,__emval_call,emval_symbols,getStringOrSymbol,emval_get_global,__emval_get_global,emval_addMethodCaller,emval_lookupTypes,__emval_get_method_caller,__emval_incref,__emval_is_string,__emval_run_destructors,__emval_take_value,INT53_MAX,INT53_MIN,bigintToI53Checked,__gmtime_js,isLeapYear,MONTH_DAYS_LEAP_CUMULATIVE,MONTH_DAYS_REGULAR_CUMULATIVE,ydayFromDate,__localtime_js,__tzset_js,_emscripten_get_now,_emscripten_date_now,checkWasiClock,_clock_time_get,readEmAsmArgsArray,readEmAsmArgs,runEmAsmFunction,_emscripten_asm_const_int,getHeapMax,alignMemory,growMemory,_emscripten_resize_heap,safeSetTimeout,_emscripten_sleep,ENV,getExecutableName,getEnvStrings,_environ_get,_environ_sizes_get,_fd_close,_fd_fdstat_get,doReadv,_fd_read,_fd_seek,doWritev,_fd_write,stackAlloc,stringToUTF8OnStack,ASM_CONSTS,wasmImports,wasmExports,___getTypeName,_malloc,_free,_main,__emscripten_stack_alloc,_asyncify_start_unwind,_asyncify_stop_unwind,_asyncify_start_rewind,_asyncify_stop_rewind,callMain,run,preInit,_args17=arguments;return _regeneratorRuntime().wrap(function _callee14$(_context18){while(1){switch(_context18.prev=_context18.next){case 0:preInit=function _preInit(){if(Module["preInit"]){if(typeof Module["preInit"]=="function")Module["preInit"]=[Module["preInit"]];while(Module["preInit"].length>0){Module["preInit"].shift()();}}};run=function _run(){var args=arguments.length>0&&arguments[0]!==undefined?arguments[0]:arguments_;if(runDependencies>0){dependenciesFulfilled=run;return;}preRun();if(runDependencies>0){dependenciesFulfilled=run;return;}function doRun(){var _Module$onRuntimeInit;Module["calledRun"]=true;if(ABORT)return;initRuntime();readyPromiseResolve(Module);(_Module$onRuntimeInit=Module["onRuntimeInitialized"])===null||_Module$onRuntimeInit===void 0?void 0:_Module$onRuntimeInit.call(Module);var noInitialRun=Module["noInitialRun"]||true;if(!noInitialRun)callMain(args);postRun();}if(Module["setStatus"]){Module["setStatus"]("Running...");setTimeout(function(){setTimeout(function(){return Module["setStatus"]("");},1);doRun();},1);}else{doRun();}};callMain=function _callMain(){var args=arguments.length>0&&arguments[0]!==undefined?arguments[0]:[];var entryFunction=_main;args.unshift(thisProgram);var argc=args.length;var argv=stackAlloc((argc+1)*4);var argv_ptr=argv;args.forEach(function(arg){HEAPU32[argv_ptr>>2]=stringToUTF8OnStack(arg);argv_ptr+=4;});HEAPU32[argv_ptr>>2]=0;try{var ret=entryFunction(argc,argv);exitJS(ret,true);return ret;}catch(e){return handleException(e);}};_fd_write=function _fd_write2(fd,iov,iovcnt,pnum){try{var stream=SYSCALLS.getStreamFromFD(fd);var num=doWritev(stream,iov,iovcnt);HEAPU32[pnum>>2]=num;return 0;}catch(e){if(typeof FS=="undefined"||!(e.name==="ErrnoError"))throw e;return e.errno;}};_fd_seek=function _fd_seek2(fd,offset,whence,newOffset){offset=bigintToI53Checked(offset);try{if(isNaN(offset))return 61;var stream=SYSCALLS.getStreamFromFD(fd);FS.llseek(stream,offset,whence);HEAP64[newOffset>>3]=BigInt(stream.position);if(stream.getdents&&offset===0&&whence===0)stream.getdents=null;return 0;}catch(e){if(typeof FS=="undefined"||!(e.name==="ErrnoError"))throw e;return e.errno;}};_fd_read=function _fd_read2(fd,iov,iovcnt,pnum){try{var stream=SYSCALLS.getStreamFromFD(fd);var num=doReadv(stream,iov,iovcnt);HEAPU32[pnum>>2]=num;return 0;}catch(e){if(typeof FS=="undefined"||!(e.name==="ErrnoError"))throw e;return e.errno;}};_fd_fdstat_get=function _fd_fdstat_get2(fd,pbuf){try{var rightsBase=0;var rightsInheriting=0;var flags=0;{var stream=SYSCALLS.getStreamFromFD(fd);var type=stream.tty?2:FS.isDir(stream.mode)?3:FS.isLink(stream.mode)?7:4;}HEAP8[pbuf]=type;HEAP16[pbuf+2>>1]=flags;HEAP64[pbuf+8>>3]=BigInt(rightsBase);HEAP64[pbuf+16>>3]=BigInt(rightsInheriting);return 0;}catch(e){if(typeof FS=="undefined"||!(e.name==="ErrnoError"))throw e;return e.errno;}};_fd_close=function _fd_close2(fd){try{var stream=SYSCALLS.getStreamFromFD(fd);FS.close(stream);return 0;}catch(e){if(typeof FS=="undefined"||!(e.name==="ErrnoError"))throw e;return e.errno;}};_clock_time_get=function _clock_time_get2(clk_id,ignored_precision,ptime){if(!checkWasiClock(clk_id)){return 28;}var now;if(clk_id===0){now=_emscripten_date_now();}else{now=_emscripten_get_now();}var nsec=Math.round(now*1e3*1e3);HEAP64[ptime>>3]=BigInt(nsec);return 0;};__localtime_js=function _localtime_js(time,tmPtr){time=bigintToI53Checked(time);var date=new Date(time*1e3);HEAP32[tmPtr>>2]=date.getSeconds();HEAP32[tmPtr+4>>2]=date.getMinutes();HEAP32[tmPtr+8>>2]=date.getHours();HEAP32[tmPtr+12>>2]=date.getDate();HEAP32[tmPtr+16>>2]=date.getMonth();HEAP32[tmPtr+20>>2]=date.getFullYear()-1900;HEAP32[tmPtr+24>>2]=date.getDay();var yday=ydayFromDate(date)|0;HEAP32[tmPtr+28>>2]=yday;HEAP32[tmPtr+36>>2]=-(date.getTimezoneOffset()*60);var start=new Date(date.getFullYear(),0,1);var summerOffset=new Date(date.getFullYear(),6,1).getTimezoneOffset();var winterOffset=start.getTimezoneOffset();var dst=(summerOffset!=winterOffset&&date.getTimezoneOffset()==Math.min(winterOffset,summerOffset))|0;HEAP32[tmPtr+32>>2]=dst;};__gmtime_js=function _gmtime_js(time,tmPtr){time=bigintToI53Checked(time);var date=new Date(time*1e3);HEAP32[tmPtr>>2]=date.getUTCSeconds();HEAP32[tmPtr+4>>2]=date.getUTCMinutes();HEAP32[tmPtr+8>>2]=date.getUTCHours();HEAP32[tmPtr+12>>2]=date.getUTCDate();HEAP32[tmPtr+16>>2]=date.getUTCMonth();HEAP32[tmPtr+20>>2]=date.getUTCFullYear()-1900;HEAP32[tmPtr+24>>2]=date.getUTCDay();var start=Date.UTC(date.getUTCFullYear(),0,1,0,0,0,0);var yday=(date.getTime()-start)/(1e3*60*60*24)|0;HEAP32[tmPtr+28>>2]=yday;};craftInvokerFunction=function _craftInvokerFunction(humanName,argTypes,classType,cppInvokerFunc,cppTargetFunc,isAsync){var argCount=argTypes.length;if(argCount<2){throwBindingError("argTypes array size mismatch! Must at least get return value and 'this' types!");}var isClassMethodFunc=argTypes[1]!==null&&classType!==null;var needsDestructorStack=usesDestructorStack(argTypes);var returns=argTypes[0].name!=="void";var closureArgs=[humanName,throwBindingError,cppInvokerFunc,cppTargetFunc,runDestructors,argTypes[0],argTypes[1]];for(var i=0;i<argCount-2;++i){closureArgs.push(argTypes[i+2]);}closureArgs.push(Asyncify);if(!needsDestructorStack){for(var i=isClassMethodFunc?1:2;i<argTypes.length;++i){if(argTypes[i].destructorFunction!==null){closureArgs.push(argTypes[i].destructorFunction);}}}var _createJsInvoker=createJsInvoker(argTypes,isClassMethodFunc,returns,isAsync),_createJsInvoker2=_slicedToArray(_createJsInvoker,2),args=_createJsInvoker2[0],invokerFnBody=_createJsInvoker2[1];var invokerFn=_construct(Function,_toConsumableArray(args).concat([invokerFnBody])).apply(void 0,closureArgs);return createNamedFunction(humanName,invokerFn);};createJsInvoker=function _createJsInvoker3(argTypes,isClassMethodFunc,returns,isAsync){var needsDestructorStack=usesDestructorStack(argTypes);var argCount=argTypes.length-2;var argsList=[];var argsListWired=["fn"];if(isClassMethodFunc){argsListWired.push("thisWired");}for(var i=0;i<argCount;++i){argsList.push("arg".concat(i));argsListWired.push("arg".concat(i,"Wired"));}argsList=argsList.join(",");argsListWired=argsListWired.join(",");var invokerFnBody="return function (".concat(argsList,") {\n");if(needsDestructorStack){invokerFnBody+="var destructors = [];\n";}var dtorStack=needsDestructorStack?"destructors":"null";var args1=["humanName","throwBindingError","invoker","fn","runDestructors","retType","classParam"];if(isClassMethodFunc){invokerFnBody+="var thisWired = classParam['toWireType'](".concat(dtorStack,", this);\n");}for(var i=0;i<argCount;++i){invokerFnBody+="var arg".concat(i,"Wired = argType").concat(i,"['toWireType'](").concat(dtorStack,", arg").concat(i,");\n");args1.push("argType".concat(i));}invokerFnBody+=(returns||isAsync?"var rv = ":"")+"invoker(".concat(argsListWired,");\n");var returnVal=returns?"rv":"";args1.push("Asyncify");invokerFnBody+="function onDone(".concat(returnVal,") {\n");if(needsDestructorStack){invokerFnBody+="runDestructors(destructors);\n";}else{for(var i=isClassMethodFunc?1:2;i<argTypes.length;++i){var paramName=i===1?"thisWired":"arg"+(i-2)+"Wired";if(argTypes[i].destructorFunction!==null){invokerFnBody+="".concat(paramName,"_dtor(").concat(paramName,");\n");args1.push("".concat(paramName,"_dtor"));}}}if(returns){invokerFnBody+="var ret = retType['fromWireType'](rv);\nreturn ret;\n";}invokerFnBody+="}\n";invokerFnBody+="return Asyncify.currData ? Asyncify.whenDone().then(onDone) : onDone(".concat(returnVal,");\n");invokerFnBody+="}\n";return[args1,invokerFnBody];};usesDestructorStack=function _usesDestructorStack(argTypes){for(var i=1;i<argTypes.length;++i){if(argTypes[i]!==null&&argTypes[i].destructorFunction===void 0){return true;}}return false;};registerType=function _registerType(rawType,registeredInstance){var options=arguments.length>2&&arguments[2]!==undefined?arguments[2]:{};return sharedRegisterType(rawType,registeredInstance,options);};sharedRegisterType=function _sharedRegisterType(rawType,registeredInstance){var options=arguments.length>2&&arguments[2]!==undefined?arguments[2]:{};var name=registeredInstance.name;if(!rawType){throwBindingError("type \"".concat(name,"\" must have a positive integer typeid pointer"));}if(registeredTypes.hasOwnProperty(rawType)){if(options.ignoreDuplicateRegistrations){return;}else{throwBindingError("Cannot register type '".concat(name,"' twice"));}}registeredTypes[rawType]=registeredInstance;delete typeDependencies[rawType];if(awaitingDependencies.hasOwnProperty(rawType)){var callbacks=awaitingDependencies[rawType];delete awaitingDependencies[rawType];callbacks.forEach(function(cb){return cb();});}};readPointer=function _readPointer(pointer){return this["fromWireType"](HEAPU32[pointer>>2]);};___syscall_unlinkat=function _syscall_unlinkat(dirfd,path,flags){try{path=SYSCALLS.getStr(path);path=SYSCALLS.calculateAt(dirfd,path);if(!flags){FS.unlink(path);}else if(flags===512){FS.rmdir(path);}else{return-28;}return 0;}catch(e){if(typeof FS=="undefined"||!(e.name==="ErrnoError"))throw e;return-e.errno;}};___syscall_stat64=function _syscall_stat(path,buf){try{path=SYSCALLS.getStr(path);return SYSCALLS.writeStat(buf,FS.stat(path));}catch(e){if(typeof FS=="undefined"||!(e.name==="ErrnoError"))throw e;return-e.errno;}};___syscall_rmdir=function _syscall_rmdir(path){try{path=SYSCALLS.getStr(path);FS.rmdir(path);return 0;}catch(e){if(typeof FS=="undefined"||!(e.name==="ErrnoError"))throw e;return-e.errno;}};___syscall_renameat=function _syscall_renameat(olddirfd,oldpath,newdirfd,newpath){try{oldpath=SYSCALLS.getStr(oldpath);newpath=SYSCALLS.getStr(newpath);oldpath=SYSCALLS.calculateAt(olddirfd,oldpath);newpath=SYSCALLS.calculateAt(newdirfd,newpath);FS.rename(oldpath,newpath);return 0;}catch(e){if(typeof FS=="undefined"||!(e.name==="ErrnoError"))throw e;return-e.errno;}};___syscall_openat=function _syscall_openat(dirfd,path,flags,varargs){SYSCALLS.varargs=varargs;try{path=SYSCALLS.getStr(path);path=SYSCALLS.calculateAt(dirfd,path);var mode=varargs?syscallGetVarargI():0;return FS.open(path,flags,mode).fd;}catch(e){if(typeof FS=="undefined"||!(e.name==="ErrnoError"))throw e;return-e.errno;}};___syscall_ioctl=function _syscall_ioctl(fd,op,varargs){SYSCALLS.varargs=varargs;try{var stream=SYSCALLS.getStreamFromFD(fd);switch(op){case 21509:{if(!stream.tty)return-59;return 0;}case 21505:{if(!stream.tty)return-59;if(stream.tty.ops.ioctl_tcgets){var termios=stream.tty.ops.ioctl_tcgets(stream);var argp=syscallGetVarargP();HEAP32[argp>>2]=termios.c_iflag||0;HEAP32[argp+4>>2]=termios.c_oflag||0;HEAP32[argp+8>>2]=termios.c_cflag||0;HEAP32[argp+12>>2]=termios.c_lflag||0;for(var i=0;i<32;i++){HEAP8[argp+i+17]=termios.c_cc[i]||0;}return 0;}return 0;}case 21510:case 21511:case 21512:{if(!stream.tty)return-59;return 0;}case 21506:case 21507:case 21508:{if(!stream.tty)return-59;if(stream.tty.ops.ioctl_tcsets){var argp=syscallGetVarargP();var c_iflag=HEAP32[argp>>2];var c_oflag=HEAP32[argp+4>>2];var c_cflag=HEAP32[argp+8>>2];var c_lflag=HEAP32[argp+12>>2];var c_cc=[];for(var i=0;i<32;i++){c_cc.push(HEAP8[argp+i+17]);}return stream.tty.ops.ioctl_tcsets(stream.tty,op,{c_iflag:c_iflag,c_oflag:c_oflag,c_cflag:c_cflag,c_lflag:c_lflag,c_cc:c_cc});}return 0;}case 21519:{if(!stream.tty)return-59;var argp=syscallGetVarargP();HEAP32[argp>>2]=0;return 0;}case 21520:{if(!stream.tty)return-59;return-28;}case 21531:{var argp=syscallGetVarargP();return FS.ioctl(stream,op,argp);}case 21523:{if(!stream.tty)return-59;if(stream.tty.ops.ioctl_tiocgwinsz){var winsize=stream.tty.ops.ioctl_tiocgwinsz(stream.tty);var argp=syscallGetVarargP();HEAP16[argp>>1]=winsize[0];HEAP16[argp+2>>1]=winsize[1];}return 0;}case 21524:{if(!stream.tty)return-59;return 0;}case 21515:{if(!stream.tty)return-59;return 0;}default:return-28;}}catch(e){if(typeof FS=="undefined"||!(e.name==="ErrnoError"))throw e;return-e.errno;}};___syscall_fcntl64=function _syscall_fcntl(fd,cmd,varargs){SYSCALLS.varargs=varargs;try{var stream=SYSCALLS.getStreamFromFD(fd);switch(cmd){case 0:{var arg=syscallGetVarargI();if(arg<0){return-28;}while(FS.streams[arg]){arg++;}var newStream;newStream=FS.dupStream(stream,arg);return newStream.fd;}case 1:case 2:return 0;case 3:return stream.flags;case 4:{var arg=syscallGetVarargI();stream.flags|=arg;return 0;}case 12:{var arg=syscallGetVarargP();var offset=0;HEAP16[arg+offset>>1]=2;return 0;}case 13:case 14:return 0;}return-28;}catch(e){if(typeof FS=="undefined"||!(e.name==="ErrnoError"))throw e;return-e.errno;}};_createWasm=function _createWasm3(){_createWasm=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee13(){var _wasmBinaryFile;var receiveInstance,receiveInstantiationResult,info,result,exports;return _regeneratorRuntime().wrap(function _callee13$(_context17){while(1){switch(_context17.prev=_context17.next){case 0:receiveInstantiationResult=function _receiveInstantiation(result2){return receiveInstance(result2["instance"]);};receiveInstance=function _receiveInstance(instance,module){wasmExports=instance.exports;wasmExports=Asyncify.instrumentWasmExports(wasmExports);wasmMemory=wasmExports["U"];updateMemoryViews();removeRunDependency();return wasmExports;};addRunDependency();info=getWasmImports();if(!Module["instantiateWasm"]){_context17.next=6;break;}return _context17.abrupt("return",new Promise(function(resolve,reject){Module["instantiateWasm"](info,function(mod,inst){resolve(receiveInstance(mod));});}));case 6:(_wasmBinaryFile=wasmBinaryFile)!==null&&_wasmBinaryFile!==void 0?_wasmBinaryFile:wasmBinaryFile=findWasmBinary();_context17.prev=7;_context17.next=10;return instantiateAsync(wasmBinary,wasmBinaryFile,info);case 10:result=_context17.sent;exports=receiveInstantiationResult(result);return _context17.abrupt("return",exports);case 15:_context17.prev=15;_context17.t0=_context17["catch"](7);readyPromiseReject(_context17.t0);return _context17.abrupt("return",Promise.reject(_context17.t0));case 19:case"end":return _context17.stop();}}},_callee13,null,[[7,15]]);}));return _createWasm.apply(this,arguments);};createWasm=function _createWasm2(){return _createWasm.apply(this,arguments);};getWasmImports=function _getWasmImports(){return{a:wasmImports};};_instantiateAsync=function _instantiateAsync3(){_instantiateAsync=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee12(binary,binaryFile,imports){var response,instantiationResult;return _regeneratorRuntime().wrap(function _callee12$(_context16){while(1){switch(_context16.prev=_context16.next){case 0:if(!(!binary&&typeof WebAssembly.instantiateStreaming=="function")){_context16.next=13;break;}_context16.prev=1;response=fetch(binaryFile,{credentials:"same-origin"});_context16.next=5;return WebAssembly.instantiateStreaming(response,imports);case 5:instantiationResult=_context16.sent;return _context16.abrupt("return",instantiationResult);case 9:_context16.prev=9;_context16.t0=_context16["catch"](1);err("wasm streaming compile failed: ".concat(_context16.t0));err("falling back to ArrayBuffer instantiation");case 13:return _context16.abrupt("return",instantiateArrayBuffer(binaryFile,imports));case 14:case"end":return _context16.stop();}}},_callee12,null,[[1,9]]);}));return _instantiateAsync.apply(this,arguments);};instantiateAsync=function _instantiateAsync2(_x124,_x125,_x126){return _instantiateAsync.apply(this,arguments);};_instantiateArrayBuffer=function _instantiateArrayBuff2(){_instantiateArrayBuffer=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee11(binaryFile,imports){var binary,instance;return _regeneratorRuntime().wrap(function _callee11$(_context15){while(1){switch(_context15.prev=_context15.next){case 0:_context15.prev=0;_context15.next=3;return getWasmBinary(binaryFile);case 3:binary=_context15.sent;_context15.next=6;return WebAssembly.instantiate(binary,imports);case 6:instance=_context15.sent;return _context15.abrupt("return",instance);case 10:_context15.prev=10;_context15.t0=_context15["catch"](0);err("failed to asynchronously prepare wasm: ".concat(_context15.t0));abort(_context15.t0);case 14:case"end":return _context15.stop();}}},_callee11,null,[[0,10]]);}));return _instantiateArrayBuffer.apply(this,arguments);};instantiateArrayBuffer=function _instantiateArrayBuff(_x122,_x123){return _instantiateArrayBuffer.apply(this,arguments);};_getWasmBinary=function _getWasmBinary3(){_getWasmBinary=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee10(binaryFile){var response;return _regeneratorRuntime().wrap(function _callee10$(_context14){while(1){switch(_context14.prev=_context14.next){case 0:if(wasmBinary){_context14.next=10;break;}_context14.prev=1;_context14.next=4;return readAsync(binaryFile);case 4:response=_context14.sent;return _context14.abrupt("return",new Uint8Array(response));case 8:_context14.prev=8;_context14.t0=_context14["catch"](1);case 10:return _context14.abrupt("return",getBinarySync(binaryFile));case 11:case"end":return _context14.stop();}}},_callee10,null,[[1,8]]);}));return _getWasmBinary.apply(this,arguments);};getWasmBinary=function _getWasmBinary2(_x121){return _getWasmBinary.apply(this,arguments);};getBinarySync=function _getBinarySync(file){if(file==wasmBinaryFile&&wasmBinary){return new Uint8Array(wasmBinary);}throw"both async and sync fetching of the wasm failed";};findWasmBinary=function _findWasmBinary(){if(Module["locateFile"]){return locateFile("ifcdb.wasm");}return new URL("ifcdb.wasm",import.meta.url).href;};abort=function _abort2(what){var _Module$onAbort;(_Module$onAbort=Module["onAbort"])===null||_Module$onAbort===void 0?void 0:_Module$onAbort.call(Module,what);what="Aborted("+what+")";err(what);ABORT=true;what+=". Build with -sASSERTIONS for more info.";var e=new WebAssembly.RuntimeError(what);readyPromiseReject(e);throw e;};removeRunDependency=function _removeRunDependency(id){var _Module$monitorRunDep2;runDependencies--;(_Module$monitorRunDep2=Module["monitorRunDependencies"])===null||_Module$monitorRunDep2===void 0?void 0:_Module$monitorRunDep2.call(Module,runDependencies);if(runDependencies==0){if(dependenciesFulfilled){var callback=dependenciesFulfilled;dependenciesFulfilled=null;callback();}}};addRunDependency=function _addRunDependency(id){var _Module$monitorRunDep;runDependencies++;(_Module$monitorRunDep=Module["monitorRunDependencies"])===null||_Module$monitorRunDep===void 0?void 0:_Module$monitorRunDep.call(Module,runDependencies);};postRun=function _postRun(){if(Module["postRun"]){if(typeof Module["postRun"]=="function")Module["postRun"]=[Module["postRun"]];while(Module["postRun"].length){addOnPostRun(Module["postRun"].shift());}}callRuntimeCallbacks(onPostRuns);};initRuntime=function _initRuntime(){if(!Module["noFSInit"]&&!FS.initialized)FS.init();wasmExports["V"]();FS.ignorePermissions=false;};preRun=function _preRun(){if(Module["preRun"]){if(typeof Module["preRun"]=="function")Module["preRun"]=[Module["preRun"]];while(Module["preRun"].length){addOnPreRun(Module["preRun"].shift());}}callRuntimeCallbacks(onPreRuns);};updateMemoryViews=function _updateMemoryViews(){var b=wasmMemory.buffer;HEAP8=new Int8Array(b);HEAP16=new Int16Array(b);HEAPU8=new Uint8Array(b);HEAPU16=new Uint16Array(b);HEAP32=new Int32Array(b);HEAPU32=new Uint32Array(b);HEAPF32=new Float32Array(b);HEAPF64=new Float64Array(b);HEAP64=new BigInt64Array(b);HEAPU64=new BigUint64Array(b);};locateFile=function _locateFile(path){if(Module["locateFile"]){return Module["locateFile"](path,scriptDirectory);}return scriptDirectory+path;};moduleArg=_args17.length>0&&_args17[0]!==undefined?_args17[0]:{};Module=moduleArg;readyPromise=new Promise(function(resolve,reject){readyPromiseResolve=resolve;readyPromiseReject=reject;});arguments_=[];thisProgram="./this.program";quit_=function quit_(status,toThrow){throw toThrow;};_scriptName=import.meta.url;scriptDirectory="";try{scriptDirectory=new URL(".",_scriptName).href;}catch(_unused2){}readAsync=/*#__PURE__*/function(){var _ref24=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee8(url){var response;return _regeneratorRuntime().wrap(function _callee8$(_context12){while(1){switch(_context12.prev=_context12.next){case 0:_context12.next=2;return fetch(url,{credentials:"same-origin"});case 2:response=_context12.sent;if(!response.ok){_context12.next=5;break;}return _context12.abrupt("return",response.arrayBuffer());case 5:throw new Error(response.status+" : "+response.url);case 6:case"end":return _context12.stop();}}},_callee8);}));return function readAsync(_x120){return _ref24.apply(this,arguments);};}();out=console.log.bind(console);err=console.error.bind(console);ABORT=false;runDependencies=0;dependenciesFulfilled=null;ExitStatus=/*#__PURE__*/_createClass(function ExitStatus(status){_classCallCheck(this,ExitStatus);__publicField$2(this,"name","ExitStatus");this.message="Program terminated with exit(".concat(status,")");this.status=status;});callRuntimeCallbacks=function callRuntimeCallbacks(callbacks){while(callbacks.length>0){callbacks.shift()(Module);}};onPostRuns=[];addOnPostRun=function addOnPostRun(cb){return onPostRuns.push(cb);};onPreRuns=[];addOnPreRun=function addOnPreRun(cb){return onPreRuns.push(cb);};dynCallLegacy=function dynCallLegacy(sig,ptr,args){sig=sig.replace(/p/g,"i");var f=Module["dynCall_"+sig];return f.apply(void 0,[ptr].concat(_toConsumableArray(args)));};dynCall=function dynCall(sig,ptr){var args=arguments.length>2&&arguments[2]!==undefined?arguments[2]:[];var promising=arguments.length>3&&arguments[3]!==undefined?arguments[3]:false;var rtn=dynCallLegacy(sig,ptr,args);function convert(rtn2){return rtn2;}return convert(rtn);};noExitRuntime=true;ExceptionInfo=/*#__PURE__*/function(){function ExceptionInfo(excPtr){_classCallCheck(this,ExceptionInfo);this.excPtr=excPtr;this.ptr=excPtr-24;}_createClass(ExceptionInfo,[{key:"set_type",value:function set_type(type){HEAPU32[this.ptr+4>>2]=type;}},{key:"get_type",value:function get_type(){return HEAPU32[this.ptr+4>>2];}},{key:"set_destructor",value:function set_destructor(destructor){HEAPU32[this.ptr+8>>2]=destructor;}},{key:"get_destructor",value:function get_destructor(){return HEAPU32[this.ptr+8>>2];}},{key:"set_caught",value:function set_caught(caught){caught=caught?1:0;HEAP8[this.ptr+12]=caught;}},{key:"get_caught",value:function get_caught(){return HEAP8[this.ptr+12]!=0;}},{key:"set_rethrown",value:function set_rethrown(rethrown){rethrown=rethrown?1:0;HEAP8[this.ptr+13]=rethrown;}},{key:"get_rethrown",value:function get_rethrown(){return HEAP8[this.ptr+13]!=0;}},{key:"init",value:function init(type,destructor){this.set_adjusted_ptr(0);this.set_type(type);this.set_destructor(destructor);}},{key:"set_adjusted_ptr",value:function set_adjusted_ptr(adjustedPtr){HEAPU32[this.ptr+16>>2]=adjustedPtr;}},{key:"get_adjusted_ptr",value:function get_adjusted_ptr(){return HEAPU32[this.ptr+16>>2];}}]);return ExceptionInfo;}();exceptionLast=0;___cxa_throw=function ___cxa_throw(ptr,type,destructor){var info=new ExceptionInfo(ptr);info.init(type,destructor);exceptionLast=ptr;throw exceptionLast;};syscallGetVarargI=function syscallGetVarargI(){var ret=HEAP32[+SYSCALLS.varargs>>2];SYSCALLS.varargs+=4;return ret;};syscallGetVarargP=syscallGetVarargI;PATH={isAbs:function isAbs(path){return path.charAt(0)==="/";},splitPath:function splitPath(filename){var splitPathRe=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/;return splitPathRe.exec(filename).slice(1);},normalizeArray:function normalizeArray(parts,allowAboveRoot){var up=0;for(var i=parts.length-1;i>=0;i--){var last=parts[i];if(last==="."){parts.splice(i,1);}else if(last===".."){parts.splice(i,1);up++;}else if(up){parts.splice(i,1);up--;}}if(allowAboveRoot){for(;up;up--){parts.unshift("..");}}return parts;},normalize:function normalize(path){var isAbsolute=PATH.isAbs(path),trailingSlash=path.slice(-1)==="/";path=PATH.normalizeArray(path.split("/").filter(function(p){return!!p;}),!isAbsolute).join("/");if(!path&&!isAbsolute){path=".";}if(path&&trailingSlash){path+="/";}return(isAbsolute?"/":"")+path;},dirname:function dirname(path){var result=PATH.splitPath(path),root=result[0],dir=result[1];if(!root&&!dir){return".";}if(dir){dir=dir.slice(0,-1);}return root+dir;},basename:function basename(path){return path&&path.match(/([^\/]+|\/)\/*$/)[1];},join:function join(){for(var _len59=arguments.length,paths=new Array(_len59),_key14=0;_key14<_len59;_key14++){paths[_key14]=arguments[_key14];}return PATH.normalize(paths.join("/"));},join2:function join2(l,r){return PATH.normalize(l+"/"+r);}};initRandomFill=function initRandomFill(){return function(view){return crypto.getRandomValues(view);};};_randomFill=function randomFill(view){(_randomFill=initRandomFill())(view);};PATH_FS={resolve:function resolve(){var resolvedPath="",resolvedAbsolute=false;for(var i=arguments.length-1;i>=-1&&!resolvedAbsolute;i--){var path=i>=0?i<0||arguments.length<=i?undefined:arguments[i]:FS.cwd();if(typeof path!="string"){throw new TypeError("Arguments to path.resolve must be strings");}else if(!path){return"";}resolvedPath=path+"/"+resolvedPath;resolvedAbsolute=PATH.isAbs(path);}resolvedPath=PATH.normalizeArray(resolvedPath.split("/").filter(function(p){return!!p;}),!resolvedAbsolute).join("/");return(resolvedAbsolute?"/":"")+resolvedPath||".";},relative:function relative(from,to){from=PATH_FS.resolve(from).slice(1);to=PATH_FS.resolve(to).slice(1);function trim(arr){var start=0;for(;start<arr.length;start++){if(arr[start]!=="")break;}var end=arr.length-1;for(;end>=0;end--){if(arr[end]!=="")break;}if(start>end)return[];return arr.slice(start,end-start+1);}var fromParts=trim(from.split("/"));var toParts=trim(to.split("/"));var length=Math.min(fromParts.length,toParts.length);var samePartsLength=length;for(var i=0;i<length;i++){if(fromParts[i]!==toParts[i]){samePartsLength=i;break;}}var outputParts=[];for(var i=samePartsLength;i<fromParts.length;i++){outputParts.push("..");}outputParts=outputParts.concat(toParts.slice(samePartsLength));return outputParts.join("/");}};UTF8Decoder=typeof TextDecoder!="undefined"?new TextDecoder():void 0;UTF8ArrayToString=function UTF8ArrayToString(heapOrArray){var idx=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0;var maxBytesToRead=arguments.length>2&&arguments[2]!==undefined?arguments[2]:NaN;var endIdx=idx+maxBytesToRead;var endPtr=idx;while(heapOrArray[endPtr]&&!(endPtr>=endIdx)){++endPtr;}if(endPtr-idx>16&&heapOrArray.buffer&&UTF8Decoder){return UTF8Decoder.decode(heapOrArray.subarray(idx,endPtr));}var str="";while(idx<endPtr){var u0=heapOrArray[idx++];if(!(u0&128)){str+=String.fromCharCode(u0);continue;}var u1=heapOrArray[idx++]&63;if((u0&224)==192){str+=String.fromCharCode((u0&31)<<6|u1);continue;}var u2=heapOrArray[idx++]&63;if((u0&240)==224){u0=(u0&15)<<12|u1<<6|u2;}else{u0=(u0&7)<<18|u1<<12|u2<<6|heapOrArray[idx++]&63;}if(u0<65536){str+=String.fromCharCode(u0);}else{var ch=u0-65536;str+=String.fromCharCode(55296|ch>>10,56320|ch&1023);}}return str;};FS_stdin_getChar_buffer=[];lengthBytesUTF8=function lengthBytesUTF8(str){var len=0;for(var i=0;i<str.length;++i){var c=str.charCodeAt(i);if(c<=127){len++;}else if(c<=2047){len+=2;}else if(c>=55296&&c<=57343){len+=4;++i;}else{len+=3;}}return len;};stringToUTF8Array=function stringToUTF8Array(str,heap,outIdx,maxBytesToWrite){if(!(maxBytesToWrite>0))return 0;var startIdx=outIdx;var endIdx=outIdx+maxBytesToWrite-1;for(var i=0;i<str.length;++i){var u=str.charCodeAt(i);if(u>=55296&&u<=57343){var u1=str.charCodeAt(++i);u=65536+((u&1023)<<10)|u1&1023;}if(u<=127){if(outIdx>=endIdx)break;heap[outIdx++]=u;}else if(u<=2047){if(outIdx+1>=endIdx)break;heap[outIdx++]=192|u>>6;heap[outIdx++]=128|u&63;}else if(u<=65535){if(outIdx+2>=endIdx)break;heap[outIdx++]=224|u>>12;heap[outIdx++]=128|u>>6&63;heap[outIdx++]=128|u&63;}else{if(outIdx+3>=endIdx)break;heap[outIdx++]=240|u>>18;heap[outIdx++]=128|u>>12&63;heap[outIdx++]=128|u>>6&63;heap[outIdx++]=128|u&63;}}heap[outIdx]=0;return outIdx-startIdx;};intArrayFromString=function intArrayFromString(stringy,dontAddNull,length){var len=length>0?length:lengthBytesUTF8(stringy)+1;var u8array=new Array(len);var numBytesWritten=stringToUTF8Array(stringy,u8array,0,u8array.length);if(dontAddNull)u8array.length=numBytesWritten;return u8array;};FS_stdin_getChar=function FS_stdin_getChar(){if(!FS_stdin_getChar_buffer.length){var result=null;if(typeof window!="undefined"&&typeof window.prompt=="function"){result=window.prompt("Input: ");if(result!==null){result+="\n";}}if(!result){return null;}FS_stdin_getChar_buffer=intArrayFromString(result,true);}return FS_stdin_getChar_buffer.shift();};TTY={ttys:[],init:function init(){},shutdown:function shutdown(){},register:function register(dev,ops){TTY.ttys[dev]={input:[],output:[],ops:ops};FS.registerDevice(dev,TTY.stream_ops);},stream_ops:{open:function open(stream){var tty=TTY.ttys[stream.node.rdev];if(!tty){throw new FS.ErrnoError(43);}stream.tty=tty;stream.seekable=false;},close:function close(stream){stream.tty.ops.fsync(stream.tty);},fsync:function fsync(stream){stream.tty.ops.fsync(stream.tty);},read:function read(stream,buffer,offset,length,pos){if(!stream.tty||!stream.tty.ops.get_char){throw new FS.ErrnoError(60);}var bytesRead=0;for(var i=0;i<length;i++){var result;try{result=stream.tty.ops.get_char(stream.tty);}catch(e){throw new FS.ErrnoError(29);}if(result===void 0&&bytesRead===0){throw new FS.ErrnoError(6);}if(result===null||result===void 0)break;bytesRead++;buffer[offset+i]=result;}if(bytesRead){stream.node.atime=Date.now();}return bytesRead;},write:function write(stream,buffer,offset,length,pos){if(!stream.tty||!stream.tty.ops.put_char){throw new FS.ErrnoError(60);}try{for(var i=0;i<length;i++){stream.tty.ops.put_char(stream.tty,buffer[offset+i]);}}catch(e){throw new FS.ErrnoError(29);}if(length){stream.node.mtime=stream.node.ctime=Date.now();}return i;}},default_tty_ops:{get_char:function get_char(tty){return FS_stdin_getChar();},put_char:function put_char(tty,val){if(val===null||val===10){out(UTF8ArrayToString(tty.output));tty.output=[];}else{if(val!=0)tty.output.push(val);}},fsync:function fsync(tty){var _tty$output;if(((_tty$output=tty.output)===null||_tty$output===void 0?void 0:_tty$output.length)>0){out(UTF8ArrayToString(tty.output));tty.output=[];}},ioctl_tcgets:function ioctl_tcgets(tty){return{c_iflag:25856,c_oflag:5,c_cflag:191,c_lflag:35387,c_cc:[3,28,127,21,4,0,1,0,17,19,26,0,18,15,23,22,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]};},ioctl_tcsets:function ioctl_tcsets(tty,optional_actions,data){return 0;},ioctl_tiocgwinsz:function ioctl_tiocgwinsz(tty){return[24,80];}},default_tty1_ops:{put_char:function put_char(tty,val){if(val===null||val===10){err(UTF8ArrayToString(tty.output));tty.output=[];}else{if(val!=0)tty.output.push(val);}},fsync:function fsync(tty){var _tty$output2;if(((_tty$output2=tty.output)===null||_tty$output2===void 0?void 0:_tty$output2.length)>0){err(UTF8ArrayToString(tty.output));tty.output=[];}}}};mmapAlloc=function mmapAlloc(size){abort();};MEMFS={ops_table:null,mount:function mount(_mount){return MEMFS.createNode(null,"/",16895,0);},createNode:function createNode(parent,name,mode,dev){if(FS.isBlkdev(mode)||FS.isFIFO(mode)){throw new FS.ErrnoError(63);}MEMFS.ops_table||(MEMFS.ops_table={dir:{node:{getattr:MEMFS.node_ops.getattr,setattr:MEMFS.node_ops.setattr,lookup:MEMFS.node_ops.lookup,mknod:MEMFS.node_ops.mknod,rename:MEMFS.node_ops.rename,unlink:MEMFS.node_ops.unlink,rmdir:MEMFS.node_ops.rmdir,readdir:MEMFS.node_ops.readdir,symlink:MEMFS.node_ops.symlink},stream:{llseek:MEMFS.stream_ops.llseek}},file:{node:{getattr:MEMFS.node_ops.getattr,setattr:MEMFS.node_ops.setattr},stream:{llseek:MEMFS.stream_ops.llseek,read:MEMFS.stream_ops.read,write:MEMFS.stream_ops.write,mmap:MEMFS.stream_ops.mmap,msync:MEMFS.stream_ops.msync}},link:{node:{getattr:MEMFS.node_ops.getattr,setattr:MEMFS.node_ops.setattr,readlink:MEMFS.node_ops.readlink},stream:{}},chrdev:{node:{getattr:MEMFS.node_ops.getattr,setattr:MEMFS.node_ops.setattr},stream:FS.chrdev_stream_ops}});var node=FS.createNode(parent,name,mode,dev);if(FS.isDir(node.mode)){node.node_ops=MEMFS.ops_table.dir.node;node.stream_ops=MEMFS.ops_table.dir.stream;node.contents={};}else if(FS.isFile(node.mode)){node.node_ops=MEMFS.ops_table.file.node;node.stream_ops=MEMFS.ops_table.file.stream;node.usedBytes=0;node.contents=null;}else if(FS.isLink(node.mode)){node.node_ops=MEMFS.ops_table.link.node;node.stream_ops=MEMFS.ops_table.link.stream;}else if(FS.isChrdev(node.mode)){node.node_ops=MEMFS.ops_table.chrdev.node;node.stream_ops=MEMFS.ops_table.chrdev.stream;}node.atime=node.mtime=node.ctime=Date.now();if(parent){parent.contents[name]=node;parent.atime=parent.mtime=parent.ctime=node.atime;}return node;},getFileDataAsTypedArray:function getFileDataAsTypedArray(node){if(!node.contents)return new Uint8Array(0);if(node.contents.subarray)return node.contents.subarray(0,node.usedBytes);return new Uint8Array(node.contents);},expandFileStorage:function expandFileStorage(node,newCapacity){var prevCapacity=node.contents?node.contents.length:0;if(prevCapacity>=newCapacity)return;var CAPACITY_DOUBLING_MAX=1024*1024;newCapacity=Math.max(newCapacity,prevCapacity*(prevCapacity<CAPACITY_DOUBLING_MAX?2:1.125)>>>0);if(prevCapacity!=0)newCapacity=Math.max(newCapacity,256);var oldContents=node.contents;node.contents=new Uint8Array(newCapacity);if(node.usedBytes>0)node.contents.set(oldContents.subarray(0,node.usedBytes),0);},resizeFileStorage:function resizeFileStorage(node,newSize){if(node.usedBytes==newSize)return;if(newSize==0){node.contents=null;node.usedBytes=0;}else{var oldContents=node.contents;node.contents=new Uint8Array(newSize);if(oldContents){node.contents.set(oldContents.subarray(0,Math.min(newSize,node.usedBytes)));}node.usedBytes=newSize;}},node_ops:{getattr:function getattr(node){var attr={};attr.dev=FS.isChrdev(node.mode)?node.id:1;attr.ino=node.id;attr.mode=node.mode;attr.nlink=1;attr.uid=0;attr.gid=0;attr.rdev=node.rdev;if(FS.isDir(node.mode)){attr.size=4096;}else if(FS.isFile(node.mode)){attr.size=node.usedBytes;}else if(FS.isLink(node.mode)){attr.size=node.link.length;}else{attr.size=0;}attr.atime=new Date(node.atime);attr.mtime=new Date(node.mtime);attr.ctime=new Date(node.ctime);attr.blksize=4096;attr.blocks=Math.ceil(attr.size/attr.blksize);return attr;},setattr:function setattr(node,attr){for(var _i388=0,_arr3=["mode","atime","mtime","ctime"];_i388<_arr3.length;_i388++){var key=_arr3[_i388];if(attr[key]!=null){node[key]=attr[key];}}if(attr.size!==void 0){MEMFS.resizeFileStorage(node,attr.size);}},lookup:function lookup(parent,name){throw MEMFS.doesNotExistError;},mknod:function mknod(parent,name,mode,dev){return MEMFS.createNode(parent,name,mode,dev);},rename:function rename(old_node,new_dir,new_name){var new_node;try{new_node=FS.lookupNode(new_dir,new_name);}catch(e){}if(new_node){if(FS.isDir(old_node.mode)){for(var i in new_node.contents){throw new FS.ErrnoError(55);}}FS.hashRemoveNode(new_node);}delete old_node.parent.contents[old_node.name];new_dir.contents[new_name]=old_node;old_node.name=new_name;new_dir.ctime=new_dir.mtime=old_node.parent.ctime=old_node.parent.mtime=Date.now();},unlink:function unlink(parent,name){delete parent.contents[name];parent.ctime=parent.mtime=Date.now();},rmdir:function rmdir(parent,name){var node=FS.lookupNode(parent,name);for(var i in node.contents){throw new FS.ErrnoError(55);}delete parent.contents[name];parent.ctime=parent.mtime=Date.now();},readdir:function readdir(node){return[".",".."].concat(_toConsumableArray(Object.keys(node.contents)));},symlink:function symlink(parent,newname,oldpath){var node=MEMFS.createNode(parent,newname,511|40960,0);node.link=oldpath;return node;},readlink:function readlink(node){if(!FS.isLink(node.mode)){throw new FS.ErrnoError(28);}return node.link;}},stream_ops:{read:function read(stream,buffer,offset,length,position){var contents=stream.node.contents;if(position>=stream.node.usedBytes)return 0;var size=Math.min(stream.node.usedBytes-position,length);if(size>8&&contents.subarray){buffer.set(contents.subarray(position,position+size),offset);}else{for(var i=0;i<size;i++){buffer[offset+i]=contents[position+i];}}return size;},write:function write(stream,buffer,offset,length,position,canOwn){if(buffer.buffer===HEAP8.buffer){canOwn=false;}if(!length)return 0;var node=stream.node;node.mtime=node.ctime=Date.now();if(buffer.subarray&&(!node.contents||node.contents.subarray)){if(canOwn){node.contents=buffer.subarray(offset,offset+length);node.usedBytes=length;return length;}else if(node.usedBytes===0&&position===0){node.contents=buffer.slice(offset,offset+length);node.usedBytes=length;return length;}else if(position+length<=node.usedBytes){node.contents.set(buffer.subarray(offset,offset+length),position);return length;}}MEMFS.expandFileStorage(node,position+length);if(node.contents.subarray&&buffer.subarray){node.contents.set(buffer.subarray(offset,offset+length),position);}else{for(var i=0;i<length;i++){node.contents[position+i]=buffer[offset+i];}}node.usedBytes=Math.max(node.usedBytes,position+length);return length;},llseek:function llseek(stream,offset,whence){var position=offset;if(whence===1){position+=stream.position;}else if(whence===2){if(FS.isFile(stream.node.mode)){position+=stream.node.usedBytes;}}if(position<0){throw new FS.ErrnoError(28);}return position;},mmap:function mmap(stream,length,position,prot,flags){if(!FS.isFile(stream.node.mode)){throw new FS.ErrnoError(43);}var ptr;var allocated;var contents=stream.node.contents;if(!(flags&2)&&contents&&contents.buffer===HEAP8.buffer){allocated=false;ptr=contents.byteOffset;}else{allocated=true;ptr=mmapAlloc();if(!ptr){throw new FS.ErrnoError(48);}if(contents){if(position>0||position+length<contents.length){if(contents.subarray){contents=contents.subarray(position,position+length);}else{contents=Array.prototype.slice.call(contents,position,position+length);}}HEAP8.set(contents,ptr);}}return{ptr:ptr,allocated:allocated};},msync:function msync(stream,buffer,offset,length,mmapFlags){MEMFS.stream_ops.write(stream,buffer,0,length,offset,false);return 0;}}};asyncLoad=/*#__PURE__*/function(){var _ref25=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee9(url){var arrayBuffer;return _regeneratorRuntime().wrap(function _callee9$(_context13){while(1){switch(_context13.prev=_context13.next){case 0:_context13.next=2;return readAsync(url);case 2:arrayBuffer=_context13.sent;return _context13.abrupt("return",new Uint8Array(arrayBuffer));case 4:case"end":return _context13.stop();}}},_callee9);}));return function asyncLoad(_x127){return _ref25.apply(this,arguments);};}();asyncLoad.isAsync=true;FS_createDataFile=function FS_createDataFile(){return FS.createDataFile.apply(FS,arguments);};preloadPlugins=[];FS_handledByPreloadPlugin=function FS_handledByPreloadPlugin(byteArray,fullname,finish,onerror){if(typeof Browser!="undefined")Browser.init();var handled=false;preloadPlugins.forEach(function(plugin){if(handled)return;if(plugin["canHandle"](fullname)){plugin["handle"](byteArray,fullname,finish,onerror);handled=true;}});return handled;};FS_createPreloadedFile=function FS_createPreloadedFile(parent,name,url,canRead,canWrite,onload,onerror,dontCreateFile,canOwn,preFinish){var fullname=name?PATH_FS.resolve(PATH.join2(parent,name)):parent;function processData(byteArray){function finish(byteArray2){preFinish===null||preFinish===void 0?void 0:preFinish();if(!dontCreateFile){FS_createDataFile(parent,name,byteArray2,canRead,canWrite,canOwn);}onload===null||onload===void 0?void 0:onload();removeRunDependency();}if(FS_handledByPreloadPlugin(byteArray,fullname,finish,function(){onerror===null||onerror===void 0?void 0:onerror();removeRunDependency();})){return;}finish(byteArray);}addRunDependency();if(typeof url=="string"){asyncLoad(url).then(processData,onerror);}else{processData(url);}};FS_modeStringToFlags=function FS_modeStringToFlags(str){var flagModes={r:0,"r+":2,w:512|64|1,"w+":512|64|2,a:1024|64|1,"a+":1024|64|2};var flags=flagModes[str];if(typeof flags=="undefined"){throw new Error("Unknown file open mode: ".concat(str));}return flags;};FS_getMode=function FS_getMode(canRead,canWrite){var mode=0;if(canRead)mode|=292|73;if(canWrite)mode|=146;return mode;};FS={root:null,mounts:[],devices:{},streams:[],nextInode:1,nameTable:null,currentPath:"/",initialized:false,ignorePermissions:true,filesystems:null,syncFSRequests:0,readFiles:{},ErrnoError:/*#__PURE__*/_createClass(function ErrnoError(errno){_classCallCheck(this,ErrnoError);__publicField$2(this,"name","ErrnoError");this.errno=errno;}),FSStream:/*#__PURE__*/function(){function FSStream(){_classCallCheck(this,FSStream);__publicField$2(this,"shared",{});}_createClass(FSStream,[{key:"object",get:function get(){return this.node;},set:function set(val){this.node=val;}},{key:"isRead",get:function get(){return(this.flags&2097155)!==1;}},{key:"isWrite",get:function get(){return(this.flags&2097155)!==0;}},{key:"isAppend",get:function get(){return this.flags&1024;}},{key:"flags",get:function get(){return this.shared.flags;},set:function set(val){this.shared.flags=val;}},{key:"position",get:function get(){return this.shared.position;},set:function set(val){this.shared.position=val;}}]);return FSStream;}(),FSNode:/*#__PURE__*/function(){function FSNode(parent,name,mode,rdev){_classCallCheck(this,FSNode);__publicField$2(this,"node_ops",{});__publicField$2(this,"stream_ops",{});__publicField$2(this,"readMode",292|73);__publicField$2(this,"writeMode",146);__publicField$2(this,"mounted",null);if(!parent){parent=this;}this.parent=parent;this.mount=parent.mount;this.id=FS.nextInode++;this.name=name;this.mode=mode;this.rdev=rdev;this.atime=this.mtime=this.ctime=Date.now();}_createClass(FSNode,[{key:"read",get:function get(){return(this.mode&this.readMode)===this.readMode;},set:function set(val){val?this.mode|=this.readMode:this.mode&=~this.readMode;}},{key:"write",get:function get(){return(this.mode&this.writeMode)===this.writeMode;},set:function set(val){val?this.mode|=this.writeMode:this.mode&=~this.writeMode;}},{key:"isFolder",get:function get(){return FS.isDir(this.mode);}},{key:"isDevice",get:function get(){return FS.isChrdev(this.mode);}}]);return FSNode;}(),lookupPath:function lookupPath(path){var _opts$follow_mount;var opts=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};if(!path){throw new FS.ErrnoError(44);}(_opts$follow_mount=opts.follow_mount)!==null&&_opts$follow_mount!==void 0?_opts$follow_mount:opts.follow_mount=true;if(!PATH.isAbs(path)){path=FS.cwd()+"/"+path;}linkloop:for(var nlinks=0;nlinks<40;nlinks++){var parts=path.split("/").filter(function(p){return!!p;});var current=FS.root;var current_path="/";for(var i=0;i<parts.length;i++){var islast=i===parts.length-1;if(islast&&opts.parent){break;}if(parts[i]==="."){continue;}if(parts[i]===".."){current_path=PATH.dirname(current_path);if(FS.isRoot(current)){path=current_path+"/"+parts.slice(i+1).join("/");continue linkloop;}else{current=current.parent;}continue;}current_path=PATH.join2(current_path,parts[i]);try{current=FS.lookupNode(current,parts[i]);}catch(e){if((e===null||e===void 0?void 0:e.errno)===44&&islast&&opts.noent_okay){return{path:current_path};}throw e;}if(FS.isMountpoint(current)&&(!islast||opts.follow_mount)){current=current.mounted.root;}if(FS.isLink(current.mode)&&(!islast||opts.follow)){if(!current.node_ops.readlink){throw new FS.ErrnoError(52);}var link=current.node_ops.readlink(current);if(!PATH.isAbs(link)){link=PATH.dirname(current_path)+"/"+link;}path=link+"/"+parts.slice(i+1).join("/");continue linkloop;}}return{path:current_path,node:current};}throw new FS.ErrnoError(32);},getPath:function getPath(node){var path;while(true){if(FS.isRoot(node)){var mount=node.mount.mountpoint;if(!path)return mount;return mount[mount.length-1]!=="/"?"".concat(mount,"/").concat(path):mount+path;}path=path?"".concat(node.name,"/").concat(path):node.name;node=node.parent;}},hashName:function hashName(parentid,name){var hash=0;for(var i=0;i<name.length;i++){hash=(hash<<5)-hash+name.charCodeAt(i)|0;}return(parentid+hash>>>0)%FS.nameTable.length;},hashAddNode:function hashAddNode(node){var hash=FS.hashName(node.parent.id,node.name);node.name_next=FS.nameTable[hash];FS.nameTable[hash]=node;},hashRemoveNode:function hashRemoveNode(node){var hash=FS.hashName(node.parent.id,node.name);if(FS.nameTable[hash]===node){FS.nameTable[hash]=node.name_next;}else{var current=FS.nameTable[hash];while(current){if(current.name_next===node){current.name_next=node.name_next;break;}current=current.name_next;}}},lookupNode:function lookupNode(parent,name){var errCode=FS.mayLookup(parent);if(errCode){throw new FS.ErrnoError(errCode);}var hash=FS.hashName(parent.id,name);for(var node=FS.nameTable[hash];node;node=node.name_next){var nodeName=node.name;if(node.parent.id===parent.id&&nodeName===name){return node;}}return FS.lookup(parent,name);},createNode:function createNode(parent,name,mode,rdev){var node=new FS.FSNode(parent,name,mode,rdev);FS.hashAddNode(node);return node;},destroyNode:function destroyNode(node){FS.hashRemoveNode(node);},isRoot:function isRoot(node){return node===node.parent;},isMountpoint:function isMountpoint(node){return!!node.mounted;},isFile:function isFile(mode){return(mode&61440)===32768;},isDir:function isDir(mode){return(mode&61440)===16384;},isLink:function isLink(mode){return(mode&61440)===40960;},isChrdev:function isChrdev(mode){return(mode&61440)===8192;},isBlkdev:function isBlkdev(mode){return(mode&61440)===24576;},isFIFO:function isFIFO(mode){return(mode&61440)===4096;},isSocket:function isSocket(mode){return(mode&49152)===49152;},flagsToPermissionString:function flagsToPermissionString(flag){var perms=["r","w","rw"][flag&3];if(flag&512){perms+="w";}return perms;},nodePermissions:function nodePermissions(node,perms){if(FS.ignorePermissions){return 0;}if(perms.includes("r")&&!(node.mode&292)){return 2;}else if(perms.includes("w")&&!(node.mode&146)){return 2;}else if(perms.includes("x")&&!(node.mode&73)){return 2;}return 0;},mayLookup:function mayLookup(dir){if(!FS.isDir(dir.mode))return 54;var errCode=FS.nodePermissions(dir,"x");if(errCode)return errCode;if(!dir.node_ops.lookup)return 2;return 0;},mayCreate:function mayCreate(dir,name){if(!FS.isDir(dir.mode)){return 54;}try{var node=FS.lookupNode(dir,name);return 20;}catch(e){}return FS.nodePermissions(dir,"wx");},mayDelete:function mayDelete(dir,name,isdir){var node;try{node=FS.lookupNode(dir,name);}catch(e){return e.errno;}var errCode=FS.nodePermissions(dir,"wx");if(errCode){return errCode;}if(isdir){if(!FS.isDir(node.mode)){return 54;}if(FS.isRoot(node)||FS.getPath(node)===FS.cwd()){return 10;}}else{if(FS.isDir(node.mode)){return 31;}}return 0;},mayOpen:function mayOpen(node,flags){if(!node){return 44;}if(FS.isLink(node.mode)){return 32;}else if(FS.isDir(node.mode)){if(FS.flagsToPermissionString(flags)!=="r"||flags&(512|64)){return 31;}}return FS.nodePermissions(node,FS.flagsToPermissionString(flags));},checkOpExists:function checkOpExists(op,err2){if(!op){throw new FS.ErrnoError(err2);}return op;},MAX_OPEN_FDS:4096,nextfd:function nextfd(){for(var fd=0;fd<=FS.MAX_OPEN_FDS;fd++){if(!FS.streams[fd]){return fd;}}throw new FS.ErrnoError(33);},getStreamChecked:function getStreamChecked(fd){var stream=FS.getStream(fd);if(!stream){throw new FS.ErrnoError(8);}return stream;},getStream:function getStream(fd){return FS.streams[fd];},createStream:function createStream(stream){var fd=arguments.length>1&&arguments[1]!==undefined?arguments[1]:-1;stream=Object.assign(new FS.FSStream(),stream);if(fd==-1){fd=FS.nextfd();}stream.fd=fd;FS.streams[fd]=stream;return stream;},closeStream:function closeStream(fd){FS.streams[fd]=null;},dupStream:function dupStream(origStream){var _stream$stream_ops,_stream$stream_ops$du;var fd=arguments.length>1&&arguments[1]!==undefined?arguments[1]:-1;var stream=FS.createStream(origStream,fd);(_stream$stream_ops=stream.stream_ops)===null||_stream$stream_ops===void 0?void 0:(_stream$stream_ops$du=_stream$stream_ops.dup)===null||_stream$stream_ops$du===void 0?void 0:_stream$stream_ops$du.call(_stream$stream_ops,stream);return stream;},doSetAttr:function doSetAttr(stream,node,attr){var _setattr;var setattr=stream===null||stream===void 0?void 0:stream.stream_ops.setattr;var arg=setattr?stream:node;(_setattr=setattr)!==null&&_setattr!==void 0?_setattr:setattr=node.node_ops.setattr;FS.checkOpExists(setattr,63);setattr(arg,attr);},chrdev_stream_ops:{open:function open(stream){var _stream$stream_ops$op,_stream$stream_ops2;var device=FS.getDevice(stream.node.rdev);stream.stream_ops=device.stream_ops;(_stream$stream_ops$op=(_stream$stream_ops2=stream.stream_ops).open)===null||_stream$stream_ops$op===void 0?void 0:_stream$stream_ops$op.call(_stream$stream_ops2,stream);},llseek:function llseek(){throw new FS.ErrnoError(70);}},major:function major(dev){return dev>>8;},minor:function minor(dev){return dev&255;},makedev:function makedev(ma,mi){return ma<<8|mi;},registerDevice:function registerDevice(dev,ops){FS.devices[dev]={stream_ops:ops};},getDevice:function getDevice(dev){return FS.devices[dev];},getMounts:function getMounts(mount){var mounts=[];var check=[mount];while(check.length){var m=check.pop();mounts.push(m);check.push.apply(check,_toConsumableArray(m.mounts));}return mounts;},syncfs:function syncfs(populate,callback){if(typeof populate=="function"){callback=populate;populate=false;}FS.syncFSRequests++;if(FS.syncFSRequests>1){err("warning: ".concat(FS.syncFSRequests," FS.syncfs operations in flight at once, probably just doing extra work"));}var mounts=FS.getMounts(FS.root.mount);var completed=0;function doCallback(errCode){FS.syncFSRequests--;return callback(errCode);}function done(errCode){if(errCode){if(!done.errored){done.errored=true;return doCallback(errCode);}return;}if(++completed>=mounts.length){doCallback(null);}}mounts.forEach(function(mount){if(!mount.type.syncfs){return done(null);}mount.type.syncfs(mount,populate,done);});},mount:function mount(type,opts,mountpoint){var root=mountpoint==="/";var pseudo=!mountpoint;var node;if(root&&FS.root){throw new FS.ErrnoError(10);}else if(!root&&!pseudo){var lookup=FS.lookupPath(mountpoint,{follow_mount:false});mountpoint=lookup.path;node=lookup.node;if(FS.isMountpoint(node)){throw new FS.ErrnoError(10);}if(!FS.isDir(node.mode)){throw new FS.ErrnoError(54);}}var mount={type:type,opts:opts,mountpoint:mountpoint,mounts:[]};var mountRoot=type.mount(mount);mountRoot.mount=mount;mount.root=mountRoot;if(root){FS.root=mountRoot;}else if(node){node.mounted=mount;if(node.mount){node.mount.mounts.push(mount);}}return mountRoot;},unmount:function unmount(mountpoint){var lookup=FS.lookupPath(mountpoint,{follow_mount:false});if(!FS.isMountpoint(lookup.node)){throw new FS.ErrnoError(28);}var node=lookup.node;var mount=node.mounted;var mounts=FS.getMounts(mount);Object.keys(FS.nameTable).forEach(function(hash){var current=FS.nameTable[hash];while(current){var next=current.name_next;if(mounts.includes(current.mount)){FS.destroyNode(current);}current=next;}});node.mounted=null;var idx=node.mount.mounts.indexOf(mount);node.mount.mounts.splice(idx,1);},lookup:function lookup(parent,name){return parent.node_ops.lookup(parent,name);},mknod:function mknod(path,mode,dev){var lookup=FS.lookupPath(path,{parent:true});var parent=lookup.node;var name=PATH.basename(path);if(!name){throw new FS.ErrnoError(28);}if(name==="."||name===".."){throw new FS.ErrnoError(20);}var errCode=FS.mayCreate(parent,name);if(errCode){throw new FS.ErrnoError(errCode);}if(!parent.node_ops.mknod){throw new FS.ErrnoError(63);}return parent.node_ops.mknod(parent,name,mode,dev);},statfs:function statfs(path){return FS.statfsNode(FS.lookupPath(path,{follow:true}).node);},statfsStream:function statfsStream(stream){return FS.statfsNode(stream.node);},statfsNode:function statfsNode(node){var rtn={bsize:4096,frsize:4096,blocks:1e6,bfree:5e5,bavail:5e5,files:FS.nextInode,ffree:FS.nextInode-1,fsid:42,flags:2,namelen:255};if(node.node_ops.statfs){Object.assign(rtn,node.node_ops.statfs(node.mount.opts.root));}return rtn;},create:function create(path){var mode=arguments.length>1&&arguments[1]!==undefined?arguments[1]:438;mode&=4095;mode|=32768;return FS.mknod(path,mode,0);},mkdir:function mkdir(path){var mode=arguments.length>1&&arguments[1]!==undefined?arguments[1]:511;mode&=511|512;mode|=16384;return FS.mknod(path,mode,0);},mkdirTree:function mkdirTree(path,mode){var dirs=path.split("/");var d="";var _iterator60=_createForOfIteratorHelper(dirs),_step60;try{for(_iterator60.s();!(_step60=_iterator60.n()).done;){var dir=_step60.value;if(!dir)continue;if(d||PATH.isAbs(path))d+="/";d+=dir;try{FS.mkdir(d,mode);}catch(e){if(e.errno!=20)throw e;}}}catch(err){_iterator60.e(err);}finally{_iterator60.f();}},mkdev:function mkdev(path,mode,dev){if(typeof dev=="undefined"){dev=mode;mode=438;}mode|=8192;return FS.mknod(path,mode,dev);},symlink:function symlink(oldpath,newpath){if(!PATH_FS.resolve(oldpath)){throw new FS.ErrnoError(44);}var lookup=FS.lookupPath(newpath,{parent:true});var parent=lookup.node;if(!parent){throw new FS.ErrnoError(44);}var newname=PATH.basename(newpath);var errCode=FS.mayCreate(parent,newname);if(errCode){throw new FS.ErrnoError(errCode);}if(!parent.node_ops.symlink){throw new FS.ErrnoError(63);}return parent.node_ops.symlink(parent,newname,oldpath);},rename:function rename(old_path,new_path){var old_dirname=PATH.dirname(old_path);var new_dirname=PATH.dirname(new_path);var old_name=PATH.basename(old_path);var new_name=PATH.basename(new_path);var lookup,old_dir,new_dir;lookup=FS.lookupPath(old_path,{parent:true});old_dir=lookup.node;lookup=FS.lookupPath(new_path,{parent:true});new_dir=lookup.node;if(!old_dir||!new_dir)throw new FS.ErrnoError(44);if(old_dir.mount!==new_dir.mount){throw new FS.ErrnoError(75);}var old_node=FS.lookupNode(old_dir,old_name);var relative=PATH_FS.relative(old_path,new_dirname);if(relative.charAt(0)!=="."){throw new FS.ErrnoError(28);}relative=PATH_FS.relative(new_path,old_dirname);if(relative.charAt(0)!=="."){throw new FS.ErrnoError(55);}var new_node;try{new_node=FS.lookupNode(new_dir,new_name);}catch(e){}if(old_node===new_node){return;}var isdir=FS.isDir(old_node.mode);var errCode=FS.mayDelete(old_dir,old_name,isdir);if(errCode){throw new FS.ErrnoError(errCode);}errCode=new_node?FS.mayDelete(new_dir,new_name,isdir):FS.mayCreate(new_dir,new_name);if(errCode){throw new FS.ErrnoError(errCode);}if(!old_dir.node_ops.rename){throw new FS.ErrnoError(63);}if(FS.isMountpoint(old_node)||new_node&&FS.isMountpoint(new_node)){throw new FS.ErrnoError(10);}if(new_dir!==old_dir){errCode=FS.nodePermissions(old_dir,"w");if(errCode){throw new FS.ErrnoError(errCode);}}FS.hashRemoveNode(old_node);try{old_dir.node_ops.rename(old_node,new_dir,new_name);old_node.parent=new_dir;}catch(e){throw e;}finally{FS.hashAddNode(old_node);}},rmdir:function rmdir(path){var lookup=FS.lookupPath(path,{parent:true});var parent=lookup.node;var name=PATH.basename(path);var node=FS.lookupNode(parent,name);var errCode=FS.mayDelete(parent,name,true);if(errCode){throw new FS.ErrnoError(errCode);}if(!parent.node_ops.rmdir){throw new FS.ErrnoError(63);}if(FS.isMountpoint(node)){throw new FS.ErrnoError(10);}parent.node_ops.rmdir(parent,name);FS.destroyNode(node);},readdir:function readdir(path){var lookup=FS.lookupPath(path,{follow:true});var node=lookup.node;var readdir=FS.checkOpExists(node.node_ops.readdir,54);return readdir(node);},unlink:function unlink(path){var lookup=FS.lookupPath(path,{parent:true});var parent=lookup.node;if(!parent){throw new FS.ErrnoError(44);}var name=PATH.basename(path);var node=FS.lookupNode(parent,name);var errCode=FS.mayDelete(parent,name,false);if(errCode){throw new FS.ErrnoError(errCode);}if(!parent.node_ops.unlink){throw new FS.ErrnoError(63);}if(FS.isMountpoint(node)){throw new FS.ErrnoError(10);}parent.node_ops.unlink(parent,name);FS.destroyNode(node);},readlink:function readlink(path){var lookup=FS.lookupPath(path);var link=lookup.node;if(!link){throw new FS.ErrnoError(44);}if(!link.node_ops.readlink){throw new FS.ErrnoError(28);}return link.node_ops.readlink(link);},stat:function stat(path,dontFollow){var lookup=FS.lookupPath(path,{follow:!dontFollow});var node=lookup.node;var getattr=FS.checkOpExists(node.node_ops.getattr,63);return getattr(node);},fstat:function fstat(fd){var _getattr;var stream=FS.getStreamChecked(fd);var node=stream.node;var getattr=stream.stream_ops.getattr;var arg=getattr?stream:node;(_getattr=getattr)!==null&&_getattr!==void 0?_getattr:getattr=node.node_ops.getattr;FS.checkOpExists(getattr,63);return getattr(arg);},lstat:function lstat(path){return FS.stat(path,true);},doChmod:function doChmod(stream,node,mode,dontFollow){FS.doSetAttr(stream,node,{mode:mode&4095|node.mode&~4095,ctime:Date.now(),dontFollow:dontFollow});},chmod:function chmod(path,mode,dontFollow){var node;if(typeof path=="string"){var lookup=FS.lookupPath(path,{follow:!dontFollow});node=lookup.node;}else{node=path;}FS.doChmod(null,node,mode,dontFollow);},lchmod:function lchmod(path,mode){FS.chmod(path,mode,true);},fchmod:function fchmod(fd,mode){var stream=FS.getStreamChecked(fd);FS.doChmod(stream,stream.node,mode,false);},doChown:function doChown(stream,node,dontFollow){FS.doSetAttr(stream,node,{timestamp:Date.now(),dontFollow:dontFollow});},chown:function chown(path,uid,gid,dontFollow){var node;if(typeof path=="string"){var lookup=FS.lookupPath(path,{follow:!dontFollow});node=lookup.node;}else{node=path;}FS.doChown(null,node,dontFollow);},lchown:function lchown(path,uid,gid){FS.chown(path,uid,gid,true);},fchown:function fchown(fd,uid,gid){var stream=FS.getStreamChecked(fd);FS.doChown(stream,stream.node,false);},doTruncate:function doTruncate(stream,node,len){if(FS.isDir(node.mode)){throw new FS.ErrnoError(31);}if(!FS.isFile(node.mode)){throw new FS.ErrnoError(28);}var errCode=FS.nodePermissions(node,"w");if(errCode){throw new FS.ErrnoError(errCode);}FS.doSetAttr(stream,node,{size:len,timestamp:Date.now()});},truncate:function truncate(path,len){if(len<0){throw new FS.ErrnoError(28);}var node;if(typeof path=="string"){var lookup=FS.lookupPath(path,{follow:true});node=lookup.node;}else{node=path;}FS.doTruncate(null,node,len);},ftruncate:function ftruncate(fd,len){var stream=FS.getStreamChecked(fd);if(len<0||(stream.flags&2097155)===0){throw new FS.ErrnoError(28);}FS.doTruncate(stream,stream.node,len);},utime:function utime(path,atime,mtime){var lookup=FS.lookupPath(path,{follow:true});var node=lookup.node;var setattr=FS.checkOpExists(node.node_ops.setattr,63);setattr(node,{atime:atime,mtime:mtime});},open:function open(path,flags){var mode=arguments.length>2&&arguments[2]!==undefined?arguments[2]:438;if(path===""){throw new FS.ErrnoError(44);}flags=typeof flags=="string"?FS_modeStringToFlags(flags):flags;if(flags&64){mode=mode&4095|32768;}else{mode=0;}var node;var isDirPath;if(_typeof(path)=="object"){node=path;}else{isDirPath=path.endsWith("/");var lookup=FS.lookupPath(path,{follow:!(flags&131072),noent_okay:true});node=lookup.node;path=lookup.path;}var created=false;if(flags&64){if(node){if(flags&128){throw new FS.ErrnoError(20);}}else if(isDirPath){throw new FS.ErrnoError(31);}else{node=FS.mknod(path,mode|511,0);created=true;}}if(!node){throw new FS.ErrnoError(44);}if(FS.isChrdev(node.mode)){flags&=~512;}if(flags&65536&&!FS.isDir(node.mode)){throw new FS.ErrnoError(54);}if(!created){var errCode=FS.mayOpen(node,flags);if(errCode){throw new FS.ErrnoError(errCode);}}if(flags&512&&!created){FS.truncate(node,0);}flags&=~(128|512|131072);var stream=FS.createStream({node:node,path:FS.getPath(node),flags:flags,seekable:true,position:0,stream_ops:node.stream_ops,ungotten:[],error:false});if(stream.stream_ops.open){stream.stream_ops.open(stream);}if(created){FS.chmod(node,mode&511);}if(Module["logReadFiles"]&&!(flags&1)){if(!(path in FS.readFiles)){FS.readFiles[path]=1;}}return stream;},close:function close(stream){if(FS.isClosed(stream)){throw new FS.ErrnoError(8);}if(stream.getdents)stream.getdents=null;try{if(stream.stream_ops.close){stream.stream_ops.close(stream);}}catch(e){throw e;}finally{FS.closeStream(stream.fd);}stream.fd=null;},isClosed:function isClosed(stream){return stream.fd===null;},llseek:function llseek(stream,offset,whence){if(FS.isClosed(stream)){throw new FS.ErrnoError(8);}if(!stream.seekable||!stream.stream_ops.llseek){throw new FS.ErrnoError(70);}if(whence!=0&&whence!=1&&whence!=2){throw new FS.ErrnoError(28);}stream.position=stream.stream_ops.llseek(stream,offset,whence);stream.ungotten=[];return stream.position;},read:function read(stream,buffer,offset,length,position){if(length<0||position<0){throw new FS.ErrnoError(28);}if(FS.isClosed(stream)){throw new FS.ErrnoError(8);}if((stream.flags&2097155)===1){throw new FS.ErrnoError(8);}if(FS.isDir(stream.node.mode)){throw new FS.ErrnoError(31);}if(!stream.stream_ops.read){throw new FS.ErrnoError(28);}var seeking=typeof position!="undefined";if(!seeking){position=stream.position;}else if(!stream.seekable){throw new FS.ErrnoError(70);}var bytesRead=stream.stream_ops.read(stream,buffer,offset,length,position);if(!seeking)stream.position+=bytesRead;return bytesRead;},write:function write(stream,buffer,offset,length,position,canOwn){if(length<0||position<0){throw new FS.ErrnoError(28);}if(FS.isClosed(stream)){throw new FS.ErrnoError(8);}if((stream.flags&2097155)===0){throw new FS.ErrnoError(8);}if(FS.isDir(stream.node.mode)){throw new FS.ErrnoError(31);}if(!stream.stream_ops.write){throw new FS.ErrnoError(28);}if(stream.seekable&&stream.flags&1024){FS.llseek(stream,0,2);}var seeking=typeof position!="undefined";if(!seeking){position=stream.position;}else if(!stream.seekable){throw new FS.ErrnoError(70);}var bytesWritten=stream.stream_ops.write(stream,buffer,offset,length,position,canOwn);if(!seeking)stream.position+=bytesWritten;return bytesWritten;},mmap:function mmap(stream,length,position,prot,flags){if((prot&2)!==0&&(flags&2)===0&&(stream.flags&2097155)!==2){throw new FS.ErrnoError(2);}if((stream.flags&2097155)===1){throw new FS.ErrnoError(2);}if(!stream.stream_ops.mmap){throw new FS.ErrnoError(43);}if(!length){throw new FS.ErrnoError(28);}return stream.stream_ops.mmap(stream,length,position,prot,flags);},msync:function msync(stream,buffer,offset,length,mmapFlags){if(!stream.stream_ops.msync){return 0;}return stream.stream_ops.msync(stream,buffer,offset,length,mmapFlags);},ioctl:function ioctl(stream,cmd,arg){if(!stream.stream_ops.ioctl){throw new FS.ErrnoError(59);}return stream.stream_ops.ioctl(stream,cmd,arg);},readFile:function readFile(path){var opts=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};opts.flags=opts.flags||0;opts.encoding=opts.encoding||"binary";if(opts.encoding!=="utf8"&&opts.encoding!=="binary"){throw new Error("Invalid encoding type \"".concat(opts.encoding,"\""));}var ret;var stream=FS.open(path,opts.flags);var stat=FS.stat(path);var length=stat.size;var buf=new Uint8Array(length);FS.read(stream,buf,0,length,0);if(opts.encoding==="utf8"){ret=UTF8ArrayToString(buf);}else if(opts.encoding==="binary"){ret=buf;}FS.close(stream);return ret;},writeFile:function writeFile(path,data){var opts=arguments.length>2&&arguments[2]!==undefined?arguments[2]:{};opts.flags=opts.flags||577;var stream=FS.open(path,opts.flags,opts.mode);if(typeof data=="string"){var buf=new Uint8Array(lengthBytesUTF8(data)+1);var actualNumBytes=stringToUTF8Array(data,buf,0,buf.length);FS.write(stream,buf,0,actualNumBytes,void 0,opts.canOwn);}else if(ArrayBuffer.isView(data)){FS.write(stream,data,0,data.byteLength,void 0,opts.canOwn);}else{throw new Error("Unsupported data type");}FS.close(stream);},cwd:function cwd(){return FS.currentPath;},chdir:function chdir(path){var lookup=FS.lookupPath(path,{follow:true});if(lookup.node===null){throw new FS.ErrnoError(44);}if(!FS.isDir(lookup.node.mode)){throw new FS.ErrnoError(54);}var errCode=FS.nodePermissions(lookup.node,"x");if(errCode){throw new FS.ErrnoError(errCode);}FS.currentPath=lookup.path;},createDefaultDirectories:function createDefaultDirectories(){FS.mkdir("/tmp");FS.mkdir("/home");FS.mkdir("/home/web_user");},createDefaultDevices:function createDefaultDevices(){FS.mkdir("/dev");FS.registerDevice(FS.makedev(1,3),{read:function read(){return 0;},write:function write(stream,buffer,offset,length,pos){return length;},llseek:function llseek(){return 0;}});FS.mkdev("/dev/null",FS.makedev(1,3));TTY.register(FS.makedev(5,0),TTY.default_tty_ops);TTY.register(FS.makedev(6,0),TTY.default_tty1_ops);FS.mkdev("/dev/tty",FS.makedev(5,0));FS.mkdev("/dev/tty1",FS.makedev(6,0));var randomBuffer=new Uint8Array(1024),randomLeft=0;var randomByte=function randomByte(){if(randomLeft===0){_randomFill(randomBuffer);randomLeft=randomBuffer.byteLength;}return randomBuffer[--randomLeft];};FS.createDevice("/dev","random",randomByte);FS.createDevice("/dev","urandom",randomByte);FS.mkdir("/dev/shm");FS.mkdir("/dev/shm/tmp");},createSpecialDirectories:function createSpecialDirectories(){FS.mkdir("/proc");var proc_self=FS.mkdir("/proc/self");FS.mkdir("/proc/self/fd");FS.mount({mount:function mount(){var node=FS.createNode(proc_self,"fd",16895,73);node.stream_ops={llseek:MEMFS.stream_ops.llseek};node.node_ops={lookup:function lookup(parent,name){var fd=+name;var stream=FS.getStreamChecked(fd);var ret={parent:null,mount:{mountpoint:"fake"},node_ops:{readlink:function readlink(){return stream.path;}},id:fd+1};ret.parent=ret;return ret;},readdir:function readdir(){return Array.from(FS.streams.entries()).filter(function(_ref26){var _ref27=_slicedToArray(_ref26,2),k=_ref27[0],v=_ref27[1];return v;}).map(function(_ref28){var _ref29=_slicedToArray(_ref28,2),k=_ref29[0],v=_ref29[1];return k.toString();});}};return node;}},{},"/proc/self/fd");},createStandardStreams:function createStandardStreams(input,output,error){if(input){FS.createDevice("/dev","stdin",input);}else{FS.symlink("/dev/tty","/dev/stdin");}if(output){FS.createDevice("/dev","stdout",null,output);}else{FS.symlink("/dev/tty","/dev/stdout");}if(error){FS.createDevice("/dev","stderr",null,error);}else{FS.symlink("/dev/tty1","/dev/stderr");}FS.open("/dev/stdin",0);FS.open("/dev/stdout",1);FS.open("/dev/stderr",1);},staticInit:function staticInit(){FS.nameTable=new Array(4096);FS.mount(MEMFS,{},"/");FS.createDefaultDirectories();FS.createDefaultDevices();FS.createSpecialDirectories();FS.filesystems={MEMFS:MEMFS};},init:function init(input,output,error){var _input,_output,_error2;FS.initialized=true;(_input=input)!==null&&_input!==void 0?_input:input=Module["stdin"];(_output=output)!==null&&_output!==void 0?_output:output=Module["stdout"];(_error2=error)!==null&&_error2!==void 0?_error2:error=Module["stderr"];FS.createStandardStreams(input,output,error);},quit:function quit(){FS.initialized=false;var _iterator61=_createForOfIteratorHelper(FS.streams),_step61;try{for(_iterator61.s();!(_step61=_iterator61.n()).done;){var stream=_step61.value;if(stream){FS.close(stream);}}}catch(err){_iterator61.e(err);}finally{_iterator61.f();}},findObject:function findObject(path,dontResolveLastLink){var ret=FS.analyzePath(path,dontResolveLastLink);if(!ret.exists){return null;}return ret.object;},analyzePath:function analyzePath(path,dontResolveLastLink){try{var lookup=FS.lookupPath(path,{follow:!dontResolveLastLink});path=lookup.path;}catch(e){}var ret={isRoot:false,exists:false,error:0,name:null,path:null,object:null,parentExists:false,parentPath:null,parentObject:null};try{var lookup=FS.lookupPath(path,{parent:true});ret.parentExists=true;ret.parentPath=lookup.path;ret.parentObject=lookup.node;ret.name=PATH.basename(path);lookup=FS.lookupPath(path,{follow:!dontResolveLastLink});ret.exists=true;ret.path=lookup.path;ret.object=lookup.node;ret.name=lookup.node.name;ret.isRoot=lookup.path==="/";}catch(e){ret.error=e.errno;}return ret;},createPath:function createPath(parent,path,canRead,canWrite){parent=typeof parent=="string"?parent:FS.getPath(parent);var parts=path.split("/").reverse();while(parts.length){var part=parts.pop();if(!part)continue;var current=PATH.join2(parent,part);try{FS.mkdir(current);}catch(e){if(e.errno!=20)throw e;}parent=current;}return current;},createFile:function createFile(parent,name,properties,canRead,canWrite){var path=PATH.join2(typeof parent=="string"?parent:FS.getPath(parent),name);var mode=FS_getMode(canRead,canWrite);return FS.create(path,mode);},createDataFile:function createDataFile(parent,name,data,canRead,canWrite,canOwn){var path=name;if(parent){parent=typeof parent=="string"?parent:FS.getPath(parent);path=name?PATH.join2(parent,name):parent;}var mode=FS_getMode(canRead,canWrite);var node=FS.create(path,mode);if(data){if(typeof data=="string"){var arr=new Array(data.length);for(var i=0,len=data.length;i<len;++i){arr[i]=data.charCodeAt(i);}data=arr;}FS.chmod(node,mode|146);var stream=FS.open(node,577);FS.write(stream,data,0,data.length,0,canOwn);FS.close(stream);FS.chmod(node,mode);}},createDevice:function createDevice(parent,name,input,output){var _a$major;var _a;var path=PATH.join2(typeof parent=="string"?parent:FS.getPath(parent),name);var mode=FS_getMode(!!input,!!output);(_a$major=(_a=FS.createDevice).major)!==null&&_a$major!==void 0?_a$major:_a.major=64;var dev=FS.makedev(FS.createDevice.major++,0);FS.registerDevice(dev,{open:function open(stream){stream.seekable=false;},close:function close(stream){var _output$buffer;if(output!==null&&output!==void 0&&(_output$buffer=output.buffer)!==null&&_output$buffer!==void 0&&_output$buffer.length){output(10);}},read:function read(stream,buffer,offset,length,pos){var bytesRead=0;for(var i=0;i<length;i++){var result;try{result=input();}catch(e){throw new FS.ErrnoError(29);}if(result===void 0&&bytesRead===0){throw new FS.ErrnoError(6);}if(result===null||result===void 0)break;bytesRead++;buffer[offset+i]=result;}if(bytesRead){stream.node.atime=Date.now();}return bytesRead;},write:function write(stream,buffer,offset,length,pos){for(var i=0;i<length;i++){try{output(buffer[offset+i]);}catch(e){throw new FS.ErrnoError(29);}}if(length){stream.node.mtime=stream.node.ctime=Date.now();}return i;}});return FS.mkdev(path,mode,dev);},forceLoadFile:function forceLoadFile(obj){if(obj.isDevice||obj.isFolder||obj.link||obj.contents)return true;if(typeof XMLHttpRequest!="undefined"){throw new Error("Lazy loading should have been performed (contents set) in createLazyFile, but it was not. Lazy loading only works in web workers. Use --embed-file or --preload-file in emcc on the main thread.");}else{try{obj.contents=readBinary(obj.url);obj.usedBytes=obj.contents.length;}catch(e){throw new FS.ErrnoError(29);}}},createLazyFile:function createLazyFile(parent,name,url,canRead,canWrite){var LazyUint8Array=/*#__PURE__*/function(){function LazyUint8Array(){_classCallCheck(this,LazyUint8Array);__publicField$2(this,"lengthKnown",false);__publicField$2(this,"chunks",[]);}_createClass(LazyUint8Array,[{key:"get",value:function get(idx){if(idx>this.length-1||idx<0){return void 0;}var chunkOffset=idx%this.chunkSize;var chunkNum=idx/this.chunkSize|0;return this.getter(chunkNum)[chunkOffset];}},{key:"setDataGetter",value:function setDataGetter(getter){this.getter=getter;}},{key:"cacheLength",value:function cacheLength(){var xhr=new XMLHttpRequest();xhr.open("HEAD",url,false);xhr.send(null);if(!(xhr.status>=200&&xhr.status<300||xhr.status===304))throw new Error("Couldn't load "+url+". Status: "+xhr.status);var datalength=Number(xhr.getResponseHeader("Content-length"));var header;var hasByteServing=(header=xhr.getResponseHeader("Accept-Ranges"))&&header==="bytes";var usesGzip=(header=xhr.getResponseHeader("Content-Encoding"))&&header==="gzip";var chunkSize=1024*1024;if(!hasByteServing)chunkSize=datalength;var doXHR=function doXHR(from,to){if(from>to)throw new Error("invalid range ("+from+", "+to+") or no bytes requested!");if(to>datalength-1)throw new Error("only "+datalength+" bytes available! programmer error!");var xhr2=new XMLHttpRequest();xhr2.open("GET",url,false);if(datalength!==chunkSize)xhr2.setRequestHeader("Range","bytes="+from+"-"+to);xhr2.responseType="arraybuffer";if(xhr2.overrideMimeType){xhr2.overrideMimeType("text/plain; charset=x-user-defined");}xhr2.send(null);if(!(xhr2.status>=200&&xhr2.status<300||xhr2.status===304))throw new Error("Couldn't load "+url+". Status: "+xhr2.status);if(xhr2.response!==void 0){return new Uint8Array(xhr2.response||[]);}return intArrayFromString(xhr2.responseText||"",true);};var lazyArray2=this;lazyArray2.setDataGetter(function(chunkNum){var start=chunkNum*chunkSize;var end=(chunkNum+1)*chunkSize-1;end=Math.min(end,datalength-1);if(typeof lazyArray2.chunks[chunkNum]=="undefined"){lazyArray2.chunks[chunkNum]=doXHR(start,end);}if(typeof lazyArray2.chunks[chunkNum]=="undefined")throw new Error("doXHR failed!");return lazyArray2.chunks[chunkNum];});if(usesGzip||!datalength){chunkSize=datalength=1;datalength=this.getter(0).length;chunkSize=datalength;out("LazyFiles on gzip forces download of the whole file when length is accessed");}this._length=datalength;this._chunkSize=chunkSize;this.lengthKnown=true;}},{key:"length",get:function get(){if(!this.lengthKnown){this.cacheLength();}return this._length;}},{key:"chunkSize",get:function get(){if(!this.lengthKnown){this.cacheLength();}return this._chunkSize;}}]);return LazyUint8Array;}();if(typeof XMLHttpRequest!="undefined"){throw"Cannot do synchronous binary XHRs outside webworkers in modern browsers. Use --embed-file or --preload-file in emcc";var lazyArray=new LazyUint8Array();var properties={isDevice:false,contents:lazyArray};}else{var properties={isDevice:false,url:url};}var node=FS.createFile(parent,name,properties,canRead,canWrite);if(properties.contents){node.contents=properties.contents;}else if(properties.url){node.contents=null;node.url=properties.url;}Object.defineProperties(node,{usedBytes:{get:function get(){return this.contents.length;}}});var stream_ops={};var keys=Object.keys(node.stream_ops);keys.forEach(function(key){var fn=node.stream_ops[key];stream_ops[key]=function(){FS.forceLoadFile(node);return fn.apply(void 0,arguments);};});function writeChunks(stream,buffer,offset,length,position){var contents=stream.node.contents;if(position>=contents.length)return 0;var size=Math.min(contents.length-position,length);if(contents.slice){for(var i=0;i<size;i++){buffer[offset+i]=contents[position+i];}}else{for(var i=0;i<size;i++){buffer[offset+i]=contents.get(position+i);}}return size;}stream_ops.read=function(stream,buffer,offset,length,position){FS.forceLoadFile(node);return writeChunks(stream,buffer,offset,length,position);};stream_ops.mmap=function(stream,length,position,prot,flags){FS.forceLoadFile(node);var ptr=mmapAlloc();if(!ptr){throw new FS.ErrnoError(48);}writeChunks(stream,HEAP8,ptr,length,position);return{ptr:ptr,allocated:true};};node.stream_ops=stream_ops;return node;}};UTF8ToString=function UTF8ToString(ptr,maxBytesToRead){return ptr?UTF8ArrayToString(HEAPU8,ptr,maxBytesToRead):"";};SYSCALLS={DEFAULT_POLLMASK:5,calculateAt:function calculateAt(dirfd,path,allowEmpty){if(PATH.isAbs(path)){return path;}var dir;if(dirfd===-100){dir=FS.cwd();}else{var dirstream=SYSCALLS.getStreamFromFD(dirfd);dir=dirstream.path;}if(path.length==0){if(!allowEmpty){throw new FS.ErrnoError(44);}return dir;}return dir+"/"+path;},writeStat:function writeStat(buf,stat){HEAP32[buf>>2]=stat.dev;HEAP32[buf+4>>2]=stat.mode;HEAPU32[buf+8>>2]=stat.nlink;HEAP32[buf+12>>2]=stat.uid;HEAP32[buf+16>>2]=stat.gid;HEAP32[buf+20>>2]=stat.rdev;HEAP64[buf+24>>3]=BigInt(stat.size);HEAP32[buf+32>>2]=4096;HEAP32[buf+36>>2]=stat.blocks;var atime=stat.atime.getTime();var mtime=stat.mtime.getTime();var ctime=stat.ctime.getTime();HEAP64[buf+40>>3]=BigInt(Math.floor(atime/1e3));HEAPU32[buf+48>>2]=atime%1e3*1e3*1e3;HEAP64[buf+56>>3]=BigInt(Math.floor(mtime/1e3));HEAPU32[buf+64>>2]=mtime%1e3*1e3*1e3;HEAP64[buf+72>>3]=BigInt(Math.floor(ctime/1e3));HEAPU32[buf+80>>2]=ctime%1e3*1e3*1e3;HEAP64[buf+88>>3]=BigInt(stat.ino);return 0;},writeStatFs:function writeStatFs(buf,stats){HEAP32[buf+4>>2]=stats.bsize;HEAP32[buf+40>>2]=stats.bsize;HEAP32[buf+8>>2]=stats.blocks;HEAP32[buf+12>>2]=stats.bfree;HEAP32[buf+16>>2]=stats.bavail;HEAP32[buf+20>>2]=stats.files;HEAP32[buf+24>>2]=stats.ffree;HEAP32[buf+28>>2]=stats.fsid;HEAP32[buf+44>>2]=stats.flags;HEAP32[buf+36>>2]=stats.namelen;},doMsync:function doMsync(addr,stream,len,flags,offset){if(!FS.isFile(stream.node.mode)){throw new FS.ErrnoError(43);}if(flags&2){return 0;}var buffer=HEAPU8.slice(addr,addr+len);FS.msync(stream,buffer,offset,len,flags);},getStreamFromFD:function getStreamFromFD(fd){var stream=FS.getStreamChecked(fd);return stream;},varargs:void 0,getStr:function getStr(ptr){var ret=UTF8ToString(ptr);return ret;}};__abort_js=function __abort_js(){return abort("");};structRegistrations={};runDestructors=function runDestructors(destructors){while(destructors.length){var ptr=destructors.pop();var del=destructors.pop();del(ptr);}};awaitingDependencies={};registeredTypes={};typeDependencies={};InternalError=/*#__PURE__*/function(_Error2){_inherits(InternalError,_Error2);var _super100=_createSuper(InternalError);function InternalError(message){var _this202;_classCallCheck(this,InternalError);_this202=_super100.call(this,message);_this202.name="InternalError";return _this202;}return _createClass(InternalError);}(/*#__PURE__*/_wrapNativeSuper(Error));throwInternalError=function throwInternalError(message){throw new InternalError(message);};whenDependentTypesAreResolved=function whenDependentTypesAreResolved(myTypes,dependentTypes,getTypeConverters){myTypes.forEach(function(type){return typeDependencies[type]=dependentTypes;});function onComplete(typeConverters2){var myTypeConverters=getTypeConverters(typeConverters2);if(myTypeConverters.length!==myTypes.length){throwInternalError("Mismatched type converter count");}for(var i=0;i<myTypes.length;++i){registerType(myTypes[i],myTypeConverters[i]);}}var typeConverters=new Array(dependentTypes.length);var unregisteredTypes=[];var registered=0;dependentTypes.forEach(function(dt,i){if(registeredTypes.hasOwnProperty(dt)){typeConverters[i]=registeredTypes[dt];}else{unregisteredTypes.push(dt);if(!awaitingDependencies.hasOwnProperty(dt)){awaitingDependencies[dt]=[];}awaitingDependencies[dt].push(function(){typeConverters[i]=registeredTypes[dt];++registered;if(registered===unregisteredTypes.length){onComplete(typeConverters);}});}});if(0===unregisteredTypes.length){onComplete(typeConverters);}};__embind_finalize_value_object=function __embind_finalize_value_object(structType){var reg=structRegistrations[structType];delete structRegistrations[structType];var rawConstructor=reg.rawConstructor;var rawDestructor=reg.rawDestructor;var fieldRecords=reg.fields;var fieldTypes=fieldRecords.map(function(field){return field.getterReturnType;}).concat(fieldRecords.map(function(field){return field.setterArgumentType;}));whenDependentTypesAreResolved([structType],fieldTypes,function(fieldTypes2){var fields={};fieldRecords.forEach(function(field,i){var fieldName=field.fieldName;var getterReturnType=fieldTypes2[i];var optional=fieldTypes2[i].optional;var getter=field.getter;var getterContext=field.getterContext;var setterArgumentType=fieldTypes2[i+fieldRecords.length];var setter=field.setter;var setterContext=field.setterContext;fields[fieldName]={read:function read(ptr){return getterReturnType["fromWireType"](getter(getterContext,ptr));},write:function write(ptr,o){var destructors=[];setter(setterContext,ptr,setterArgumentType["toWireType"](destructors,o));runDestructors(destructors);},optional:optional};});return[{name:reg.name,fromWireType:function fromWireType(ptr){var rv={};for(var i in fields){rv[i]=fields[i].read(ptr);}rawDestructor(ptr);return rv;},toWireType:function toWireType(destructors,o){for(var fieldName in fields){if(!(fieldName in o)&&!fields[fieldName].optional){throw new TypeError("Missing field: \"".concat(fieldName,"\""));}}var ptr=rawConstructor();for(fieldName in fields){fields[fieldName].write(ptr,o[fieldName]);}if(destructors!==null){destructors.push(rawDestructor,ptr);}return ptr;},argPackAdvance:GenericWireTypeSize,readValueFromPointer:readPointer,destructorFunction:rawDestructor}];});};embind_init_charCodes=function embind_init_charCodes(){var codes=new Array(256);for(var i=0;i<256;++i){codes[i]=String.fromCharCode(i);}embind_charCodes=codes;};readLatin1String=function readLatin1String(ptr){var ret="";var c=ptr;while(HEAPU8[c]){ret+=embind_charCodes[HEAPU8[c++]];}return ret;};BindingError=/*#__PURE__*/function(_Error3){_inherits(BindingError,_Error3);var _super101=_createSuper(BindingError);function BindingError(message){var _this203;_classCallCheck(this,BindingError);_this203=_super101.call(this,message);_this203.name="BindingError";return _this203;}return _createClass(BindingError);}(/*#__PURE__*/_wrapNativeSuper(Error));throwBindingError=function throwBindingError(message){throw new BindingError(message);};integerReadValueFromPointer=function integerReadValueFromPointer(name,width,signed){switch(width){case 1:return signed?function(pointer){return HEAP8[pointer];}:function(pointer){return HEAPU8[pointer];};case 2:return signed?function(pointer){return HEAP16[pointer>>1];}:function(pointer){return HEAPU16[pointer>>1];};case 4:return signed?function(pointer){return HEAP32[pointer>>2];}:function(pointer){return HEAPU32[pointer>>2];};case 8:return signed?function(pointer){return HEAP64[pointer>>3];}:function(pointer){return HEAPU64[pointer>>3];};default:throw new TypeError("invalid integer width (".concat(width,"): ").concat(name));}};__embind_register_bigint=function __embind_register_bigint(primitiveType,name,size,minRange,maxRange){name=readLatin1String(name);var isUnsignedType=minRange===0n;var fromWireType=function fromWireType(value){return value;};if(isUnsignedType){var bitSize=size*8;fromWireType=function fromWireType(value){return BigInt.asUintN(bitSize,value);};maxRange=fromWireType(maxRange);}registerType(primitiveType,{name:name,fromWireType:fromWireType,toWireType:function toWireType(destructors,value){if(typeof value=="number"){value=BigInt(value);}return value;},argPackAdvance:GenericWireTypeSize,readValueFromPointer:integerReadValueFromPointer(name,size,!isUnsignedType),destructorFunction:null});};GenericWireTypeSize=8;__embind_register_bool=function __embind_register_bool(rawType,name,trueValue,falseValue){name=readLatin1String(name);registerType(rawType,{name:name,fromWireType:function fromWireType(wt){return!!wt;},toWireType:function toWireType(destructors,o){return o?trueValue:falseValue;},argPackAdvance:GenericWireTypeSize,readValueFromPointer:function readValueFromPointer(pointer){return this["fromWireType"](HEAPU8[pointer]);},destructorFunction:null});};emval_freelist=[];emval_handles=[0,1,,1,null,1,true,1,false,1];__emval_decref=function __emval_decref(handle){if(handle>9&&0===--emval_handles[handle+1]){emval_handles[handle]=void 0;emval_freelist.push(handle);}};Emval={toValue:function toValue(handle){if(!handle){throwBindingError("Cannot use deleted val. handle = ".concat(handle));}return emval_handles[handle];},toHandle:function toHandle(value){switch(value){case void 0:return 2;case null:return 4;case true:return 6;case false:return 8;default:{var handle=emval_freelist.pop()||emval_handles.length;emval_handles[handle]=value;emval_handles[handle+1]=1;return handle;}}}};EmValType={name:"emscripten::val",fromWireType:function fromWireType(handle){var rv=Emval.toValue(handle);__emval_decref(handle);return rv;},toWireType:function toWireType(destructors,value){return Emval.toHandle(value);},argPackAdvance:GenericWireTypeSize,readValueFromPointer:readPointer,destructorFunction:null};__embind_register_emval=function __embind_register_emval(rawType){return registerType(rawType,EmValType);};floatReadValueFromPointer=function floatReadValueFromPointer(name,width){switch(width){case 4:return function(pointer){return this["fromWireType"](HEAPF32[pointer>>2]);};case 8:return function(pointer){return this["fromWireType"](HEAPF64[pointer>>3]);};default:throw new TypeError("invalid float width (".concat(width,"): ").concat(name));}};__embind_register_float=function __embind_register_float(rawType,name,size){name=readLatin1String(name);registerType(rawType,{name:name,fromWireType:function fromWireType(value){return value;},toWireType:function toWireType(destructors,value){return value;},argPackAdvance:GenericWireTypeSize,readValueFromPointer:floatReadValueFromPointer(name,size),destructorFunction:null});};createNamedFunction=function createNamedFunction(name,func){return Object.defineProperty(func,"name",{value:name});};runAndAbortIfError=function runAndAbortIfError(func){try{return func();}catch(e){abort(e);}};handleException=function handleException(e){if(e instanceof ExitStatus||e=="unwind"){return EXITSTATUS;}quit_(1,e);};runtimeKeepaliveCounter=0;keepRuntimeAlive=function keepRuntimeAlive(){return noExitRuntime||runtimeKeepaliveCounter>0;};_proc_exit=function _proc_exit(code){EXITSTATUS=code;if(!keepRuntimeAlive()){var _Module$onExit;(_Module$onExit=Module["onExit"])===null||_Module$onExit===void 0?void 0:_Module$onExit.call(Module,code);ABORT=true;}quit_(code,new ExitStatus(code));};exitJS=function exitJS(status,implicit){EXITSTATUS=status;_proc_exit(status);};_exit=exitJS;maybeExit=function maybeExit(){if(!keepRuntimeAlive()){try{_exit(EXITSTATUS);}catch(e){handleException(e);}}};callUserCallback=function callUserCallback(func){if(ABORT){return;}try{func();maybeExit();}catch(e){handleException(e);}};Asyncify={instrumentWasmImports:function instrumentWasmImports(imports){var importPattern=/^(invoke_.*|__asyncjs__.*)$/;for(var _i389=0,_Object$entries6=Object.entries(imports);_i389<_Object$entries6.length;_i389++){var _Object$entries6$_i=_slicedToArray(_Object$entries6[_i389],2),x=_Object$entries6$_i[0],original=_Object$entries6$_i[1];if(typeof original=="function"){original.isAsync||importPattern.test(x);}}},instrumentWasmExports:function instrumentWasmExports(exports){var ret={};var _loop14=function _loop14(){var _Object$entries7$_i=_slicedToArray(_Object$entries7[_i390],2),x=_Object$entries7$_i[0],original=_Object$entries7$_i[1];if(typeof original=="function"){ret[x]=function(){Asyncify.exportCallStack.push(x);try{return original.apply(void 0,arguments);}finally{if(!ABORT){Asyncify.exportCallStack.pop();Asyncify.maybeStopUnwind();}}};}else{ret[x]=original;}};for(var _i390=0,_Object$entries7=Object.entries(exports);_i390<_Object$entries7.length;_i390++){_loop14();}return ret;},State:{Normal:0,Unwinding:1,Rewinding:2,Disabled:3},state:0,StackSize:4096,currData:null,handleSleepReturnValue:0,exportCallStack:[],callStackNameToId:{},callStackIdToName:{},callStackId:0,asyncPromiseHandlers:null,sleepCallbacks:[],getCallStackId:function getCallStackId(funcName){var id=Asyncify.callStackNameToId[funcName];if(id===void 0){id=Asyncify.callStackId++;Asyncify.callStackNameToId[funcName]=id;Asyncify.callStackIdToName[id]=funcName;}return id;},maybeStopUnwind:function maybeStopUnwind(){if(Asyncify.currData&&Asyncify.state===Asyncify.State.Unwinding&&Asyncify.exportCallStack.length===0){Asyncify.state=Asyncify.State.Normal;runAndAbortIfError(_asyncify_stop_unwind);if(typeof Fibers!="undefined"){Fibers.trampoline();}}},whenDone:function whenDone(){return new Promise(function(resolve,reject){Asyncify.asyncPromiseHandlers={resolve:resolve,reject:reject};});},allocateData:function allocateData(){var ptr=_malloc(12+Asyncify.StackSize);Asyncify.setDataHeader(ptr,ptr+12,Asyncify.StackSize);Asyncify.setDataRewindFunc(ptr);return ptr;},setDataHeader:function setDataHeader(ptr,stack,stackSize){HEAPU32[ptr>>2]=stack;HEAPU32[ptr+4>>2]=stack+stackSize;},setDataRewindFunc:function setDataRewindFunc(ptr){var bottomOfCallStack=Asyncify.exportCallStack[0];var rewindId=Asyncify.getCallStackId(bottomOfCallStack);HEAP32[ptr+8>>2]=rewindId;},getDataRewindFuncName:function getDataRewindFuncName(ptr){var id=HEAP32[ptr+8>>2];var name=Asyncify.callStackIdToName[id];return name;},getDataRewindFunc:function getDataRewindFunc(name){var func=wasmExports[name];return func;},doRewind:function doRewind(ptr){var name=Asyncify.getDataRewindFuncName(ptr);var func=Asyncify.getDataRewindFunc(name);return func();},handleSleep:function handleSleep(startAsync){if(ABORT)return;if(Asyncify.state===Asyncify.State.Normal){var reachedCallback=false;var reachedAfterCallback=false;startAsync(function(){var handleSleepReturnValue=arguments.length>0&&arguments[0]!==undefined?arguments[0]:0;if(ABORT)return;Asyncify.handleSleepReturnValue=handleSleepReturnValue;reachedCallback=true;if(!reachedAfterCallback){return;}Asyncify.state=Asyncify.State.Rewinding;runAndAbortIfError(function(){return _asyncify_start_rewind(Asyncify.currData);});if(typeof MainLoop!="undefined"&&MainLoop.func){MainLoop.resume();}var asyncWasmReturnValue,isError=false;try{asyncWasmReturnValue=Asyncify.doRewind(Asyncify.currData);}catch(err2){asyncWasmReturnValue=err2;isError=true;}var handled=false;if(!Asyncify.currData){var asyncPromiseHandlers=Asyncify.asyncPromiseHandlers;if(asyncPromiseHandlers){Asyncify.asyncPromiseHandlers=null;(isError?asyncPromiseHandlers.reject:asyncPromiseHandlers.resolve)(asyncWasmReturnValue);handled=true;}}if(isError&&!handled){throw asyncWasmReturnValue;}});reachedAfterCallback=true;if(!reachedCallback){Asyncify.state=Asyncify.State.Unwinding;Asyncify.currData=Asyncify.allocateData();if(typeof MainLoop!="undefined"&&MainLoop.func){MainLoop.pause();}runAndAbortIfError(function(){return _asyncify_start_unwind(Asyncify.currData);});}}else if(Asyncify.state===Asyncify.State.Rewinding){Asyncify.state=Asyncify.State.Normal;runAndAbortIfError(_asyncify_stop_rewind);_free(Asyncify.currData);Asyncify.currData=null;Asyncify.sleepCallbacks.forEach(callUserCallback);}else{abort("invalid state: ".concat(Asyncify.state));}return Asyncify.handleSleepReturnValue;},handleAsync:function handleAsync(startAsync){return Asyncify.handleSleep(function(wakeUp){startAsync().then(wakeUp);});}};ensureOverloadTable=function ensureOverloadTable(proto,methodName,humanName){if(void 0===proto[methodName].overloadTable){var prevFunc=proto[methodName];proto[methodName]=function(){for(var _len60=arguments.length,args=new Array(_len60),_key15=0;_key15<_len60;_key15++){args[_key15]=arguments[_key15];}if(!proto[methodName].overloadTable.hasOwnProperty(args.length)){throwBindingError("Function '".concat(humanName,"' called with an invalid number of arguments (").concat(args.length,") - expects one of (").concat(proto[methodName].overloadTable,")!"));}return proto[methodName].overloadTable[args.length].apply(this,args);};proto[methodName].overloadTable=[];proto[methodName].overloadTable[prevFunc.argCount]=prevFunc;}};exposePublicSymbol=function exposePublicSymbol(name,value,numArguments){if(Module.hasOwnProperty(name)){if(void 0===numArguments||void 0!==Module[name].overloadTable&&void 0!==Module[name].overloadTable[numArguments]){throwBindingError("Cannot register public name '".concat(name,"' twice"));}ensureOverloadTable(Module,name,name);if(Module[name].overloadTable.hasOwnProperty(numArguments)){throwBindingError("Cannot register multiple overloads of a function with the same number of arguments (".concat(numArguments,")!"));}Module[name].overloadTable[numArguments]=value;}else{Module[name]=value;Module[name].argCount=numArguments;}};heap32VectorToArray=function heap32VectorToArray(count,firstElement){var array=[];for(var i=0;i<count;i++){array.push(HEAPU32[firstElement+i*4>>2]);}return array;};replacePublicSymbol=function replacePublicSymbol(name,value,numArguments){if(!Module.hasOwnProperty(name)){throwInternalError("Replacing nonexistent public symbol");}if(void 0!==Module[name].overloadTable&&void 0!==numArguments){Module[name].overloadTable[numArguments]=value;}else{Module[name]=value;Module[name].argCount=numArguments;}};getDynCaller=function getDynCaller(sig,ptr){var promising=arguments.length>2&&arguments[2]!==undefined?arguments[2]:false;return function(){for(var _len61=arguments.length,args=new Array(_len61),_key16=0;_key16<_len61;_key16++){args[_key16]=arguments[_key16];}return dynCall(sig,ptr,args,promising);};};embind__requireFunction=function embind__requireFunction(signature,rawFunction){var isAsync=arguments.length>2&&arguments[2]!==undefined?arguments[2]:false;signature=readLatin1String(signature);function makeDynCaller(){return getDynCaller(signature,rawFunction);}var fp=makeDynCaller();if(typeof fp!="function"){throwBindingError("unknown function pointer with signature ".concat(signature,": ").concat(rawFunction));}return fp;};UnboundTypeError=/*#__PURE__*/function(_Error4){_inherits(UnboundTypeError,_Error4);var _super102=_createSuper(UnboundTypeError);function UnboundTypeError(){_classCallCheck(this,UnboundTypeError);return _super102.apply(this,arguments);}return _createClass(UnboundTypeError);}(/*#__PURE__*/_wrapNativeSuper(Error));getTypeName=function getTypeName(type){var ptr=___getTypeName(type);var rv=readLatin1String(ptr);_free(ptr);return rv;};throwUnboundTypeError=function throwUnboundTypeError(message,types){var unboundTypes=[];var seen={};function visit(type){if(seen[type]){return;}if(registeredTypes[type]){return;}if(typeDependencies[type]){typeDependencies[type].forEach(visit);return;}unboundTypes.push(type);seen[type]=true;}types.forEach(visit);throw new UnboundTypeError("".concat(message,": ")+unboundTypes.map(getTypeName).join([", "]));};getFunctionName=function getFunctionName(signature){signature=signature.trim();var argsIndex=signature.indexOf("(");if(argsIndex===-1)return signature;return signature.slice(0,argsIndex);};__embind_register_function=function __embind_register_function(name,argCount,rawArgTypesAddr,signature,rawInvoker,fn,isAsync,isNonnullReturn){var argTypes=heap32VectorToArray(argCount,rawArgTypesAddr);name=readLatin1String(name);name=getFunctionName(name);rawInvoker=embind__requireFunction(signature,rawInvoker,isAsync);exposePublicSymbol(name,function(){throwUnboundTypeError("Cannot call ".concat(name," due to unbound types"),argTypes);},argCount-1);whenDependentTypesAreResolved([],argTypes,function(argTypes2){var invokerArgsArray=[argTypes2[0],null].concat(argTypes2.slice(1));replacePublicSymbol(name,craftInvokerFunction(name,invokerArgsArray,null,rawInvoker,fn,isAsync),argCount-1);return[];});};__embind_register_integer=function __embind_register_integer(primitiveType,name,size,minRange,maxRange){name=readLatin1String(name);var isUnsignedType=minRange===0;var fromWireType=function fromWireType(value){return value;};if(isUnsignedType){var bitshift=32-8*size;fromWireType=function fromWireType(value){return value<<bitshift>>>bitshift;};maxRange=fromWireType(maxRange);}registerType(primitiveType,{name:name,fromWireType:fromWireType,toWireType:function toWireType(destructors,value){return value;},argPackAdvance:GenericWireTypeSize,readValueFromPointer:integerReadValueFromPointer(name,size,minRange!==0),destructorFunction:null});};__embind_register_memory_view=function __embind_register_memory_view(rawType,dataTypeIndex,name){var typeMapping=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array,BigInt64Array,BigUint64Array];var TA=typeMapping[dataTypeIndex];function decodeMemoryView(handle){var size=HEAPU32[handle>>2];var data=HEAPU32[handle+4>>2];return new TA(HEAP8.buffer,data,size);}name=readLatin1String(name);registerType(rawType,{name:name,fromWireType:decodeMemoryView,argPackAdvance:GenericWireTypeSize,readValueFromPointer:decodeMemoryView},{ignoreDuplicateRegistrations:true});};stringToUTF8=function stringToUTF8(str,outPtr,maxBytesToWrite){return stringToUTF8Array(str,HEAPU8,outPtr,maxBytesToWrite);};__embind_register_std_string=function __embind_register_std_string(rawType,name){name=readLatin1String(name);registerType(rawType,{name:name,fromWireType:function fromWireType(value){var length=HEAPU32[value>>2];var payload=value+4;var str;var i;{var decodeStartPtr=payload;for(var i=0;i<=length;++i){var currentBytePtr=payload+i;if(i==length||HEAPU8[currentBytePtr]==0){var maxRead=currentBytePtr-decodeStartPtr;var stringSegment=UTF8ToString(decodeStartPtr,maxRead);if(str===void 0){str=stringSegment;}else{str+=String.fromCharCode(0);str+=stringSegment;}decodeStartPtr=currentBytePtr+1;}}}_free(value);return str;},toWireType:function toWireType(destructors,value){if(value instanceof ArrayBuffer){value=new Uint8Array(value);}var length;var valueIsOfTypeString=typeof value=="string";if(!(valueIsOfTypeString||ArrayBuffer.isView(value)&&value.BYTES_PER_ELEMENT==1)){throwBindingError("Cannot pass non-string to std::string");}if(valueIsOfTypeString){length=lengthBytesUTF8(value);}else{length=value.length;}var base=_malloc(4+length+1);var ptr=base+4;HEAPU32[base>>2]=length;if(valueIsOfTypeString){{stringToUTF8(value,ptr,length+1);}}else{HEAPU8.set(value,ptr);}if(destructors!==null){destructors.push(_free,base);}return base;},argPackAdvance:GenericWireTypeSize,readValueFromPointer:readPointer,destructorFunction:function destructorFunction(ptr){_free(ptr);}});};UTF16Decoder=typeof TextDecoder!="undefined"?new TextDecoder("utf-16le"):void 0;UTF16ToString=function UTF16ToString(ptr,maxBytesToRead){var idx=ptr>>1;var maxIdx=idx+maxBytesToRead/2;var endIdx=idx;while(!(endIdx>=maxIdx)&&HEAPU16[endIdx]){++endIdx;}if(endIdx-idx>16&&UTF16Decoder)return UTF16Decoder.decode(HEAPU16.subarray(idx,endIdx));var str="";for(var i=idx;!(i>=maxIdx);++i){var codeUnit=HEAPU16[i];if(codeUnit==0)break;str+=String.fromCharCode(codeUnit);}return str;};stringToUTF16=function stringToUTF16(str,outPtr,maxBytesToWrite){var _maxBytesToWrite;(_maxBytesToWrite=maxBytesToWrite)!==null&&_maxBytesToWrite!==void 0?_maxBytesToWrite:maxBytesToWrite=2147483647;if(maxBytesToWrite<2)return 0;maxBytesToWrite-=2;var startPtr=outPtr;var numCharsToWrite=maxBytesToWrite<str.length*2?maxBytesToWrite/2:str.length;for(var i=0;i<numCharsToWrite;++i){var codeUnit=str.charCodeAt(i);HEAP16[outPtr>>1]=codeUnit;outPtr+=2;}HEAP16[outPtr>>1]=0;return outPtr-startPtr;};lengthBytesUTF16=function lengthBytesUTF16(str){return str.length*2;};UTF32ToString=function UTF32ToString(ptr,maxBytesToRead){var i=0;var str="";while(!(i>=maxBytesToRead/4)){var utf32=HEAP32[ptr+i*4>>2];if(utf32==0)break;++i;if(utf32>=65536){var ch=utf32-65536;str+=String.fromCharCode(55296|ch>>10,56320|ch&1023);}else{str+=String.fromCharCode(utf32);}}return str;};stringToUTF32=function stringToUTF32(str,outPtr,maxBytesToWrite){var _maxBytesToWrite2;(_maxBytesToWrite2=maxBytesToWrite)!==null&&_maxBytesToWrite2!==void 0?_maxBytesToWrite2:maxBytesToWrite=2147483647;if(maxBytesToWrite<4)return 0;var startPtr=outPtr;var endPtr=startPtr+maxBytesToWrite-4;for(var i=0;i<str.length;++i){var codeUnit=str.charCodeAt(i);if(codeUnit>=55296&&codeUnit<=57343){var trailSurrogate=str.charCodeAt(++i);codeUnit=65536+((codeUnit&1023)<<10)|trailSurrogate&1023;}HEAP32[outPtr>>2]=codeUnit;outPtr+=4;if(outPtr+4>endPtr)break;}HEAP32[outPtr>>2]=0;return outPtr-startPtr;};lengthBytesUTF32=function lengthBytesUTF32(str){var len=0;for(var i=0;i<str.length;++i){var codeUnit=str.charCodeAt(i);if(codeUnit>=55296&&codeUnit<=57343)++i;len+=4;}return len;};__embind_register_std_wstring=function __embind_register_std_wstring(rawType,charSize,name){name=readLatin1String(name);var decodeString,encodeString,readCharAt,lengthBytesUTF;if(charSize===2){decodeString=UTF16ToString;encodeString=stringToUTF16;lengthBytesUTF=lengthBytesUTF16;readCharAt=function readCharAt(pointer){return HEAPU16[pointer>>1];};}else if(charSize===4){decodeString=UTF32ToString;encodeString=stringToUTF32;lengthBytesUTF=lengthBytesUTF32;readCharAt=function readCharAt(pointer){return HEAPU32[pointer>>2];};}registerType(rawType,{name:name,fromWireType:function fromWireType(value){var length=HEAPU32[value>>2];var str;var decodeStartPtr=value+4;for(var i=0;i<=length;++i){var currentBytePtr=value+4+i*charSize;if(i==length||readCharAt(currentBytePtr)==0){var maxReadBytes=currentBytePtr-decodeStartPtr;var stringSegment=decodeString(decodeStartPtr,maxReadBytes);if(str===void 0){str=stringSegment;}else{str+=String.fromCharCode(0);str+=stringSegment;}decodeStartPtr=currentBytePtr+charSize;}}_free(value);return str;},toWireType:function toWireType(destructors,value){if(!(typeof value=="string")){throwBindingError("Cannot pass non-string to C++ string type ".concat(name));}var length=lengthBytesUTF(value);var ptr=_malloc(4+length+charSize);HEAPU32[ptr>>2]=length/charSize;encodeString(value,ptr+4,length+charSize);if(destructors!==null){destructors.push(_free,ptr);}return ptr;},argPackAdvance:GenericWireTypeSize,readValueFromPointer:readPointer,destructorFunction:function destructorFunction(ptr){_free(ptr);}});};__embind_register_value_object=function __embind_register_value_object(rawType,name,constructorSignature,rawConstructor,destructorSignature,rawDestructor){structRegistrations[rawType]={name:readLatin1String(name),rawConstructor:embind__requireFunction(constructorSignature,rawConstructor),rawDestructor:embind__requireFunction(destructorSignature,rawDestructor),fields:[]};};__embind_register_value_object_field=function __embind_register_value_object_field(structType,fieldName,getterReturnType,getterSignature,getter,getterContext,setterArgumentType,setterSignature,setter,setterContext){structRegistrations[structType].fields.push({fieldName:readLatin1String(fieldName),getterReturnType:getterReturnType,getter:embind__requireFunction(getterSignature,getter),getterContext:getterContext,setterArgumentType:setterArgumentType,setter:embind__requireFunction(setterSignature,setter),setterContext:setterContext});};__embind_register_void=function __embind_register_void(rawType,name){name=readLatin1String(name);registerType(rawType,{isVoid:true,name:name,argPackAdvance:0,fromWireType:function fromWireType(){return void 0;},toWireType:function toWireType(destructors,o){return void 0;}});};requireRegisteredType=function requireRegisteredType(rawType,humanName){var impl=registeredTypes[rawType];if(void 0===impl){throwBindingError("".concat(humanName," has unknown type ").concat(getTypeName(rawType)));}return impl;};emval_returnValue=function emval_returnValue(returnType,destructorsRef,handle){var destructors=[];var result=returnType["toWireType"](destructors,handle);if(destructors.length){HEAPU32[destructorsRef>>2]=Emval.toHandle(destructors);}return result;};__emval_as=function __emval_as(handle,returnType,destructorsRef){handle=Emval.toValue(handle);returnType=requireRegisteredType(returnType,"emval::as");return emval_returnValue(returnType,destructorsRef,handle);};emval_methodCallers=[];__emval_call=function __emval_call(caller,handle,destructorsRef,args){caller=emval_methodCallers[caller];handle=Emval.toValue(handle);return caller(null,handle,destructorsRef,args);};emval_symbols={};getStringOrSymbol=function getStringOrSymbol(address){var symbol=emval_symbols[address];if(symbol===void 0){return readLatin1String(address);}return symbol;};emval_get_global=function emval_get_global(){if((typeof globalThis==="undefined"?"undefined":_typeof(globalThis))=="object"){return globalThis;}return/* @__PURE__ */function(){return Function;}()("return this")();};__emval_get_global=function __emval_get_global(name){if(name===0){return Emval.toHandle(emval_get_global());}else{name=getStringOrSymbol(name);return Emval.toHandle(emval_get_global()[name]);}};emval_addMethodCaller=function emval_addMethodCaller(caller){var id=emval_methodCallers.length;emval_methodCallers.push(caller);return id;};emval_lookupTypes=function emval_lookupTypes(argCount,argTypes){var a=new Array(argCount);for(var i=0;i<argCount;++i){a[i]=requireRegisteredType(HEAPU32[argTypes+i*4>>2],"parameter ".concat(i));}return a;};__emval_get_method_caller=function __emval_get_method_caller(argCount,argTypes,kind){var types=emval_lookupTypes(argCount,argTypes);var retType=types.shift();argCount--;var functionBody="return function (obj, func, destructorsRef, args) {\n";var offset=0;var argsList=[];if(kind===0){argsList.push("obj");}var params=["retType"];var args=[retType];for(var i=0;i<argCount;++i){argsList.push("arg".concat(i));params.push("argType".concat(i));args.push(types[i]);functionBody+=" var arg".concat(i," = argType").concat(i,".readValueFromPointer(args").concat(offset?"+"+offset:"",");\n");offset+=types[i].argPackAdvance;}var invoker=kind===1?"new func":"func.call";functionBody+=" var rv = ".concat(invoker,"(").concat(argsList.join(", "),");\n");if(!retType.isVoid){params.push("emval_returnValue");args.push(emval_returnValue);functionBody+=" return emval_returnValue(retType, destructorsRef, rv);\n";}functionBody+="};\n";var invokerFunction=_construct(Function,params.concat([functionBody])).apply(void 0,args);var functionName="methodCaller<(".concat(types.map(function(t){return t.name;}).join(", "),") => ").concat(retType.name,">");return emval_addMethodCaller(createNamedFunction(functionName,invokerFunction));};__emval_incref=function __emval_incref(handle){if(handle>9){emval_handles[handle+1]+=1;}};__emval_is_string=function __emval_is_string(handle){handle=Emval.toValue(handle);return typeof handle=="string";};__emval_run_destructors=function __emval_run_destructors(handle){var destructors=Emval.toValue(handle);runDestructors(destructors);__emval_decref(handle);};__emval_take_value=function __emval_take_value(type,arg){type=requireRegisteredType(type,"_emval_take_value");var v=type["readValueFromPointer"](arg);return Emval.toHandle(v);};INT53_MAX=9007199254740992;INT53_MIN=-9007199254740992;bigintToI53Checked=function bigintToI53Checked(num){return num<INT53_MIN||num>INT53_MAX?NaN:Number(num);};isLeapYear=function isLeapYear(year){return year%4===0&&(year%100!==0||year%400===0);};MONTH_DAYS_LEAP_CUMULATIVE=[0,31,60,91,121,152,182,213,244,274,305,335];MONTH_DAYS_REGULAR_CUMULATIVE=[0,31,59,90,120,151,181,212,243,273,304,334];ydayFromDate=function ydayFromDate(date){var leap=isLeapYear(date.getFullYear());var monthDaysCumulative=leap?MONTH_DAYS_LEAP_CUMULATIVE:MONTH_DAYS_REGULAR_CUMULATIVE;var yday=monthDaysCumulative[date.getMonth()]+date.getDate()-1;return yday;};__tzset_js=function __tzset_js(timezone,daylight,std_name,dst_name){var currentYear=/* @__PURE__ */new Date().getFullYear();var winter=new Date(currentYear,0,1);var summer=new Date(currentYear,6,1);var winterOffset=winter.getTimezoneOffset();var summerOffset=summer.getTimezoneOffset();var stdTimezoneOffset=Math.max(winterOffset,summerOffset);HEAPU32[timezone>>2]=stdTimezoneOffset*60;HEAP32[daylight>>2]=Number(winterOffset!=summerOffset);var extractZone=function extractZone(timezoneOffset){var sign=timezoneOffset>=0?"-":"+";var absOffset=Math.abs(timezoneOffset);var hours=String(Math.floor(absOffset/60)).padStart(2,"0");var minutes=String(absOffset%60).padStart(2,"0");return"UTC".concat(sign).concat(hours).concat(minutes);};var winterName=extractZone(winterOffset);var summerName=extractZone(summerOffset);if(summerOffset<winterOffset){stringToUTF8(winterName,std_name,17);stringToUTF8(summerName,dst_name,17);}else{stringToUTF8(winterName,dst_name,17);stringToUTF8(summerName,std_name,17);}};_emscripten_get_now=function _emscripten_get_now(){return performance.now();};_emscripten_date_now=function _emscripten_date_now(){return Date.now();};checkWasiClock=function checkWasiClock(clock_id){return clock_id>=0&&clock_id<=3;};readEmAsmArgsArray=[];readEmAsmArgs=function readEmAsmArgs(sigPtr,buf){readEmAsmArgsArray.length=0;var ch;while(ch=HEAPU8[sigPtr++]){var wide=ch!=105;wide&=ch!=112;buf+=wide&&buf%8?4:0;readEmAsmArgsArray.push(ch==112?HEAPU32[buf>>2]:ch==106?HEAP64[buf>>3]:ch==105?HEAP32[buf>>2]:HEAPF64[buf>>3]);buf+=wide?8:4;}return readEmAsmArgsArray;};runEmAsmFunction=function runEmAsmFunction(code,sigPtr,argbuf){var args=readEmAsmArgs(sigPtr,argbuf);return ASM_CONSTS[code].apply(ASM_CONSTS,_toConsumableArray(args));};_emscripten_asm_const_int=function _emscripten_asm_const_int(code,sigPtr,argbuf){return runEmAsmFunction(code,sigPtr,argbuf);};getHeapMax=function getHeapMax(){return 2147483648;};alignMemory=function alignMemory(size,alignment){return Math.ceil(size/alignment)*alignment;};growMemory=function growMemory(size){var b=wasmMemory.buffer;var pages=(size-b.byteLength+65535)/65536|0;try{wasmMemory.grow(pages);updateMemoryViews();return 1;}catch(e){}};_emscripten_resize_heap=function _emscripten_resize_heap(requestedSize){var oldSize=HEAPU8.length;requestedSize>>>=0;var maxHeapSize=getHeapMax();if(requestedSize>maxHeapSize){return false;}for(var cutDown=1;cutDown<=4;cutDown*=2){var overGrownHeapSize=oldSize*(1+0.2/cutDown);overGrownHeapSize=Math.min(overGrownHeapSize,requestedSize+100663296);var newSize=Math.min(maxHeapSize,alignMemory(Math.max(requestedSize,overGrownHeapSize),65536));var replacement=growMemory(newSize);if(replacement){return true;}}return false;};safeSetTimeout=function safeSetTimeout(func,timeout){return setTimeout(function(){callUserCallback(func);},timeout);};_emscripten_sleep=function _emscripten_sleep(ms){return Asyncify.handleSleep(function(wakeUp){return safeSetTimeout(wakeUp,ms);});};_emscripten_sleep.isAsync=true;ENV={};getExecutableName=function getExecutableName(){return thisProgram||"./this.program";};getEnvStrings=function getEnvStrings(){if(!getEnvStrings.strings){var lang=((typeof navigator==="undefined"?"undefined":_typeof(navigator))=="object"&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8";var env={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:lang,_:getExecutableName()};for(var x in ENV){if(ENV[x]===void 0)delete env[x];else env[x]=ENV[x];}var strings=[];for(var x in env){strings.push("".concat(x,"=").concat(env[x]));}getEnvStrings.strings=strings;}return getEnvStrings.strings;};_environ_get=function _environ_get(__environ,environ_buf){var bufSize=0;var envp=0;var _iterator62=_createForOfIteratorHelper(getEnvStrings()),_step62;try{for(_iterator62.s();!(_step62=_iterator62.n()).done;){var string=_step62.value;var ptr=environ_buf+bufSize;HEAPU32[__environ+envp>>2]=ptr;bufSize+=stringToUTF8(string,ptr,Infinity)+1;envp+=4;}}catch(err){_iterator62.e(err);}finally{_iterator62.f();}return 0;};_environ_sizes_get=function _environ_sizes_get(penviron_count,penviron_buf_size){var strings=getEnvStrings();HEAPU32[penviron_count>>2]=strings.length;var bufSize=0;var _iterator63=_createForOfIteratorHelper(strings),_step63;try{for(_iterator63.s();!(_step63=_iterator63.n()).done;){var string=_step63.value;bufSize+=lengthBytesUTF8(string)+1;}}catch(err){_iterator63.e(err);}finally{_iterator63.f();}HEAPU32[penviron_buf_size>>2]=bufSize;return 0;};doReadv=function doReadv(stream,iov,iovcnt,offset){var ret=0;for(var i=0;i<iovcnt;i++){var ptr=HEAPU32[iov>>2];var len=HEAPU32[iov+4>>2];iov+=8;var curr=FS.read(stream,HEAP8,ptr,len,offset);if(curr<0)return-1;ret+=curr;if(curr<len)break;if(typeof offset!="undefined"){offset+=curr;}}return ret;};doWritev=function doWritev(stream,iov,iovcnt,offset){var ret=0;for(var i=0;i<iovcnt;i++){var ptr=HEAPU32[iov>>2];var len=HEAPU32[iov+4>>2];iov+=8;var curr=FS.write(stream,HEAP8,ptr,len,offset);if(curr<0)return-1;ret+=curr;if(curr<len){break;}if(typeof offset!="undefined"){offset+=curr;}}return ret;};stackAlloc=function stackAlloc(sz){return __emscripten_stack_alloc(sz);};stringToUTF8OnStack=function stringToUTF8OnStack(str){var size=lengthBytesUTF8(str)+1;var ret=stackAlloc(size);stringToUTF8(str,ret,size);return ret;};FS.createPreloadedFile=FS_createPreloadedFile;FS.staticInit();MEMFS.doesNotExistError=new FS.ErrnoError(44);MEMFS.doesNotExistError.stack="<generic error, no stack>";embind_init_charCodes();if(Module["noExitRuntime"])noExitRuntime=Module["noExitRuntime"];if(Module["preloadPlugins"])preloadPlugins=Module["preloadPlugins"];if(Module["print"])out=Module["print"];if(Module["printErr"])err=Module["printErr"];if(Module["wasmBinary"])wasmBinary=Module["wasmBinary"];if(Module["arguments"])arguments_=Module["arguments"];if(Module["thisProgram"])thisProgram=Module["thisProgram"];ASM_CONSTS={1473352:function _(){console.error("progress callback is not set.");}};wasmImports={a:___cxa_throw,j:___syscall_fcntl64,G:___syscall_ioctl,H:___syscall_openat,r:___syscall_renameat,s:___syscall_rmdir,w:___syscall_stat64,t:___syscall_unlinkat,u:__abort_js,L:__embind_finalize_value_object,m:__embind_register_bigint,R:__embind_register_bool,P:__embind_register_emval,l:__embind_register_float,f:__embind_register_function,c:__embind_register_integer,b:__embind_register_memory_view,Q:__embind_register_std_string,g:__embind_register_std_wstring,O:__embind_register_value_object,M:__embind_register_value_object_field,S:__embind_register_void,N:__emval_as,d:__emval_call,q:__emval_decref,F:__emval_get_global,e:__emval_get_method_caller,o:__emval_incref,T:__emval_is_string,n:__emval_run_destructors,p:__emval_take_value,x:__gmtime_js,y:__localtime_js,z:__tzset_js,J:_clock_time_get,K:_emscripten_asm_const_int,I:_emscripten_date_now,v:_emscripten_resize_heap,k:_emscripten_sleep,C:_environ_get,D:_environ_sizes_get,h:_fd_close,B:_fd_fdstat_get,E:_fd_read,A:_fd_seek,i:_fd_write};_context18.next=223;return createWasm();case 223:wasmExports=_context18.sent;wasmExports["V"];___getTypeName=wasmExports["W"];_malloc=wasmExports["X"];_free=wasmExports["Y"];_main=Module["_main"]=wasmExports["Z"];__emscripten_stack_alloc=wasmExports["_"];Module["dynCall_ii"]=wasmExports["$"];Module["dynCall_vi"]=wasmExports["aa"];Module["dynCall_vii"]=wasmExports["ba"];Module["dynCall_iii"]=wasmExports["ca"];Module["dynCall_viii"]=wasmExports["da"];Module["dynCall_v"]=wasmExports["ea"];Module["dynCall_diiii"]=wasmExports["fa"];Module["dynCall_viif"]=wasmExports["ga"];Module["dynCall_iiiii"]=wasmExports["ha"];Module["dynCall_iiii"]=wasmExports["ia"];Module["dynCall_ddd"]=wasmExports["ja"];Module["dynCall_i"]=wasmExports["ka"];Module["dynCall_fii"]=wasmExports["la"];Module["dynCall_viiii"]=wasmExports["ma"];Module["dynCall_iiiiii"]=wasmExports["na"];Module["dynCall_idd"]=wasmExports["oa"];Module["dynCall_jiji"]=wasmExports["pa"];Module["dynCall_iidiiii"]=wasmExports["qa"];Module["dynCall_viijii"]=wasmExports["ra"];Module["dynCall_iiiiiiiii"]=wasmExports["sa"];Module["dynCall_iiiiiii"]=wasmExports["ta"];Module["dynCall_iiiiij"]=wasmExports["ua"];Module["dynCall_iiiiid"]=wasmExports["va"];Module["dynCall_iiiiijj"]=wasmExports["wa"];Module["dynCall_iiiiiiii"]=wasmExports["xa"];Module["dynCall_iiiiiijj"]=wasmExports["ya"];Module["dynCall_viiiiii"]=wasmExports["za"];Module["dynCall_viiiii"]=wasmExports["Aa"];_asyncify_start_unwind=wasmExports["Ba"];_asyncify_stop_unwind=wasmExports["Ca"];_asyncify_start_rewind=wasmExports["Da"];_asyncify_stop_rewind=wasmExports["Ea"];preInit();run();moduleRtn=readyPromise;return _context18.abrupt("return",moduleRtn);case 266:case"end":return _context18.stop();}}},_callee14);}));}();var __defProp$1=Object.defineProperty;var __defNormalProp$1=function __defNormalProp$1(obj,key,value){return key in obj?__defProp$1(obj,key,{enumerable:true,configurable:true,writable:true,value:value}):obj[key]=value;};var __publicField$1=function __publicField$1(obj,key,value){__defNormalProp$1(obj,_typeof(key)!=="symbol"?key+"":key,value);return value;};var cdnUrl="https://cdn.jsdelivr.net/npm/@creooxag/cxconverter@".concat(packageJSON.version,"/dist/");var defaultUrlPrefix="./";var _IfcWasmConverterLoader=/*#__PURE__*/function(){function _IfcWasmConverterLoader(){_classCallCheck(this,_IfcWasmConverterLoader);__publicField$1(this,"module");}_createClass(_IfcWasmConverterLoader,null,[{key:"getInstance",value:function(){var _getInstance=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee15(){var userUrlPrefix,urlPrefix,_Module,_args18=arguments;return _regeneratorRuntime().wrap(function _callee15$(_context19){while(1){switch(_context19.prev=_context19.next){case 0:userUrlPrefix=_args18.length>0&&_args18[0]!==undefined?_args18[0]:"remote";urlPrefix=defaultUrlPrefix;if(userUrlPrefix){urlPrefix=userUrlPrefix=="remote"?cdnUrl:userUrlPrefix;}if(_IfcWasmConverterLoader.instance){_context19.next=15;break;}_IfcWasmConverterLoader.instance=new _IfcWasmConverterLoader();_Module={locateFile:function locateFile(path){var fullPath=urlPrefix+path;if(path.endsWith(".wasm")){console.log("Loading wasm file from ".concat(fullPath));return fullPath;}return path;}};_context19.prev=6;_context19.next=9;return IfcDbWasm(_Module);case 9:_IfcWasmConverterLoader.instance.module=_context19.sent;_context19.next=15;break;case 12:_context19.prev=12;_context19.t0=_context19["catch"](6);console.error("Error on wasm import:",_context19.t0);case 15:return _context19.abrupt("return",_IfcWasmConverterLoader.instance);case 16:case"end":return _context19.stop();}}},_callee15,null,[[6,12]]);}));function getInstance(){return _getInstance.apply(this,arguments);}return getInstance;}()},{key:"getModule",value:function(){var _getModule=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee16(userUrlPrefix){return _regeneratorRuntime().wrap(function _callee16$(_context20){while(1){switch(_context20.prev=_context20.next){case 0:_context20.next=2;return _IfcWasmConverterLoader.getInstance(userUrlPrefix);case 2:return _context20.abrupt("return",_context20.sent.module);case 3:case"end":return _context20.stop();}}},_callee16);}));function getModule(_x128){return _getModule.apply(this,arguments);}return getModule;}()}]);return _IfcWasmConverterLoader;}();__publicField$1(_IfcWasmConverterLoader,"instance");var IfcWasmConverterLoader=_IfcWasmConverterLoader;function ifc2gltf(_x129){return _ifc2gltf.apply(this,arguments);}function _ifc2gltf(){_ifc2gltf=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee73(ifcData){var params,inputOptionsString,loadOptions,resolveCallbackGltf,resolveCallbackMetadata,url,module,promiseGltf,promiseMetadata,gltf,uint8Array,decoder,metaStr,metaData,_args76=arguments;return _regeneratorRuntime().wrap(function _callee73$(_context77){while(1){switch(_context77.prev=_context77.next){case 0:params=_args76.length>1&&_args76[1]!==undefined?_args76[1]:{remote:true};if(params.remote==void 0)params.remote=true;inputOptionsString=params.inputOptions?params.inputOptions:JSON.stringify(inputOptionsDefault);loadOptions={"maxFileSizeInMegaBytes":1e3};resolveCallbackGltf=void 0;resolveCallbackMetadata=void 0;url=params.remote?"remote":params.urlPath;_context77.next=9;return IfcWasmConverterLoader.getModule(url);case 9:module=_context77.sent;if(params.progressCallback)module.setProgressCallback(params.progressCallback);else module.setProgressCallback(function(progress){console.log("Progress: ".concat(progress));});if(params.progressTextCallback)module.setProgressTextCallback(params.progressTextCallback);else module.setProgressTextCallback(function(progressText){console.log("Progress text: ".concat(progressText));});module.setInputOptions(inputOptionsString);promiseGltf=new Promise(function(resolve){resolveCallbackGltf=resolve;});promiseMetadata=new Promise(function(resolve){resolveCallbackMetadata=resolve;});if(resolveCallbackGltf)module.setGltfCompleteCallback(resolveCallbackGltf);if(resolveCallbackMetadata)module.setMetaDataCompleteCallback(resolveCallbackMetadata);module.loadModel(ifcData,loadOptions);_context77.next=20;return Promise.all([promiseGltf,promiseMetadata]);case 20:_context77.next=22;return module.getGeometry();case 22:gltf=_context77.sent;_context77.next=25;return module.getMetaData();case 25:uint8Array=_context77.sent;decoder=new TextDecoder();metaStr=decoder.decode(uint8Array);_context77.next=30;return JSON.parse(metaStr);case 30:metaData=_context77.sent;return _context77.abrupt("return",{gltf:gltf,metaData:metaData});case 32:case"end":return _context77.stop();}}},_callee73);}));return _ifc2gltf.apply(this,arguments);}var inputOptionsDefault={"inputParameters":{"exportPropertySets":"yes","exportIfcPropertyTypes":"yes","exportIfcValueTypes":"yes","exportPolylines":"yes","excludeGeometryForIfcTypes":["IfcOpeningElement"],"excludeGUIDs":[""],"exportOnlyGUIDs":[""],"centerModelAtOrigin":"yes","ignoreProfileRadius":"yes","enableGltfCompression":"yes","enableGltfQuantization":"no","exportNormals":"no","numPointsPerCircle":18,"licenceKey":"",// JSON above is copied from default input config file. Changes applied here:
30595
+ 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);var name="@creooxag/cxconverter";var version="0.0.3-alpha";var description="";var exports$1={".":{types:"./dist/index.d.ts","import":"./dist/index.mjs",require:"./dist/index.cjs"}};var main="./dist/index.mjs";var module$1="./dist/index.mjs";var types="./dist/index.d.ts";var typesVersions={"*":{"*":["./dist/*","./dist/index.d.ts"]}};var files=["dist/"];var scripts={"clean-dist":"rm -rf ./dist","clean-cmake":"rm -rf ./cmake-build","build-wasm-release":"emcmake cmake -S . -B ../cmake-build -DCMAKE_BUILD_TYPE=Release && cmake --build ../cmake-build","publish-npm":"npm publish --access public",build:"unbuild",dev:"unbuild --stub",lint:"eslint .",start:"esno examples/node/nodeExport.ts","example-html":"http-server -c-1 -p8237 --cors"};var keywords=[];var devDependencies={"@types/node":"^22.10.2",esno:"^4.8.0","fast-glob":"^3.3.2",globals:"^15.8.0","http-server":"^14.1.1",prettier:"^3.3.3","prettier-eslint":"^16.3.0",typescript:"^5.7.2",unbuild:"^2.0.0","@eslint/eslintrc":"^3.2.0","@eslint/js":"^9.20.0","@typescript-eslint/eslint-plugin":"^8.24.0","@typescript-eslint/parser":"^8.24.0",eslint:"^9.20.1","eslint-config-prettier":"^10.0.1","eslint-plugin-import":"^2.31.0","eslint-plugin-prettier":"^5.2.3"};var packageJSON={name:name,version:version,description:description,exports:exports$1,main:main,module:module$1,types:types,typesVersions:typesVersions,files:files,scripts:scripts,keywords:keywords,devDependencies:devDependencies};var __defProp$2=Object.defineProperty;var __defNormalProp$2=function __defNormalProp$2(obj,key,value){return key in obj?__defProp$2(obj,key,{enumerable:true,configurable:true,writable:true,value:value}):obj[key]=value;};var __publicField$2=function __publicField$2(obj,key,value){__defNormalProp$2(obj,_typeof(key)!=="symbol"?key+"":key,value);return value;};var IfcDbWasm=/* @__PURE__ */function(){return/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee14(){var moduleArg,moduleRtn,Module,readyPromiseResolve,readyPromiseReject,readyPromise,arguments_,thisProgram,quit_,_scriptName,scriptDirectory,locateFile,readAsync,readBinary,out,err,wasmBinary,wasmMemory,ABORT,EXITSTATUS,HEAP8,HEAPU8,HEAP16,HEAPU16,HEAP32,HEAPU32,HEAPF32,HEAP64,HEAPU64,HEAPF64,updateMemoryViews,preRun,initRuntime,postRun,runDependencies,dependenciesFulfilled,addRunDependency,removeRunDependency,abort,wasmBinaryFile,findWasmBinary,getBinarySync,getWasmBinary,_getWasmBinary,instantiateArrayBuffer,_instantiateArrayBuffer,instantiateAsync,_instantiateAsync,getWasmImports,createWasm,_createWasm,ExitStatus,callRuntimeCallbacks,onPostRuns,addOnPostRun,onPreRuns,addOnPreRun,dynCallLegacy,dynCall,noExitRuntime,ExceptionInfo,exceptionLast,___cxa_throw,syscallGetVarargI,syscallGetVarargP,PATH,initRandomFill,_randomFill,PATH_FS,UTF8Decoder,UTF8ArrayToString,FS_stdin_getChar_buffer,lengthBytesUTF8,stringToUTF8Array,intArrayFromString,FS_stdin_getChar,TTY,mmapAlloc,MEMFS,asyncLoad,FS_createDataFile,preloadPlugins,FS_handledByPreloadPlugin,FS_createPreloadedFile,FS_modeStringToFlags,FS_getMode,FS,UTF8ToString,SYSCALLS,___syscall_fcntl64,___syscall_ioctl,___syscall_openat,___syscall_renameat,___syscall_rmdir,___syscall_stat64,___syscall_unlinkat,__abort_js,structRegistrations,runDestructors,readPointer,awaitingDependencies,registeredTypes,typeDependencies,InternalError,throwInternalError,whenDependentTypesAreResolved,__embind_finalize_value_object,embind_init_charCodes,embind_charCodes,readLatin1String,BindingError,throwBindingError,sharedRegisterType,registerType,integerReadValueFromPointer,__embind_register_bigint,GenericWireTypeSize,__embind_register_bool,emval_freelist,emval_handles,__emval_decref,Emval,EmValType,__embind_register_emval,floatReadValueFromPointer,__embind_register_float,createNamedFunction,usesDestructorStack,createJsInvoker,runAndAbortIfError,handleException,runtimeKeepaliveCounter,keepRuntimeAlive,_proc_exit,exitJS,_exit,maybeExit,callUserCallback,Asyncify,craftInvokerFunction,ensureOverloadTable,exposePublicSymbol,heap32VectorToArray,replacePublicSymbol,getDynCaller,embind__requireFunction,UnboundTypeError,getTypeName,throwUnboundTypeError,getFunctionName,__embind_register_function,__embind_register_integer,__embind_register_memory_view,stringToUTF8,__embind_register_std_string,UTF16Decoder,UTF16ToString,stringToUTF16,lengthBytesUTF16,UTF32ToString,stringToUTF32,lengthBytesUTF32,__embind_register_std_wstring,__embind_register_value_object,__embind_register_value_object_field,__embind_register_void,requireRegisteredType,emval_returnValue,__emval_as,emval_methodCallers,__emval_call,emval_symbols,getStringOrSymbol,emval_get_global,__emval_get_global,emval_addMethodCaller,emval_lookupTypes,__emval_get_method_caller,__emval_incref,__emval_is_string,__emval_run_destructors,__emval_take_value,INT53_MAX,INT53_MIN,bigintToI53Checked,__gmtime_js,isLeapYear,MONTH_DAYS_LEAP_CUMULATIVE,MONTH_DAYS_REGULAR_CUMULATIVE,ydayFromDate,__localtime_js,__tzset_js,_emscripten_get_now,_emscripten_date_now,checkWasiClock,_clock_time_get,readEmAsmArgsArray,readEmAsmArgs,runEmAsmFunction,_emscripten_asm_const_int,getHeapMax,alignMemory,growMemory,_emscripten_resize_heap,safeSetTimeout,_emscripten_sleep,ENV,getExecutableName,getEnvStrings,_environ_get,_environ_sizes_get,_fd_close,_fd_fdstat_get,doReadv,_fd_read,_fd_seek,doWritev,_fd_write,stackAlloc,stringToUTF8OnStack,ASM_CONSTS,wasmImports,wasmExports,___getTypeName,_malloc,_free,_main,__emscripten_stack_alloc,_asyncify_start_unwind,_asyncify_stop_unwind,_asyncify_start_rewind,_asyncify_stop_rewind,callMain,run,preInit,_args17=arguments;return _regeneratorRuntime().wrap(function _callee14$(_context18){while(1){switch(_context18.prev=_context18.next){case 0:preInit=function _preInit(){if(Module["preInit"]){if(typeof Module["preInit"]=="function")Module["preInit"]=[Module["preInit"]];while(Module["preInit"].length>0){Module["preInit"].shift()();}}};run=function _run(){var args=arguments.length>0&&arguments[0]!==undefined?arguments[0]:arguments_;if(runDependencies>0){dependenciesFulfilled=run;return;}preRun();if(runDependencies>0){dependenciesFulfilled=run;return;}function doRun(){var _Module$onRuntimeInit;Module["calledRun"]=true;if(ABORT)return;initRuntime();readyPromiseResolve(Module);(_Module$onRuntimeInit=Module["onRuntimeInitialized"])===null||_Module$onRuntimeInit===void 0?void 0:_Module$onRuntimeInit.call(Module);var noInitialRun=Module["noInitialRun"]||true;if(!noInitialRun)callMain(args);postRun();}if(Module["setStatus"]){Module["setStatus"]("Running...");setTimeout(function(){setTimeout(function(){return Module["setStatus"]("");},1);doRun();},1);}else{doRun();}};callMain=function _callMain(){var args=arguments.length>0&&arguments[0]!==undefined?arguments[0]:[];var entryFunction=_main;args.unshift(thisProgram);var argc=args.length;var argv=stackAlloc((argc+1)*4);var argv_ptr=argv;args.forEach(function(arg){HEAPU32[argv_ptr>>2]=stringToUTF8OnStack(arg);argv_ptr+=4;});HEAPU32[argv_ptr>>2]=0;try{var ret=entryFunction(argc,argv);exitJS(ret,true);return ret;}catch(e){return handleException(e);}};_fd_write=function _fd_write2(fd,iov,iovcnt,pnum){try{var stream=SYSCALLS.getStreamFromFD(fd);var num=doWritev(stream,iov,iovcnt);HEAPU32[pnum>>2]=num;return 0;}catch(e){if(typeof FS=="undefined"||!(e.name==="ErrnoError"))throw e;return e.errno;}};_fd_seek=function _fd_seek2(fd,offset,whence,newOffset){offset=bigintToI53Checked(offset);try{if(isNaN(offset))return 61;var stream=SYSCALLS.getStreamFromFD(fd);FS.llseek(stream,offset,whence);HEAP64[newOffset>>3]=BigInt(stream.position);if(stream.getdents&&offset===0&&whence===0)stream.getdents=null;return 0;}catch(e){if(typeof FS=="undefined"||!(e.name==="ErrnoError"))throw e;return e.errno;}};_fd_read=function _fd_read2(fd,iov,iovcnt,pnum){try{var stream=SYSCALLS.getStreamFromFD(fd);var num=doReadv(stream,iov,iovcnt);HEAPU32[pnum>>2]=num;return 0;}catch(e){if(typeof FS=="undefined"||!(e.name==="ErrnoError"))throw e;return e.errno;}};_fd_fdstat_get=function _fd_fdstat_get2(fd,pbuf){try{var rightsBase=0;var rightsInheriting=0;var flags=0;{var stream=SYSCALLS.getStreamFromFD(fd);var type=stream.tty?2:FS.isDir(stream.mode)?3:FS.isLink(stream.mode)?7:4;}HEAP8[pbuf]=type;HEAP16[pbuf+2>>1]=flags;HEAP64[pbuf+8>>3]=BigInt(rightsBase);HEAP64[pbuf+16>>3]=BigInt(rightsInheriting);return 0;}catch(e){if(typeof FS=="undefined"||!(e.name==="ErrnoError"))throw e;return e.errno;}};_fd_close=function _fd_close2(fd){try{var stream=SYSCALLS.getStreamFromFD(fd);FS.close(stream);return 0;}catch(e){if(typeof FS=="undefined"||!(e.name==="ErrnoError"))throw e;return e.errno;}};_clock_time_get=function _clock_time_get2(clk_id,ignored_precision,ptime){if(!checkWasiClock(clk_id)){return 28;}var now;if(clk_id===0){now=_emscripten_date_now();}else{now=_emscripten_get_now();}var nsec=Math.round(now*1e3*1e3);HEAP64[ptime>>3]=BigInt(nsec);return 0;};__localtime_js=function _localtime_js(time,tmPtr){time=bigintToI53Checked(time);var date=new Date(time*1e3);HEAP32[tmPtr>>2]=date.getSeconds();HEAP32[tmPtr+4>>2]=date.getMinutes();HEAP32[tmPtr+8>>2]=date.getHours();HEAP32[tmPtr+12>>2]=date.getDate();HEAP32[tmPtr+16>>2]=date.getMonth();HEAP32[tmPtr+20>>2]=date.getFullYear()-1900;HEAP32[tmPtr+24>>2]=date.getDay();var yday=ydayFromDate(date)|0;HEAP32[tmPtr+28>>2]=yday;HEAP32[tmPtr+36>>2]=-(date.getTimezoneOffset()*60);var start=new Date(date.getFullYear(),0,1);var summerOffset=new Date(date.getFullYear(),6,1).getTimezoneOffset();var winterOffset=start.getTimezoneOffset();var dst=(summerOffset!=winterOffset&&date.getTimezoneOffset()==Math.min(winterOffset,summerOffset))|0;HEAP32[tmPtr+32>>2]=dst;};__gmtime_js=function _gmtime_js(time,tmPtr){time=bigintToI53Checked(time);var date=new Date(time*1e3);HEAP32[tmPtr>>2]=date.getUTCSeconds();HEAP32[tmPtr+4>>2]=date.getUTCMinutes();HEAP32[tmPtr+8>>2]=date.getUTCHours();HEAP32[tmPtr+12>>2]=date.getUTCDate();HEAP32[tmPtr+16>>2]=date.getUTCMonth();HEAP32[tmPtr+20>>2]=date.getUTCFullYear()-1900;HEAP32[tmPtr+24>>2]=date.getUTCDay();var start=Date.UTC(date.getUTCFullYear(),0,1,0,0,0,0);var yday=(date.getTime()-start)/(1e3*60*60*24)|0;HEAP32[tmPtr+28>>2]=yday;};craftInvokerFunction=function _craftInvokerFunction(humanName,argTypes,classType,cppInvokerFunc,cppTargetFunc,isAsync){var argCount=argTypes.length;if(argCount<2){throwBindingError("argTypes array size mismatch! Must at least get return value and 'this' types!");}var isClassMethodFunc=argTypes[1]!==null&&classType!==null;var needsDestructorStack=usesDestructorStack(argTypes);var returns=argTypes[0].name!=="void";var closureArgs=[humanName,throwBindingError,cppInvokerFunc,cppTargetFunc,runDestructors,argTypes[0],argTypes[1]];for(var i=0;i<argCount-2;++i){closureArgs.push(argTypes[i+2]);}closureArgs.push(Asyncify);if(!needsDestructorStack){for(var i=isClassMethodFunc?1:2;i<argTypes.length;++i){if(argTypes[i].destructorFunction!==null){closureArgs.push(argTypes[i].destructorFunction);}}}var _createJsInvoker=createJsInvoker(argTypes,isClassMethodFunc,returns,isAsync),_createJsInvoker2=_slicedToArray(_createJsInvoker,2),args=_createJsInvoker2[0],invokerFnBody=_createJsInvoker2[1];var invokerFn=_construct(Function,_toConsumableArray(args).concat([invokerFnBody])).apply(void 0,closureArgs);return createNamedFunction(humanName,invokerFn);};createJsInvoker=function _createJsInvoker3(argTypes,isClassMethodFunc,returns,isAsync){var needsDestructorStack=usesDestructorStack(argTypes);var argCount=argTypes.length-2;var argsList=[];var argsListWired=["fn"];if(isClassMethodFunc){argsListWired.push("thisWired");}for(var i=0;i<argCount;++i){argsList.push("arg".concat(i));argsListWired.push("arg".concat(i,"Wired"));}argsList=argsList.join(",");argsListWired=argsListWired.join(",");var invokerFnBody="return function (".concat(argsList,") {\n");if(needsDestructorStack){invokerFnBody+="var destructors = [];\n";}var dtorStack=needsDestructorStack?"destructors":"null";var args1=["humanName","throwBindingError","invoker","fn","runDestructors","retType","classParam"];if(isClassMethodFunc){invokerFnBody+="var thisWired = classParam['toWireType'](".concat(dtorStack,", this);\n");}for(var i=0;i<argCount;++i){invokerFnBody+="var arg".concat(i,"Wired = argType").concat(i,"['toWireType'](").concat(dtorStack,", arg").concat(i,");\n");args1.push("argType".concat(i));}invokerFnBody+=(returns||isAsync?"var rv = ":"")+"invoker(".concat(argsListWired,");\n");var returnVal=returns?"rv":"";args1.push("Asyncify");invokerFnBody+="function onDone(".concat(returnVal,") {\n");if(needsDestructorStack){invokerFnBody+="runDestructors(destructors);\n";}else{for(var i=isClassMethodFunc?1:2;i<argTypes.length;++i){var paramName=i===1?"thisWired":"arg"+(i-2)+"Wired";if(argTypes[i].destructorFunction!==null){invokerFnBody+="".concat(paramName,"_dtor(").concat(paramName,");\n");args1.push("".concat(paramName,"_dtor"));}}}if(returns){invokerFnBody+="var ret = retType['fromWireType'](rv);\nreturn ret;\n";}invokerFnBody+="}\n";invokerFnBody+="return Asyncify.currData ? Asyncify.whenDone().then(onDone) : onDone(".concat(returnVal,");\n");invokerFnBody+="}\n";return[args1,invokerFnBody];};usesDestructorStack=function _usesDestructorStack(argTypes){for(var i=1;i<argTypes.length;++i){if(argTypes[i]!==null&&argTypes[i].destructorFunction===void 0){return true;}}return false;};registerType=function _registerType(rawType,registeredInstance){var options=arguments.length>2&&arguments[2]!==undefined?arguments[2]:{};return sharedRegisterType(rawType,registeredInstance,options);};sharedRegisterType=function _sharedRegisterType(rawType,registeredInstance){var options=arguments.length>2&&arguments[2]!==undefined?arguments[2]:{};var name=registeredInstance.name;if(!rawType){throwBindingError("type \"".concat(name,"\" must have a positive integer typeid pointer"));}if(registeredTypes.hasOwnProperty(rawType)){if(options.ignoreDuplicateRegistrations){return;}else{throwBindingError("Cannot register type '".concat(name,"' twice"));}}registeredTypes[rawType]=registeredInstance;delete typeDependencies[rawType];if(awaitingDependencies.hasOwnProperty(rawType)){var callbacks=awaitingDependencies[rawType];delete awaitingDependencies[rawType];callbacks.forEach(function(cb){return cb();});}};readPointer=function _readPointer(pointer){return this["fromWireType"](HEAPU32[pointer>>2]);};___syscall_unlinkat=function _syscall_unlinkat(dirfd,path,flags){try{path=SYSCALLS.getStr(path);path=SYSCALLS.calculateAt(dirfd,path);if(!flags){FS.unlink(path);}else if(flags===512){FS.rmdir(path);}else{return-28;}return 0;}catch(e){if(typeof FS=="undefined"||!(e.name==="ErrnoError"))throw e;return-e.errno;}};___syscall_stat64=function _syscall_stat(path,buf){try{path=SYSCALLS.getStr(path);return SYSCALLS.writeStat(buf,FS.stat(path));}catch(e){if(typeof FS=="undefined"||!(e.name==="ErrnoError"))throw e;return-e.errno;}};___syscall_rmdir=function _syscall_rmdir(path){try{path=SYSCALLS.getStr(path);FS.rmdir(path);return 0;}catch(e){if(typeof FS=="undefined"||!(e.name==="ErrnoError"))throw e;return-e.errno;}};___syscall_renameat=function _syscall_renameat(olddirfd,oldpath,newdirfd,newpath){try{oldpath=SYSCALLS.getStr(oldpath);newpath=SYSCALLS.getStr(newpath);oldpath=SYSCALLS.calculateAt(olddirfd,oldpath);newpath=SYSCALLS.calculateAt(newdirfd,newpath);FS.rename(oldpath,newpath);return 0;}catch(e){if(typeof FS=="undefined"||!(e.name==="ErrnoError"))throw e;return-e.errno;}};___syscall_openat=function _syscall_openat(dirfd,path,flags,varargs){SYSCALLS.varargs=varargs;try{path=SYSCALLS.getStr(path);path=SYSCALLS.calculateAt(dirfd,path);var mode=varargs?syscallGetVarargI():0;return FS.open(path,flags,mode).fd;}catch(e){if(typeof FS=="undefined"||!(e.name==="ErrnoError"))throw e;return-e.errno;}};___syscall_ioctl=function _syscall_ioctl(fd,op,varargs){SYSCALLS.varargs=varargs;try{var stream=SYSCALLS.getStreamFromFD(fd);switch(op){case 21509:{if(!stream.tty)return-59;return 0;}case 21505:{if(!stream.tty)return-59;if(stream.tty.ops.ioctl_tcgets){var termios=stream.tty.ops.ioctl_tcgets(stream);var argp=syscallGetVarargP();HEAP32[argp>>2]=termios.c_iflag||0;HEAP32[argp+4>>2]=termios.c_oflag||0;HEAP32[argp+8>>2]=termios.c_cflag||0;HEAP32[argp+12>>2]=termios.c_lflag||0;for(var i=0;i<32;i++){HEAP8[argp+i+17]=termios.c_cc[i]||0;}return 0;}return 0;}case 21510:case 21511:case 21512:{if(!stream.tty)return-59;return 0;}case 21506:case 21507:case 21508:{if(!stream.tty)return-59;if(stream.tty.ops.ioctl_tcsets){var argp=syscallGetVarargP();var c_iflag=HEAP32[argp>>2];var c_oflag=HEAP32[argp+4>>2];var c_cflag=HEAP32[argp+8>>2];var c_lflag=HEAP32[argp+12>>2];var c_cc=[];for(var i=0;i<32;i++){c_cc.push(HEAP8[argp+i+17]);}return stream.tty.ops.ioctl_tcsets(stream.tty,op,{c_iflag:c_iflag,c_oflag:c_oflag,c_cflag:c_cflag,c_lflag:c_lflag,c_cc:c_cc});}return 0;}case 21519:{if(!stream.tty)return-59;var argp=syscallGetVarargP();HEAP32[argp>>2]=0;return 0;}case 21520:{if(!stream.tty)return-59;return-28;}case 21531:{var argp=syscallGetVarargP();return FS.ioctl(stream,op,argp);}case 21523:{if(!stream.tty)return-59;if(stream.tty.ops.ioctl_tiocgwinsz){var winsize=stream.tty.ops.ioctl_tiocgwinsz(stream.tty);var argp=syscallGetVarargP();HEAP16[argp>>1]=winsize[0];HEAP16[argp+2>>1]=winsize[1];}return 0;}case 21524:{if(!stream.tty)return-59;return 0;}case 21515:{if(!stream.tty)return-59;return 0;}default:return-28;}}catch(e){if(typeof FS=="undefined"||!(e.name==="ErrnoError"))throw e;return-e.errno;}};___syscall_fcntl64=function _syscall_fcntl(fd,cmd,varargs){SYSCALLS.varargs=varargs;try{var stream=SYSCALLS.getStreamFromFD(fd);switch(cmd){case 0:{var arg=syscallGetVarargI();if(arg<0){return-28;}while(FS.streams[arg]){arg++;}var newStream;newStream=FS.dupStream(stream,arg);return newStream.fd;}case 1:case 2:return 0;case 3:return stream.flags;case 4:{var arg=syscallGetVarargI();stream.flags|=arg;return 0;}case 12:{var arg=syscallGetVarargP();var offset=0;HEAP16[arg+offset>>1]=2;return 0;}case 13:case 14:return 0;}return-28;}catch(e){if(typeof FS=="undefined"||!(e.name==="ErrnoError"))throw e;return-e.errno;}};_createWasm=function _createWasm3(){_createWasm=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee13(){var _wasmBinaryFile;var receiveInstance,receiveInstantiationResult,info,result,exports;return _regeneratorRuntime().wrap(function _callee13$(_context17){while(1){switch(_context17.prev=_context17.next){case 0:receiveInstantiationResult=function _receiveInstantiation(result2){return receiveInstance(result2["instance"]);};receiveInstance=function _receiveInstance(instance,module){wasmExports=instance.exports;wasmExports=Asyncify.instrumentWasmExports(wasmExports);wasmMemory=wasmExports["U"];updateMemoryViews();removeRunDependency();return wasmExports;};addRunDependency();info=getWasmImports();if(!Module["instantiateWasm"]){_context17.next=6;break;}return _context17.abrupt("return",new Promise(function(resolve,reject){Module["instantiateWasm"](info,function(mod,inst){resolve(receiveInstance(mod));});}));case 6:(_wasmBinaryFile=wasmBinaryFile)!==null&&_wasmBinaryFile!==void 0?_wasmBinaryFile:wasmBinaryFile=findWasmBinary();_context17.prev=7;_context17.next=10;return instantiateAsync(wasmBinary,wasmBinaryFile,info);case 10:result=_context17.sent;exports=receiveInstantiationResult(result);return _context17.abrupt("return",exports);case 15:_context17.prev=15;_context17.t0=_context17["catch"](7);readyPromiseReject(_context17.t0);return _context17.abrupt("return",Promise.reject(_context17.t0));case 19:case"end":return _context17.stop();}}},_callee13,null,[[7,15]]);}));return _createWasm.apply(this,arguments);};createWasm=function _createWasm2(){return _createWasm.apply(this,arguments);};getWasmImports=function _getWasmImports(){return{a:wasmImports};};_instantiateAsync=function _instantiateAsync3(){_instantiateAsync=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee12(binary,binaryFile,imports){var response,instantiationResult;return _regeneratorRuntime().wrap(function _callee12$(_context16){while(1){switch(_context16.prev=_context16.next){case 0:if(!(!binary&&typeof WebAssembly.instantiateStreaming=="function")){_context16.next=13;break;}_context16.prev=1;response=fetch(binaryFile,{credentials:"same-origin"});_context16.next=5;return WebAssembly.instantiateStreaming(response,imports);case 5:instantiationResult=_context16.sent;return _context16.abrupt("return",instantiationResult);case 9:_context16.prev=9;_context16.t0=_context16["catch"](1);err("wasm streaming compile failed: ".concat(_context16.t0));err("falling back to ArrayBuffer instantiation");case 13:return _context16.abrupt("return",instantiateArrayBuffer(binaryFile,imports));case 14:case"end":return _context16.stop();}}},_callee12,null,[[1,9]]);}));return _instantiateAsync.apply(this,arguments);};instantiateAsync=function _instantiateAsync2(_x124,_x125,_x126){return _instantiateAsync.apply(this,arguments);};_instantiateArrayBuffer=function _instantiateArrayBuff2(){_instantiateArrayBuffer=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee11(binaryFile,imports){var binary,instance;return _regeneratorRuntime().wrap(function _callee11$(_context15){while(1){switch(_context15.prev=_context15.next){case 0:_context15.prev=0;_context15.next=3;return getWasmBinary(binaryFile);case 3:binary=_context15.sent;_context15.next=6;return WebAssembly.instantiate(binary,imports);case 6:instance=_context15.sent;return _context15.abrupt("return",instance);case 10:_context15.prev=10;_context15.t0=_context15["catch"](0);err("failed to asynchronously prepare wasm: ".concat(_context15.t0));abort(_context15.t0);case 14:case"end":return _context15.stop();}}},_callee11,null,[[0,10]]);}));return _instantiateArrayBuffer.apply(this,arguments);};instantiateArrayBuffer=function _instantiateArrayBuff(_x122,_x123){return _instantiateArrayBuffer.apply(this,arguments);};_getWasmBinary=function _getWasmBinary3(){_getWasmBinary=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee10(binaryFile){var response;return _regeneratorRuntime().wrap(function _callee10$(_context14){while(1){switch(_context14.prev=_context14.next){case 0:if(wasmBinary){_context14.next=10;break;}_context14.prev=1;_context14.next=4;return readAsync(binaryFile);case 4:response=_context14.sent;return _context14.abrupt("return",new Uint8Array(response));case 8:_context14.prev=8;_context14.t0=_context14["catch"](1);case 10:return _context14.abrupt("return",getBinarySync(binaryFile));case 11:case"end":return _context14.stop();}}},_callee10,null,[[1,8]]);}));return _getWasmBinary.apply(this,arguments);};getWasmBinary=function _getWasmBinary2(_x121){return _getWasmBinary.apply(this,arguments);};getBinarySync=function _getBinarySync(file){if(file==wasmBinaryFile&&wasmBinary){return new Uint8Array(wasmBinary);}throw"both async and sync fetching of the wasm failed";};findWasmBinary=function _findWasmBinary(){if(Module["locateFile"]){return locateFile("ifcdb.wasm");}return new URL("ifcdb.wasm",import.meta.url).href;};abort=function _abort2(what){var _Module$onAbort;(_Module$onAbort=Module["onAbort"])===null||_Module$onAbort===void 0?void 0:_Module$onAbort.call(Module,what);what="Aborted("+what+")";err(what);ABORT=true;what+=". Build with -sASSERTIONS for more info.";var e=new WebAssembly.RuntimeError(what);readyPromiseReject(e);throw e;};removeRunDependency=function _removeRunDependency(id){var _Module$monitorRunDep2;runDependencies--;(_Module$monitorRunDep2=Module["monitorRunDependencies"])===null||_Module$monitorRunDep2===void 0?void 0:_Module$monitorRunDep2.call(Module,runDependencies);if(runDependencies==0){if(dependenciesFulfilled){var callback=dependenciesFulfilled;dependenciesFulfilled=null;callback();}}};addRunDependency=function _addRunDependency(id){var _Module$monitorRunDep;runDependencies++;(_Module$monitorRunDep=Module["monitorRunDependencies"])===null||_Module$monitorRunDep===void 0?void 0:_Module$monitorRunDep.call(Module,runDependencies);};postRun=function _postRun(){if(Module["postRun"]){if(typeof Module["postRun"]=="function")Module["postRun"]=[Module["postRun"]];while(Module["postRun"].length){addOnPostRun(Module["postRun"].shift());}}callRuntimeCallbacks(onPostRuns);};initRuntime=function _initRuntime(){if(!Module["noFSInit"]&&!FS.initialized)FS.init();wasmExports["V"]();FS.ignorePermissions=false;};preRun=function _preRun(){if(Module["preRun"]){if(typeof Module["preRun"]=="function")Module["preRun"]=[Module["preRun"]];while(Module["preRun"].length){addOnPreRun(Module["preRun"].shift());}}callRuntimeCallbacks(onPreRuns);};updateMemoryViews=function _updateMemoryViews(){var b=wasmMemory.buffer;HEAP8=new Int8Array(b);HEAP16=new Int16Array(b);HEAPU8=new Uint8Array(b);HEAPU16=new Uint16Array(b);HEAP32=new Int32Array(b);HEAPU32=new Uint32Array(b);HEAPF32=new Float32Array(b);HEAPF64=new Float64Array(b);HEAP64=new BigInt64Array(b);HEAPU64=new BigUint64Array(b);};locateFile=function _locateFile(path){if(Module["locateFile"]){return Module["locateFile"](path,scriptDirectory);}return scriptDirectory+path;};moduleArg=_args17.length>0&&_args17[0]!==undefined?_args17[0]:{};Module=moduleArg;readyPromise=new Promise(function(resolve,reject){readyPromiseResolve=resolve;readyPromiseReject=reject;});arguments_=[];thisProgram="./this.program";quit_=function quit_(status,toThrow){throw toThrow;};_scriptName=import.meta.url;scriptDirectory="";try{scriptDirectory=new URL(".",_scriptName).href;}catch(_unused2){}readAsync=/*#__PURE__*/function(){var _ref24=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee8(url){var response;return _regeneratorRuntime().wrap(function _callee8$(_context12){while(1){switch(_context12.prev=_context12.next){case 0:_context12.next=2;return fetch(url,{credentials:"same-origin"});case 2:response=_context12.sent;if(!response.ok){_context12.next=5;break;}return _context12.abrupt("return",response.arrayBuffer());case 5:throw new Error(response.status+" : "+response.url);case 6:case"end":return _context12.stop();}}},_callee8);}));return function readAsync(_x120){return _ref24.apply(this,arguments);};}();out=console.log.bind(console);err=console.error.bind(console);ABORT=false;runDependencies=0;dependenciesFulfilled=null;ExitStatus=/*#__PURE__*/_createClass(function ExitStatus(status){_classCallCheck(this,ExitStatus);__publicField$2(this,"name","ExitStatus");this.message="Program terminated with exit(".concat(status,")");this.status=status;});callRuntimeCallbacks=function callRuntimeCallbacks(callbacks){while(callbacks.length>0){callbacks.shift()(Module);}};onPostRuns=[];addOnPostRun=function addOnPostRun(cb){return onPostRuns.push(cb);};onPreRuns=[];addOnPreRun=function addOnPreRun(cb){return onPreRuns.push(cb);};dynCallLegacy=function dynCallLegacy(sig,ptr,args){sig=sig.replace(/p/g,"i");var f=Module["dynCall_"+sig];return f.apply(void 0,[ptr].concat(_toConsumableArray(args)));};dynCall=function dynCall(sig,ptr){var args=arguments.length>2&&arguments[2]!==undefined?arguments[2]:[];var promising=arguments.length>3&&arguments[3]!==undefined?arguments[3]:false;var rtn=dynCallLegacy(sig,ptr,args);function convert(rtn2){return rtn2;}return convert(rtn);};noExitRuntime=true;ExceptionInfo=/*#__PURE__*/function(){function ExceptionInfo(excPtr){_classCallCheck(this,ExceptionInfo);this.excPtr=excPtr;this.ptr=excPtr-24;}_createClass(ExceptionInfo,[{key:"set_type",value:function set_type(type){HEAPU32[this.ptr+4>>2]=type;}},{key:"get_type",value:function get_type(){return HEAPU32[this.ptr+4>>2];}},{key:"set_destructor",value:function set_destructor(destructor){HEAPU32[this.ptr+8>>2]=destructor;}},{key:"get_destructor",value:function get_destructor(){return HEAPU32[this.ptr+8>>2];}},{key:"set_caught",value:function set_caught(caught){caught=caught?1:0;HEAP8[this.ptr+12]=caught;}},{key:"get_caught",value:function get_caught(){return HEAP8[this.ptr+12]!=0;}},{key:"set_rethrown",value:function set_rethrown(rethrown){rethrown=rethrown?1:0;HEAP8[this.ptr+13]=rethrown;}},{key:"get_rethrown",value:function get_rethrown(){return HEAP8[this.ptr+13]!=0;}},{key:"init",value:function init(type,destructor){this.set_adjusted_ptr(0);this.set_type(type);this.set_destructor(destructor);}},{key:"set_adjusted_ptr",value:function set_adjusted_ptr(adjustedPtr){HEAPU32[this.ptr+16>>2]=adjustedPtr;}},{key:"get_adjusted_ptr",value:function get_adjusted_ptr(){return HEAPU32[this.ptr+16>>2];}}]);return ExceptionInfo;}();exceptionLast=0;___cxa_throw=function ___cxa_throw(ptr,type,destructor){var info=new ExceptionInfo(ptr);info.init(type,destructor);exceptionLast=ptr;throw exceptionLast;};syscallGetVarargI=function syscallGetVarargI(){var ret=HEAP32[+SYSCALLS.varargs>>2];SYSCALLS.varargs+=4;return ret;};syscallGetVarargP=syscallGetVarargI;PATH={isAbs:function isAbs(path){return path.charAt(0)==="/";},splitPath:function splitPath(filename){var splitPathRe=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/;return splitPathRe.exec(filename).slice(1);},normalizeArray:function normalizeArray(parts,allowAboveRoot){var up=0;for(var i=parts.length-1;i>=0;i--){var last=parts[i];if(last==="."){parts.splice(i,1);}else if(last===".."){parts.splice(i,1);up++;}else if(up){parts.splice(i,1);up--;}}if(allowAboveRoot){for(;up;up--){parts.unshift("..");}}return parts;},normalize:function normalize(path){var isAbsolute=PATH.isAbs(path),trailingSlash=path.slice(-1)==="/";path=PATH.normalizeArray(path.split("/").filter(function(p){return!!p;}),!isAbsolute).join("/");if(!path&&!isAbsolute){path=".";}if(path&&trailingSlash){path+="/";}return(isAbsolute?"/":"")+path;},dirname:function dirname(path){var result=PATH.splitPath(path),root=result[0],dir=result[1];if(!root&&!dir){return".";}if(dir){dir=dir.slice(0,-1);}return root+dir;},basename:function basename(path){return path&&path.match(/([^\/]+|\/)\/*$/)[1];},join:function join(){for(var _len59=arguments.length,paths=new Array(_len59),_key14=0;_key14<_len59;_key14++){paths[_key14]=arguments[_key14];}return PATH.normalize(paths.join("/"));},join2:function join2(l,r){return PATH.normalize(l+"/"+r);}};initRandomFill=function initRandomFill(){return function(view){return crypto.getRandomValues(view);};};_randomFill=function randomFill(view){(_randomFill=initRandomFill())(view);};PATH_FS={resolve:function resolve(){var resolvedPath="",resolvedAbsolute=false;for(var i=arguments.length-1;i>=-1&&!resolvedAbsolute;i--){var path=i>=0?i<0||arguments.length<=i?undefined:arguments[i]:FS.cwd();if(typeof path!="string"){throw new TypeError("Arguments to path.resolve must be strings");}else if(!path){return"";}resolvedPath=path+"/"+resolvedPath;resolvedAbsolute=PATH.isAbs(path);}resolvedPath=PATH.normalizeArray(resolvedPath.split("/").filter(function(p){return!!p;}),!resolvedAbsolute).join("/");return(resolvedAbsolute?"/":"")+resolvedPath||".";},relative:function relative(from,to){from=PATH_FS.resolve(from).slice(1);to=PATH_FS.resolve(to).slice(1);function trim(arr){var start=0;for(;start<arr.length;start++){if(arr[start]!=="")break;}var end=arr.length-1;for(;end>=0;end--){if(arr[end]!=="")break;}if(start>end)return[];return arr.slice(start,end-start+1);}var fromParts=trim(from.split("/"));var toParts=trim(to.split("/"));var length=Math.min(fromParts.length,toParts.length);var samePartsLength=length;for(var i=0;i<length;i++){if(fromParts[i]!==toParts[i]){samePartsLength=i;break;}}var outputParts=[];for(var i=samePartsLength;i<fromParts.length;i++){outputParts.push("..");}outputParts=outputParts.concat(toParts.slice(samePartsLength));return outputParts.join("/");}};UTF8Decoder=typeof TextDecoder!="undefined"?new TextDecoder():void 0;UTF8ArrayToString=function UTF8ArrayToString(heapOrArray){var idx=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0;var maxBytesToRead=arguments.length>2&&arguments[2]!==undefined?arguments[2]:NaN;var endIdx=idx+maxBytesToRead;var endPtr=idx;while(heapOrArray[endPtr]&&!(endPtr>=endIdx)){++endPtr;}if(endPtr-idx>16&&heapOrArray.buffer&&UTF8Decoder){return UTF8Decoder.decode(heapOrArray.subarray(idx,endPtr));}var str="";while(idx<endPtr){var u0=heapOrArray[idx++];if(!(u0&128)){str+=String.fromCharCode(u0);continue;}var u1=heapOrArray[idx++]&63;if((u0&224)==192){str+=String.fromCharCode((u0&31)<<6|u1);continue;}var u2=heapOrArray[idx++]&63;if((u0&240)==224){u0=(u0&15)<<12|u1<<6|u2;}else{u0=(u0&7)<<18|u1<<12|u2<<6|heapOrArray[idx++]&63;}if(u0<65536){str+=String.fromCharCode(u0);}else{var ch=u0-65536;str+=String.fromCharCode(55296|ch>>10,56320|ch&1023);}}return str;};FS_stdin_getChar_buffer=[];lengthBytesUTF8=function lengthBytesUTF8(str){var len=0;for(var i=0;i<str.length;++i){var c=str.charCodeAt(i);if(c<=127){len++;}else if(c<=2047){len+=2;}else if(c>=55296&&c<=57343){len+=4;++i;}else{len+=3;}}return len;};stringToUTF8Array=function stringToUTF8Array(str,heap,outIdx,maxBytesToWrite){if(!(maxBytesToWrite>0))return 0;var startIdx=outIdx;var endIdx=outIdx+maxBytesToWrite-1;for(var i=0;i<str.length;++i){var u=str.charCodeAt(i);if(u>=55296&&u<=57343){var u1=str.charCodeAt(++i);u=65536+((u&1023)<<10)|u1&1023;}if(u<=127){if(outIdx>=endIdx)break;heap[outIdx++]=u;}else if(u<=2047){if(outIdx+1>=endIdx)break;heap[outIdx++]=192|u>>6;heap[outIdx++]=128|u&63;}else if(u<=65535){if(outIdx+2>=endIdx)break;heap[outIdx++]=224|u>>12;heap[outIdx++]=128|u>>6&63;heap[outIdx++]=128|u&63;}else{if(outIdx+3>=endIdx)break;heap[outIdx++]=240|u>>18;heap[outIdx++]=128|u>>12&63;heap[outIdx++]=128|u>>6&63;heap[outIdx++]=128|u&63;}}heap[outIdx]=0;return outIdx-startIdx;};intArrayFromString=function intArrayFromString(stringy,dontAddNull,length){var len=length>0?length:lengthBytesUTF8(stringy)+1;var u8array=new Array(len);var numBytesWritten=stringToUTF8Array(stringy,u8array,0,u8array.length);if(dontAddNull)u8array.length=numBytesWritten;return u8array;};FS_stdin_getChar=function FS_stdin_getChar(){if(!FS_stdin_getChar_buffer.length){var result=null;if(typeof window!="undefined"&&typeof window.prompt=="function"){result=window.prompt("Input: ");if(result!==null){result+="\n";}}if(!result){return null;}FS_stdin_getChar_buffer=intArrayFromString(result,true);}return FS_stdin_getChar_buffer.shift();};TTY={ttys:[],init:function init(){},shutdown:function shutdown(){},register:function register(dev,ops){TTY.ttys[dev]={input:[],output:[],ops:ops};FS.registerDevice(dev,TTY.stream_ops);},stream_ops:{open:function open(stream){var tty=TTY.ttys[stream.node.rdev];if(!tty){throw new FS.ErrnoError(43);}stream.tty=tty;stream.seekable=false;},close:function close(stream){stream.tty.ops.fsync(stream.tty);},fsync:function fsync(stream){stream.tty.ops.fsync(stream.tty);},read:function read(stream,buffer,offset,length,pos){if(!stream.tty||!stream.tty.ops.get_char){throw new FS.ErrnoError(60);}var bytesRead=0;for(var i=0;i<length;i++){var result;try{result=stream.tty.ops.get_char(stream.tty);}catch(e){throw new FS.ErrnoError(29);}if(result===void 0&&bytesRead===0){throw new FS.ErrnoError(6);}if(result===null||result===void 0)break;bytesRead++;buffer[offset+i]=result;}if(bytesRead){stream.node.atime=Date.now();}return bytesRead;},write:function write(stream,buffer,offset,length,pos){if(!stream.tty||!stream.tty.ops.put_char){throw new FS.ErrnoError(60);}try{for(var i=0;i<length;i++){stream.tty.ops.put_char(stream.tty,buffer[offset+i]);}}catch(e){throw new FS.ErrnoError(29);}if(length){stream.node.mtime=stream.node.ctime=Date.now();}return i;}},default_tty_ops:{get_char:function get_char(tty){return FS_stdin_getChar();},put_char:function put_char(tty,val){if(val===null||val===10){out(UTF8ArrayToString(tty.output));tty.output=[];}else{if(val!=0)tty.output.push(val);}},fsync:function fsync(tty){var _tty$output;if(((_tty$output=tty.output)===null||_tty$output===void 0?void 0:_tty$output.length)>0){out(UTF8ArrayToString(tty.output));tty.output=[];}},ioctl_tcgets:function ioctl_tcgets(tty){return{c_iflag:25856,c_oflag:5,c_cflag:191,c_lflag:35387,c_cc:[3,28,127,21,4,0,1,0,17,19,26,0,18,15,23,22,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]};},ioctl_tcsets:function ioctl_tcsets(tty,optional_actions,data){return 0;},ioctl_tiocgwinsz:function ioctl_tiocgwinsz(tty){return[24,80];}},default_tty1_ops:{put_char:function put_char(tty,val){if(val===null||val===10){err(UTF8ArrayToString(tty.output));tty.output=[];}else{if(val!=0)tty.output.push(val);}},fsync:function fsync(tty){var _tty$output2;if(((_tty$output2=tty.output)===null||_tty$output2===void 0?void 0:_tty$output2.length)>0){err(UTF8ArrayToString(tty.output));tty.output=[];}}}};mmapAlloc=function mmapAlloc(size){abort();};MEMFS={ops_table:null,mount:function mount(_mount){return MEMFS.createNode(null,"/",16895,0);},createNode:function createNode(parent,name,mode,dev){if(FS.isBlkdev(mode)||FS.isFIFO(mode)){throw new FS.ErrnoError(63);}MEMFS.ops_table||(MEMFS.ops_table={dir:{node:{getattr:MEMFS.node_ops.getattr,setattr:MEMFS.node_ops.setattr,lookup:MEMFS.node_ops.lookup,mknod:MEMFS.node_ops.mknod,rename:MEMFS.node_ops.rename,unlink:MEMFS.node_ops.unlink,rmdir:MEMFS.node_ops.rmdir,readdir:MEMFS.node_ops.readdir,symlink:MEMFS.node_ops.symlink},stream:{llseek:MEMFS.stream_ops.llseek}},file:{node:{getattr:MEMFS.node_ops.getattr,setattr:MEMFS.node_ops.setattr},stream:{llseek:MEMFS.stream_ops.llseek,read:MEMFS.stream_ops.read,write:MEMFS.stream_ops.write,mmap:MEMFS.stream_ops.mmap,msync:MEMFS.stream_ops.msync}},link:{node:{getattr:MEMFS.node_ops.getattr,setattr:MEMFS.node_ops.setattr,readlink:MEMFS.node_ops.readlink},stream:{}},chrdev:{node:{getattr:MEMFS.node_ops.getattr,setattr:MEMFS.node_ops.setattr},stream:FS.chrdev_stream_ops}});var node=FS.createNode(parent,name,mode,dev);if(FS.isDir(node.mode)){node.node_ops=MEMFS.ops_table.dir.node;node.stream_ops=MEMFS.ops_table.dir.stream;node.contents={};}else if(FS.isFile(node.mode)){node.node_ops=MEMFS.ops_table.file.node;node.stream_ops=MEMFS.ops_table.file.stream;node.usedBytes=0;node.contents=null;}else if(FS.isLink(node.mode)){node.node_ops=MEMFS.ops_table.link.node;node.stream_ops=MEMFS.ops_table.link.stream;}else if(FS.isChrdev(node.mode)){node.node_ops=MEMFS.ops_table.chrdev.node;node.stream_ops=MEMFS.ops_table.chrdev.stream;}node.atime=node.mtime=node.ctime=Date.now();if(parent){parent.contents[name]=node;parent.atime=parent.mtime=parent.ctime=node.atime;}return node;},getFileDataAsTypedArray:function getFileDataAsTypedArray(node){if(!node.contents)return new Uint8Array(0);if(node.contents.subarray)return node.contents.subarray(0,node.usedBytes);return new Uint8Array(node.contents);},expandFileStorage:function expandFileStorage(node,newCapacity){var prevCapacity=node.contents?node.contents.length:0;if(prevCapacity>=newCapacity)return;var CAPACITY_DOUBLING_MAX=1024*1024;newCapacity=Math.max(newCapacity,prevCapacity*(prevCapacity<CAPACITY_DOUBLING_MAX?2:1.125)>>>0);if(prevCapacity!=0)newCapacity=Math.max(newCapacity,256);var oldContents=node.contents;node.contents=new Uint8Array(newCapacity);if(node.usedBytes>0)node.contents.set(oldContents.subarray(0,node.usedBytes),0);},resizeFileStorage:function resizeFileStorage(node,newSize){if(node.usedBytes==newSize)return;if(newSize==0){node.contents=null;node.usedBytes=0;}else{var oldContents=node.contents;node.contents=new Uint8Array(newSize);if(oldContents){node.contents.set(oldContents.subarray(0,Math.min(newSize,node.usedBytes)));}node.usedBytes=newSize;}},node_ops:{getattr:function getattr(node){var attr={};attr.dev=FS.isChrdev(node.mode)?node.id:1;attr.ino=node.id;attr.mode=node.mode;attr.nlink=1;attr.uid=0;attr.gid=0;attr.rdev=node.rdev;if(FS.isDir(node.mode)){attr.size=4096;}else if(FS.isFile(node.mode)){attr.size=node.usedBytes;}else if(FS.isLink(node.mode)){attr.size=node.link.length;}else{attr.size=0;}attr.atime=new Date(node.atime);attr.mtime=new Date(node.mtime);attr.ctime=new Date(node.ctime);attr.blksize=4096;attr.blocks=Math.ceil(attr.size/attr.blksize);return attr;},setattr:function setattr(node,attr){for(var _i389=0,_arr3=["mode","atime","mtime","ctime"];_i389<_arr3.length;_i389++){var key=_arr3[_i389];if(attr[key]!=null){node[key]=attr[key];}}if(attr.size!==void 0){MEMFS.resizeFileStorage(node,attr.size);}},lookup:function lookup(parent,name){throw MEMFS.doesNotExistError;},mknod:function mknod(parent,name,mode,dev){return MEMFS.createNode(parent,name,mode,dev);},rename:function rename(old_node,new_dir,new_name){var new_node;try{new_node=FS.lookupNode(new_dir,new_name);}catch(e){}if(new_node){if(FS.isDir(old_node.mode)){for(var i in new_node.contents){throw new FS.ErrnoError(55);}}FS.hashRemoveNode(new_node);}delete old_node.parent.contents[old_node.name];new_dir.contents[new_name]=old_node;old_node.name=new_name;new_dir.ctime=new_dir.mtime=old_node.parent.ctime=old_node.parent.mtime=Date.now();},unlink:function unlink(parent,name){delete parent.contents[name];parent.ctime=parent.mtime=Date.now();},rmdir:function rmdir(parent,name){var node=FS.lookupNode(parent,name);for(var i in node.contents){throw new FS.ErrnoError(55);}delete parent.contents[name];parent.ctime=parent.mtime=Date.now();},readdir:function readdir(node){return[".",".."].concat(_toConsumableArray(Object.keys(node.contents)));},symlink:function symlink(parent,newname,oldpath){var node=MEMFS.createNode(parent,newname,511|40960,0);node.link=oldpath;return node;},readlink:function readlink(node){if(!FS.isLink(node.mode)){throw new FS.ErrnoError(28);}return node.link;}},stream_ops:{read:function read(stream,buffer,offset,length,position){var contents=stream.node.contents;if(position>=stream.node.usedBytes)return 0;var size=Math.min(stream.node.usedBytes-position,length);if(size>8&&contents.subarray){buffer.set(contents.subarray(position,position+size),offset);}else{for(var i=0;i<size;i++){buffer[offset+i]=contents[position+i];}}return size;},write:function write(stream,buffer,offset,length,position,canOwn){if(buffer.buffer===HEAP8.buffer){canOwn=false;}if(!length)return 0;var node=stream.node;node.mtime=node.ctime=Date.now();if(buffer.subarray&&(!node.contents||node.contents.subarray)){if(canOwn){node.contents=buffer.subarray(offset,offset+length);node.usedBytes=length;return length;}else if(node.usedBytes===0&&position===0){node.contents=buffer.slice(offset,offset+length);node.usedBytes=length;return length;}else if(position+length<=node.usedBytes){node.contents.set(buffer.subarray(offset,offset+length),position);return length;}}MEMFS.expandFileStorage(node,position+length);if(node.contents.subarray&&buffer.subarray){node.contents.set(buffer.subarray(offset,offset+length),position);}else{for(var i=0;i<length;i++){node.contents[position+i]=buffer[offset+i];}}node.usedBytes=Math.max(node.usedBytes,position+length);return length;},llseek:function llseek(stream,offset,whence){var position=offset;if(whence===1){position+=stream.position;}else if(whence===2){if(FS.isFile(stream.node.mode)){position+=stream.node.usedBytes;}}if(position<0){throw new FS.ErrnoError(28);}return position;},mmap:function mmap(stream,length,position,prot,flags){if(!FS.isFile(stream.node.mode)){throw new FS.ErrnoError(43);}var ptr;var allocated;var contents=stream.node.contents;if(!(flags&2)&&contents&&contents.buffer===HEAP8.buffer){allocated=false;ptr=contents.byteOffset;}else{allocated=true;ptr=mmapAlloc();if(!ptr){throw new FS.ErrnoError(48);}if(contents){if(position>0||position+length<contents.length){if(contents.subarray){contents=contents.subarray(position,position+length);}else{contents=Array.prototype.slice.call(contents,position,position+length);}}HEAP8.set(contents,ptr);}}return{ptr:ptr,allocated:allocated};},msync:function msync(stream,buffer,offset,length,mmapFlags){MEMFS.stream_ops.write(stream,buffer,0,length,offset,false);return 0;}}};asyncLoad=/*#__PURE__*/function(){var _ref25=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee9(url){var arrayBuffer;return _regeneratorRuntime().wrap(function _callee9$(_context13){while(1){switch(_context13.prev=_context13.next){case 0:_context13.next=2;return readAsync(url);case 2:arrayBuffer=_context13.sent;return _context13.abrupt("return",new Uint8Array(arrayBuffer));case 4:case"end":return _context13.stop();}}},_callee9);}));return function asyncLoad(_x127){return _ref25.apply(this,arguments);};}();asyncLoad.isAsync=true;FS_createDataFile=function FS_createDataFile(){return FS.createDataFile.apply(FS,arguments);};preloadPlugins=[];FS_handledByPreloadPlugin=function FS_handledByPreloadPlugin(byteArray,fullname,finish,onerror){if(typeof Browser!="undefined")Browser.init();var handled=false;preloadPlugins.forEach(function(plugin){if(handled)return;if(plugin["canHandle"](fullname)){plugin["handle"](byteArray,fullname,finish,onerror);handled=true;}});return handled;};FS_createPreloadedFile=function FS_createPreloadedFile(parent,name,url,canRead,canWrite,onload,onerror,dontCreateFile,canOwn,preFinish){var fullname=name?PATH_FS.resolve(PATH.join2(parent,name)):parent;function processData(byteArray){function finish(byteArray2){preFinish===null||preFinish===void 0?void 0:preFinish();if(!dontCreateFile){FS_createDataFile(parent,name,byteArray2,canRead,canWrite,canOwn);}onload===null||onload===void 0?void 0:onload();removeRunDependency();}if(FS_handledByPreloadPlugin(byteArray,fullname,finish,function(){onerror===null||onerror===void 0?void 0:onerror();removeRunDependency();})){return;}finish(byteArray);}addRunDependency();if(typeof url=="string"){asyncLoad(url).then(processData,onerror);}else{processData(url);}};FS_modeStringToFlags=function FS_modeStringToFlags(str){var flagModes={r:0,"r+":2,w:512|64|1,"w+":512|64|2,a:1024|64|1,"a+":1024|64|2};var flags=flagModes[str];if(typeof flags=="undefined"){throw new Error("Unknown file open mode: ".concat(str));}return flags;};FS_getMode=function FS_getMode(canRead,canWrite){var mode=0;if(canRead)mode|=292|73;if(canWrite)mode|=146;return mode;};FS={root:null,mounts:[],devices:{},streams:[],nextInode:1,nameTable:null,currentPath:"/",initialized:false,ignorePermissions:true,filesystems:null,syncFSRequests:0,readFiles:{},ErrnoError:/*#__PURE__*/_createClass(function ErrnoError(errno){_classCallCheck(this,ErrnoError);__publicField$2(this,"name","ErrnoError");this.errno=errno;}),FSStream:/*#__PURE__*/function(){function FSStream(){_classCallCheck(this,FSStream);__publicField$2(this,"shared",{});}_createClass(FSStream,[{key:"object",get:function get(){return this.node;},set:function set(val){this.node=val;}},{key:"isRead",get:function get(){return(this.flags&2097155)!==1;}},{key:"isWrite",get:function get(){return(this.flags&2097155)!==0;}},{key:"isAppend",get:function get(){return this.flags&1024;}},{key:"flags",get:function get(){return this.shared.flags;},set:function set(val){this.shared.flags=val;}},{key:"position",get:function get(){return this.shared.position;},set:function set(val){this.shared.position=val;}}]);return FSStream;}(),FSNode:/*#__PURE__*/function(){function FSNode(parent,name,mode,rdev){_classCallCheck(this,FSNode);__publicField$2(this,"node_ops",{});__publicField$2(this,"stream_ops",{});__publicField$2(this,"readMode",292|73);__publicField$2(this,"writeMode",146);__publicField$2(this,"mounted",null);if(!parent){parent=this;}this.parent=parent;this.mount=parent.mount;this.id=FS.nextInode++;this.name=name;this.mode=mode;this.rdev=rdev;this.atime=this.mtime=this.ctime=Date.now();}_createClass(FSNode,[{key:"read",get:function get(){return(this.mode&this.readMode)===this.readMode;},set:function set(val){val?this.mode|=this.readMode:this.mode&=~this.readMode;}},{key:"write",get:function get(){return(this.mode&this.writeMode)===this.writeMode;},set:function set(val){val?this.mode|=this.writeMode:this.mode&=~this.writeMode;}},{key:"isFolder",get:function get(){return FS.isDir(this.mode);}},{key:"isDevice",get:function get(){return FS.isChrdev(this.mode);}}]);return FSNode;}(),lookupPath:function lookupPath(path){var _opts$follow_mount;var opts=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};if(!path){throw new FS.ErrnoError(44);}(_opts$follow_mount=opts.follow_mount)!==null&&_opts$follow_mount!==void 0?_opts$follow_mount:opts.follow_mount=true;if(!PATH.isAbs(path)){path=FS.cwd()+"/"+path;}linkloop:for(var nlinks=0;nlinks<40;nlinks++){var parts=path.split("/").filter(function(p){return!!p;});var current=FS.root;var current_path="/";for(var i=0;i<parts.length;i++){var islast=i===parts.length-1;if(islast&&opts.parent){break;}if(parts[i]==="."){continue;}if(parts[i]===".."){current_path=PATH.dirname(current_path);if(FS.isRoot(current)){path=current_path+"/"+parts.slice(i+1).join("/");continue linkloop;}else{current=current.parent;}continue;}current_path=PATH.join2(current_path,parts[i]);try{current=FS.lookupNode(current,parts[i]);}catch(e){if((e===null||e===void 0?void 0:e.errno)===44&&islast&&opts.noent_okay){return{path:current_path};}throw e;}if(FS.isMountpoint(current)&&(!islast||opts.follow_mount)){current=current.mounted.root;}if(FS.isLink(current.mode)&&(!islast||opts.follow)){if(!current.node_ops.readlink){throw new FS.ErrnoError(52);}var link=current.node_ops.readlink(current);if(!PATH.isAbs(link)){link=PATH.dirname(current_path)+"/"+link;}path=link+"/"+parts.slice(i+1).join("/");continue linkloop;}}return{path:current_path,node:current};}throw new FS.ErrnoError(32);},getPath:function getPath(node){var path;while(true){if(FS.isRoot(node)){var mount=node.mount.mountpoint;if(!path)return mount;return mount[mount.length-1]!=="/"?"".concat(mount,"/").concat(path):mount+path;}path=path?"".concat(node.name,"/").concat(path):node.name;node=node.parent;}},hashName:function hashName(parentid,name){var hash=0;for(var i=0;i<name.length;i++){hash=(hash<<5)-hash+name.charCodeAt(i)|0;}return(parentid+hash>>>0)%FS.nameTable.length;},hashAddNode:function hashAddNode(node){var hash=FS.hashName(node.parent.id,node.name);node.name_next=FS.nameTable[hash];FS.nameTable[hash]=node;},hashRemoveNode:function hashRemoveNode(node){var hash=FS.hashName(node.parent.id,node.name);if(FS.nameTable[hash]===node){FS.nameTable[hash]=node.name_next;}else{var current=FS.nameTable[hash];while(current){if(current.name_next===node){current.name_next=node.name_next;break;}current=current.name_next;}}},lookupNode:function lookupNode(parent,name){var errCode=FS.mayLookup(parent);if(errCode){throw new FS.ErrnoError(errCode);}var hash=FS.hashName(parent.id,name);for(var node=FS.nameTable[hash];node;node=node.name_next){var nodeName=node.name;if(node.parent.id===parent.id&&nodeName===name){return node;}}return FS.lookup(parent,name);},createNode:function createNode(parent,name,mode,rdev){var node=new FS.FSNode(parent,name,mode,rdev);FS.hashAddNode(node);return node;},destroyNode:function destroyNode(node){FS.hashRemoveNode(node);},isRoot:function isRoot(node){return node===node.parent;},isMountpoint:function isMountpoint(node){return!!node.mounted;},isFile:function isFile(mode){return(mode&61440)===32768;},isDir:function isDir(mode){return(mode&61440)===16384;},isLink:function isLink(mode){return(mode&61440)===40960;},isChrdev:function isChrdev(mode){return(mode&61440)===8192;},isBlkdev:function isBlkdev(mode){return(mode&61440)===24576;},isFIFO:function isFIFO(mode){return(mode&61440)===4096;},isSocket:function isSocket(mode){return(mode&49152)===49152;},flagsToPermissionString:function flagsToPermissionString(flag){var perms=["r","w","rw"][flag&3];if(flag&512){perms+="w";}return perms;},nodePermissions:function nodePermissions(node,perms){if(FS.ignorePermissions){return 0;}if(perms.includes("r")&&!(node.mode&292)){return 2;}else if(perms.includes("w")&&!(node.mode&146)){return 2;}else if(perms.includes("x")&&!(node.mode&73)){return 2;}return 0;},mayLookup:function mayLookup(dir){if(!FS.isDir(dir.mode))return 54;var errCode=FS.nodePermissions(dir,"x");if(errCode)return errCode;if(!dir.node_ops.lookup)return 2;return 0;},mayCreate:function mayCreate(dir,name){if(!FS.isDir(dir.mode)){return 54;}try{var node=FS.lookupNode(dir,name);return 20;}catch(e){}return FS.nodePermissions(dir,"wx");},mayDelete:function mayDelete(dir,name,isdir){var node;try{node=FS.lookupNode(dir,name);}catch(e){return e.errno;}var errCode=FS.nodePermissions(dir,"wx");if(errCode){return errCode;}if(isdir){if(!FS.isDir(node.mode)){return 54;}if(FS.isRoot(node)||FS.getPath(node)===FS.cwd()){return 10;}}else{if(FS.isDir(node.mode)){return 31;}}return 0;},mayOpen:function mayOpen(node,flags){if(!node){return 44;}if(FS.isLink(node.mode)){return 32;}else if(FS.isDir(node.mode)){if(FS.flagsToPermissionString(flags)!=="r"||flags&(512|64)){return 31;}}return FS.nodePermissions(node,FS.flagsToPermissionString(flags));},checkOpExists:function checkOpExists(op,err2){if(!op){throw new FS.ErrnoError(err2);}return op;},MAX_OPEN_FDS:4096,nextfd:function nextfd(){for(var fd=0;fd<=FS.MAX_OPEN_FDS;fd++){if(!FS.streams[fd]){return fd;}}throw new FS.ErrnoError(33);},getStreamChecked:function getStreamChecked(fd){var stream=FS.getStream(fd);if(!stream){throw new FS.ErrnoError(8);}return stream;},getStream:function getStream(fd){return FS.streams[fd];},createStream:function createStream(stream){var fd=arguments.length>1&&arguments[1]!==undefined?arguments[1]:-1;stream=Object.assign(new FS.FSStream(),stream);if(fd==-1){fd=FS.nextfd();}stream.fd=fd;FS.streams[fd]=stream;return stream;},closeStream:function closeStream(fd){FS.streams[fd]=null;},dupStream:function dupStream(origStream){var _stream$stream_ops,_stream$stream_ops$du;var fd=arguments.length>1&&arguments[1]!==undefined?arguments[1]:-1;var stream=FS.createStream(origStream,fd);(_stream$stream_ops=stream.stream_ops)===null||_stream$stream_ops===void 0?void 0:(_stream$stream_ops$du=_stream$stream_ops.dup)===null||_stream$stream_ops$du===void 0?void 0:_stream$stream_ops$du.call(_stream$stream_ops,stream);return stream;},doSetAttr:function doSetAttr(stream,node,attr){var _setattr;var setattr=stream===null||stream===void 0?void 0:stream.stream_ops.setattr;var arg=setattr?stream:node;(_setattr=setattr)!==null&&_setattr!==void 0?_setattr:setattr=node.node_ops.setattr;FS.checkOpExists(setattr,63);setattr(arg,attr);},chrdev_stream_ops:{open:function open(stream){var _stream$stream_ops$op,_stream$stream_ops2;var device=FS.getDevice(stream.node.rdev);stream.stream_ops=device.stream_ops;(_stream$stream_ops$op=(_stream$stream_ops2=stream.stream_ops).open)===null||_stream$stream_ops$op===void 0?void 0:_stream$stream_ops$op.call(_stream$stream_ops2,stream);},llseek:function llseek(){throw new FS.ErrnoError(70);}},major:function major(dev){return dev>>8;},minor:function minor(dev){return dev&255;},makedev:function makedev(ma,mi){return ma<<8|mi;},registerDevice:function registerDevice(dev,ops){FS.devices[dev]={stream_ops:ops};},getDevice:function getDevice(dev){return FS.devices[dev];},getMounts:function getMounts(mount){var mounts=[];var check=[mount];while(check.length){var m=check.pop();mounts.push(m);check.push.apply(check,_toConsumableArray(m.mounts));}return mounts;},syncfs:function syncfs(populate,callback){if(typeof populate=="function"){callback=populate;populate=false;}FS.syncFSRequests++;if(FS.syncFSRequests>1){err("warning: ".concat(FS.syncFSRequests," FS.syncfs operations in flight at once, probably just doing extra work"));}var mounts=FS.getMounts(FS.root.mount);var completed=0;function doCallback(errCode){FS.syncFSRequests--;return callback(errCode);}function done(errCode){if(errCode){if(!done.errored){done.errored=true;return doCallback(errCode);}return;}if(++completed>=mounts.length){doCallback(null);}}mounts.forEach(function(mount){if(!mount.type.syncfs){return done(null);}mount.type.syncfs(mount,populate,done);});},mount:function mount(type,opts,mountpoint){var root=mountpoint==="/";var pseudo=!mountpoint;var node;if(root&&FS.root){throw new FS.ErrnoError(10);}else if(!root&&!pseudo){var lookup=FS.lookupPath(mountpoint,{follow_mount:false});mountpoint=lookup.path;node=lookup.node;if(FS.isMountpoint(node)){throw new FS.ErrnoError(10);}if(!FS.isDir(node.mode)){throw new FS.ErrnoError(54);}}var mount={type:type,opts:opts,mountpoint:mountpoint,mounts:[]};var mountRoot=type.mount(mount);mountRoot.mount=mount;mount.root=mountRoot;if(root){FS.root=mountRoot;}else if(node){node.mounted=mount;if(node.mount){node.mount.mounts.push(mount);}}return mountRoot;},unmount:function unmount(mountpoint){var lookup=FS.lookupPath(mountpoint,{follow_mount:false});if(!FS.isMountpoint(lookup.node)){throw new FS.ErrnoError(28);}var node=lookup.node;var mount=node.mounted;var mounts=FS.getMounts(mount);Object.keys(FS.nameTable).forEach(function(hash){var current=FS.nameTable[hash];while(current){var next=current.name_next;if(mounts.includes(current.mount)){FS.destroyNode(current);}current=next;}});node.mounted=null;var idx=node.mount.mounts.indexOf(mount);node.mount.mounts.splice(idx,1);},lookup:function lookup(parent,name){return parent.node_ops.lookup(parent,name);},mknod:function mknod(path,mode,dev){var lookup=FS.lookupPath(path,{parent:true});var parent=lookup.node;var name=PATH.basename(path);if(!name){throw new FS.ErrnoError(28);}if(name==="."||name===".."){throw new FS.ErrnoError(20);}var errCode=FS.mayCreate(parent,name);if(errCode){throw new FS.ErrnoError(errCode);}if(!parent.node_ops.mknod){throw new FS.ErrnoError(63);}return parent.node_ops.mknod(parent,name,mode,dev);},statfs:function statfs(path){return FS.statfsNode(FS.lookupPath(path,{follow:true}).node);},statfsStream:function statfsStream(stream){return FS.statfsNode(stream.node);},statfsNode:function statfsNode(node){var rtn={bsize:4096,frsize:4096,blocks:1e6,bfree:5e5,bavail:5e5,files:FS.nextInode,ffree:FS.nextInode-1,fsid:42,flags:2,namelen:255};if(node.node_ops.statfs){Object.assign(rtn,node.node_ops.statfs(node.mount.opts.root));}return rtn;},create:function create(path){var mode=arguments.length>1&&arguments[1]!==undefined?arguments[1]:438;mode&=4095;mode|=32768;return FS.mknod(path,mode,0);},mkdir:function mkdir(path){var mode=arguments.length>1&&arguments[1]!==undefined?arguments[1]:511;mode&=511|512;mode|=16384;return FS.mknod(path,mode,0);},mkdirTree:function mkdirTree(path,mode){var dirs=path.split("/");var d="";var _iterator60=_createForOfIteratorHelper(dirs),_step60;try{for(_iterator60.s();!(_step60=_iterator60.n()).done;){var dir=_step60.value;if(!dir)continue;if(d||PATH.isAbs(path))d+="/";d+=dir;try{FS.mkdir(d,mode);}catch(e){if(e.errno!=20)throw e;}}}catch(err){_iterator60.e(err);}finally{_iterator60.f();}},mkdev:function mkdev(path,mode,dev){if(typeof dev=="undefined"){dev=mode;mode=438;}mode|=8192;return FS.mknod(path,mode,dev);},symlink:function symlink(oldpath,newpath){if(!PATH_FS.resolve(oldpath)){throw new FS.ErrnoError(44);}var lookup=FS.lookupPath(newpath,{parent:true});var parent=lookup.node;if(!parent){throw new FS.ErrnoError(44);}var newname=PATH.basename(newpath);var errCode=FS.mayCreate(parent,newname);if(errCode){throw new FS.ErrnoError(errCode);}if(!parent.node_ops.symlink){throw new FS.ErrnoError(63);}return parent.node_ops.symlink(parent,newname,oldpath);},rename:function rename(old_path,new_path){var old_dirname=PATH.dirname(old_path);var new_dirname=PATH.dirname(new_path);var old_name=PATH.basename(old_path);var new_name=PATH.basename(new_path);var lookup,old_dir,new_dir;lookup=FS.lookupPath(old_path,{parent:true});old_dir=lookup.node;lookup=FS.lookupPath(new_path,{parent:true});new_dir=lookup.node;if(!old_dir||!new_dir)throw new FS.ErrnoError(44);if(old_dir.mount!==new_dir.mount){throw new FS.ErrnoError(75);}var old_node=FS.lookupNode(old_dir,old_name);var relative=PATH_FS.relative(old_path,new_dirname);if(relative.charAt(0)!=="."){throw new FS.ErrnoError(28);}relative=PATH_FS.relative(new_path,old_dirname);if(relative.charAt(0)!=="."){throw new FS.ErrnoError(55);}var new_node;try{new_node=FS.lookupNode(new_dir,new_name);}catch(e){}if(old_node===new_node){return;}var isdir=FS.isDir(old_node.mode);var errCode=FS.mayDelete(old_dir,old_name,isdir);if(errCode){throw new FS.ErrnoError(errCode);}errCode=new_node?FS.mayDelete(new_dir,new_name,isdir):FS.mayCreate(new_dir,new_name);if(errCode){throw new FS.ErrnoError(errCode);}if(!old_dir.node_ops.rename){throw new FS.ErrnoError(63);}if(FS.isMountpoint(old_node)||new_node&&FS.isMountpoint(new_node)){throw new FS.ErrnoError(10);}if(new_dir!==old_dir){errCode=FS.nodePermissions(old_dir,"w");if(errCode){throw new FS.ErrnoError(errCode);}}FS.hashRemoveNode(old_node);try{old_dir.node_ops.rename(old_node,new_dir,new_name);old_node.parent=new_dir;}catch(e){throw e;}finally{FS.hashAddNode(old_node);}},rmdir:function rmdir(path){var lookup=FS.lookupPath(path,{parent:true});var parent=lookup.node;var name=PATH.basename(path);var node=FS.lookupNode(parent,name);var errCode=FS.mayDelete(parent,name,true);if(errCode){throw new FS.ErrnoError(errCode);}if(!parent.node_ops.rmdir){throw new FS.ErrnoError(63);}if(FS.isMountpoint(node)){throw new FS.ErrnoError(10);}parent.node_ops.rmdir(parent,name);FS.destroyNode(node);},readdir:function readdir(path){var lookup=FS.lookupPath(path,{follow:true});var node=lookup.node;var readdir=FS.checkOpExists(node.node_ops.readdir,54);return readdir(node);},unlink:function unlink(path){var lookup=FS.lookupPath(path,{parent:true});var parent=lookup.node;if(!parent){throw new FS.ErrnoError(44);}var name=PATH.basename(path);var node=FS.lookupNode(parent,name);var errCode=FS.mayDelete(parent,name,false);if(errCode){throw new FS.ErrnoError(errCode);}if(!parent.node_ops.unlink){throw new FS.ErrnoError(63);}if(FS.isMountpoint(node)){throw new FS.ErrnoError(10);}parent.node_ops.unlink(parent,name);FS.destroyNode(node);},readlink:function readlink(path){var lookup=FS.lookupPath(path);var link=lookup.node;if(!link){throw new FS.ErrnoError(44);}if(!link.node_ops.readlink){throw new FS.ErrnoError(28);}return link.node_ops.readlink(link);},stat:function stat(path,dontFollow){var lookup=FS.lookupPath(path,{follow:!dontFollow});var node=lookup.node;var getattr=FS.checkOpExists(node.node_ops.getattr,63);return getattr(node);},fstat:function fstat(fd){var _getattr;var stream=FS.getStreamChecked(fd);var node=stream.node;var getattr=stream.stream_ops.getattr;var arg=getattr?stream:node;(_getattr=getattr)!==null&&_getattr!==void 0?_getattr:getattr=node.node_ops.getattr;FS.checkOpExists(getattr,63);return getattr(arg);},lstat:function lstat(path){return FS.stat(path,true);},doChmod:function doChmod(stream,node,mode,dontFollow){FS.doSetAttr(stream,node,{mode:mode&4095|node.mode&~4095,ctime:Date.now(),dontFollow:dontFollow});},chmod:function chmod(path,mode,dontFollow){var node;if(typeof path=="string"){var lookup=FS.lookupPath(path,{follow:!dontFollow});node=lookup.node;}else{node=path;}FS.doChmod(null,node,mode,dontFollow);},lchmod:function lchmod(path,mode){FS.chmod(path,mode,true);},fchmod:function fchmod(fd,mode){var stream=FS.getStreamChecked(fd);FS.doChmod(stream,stream.node,mode,false);},doChown:function doChown(stream,node,dontFollow){FS.doSetAttr(stream,node,{timestamp:Date.now(),dontFollow:dontFollow});},chown:function chown(path,uid,gid,dontFollow){var node;if(typeof path=="string"){var lookup=FS.lookupPath(path,{follow:!dontFollow});node=lookup.node;}else{node=path;}FS.doChown(null,node,dontFollow);},lchown:function lchown(path,uid,gid){FS.chown(path,uid,gid,true);},fchown:function fchown(fd,uid,gid){var stream=FS.getStreamChecked(fd);FS.doChown(stream,stream.node,false);},doTruncate:function doTruncate(stream,node,len){if(FS.isDir(node.mode)){throw new FS.ErrnoError(31);}if(!FS.isFile(node.mode)){throw new FS.ErrnoError(28);}var errCode=FS.nodePermissions(node,"w");if(errCode){throw new FS.ErrnoError(errCode);}FS.doSetAttr(stream,node,{size:len,timestamp:Date.now()});},truncate:function truncate(path,len){if(len<0){throw new FS.ErrnoError(28);}var node;if(typeof path=="string"){var lookup=FS.lookupPath(path,{follow:true});node=lookup.node;}else{node=path;}FS.doTruncate(null,node,len);},ftruncate:function ftruncate(fd,len){var stream=FS.getStreamChecked(fd);if(len<0||(stream.flags&2097155)===0){throw new FS.ErrnoError(28);}FS.doTruncate(stream,stream.node,len);},utime:function utime(path,atime,mtime){var lookup=FS.lookupPath(path,{follow:true});var node=lookup.node;var setattr=FS.checkOpExists(node.node_ops.setattr,63);setattr(node,{atime:atime,mtime:mtime});},open:function open(path,flags){var mode=arguments.length>2&&arguments[2]!==undefined?arguments[2]:438;if(path===""){throw new FS.ErrnoError(44);}flags=typeof flags=="string"?FS_modeStringToFlags(flags):flags;if(flags&64){mode=mode&4095|32768;}else{mode=0;}var node;var isDirPath;if(_typeof(path)=="object"){node=path;}else{isDirPath=path.endsWith("/");var lookup=FS.lookupPath(path,{follow:!(flags&131072),noent_okay:true});node=lookup.node;path=lookup.path;}var created=false;if(flags&64){if(node){if(flags&128){throw new FS.ErrnoError(20);}}else if(isDirPath){throw new FS.ErrnoError(31);}else{node=FS.mknod(path,mode|511,0);created=true;}}if(!node){throw new FS.ErrnoError(44);}if(FS.isChrdev(node.mode)){flags&=~512;}if(flags&65536&&!FS.isDir(node.mode)){throw new FS.ErrnoError(54);}if(!created){var errCode=FS.mayOpen(node,flags);if(errCode){throw new FS.ErrnoError(errCode);}}if(flags&512&&!created){FS.truncate(node,0);}flags&=~(128|512|131072);var stream=FS.createStream({node:node,path:FS.getPath(node),flags:flags,seekable:true,position:0,stream_ops:node.stream_ops,ungotten:[],error:false});if(stream.stream_ops.open){stream.stream_ops.open(stream);}if(created){FS.chmod(node,mode&511);}if(Module["logReadFiles"]&&!(flags&1)){if(!(path in FS.readFiles)){FS.readFiles[path]=1;}}return stream;},close:function close(stream){if(FS.isClosed(stream)){throw new FS.ErrnoError(8);}if(stream.getdents)stream.getdents=null;try{if(stream.stream_ops.close){stream.stream_ops.close(stream);}}catch(e){throw e;}finally{FS.closeStream(stream.fd);}stream.fd=null;},isClosed:function isClosed(stream){return stream.fd===null;},llseek:function llseek(stream,offset,whence){if(FS.isClosed(stream)){throw new FS.ErrnoError(8);}if(!stream.seekable||!stream.stream_ops.llseek){throw new FS.ErrnoError(70);}if(whence!=0&&whence!=1&&whence!=2){throw new FS.ErrnoError(28);}stream.position=stream.stream_ops.llseek(stream,offset,whence);stream.ungotten=[];return stream.position;},read:function read(stream,buffer,offset,length,position){if(length<0||position<0){throw new FS.ErrnoError(28);}if(FS.isClosed(stream)){throw new FS.ErrnoError(8);}if((stream.flags&2097155)===1){throw new FS.ErrnoError(8);}if(FS.isDir(stream.node.mode)){throw new FS.ErrnoError(31);}if(!stream.stream_ops.read){throw new FS.ErrnoError(28);}var seeking=typeof position!="undefined";if(!seeking){position=stream.position;}else if(!stream.seekable){throw new FS.ErrnoError(70);}var bytesRead=stream.stream_ops.read(stream,buffer,offset,length,position);if(!seeking)stream.position+=bytesRead;return bytesRead;},write:function write(stream,buffer,offset,length,position,canOwn){if(length<0||position<0){throw new FS.ErrnoError(28);}if(FS.isClosed(stream)){throw new FS.ErrnoError(8);}if((stream.flags&2097155)===0){throw new FS.ErrnoError(8);}if(FS.isDir(stream.node.mode)){throw new FS.ErrnoError(31);}if(!stream.stream_ops.write){throw new FS.ErrnoError(28);}if(stream.seekable&&stream.flags&1024){FS.llseek(stream,0,2);}var seeking=typeof position!="undefined";if(!seeking){position=stream.position;}else if(!stream.seekable){throw new FS.ErrnoError(70);}var bytesWritten=stream.stream_ops.write(stream,buffer,offset,length,position,canOwn);if(!seeking)stream.position+=bytesWritten;return bytesWritten;},mmap:function mmap(stream,length,position,prot,flags){if((prot&2)!==0&&(flags&2)===0&&(stream.flags&2097155)!==2){throw new FS.ErrnoError(2);}if((stream.flags&2097155)===1){throw new FS.ErrnoError(2);}if(!stream.stream_ops.mmap){throw new FS.ErrnoError(43);}if(!length){throw new FS.ErrnoError(28);}return stream.stream_ops.mmap(stream,length,position,prot,flags);},msync:function msync(stream,buffer,offset,length,mmapFlags){if(!stream.stream_ops.msync){return 0;}return stream.stream_ops.msync(stream,buffer,offset,length,mmapFlags);},ioctl:function ioctl(stream,cmd,arg){if(!stream.stream_ops.ioctl){throw new FS.ErrnoError(59);}return stream.stream_ops.ioctl(stream,cmd,arg);},readFile:function readFile(path){var opts=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};opts.flags=opts.flags||0;opts.encoding=opts.encoding||"binary";if(opts.encoding!=="utf8"&&opts.encoding!=="binary"){throw new Error("Invalid encoding type \"".concat(opts.encoding,"\""));}var ret;var stream=FS.open(path,opts.flags);var stat=FS.stat(path);var length=stat.size;var buf=new Uint8Array(length);FS.read(stream,buf,0,length,0);if(opts.encoding==="utf8"){ret=UTF8ArrayToString(buf);}else if(opts.encoding==="binary"){ret=buf;}FS.close(stream);return ret;},writeFile:function writeFile(path,data){var opts=arguments.length>2&&arguments[2]!==undefined?arguments[2]:{};opts.flags=opts.flags||577;var stream=FS.open(path,opts.flags,opts.mode);if(typeof data=="string"){var buf=new Uint8Array(lengthBytesUTF8(data)+1);var actualNumBytes=stringToUTF8Array(data,buf,0,buf.length);FS.write(stream,buf,0,actualNumBytes,void 0,opts.canOwn);}else if(ArrayBuffer.isView(data)){FS.write(stream,data,0,data.byteLength,void 0,opts.canOwn);}else{throw new Error("Unsupported data type");}FS.close(stream);},cwd:function cwd(){return FS.currentPath;},chdir:function chdir(path){var lookup=FS.lookupPath(path,{follow:true});if(lookup.node===null){throw new FS.ErrnoError(44);}if(!FS.isDir(lookup.node.mode)){throw new FS.ErrnoError(54);}var errCode=FS.nodePermissions(lookup.node,"x");if(errCode){throw new FS.ErrnoError(errCode);}FS.currentPath=lookup.path;},createDefaultDirectories:function createDefaultDirectories(){FS.mkdir("/tmp");FS.mkdir("/home");FS.mkdir("/home/web_user");},createDefaultDevices:function createDefaultDevices(){FS.mkdir("/dev");FS.registerDevice(FS.makedev(1,3),{read:function read(){return 0;},write:function write(stream,buffer,offset,length,pos){return length;},llseek:function llseek(){return 0;}});FS.mkdev("/dev/null",FS.makedev(1,3));TTY.register(FS.makedev(5,0),TTY.default_tty_ops);TTY.register(FS.makedev(6,0),TTY.default_tty1_ops);FS.mkdev("/dev/tty",FS.makedev(5,0));FS.mkdev("/dev/tty1",FS.makedev(6,0));var randomBuffer=new Uint8Array(1024),randomLeft=0;var randomByte=function randomByte(){if(randomLeft===0){_randomFill(randomBuffer);randomLeft=randomBuffer.byteLength;}return randomBuffer[--randomLeft];};FS.createDevice("/dev","random",randomByte);FS.createDevice("/dev","urandom",randomByte);FS.mkdir("/dev/shm");FS.mkdir("/dev/shm/tmp");},createSpecialDirectories:function createSpecialDirectories(){FS.mkdir("/proc");var proc_self=FS.mkdir("/proc/self");FS.mkdir("/proc/self/fd");FS.mount({mount:function mount(){var node=FS.createNode(proc_self,"fd",16895,73);node.stream_ops={llseek:MEMFS.stream_ops.llseek};node.node_ops={lookup:function lookup(parent,name){var fd=+name;var stream=FS.getStreamChecked(fd);var ret={parent:null,mount:{mountpoint:"fake"},node_ops:{readlink:function readlink(){return stream.path;}},id:fd+1};ret.parent=ret;return ret;},readdir:function readdir(){return Array.from(FS.streams.entries()).filter(function(_ref26){var _ref27=_slicedToArray(_ref26,2),k=_ref27[0],v=_ref27[1];return v;}).map(function(_ref28){var _ref29=_slicedToArray(_ref28,2),k=_ref29[0],v=_ref29[1];return k.toString();});}};return node;}},{},"/proc/self/fd");},createStandardStreams:function createStandardStreams(input,output,error){if(input){FS.createDevice("/dev","stdin",input);}else{FS.symlink("/dev/tty","/dev/stdin");}if(output){FS.createDevice("/dev","stdout",null,output);}else{FS.symlink("/dev/tty","/dev/stdout");}if(error){FS.createDevice("/dev","stderr",null,error);}else{FS.symlink("/dev/tty1","/dev/stderr");}FS.open("/dev/stdin",0);FS.open("/dev/stdout",1);FS.open("/dev/stderr",1);},staticInit:function staticInit(){FS.nameTable=new Array(4096);FS.mount(MEMFS,{},"/");FS.createDefaultDirectories();FS.createDefaultDevices();FS.createSpecialDirectories();FS.filesystems={MEMFS:MEMFS};},init:function init(input,output,error){var _input,_output,_error2;FS.initialized=true;(_input=input)!==null&&_input!==void 0?_input:input=Module["stdin"];(_output=output)!==null&&_output!==void 0?_output:output=Module["stdout"];(_error2=error)!==null&&_error2!==void 0?_error2:error=Module["stderr"];FS.createStandardStreams(input,output,error);},quit:function quit(){FS.initialized=false;var _iterator61=_createForOfIteratorHelper(FS.streams),_step61;try{for(_iterator61.s();!(_step61=_iterator61.n()).done;){var stream=_step61.value;if(stream){FS.close(stream);}}}catch(err){_iterator61.e(err);}finally{_iterator61.f();}},findObject:function findObject(path,dontResolveLastLink){var ret=FS.analyzePath(path,dontResolveLastLink);if(!ret.exists){return null;}return ret.object;},analyzePath:function analyzePath(path,dontResolveLastLink){try{var lookup=FS.lookupPath(path,{follow:!dontResolveLastLink});path=lookup.path;}catch(e){}var ret={isRoot:false,exists:false,error:0,name:null,path:null,object:null,parentExists:false,parentPath:null,parentObject:null};try{var lookup=FS.lookupPath(path,{parent:true});ret.parentExists=true;ret.parentPath=lookup.path;ret.parentObject=lookup.node;ret.name=PATH.basename(path);lookup=FS.lookupPath(path,{follow:!dontResolveLastLink});ret.exists=true;ret.path=lookup.path;ret.object=lookup.node;ret.name=lookup.node.name;ret.isRoot=lookup.path==="/";}catch(e){ret.error=e.errno;}return ret;},createPath:function createPath(parent,path,canRead,canWrite){parent=typeof parent=="string"?parent:FS.getPath(parent);var parts=path.split("/").reverse();while(parts.length){var part=parts.pop();if(!part)continue;var current=PATH.join2(parent,part);try{FS.mkdir(current);}catch(e){if(e.errno!=20)throw e;}parent=current;}return current;},createFile:function createFile(parent,name,properties,canRead,canWrite){var path=PATH.join2(typeof parent=="string"?parent:FS.getPath(parent),name);var mode=FS_getMode(canRead,canWrite);return FS.create(path,mode);},createDataFile:function createDataFile(parent,name,data,canRead,canWrite,canOwn){var path=name;if(parent){parent=typeof parent=="string"?parent:FS.getPath(parent);path=name?PATH.join2(parent,name):parent;}var mode=FS_getMode(canRead,canWrite);var node=FS.create(path,mode);if(data){if(typeof data=="string"){var arr=new Array(data.length);for(var i=0,len=data.length;i<len;++i){arr[i]=data.charCodeAt(i);}data=arr;}FS.chmod(node,mode|146);var stream=FS.open(node,577);FS.write(stream,data,0,data.length,0,canOwn);FS.close(stream);FS.chmod(node,mode);}},createDevice:function createDevice(parent,name,input,output){var _a$major;var _a;var path=PATH.join2(typeof parent=="string"?parent:FS.getPath(parent),name);var mode=FS_getMode(!!input,!!output);(_a$major=(_a=FS.createDevice).major)!==null&&_a$major!==void 0?_a$major:_a.major=64;var dev=FS.makedev(FS.createDevice.major++,0);FS.registerDevice(dev,{open:function open(stream){stream.seekable=false;},close:function close(stream){var _output$buffer;if(output!==null&&output!==void 0&&(_output$buffer=output.buffer)!==null&&_output$buffer!==void 0&&_output$buffer.length){output(10);}},read:function read(stream,buffer,offset,length,pos){var bytesRead=0;for(var i=0;i<length;i++){var result;try{result=input();}catch(e){throw new FS.ErrnoError(29);}if(result===void 0&&bytesRead===0){throw new FS.ErrnoError(6);}if(result===null||result===void 0)break;bytesRead++;buffer[offset+i]=result;}if(bytesRead){stream.node.atime=Date.now();}return bytesRead;},write:function write(stream,buffer,offset,length,pos){for(var i=0;i<length;i++){try{output(buffer[offset+i]);}catch(e){throw new FS.ErrnoError(29);}}if(length){stream.node.mtime=stream.node.ctime=Date.now();}return i;}});return FS.mkdev(path,mode,dev);},forceLoadFile:function forceLoadFile(obj){if(obj.isDevice||obj.isFolder||obj.link||obj.contents)return true;if(typeof XMLHttpRequest!="undefined"){throw new Error("Lazy loading should have been performed (contents set) in createLazyFile, but it was not. Lazy loading only works in web workers. Use --embed-file or --preload-file in emcc on the main thread.");}else{try{obj.contents=readBinary(obj.url);obj.usedBytes=obj.contents.length;}catch(e){throw new FS.ErrnoError(29);}}},createLazyFile:function createLazyFile(parent,name,url,canRead,canWrite){var LazyUint8Array=/*#__PURE__*/function(){function LazyUint8Array(){_classCallCheck(this,LazyUint8Array);__publicField$2(this,"lengthKnown",false);__publicField$2(this,"chunks",[]);}_createClass(LazyUint8Array,[{key:"get",value:function get(idx){if(idx>this.length-1||idx<0){return void 0;}var chunkOffset=idx%this.chunkSize;var chunkNum=idx/this.chunkSize|0;return this.getter(chunkNum)[chunkOffset];}},{key:"setDataGetter",value:function setDataGetter(getter){this.getter=getter;}},{key:"cacheLength",value:function cacheLength(){var xhr=new XMLHttpRequest();xhr.open("HEAD",url,false);xhr.send(null);if(!(xhr.status>=200&&xhr.status<300||xhr.status===304))throw new Error("Couldn't load "+url+". Status: "+xhr.status);var datalength=Number(xhr.getResponseHeader("Content-length"));var header;var hasByteServing=(header=xhr.getResponseHeader("Accept-Ranges"))&&header==="bytes";var usesGzip=(header=xhr.getResponseHeader("Content-Encoding"))&&header==="gzip";var chunkSize=1024*1024;if(!hasByteServing)chunkSize=datalength;var doXHR=function doXHR(from,to){if(from>to)throw new Error("invalid range ("+from+", "+to+") or no bytes requested!");if(to>datalength-1)throw new Error("only "+datalength+" bytes available! programmer error!");var xhr2=new XMLHttpRequest();xhr2.open("GET",url,false);if(datalength!==chunkSize)xhr2.setRequestHeader("Range","bytes="+from+"-"+to);xhr2.responseType="arraybuffer";if(xhr2.overrideMimeType){xhr2.overrideMimeType("text/plain; charset=x-user-defined");}xhr2.send(null);if(!(xhr2.status>=200&&xhr2.status<300||xhr2.status===304))throw new Error("Couldn't load "+url+". Status: "+xhr2.status);if(xhr2.response!==void 0){return new Uint8Array(xhr2.response||[]);}return intArrayFromString(xhr2.responseText||"",true);};var lazyArray2=this;lazyArray2.setDataGetter(function(chunkNum){var start=chunkNum*chunkSize;var end=(chunkNum+1)*chunkSize-1;end=Math.min(end,datalength-1);if(typeof lazyArray2.chunks[chunkNum]=="undefined"){lazyArray2.chunks[chunkNum]=doXHR(start,end);}if(typeof lazyArray2.chunks[chunkNum]=="undefined")throw new Error("doXHR failed!");return lazyArray2.chunks[chunkNum];});if(usesGzip||!datalength){chunkSize=datalength=1;datalength=this.getter(0).length;chunkSize=datalength;out("LazyFiles on gzip forces download of the whole file when length is accessed");}this._length=datalength;this._chunkSize=chunkSize;this.lengthKnown=true;}},{key:"length",get:function get(){if(!this.lengthKnown){this.cacheLength();}return this._length;}},{key:"chunkSize",get:function get(){if(!this.lengthKnown){this.cacheLength();}return this._chunkSize;}}]);return LazyUint8Array;}();if(typeof XMLHttpRequest!="undefined"){throw"Cannot do synchronous binary XHRs outside webworkers in modern browsers. Use --embed-file or --preload-file in emcc";var lazyArray=new LazyUint8Array();var properties={isDevice:false,contents:lazyArray};}else{var properties={isDevice:false,url:url};}var node=FS.createFile(parent,name,properties,canRead,canWrite);if(properties.contents){node.contents=properties.contents;}else if(properties.url){node.contents=null;node.url=properties.url;}Object.defineProperties(node,{usedBytes:{get:function get(){return this.contents.length;}}});var stream_ops={};var keys=Object.keys(node.stream_ops);keys.forEach(function(key){var fn=node.stream_ops[key];stream_ops[key]=function(){FS.forceLoadFile(node);return fn.apply(void 0,arguments);};});function writeChunks(stream,buffer,offset,length,position){var contents=stream.node.contents;if(position>=contents.length)return 0;var size=Math.min(contents.length-position,length);if(contents.slice){for(var i=0;i<size;i++){buffer[offset+i]=contents[position+i];}}else{for(var i=0;i<size;i++){buffer[offset+i]=contents.get(position+i);}}return size;}stream_ops.read=function(stream,buffer,offset,length,position){FS.forceLoadFile(node);return writeChunks(stream,buffer,offset,length,position);};stream_ops.mmap=function(stream,length,position,prot,flags){FS.forceLoadFile(node);var ptr=mmapAlloc();if(!ptr){throw new FS.ErrnoError(48);}writeChunks(stream,HEAP8,ptr,length,position);return{ptr:ptr,allocated:true};};node.stream_ops=stream_ops;return node;}};UTF8ToString=function UTF8ToString(ptr,maxBytesToRead){return ptr?UTF8ArrayToString(HEAPU8,ptr,maxBytesToRead):"";};SYSCALLS={DEFAULT_POLLMASK:5,calculateAt:function calculateAt(dirfd,path,allowEmpty){if(PATH.isAbs(path)){return path;}var dir;if(dirfd===-100){dir=FS.cwd();}else{var dirstream=SYSCALLS.getStreamFromFD(dirfd);dir=dirstream.path;}if(path.length==0){if(!allowEmpty){throw new FS.ErrnoError(44);}return dir;}return dir+"/"+path;},writeStat:function writeStat(buf,stat){HEAP32[buf>>2]=stat.dev;HEAP32[buf+4>>2]=stat.mode;HEAPU32[buf+8>>2]=stat.nlink;HEAP32[buf+12>>2]=stat.uid;HEAP32[buf+16>>2]=stat.gid;HEAP32[buf+20>>2]=stat.rdev;HEAP64[buf+24>>3]=BigInt(stat.size);HEAP32[buf+32>>2]=4096;HEAP32[buf+36>>2]=stat.blocks;var atime=stat.atime.getTime();var mtime=stat.mtime.getTime();var ctime=stat.ctime.getTime();HEAP64[buf+40>>3]=BigInt(Math.floor(atime/1e3));HEAPU32[buf+48>>2]=atime%1e3*1e3*1e3;HEAP64[buf+56>>3]=BigInt(Math.floor(mtime/1e3));HEAPU32[buf+64>>2]=mtime%1e3*1e3*1e3;HEAP64[buf+72>>3]=BigInt(Math.floor(ctime/1e3));HEAPU32[buf+80>>2]=ctime%1e3*1e3*1e3;HEAP64[buf+88>>3]=BigInt(stat.ino);return 0;},writeStatFs:function writeStatFs(buf,stats){HEAP32[buf+4>>2]=stats.bsize;HEAP32[buf+40>>2]=stats.bsize;HEAP32[buf+8>>2]=stats.blocks;HEAP32[buf+12>>2]=stats.bfree;HEAP32[buf+16>>2]=stats.bavail;HEAP32[buf+20>>2]=stats.files;HEAP32[buf+24>>2]=stats.ffree;HEAP32[buf+28>>2]=stats.fsid;HEAP32[buf+44>>2]=stats.flags;HEAP32[buf+36>>2]=stats.namelen;},doMsync:function doMsync(addr,stream,len,flags,offset){if(!FS.isFile(stream.node.mode)){throw new FS.ErrnoError(43);}if(flags&2){return 0;}var buffer=HEAPU8.slice(addr,addr+len);FS.msync(stream,buffer,offset,len,flags);},getStreamFromFD:function getStreamFromFD(fd){var stream=FS.getStreamChecked(fd);return stream;},varargs:void 0,getStr:function getStr(ptr){var ret=UTF8ToString(ptr);return ret;}};__abort_js=function __abort_js(){return abort("");};structRegistrations={};runDestructors=function runDestructors(destructors){while(destructors.length){var ptr=destructors.pop();var del=destructors.pop();del(ptr);}};awaitingDependencies={};registeredTypes={};typeDependencies={};InternalError=/*#__PURE__*/function(_Error2){_inherits(InternalError,_Error2);var _super100=_createSuper(InternalError);function InternalError(message){var _this202;_classCallCheck(this,InternalError);_this202=_super100.call(this,message);_this202.name="InternalError";return _this202;}return _createClass(InternalError);}(/*#__PURE__*/_wrapNativeSuper(Error));throwInternalError=function throwInternalError(message){throw new InternalError(message);};whenDependentTypesAreResolved=function whenDependentTypesAreResolved(myTypes,dependentTypes,getTypeConverters){myTypes.forEach(function(type){return typeDependencies[type]=dependentTypes;});function onComplete(typeConverters2){var myTypeConverters=getTypeConverters(typeConverters2);if(myTypeConverters.length!==myTypes.length){throwInternalError("Mismatched type converter count");}for(var i=0;i<myTypes.length;++i){registerType(myTypes[i],myTypeConverters[i]);}}var typeConverters=new Array(dependentTypes.length);var unregisteredTypes=[];var registered=0;dependentTypes.forEach(function(dt,i){if(registeredTypes.hasOwnProperty(dt)){typeConverters[i]=registeredTypes[dt];}else{unregisteredTypes.push(dt);if(!awaitingDependencies.hasOwnProperty(dt)){awaitingDependencies[dt]=[];}awaitingDependencies[dt].push(function(){typeConverters[i]=registeredTypes[dt];++registered;if(registered===unregisteredTypes.length){onComplete(typeConverters);}});}});if(0===unregisteredTypes.length){onComplete(typeConverters);}};__embind_finalize_value_object=function __embind_finalize_value_object(structType){var reg=structRegistrations[structType];delete structRegistrations[structType];var rawConstructor=reg.rawConstructor;var rawDestructor=reg.rawDestructor;var fieldRecords=reg.fields;var fieldTypes=fieldRecords.map(function(field){return field.getterReturnType;}).concat(fieldRecords.map(function(field){return field.setterArgumentType;}));whenDependentTypesAreResolved([structType],fieldTypes,function(fieldTypes2){var fields={};fieldRecords.forEach(function(field,i){var fieldName=field.fieldName;var getterReturnType=fieldTypes2[i];var optional=fieldTypes2[i].optional;var getter=field.getter;var getterContext=field.getterContext;var setterArgumentType=fieldTypes2[i+fieldRecords.length];var setter=field.setter;var setterContext=field.setterContext;fields[fieldName]={read:function read(ptr){return getterReturnType["fromWireType"](getter(getterContext,ptr));},write:function write(ptr,o){var destructors=[];setter(setterContext,ptr,setterArgumentType["toWireType"](destructors,o));runDestructors(destructors);},optional:optional};});return[{name:reg.name,fromWireType:function fromWireType(ptr){var rv={};for(var i in fields){rv[i]=fields[i].read(ptr);}rawDestructor(ptr);return rv;},toWireType:function toWireType(destructors,o){for(var fieldName in fields){if(!(fieldName in o)&&!fields[fieldName].optional){throw new TypeError("Missing field: \"".concat(fieldName,"\""));}}var ptr=rawConstructor();for(fieldName in fields){fields[fieldName].write(ptr,o[fieldName]);}if(destructors!==null){destructors.push(rawDestructor,ptr);}return ptr;},argPackAdvance:GenericWireTypeSize,readValueFromPointer:readPointer,destructorFunction:rawDestructor}];});};embind_init_charCodes=function embind_init_charCodes(){var codes=new Array(256);for(var i=0;i<256;++i){codes[i]=String.fromCharCode(i);}embind_charCodes=codes;};readLatin1String=function readLatin1String(ptr){var ret="";var c=ptr;while(HEAPU8[c]){ret+=embind_charCodes[HEAPU8[c++]];}return ret;};BindingError=/*#__PURE__*/function(_Error3){_inherits(BindingError,_Error3);var _super101=_createSuper(BindingError);function BindingError(message){var _this203;_classCallCheck(this,BindingError);_this203=_super101.call(this,message);_this203.name="BindingError";return _this203;}return _createClass(BindingError);}(/*#__PURE__*/_wrapNativeSuper(Error));throwBindingError=function throwBindingError(message){throw new BindingError(message);};integerReadValueFromPointer=function integerReadValueFromPointer(name,width,signed){switch(width){case 1:return signed?function(pointer){return HEAP8[pointer];}:function(pointer){return HEAPU8[pointer];};case 2:return signed?function(pointer){return HEAP16[pointer>>1];}:function(pointer){return HEAPU16[pointer>>1];};case 4:return signed?function(pointer){return HEAP32[pointer>>2];}:function(pointer){return HEAPU32[pointer>>2];};case 8:return signed?function(pointer){return HEAP64[pointer>>3];}:function(pointer){return HEAPU64[pointer>>3];};default:throw new TypeError("invalid integer width (".concat(width,"): ").concat(name));}};__embind_register_bigint=function __embind_register_bigint(primitiveType,name,size,minRange,maxRange){name=readLatin1String(name);var isUnsignedType=minRange===0n;var fromWireType=function fromWireType(value){return value;};if(isUnsignedType){var bitSize=size*8;fromWireType=function fromWireType(value){return BigInt.asUintN(bitSize,value);};maxRange=fromWireType(maxRange);}registerType(primitiveType,{name:name,fromWireType:fromWireType,toWireType:function toWireType(destructors,value){if(typeof value=="number"){value=BigInt(value);}return value;},argPackAdvance:GenericWireTypeSize,readValueFromPointer:integerReadValueFromPointer(name,size,!isUnsignedType),destructorFunction:null});};GenericWireTypeSize=8;__embind_register_bool=function __embind_register_bool(rawType,name,trueValue,falseValue){name=readLatin1String(name);registerType(rawType,{name:name,fromWireType:function fromWireType(wt){return!!wt;},toWireType:function toWireType(destructors,o){return o?trueValue:falseValue;},argPackAdvance:GenericWireTypeSize,readValueFromPointer:function readValueFromPointer(pointer){return this["fromWireType"](HEAPU8[pointer]);},destructorFunction:null});};emval_freelist=[];emval_handles=[0,1,,1,null,1,true,1,false,1];__emval_decref=function __emval_decref(handle){if(handle>9&&0===--emval_handles[handle+1]){emval_handles[handle]=void 0;emval_freelist.push(handle);}};Emval={toValue:function toValue(handle){if(!handle){throwBindingError("Cannot use deleted val. handle = ".concat(handle));}return emval_handles[handle];},toHandle:function toHandle(value){switch(value){case void 0:return 2;case null:return 4;case true:return 6;case false:return 8;default:{var handle=emval_freelist.pop()||emval_handles.length;emval_handles[handle]=value;emval_handles[handle+1]=1;return handle;}}}};EmValType={name:"emscripten::val",fromWireType:function fromWireType(handle){var rv=Emval.toValue(handle);__emval_decref(handle);return rv;},toWireType:function toWireType(destructors,value){return Emval.toHandle(value);},argPackAdvance:GenericWireTypeSize,readValueFromPointer:readPointer,destructorFunction:null};__embind_register_emval=function __embind_register_emval(rawType){return registerType(rawType,EmValType);};floatReadValueFromPointer=function floatReadValueFromPointer(name,width){switch(width){case 4:return function(pointer){return this["fromWireType"](HEAPF32[pointer>>2]);};case 8:return function(pointer){return this["fromWireType"](HEAPF64[pointer>>3]);};default:throw new TypeError("invalid float width (".concat(width,"): ").concat(name));}};__embind_register_float=function __embind_register_float(rawType,name,size){name=readLatin1String(name);registerType(rawType,{name:name,fromWireType:function fromWireType(value){return value;},toWireType:function toWireType(destructors,value){return value;},argPackAdvance:GenericWireTypeSize,readValueFromPointer:floatReadValueFromPointer(name,size),destructorFunction:null});};createNamedFunction=function createNamedFunction(name,func){return Object.defineProperty(func,"name",{value:name});};runAndAbortIfError=function runAndAbortIfError(func){try{return func();}catch(e){abort(e);}};handleException=function handleException(e){if(e instanceof ExitStatus||e=="unwind"){return EXITSTATUS;}quit_(1,e);};runtimeKeepaliveCounter=0;keepRuntimeAlive=function keepRuntimeAlive(){return noExitRuntime||runtimeKeepaliveCounter>0;};_proc_exit=function _proc_exit(code){EXITSTATUS=code;if(!keepRuntimeAlive()){var _Module$onExit;(_Module$onExit=Module["onExit"])===null||_Module$onExit===void 0?void 0:_Module$onExit.call(Module,code);ABORT=true;}quit_(code,new ExitStatus(code));};exitJS=function exitJS(status,implicit){EXITSTATUS=status;_proc_exit(status);};_exit=exitJS;maybeExit=function maybeExit(){if(!keepRuntimeAlive()){try{_exit(EXITSTATUS);}catch(e){handleException(e);}}};callUserCallback=function callUserCallback(func){if(ABORT){return;}try{func();maybeExit();}catch(e){handleException(e);}};Asyncify={instrumentWasmImports:function instrumentWasmImports(imports){var importPattern=/^(invoke_.*|__asyncjs__.*)$/;for(var _i390=0,_Object$entries6=Object.entries(imports);_i390<_Object$entries6.length;_i390++){var _Object$entries6$_i=_slicedToArray(_Object$entries6[_i390],2),x=_Object$entries6$_i[0],original=_Object$entries6$_i[1];if(typeof original=="function"){original.isAsync||importPattern.test(x);}}},instrumentWasmExports:function instrumentWasmExports(exports){var ret={};var _loop14=function _loop14(){var _Object$entries7$_i=_slicedToArray(_Object$entries7[_i391],2),x=_Object$entries7$_i[0],original=_Object$entries7$_i[1];if(typeof original=="function"){ret[x]=function(){Asyncify.exportCallStack.push(x);try{return original.apply(void 0,arguments);}finally{if(!ABORT){Asyncify.exportCallStack.pop();Asyncify.maybeStopUnwind();}}};}else{ret[x]=original;}};for(var _i391=0,_Object$entries7=Object.entries(exports);_i391<_Object$entries7.length;_i391++){_loop14();}return ret;},State:{Normal:0,Unwinding:1,Rewinding:2,Disabled:3},state:0,StackSize:4096,currData:null,handleSleepReturnValue:0,exportCallStack:[],callStackNameToId:{},callStackIdToName:{},callStackId:0,asyncPromiseHandlers:null,sleepCallbacks:[],getCallStackId:function getCallStackId(funcName){var id=Asyncify.callStackNameToId[funcName];if(id===void 0){id=Asyncify.callStackId++;Asyncify.callStackNameToId[funcName]=id;Asyncify.callStackIdToName[id]=funcName;}return id;},maybeStopUnwind:function maybeStopUnwind(){if(Asyncify.currData&&Asyncify.state===Asyncify.State.Unwinding&&Asyncify.exportCallStack.length===0){Asyncify.state=Asyncify.State.Normal;runAndAbortIfError(_asyncify_stop_unwind);if(typeof Fibers!="undefined"){Fibers.trampoline();}}},whenDone:function whenDone(){return new Promise(function(resolve,reject){Asyncify.asyncPromiseHandlers={resolve:resolve,reject:reject};});},allocateData:function allocateData(){var ptr=_malloc(12+Asyncify.StackSize);Asyncify.setDataHeader(ptr,ptr+12,Asyncify.StackSize);Asyncify.setDataRewindFunc(ptr);return ptr;},setDataHeader:function setDataHeader(ptr,stack,stackSize){HEAPU32[ptr>>2]=stack;HEAPU32[ptr+4>>2]=stack+stackSize;},setDataRewindFunc:function setDataRewindFunc(ptr){var bottomOfCallStack=Asyncify.exportCallStack[0];var rewindId=Asyncify.getCallStackId(bottomOfCallStack);HEAP32[ptr+8>>2]=rewindId;},getDataRewindFuncName:function getDataRewindFuncName(ptr){var id=HEAP32[ptr+8>>2];var name=Asyncify.callStackIdToName[id];return name;},getDataRewindFunc:function getDataRewindFunc(name){var func=wasmExports[name];return func;},doRewind:function doRewind(ptr){var name=Asyncify.getDataRewindFuncName(ptr);var func=Asyncify.getDataRewindFunc(name);return func();},handleSleep:function handleSleep(startAsync){if(ABORT)return;if(Asyncify.state===Asyncify.State.Normal){var reachedCallback=false;var reachedAfterCallback=false;startAsync(function(){var handleSleepReturnValue=arguments.length>0&&arguments[0]!==undefined?arguments[0]:0;if(ABORT)return;Asyncify.handleSleepReturnValue=handleSleepReturnValue;reachedCallback=true;if(!reachedAfterCallback){return;}Asyncify.state=Asyncify.State.Rewinding;runAndAbortIfError(function(){return _asyncify_start_rewind(Asyncify.currData);});if(typeof MainLoop!="undefined"&&MainLoop.func){MainLoop.resume();}var asyncWasmReturnValue,isError=false;try{asyncWasmReturnValue=Asyncify.doRewind(Asyncify.currData);}catch(err2){asyncWasmReturnValue=err2;isError=true;}var handled=false;if(!Asyncify.currData){var asyncPromiseHandlers=Asyncify.asyncPromiseHandlers;if(asyncPromiseHandlers){Asyncify.asyncPromiseHandlers=null;(isError?asyncPromiseHandlers.reject:asyncPromiseHandlers.resolve)(asyncWasmReturnValue);handled=true;}}if(isError&&!handled){throw asyncWasmReturnValue;}});reachedAfterCallback=true;if(!reachedCallback){Asyncify.state=Asyncify.State.Unwinding;Asyncify.currData=Asyncify.allocateData();if(typeof MainLoop!="undefined"&&MainLoop.func){MainLoop.pause();}runAndAbortIfError(function(){return _asyncify_start_unwind(Asyncify.currData);});}}else if(Asyncify.state===Asyncify.State.Rewinding){Asyncify.state=Asyncify.State.Normal;runAndAbortIfError(_asyncify_stop_rewind);_free(Asyncify.currData);Asyncify.currData=null;Asyncify.sleepCallbacks.forEach(callUserCallback);}else{abort("invalid state: ".concat(Asyncify.state));}return Asyncify.handleSleepReturnValue;},handleAsync:function handleAsync(startAsync){return Asyncify.handleSleep(function(wakeUp){startAsync().then(wakeUp);});}};ensureOverloadTable=function ensureOverloadTable(proto,methodName,humanName){if(void 0===proto[methodName].overloadTable){var prevFunc=proto[methodName];proto[methodName]=function(){for(var _len60=arguments.length,args=new Array(_len60),_key15=0;_key15<_len60;_key15++){args[_key15]=arguments[_key15];}if(!proto[methodName].overloadTable.hasOwnProperty(args.length)){throwBindingError("Function '".concat(humanName,"' called with an invalid number of arguments (").concat(args.length,") - expects one of (").concat(proto[methodName].overloadTable,")!"));}return proto[methodName].overloadTable[args.length].apply(this,args);};proto[methodName].overloadTable=[];proto[methodName].overloadTable[prevFunc.argCount]=prevFunc;}};exposePublicSymbol=function exposePublicSymbol(name,value,numArguments){if(Module.hasOwnProperty(name)){if(void 0===numArguments||void 0!==Module[name].overloadTable&&void 0!==Module[name].overloadTable[numArguments]){throwBindingError("Cannot register public name '".concat(name,"' twice"));}ensureOverloadTable(Module,name,name);if(Module[name].overloadTable.hasOwnProperty(numArguments)){throwBindingError("Cannot register multiple overloads of a function with the same number of arguments (".concat(numArguments,")!"));}Module[name].overloadTable[numArguments]=value;}else{Module[name]=value;Module[name].argCount=numArguments;}};heap32VectorToArray=function heap32VectorToArray(count,firstElement){var array=[];for(var i=0;i<count;i++){array.push(HEAPU32[firstElement+i*4>>2]);}return array;};replacePublicSymbol=function replacePublicSymbol(name,value,numArguments){if(!Module.hasOwnProperty(name)){throwInternalError("Replacing nonexistent public symbol");}if(void 0!==Module[name].overloadTable&&void 0!==numArguments){Module[name].overloadTable[numArguments]=value;}else{Module[name]=value;Module[name].argCount=numArguments;}};getDynCaller=function getDynCaller(sig,ptr){var promising=arguments.length>2&&arguments[2]!==undefined?arguments[2]:false;return function(){for(var _len61=arguments.length,args=new Array(_len61),_key16=0;_key16<_len61;_key16++){args[_key16]=arguments[_key16];}return dynCall(sig,ptr,args,promising);};};embind__requireFunction=function embind__requireFunction(signature,rawFunction){var isAsync=arguments.length>2&&arguments[2]!==undefined?arguments[2]:false;signature=readLatin1String(signature);function makeDynCaller(){return getDynCaller(signature,rawFunction);}var fp=makeDynCaller();if(typeof fp!="function"){throwBindingError("unknown function pointer with signature ".concat(signature,": ").concat(rawFunction));}return fp;};UnboundTypeError=/*#__PURE__*/function(_Error4){_inherits(UnboundTypeError,_Error4);var _super102=_createSuper(UnboundTypeError);function UnboundTypeError(){_classCallCheck(this,UnboundTypeError);return _super102.apply(this,arguments);}return _createClass(UnboundTypeError);}(/*#__PURE__*/_wrapNativeSuper(Error));getTypeName=function getTypeName(type){var ptr=___getTypeName(type);var rv=readLatin1String(ptr);_free(ptr);return rv;};throwUnboundTypeError=function throwUnboundTypeError(message,types){var unboundTypes=[];var seen={};function visit(type){if(seen[type]){return;}if(registeredTypes[type]){return;}if(typeDependencies[type]){typeDependencies[type].forEach(visit);return;}unboundTypes.push(type);seen[type]=true;}types.forEach(visit);throw new UnboundTypeError("".concat(message,": ")+unboundTypes.map(getTypeName).join([", "]));};getFunctionName=function getFunctionName(signature){signature=signature.trim();var argsIndex=signature.indexOf("(");if(argsIndex===-1)return signature;return signature.slice(0,argsIndex);};__embind_register_function=function __embind_register_function(name,argCount,rawArgTypesAddr,signature,rawInvoker,fn,isAsync,isNonnullReturn){var argTypes=heap32VectorToArray(argCount,rawArgTypesAddr);name=readLatin1String(name);name=getFunctionName(name);rawInvoker=embind__requireFunction(signature,rawInvoker,isAsync);exposePublicSymbol(name,function(){throwUnboundTypeError("Cannot call ".concat(name," due to unbound types"),argTypes);},argCount-1);whenDependentTypesAreResolved([],argTypes,function(argTypes2){var invokerArgsArray=[argTypes2[0],null].concat(argTypes2.slice(1));replacePublicSymbol(name,craftInvokerFunction(name,invokerArgsArray,null,rawInvoker,fn,isAsync),argCount-1);return[];});};__embind_register_integer=function __embind_register_integer(primitiveType,name,size,minRange,maxRange){name=readLatin1String(name);var isUnsignedType=minRange===0;var fromWireType=function fromWireType(value){return value;};if(isUnsignedType){var bitshift=32-8*size;fromWireType=function fromWireType(value){return value<<bitshift>>>bitshift;};maxRange=fromWireType(maxRange);}registerType(primitiveType,{name:name,fromWireType:fromWireType,toWireType:function toWireType(destructors,value){return value;},argPackAdvance:GenericWireTypeSize,readValueFromPointer:integerReadValueFromPointer(name,size,minRange!==0),destructorFunction:null});};__embind_register_memory_view=function __embind_register_memory_view(rawType,dataTypeIndex,name){var typeMapping=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array,BigInt64Array,BigUint64Array];var TA=typeMapping[dataTypeIndex];function decodeMemoryView(handle){var size=HEAPU32[handle>>2];var data=HEAPU32[handle+4>>2];return new TA(HEAP8.buffer,data,size);}name=readLatin1String(name);registerType(rawType,{name:name,fromWireType:decodeMemoryView,argPackAdvance:GenericWireTypeSize,readValueFromPointer:decodeMemoryView},{ignoreDuplicateRegistrations:true});};stringToUTF8=function stringToUTF8(str,outPtr,maxBytesToWrite){return stringToUTF8Array(str,HEAPU8,outPtr,maxBytesToWrite);};__embind_register_std_string=function __embind_register_std_string(rawType,name){name=readLatin1String(name);registerType(rawType,{name:name,fromWireType:function fromWireType(value){var length=HEAPU32[value>>2];var payload=value+4;var str;var i;{var decodeStartPtr=payload;for(var i=0;i<=length;++i){var currentBytePtr=payload+i;if(i==length||HEAPU8[currentBytePtr]==0){var maxRead=currentBytePtr-decodeStartPtr;var stringSegment=UTF8ToString(decodeStartPtr,maxRead);if(str===void 0){str=stringSegment;}else{str+=String.fromCharCode(0);str+=stringSegment;}decodeStartPtr=currentBytePtr+1;}}}_free(value);return str;},toWireType:function toWireType(destructors,value){if(value instanceof ArrayBuffer){value=new Uint8Array(value);}var length;var valueIsOfTypeString=typeof value=="string";if(!(valueIsOfTypeString||ArrayBuffer.isView(value)&&value.BYTES_PER_ELEMENT==1)){throwBindingError("Cannot pass non-string to std::string");}if(valueIsOfTypeString){length=lengthBytesUTF8(value);}else{length=value.length;}var base=_malloc(4+length+1);var ptr=base+4;HEAPU32[base>>2]=length;if(valueIsOfTypeString){{stringToUTF8(value,ptr,length+1);}}else{HEAPU8.set(value,ptr);}if(destructors!==null){destructors.push(_free,base);}return base;},argPackAdvance:GenericWireTypeSize,readValueFromPointer:readPointer,destructorFunction:function destructorFunction(ptr){_free(ptr);}});};UTF16Decoder=typeof TextDecoder!="undefined"?new TextDecoder("utf-16le"):void 0;UTF16ToString=function UTF16ToString(ptr,maxBytesToRead){var idx=ptr>>1;var maxIdx=idx+maxBytesToRead/2;var endIdx=idx;while(!(endIdx>=maxIdx)&&HEAPU16[endIdx]){++endIdx;}if(endIdx-idx>16&&UTF16Decoder)return UTF16Decoder.decode(HEAPU16.subarray(idx,endIdx));var str="";for(var i=idx;!(i>=maxIdx);++i){var codeUnit=HEAPU16[i];if(codeUnit==0)break;str+=String.fromCharCode(codeUnit);}return str;};stringToUTF16=function stringToUTF16(str,outPtr,maxBytesToWrite){var _maxBytesToWrite;(_maxBytesToWrite=maxBytesToWrite)!==null&&_maxBytesToWrite!==void 0?_maxBytesToWrite:maxBytesToWrite=2147483647;if(maxBytesToWrite<2)return 0;maxBytesToWrite-=2;var startPtr=outPtr;var numCharsToWrite=maxBytesToWrite<str.length*2?maxBytesToWrite/2:str.length;for(var i=0;i<numCharsToWrite;++i){var codeUnit=str.charCodeAt(i);HEAP16[outPtr>>1]=codeUnit;outPtr+=2;}HEAP16[outPtr>>1]=0;return outPtr-startPtr;};lengthBytesUTF16=function lengthBytesUTF16(str){return str.length*2;};UTF32ToString=function UTF32ToString(ptr,maxBytesToRead){var i=0;var str="";while(!(i>=maxBytesToRead/4)){var utf32=HEAP32[ptr+i*4>>2];if(utf32==0)break;++i;if(utf32>=65536){var ch=utf32-65536;str+=String.fromCharCode(55296|ch>>10,56320|ch&1023);}else{str+=String.fromCharCode(utf32);}}return str;};stringToUTF32=function stringToUTF32(str,outPtr,maxBytesToWrite){var _maxBytesToWrite2;(_maxBytesToWrite2=maxBytesToWrite)!==null&&_maxBytesToWrite2!==void 0?_maxBytesToWrite2:maxBytesToWrite=2147483647;if(maxBytesToWrite<4)return 0;var startPtr=outPtr;var endPtr=startPtr+maxBytesToWrite-4;for(var i=0;i<str.length;++i){var codeUnit=str.charCodeAt(i);if(codeUnit>=55296&&codeUnit<=57343){var trailSurrogate=str.charCodeAt(++i);codeUnit=65536+((codeUnit&1023)<<10)|trailSurrogate&1023;}HEAP32[outPtr>>2]=codeUnit;outPtr+=4;if(outPtr+4>endPtr)break;}HEAP32[outPtr>>2]=0;return outPtr-startPtr;};lengthBytesUTF32=function lengthBytesUTF32(str){var len=0;for(var i=0;i<str.length;++i){var codeUnit=str.charCodeAt(i);if(codeUnit>=55296&&codeUnit<=57343)++i;len+=4;}return len;};__embind_register_std_wstring=function __embind_register_std_wstring(rawType,charSize,name){name=readLatin1String(name);var decodeString,encodeString,readCharAt,lengthBytesUTF;if(charSize===2){decodeString=UTF16ToString;encodeString=stringToUTF16;lengthBytesUTF=lengthBytesUTF16;readCharAt=function readCharAt(pointer){return HEAPU16[pointer>>1];};}else if(charSize===4){decodeString=UTF32ToString;encodeString=stringToUTF32;lengthBytesUTF=lengthBytesUTF32;readCharAt=function readCharAt(pointer){return HEAPU32[pointer>>2];};}registerType(rawType,{name:name,fromWireType:function fromWireType(value){var length=HEAPU32[value>>2];var str;var decodeStartPtr=value+4;for(var i=0;i<=length;++i){var currentBytePtr=value+4+i*charSize;if(i==length||readCharAt(currentBytePtr)==0){var maxReadBytes=currentBytePtr-decodeStartPtr;var stringSegment=decodeString(decodeStartPtr,maxReadBytes);if(str===void 0){str=stringSegment;}else{str+=String.fromCharCode(0);str+=stringSegment;}decodeStartPtr=currentBytePtr+charSize;}}_free(value);return str;},toWireType:function toWireType(destructors,value){if(!(typeof value=="string")){throwBindingError("Cannot pass non-string to C++ string type ".concat(name));}var length=lengthBytesUTF(value);var ptr=_malloc(4+length+charSize);HEAPU32[ptr>>2]=length/charSize;encodeString(value,ptr+4,length+charSize);if(destructors!==null){destructors.push(_free,ptr);}return ptr;},argPackAdvance:GenericWireTypeSize,readValueFromPointer:readPointer,destructorFunction:function destructorFunction(ptr){_free(ptr);}});};__embind_register_value_object=function __embind_register_value_object(rawType,name,constructorSignature,rawConstructor,destructorSignature,rawDestructor){structRegistrations[rawType]={name:readLatin1String(name),rawConstructor:embind__requireFunction(constructorSignature,rawConstructor),rawDestructor:embind__requireFunction(destructorSignature,rawDestructor),fields:[]};};__embind_register_value_object_field=function __embind_register_value_object_field(structType,fieldName,getterReturnType,getterSignature,getter,getterContext,setterArgumentType,setterSignature,setter,setterContext){structRegistrations[structType].fields.push({fieldName:readLatin1String(fieldName),getterReturnType:getterReturnType,getter:embind__requireFunction(getterSignature,getter),getterContext:getterContext,setterArgumentType:setterArgumentType,setter:embind__requireFunction(setterSignature,setter),setterContext:setterContext});};__embind_register_void=function __embind_register_void(rawType,name){name=readLatin1String(name);registerType(rawType,{isVoid:true,name:name,argPackAdvance:0,fromWireType:function fromWireType(){return void 0;},toWireType:function toWireType(destructors,o){return void 0;}});};requireRegisteredType=function requireRegisteredType(rawType,humanName){var impl=registeredTypes[rawType];if(void 0===impl){throwBindingError("".concat(humanName," has unknown type ").concat(getTypeName(rawType)));}return impl;};emval_returnValue=function emval_returnValue(returnType,destructorsRef,handle){var destructors=[];var result=returnType["toWireType"](destructors,handle);if(destructors.length){HEAPU32[destructorsRef>>2]=Emval.toHandle(destructors);}return result;};__emval_as=function __emval_as(handle,returnType,destructorsRef){handle=Emval.toValue(handle);returnType=requireRegisteredType(returnType,"emval::as");return emval_returnValue(returnType,destructorsRef,handle);};emval_methodCallers=[];__emval_call=function __emval_call(caller,handle,destructorsRef,args){caller=emval_methodCallers[caller];handle=Emval.toValue(handle);return caller(null,handle,destructorsRef,args);};emval_symbols={};getStringOrSymbol=function getStringOrSymbol(address){var symbol=emval_symbols[address];if(symbol===void 0){return readLatin1String(address);}return symbol;};emval_get_global=function emval_get_global(){if((typeof globalThis==="undefined"?"undefined":_typeof(globalThis))=="object"){return globalThis;}return/* @__PURE__ */function(){return Function;}()("return this")();};__emval_get_global=function __emval_get_global(name){if(name===0){return Emval.toHandle(emval_get_global());}else{name=getStringOrSymbol(name);return Emval.toHandle(emval_get_global()[name]);}};emval_addMethodCaller=function emval_addMethodCaller(caller){var id=emval_methodCallers.length;emval_methodCallers.push(caller);return id;};emval_lookupTypes=function emval_lookupTypes(argCount,argTypes){var a=new Array(argCount);for(var i=0;i<argCount;++i){a[i]=requireRegisteredType(HEAPU32[argTypes+i*4>>2],"parameter ".concat(i));}return a;};__emval_get_method_caller=function __emval_get_method_caller(argCount,argTypes,kind){var types=emval_lookupTypes(argCount,argTypes);var retType=types.shift();argCount--;var functionBody="return function (obj, func, destructorsRef, args) {\n";var offset=0;var argsList=[];if(kind===0){argsList.push("obj");}var params=["retType"];var args=[retType];for(var i=0;i<argCount;++i){argsList.push("arg".concat(i));params.push("argType".concat(i));args.push(types[i]);functionBody+=" var arg".concat(i," = argType").concat(i,".readValueFromPointer(args").concat(offset?"+"+offset:"",");\n");offset+=types[i].argPackAdvance;}var invoker=kind===1?"new func":"func.call";functionBody+=" var rv = ".concat(invoker,"(").concat(argsList.join(", "),");\n");if(!retType.isVoid){params.push("emval_returnValue");args.push(emval_returnValue);functionBody+=" return emval_returnValue(retType, destructorsRef, rv);\n";}functionBody+="};\n";var invokerFunction=_construct(Function,params.concat([functionBody])).apply(void 0,args);var functionName="methodCaller<(".concat(types.map(function(t){return t.name;}).join(", "),") => ").concat(retType.name,">");return emval_addMethodCaller(createNamedFunction(functionName,invokerFunction));};__emval_incref=function __emval_incref(handle){if(handle>9){emval_handles[handle+1]+=1;}};__emval_is_string=function __emval_is_string(handle){handle=Emval.toValue(handle);return typeof handle=="string";};__emval_run_destructors=function __emval_run_destructors(handle){var destructors=Emval.toValue(handle);runDestructors(destructors);__emval_decref(handle);};__emval_take_value=function __emval_take_value(type,arg){type=requireRegisteredType(type,"_emval_take_value");var v=type["readValueFromPointer"](arg);return Emval.toHandle(v);};INT53_MAX=9007199254740992;INT53_MIN=-9007199254740992;bigintToI53Checked=function bigintToI53Checked(num){return num<INT53_MIN||num>INT53_MAX?NaN:Number(num);};isLeapYear=function isLeapYear(year){return year%4===0&&(year%100!==0||year%400===0);};MONTH_DAYS_LEAP_CUMULATIVE=[0,31,60,91,121,152,182,213,244,274,305,335];MONTH_DAYS_REGULAR_CUMULATIVE=[0,31,59,90,120,151,181,212,243,273,304,334];ydayFromDate=function ydayFromDate(date){var leap=isLeapYear(date.getFullYear());var monthDaysCumulative=leap?MONTH_DAYS_LEAP_CUMULATIVE:MONTH_DAYS_REGULAR_CUMULATIVE;var yday=monthDaysCumulative[date.getMonth()]+date.getDate()-1;return yday;};__tzset_js=function __tzset_js(timezone,daylight,std_name,dst_name){var currentYear=/* @__PURE__ */new Date().getFullYear();var winter=new Date(currentYear,0,1);var summer=new Date(currentYear,6,1);var winterOffset=winter.getTimezoneOffset();var summerOffset=summer.getTimezoneOffset();var stdTimezoneOffset=Math.max(winterOffset,summerOffset);HEAPU32[timezone>>2]=stdTimezoneOffset*60;HEAP32[daylight>>2]=Number(winterOffset!=summerOffset);var extractZone=function extractZone(timezoneOffset){var sign=timezoneOffset>=0?"-":"+";var absOffset=Math.abs(timezoneOffset);var hours=String(Math.floor(absOffset/60)).padStart(2,"0");var minutes=String(absOffset%60).padStart(2,"0");return"UTC".concat(sign).concat(hours).concat(minutes);};var winterName=extractZone(winterOffset);var summerName=extractZone(summerOffset);if(summerOffset<winterOffset){stringToUTF8(winterName,std_name,17);stringToUTF8(summerName,dst_name,17);}else{stringToUTF8(winterName,dst_name,17);stringToUTF8(summerName,std_name,17);}};_emscripten_get_now=function _emscripten_get_now(){return performance.now();};_emscripten_date_now=function _emscripten_date_now(){return Date.now();};checkWasiClock=function checkWasiClock(clock_id){return clock_id>=0&&clock_id<=3;};readEmAsmArgsArray=[];readEmAsmArgs=function readEmAsmArgs(sigPtr,buf){readEmAsmArgsArray.length=0;var ch;while(ch=HEAPU8[sigPtr++]){var wide=ch!=105;wide&=ch!=112;buf+=wide&&buf%8?4:0;readEmAsmArgsArray.push(ch==112?HEAPU32[buf>>2]:ch==106?HEAP64[buf>>3]:ch==105?HEAP32[buf>>2]:HEAPF64[buf>>3]);buf+=wide?8:4;}return readEmAsmArgsArray;};runEmAsmFunction=function runEmAsmFunction(code,sigPtr,argbuf){var args=readEmAsmArgs(sigPtr,argbuf);return ASM_CONSTS[code].apply(ASM_CONSTS,_toConsumableArray(args));};_emscripten_asm_const_int=function _emscripten_asm_const_int(code,sigPtr,argbuf){return runEmAsmFunction(code,sigPtr,argbuf);};getHeapMax=function getHeapMax(){return 2147483648;};alignMemory=function alignMemory(size,alignment){return Math.ceil(size/alignment)*alignment;};growMemory=function growMemory(size){var b=wasmMemory.buffer;var pages=(size-b.byteLength+65535)/65536|0;try{wasmMemory.grow(pages);updateMemoryViews();return 1;}catch(e){}};_emscripten_resize_heap=function _emscripten_resize_heap(requestedSize){var oldSize=HEAPU8.length;requestedSize>>>=0;var maxHeapSize=getHeapMax();if(requestedSize>maxHeapSize){return false;}for(var cutDown=1;cutDown<=4;cutDown*=2){var overGrownHeapSize=oldSize*(1+0.2/cutDown);overGrownHeapSize=Math.min(overGrownHeapSize,requestedSize+100663296);var newSize=Math.min(maxHeapSize,alignMemory(Math.max(requestedSize,overGrownHeapSize),65536));var replacement=growMemory(newSize);if(replacement){return true;}}return false;};safeSetTimeout=function safeSetTimeout(func,timeout){return setTimeout(function(){callUserCallback(func);},timeout);};_emscripten_sleep=function _emscripten_sleep(ms){return Asyncify.handleSleep(function(wakeUp){return safeSetTimeout(wakeUp,ms);});};_emscripten_sleep.isAsync=true;ENV={};getExecutableName=function getExecutableName(){return thisProgram||"./this.program";};getEnvStrings=function getEnvStrings(){if(!getEnvStrings.strings){var lang=((typeof navigator==="undefined"?"undefined":_typeof(navigator))=="object"&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8";var env={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:lang,_:getExecutableName()};for(var x in ENV){if(ENV[x]===void 0)delete env[x];else env[x]=ENV[x];}var strings=[];for(var x in env){strings.push("".concat(x,"=").concat(env[x]));}getEnvStrings.strings=strings;}return getEnvStrings.strings;};_environ_get=function _environ_get(__environ,environ_buf){var bufSize=0;var envp=0;var _iterator62=_createForOfIteratorHelper(getEnvStrings()),_step62;try{for(_iterator62.s();!(_step62=_iterator62.n()).done;){var string=_step62.value;var ptr=environ_buf+bufSize;HEAPU32[__environ+envp>>2]=ptr;bufSize+=stringToUTF8(string,ptr,Infinity)+1;envp+=4;}}catch(err){_iterator62.e(err);}finally{_iterator62.f();}return 0;};_environ_sizes_get=function _environ_sizes_get(penviron_count,penviron_buf_size){var strings=getEnvStrings();HEAPU32[penviron_count>>2]=strings.length;var bufSize=0;var _iterator63=_createForOfIteratorHelper(strings),_step63;try{for(_iterator63.s();!(_step63=_iterator63.n()).done;){var string=_step63.value;bufSize+=lengthBytesUTF8(string)+1;}}catch(err){_iterator63.e(err);}finally{_iterator63.f();}HEAPU32[penviron_buf_size>>2]=bufSize;return 0;};doReadv=function doReadv(stream,iov,iovcnt,offset){var ret=0;for(var i=0;i<iovcnt;i++){var ptr=HEAPU32[iov>>2];var len=HEAPU32[iov+4>>2];iov+=8;var curr=FS.read(stream,HEAP8,ptr,len,offset);if(curr<0)return-1;ret+=curr;if(curr<len)break;if(typeof offset!="undefined"){offset+=curr;}}return ret;};doWritev=function doWritev(stream,iov,iovcnt,offset){var ret=0;for(var i=0;i<iovcnt;i++){var ptr=HEAPU32[iov>>2];var len=HEAPU32[iov+4>>2];iov+=8;var curr=FS.write(stream,HEAP8,ptr,len,offset);if(curr<0)return-1;ret+=curr;if(curr<len){break;}if(typeof offset!="undefined"){offset+=curr;}}return ret;};stackAlloc=function stackAlloc(sz){return __emscripten_stack_alloc(sz);};stringToUTF8OnStack=function stringToUTF8OnStack(str){var size=lengthBytesUTF8(str)+1;var ret=stackAlloc(size);stringToUTF8(str,ret,size);return ret;};FS.createPreloadedFile=FS_createPreloadedFile;FS.staticInit();MEMFS.doesNotExistError=new FS.ErrnoError(44);MEMFS.doesNotExistError.stack="<generic error, no stack>";embind_init_charCodes();if(Module["noExitRuntime"])noExitRuntime=Module["noExitRuntime"];if(Module["preloadPlugins"])preloadPlugins=Module["preloadPlugins"];if(Module["print"])out=Module["print"];if(Module["printErr"])err=Module["printErr"];if(Module["wasmBinary"])wasmBinary=Module["wasmBinary"];if(Module["arguments"])arguments_=Module["arguments"];if(Module["thisProgram"])thisProgram=Module["thisProgram"];ASM_CONSTS={1473352:function _(){console.error("progress callback is not set.");}};wasmImports={a:___cxa_throw,j:___syscall_fcntl64,G:___syscall_ioctl,H:___syscall_openat,r:___syscall_renameat,s:___syscall_rmdir,w:___syscall_stat64,t:___syscall_unlinkat,u:__abort_js,L:__embind_finalize_value_object,m:__embind_register_bigint,R:__embind_register_bool,P:__embind_register_emval,l:__embind_register_float,f:__embind_register_function,c:__embind_register_integer,b:__embind_register_memory_view,Q:__embind_register_std_string,g:__embind_register_std_wstring,O:__embind_register_value_object,M:__embind_register_value_object_field,S:__embind_register_void,N:__emval_as,d:__emval_call,q:__emval_decref,F:__emval_get_global,e:__emval_get_method_caller,o:__emval_incref,T:__emval_is_string,n:__emval_run_destructors,p:__emval_take_value,x:__gmtime_js,y:__localtime_js,z:__tzset_js,J:_clock_time_get,K:_emscripten_asm_const_int,I:_emscripten_date_now,v:_emscripten_resize_heap,k:_emscripten_sleep,C:_environ_get,D:_environ_sizes_get,h:_fd_close,B:_fd_fdstat_get,E:_fd_read,A:_fd_seek,i:_fd_write};_context18.next=223;return createWasm();case 223:wasmExports=_context18.sent;wasmExports["V"];___getTypeName=wasmExports["W"];_malloc=wasmExports["X"];_free=wasmExports["Y"];_main=Module["_main"]=wasmExports["Z"];__emscripten_stack_alloc=wasmExports["_"];Module["dynCall_ii"]=wasmExports["$"];Module["dynCall_vi"]=wasmExports["aa"];Module["dynCall_vii"]=wasmExports["ba"];Module["dynCall_iii"]=wasmExports["ca"];Module["dynCall_viii"]=wasmExports["da"];Module["dynCall_v"]=wasmExports["ea"];Module["dynCall_diiii"]=wasmExports["fa"];Module["dynCall_viif"]=wasmExports["ga"];Module["dynCall_iiiii"]=wasmExports["ha"];Module["dynCall_iiii"]=wasmExports["ia"];Module["dynCall_ddd"]=wasmExports["ja"];Module["dynCall_i"]=wasmExports["ka"];Module["dynCall_fii"]=wasmExports["la"];Module["dynCall_viiii"]=wasmExports["ma"];Module["dynCall_iiiiii"]=wasmExports["na"];Module["dynCall_idd"]=wasmExports["oa"];Module["dynCall_jiji"]=wasmExports["pa"];Module["dynCall_iidiiii"]=wasmExports["qa"];Module["dynCall_viijii"]=wasmExports["ra"];Module["dynCall_iiiiiiiii"]=wasmExports["sa"];Module["dynCall_iiiiiii"]=wasmExports["ta"];Module["dynCall_iiiiij"]=wasmExports["ua"];Module["dynCall_iiiiid"]=wasmExports["va"];Module["dynCall_iiiiijj"]=wasmExports["wa"];Module["dynCall_iiiiiiii"]=wasmExports["xa"];Module["dynCall_iiiiiijj"]=wasmExports["ya"];Module["dynCall_viiiiii"]=wasmExports["za"];Module["dynCall_viiiii"]=wasmExports["Aa"];_asyncify_start_unwind=wasmExports["Ba"];_asyncify_stop_unwind=wasmExports["Ca"];_asyncify_start_rewind=wasmExports["Da"];_asyncify_stop_rewind=wasmExports["Ea"];preInit();run();moduleRtn=readyPromise;return _context18.abrupt("return",moduleRtn);case 266:case"end":return _context18.stop();}}},_callee14);}));}();var __defProp$1=Object.defineProperty;var __defNormalProp$1=function __defNormalProp$1(obj,key,value){return key in obj?__defProp$1(obj,key,{enumerable:true,configurable:true,writable:true,value:value}):obj[key]=value;};var __publicField$1=function __publicField$1(obj,key,value){__defNormalProp$1(obj,_typeof(key)!=="symbol"?key+"":key,value);return value;};var cdnUrl="https://cdn.jsdelivr.net/npm/@creooxag/cxconverter@".concat(packageJSON.version,"/dist/");var defaultUrlPrefix="./";var _IfcWasmConverterLoader=/*#__PURE__*/function(){function _IfcWasmConverterLoader(){_classCallCheck(this,_IfcWasmConverterLoader);__publicField$1(this,"module");}_createClass(_IfcWasmConverterLoader,null,[{key:"getInstance",value:function(){var _getInstance=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee15(){var userUrlPrefix,urlPrefix,_Module,_args18=arguments;return _regeneratorRuntime().wrap(function _callee15$(_context19){while(1){switch(_context19.prev=_context19.next){case 0:userUrlPrefix=_args18.length>0&&_args18[0]!==undefined?_args18[0]:"remote";urlPrefix=defaultUrlPrefix;if(userUrlPrefix){urlPrefix=userUrlPrefix=="remote"?cdnUrl:userUrlPrefix;}if(_IfcWasmConverterLoader.instance){_context19.next=15;break;}_IfcWasmConverterLoader.instance=new _IfcWasmConverterLoader();_Module={locateFile:function locateFile(path){var fullPath=urlPrefix+path;if(path.endsWith(".wasm")){console.log("Loading wasm file from ".concat(fullPath));return fullPath;}return path;}};_context19.prev=6;_context19.next=9;return IfcDbWasm(_Module);case 9:_IfcWasmConverterLoader.instance.module=_context19.sent;_context19.next=15;break;case 12:_context19.prev=12;_context19.t0=_context19["catch"](6);console.error("Error on wasm import:",_context19.t0);case 15:return _context19.abrupt("return",_IfcWasmConverterLoader.instance);case 16:case"end":return _context19.stop();}}},_callee15,null,[[6,12]]);}));function getInstance(){return _getInstance.apply(this,arguments);}return getInstance;}()},{key:"getModule",value:function(){var _getModule=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee16(userUrlPrefix){return _regeneratorRuntime().wrap(function _callee16$(_context20){while(1){switch(_context20.prev=_context20.next){case 0:_context20.next=2;return _IfcWasmConverterLoader.getInstance(userUrlPrefix);case 2:return _context20.abrupt("return",_context20.sent.module);case 3:case"end":return _context20.stop();}}},_callee16);}));function getModule(_x128){return _getModule.apply(this,arguments);}return getModule;}()}]);return _IfcWasmConverterLoader;}();__publicField$1(_IfcWasmConverterLoader,"instance");var IfcWasmConverterLoader=_IfcWasmConverterLoader;function ifc2gltf(_x129){return _ifc2gltf.apply(this,arguments);}function _ifc2gltf(){_ifc2gltf=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee73(ifcData){var params,inputOptionsString,loadOptions,resolveCallbackGltf,resolveCallbackMetadata,url,module,promiseGltf,promiseMetadata,gltf,uint8Array,decoder,metaStr,metaData,_args76=arguments;return _regeneratorRuntime().wrap(function _callee73$(_context77){while(1){switch(_context77.prev=_context77.next){case 0:params=_args76.length>1&&_args76[1]!==undefined?_args76[1]:{remote:true};if(params.remote==void 0)params.remote=true;inputOptionsString=params.inputOptions?params.inputOptions:JSON.stringify(inputOptionsDefault);loadOptions={"maxFileSizeInMegaBytes":1e3};resolveCallbackGltf=void 0;resolveCallbackMetadata=void 0;url=params.remote?"remote":params.urlPath;_context77.next=9;return IfcWasmConverterLoader.getModule(url);case 9:module=_context77.sent;if(params.progressCallback)module.setProgressCallback(params.progressCallback);else module.setProgressCallback(function(progress){console.log("Progress: ".concat(progress));});if(params.progressTextCallback)module.setProgressTextCallback(params.progressTextCallback);else module.setProgressTextCallback(function(progressText){console.log("Progress text: ".concat(progressText));});module.setInputOptions(inputOptionsString);promiseGltf=new Promise(function(resolve){resolveCallbackGltf=resolve;});promiseMetadata=new Promise(function(resolve){resolveCallbackMetadata=resolve;});if(resolveCallbackGltf)module.setGltfCompleteCallback(resolveCallbackGltf);if(resolveCallbackMetadata)module.setMetaDataCompleteCallback(resolveCallbackMetadata);module.loadModel(ifcData,loadOptions);_context77.next=20;return Promise.all([promiseGltf,promiseMetadata]);case 20:_context77.next=22;return module.getGeometry();case 22:gltf=_context77.sent;_context77.next=25;return module.getMetaData();case 25:uint8Array=_context77.sent;decoder=new TextDecoder();metaStr=decoder.decode(uint8Array);_context77.next=30;return JSON.parse(metaStr);case 30:metaData=_context77.sent;return _context77.abrupt("return",{gltf:gltf,metaData:metaData});case 32:case"end":return _context77.stop();}}},_callee73);}));return _ifc2gltf.apply(this,arguments);}var inputOptionsDefault={"inputParameters":{"exportPropertySets":"yes","exportIfcPropertyTypes":"yes","exportIfcValueTypes":"yes","exportPolylines":"yes","excludeGeometryForIfcTypes":["IfcOpeningElement"],"excludeGUIDs":[""],"exportOnlyGUIDs":[""],"centerModelAtOrigin":"yes","ignoreProfileRadius":"yes","enableGltfCompression":"yes","enableGltfQuantization":"no","exportNormals":"no","numPointsPerCircle":18,"licenceKey":"",// JSON above is copied from default input config file. Changes applied here:
30594
30596
  "loadingPriorityTypes":["IFCWALL","IFCSLAB","IFCWINDOW","IFCROOF","IFCFURNISHINGELEMENT","IFCAIRTERMINAL"]//[ "IfcOpeningElement" ],
30595
30597
  }};/**
30596
30598
  * Fetches a file from the given URL and returns its contents as text.
@@ -30675,7 +30677,7 @@ asmGlobalArg,asmLibraryArg,buffer);var __ZSt18uncaught_exceptionv=Module['__ZSt1
30675
30677
  * @param offset
30676
30678
  * @param count
30677
30679
  * @returns number | number[] from incoming binary data
30678
- */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 _i391=0;_i391<count;_i391++){ret.push(r[_i391]);}return ret;}/**
30680
+ */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 _i392=0;_i392<count;_i392++){ret.push(r[_i392]);}return ret;}/**
30679
30681
  * Parsing of header's attributes
30680
30682
  * @param arraybuffer
30681
30683
  * @returns header as LASHeader
@@ -30695,7 +30697,7 @@ return true;}/**
30695
30697
  * @param count
30696
30698
  * @param skip
30697
30699
  * @returns new ArrayBuffer, count, hasMoreData
30698
- */},{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 _i392=0;_i392<pointsToRead;_i392++){if(_i392%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};}/**
30700
+ */},{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 _i393=0;_i393<pointsToRead;_i393++){if(_i393%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};}/**
30699
30701
  * Method which brings data to null to close the file
30700
30702
  * @returns
30701
30703
  */},{key:"close",value:function close(){// @ts-ignore Possibly null
@@ -30712,7 +30714,7 @@ Module=getModule();}}/**
30712
30714
  * @param offset
30713
30715
  * @param skip
30714
30716
  * @returns Data
30715
- */},{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 _i393=0;_i393<pointsToRead;_i393++){instance.getPoint(bufRead);if(_i393%skip===0){var _a11=new Uint8Array(Module.HEAPU8.buffer,bufRead,header.pointsStructSize);thisBuf.set(_a11,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));}}/**
30717
+ */},{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 _i394=0;_i394<pointsToRead;_i394++){instance.getPoint(bufRead);if(_i394%skip===0){var _a11=new Uint8Array(Module.HEAPU8.buffer,bufRead,header.pointsStructSize);thisBuf.set(_a11,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));}}/**
30716
30718
  * Deletes the instance
30717
30719
  * @returns boolean
30718
30720
  */},{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;}();/**
@@ -30769,7 +30771,7 @@ schema:{fields:[],metadata:{}},header:{vertexCount:0,boundingBox:[[0,0,0],[0,0,0
30769
30771
  };/* eslint-disable max-statements */ // @ts-ignore Possibly undefined
30770
30772
  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`
30771
30773
  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
30772
- 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 _i394=0;_i394<batchSize;_i394++){var _decoder$getPoint=decoder.getPoint(_i394),_position4=_decoder$getPoint.position,_color12=_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(_color12&&colors){if(twoByteColor){colors[pointIndex*4]=_color12[0]/256;colors[pointIndex*4+1]=_color12[1]/256;colors[pointIndex*4+2]=_color12[2]/256;}else{colors[pointIndex*4]=_color12[0];colors[pointIndex*4+1]=_color12[1];colors[pointIndex*4+2]=_color12[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;}/**
30774
+ 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 _i395=0;_i395<batchSize;_i395++){var _decoder$getPoint=decoder.getPoint(_i395),_position4=_decoder$getPoint.position,_color12=_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(_color12&&colors){if(twoByteColor){colors[pointIndex*4]=_color12[0]/256;colors[pointIndex*4+1]=_color12[1]/256;colors[pointIndex*4+2]=_color12[2]/256;}else{colors[pointIndex*4]=_color12[0];colors[pointIndex*4+1]=_color12[1];colors[pointIndex*4+2]=_color12[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;}/**
30773
30775
  * parse laz data
30774
30776
  * @param rawData
30775
30777
  * @param skip
@@ -30784,7 +30786,7 @@ onParseData(unpacker,header);if(!chunk.hasMoreData||totalRead>=totalToRead){brea
30784
30786
  * @param batchSize
30785
30787
  * @param colorDepth
30786
30788
  * @returns boolean
30787
- */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 _i395=0;_i395<batchSize;_i395++){var _decoder$getPoint2=decoder.getPoint(_i395),_color13=_decoder$getPoint2.color;// eslint-disable-next-line max-depth
30789
+ */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 _i396=0;_i396<batchSize;_i396++){var _decoder$getPoint2=decoder.getPoint(_i396),_color13=_decoder$getPoint2.color;// eslint-disable-next-line max-depth
30788
30790
  if(_color13[0]>255||_color13[1]>255||_color13[2]>255){twoByteColor=true;}}}break;default:// eslint-disable-next-line
30789
30791
  console.warn('las: illegal value for options.las.colorDepth');break;}return twoByteColor;}/**
30790
30792
  * Loader for the LAS (LASer) point cloud format
@@ -30794,7 +30796,7 @@ var headerBlockItems=[{item:'FileSignature',format:'char',size:4},{item:'FileSou
30794
30796
  * @private
30795
30797
  * @param arrayBuffer
30796
30798
  * @returns {{}}
30797
- */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(_ref30){var item=_ref30.item,format=_ref30.format,size=_ref30.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 _loop15=function _loop15(){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--){_loop15();}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 _i396=0;_i396<buf.length;++_i396){view[_i396]=buf[_i396];}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
30799
+ */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(_ref30){var item=_ref30.item,format=_ref30.format,size=_ref30.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 _loop15=function _loop15(){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--){_loop15();}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
30798
30800
  /**
30799
30801
  * {@link Viewer} plugin that loads lidar point cloud geometry from LAS files.
30800
30802
  *
@@ -31133,7 +31135,7 @@ var headerBlockItems=[{item:'FileSignature',format:'char',size:4},{item:'FileSou
31133
31135
  sceneModel.fire("loaded",true,false);// Don't forget the event, for late subscribers
31134
31136
  });spinner.processes--;};var error=function error(errMsg){spinner.processes--;_this206.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;_this206._dataSource.getLAS("".concat(baseDir).concat(lasFiles[i]),function(arrayBuffer){var modelParams=utils.apply(params,{isManifest:true,index:i});_this206._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++;_this206.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){_this206.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){_this206.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 _this207=this;var spinner=this.viewer.scene.canvas.spinner;spinner.processes++;this._dataSource.getLAS(params.src,function(arrayBuffer){_this207._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
31135
31137
  sceneModel.fire("loaded",true,false);// Don't forget the event, for late subscribers
31136
- });spinner.processes--;},function(errMsg){spinner.processes--;_this207.error(errMsg);sceneModel.fire("error",errMsg);});},function(errMsg){spinner.processes--;_this207.error(errMsg);sceneModel.fire("error",errMsg);});}},{key:"_parseModel",value:function _parseModel(arrayBuffer,params,options,sceneModel){var _this208=this;var readPositions=function readPositions(attributesPosition){var positionsValue=attributesPosition.value;if(_this208._center){var centerPos=math.vec3();var numPoints=positionsValue.length;for(var _i397=0,len=positionsValue.length;_i397<len;_i397+=3){centerPos[0]+=positionsValue[_i397+0];centerPos[1]+=positionsValue[_i397+1];centerPos[2]+=positionsValue[_i397+2];}centerPos[0]/=numPoints;centerPos[1]/=numPoints;centerPos[2]/=numPoints;for(var _i398=0,_len62=positionsValue.length;_i398<_len62;_i398+=3){positionsValue[_i398+0]-=centerPos[0];positionsValue[_i398+1]-=centerPos[1];positionsValue[_i398+2]-=centerPos[2];}}if(_this208._rotateX){if(positionsValue){for(var _i399=0,_len63=positionsValue.length;_i399<_len63;_i399+=3){var temp=positionsValue[_i399+1];positionsValue[_i399+1]=positionsValue[_i399+2];positionsValue[_i399+2]=temp;}}}if(_this208._rotate){var quaternion=math.identityQuaternion();var mat=math.mat4();math.eulerToQuaternion(_this208._rotate,"XYZ",quaternion);math.quaternionToRotationMat4(quaternion,mat);var pos=math.vec3();for(var _i400=0,_len64=positionsValue.length;_i400<_len64;_i400+=3){pos[0]=positionsValue[_i400+0];pos[1]=positionsValue[_i400+1];pos[2]=positionsValue[_i400+2];math.transformPoint3(mat,pos,pos);positionsValue[_i400+0]=pos[0];positionsValue[_i400+1]=pos[1];positionsValue[_i400+2]=pos[2];}}if(_this208._transform){var _mat=math.mat4(_this208._transform);var _pos=math.vec3();for(var _i401=0,_len65=positionsValue.length;_i401<_len65;_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];}}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 _i402=0,j=0,k=0,len=intensities.length;_i402<len;_i402++,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[_i402]/65536*255);}return colorsCompressed;}function readIntensities(attributesIntensity){var intensities=attributesIntensity.value;var colorsCompressedSize=intensities.length*4;var colorsCompressed=new Uint8Array(colorsCompressedSize);for(var _i403=0,j=0,len=intensities.length;_i403<len;_i403++,j+=4){colorsCompressed[j+0]=0;colorsCompressed[j+1]=0;colorsCompressed[j+2]=0;colorsCompressed[j+3]=Math.round(intensities[_i403]/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$3(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 _i404=0,len=pointsChunks.length;_i404<len;_i404++){var meshId="".concat(params.isManifest?'model'+params.index:'',"pointsMesh").concat(_i404);meshIds.push(meshId);sceneModel.createMesh({id:meshId,primitive:"points",positions:pointsChunks[_i404],colorsCompressed:_i404<colorsChunks.length?colorsChunks[_i404]:null});}var pointsObjectId=params.entityId||math.createUUID();sceneModel.createEntity({id:pointsObjectId,meshIds:meshIds,isObject:true});sceneModel.finalize();if(params.metaModelJSON){var metaModelId=sceneModel.id;_this208.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;_this208.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 _i405=0;_i405<array.length;_i405+=chunkSize){result.push(array.slice(_i405,_i405+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
31138
+ });spinner.processes--;},function(errMsg){spinner.processes--;_this207.error(errMsg);sceneModel.fire("error",errMsg);});},function(errMsg){spinner.processes--;_this207.error(errMsg);sceneModel.fire("error",errMsg);});}},{key:"_parseModel",value:function _parseModel(arrayBuffer,params,options,sceneModel){var _this208=this;var readPositions=function readPositions(attributesPosition){var positionsValue=attributesPosition.value;if(_this208._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,_len62=positionsValue.length;_i399<_len62;_i399+=3){positionsValue[_i399+0]-=centerPos[0];positionsValue[_i399+1]-=centerPos[1];positionsValue[_i399+2]-=centerPos[2];}}if(_this208._rotateX){if(positionsValue){for(var _i400=0,_len63=positionsValue.length;_i400<_len63;_i400+=3){var temp=positionsValue[_i400+1];positionsValue[_i400+1]=positionsValue[_i400+2];positionsValue[_i400+2]=temp;}}}if(_this208._rotate){var quaternion=math.identityQuaternion();var mat=math.mat4();math.eulerToQuaternion(_this208._rotate,"XYZ",quaternion);math.quaternionToRotationMat4(quaternion,mat);var pos=math.vec3();for(var _i401=0,_len64=positionsValue.length;_i401<_len64;_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(_this208._transform){var _mat=math.mat4(_this208._transform);var _pos=math.vec3();for(var _i402=0,_len65=positionsValue.length;_i402<_len65;_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$3(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;_this208.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;_this208.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
31137
31139
  return pathArray.join('/')+'/';}/**
31138
31140
  * Default data access strategy for {@link CityJSONLoaderPlugin}.
31139
31141
  */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;}}/**
@@ -31286,16 +31288,16 @@ return pathArray.join('/')+'/';}/**
31286
31288
  */},{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
31287
31289
  }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 _this210=this;var spinner=this.viewer.scene.canvas.spinner;spinner.processes++;this._dataSource.getCityJSON(params.src,function(data){_this210._parseModel(data,params,options,sceneModel);spinner.processes--;},function(errMsg){spinner.processes--;_this210.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
31288
31290
  sceneModel.fire("loaded",true,false);// Don't forget the event, for late subscribers
31289
- });}},{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 _i406=0,j=0;_i406<vertices.length;_i406++,j+=3){var x=vertices[_i406][0]*scale[0]+translate[0];var y=vertices[_i406][1]*scale[1]+translate[1];var _z5=vertices[_i406][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 _i407=0,len=cityObject.geometry.length;_i407<len;_i407++){var geometry=cityObject.geometry[_i407];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[_i407];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 _j7=0;_j7<solids.length;_j7++){for(var k=0;k<solids[_j7].length;k++){var _surfaces2=solids[_j7][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 _i408=0;_i408<surfaces.length;_i408++){var surface=surfaces[_i408];var surfaceMaterial=surfaceMaterials[_i408]||{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
31291
+ });}},{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 _j7=0;_j7<solids.length;_j7++){for(var k=0;k<solids[_j7].length;k++){var _surfaces2=solids[_j7][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
31290
31292
  geometryCfg.indices.push(face[0]);geometryCfg.indices.push(face[1]);geometryCfg.indices.push(face[2]);}else if(face.length>3){// Polygon
31291
31293
  // Prepare to triangulate
31292
31294
  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
31293
31295
  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
31294
31296
  var tr=earcut(pv,holes,2);// Create triangles
31295
31297
  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 _j8=0;_j8<solids.length;_j8++){for(var k=0;k<solids[_j8].length;k++){var _surfaces4=solids[_j8][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
31296
- });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 _i409=0;_i409<surfaces.length;_i409++){var boundary=[];var holes=[];for(var j=0;j<surfaces[_i409].length;j++){if(boundary.length>0){holes.push(boundary.length);}var newBoundary=this._extractLocalIndices(ctx,surfaces[_i409][j],sharedIndices,primitiveCfg);boundary.push.apply(boundary,_toConsumableArray(newBoundary));}if(boundary.length===3){// Triangle
31298
+ });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
31297
31299
  primitiveCfg.indices.push(boundary[0]);primitiveCfg.indices.push(boundary[1]);primitiveCfg.indices.push(boundary[2]);}else if(boundary.length>3){// Polygon
31298
- 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 _i410=0,len=boundary.length;_i410<len;_i410++){var index=boundary[_i410];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 _i411=0;_i411<positions.length;_i411++){var nexti=_i411+1;if(nexti===positions.length){nexti=0;}normal[0]+=(positions[_i411].y-positions[nexti].y)*(positions[_i411].z+positions[nexti].z);normal[1]+=(positions[_i411].z-positions[nexti].z)*(positions[_i411].x+positions[nexti].x);normal[2]+=(positions[_i411].x-positions[nexti].x)*(positions[_i411].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);/**
31300
+ 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);/**
31299
31301
  * Default data access strategy for {@link DotBIMLoaderPlugin}.
31300
31302
  *
31301
31303
  * This just loads assets using XMLHttpRequest.
@@ -31570,7 +31572,7 @@ var pList=[];for(var k=0;k<boundary.length;k++){pList.push({x:vertices[sharedInd
31570
31572
  * @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}
31571
31573
  */,set:function set(value){this._objectDefaults=value||IFCObjectDefaults;}},{key:"load",value:function load(){var _this212=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
31572
31574
  if(!params.src&&!params.dotBIM){this.error("load() param expected: src or dotBIM");return sceneModel;// Return new empty model
31573
- }var objectDefaults=params.objectDefaults||this._objectDefaults||IFCObjectDefaults;var includeTypes;if(params.includeTypes){includeTypes={};for(var _i412=0,len=params.includeTypes.length;_i412<len;_i412++){includeTypes[params.includeTypes[_i412]]=true;}}var excludeTypes;if(params.excludeTypes){excludeTypes={};if(!includeTypes){includeTypes={};}for(var _i413=0,_len66=params.excludeTypes.length;_i413<_len66;_i413++){includeTypes[params.excludeTypes[_i413]]=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 _loop16=function _loop16(_i414,_len67){var element=dbElements[_i414];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:_i414;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");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 _i415=0,_len68=faceColors.length;_i415<_len68;_i415+=4){var faceColor=[faceColors[_i415],faceColors[_i415+1],faceColors[_i415+2],faceColors[_i415+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 _i416=0,_Object$entries8=Object.entries(coloredTrianglesDictionary);_i416<_Object$entries8.length;_i416++){var _Object$entries8$_i=_slicedToArray(_Object$entries8[_i416],2),_faceColor=_Object$entries8$_i[0],trianglesCoordinates=_Object$entries8$_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(_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 _i414=0,_len67=dbElements.length;_i414<_len67;_i414++){var _ret3=_loop16(_i414,_len67);if(_ret3==="continue")continue;}sceneModel.finalize();_this212.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
31575
+ }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,_len66=params.excludeTypes.length;_i414<_len66;_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 _loop16=function _loop16(_i415,_len67){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");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,_len68=faceColors.length;_i416<_len68;_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$entries8=Object.entries(coloredTrianglesDictionary);_i417<_Object$entries8.length;_i417++){var _Object$entries8$_i=_slicedToArray(_Object$entries8[_i417],2),_faceColor=_Object$entries8$_i[0],trianglesCoordinates=_Object$entries8$_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(_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,_len67=dbElements.length;_i415<_len67;_i415++){var _ret3=_loop16(_i415,_len67);if(_ret3==="continue")continue;}sceneModel.finalize();_this212.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
31574
31576
  sceneModel.fire("loaded",true,false);// Don't forget the event, for late subscribers
31575
31577
  });};if(params.src){var src=params.src;this.viewer.scene.canvas.spinner.processes++;this._dataSource.getDotBIM(src,function(fileData){// OK
31576
31578
  var ctx={fileData:fileData,sceneModel:sceneModel,nextId:0,error:function error(errMsg){}};parseDotBIM(ctx);_this212.viewer.scene.canvas.spinner.processes--;},function(err){_this212.viewer.scene.canvas.spinner.processes--;_this212.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(){_this212.viewer.metaScene.destroyMetaModel(modelId);});return sceneModel;}/**
@@ -31593,13 +31595,13 @@ marker2.update(point2WorldPos);marker1.destroy();marker2.destroy();updatePointer
31593
31595
  var pos=[];var ind=[];var addPlane=function addPlane(isCeiling){var baseIdx=pos.length;var _iterator64=_createForOfIteratorHelper(baseVertices),_step64;try{for(_iterator64.s();!(_step64=_iterator64.n()).done;){var c=_step64.value;pos.push([c[0],altitude+(isCeiling?height:0),c[1]]);}}catch(err){_iterator64.e(err);}finally{_iterator64.f();}var _iterator65=_createForOfIteratorHelper(baseTriangles),_step65;try{for(_iterator65.s();!(_step65=_iterator65.n()).done;){var t=_step65.value;ind.push.apply(ind,_toConsumableArray((isCeiling?t:t.slice(0).reverse()).map(function(i){return i+baseIdx;})));}}catch(err){_iterator65.e(err);}finally{_iterator65.f();}};addPlane(false);// floor
31594
31596
  addPlane(true);// ceiling
31595
31597
  // sides
31596
- var _loop17=function _loop17(_i417){var a=baseVertices[_i417];var b=baseVertices[(baseVertices.length+_i417+(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 _i417=0;_i417<baseVertices.length;++_i417){_loop17(_i417);}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=(_ref33=[]).concat.apply(_ref33,_toConsumableArray(pos.map(function(p){return math.subVec3(p,_this214._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 _iterator66=_createForOfIteratorHelper(baseTriangles),_step66;try{for(_iterator66.s();!(_step66=_iterator66.n()).done;){var t=_step66.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){_iterator66.e(err);}finally{_iterator66.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
31597
- 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 _i418=0;_i418<geo.indices.length;_i418+=3){for(var off=0;off<3;++off){var _p5=pts[off];var pIdx=3*geo.indices[_i418+off];for(var c=0;c<3;++c){_p5[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
31598
+ var _loop17=function _loop17(_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){_loop17(_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=(_ref33=[]).concat.apply(_ref33,_toConsumableArray(pos.map(function(p){return math.subVec3(p,_this214._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 _iterator66=_createForOfIteratorHelper(baseTriangles),_step66;try{for(_iterator66.s();!(_step66=_iterator66.n()).done;){var t=_step66.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){_iterator66.e(err);}finally{_iterator66.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
31599
+ 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 _p5=pts[off];var pIdx=3*geo.indices[_i419+off];for(var c=0;c<3;++c){_p5[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
31598
31600
  addPlane(false);// floor
31599
31601
  // sides
31600
- var _p6=function _p6(idx,y){return[planeCoords[idx][0],y,planeCoords[idx][1]];};for(var _i419=0;_i419<planeCoords.length;++_i419){var _j9=(_i419+1)%planeCoords.length;faces.push([_p6(_i419,_f2),_p6(_j9,_f2),_p6(_j9,c),_p6(_i419,c)]);}}var _iterator67=_createForOfIteratorHelper(sectionPlanes),_step67;try{for(_iterator67.s();!(_step67=_iterator67.n()).done;){var s=_step67.value;var dir=s.dir;var dist=s.dist;var newFaces=[];var _iterator70=_createForOfIteratorHelper(faces),_step70;try{for(_iterator70.s();!(_step70=_iterator70.n()).done;){var face=_step70.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.
31601
- var polygonType=0;var _types=[];for(var _i420=0;_i420<face.length;_i420++){var t=math.dotVec3(dir,face[_i420])+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.
31602
- switch(polygonType){case COPLANAR:newFaces.push(face);break;case FRONT:newFaces.push(face);break;case BACK:break;case SPANNING:var _f4=[];for(var _i421=0;_i421<face.length;_i421++){var j=(_i421+1)%face.length;var ti=_types[_i421];var tj=_types[j];var vi=face[_i421];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){_iterator70.e(err);}finally{_iterator70.f();}faces=newFaces;}}catch(err){_iterator67.e(err);}finally{_iterator67.f();}if(faces.length===0){return null;}else{var avg=math.vec3([0,0,0]);var unique=new Set();var _iterator68=_createForOfIteratorHelper(faces),_step68;try{for(_iterator68.s();!(_step68=_iterator68.n()).done;){var _f3=_step68.value;var _iterator69=_createForOfIteratorHelper(_f3),_step69;try{for(_iterator69.s();!(_step69=_iterator69.n()).done;){var _p7=_step69.value;var id=_p7.map(function(x){return x.toFixed(3);}).join(":");if(!unique.has(id)){unique.add(id);math.addVec3(avg,_p7,avg);}}}catch(err){_iterator69.e(err);}finally{_iterator69.f();}}}catch(err){_iterator68.e(err);}finally{_iterator68.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;}}/**
31602
+ var _p6=function _p6(idx,y){return[planeCoords[idx][0],y,planeCoords[idx][1]];};for(var _i420=0;_i420<planeCoords.length;++_i420){var _j9=(_i420+1)%planeCoords.length;faces.push([_p6(_i420,_f2),_p6(_j9,_f2),_p6(_j9,c),_p6(_i420,c)]);}}var _iterator67=_createForOfIteratorHelper(sectionPlanes),_step67;try{for(_iterator67.s();!(_step67=_iterator67.n()).done;){var s=_step67.value;var dir=s.dir;var dist=s.dist;var newFaces=[];var _iterator70=_createForOfIteratorHelper(faces),_step70;try{for(_iterator70.s();!(_step70=_iterator70.n()).done;){var face=_step70.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.
31603
+ 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.
31604
+ 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){_iterator70.e(err);}finally{_iterator70.f();}faces=newFaces;}}catch(err){_iterator67.e(err);}finally{_iterator67.f();}if(faces.length===0){return null;}else{var avg=math.vec3([0,0,0]);var unique=new Set();var _iterator68=_createForOfIteratorHelper(faces),_step68;try{for(_iterator68.s();!(_step68=_iterator68.n()).done;){var _f3=_step68.value;var _iterator69=_createForOfIteratorHelper(_f3),_step69;try{for(_iterator69.s();!(_step69=_iterator69.n()).done;){var _p7=_step69.value;var id=_p7.map(function(x){return x.toFixed(3);}).join(":");if(!unique.has(id)){unique.add(id);math.addVec3(avg,_p7,avg);}}}catch(err){_iterator69.e(err);}finally{_iterator69.f();}}}catch(err){_iterator68.e(err);}finally{_iterator68.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;}}/**
31603
31605
  * Sets whether this Zone is visible or not.
31604
31606
  *
31605
31607
  * @type {Boolean}
@@ -31687,7 +31689,7 @@ switch(polygonType){case COPLANAR:newFaces.push(face);break;case FRONT:newFaces.
31687
31689
  */},{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
31688
31690
  // clockwise
31689
31691
  // counterclockwise
31690
- 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 _i422=excludeFirstSegment?1:0;_i422<pos2D.length-2-1;++_i422){var c=pos2D[_i422];var d=pos2D[_i422+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
31692
+ 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
31691
31693
  o1===0&&onSegment(a,c,b)||// a, b and c are collinear and c lies on segment ab
31692
31694
  o2===0&&onSegment(a,d,b)||// a, b and d are collinear and d lies on segment ab
31693
31695
  o3===0&&onSegment(c,a,d)||// c, d and a are collinear and a lies on segment cd