@xeokit/xeokit-sdk 2.6.86-beta.0 → 2.6.87
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.
- package/dist/xeokit-sdk.cjs.js +4122 -38
- package/dist/xeokit-sdk.es.js +4122 -39
- package/dist/xeokit-sdk.es5.js +203 -165
- package/dist/xeokit-sdk.min.cjs.js +8 -8
- package/dist/xeokit-sdk.min.es.js +7 -7
- package/dist/xeokit-sdk.min.es5.js +7 -7
- package/package.json +2 -1
- package/src/plugins/CxConverterIFCLoaderPlugin/CxConverterIFCLoaderPlugin.js +86 -0
- package/src/plugins/CxConverterIFCLoaderPlugin/index.js +1 -0
- package/src/plugins/index.js +1 -0
- package/src/plugins/lib/html/MenuEvent.js +2 -2
- package/src/viewer/scene/CameraControl/lib/handlers/TouchPickHandler.js +7 -6
- package/src/viewer/utils/os.js +9 -0
- package/dist/xeokit-sdk.es5.js.map +0 -1
- package/dist/xeokit-sdk.min.es5.js.map +0 -1
package/dist/xeokit-sdk.es5.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* xeokit-sdk v2.6.
|
|
3
|
-
* Commit:
|
|
4
|
-
* Built: 2025-07-
|
|
2
|
+
* xeokit-sdk v2.6.87
|
|
3
|
+
* Commit: 8fcdaeda55a3bd75b49a6cc6fe5d950fa3251f38
|
|
4
|
+
* Built: 2025-07-31T17:45:41.426Z
|
|
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 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 _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 _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;}/**
|
|
@@ -15623,7 +15623,8 @@ var id=curve;curve=this.scene.components[id];if(!curve){this.error("Component no
|
|
|
15623
15623
|
* @returns {boolean}
|
|
15624
15624
|
*/},{key:"snapped",get:function get(){return this.snappedToEdge||this.snappedToVertex;}/**
|
|
15625
15625
|
* @private
|
|
15626
|
-
*/},{key:"reset",value:function reset(){this.entity=null;this.primIndex=-1;this.primitive=null;this.pickSurfacePrecision=false;this._gotCanvasPos=false;this._gotSnappedCanvasPos=false;this._gotOrigin=false;this._gotDirection=false;this._gotIndices=false;this._gotLocalPos=false;this._gotWorldPos=false;this._gotViewPos=false;this._gotBary=false;this._gotWorldNormal=false;this._gotUV=false;this.touchInput=false;this.snappedToEdge=false;this.snappedToVertex=false;}}]);return PickResult;}();var os={isIphoneSafari:function isIphoneSafari(){var userAgent=window.navigator.userAgent;var isIphone=/iPhone/i.test(userAgent);var isSafari=/Safari/i.test(userAgent)&&!/Chrome/i.test(userAgent);return isIphone&&isSafari;},
|
|
15626
|
+
*/},{key:"reset",value:function reset(){this.entity=null;this.primIndex=-1;this.primitive=null;this.pickSurfacePrecision=false;this._gotCanvasPos=false;this._gotSnappedCanvasPos=false;this._gotOrigin=false;this._gotDirection=false;this._gotIndices=false;this._gotLocalPos=false;this._gotWorldPos=false;this._gotViewPos=false;this._gotBary=false;this._gotWorldNormal=false;this._gotUV=false;this.touchInput=false;this.snappedToEdge=false;this.snappedToVertex=false;}}]);return PickResult;}();var os={isIphoneSafari:function isIphoneSafari(){var userAgent=window.navigator.userAgent;var isIphone=/iPhone/i.test(userAgent);var isSafari=/Safari/i.test(userAgent)&&!/Chrome/i.test(userAgent);return isIphone&&isSafari;},isIphoneOrIpadSafari:function isIphoneOrIpadSafari(){var userAgent=window.navigator.userAgent;var isIphoneOrIpad=/iPhone|iPad/i.test(userAgent)||// iPad detection: Check for touch support and macOS-like user agent
|
|
15627
|
+
/Macintosh/i.test(userAgent)&&navigator.maxTouchPoints&&navigator.maxTouchPoints>2;var isSafari=/Safari/i.test(userAgent)&&!/Chrome/i.test(userAgent);return isIphoneOrIpad&&isSafari;},isTouchDevice:function isTouchDevice(){return'ontouchstart'in window||//works for most devices
|
|
15627
15628
|
navigator.maxTouchPoints>0||//works for modern touch devices
|
|
15628
15629
|
navigator.mxMaxTouchPoints>0//works for older microsoft touch devices
|
|
15629
15630
|
;}};/**
|
|
@@ -20593,8 +20594,8 @@ if(_camera2.projection==="perspective"){var pickedWorldPos=pickController.pickRe
|
|
|
20593
20594
|
*/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
|
|
20594
20595
|
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
|
|
20595
20596
|
}else{// Fly to fit target boundary in view
|
|
20596
|
-
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(){controllers.cameraControl.fire("rightClick",{// For context menus
|
|
20597
|
-
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 _i493=0,len=touches.length;_i493<len;++_i493){getCanvasPosFromEvent(touches[_i493],activeTouches[_i493]);}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
|
|
20597
|
+
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
|
|
20598
|
+
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 _i493=0,len=touches.length;_i493<len;++_i493){getCanvasPosFromEvent(touches[_i493],activeTouches[_i493]);}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
|
|
20598
20599
|
if(touches.length===0&&changedTouches.length===1){if(tapStartTime>-1&¤tTime-tapStartTime<TAP_INTERVAL){if(lastTapTime>-1&&tapStartTime-lastTapTime<DBL_TAP_INTERVAL){// Double-tap
|
|
20599
20600
|
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
|
|
20600
20601
|
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 _i494=0,len=touches.length;_i494<len;++_i494){activeTouches[_i494][0]=touches[_i494].pageX;activeTouches[_i494][1]=touches[_i494].pageY;}// e.stopPropagation();
|
|
@@ -22480,7 +22481,7 @@ console.error.apply(console,__spreadArray([this.id,this.getTime()+"ms"],args));}
|
|
|
22480
22481
|
var documentBackgroundColor=ownerDocument.documentElement?parseColor(context,getComputedStyle(ownerDocument.documentElement).backgroundColor):COLORS.TRANSPARENT;var bodyBackgroundColor=ownerDocument.body?parseColor(context,getComputedStyle(ownerDocument.body).backgroundColor):COLORS.TRANSPARENT;var defaultBackgroundColor=typeof backgroundColorOverride==='string'?parseColor(context,backgroundColorOverride):backgroundColorOverride===null?COLORS.TRANSPARENT:0xffffffff;return element===ownerDocument.documentElement?isTransparent(documentBackgroundColor)?isTransparent(bodyBackgroundColor)?defaultBackgroundColor:bodyBackgroundColor:documentBackgroundColor:defaultBackgroundColor;};//failCallback will be called when the press is not long enough to considered a long press
|
|
22481
22482
|
function addContextMenuListener(elem,callback){var failCallback=arguments.length>2&&arguments[2]!==undefined?arguments[2]:function(){};if(!elem||!callback)return;var timeout=null;var longPressTimer=500;var MOVE_THRESHOLD=3;var startX,startY;var touchStartHandler=function touchStartHandler(event){event.preventDefault();if(timeout){clearTimeout(timeout);timeout=null;}// If more than one finger touches the screen, cancel the timeout
|
|
22482
22483
|
if(event.touches.length>1)return;var touch=event.touches[0];startX=touch.clientX;startY=touch.clientY;timeout=setTimeout(function(){event.clientX=touch.clientX;event.clientY=touch.clientY;callback(event);clearTimeout(timeout);timeout=null;},longPressTimer);};var globalTouchStartHandler=function globalTouchStartHandler(event){// Cancel timeout if multiple touches are detected anywhere on the screen
|
|
22483
|
-
if(event.touches.length>1&&timeout){clearTimeout(timeout);timeout=null;}};var touchMoveHandler=function touchMoveHandler(event){if(!timeout)return;var touch=event.touches[0];var deltaX=Math.abs(touch.clientX-startX);var deltaY=Math.abs(touch.clientY-startY);if(deltaX>MOVE_THRESHOLD||deltaY>MOVE_THRESHOLD){clearTimeout(timeout);timeout=null;}};var touchEndHandler=function touchEndHandler(event){event.preventDefault();if(timeout){failCallback(event);clearTimeout(timeout);timeout=null;}};var contextMenuHandler=function contextMenuHandler(event){callback(event);event.preventDefault();event.stopPropagation();};if(os.isIphoneSafari()){elem.addEventListener('touchstart',touchStartHandler);elem.addEventListener('touchmove',touchMoveHandler);elem.addEventListener('touchend',touchEndHandler);window.addEventListener('touchstart',globalTouchStartHandler);}else{elem.addEventListener('contextmenu',contextMenuHandler);}return function removeContextMenuListener(){if(os.isIphoneSafari()){elem.removeEventListener('touchstart',touchStartHandler);elem.removeEventListener('touchmove',touchMoveHandler);elem.removeEventListener('touchend',touchEndHandler);window.removeEventListener('touchstart',globalTouchStartHandler);}else{elem.removeEventListener('contextmenu',contextMenuHandler);}};}/** @private */var Dot=/*#__PURE__*/function(){function Dot(parentElement){var _this91=this;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,Dot);this._highlightClass="viewer-ruler-dot-highlighted";this._x=0;this._y=0;this._dot=document.createElement('div');this._dot.className+=this._dot.className?' viewer-ruler-dot':'viewer-ruler-dot';this._dotClickable=document.createElement('div');this._dotClickable.className+=this._dotClickable.className?' viewer-ruler-dot-clickable':'viewer-ruler-dot-clickable';this._visible=cfg.visible!==false;this._culled=false;var dot=this._dot;var dotStyle=dot.style;dotStyle["border-radius"]=25+"px";dotStyle.border="solid 2px white";dotStyle.background="lightgreen";dotStyle.position="absolute";dotStyle["z-index"]=cfg.zIndex===undefined?"40000005":cfg.zIndex;dotStyle.width=8+"px";dotStyle.height=8+"px";dotStyle.visibility=this._visible?"visible":"hidden";dotStyle.top=0+"px";dotStyle.left=0+"px";dotStyle["box-shadow"]="0 2px 5px 0 #182A3D;";dotStyle["opacity"]=1.0;dotStyle["pointer-events"]="none";if(cfg.onContextMenu);parentElement.appendChild(dot);var dotClickable=this._dotClickable;var dotClickableStyle=dotClickable.style;dotClickableStyle["border-radius"]=35+"px";dotClickableStyle.border="solid 10px white";dotClickableStyle.position="absolute";dotClickableStyle["z-index"]=cfg.zIndex===undefined?"40000007":cfg.zIndex+1;dotClickableStyle.width=8+"px";dotClickableStyle.height=8+"px";dotClickableStyle.visibility="visible";dotClickableStyle.top=0+"px";dotClickableStyle.left=0+"px";dotClickableStyle["opacity"]=0.0;dotClickableStyle["pointer-events"]="none";if(cfg.onContextMenu);parentElement.appendChild(dotClickable);dotClickable.addEventListener('click',function(event){parentElement.dispatchEvent(new MouseEvent('mouseover',event));});if(cfg.onMouseOver){dotClickable.addEventListener('mouseover',function(event){cfg.onMouseOver(event,_this91);parentElement.dispatchEvent(new MouseEvent('mouseover',event));});}if(cfg.onMouseLeave){dotClickable.addEventListener('mouseleave',function(event){cfg.onMouseLeave(event,_this91);});}if(cfg.onMouseWheel){dotClickable.addEventListener('wheel',function(event){cfg.onMouseWheel(event,_this91);});}if(cfg.onMouseDown){dotClickable.addEventListener('mousedown',function(event){cfg.onMouseDown(event,_this91);});}if(cfg.onMouseUp){dotClickable.addEventListener('mouseup',function(event){cfg.onMouseUp(event,_this91);});}if(cfg.onMouseMove){dotClickable.addEventListener('mousemove',function(event){cfg.onMouseMove(event,_this91);});}if(cfg.onTouchstart){dotClickable.addEventListener('touchstart',function(event){cfg.onTouchstart(event,_this91);});}if(cfg.onTouchmove){dotClickable.addEventListener('touchmove',function(event){cfg.onTouchmove(event,_this91);});}if(cfg.onTouchend){dotClickable.addEventListener('touchend',function(event){cfg.onTouchend(event,_this91);});}if(cfg.onContextMenu){var contextMenuCallback=function contextMenuCallback(event){cfg.onContextMenu(event,_this91);};addContextMenuListener(dotClickable,contextMenuCallback);}this.setPos(cfg.x||0,cfg.y||0);this.setFillColor(cfg.fillColor);this.setBorderColor(cfg.borderColor);}_createClass(Dot,[{key:"setPos",value:function setPos(x,y){this._x=x;this._y=y;var dotStyle=this._dot.style;dotStyle["left"]=Math.round(x)-6+'px';dotStyle["top"]=Math.round(y)-6+'px';var dotClickableStyle=this._dotClickable.style;dotClickableStyle["left"]=Math.round(x)-14+'px';dotClickableStyle["top"]=Math.round(y)-14+'px';}},{key:"setFillColor",value:function setFillColor(color){this._dot.style.background=color||"lightgreen";}},{key:"setBorderColor",value:function setBorderColor(color){this._dot.style.border="solid 2px"+(color||"black");}},{key:"setOpacity",value:function setOpacity(opacity){this._dot.style.opacity=opacity;}},{key:"_updateVisibility",value:function _updateVisibility(){this._dot.style.visibility=this._dotClickable.style.visibility=this._visible&&!this._culled?"visible":"hidden";}},{key:"setVisible",value:function setVisible(visible){if(this._visible===visible){return;}this._visible=!!visible;this._updateVisibility();}},{key:"setCulled",value:function setCulled(culled){if(this._culled===culled){return;}this._culled=!!culled;this._updateVisibility();}},{key:"setClickable",value:function setClickable(clickable){this._dotClickable.style["pointer-events"]=clickable?"all":"none";}},{key:"setHighlighted",value:function setHighlighted(highlighted){if(this._highlighted===highlighted){return;}this._highlighted=!!highlighted;if(this._highlighted){this._dot.classList.add(this._highlightClass);}else{this._dot.classList.remove(this._highlightClass);}}},{key:"destroy",value:function destroy(){this.setVisible(false);if(this._dot.parentElement){this._dot.parentElement.removeChild(this._dot);}if(this._dotClickable.parentElement){this._dotClickable.parentElement.removeChild(this._dotClickable);}}}]);return Dot;}();/** @private */var Label=/*#__PURE__*/function(){function Label(parentElement){var _this92=this;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,Label);this._highlightClass="viewer-ruler-label-highlighted";this._prefix=cfg.prefix||"";this._x=0;this._y=0;this._visible=true;this._culled=false;this._label=document.createElement('div');this._label.className+=this._label.className?' viewer-ruler-label':'viewer-ruler-label';this._timeout=null;var label=this._label;var style=label.style;style["border-radius"]=5+"px";style.color="white";style.padding="4px";style.border="solid 1px";style.background="lightgreen";style.position="absolute";style["z-index"]=cfg.zIndex===undefined?"5000005":cfg.zIndex;style.width="auto";style.height="auto";style.visibility="visible";style.top=0+"px";style.left=0+"px";style["pointer-events"]="all";style["opacity"]=1.0;if(cfg.onContextMenu);label.innerText="";parentElement.appendChild(label);this.setPos(cfg.x||0,cfg.y||0);this.setFillColor(cfg.fillColor);this.setBorderColor(cfg.fillColor);this.setText(cfg.text);if(cfg.onMouseOver){label.addEventListener('mouseover',function(event){cfg.onMouseOver(event,_this92);event.preventDefault();});}if(cfg.onMouseLeave){label.addEventListener('mouseleave',function(event){cfg.onMouseLeave(event,_this92);event.preventDefault();});}if(cfg.onMouseWheel){label.addEventListener('wheel',function(event){cfg.onMouseWheel(event,_this92);});}if(cfg.onMouseDown){label.addEventListener('mousedown',function(event){cfg.onMouseDown(event,_this92);event.stopPropagation();});}if(cfg.onMouseUp){label.addEventListener('mouseup',function(event){cfg.onMouseUp(event,_this92);event.stopPropagation();});}if(cfg.onMouseMove){label.addEventListener('mousemove',function(event){cfg.onMouseMove(event,_this92);});}if(cfg.onContextMenu){var contextMenuCallback=function contextMenuCallback(event){cfg.onContextMenu(event,_this92);};addContextMenuListener(label,contextMenuCallback);}}_createClass(Label,[{key:"setPos",value:function setPos(x,y){this._x=x;this._y=y;var style=this._label.style;style["left"]=Math.round(x)-20+'px';style["top"]=Math.round(y)-12+'px';}},{key:"setPosOnWire",value:function setPosOnWire(x1,y1,x2,y2){var x=x1+(x2-x1)*0.5;var y=y1+(y2-y1)*0.5;var style=this._label.style;style["left"]=Math.round(x)-20+'px';style["top"]=Math.round(y)-12+'px';}},{key:"setPosBetweenWires",value:function setPosBetweenWires(x1,y1,x2,y2,x3,y3){var x=(x1+x2+x3)/3;var y=(y1+y2+y3)/3;var style=this._label.style;style["left"]=Math.round(x)-20+'px';style["top"]=Math.round(y)-12+'px';}},{key:"setText",value:function setText(text){this._label.innerHTML=this._prefix+(text||"");}},{key:"setFillColor",value:function setFillColor(color){this._fillColor=color||"lightgreen";this._label.style.background=this._fillColor;}},{key:"setBorderColor",value:function setBorderColor(color){this._borderColor=color||"black";this._label.style.border="solid 1px "+this._borderColor;}},{key:"setOpacity",value:function setOpacity(opacity){this._label.style.opacity=opacity;}},{key:"_updateVisibility",value:function _updateVisibility(){this._label.style.visibility=this._visible&&!this._culled?"visible":"hidden";}},{key:"setVisible",value:function setVisible(visible){if(this._visible===visible){return;}this._visible=!!visible;this._updateVisibility();}},{key:"setCulled",value:function setCulled(culled){if(this._culled===culled){return;}this._culled=!!culled;this._updateVisibility();}},{key:"setHighlighted",value:function setHighlighted(highlighted){if(this._highlighted===highlighted){return;}this._highlighted=!!highlighted;if(this._highlighted){this._label.classList.add(this._highlightClass);}else{this._label.classList.remove(this._highlightClass);}}},{key:"setClickable",value:function setClickable(clickable){this._label.style["pointer-events"]=clickable?"all":"none";}},{key:"setPrefix",value:function setPrefix(prefix){if(this._prefix===prefix){return;}this._prefix=prefix;}},{key:"destroy",value:function destroy(){if(this._label.parentElement){this._label.parentElement.removeChild(this._label);}}}]);return Label;}();/** @private */var Wire=/*#__PURE__*/function(){function Wire(parentElement){var _this93=this;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,Wire);this._color=cfg.color||"black";this._highlightClass="viewer-ruler-wire-highlighted";this._wire=document.createElement('div');this._wire.className+=this._wire.className?' viewer-ruler-wire':'viewer-ruler-wire';this._wireClickable=document.createElement('div');this._wireClickable.className+=this._wireClickable.className?' viewer-ruler-wire-clickable':'viewer-ruler-wire-clickable';this._thickness=cfg.thickness||1.0;this._thicknessClickable=cfg.thicknessClickable||6.0;this._visible=true;this._culled=false;var wire=this._wire;var wireStyle=wire.style;wireStyle.border="solid "+this._thickness+"px "+this._color;wireStyle.position="absolute";wireStyle["z-index"]=cfg.zIndex===undefined?"2000001":cfg.zIndex;wireStyle.width=0+"px";wireStyle.height=0+"px";wireStyle.visibility="visible";wireStyle.top=0+"px";wireStyle.left=0+"px";wireStyle['-webkit-transform-origin']="0 0";wireStyle['-moz-transform-origin']="0 0";wireStyle['-ms-transform-origin']="0 0";wireStyle['-o-transform-origin']="0 0";wireStyle['transform-origin']="0 0";wireStyle['-webkit-transform']='rotate(0deg)';wireStyle['-moz-transform']='rotate(0deg)';wireStyle['-ms-transform']='rotate(0deg)';wireStyle['-o-transform']='rotate(0deg)';wireStyle['transform']='rotate(0deg)';wireStyle["opacity"]=1.0;wireStyle["pointer-events"]="none";if(cfg.onContextMenu);parentElement.appendChild(wire);var wireClickable=this._wireClickable;var wireClickableStyle=wireClickable.style;wireClickableStyle.border="solid "+this._thicknessClickable+"px "+this._color;wireClickableStyle.position="absolute";wireClickableStyle["z-index"]=cfg.zIndex===undefined?"2000002":cfg.zIndex+1;wireClickableStyle.width=0+"px";wireClickableStyle.height=0+"px";wireClickableStyle.visibility="visible";wireClickableStyle.top=0+"px";wireClickableStyle.left=0+"px";// wireClickableStyle["pointer-events"] = "none";
|
|
22484
|
+
if(event.touches.length>1&&timeout){clearTimeout(timeout);timeout=null;}};var touchMoveHandler=function touchMoveHandler(event){if(!timeout)return;var touch=event.touches[0];var deltaX=Math.abs(touch.clientX-startX);var deltaY=Math.abs(touch.clientY-startY);if(deltaX>MOVE_THRESHOLD||deltaY>MOVE_THRESHOLD){clearTimeout(timeout);timeout=null;}};var touchEndHandler=function touchEndHandler(event){event.preventDefault();if(timeout){failCallback(event);clearTimeout(timeout);timeout=null;}};var contextMenuHandler=function contextMenuHandler(event){callback(event);event.preventDefault();event.stopPropagation();};if(os.isIphoneOrIpadSafari()){elem.addEventListener('touchstart',touchStartHandler);elem.addEventListener('touchmove',touchMoveHandler);elem.addEventListener('touchend',touchEndHandler);window.addEventListener('touchstart',globalTouchStartHandler);}else{elem.addEventListener('contextmenu',contextMenuHandler);}return function removeContextMenuListener(){if(os.isIphoneOrIpadSafari()){elem.removeEventListener('touchstart',touchStartHandler);elem.removeEventListener('touchmove',touchMoveHandler);elem.removeEventListener('touchend',touchEndHandler);window.removeEventListener('touchstart',globalTouchStartHandler);}else{elem.removeEventListener('contextmenu',contextMenuHandler);}};}/** @private */var Dot=/*#__PURE__*/function(){function Dot(parentElement){var _this91=this;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,Dot);this._highlightClass="viewer-ruler-dot-highlighted";this._x=0;this._y=0;this._dot=document.createElement('div');this._dot.className+=this._dot.className?' viewer-ruler-dot':'viewer-ruler-dot';this._dotClickable=document.createElement('div');this._dotClickable.className+=this._dotClickable.className?' viewer-ruler-dot-clickable':'viewer-ruler-dot-clickable';this._visible=cfg.visible!==false;this._culled=false;var dot=this._dot;var dotStyle=dot.style;dotStyle["border-radius"]=25+"px";dotStyle.border="solid 2px white";dotStyle.background="lightgreen";dotStyle.position="absolute";dotStyle["z-index"]=cfg.zIndex===undefined?"40000005":cfg.zIndex;dotStyle.width=8+"px";dotStyle.height=8+"px";dotStyle.visibility=this._visible?"visible":"hidden";dotStyle.top=0+"px";dotStyle.left=0+"px";dotStyle["box-shadow"]="0 2px 5px 0 #182A3D;";dotStyle["opacity"]=1.0;dotStyle["pointer-events"]="none";if(cfg.onContextMenu);parentElement.appendChild(dot);var dotClickable=this._dotClickable;var dotClickableStyle=dotClickable.style;dotClickableStyle["border-radius"]=35+"px";dotClickableStyle.border="solid 10px white";dotClickableStyle.position="absolute";dotClickableStyle["z-index"]=cfg.zIndex===undefined?"40000007":cfg.zIndex+1;dotClickableStyle.width=8+"px";dotClickableStyle.height=8+"px";dotClickableStyle.visibility="visible";dotClickableStyle.top=0+"px";dotClickableStyle.left=0+"px";dotClickableStyle["opacity"]=0.0;dotClickableStyle["pointer-events"]="none";if(cfg.onContextMenu);parentElement.appendChild(dotClickable);dotClickable.addEventListener('click',function(event){parentElement.dispatchEvent(new MouseEvent('mouseover',event));});if(cfg.onMouseOver){dotClickable.addEventListener('mouseover',function(event){cfg.onMouseOver(event,_this91);parentElement.dispatchEvent(new MouseEvent('mouseover',event));});}if(cfg.onMouseLeave){dotClickable.addEventListener('mouseleave',function(event){cfg.onMouseLeave(event,_this91);});}if(cfg.onMouseWheel){dotClickable.addEventListener('wheel',function(event){cfg.onMouseWheel(event,_this91);});}if(cfg.onMouseDown){dotClickable.addEventListener('mousedown',function(event){cfg.onMouseDown(event,_this91);});}if(cfg.onMouseUp){dotClickable.addEventListener('mouseup',function(event){cfg.onMouseUp(event,_this91);});}if(cfg.onMouseMove){dotClickable.addEventListener('mousemove',function(event){cfg.onMouseMove(event,_this91);});}if(cfg.onTouchstart){dotClickable.addEventListener('touchstart',function(event){cfg.onTouchstart(event,_this91);});}if(cfg.onTouchmove){dotClickable.addEventListener('touchmove',function(event){cfg.onTouchmove(event,_this91);});}if(cfg.onTouchend){dotClickable.addEventListener('touchend',function(event){cfg.onTouchend(event,_this91);});}if(cfg.onContextMenu){var contextMenuCallback=function contextMenuCallback(event){cfg.onContextMenu(event,_this91);};addContextMenuListener(dotClickable,contextMenuCallback);}this.setPos(cfg.x||0,cfg.y||0);this.setFillColor(cfg.fillColor);this.setBorderColor(cfg.borderColor);}_createClass(Dot,[{key:"setPos",value:function setPos(x,y){this._x=x;this._y=y;var dotStyle=this._dot.style;dotStyle["left"]=Math.round(x)-6+'px';dotStyle["top"]=Math.round(y)-6+'px';var dotClickableStyle=this._dotClickable.style;dotClickableStyle["left"]=Math.round(x)-14+'px';dotClickableStyle["top"]=Math.round(y)-14+'px';}},{key:"setFillColor",value:function setFillColor(color){this._dot.style.background=color||"lightgreen";}},{key:"setBorderColor",value:function setBorderColor(color){this._dot.style.border="solid 2px"+(color||"black");}},{key:"setOpacity",value:function setOpacity(opacity){this._dot.style.opacity=opacity;}},{key:"_updateVisibility",value:function _updateVisibility(){this._dot.style.visibility=this._dotClickable.style.visibility=this._visible&&!this._culled?"visible":"hidden";}},{key:"setVisible",value:function setVisible(visible){if(this._visible===visible){return;}this._visible=!!visible;this._updateVisibility();}},{key:"setCulled",value:function setCulled(culled){if(this._culled===culled){return;}this._culled=!!culled;this._updateVisibility();}},{key:"setClickable",value:function setClickable(clickable){this._dotClickable.style["pointer-events"]=clickable?"all":"none";}},{key:"setHighlighted",value:function setHighlighted(highlighted){if(this._highlighted===highlighted){return;}this._highlighted=!!highlighted;if(this._highlighted){this._dot.classList.add(this._highlightClass);}else{this._dot.classList.remove(this._highlightClass);}}},{key:"destroy",value:function destroy(){this.setVisible(false);if(this._dot.parentElement){this._dot.parentElement.removeChild(this._dot);}if(this._dotClickable.parentElement){this._dotClickable.parentElement.removeChild(this._dotClickable);}}}]);return Dot;}();/** @private */var Label=/*#__PURE__*/function(){function Label(parentElement){var _this92=this;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,Label);this._highlightClass="viewer-ruler-label-highlighted";this._prefix=cfg.prefix||"";this._x=0;this._y=0;this._visible=true;this._culled=false;this._label=document.createElement('div');this._label.className+=this._label.className?' viewer-ruler-label':'viewer-ruler-label';this._timeout=null;var label=this._label;var style=label.style;style["border-radius"]=5+"px";style.color="white";style.padding="4px";style.border="solid 1px";style.background="lightgreen";style.position="absolute";style["z-index"]=cfg.zIndex===undefined?"5000005":cfg.zIndex;style.width="auto";style.height="auto";style.visibility="visible";style.top=0+"px";style.left=0+"px";style["pointer-events"]="all";style["opacity"]=1.0;if(cfg.onContextMenu);label.innerText="";parentElement.appendChild(label);this.setPos(cfg.x||0,cfg.y||0);this.setFillColor(cfg.fillColor);this.setBorderColor(cfg.fillColor);this.setText(cfg.text);if(cfg.onMouseOver){label.addEventListener('mouseover',function(event){cfg.onMouseOver(event,_this92);event.preventDefault();});}if(cfg.onMouseLeave){label.addEventListener('mouseleave',function(event){cfg.onMouseLeave(event,_this92);event.preventDefault();});}if(cfg.onMouseWheel){label.addEventListener('wheel',function(event){cfg.onMouseWheel(event,_this92);});}if(cfg.onMouseDown){label.addEventListener('mousedown',function(event){cfg.onMouseDown(event,_this92);event.stopPropagation();});}if(cfg.onMouseUp){label.addEventListener('mouseup',function(event){cfg.onMouseUp(event,_this92);event.stopPropagation();});}if(cfg.onMouseMove){label.addEventListener('mousemove',function(event){cfg.onMouseMove(event,_this92);});}if(cfg.onContextMenu){var contextMenuCallback=function contextMenuCallback(event){cfg.onContextMenu(event,_this92);};addContextMenuListener(label,contextMenuCallback);}}_createClass(Label,[{key:"setPos",value:function setPos(x,y){this._x=x;this._y=y;var style=this._label.style;style["left"]=Math.round(x)-20+'px';style["top"]=Math.round(y)-12+'px';}},{key:"setPosOnWire",value:function setPosOnWire(x1,y1,x2,y2){var x=x1+(x2-x1)*0.5;var y=y1+(y2-y1)*0.5;var style=this._label.style;style["left"]=Math.round(x)-20+'px';style["top"]=Math.round(y)-12+'px';}},{key:"setPosBetweenWires",value:function setPosBetweenWires(x1,y1,x2,y2,x3,y3){var x=(x1+x2+x3)/3;var y=(y1+y2+y3)/3;var style=this._label.style;style["left"]=Math.round(x)-20+'px';style["top"]=Math.round(y)-12+'px';}},{key:"setText",value:function setText(text){this._label.innerHTML=this._prefix+(text||"");}},{key:"setFillColor",value:function setFillColor(color){this._fillColor=color||"lightgreen";this._label.style.background=this._fillColor;}},{key:"setBorderColor",value:function setBorderColor(color){this._borderColor=color||"black";this._label.style.border="solid 1px "+this._borderColor;}},{key:"setOpacity",value:function setOpacity(opacity){this._label.style.opacity=opacity;}},{key:"_updateVisibility",value:function _updateVisibility(){this._label.style.visibility=this._visible&&!this._culled?"visible":"hidden";}},{key:"setVisible",value:function setVisible(visible){if(this._visible===visible){return;}this._visible=!!visible;this._updateVisibility();}},{key:"setCulled",value:function setCulled(culled){if(this._culled===culled){return;}this._culled=!!culled;this._updateVisibility();}},{key:"setHighlighted",value:function setHighlighted(highlighted){if(this._highlighted===highlighted){return;}this._highlighted=!!highlighted;if(this._highlighted){this._label.classList.add(this._highlightClass);}else{this._label.classList.remove(this._highlightClass);}}},{key:"setClickable",value:function setClickable(clickable){this._label.style["pointer-events"]=clickable?"all":"none";}},{key:"setPrefix",value:function setPrefix(prefix){if(this._prefix===prefix){return;}this._prefix=prefix;}},{key:"destroy",value:function destroy(){if(this._label.parentElement){this._label.parentElement.removeChild(this._label);}}}]);return Label;}();/** @private */var Wire=/*#__PURE__*/function(){function Wire(parentElement){var _this93=this;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,Wire);this._color=cfg.color||"black";this._highlightClass="viewer-ruler-wire-highlighted";this._wire=document.createElement('div');this._wire.className+=this._wire.className?' viewer-ruler-wire':'viewer-ruler-wire';this._wireClickable=document.createElement('div');this._wireClickable.className+=this._wireClickable.className?' viewer-ruler-wire-clickable':'viewer-ruler-wire-clickable';this._thickness=cfg.thickness||1.0;this._thicknessClickable=cfg.thicknessClickable||6.0;this._visible=true;this._culled=false;var wire=this._wire;var wireStyle=wire.style;wireStyle.border="solid "+this._thickness+"px "+this._color;wireStyle.position="absolute";wireStyle["z-index"]=cfg.zIndex===undefined?"2000001":cfg.zIndex;wireStyle.width=0+"px";wireStyle.height=0+"px";wireStyle.visibility="visible";wireStyle.top=0+"px";wireStyle.left=0+"px";wireStyle['-webkit-transform-origin']="0 0";wireStyle['-moz-transform-origin']="0 0";wireStyle['-ms-transform-origin']="0 0";wireStyle['-o-transform-origin']="0 0";wireStyle['transform-origin']="0 0";wireStyle['-webkit-transform']='rotate(0deg)';wireStyle['-moz-transform']='rotate(0deg)';wireStyle['-ms-transform']='rotate(0deg)';wireStyle['-o-transform']='rotate(0deg)';wireStyle['transform']='rotate(0deg)';wireStyle["opacity"]=1.0;wireStyle["pointer-events"]="none";if(cfg.onContextMenu);parentElement.appendChild(wire);var wireClickable=this._wireClickable;var wireClickableStyle=wireClickable.style;wireClickableStyle.border="solid "+this._thicknessClickable+"px "+this._color;wireClickableStyle.position="absolute";wireClickableStyle["z-index"]=cfg.zIndex===undefined?"2000002":cfg.zIndex+1;wireClickableStyle.width=0+"px";wireClickableStyle.height=0+"px";wireClickableStyle.visibility="visible";wireClickableStyle.top=0+"px";wireClickableStyle.left=0+"px";// wireClickableStyle["pointer-events"] = "none";
|
|
22484
22485
|
wireClickableStyle['-webkit-transform-origin']="0 0";wireClickableStyle['-moz-transform-origin']="0 0";wireClickableStyle['-ms-transform-origin']="0 0";wireClickableStyle['-o-transform-origin']="0 0";wireClickableStyle['transform-origin']="0 0";wireClickableStyle['-webkit-transform']='rotate(0deg)';wireClickableStyle['-moz-transform']='rotate(0deg)';wireClickableStyle['-ms-transform']='rotate(0deg)';wireClickableStyle['-o-transform']='rotate(0deg)';wireClickableStyle['transform']='rotate(0deg)';wireClickableStyle["opacity"]=0.0;wireClickableStyle["pointer-events"]="none";if(cfg.onContextMenu);parentElement.appendChild(wireClickable);if(cfg.onMouseOver){wireClickable.addEventListener('mouseover',function(event){cfg.onMouseOver(event,_this93);});}if(cfg.onMouseLeave){wireClickable.addEventListener('mouseleave',function(event){cfg.onMouseLeave(event,_this93);});}if(cfg.onMouseWheel){wireClickable.addEventListener('wheel',function(event){cfg.onMouseWheel(event,_this93);});}if(cfg.onMouseDown){wireClickable.addEventListener('mousedown',function(event){cfg.onMouseDown(event,_this93);});}if(cfg.onMouseUp){wireClickable.addEventListener('mouseup',function(event){cfg.onMouseUp(event,_this93);});}if(cfg.onMouseMove){wireClickable.addEventListener('mousemove',function(event){cfg.onMouseMove(event,_this93);});}if(cfg.onContextMenu){var contextMenuCallback=function contextMenuCallback(event){cfg.onContextMenu(event,_this93);};addContextMenuListener(wireClickable,contextMenuCallback);}this._x1=0;this._y1=0;this._x2=0;this._y2=0;this._update();}_createClass(Wire,[{key:"visible",get:function get(){return this._wire.style.visibility==="visible";}},{key:"_update",value:function _update(){var length=Math.abs(Math.sqrt((this._x1-this._x2)*(this._x1-this._x2)+(this._y1-this._y2)*(this._y1-this._y2)));var angle=Math.atan2(this._y2-this._y1,this._x2-this._x1)*180.0/Math.PI;var wireStyle=this._wire.style;wireStyle["width"]=Math.round(length)+'px';wireStyle["left"]=Math.round(this._x1)+'px';wireStyle["top"]=Math.round(this._y1)+'px';wireStyle['-webkit-transform']=wireStyle['-moz-transform']=wireStyle['-ms-transform']=wireStyle['-o-transform']=wireStyle['transform']='rotate('+angle+'deg) translate(-'+this._thickness+'px, -'+this._thickness+'px)';var wireClickableStyle=this._wireClickable.style;wireClickableStyle["width"]=Math.round(length)+'px';wireClickableStyle["left"]=Math.round(this._x1)+'px';wireClickableStyle["top"]=Math.round(this._y1)+'px';wireClickableStyle['-webkit-transform']=wireClickableStyle['-moz-transform']=wireClickableStyle['-ms-transform']=wireClickableStyle['-o-transform']=wireClickableStyle['transform']='rotate('+angle+'deg) translate(-'+this._thicknessClickable+'px, -'+this._thicknessClickable+'px)';}},{key:"setStartAndEnd",value:function setStartAndEnd(x1,y1,x2,y2){this._x1=x1;this._y1=y1;this._x2=x2;this._y2=y2;this._update();}},{key:"setColor",value:function setColor(color){this._color=color||"black";this._wire.style.border="solid "+this._thickness+"px "+this._color;}},{key:"setOpacity",value:function setOpacity(opacity){this._wire.style.opacity=opacity;}},{key:"_updateVisibility",value:function _updateVisibility(){this._wire.style.visibility=this._wireClickable.style.visibility=this._visible&&!this._culled?"visible":"hidden";}},{key:"setVisible",value:function setVisible(visible){if(this._visible===visible){return;}this._visible=!!visible;this._updateVisibility();}},{key:"setCulled",value:function setCulled(culled){if(this._culled===culled){return;}this._culled=!!culled;this._updateVisibility();}},{key:"setClickable",value:function setClickable(clickable){this._wireClickable.style["pointer-events"]=clickable?"all":"none";}},{key:"setHighlighted",value:function setHighlighted(highlighted){if(this._highlighted===highlighted){return;}this._highlighted=!!highlighted;if(this._highlighted){this._wire.classList.add(this._highlightClass);}else{this._wire.classList.remove(this._highlightClass);}}},{key:"destroy",value:function destroy(visible){if(this._wire.parentElement){this._wire.parentElement.removeChild(this._wire);}if(this._wireClickable.parentElement){this._wireClickable.parentElement.removeChild(this._wireClickable);}}}]);return Wire;}();var tmpVec2a=math.vec2();var tmpVec2b=math.vec2();var tmpVec2c=math.vec2();var tmpVec2d=math.vec2();var tmpVec3a$2=math.vec3();var tmpVec3b$2=math.vec3();var tmpVec4a=math.vec4();var tmpVec4b=math.vec4();var tmpVec4c=math.vec4();var tmpVec4d=math.vec4();var tmpMat4=math.mat4();var tmpRay={origin:math.vec3(),direction:math.vec3()};var nop=function nop(){};var planeIntersect$1=function planeIntersect$1(p0,n,origin,direction){var t=(p0-math.dotVec3(origin,n))/math.dotVec3(direction,n);if(t<0){return null;}else{var worldPos=math.vec3();math.mulVec3Scalar(direction,t,worldPos);math.addVec3(origin,worldPos,worldPos);return worldPos;}};function transformToNode(from,to,vec){var fromRec=from.getBoundingClientRect();var toRec=to.getBoundingClientRect();vec[0]+=fromRec.left-toRec.left;vec[1]+=fromRec.top-toRec.top;}var toClipSpace=function toClipSpace(camera,worldPos,p){// The reason the projMatrix is explicitely fetched as below is a complex callback chain
|
|
22485
22486
|
// leading from a boundary update to a viewMatrix and projMatrix updates, which change their values
|
|
22486
22487
|
// in the mid of the toClipSpace, leading to incorrect values.
|
|
@@ -22742,14 +22743,14 @@ for(var _i525=0,len=plugins.length;_i525<len;_i525++){var plugin=plugins[_i525];
|
|
|
22742
22743
|
*/function createCombinedTexture(_x7,_x8){return _createCombinedTexture.apply(this,arguments);}/**
|
|
22743
22744
|
* @param {Component} scene
|
|
22744
22745
|
* @param {Texture} [texture] Texture to be used on the skybox mesh
|
|
22745
|
-
*/function _createCombinedTexture(){_createCombinedTexture=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
22746
|
+
*/function _createCombinedTexture(){_createCombinedTexture=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee19(scene,cfg){var _cfg$src,posX,negX,posY,negY,posZ,negZ,canvas,ctx,loadImage,_yield$Promise$all,_yield$Promise$all2,imgPosX,imgNegX,imgPosY,imgNegY,imgPosZ,imgNegZ,imageSize,combinedTexture;return _regeneratorRuntime().wrap(function _callee19$(_context23){while(1){switch(_context23.prev=_context23.next){case 0:if(!(!cfg.src||!Array.isArray(cfg.src)||cfg.src.length!==6)){_context23.next=2;break;}throw new Error("src requires path to 6 images");case 2:_cfg$src=_slicedToArray(cfg.src,6),posX=_cfg$src[0],negX=_cfg$src[1],posY=_cfg$src[2],negY=_cfg$src[3],posZ=_cfg$src[4],negZ=_cfg$src[5];if(!(!posX||!negX||!posY||!negY||!posZ||!negZ)){_context23.next=5;break;}throw new Error("All six images must be provided");case 5:canvas=document.createElement('canvas');ctx=canvas.getContext('2d');loadImage=function loadImage(src){return new Promise(function(resolve,reject){var img=new Image();img.crossOrigin="anonymous";img.onload=function(){return resolve(img);};img.onerror=function(){return reject(new Error("Failed to load image: ".concat(src)));};img.src=src;});};_context23.prev=8;_context23.next=11;return Promise.all([loadImage(posX),loadImage(negX),loadImage(posY),loadImage(negY),loadImage(posZ),loadImage(negZ)]);case 11:_yield$Promise$all=_context23.sent;_yield$Promise$all2=_slicedToArray(_yield$Promise$all,6);imgPosX=_yield$Promise$all2[0];imgNegX=_yield$Promise$all2[1];imgPosY=_yield$Promise$all2[2];imgNegY=_yield$Promise$all2[3];imgPosZ=_yield$Promise$all2[4];imgNegZ=_yield$Promise$all2[5];imageSize=imgPosX.width;if(!(imgNegX.width!==imageSize||imgPosY.width!==imageSize||imgNegY.width!==imageSize||imgPosZ.width!==imageSize||imgNegZ.width!==imageSize)){_context23.next=22;break;}throw new Error("All skybox textures must have the same dimensions");case 22:// Set canvas size for the Christ cross layout (3×4 grid)
|
|
22746
22747
|
canvas.width=imageSize*4;canvas.height=imageSize*3;ctx.fillStyle='black';ctx.fillRect(0,0,canvas.width,canvas.height);ctx.drawImage(imgNegX,imageSize*0,imageSize*1,imageSize,imageSize);// -X (left)
|
|
22747
22748
|
ctx.drawImage(imgPosX,imageSize*2,imageSize*1,imageSize,imageSize);// +X (right)
|
|
22748
22749
|
ctx.drawImage(imgPosY,imageSize*1,imageSize*0,imageSize,imageSize);// +Y (top)
|
|
22749
22750
|
ctx.drawImage(imgNegY,imageSize*1,imageSize*2,imageSize,imageSize);// -Y (bottom)
|
|
22750
22751
|
ctx.drawImage(imgPosZ,imageSize*1,imageSize*1,imageSize,imageSize);// +Z (front)
|
|
22751
22752
|
ctx.drawImage(imgNegZ,imageSize*3,imageSize*1,imageSize,imageSize);// -Z (back)
|
|
22752
|
-
combinedTexture=new Texture(scene,{image:canvas,flipY:true,wrapS:ClampToEdgeWrapping,wrapT:ClampToEdgeWrapping,encoding:cfg.encoding||LinearEncoding});return
|
|
22753
|
+
combinedTexture=new Texture(scene,{image:canvas,flipY:true,wrapS:ClampToEdgeWrapping,wrapT:ClampToEdgeWrapping,encoding:cfg.encoding||LinearEncoding});return _context23.abrupt("return",combinedTexture);case 36:_context23.prev=36;_context23.t0=_context23["catch"](8);console.error("Error creating combined skybox texture:",_context23.t0);throw _context23.t0;case 40:case"end":return _context23.stop();}}},_callee19,null,[[8,36]]);}));return _createCombinedTexture.apply(this,arguments);}function createSkyboxMesh(scene,texture){return new Mesh(scene,{geometry:new ReadableGeometry(scene,{// Box-shaped geometry
|
|
22753
22754
|
primitive:"triangles",positions:[1,1,1,-1,1,1,-1,-1,1,1,-1,1,// v0-v1-v2-v3 front
|
|
22754
22755
|
1,1,1,1,-1,1,1,-1,-1,1,1,-1,// v0-v3-v4-v5 right
|
|
22755
22756
|
1,1,1,1,1,-1,-1,1,-1,-1,1,1,// v0-v5-v6-v1 top
|
|
@@ -25524,7 +25525,7 @@ var isBase64=!!dataUriRegexResult[2];var data=dataUriRegexResult[3];data=window.
|
|
|
25524
25525
|
function parseFromContext(_x9,_x10,_x11,_x12){return _parseFromContext.apply(this,arguments);}/**
|
|
25525
25526
|
* Throws an `Error` with the optional `message` if `condition` is falsy
|
|
25526
25527
|
* @note Replacement for the external assert method to reduce bundle size
|
|
25527
|
-
*/function _parseFromContext(){_parseFromContext=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
25528
|
+
*/function _parseFromContext(){_parseFromContext=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee20(data,loaders,options,context){return _regeneratorRuntime().wrap(function _callee20$(_context24){while(1){switch(_context24.prev=_context24.next){case 0:return _context24.abrupt("return",context._parse(data,loaders,options,context));case 1:case"end":return _context24.stop();}}},_callee20);}));return _parseFromContext.apply(this,arguments);}function assert$4(condition,message){if(!condition){throw new Error(message||'loader assertion failed.');}}// Purpose: include this in your module to avoid
|
|
25528
25529
|
/** true if running in a browser */var isBrowser$2=// @ts-ignore process does not exist on browser
|
|
25529
25530
|
Boolean((typeof process==="undefined"?"undefined":_typeof(process))!=='object'||String(process)!=='[object process]'||process.browser);// Extract node major version
|
|
25530
25531
|
var matches$1=typeof process!=='undefined'&&process.version&&/v([0-9]*)/.exec(process.version);/** Major Node version (as a number) */matches$1&&parseFloat(matches$1[1])||0;// Do not name these variables the same as the global objects - will break bundling
|
|
@@ -25620,8 +25621,8 @@ return Object.assign(opts,{args:args},opts.opts);}function decorateMessage(id,me
|
|
|
25620
25621
|
// Version constant cannot be imported, it needs to correspond to the build version of **this** module.
|
|
25621
25622
|
// __VERSION__ is injected by babel-plugin-version-inline
|
|
25622
25623
|
// @ts-ignore TS2304: Cannot find name '__VERSION__'.
|
|
25623
|
-
var VERSION$6="4.3.2";var version=VERSION$6[0]>='0'&&VERSION$6[0]<='9'?"v".concat(VERSION$6):'';// Make sure we set the global variable
|
|
25624
|
-
function createLog(){var log=new Log({id:'loaders.gl'});globalThis.loaders=globalThis.loaders||{};globalThis.loaders.log=log;globalThis.loaders.version=version;globalThis.probe=globalThis.probe||{};globalThis.probe.loaders=log;return log;}var log=createLog();// loaders.gl
|
|
25624
|
+
var VERSION$6="4.3.2";var version$1=VERSION$6[0]>='0'&&VERSION$6[0]<='9'?"v".concat(VERSION$6):'';// Make sure we set the global variable
|
|
25625
|
+
function createLog(){var log=new Log({id:'loaders.gl'});globalThis.loaders=globalThis.loaders||{};globalThis.loaders.log=log;globalThis.loaders.version=version$1;globalThis.probe=globalThis.probe||{};globalThis.probe.loaders=log;return log;}var log=createLog();// loaders.gl
|
|
25625
25626
|
// SPDX-License-Identifier: MIT
|
|
25626
25627
|
// Copyright (c) vis.gl contributors
|
|
25627
25628
|
/**
|
|
@@ -25871,9 +25872,9 @@ var loadLibraryPromises={};// promises
|
|
|
25871
25872
|
* @param moduleName
|
|
25872
25873
|
* @param options
|
|
25873
25874
|
*/function loadLibrary(_x14){return _loadLibrary.apply(this,arguments);}// TODO - sort out how to resolve paths for main/worker and dev/prod
|
|
25874
|
-
function _loadLibrary(){_loadLibrary=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
25875
|
+
function _loadLibrary(){_loadLibrary=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee21(libraryUrl){var moduleName,options,libraryName,_args24=arguments;return _regeneratorRuntime().wrap(function _callee21$(_context25){while(1){switch(_context25.prev=_context25.next){case 0:moduleName=_args24.length>1&&_args24[1]!==undefined?_args24[1]:null;options=_args24.length>2&&_args24[2]!==undefined?_args24[2]:{};libraryName=_args24.length>3&&_args24[3]!==undefined?_args24[3]:null;if(moduleName){libraryUrl=getLibraryUrl(libraryUrl,moduleName,options,libraryName);}// Ensure libraries are only loaded once
|
|
25875
25876
|
loadLibraryPromises[libraryUrl]=// eslint-disable-next-line @typescript-eslint/no-misused-promises
|
|
25876
|
-
loadLibraryPromises[libraryUrl]||loadLibraryFromFile(libraryUrl);
|
|
25877
|
+
loadLibraryPromises[libraryUrl]||loadLibraryFromFile(libraryUrl);_context25.next=7;return loadLibraryPromises[libraryUrl];case 7:return _context25.abrupt("return",_context25.sent);case 8:case"end":return _context25.stop();}}},_callee21);}));return _loadLibrary.apply(this,arguments);}function getLibraryUrl(library,moduleName){var options=arguments.length>2&&arguments[2]!==undefined?arguments[2]:{};var libraryName=arguments.length>3&&arguments[3]!==undefined?arguments[3]:null;// Check if already a URL
|
|
25877
25878
|
if(!options.useLocalLibraries&&library.startsWith('http')){return library;}libraryName=libraryName||library;// Allow application to import and supply libraries through `options.modules`
|
|
25878
25879
|
// TODO - See js-module-utils in loader-utils
|
|
25879
25880
|
var modules=options.modules||{};if(modules[libraryName]){return modules[libraryName];}// Load from local files, not from CDN scripts in Node.js
|
|
@@ -25896,8 +25897,8 @@ async function loadScriptFromFile(libraryUrl) {
|
|
|
25896
25897
|
// - Potentially bypasses CORS
|
|
25897
25898
|
// Upside is that this separates fetching and parsing
|
|
25898
25899
|
// we could create a`LibraryLoader` or`ModuleLoader`
|
|
25899
|
-
function _loadLibraryFromFile(){_loadLibraryFromFile=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
25900
|
-
return
|
|
25900
|
+
function _loadLibraryFromFile(){_loadLibraryFromFile=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee22(libraryUrl){var _ref36,requireFromFile,scriptSource;return _regeneratorRuntime().wrap(function _callee22$(_context26){while(1){switch(_context26.prev=_context26.next){case 0:if(!libraryUrl.endsWith('wasm')){_context26.next=4;break;}_context26.next=3;return loadAsArrayBuffer(libraryUrl);case 3:return _context26.abrupt("return",_context26.sent);case 4:if(isBrowser){_context26.next=16;break;}_context26.prev=5;_ref36=globalThis.loaders||{},requireFromFile=_ref36.requireFromFile;_context26.next=9;return requireFromFile===null||requireFromFile===void 0?void 0:requireFromFile(libraryUrl);case 9:return _context26.abrupt("return",_context26.sent);case 12:_context26.prev=12;_context26.t0=_context26["catch"](5);console.error(_context26.t0);// eslint-disable-line no-console
|
|
25901
|
+
return _context26.abrupt("return",null);case 16:if(!isWorker){_context26.next=18;break;}return _context26.abrupt("return",importScripts(libraryUrl));case 18:_context26.next=20;return loadAsText(libraryUrl);case 20:scriptSource=_context26.sent;return _context26.abrupt("return",loadLibraryFromString(scriptSource,libraryUrl));case 22:case"end":return _context26.stop();}}},_callee22,null,[[5,12]]);}));return _loadLibraryFromFile.apply(this,arguments);}function loadLibraryFromString(scriptSource,id){if(!isBrowser){var _ref16=globalThis.loaders||{},requireFromString=_ref16.requireFromString;return requireFromString===null||requireFromString===void 0?void 0:requireFromString(scriptSource,id);}if(isWorker){// Use lvalue trick to make eval run in global scope
|
|
25901
25902
|
eval.call(globalThis,scriptSource);// eslint-disable-line no-eval
|
|
25902
25903
|
// https://stackoverflow.com/questions/9107240/1-evalthis-vs-evalthis-in-javascript
|
|
25903
25904
|
// http://perfectionkills.com/global-eval-what-are-the-options/
|
|
@@ -25919,11 +25920,11 @@ function combineWorkerWithLibrary(worker, jsContent) {
|
|
|
25919
25920
|
* Load a file from local file system
|
|
25920
25921
|
* @param filename
|
|
25921
25922
|
* @returns
|
|
25922
|
-
*/function _loadAsArrayBuffer(){_loadAsArrayBuffer=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
25923
|
+
*/function _loadAsArrayBuffer(){_loadAsArrayBuffer=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee23(url){var _ref37,readFileAsArrayBuffer,response;return _regeneratorRuntime().wrap(function _callee23$(_context27){while(1){switch(_context27.prev=_context27.next){case 0:_ref37=globalThis.loaders||{},readFileAsArrayBuffer=_ref37.readFileAsArrayBuffer;if(!(isBrowser||!readFileAsArrayBuffer||url.startsWith('http'))){_context27.next=8;break;}_context27.next=4;return fetch(url);case 4:response=_context27.sent;_context27.next=7;return response.arrayBuffer();case 7:return _context27.abrupt("return",_context27.sent);case 8:_context27.next=10;return readFileAsArrayBuffer(url);case 10:return _context27.abrupt("return",_context27.sent);case 11:case"end":return _context27.stop();}}},_callee23);}));return _loadAsArrayBuffer.apply(this,arguments);}function loadAsText(_x17){return _loadAsText.apply(this,arguments);}/**
|
|
25923
25924
|
* Determines if a loader can parse with worker
|
|
25924
25925
|
* @param loader
|
|
25925
25926
|
* @param options
|
|
25926
|
-
*/function _loadAsText(){_loadAsText=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
25927
|
+
*/function _loadAsText(){_loadAsText=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee24(url){var _ref38,readFileAsText,response;return _regeneratorRuntime().wrap(function _callee24$(_context28){while(1){switch(_context28.prev=_context28.next){case 0:_ref38=globalThis.loaders||{},readFileAsText=_ref38.readFileAsText;if(!(isBrowser||!readFileAsText||url.startsWith('http'))){_context28.next=8;break;}_context28.next=4;return fetch(url);case 4:response=_context28.sent;_context28.next=7;return response.text();case 7:return _context28.abrupt("return",_context28.sent);case 8:_context28.next=10;return readFileAsText(url);case 10:return _context28.abrupt("return",_context28.sent);case 11:case"end":return _context28.stop();}}},_callee24);}));return _loadAsText.apply(this,arguments);}function canParseWithWorker(loader,options){if(!WorkerFarm.isSupported()){return false;}// Node workers are still experimental
|
|
25927
25928
|
if(!isBrowser&&!(options!==null&&options!==void 0&&options._nodeWorkers)){return false;}return loader.worker&&(options===null||options===void 0?void 0:options.worker);}/**
|
|
25928
25929
|
* this function expects that the worker function sends certain messages,
|
|
25929
25930
|
* this can be automated if the worker is wrapper by a call to createLoaderWorker in @loaders.gl/loader-utils.
|
|
@@ -25932,14 +25933,14 @@ if(!isBrowser&&!(options!==null&&options!==void 0&&options._nodeWorkers)){return
|
|
|
25932
25933
|
* @param job
|
|
25933
25934
|
* @param type
|
|
25934
25935
|
* @param payload
|
|
25935
|
-
*/function _parseWithWorker(){_parseWithWorker=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
25936
|
+
*/function _parseWithWorker(){_parseWithWorker=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee25(loader,data,options,context,parseOnMainThread){var name,url,workerFarm,workerPool,job,result;return _regeneratorRuntime().wrap(function _callee25$(_context29){while(1){switch(_context29.prev=_context29.next){case 0:name=loader.id;// TODO
|
|
25936
25937
|
url=getWorkerURL(loader,options);workerFarm=WorkerFarm.getWorkerFarm(options);workerPool=workerFarm.getWorkerPool({name:name,url:url});// options.log object contains functions which cannot be transferred
|
|
25937
25938
|
// context.fetch & context.parse functions cannot be transferred
|
|
25938
25939
|
// TODO - decide how to handle logging on workers
|
|
25939
|
-
options=JSON.parse(JSON.stringify(options));context=JSON.parse(JSON.stringify(context||{}));
|
|
25940
|
+
options=JSON.parse(JSON.stringify(options));context=JSON.parse(JSON.stringify(context||{}));_context29.next=8;return workerPool.startJob('process-on-worker',// @ts-expect-error
|
|
25940
25941
|
onMessage.bind(null,parseOnMainThread)// eslint-disable-line @typescript-eslint/no-misused-promises
|
|
25941
|
-
);case 8:job=
|
|
25942
|
-
input:data,options:options,context:context});
|
|
25942
|
+
);case 8:job=_context29.sent;job.postMessage('process',{// @ts-ignore
|
|
25943
|
+
input:data,options:options,context:context});_context29.next=12;return job.result;case 12:result=_context29.sent;_context29.next=15;return result.result;case 15:return _context29.abrupt("return",_context29.sent);case 16:case"end":return _context29.stop();}}},_callee25);}));return _parseWithWorker.apply(this,arguments);}function onMessage(_x23,_x24,_x25,_x26){return _onMessage2.apply(this,arguments);}// loaders.gl
|
|
25943
25944
|
// SPDX-License-Identifier: MIT
|
|
25944
25945
|
// Copyright (c) vis.gl contributors
|
|
25945
25946
|
/**
|
|
@@ -25947,9 +25948,9 @@ input:data,options:options,context:context});_context19.next=12;return job.resul
|
|
|
25947
25948
|
* @param data
|
|
25948
25949
|
* @param length
|
|
25949
25950
|
* @returns
|
|
25950
|
-
*/function _onMessage2(){_onMessage2=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
25951
|
-
id=payload.id,input=payload.input,options=payload.options;
|
|
25952
|
-
console.warn("parse-with-worker unknown message ".concat(type));case 21:case"end":return
|
|
25951
|
+
*/function _onMessage2(){_onMessage2=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee26(parseOnMainThread,job,type,payload){var id,input,options,result,message;return _regeneratorRuntime().wrap(function _callee26$(_context30){while(1){switch(_context30.prev=_context30.next){case 0:_context30.t0=type;_context30.next=_context30.t0==='done'?3:_context30.t0==='error'?5:_context30.t0==='process'?7:20;break;case 3:job.done(payload);return _context30.abrupt("break",21);case 5:job.error(new Error(payload.error));return _context30.abrupt("break",21);case 7:// Worker is asking for main thread to parseO
|
|
25952
|
+
id=payload.id,input=payload.input,options=payload.options;_context30.prev=8;_context30.next=11;return parseOnMainThread(input,options);case 11:result=_context30.sent;job.postMessage('done',{id:id,result:result});_context30.next=19;break;case 15:_context30.prev=15;_context30.t1=_context30["catch"](8);message=_context30.t1 instanceof Error?_context30.t1.message:'unknown error';job.postMessage('error',{id:id,error:message});case 19:return _context30.abrupt("break",21);case 20:// eslint-disable-next-line
|
|
25953
|
+
console.warn("parse-with-worker unknown message ".concat(type));case 21:case"end":return _context30.stop();}}},_callee26,null,[[8,15]]);}));return _onMessage2.apply(this,arguments);}function getFirstCharacters$1(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
|
|
25953
25954
|
return getMagicString$2(data.buffer,data.byteOffset,length);}else if(data instanceof ArrayBuffer){var byteOffset=0;return getMagicString$2(data,byteOffset,length);}return'';}/**
|
|
25954
25955
|
* Gets a magic string from a "file"
|
|
25955
25956
|
* Typically used to check or detect file format
|
|
@@ -26009,7 +26010,7 @@ target.set(sourceArray,targetOffset);return targetOffset+padToNBytes(sourceArray
|
|
|
26009
26010
|
* Concatenates all data chunks yielded by an (async) iterator
|
|
26010
26011
|
* This function can e.g. be used to enable atomic parsers to work on (async) iterator inputs
|
|
26011
26012
|
*/function concatenateArrayBuffersAsync(_x27){return _concatenateArrayBuffersAsync.apply(this,arguments);}// Simple file alias mechanisms for tests.
|
|
26012
|
-
function _concatenateArrayBuffersAsync(){_concatenateArrayBuffersAsync=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
26013
|
+
function _concatenateArrayBuffersAsync(){_concatenateArrayBuffersAsync=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee27(asyncIterator){var arrayBuffers,_iteratorAbruptCompletion,_didIteratorError,_iteratorError,_iterator,_step,chunk;return _regeneratorRuntime().wrap(function _callee27$(_context31){while(1){switch(_context31.prev=_context31.next){case 0:arrayBuffers=[];_iteratorAbruptCompletion=false;_didIteratorError=false;_context31.prev=3;_iterator=_asyncIterator(asyncIterator);case 5:_context31.next=7;return _iterator.next();case 7:if(!(_iteratorAbruptCompletion=!(_step=_context31.sent).done)){_context31.next=13;break;}chunk=_step.value;arrayBuffers.push(chunk);case 10:_iteratorAbruptCompletion=false;_context31.next=5;break;case 13:_context31.next=19;break;case 15:_context31.prev=15;_context31.t0=_context31["catch"](3);_didIteratorError=true;_iteratorError=_context31.t0;case 19:_context31.prev=19;_context31.prev=20;if(!(_iteratorAbruptCompletion&&_iterator["return"]!=null)){_context31.next=24;break;}_context31.next=24;return _iterator["return"]();case 24:_context31.prev=24;if(!_didIteratorError){_context31.next=27;break;}throw _iteratorError;case 27:return _context31.finish(24);case 28:return _context31.finish(19);case 29:return _context31.abrupt("return",concatenateArrayBuffers.apply(void 0,arrayBuffers));case 30:case"end":return _context31.stop();}}},_callee27,null,[[3,15,19,29],[20,,24,28]]);}));return _concatenateArrayBuffersAsync.apply(this,arguments);}var pathPrefix='';var fileAliases={};/**
|
|
26013
26014
|
* Resolves aliases and adds path-prefix to paths
|
|
26014
26015
|
*/function resolvePath(filename){for(var alias in fileAliases){if(filename.startsWith(alias)){var replacement=fileAliases[alias];filename=filename.replace(alias,replacement);}}if(!filename.startsWith('http://')&&!filename.startsWith('https://')){filename="".concat(pathPrefix).concat(filename);}return filename;}// loaders.gl
|
|
26015
26016
|
// SPDX-License-Identifier: MIT
|
|
@@ -26109,27 +26110,27 @@ return resource.length;}if(resource instanceof ArrayBuffer){return resource.byte
|
|
|
26109
26110
|
*/function makeResponse(_x28){return _makeResponse.apply(this,arguments);}/**
|
|
26110
26111
|
* Checks response status (async) and throws a helpful error message if status is not OK.
|
|
26111
26112
|
* @param response
|
|
26112
|
-
*/function _makeResponse(){_makeResponse=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
26113
|
+
*/function _makeResponse(){_makeResponse=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee28(resource){var headers,contentLength,url,type,initialDataUrl,response;return _regeneratorRuntime().wrap(function _callee28$(_context32){while(1){switch(_context32.prev=_context32.next){case 0:if(!isResponse(resource)){_context32.next=2;break;}return _context32.abrupt("return",resource);case 2:// Add content-length header if possible
|
|
26113
26114
|
headers={};contentLength=getResourceContentLength(resource);if(contentLength>=0){headers['content-length']=String(contentLength);}// `new Response(File)` does not preserve content-type and URL
|
|
26114
26115
|
// so we add them here
|
|
26115
26116
|
url=getResourceUrl(resource);type=getResourceMIMEType(resource);if(type){headers['content-type']=type;}// Add a custom header with initial bytes if available
|
|
26116
|
-
|
|
26117
|
+
_context32.next=10;return getInitialDataUrl(resource);case 10:initialDataUrl=_context32.sent;if(initialDataUrl){headers['x-first-bytes']=initialDataUrl;}// TODO - is this the best way of handling strings?
|
|
26117
26118
|
// Maybe package as data URL instead?
|
|
26118
26119
|
if(typeof resource==='string'){// Convert to ArrayBuffer to avoid Response treating it as a URL
|
|
26119
26120
|
resource=new TextEncoder().encode(resource);}// Attempt to create a Response from the resource, adding headers and setting url
|
|
26120
26121
|
response=new Response(resource,{headers:headers});// We can't control `Response.url` via constructor, use a property override to record URL.
|
|
26121
|
-
Object.defineProperty(response,'url',{value:url});return
|
|
26122
|
-
function _checkResponse(){_checkResponse=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
26123
|
-
|
|
26124
|
-
function _getInitialDataUrl(){_getInitialDataUrl=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
26122
|
+
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
|
|
26123
|
+
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
|
|
26124
|
+
_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
|
|
26125
|
+
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 _i536=0;_i536<bytes.byteLength;_i536++){binary+=String.fromCharCode(bytes[_i536]);}return btoa(binary);}// loaders.gl
|
|
26125
26126
|
// import {FetchError} from './fetch-error';
|
|
26126
26127
|
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:');}/**
|
|
26127
26128
|
* fetch API compatible function
|
|
26128
26129
|
* - Supports fetching from Node.js local file system paths
|
|
26129
26130
|
* - Respects pathPrefix and file aliases
|
|
26130
|
-
*/function fetchFile(_x32,_x33){return _fetchFile
|
|
26131
|
-
function _fetchFile(){_fetchFile
|
|
26132
|
-
if(!isNodePath(url)){
|
|
26131
|
+
*/function fetchFile$1(_x32,_x33){return _fetchFile$.apply(this,arguments);}// loaders.gl
|
|
26132
|
+
function _fetchFile$(){_fetchFile$=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee32(urlOrData,fetchOptions){var url,_globalThis$loaders6,_globalThis$loaders7;return _regeneratorRuntime().wrap(function _callee32$(_context36){while(1){switch(_context36.prev=_context36.next){case 0:if(!(typeof urlOrData==='string')){_context36.next=8;break;}url=resolvePath(urlOrData);// Support fetching from local file system
|
|
26133
|
+
if(!isNodePath(url)){_context36.next=5;break;}if(!((_globalThis$loaders6=globalThis.loaders)!==null&&_globalThis$loaders6!==void 0&&_globalThis$loaders6.fetchNode)){_context36.next=5;break;}return _context36.abrupt("return",(_globalThis$loaders7=globalThis.loaders)===null||_globalThis$loaders7===void 0?void 0:_globalThis$loaders7.fetchNode(url,fetchOptions));case 5:_context36.next=7;return fetch(url,fetchOptions);case 7:return _context36.abrupt("return",_context36.sent);case 8:_context36.next=10;return makeResponse(urlOrData);case 10:return _context36.abrupt("return",_context36.sent);case 11:case"end":return _context36.stop();}}},_callee32);}));return _fetchFile$.apply(this,arguments);}var probeLog=new Log({id:'loaders.gl'});// Logs nothing
|
|
26133
26134
|
var NullLog=/*#__PURE__*/function(){function NullLog(){_classCallCheck(this,NullLog);}_createClass(NullLog,[{key:"log",value:function log(){return function(){};}},{key:"info",value:function info(){return function(){};}},{key:"warn",value:function warn(){return function(){};}},{key:"error",value:function error(){return function(){};}}]);return NullLog;}();// Logs to console
|
|
26134
26135
|
var ConsoleLog=/*#__PURE__*/function(){function ConsoleLog(){_classCallCheck(this,ConsoleLog);_defineProperty(this,"console",void 0);this.console=console;// eslint-disable-line
|
|
26135
26136
|
}_createClass(ConsoleLog,[{key:"log",value:function log(){var _this$console$log;for(var _len103=arguments.length,args=new Array(_len103),_key6=0;_key6<_len103;_key6++){args[_key6]=arguments[_key6];}return(_this$console$log=this.console.log).bind.apply(_this$console$log,[this.console].concat(args));}},{key:"info",value:function info(){var _this$console$info;for(var _len104=arguments.length,args=new Array(_len104),_key7=0;_key7<_len104;_key7++){args[_key7]=arguments[_key7];}return(_this$console$info=this.console.info).bind.apply(_this$console$info,[this.console].concat(args));}},{key:"warn",value:function warn(){var _this$console$warn;for(var _len105=arguments.length,args=new Array(_len105),_key8=0;_key8<_len105;_key8++){args[_key8]=arguments[_key8];}return(_this$console$warn=this.console.warn).bind.apply(_this$console$warn,[this.console].concat(args));}},{key:"error",value:function error(){var _this$console$error;for(var _len106=arguments.length,args=new Array(_len106),_key9=0;_key9<_len106;_key9++){args[_key9]=arguments[_key9];}return(_this$console$error=this.console.error).bind.apply(_this$console$error,[this.console].concat(args));}}]);return ConsoleLog;}();// loaders.gl
|
|
@@ -26229,8 +26230,8 @@ var EXT_PATTERN=/\.([^.]+)$/;// TODO - Need a variant that peeks at streams for
|
|
|
26229
26230
|
* @param loaders
|
|
26230
26231
|
* @param options
|
|
26231
26232
|
* @param context used internally, applications should not provide this parameter
|
|
26232
|
-
*/function _selectLoader(){_selectLoader=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
26233
|
-
loader=selectLoaderSync(data,loaders,_objectSpread(_objectSpread({},options),{},{nothrow:true}),context);if(!loader){
|
|
26233
|
+
*/function _selectLoader(){_selectLoader=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee33(data){var loaders,options,context,loader,_args36=arguments;return _regeneratorRuntime().wrap(function _callee33$(_context37){while(1){switch(_context37.prev=_context37.next){case 0:loaders=_args36.length>1&&_args36[1]!==undefined?_args36[1]:[];options=_args36.length>2?_args36[2]:undefined;context=_args36.length>3?_args36[3]:undefined;if(validHTTPResponse(data)){_context37.next=5;break;}return _context37.abrupt("return",null);case 5:// First make a sync attempt, disabling exceptions
|
|
26234
|
+
loader=selectLoaderSync(data,loaders,_objectSpread(_objectSpread({},options),{},{nothrow:true}),context);if(!loader){_context37.next=8;break;}return _context37.abrupt("return",loader);case 8:if(!isBlob(data)){_context37.next=13;break;}_context37.next=11;return data.slice(0,10).arrayBuffer();case 11:data=_context37.sent;loader=selectLoaderSync(data,loaders,options,context);case 13:if(!(!loader&&!(options!==null&&options!==void 0&&options.nothrow))){_context37.next=15;break;}throw new Error(getNoValidLoaderMessage(data));case 15:return _context37.abrupt("return",loader);case 16:case"end":return _context37.stop();}}},_callee33);}));return _selectLoader.apply(this,arguments);}function selectLoaderSync(data){var loaders=arguments.length>1&&arguments[1]!==undefined?arguments[1]:[];var options=arguments.length>2?arguments[2]:undefined;var context=arguments.length>3?arguments[3]:undefined;if(!validHTTPResponse(data)){return null;}// eslint-disable-next-line complexity
|
|
26234
26235
|
// if only a single loader was provided (not as array), force its use
|
|
26235
26236
|
// TODO - Should this behavior be kept and documented?
|
|
26236
26237
|
if(loaders&&!Array.isArray(loaders)){// TODO - remove support for legacy loaders
|
|
@@ -26369,12 +26370,12 @@ function getArrayBufferOrStringFromData(_x35,_x36,_x37){return _getArrayBufferOr
|
|
|
26369
26370
|
* Gets the current fetch function from options and context
|
|
26370
26371
|
* @param options
|
|
26371
26372
|
* @param context
|
|
26372
|
-
*/function _getArrayBufferOrStringFromData(){_getArrayBufferOrStringFromData=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
26373
|
-
data=makeIterator(data,options);}if(!(isIterable(data)||isAsyncIterable(data))){
|
|
26373
|
+
*/function _getArrayBufferOrStringFromData(){_getArrayBufferOrStringFromData=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee34(data,loader,options){var isArrayBuffer,response;return _regeneratorRuntime().wrap(function _callee34$(_context38){while(1){switch(_context38.prev=_context38.next){case 0:isArrayBuffer=data instanceof ArrayBuffer||ArrayBuffer.isView(data);if(!(typeof data==='string'||isArrayBuffer)){_context38.next=3;break;}return _context38.abrupt("return",getArrayBufferOrStringFromDataSync(data,loader));case 3:if(!isBlob(data)){_context38.next=7;break;}_context38.next=6;return makeResponse(data);case 6:data=_context38.sent;case 7:if(!isResponse(data)){_context38.next=21;break;}response=data;_context38.next=11;return checkResponse(response);case 11:if(!loader.binary){_context38.next=17;break;}_context38.next=14;return response.arrayBuffer();case 14:_context38.t0=_context38.sent;_context38.next=20;break;case 17:_context38.next=19;return response.text();case 19:_context38.t0=_context38.sent;case 20:return _context38.abrupt("return",_context38.t0);case 21:if(isReadableStream(data)){// @ts-expect-error TS2559 options type
|
|
26374
|
+
data=makeIterator(data,options);}if(!(isIterable(data)||isAsyncIterable(data))){_context38.next=24;break;}return _context38.abrupt("return",concatenateArrayBuffersAsync(data));case 24:throw new Error(ERR_DATA);case 25:case"end":return _context38.stop();}}},_callee34);}));return _getArrayBufferOrStringFromData.apply(this,arguments);}function getFetchFunction(options,context){var globalOptions=getGlobalLoaderOptions();var loaderOptions=options||globalOptions;// options.fetch can be a function
|
|
26374
26375
|
if(typeof loaderOptions.fetch==='function'){return loaderOptions.fetch;}// options.fetch can be an options object
|
|
26375
|
-
if(isObject(loaderOptions.fetch)){return function(url){return fetchFile(url,loaderOptions.fetch);};}// else refer to context (from parent loader) if available
|
|
26376
|
+
if(isObject(loaderOptions.fetch)){return function(url){return fetchFile$1(url,loaderOptions.fetch);};}// else refer to context (from parent loader) if available
|
|
26376
26377
|
if(context!==null&&context!==void 0&&context.fetch){return context===null||context===void 0?void 0:context.fetch;}// else return the default fetch function
|
|
26377
|
-
return fetchFile;}// loaders.gl
|
|
26378
|
+
return fetchFile$1;}// loaders.gl
|
|
26378
26379
|
/**
|
|
26379
26380
|
* "sub" loaders invoked by other loaders get a "context" injected on `this`
|
|
26380
26381
|
* The context will inject core methods like `parse` and contain information
|
|
@@ -26401,29 +26402,29 @@ return candidateLoaders&&candidateLoaders.length?candidateLoaders:undefined;}//
|
|
|
26401
26402
|
*/ // implementation signature
|
|
26402
26403
|
function parse$3(_x38,_x39,_x40,_x41){return _parse$.apply(this,arguments);}// TODO: support progress and abort
|
|
26403
26404
|
// TODO - should accept loader.parseAsyncIterator and concatenate.
|
|
26404
|
-
function _parse$(){_parse$=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
26405
|
+
function _parse$(){_parse$=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee35(data,loaders,options,context){var url,typedLoaders,candidateLoaders,loader;return _regeneratorRuntime().wrap(function _callee35$(_context39){while(1){switch(_context39.prev=_context39.next){case 0:// Signature: parse(data, options, context | url)
|
|
26405
26406
|
// Uses registered loaders
|
|
26406
26407
|
if(loaders&&!Array.isArray(loaders)&&!isLoaderObject(loaders)){context=undefined;// context not supported in short signature
|
|
26407
|
-
options=loaders;loaders=undefined;}
|
|
26408
|
+
options=loaders;loaders=undefined;}_context39.next=3;return data;case 3:data=_context39.sent;// Resolve any promise
|
|
26408
26409
|
options=options||{};// Could be invalid...
|
|
26409
26410
|
// Extract a url for auto detection
|
|
26410
26411
|
url=getResourceUrl(data);// Chooses a loader (and normalizes it)
|
|
26411
26412
|
// Also use any loaders in the context, new loaders take priority
|
|
26412
26413
|
typedLoaders=loaders;candidateLoaders=getLoadersFromContext(typedLoaders,context);// todo hacky type cast
|
|
26413
|
-
|
|
26414
|
+
_context39.next=10;return selectLoader(data,candidateLoaders,options);case 10:loader=_context39.sent;if(loader){_context39.next=13;break;}return _context39.abrupt("return",null);case 13:// Normalize options
|
|
26414
26415
|
// @ts-expect-error
|
|
26415
26416
|
options=normalizeOptions(options,loader,candidateLoaders,url);// Could be invalid...
|
|
26416
26417
|
// Get a context (if already present, will be unchanged)
|
|
26417
26418
|
context=getLoaderContext(// @ts-expect-error
|
|
26418
|
-
{url:url,_parse:parse$3,loaders:candidateLoaders},options,context||null);
|
|
26419
|
+
{url:url,_parse:parse$3,loaders:candidateLoaders},options,context||null);_context39.next=17;return parseWithLoader(loader,data,options,context);case 17:return _context39.abrupt("return",_context39.sent);case 18:case"end":return _context39.stop();}}},_callee35);}));return _parse$.apply(this,arguments);}function parseWithLoader(_x42,_x43,_x44,_x45){return _parseWithLoader.apply(this,arguments);}// loaders.gl
|
|
26419
26420
|
/**
|
|
26420
26421
|
* Deduces a simple data type "descriptor from a typed array instance
|
|
26421
|
-
*/function _parseWithLoader(){_parseWithLoader=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
26422
|
+
*/function _parseWithLoader(){_parseWithLoader=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee36(loader,data,options,context){var response,ok,redirected,status,statusText,type,url,headers,loaderWithParser;return _regeneratorRuntime().wrap(function _callee36$(_context40){while(1){switch(_context40.prev=_context40.next){case 0:validateWorkerVersion(loader);options=mergeLoaderOptions(loader.options,options);if(isResponse(data)){// Serialize to support passing the response to web worker
|
|
26422
26423
|
response=data;ok=response.ok,redirected=response.redirected,status=response.status,statusText=response.statusText,type=response.type,url=response.url;headers=Object.fromEntries(response.headers.entries());// @ts-expect-error TODO - fix this
|
|
26423
|
-
context.response={headers:headers,ok:ok,redirected:redirected,status:status,statusText:statusText,type:type,url:url};}
|
|
26424
|
-
if(!(loaderWithParser.parseTextSync&&typeof data==='string')){
|
|
26424
|
+
context.response={headers:headers,ok:ok,redirected:redirected,status:status,statusText:statusText,type:type,url:url};}_context40.next=5;return getArrayBufferOrStringFromData(data,loader,options);case 5:data=_context40.sent;loaderWithParser=loader;// First check for synchronous text parser, wrap results in promises
|
|
26425
|
+
if(!(loaderWithParser.parseTextSync&&typeof data==='string')){_context40.next=9;break;}return _context40.abrupt("return",loaderWithParser.parseTextSync(data,options,context));case 9:if(!canParseWithWorker(loader,options)){_context40.next=13;break;}_context40.next=12;return parseWithWorker(loader,data,options,context,parse$3);case 12:return _context40.abrupt("return",_context40.sent);case 13:if(!(loaderWithParser.parseText&&typeof data==='string')){_context40.next=17;break;}_context40.next=16;return loaderWithParser.parseText(data,options,context);case 16:return _context40.abrupt("return",_context40.sent);case 17:if(!loaderWithParser.parse){_context40.next=21;break;}_context40.next=20;return loaderWithParser.parse(data,options,context);case 20:return _context40.abrupt("return",_context40.sent);case 21:// This should not happen, all sync loaders should also offer `parse` function
|
|
26425
26426
|
assert$2(!loaderWithParser.parseSync);// TBD - If asynchronous parser not available, return null
|
|
26426
|
-
throw new Error("".concat(loader.id," loader - no parser found and worker is disabled"));case 23:case"end":return
|
|
26427
|
+
throw new Error("".concat(loader.id," loader - no parser found and worker is disabled"));case 23:case"end":return _context40.stop();}}},_callee36);}));return _parseWithLoader.apply(this,arguments);}function getDataTypeFromTypedArray(array){switch(array.constructor){case Int8Array:return'int8';case Uint8Array:case Uint8ClampedArray:return'uint8';case Int16Array:return'int16';case Uint16Array:return'uint16';case Int32Array:return'int32';case Uint32Array:return'uint32';case Float32Array:return'float32';case Float64Array:return'float64';default:return'null';}}/**
|
|
26427
26428
|
* Get number of vertices in mesh
|
|
26428
26429
|
* @param attributes
|
|
26429
26430
|
*/ /**
|
|
@@ -26482,16 +26483,16 @@ var src="data:image/svg+xml;base64,".concat(btoa(xmlText));return src;}return ge
|
|
|
26482
26483
|
throw new Error('SVG cannot be parsed directly to imagebitmap');}// TODO - how to determine mime type? Param? Sniff here?
|
|
26483
26484
|
return new Blob([new Uint8Array(arrayBuffer)]);// MIME type not needed?
|
|
26484
26485
|
}// Parses html image from array buffer
|
|
26485
|
-
function parseToImage(_x46,_x47,_x48){return _parseToImage.apply(this,arguments);}function _parseToImage(){_parseToImage=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
26486
|
+
function parseToImage(_x46,_x47,_x48){return _parseToImage.apply(this,arguments);}function _parseToImage(){_parseToImage=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee37(arrayBuffer,options,url){var blobOrDataUrl,URL,objectUrl;return _regeneratorRuntime().wrap(function _callee37$(_context41){while(1){switch(_context41.prev=_context41.next){case 0:// Note: image parsing requires conversion to Blob (for createObjectURL).
|
|
26486
26487
|
// Potentially inefficient for not using `response.blob()` (and for File / Blob inputs)...
|
|
26487
26488
|
// But presumably not worth adding 'blob' flag to loader objects?
|
|
26488
|
-
blobOrDataUrl=getBlobOrSVGDataUrl(arrayBuffer,url);URL=self.URL||self.webkitURL;objectUrl=typeof blobOrDataUrl!=='string'&&URL.createObjectURL(blobOrDataUrl);
|
|
26489
|
+
blobOrDataUrl=getBlobOrSVGDataUrl(arrayBuffer,url);URL=self.URL||self.webkitURL;objectUrl=typeof blobOrDataUrl!=='string'&&URL.createObjectURL(blobOrDataUrl);_context41.prev=3;_context41.next=6;return loadToImage(objectUrl||blobOrDataUrl,options);case 6:return _context41.abrupt("return",_context41.sent);case 7:_context41.prev=7;if(objectUrl){URL.revokeObjectURL(objectUrl);}return _context41.finish(7);case 10:case"end":return _context41.stop();}}},_callee37,null,[[3,,7,10]]);}));return _parseToImage.apply(this,arguments);}function loadToImage(_x49,_x50){return _loadToImage.apply(this,arguments);}function _loadToImage(){_loadToImage=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee38(url,options){var image;return _regeneratorRuntime().wrap(function _callee38$(_context42){while(1){switch(_context42.prev=_context42.next){case 0:image=new Image();image.src=url;// The `image.onload()` callback does not guarantee that the image has been decoded
|
|
26489
26490
|
// so a main thread "freeze" can be incurred when using the image for the first time.
|
|
26490
26491
|
// `Image.decode()` returns a promise that completes when image is decoded.
|
|
26491
26492
|
// https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement/decode
|
|
26492
26493
|
// Note: When calling `img.decode()`, we do not need to wait for `img.onload()`
|
|
26493
26494
|
// Note: `HTMLImageElement.decode()` is not available in Edge and IE11
|
|
26494
|
-
if(!(options.image&&options.image.decode&&image.decode)){
|
|
26495
|
+
if(!(options.image&&options.image.decode&&image.decode)){_context42.next=6;break;}_context42.next=5;return image.decode();case 5:return _context42.abrupt("return",image);case 6:_context42.next=8;return new Promise(function(resolve,reject){try{image.onload=function(){return resolve(image);};image.onerror=function(error){var message=error instanceof Error?error.message:'error';reject(new Error(message));};}catch(error){reject(error);}});case 8:return _context42.abrupt("return",_context42.sent);case 9:case"end":return _context42.stop();}}},_callee38);}));return _loadToImage.apply(this,arguments);}var EMPTY_OBJECT={};var imagebitmapOptionsSupported=true;/**
|
|
26495
26496
|
* Asynchronously parses an array buffer into an ImageBitmap - this contains the decoded data
|
|
26496
26497
|
* ImageBitmaps are supported on worker threads, but not supported on Edge, IE11 and Safari
|
|
26497
26498
|
* https://developer.mozilla.org/en-US/docs/Web/API/ImageBitmap#Browser_compatibility
|
|
@@ -26502,9 +26503,9 @@ if(!(options.image&&options.image.decode&&image.decode)){_context32.next=6;break
|
|
|
26502
26503
|
* *
|
|
26503
26504
|
* Firefox crashes if imagebitmapOptions is supplied
|
|
26504
26505
|
* Avoid supplying if not provided or supported, remember if not supported
|
|
26505
|
-
*/function _parseToImageBitmap(){_parseToImageBitmap=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
26506
|
-
blob=getBlob(arrayBuffer,url);case 8:imagebitmapOptions=options&&options.imagebitmap;
|
|
26507
|
-
imagebitmapOptionsSupported=false;case 13:
|
|
26506
|
+
*/function _parseToImageBitmap(){_parseToImageBitmap=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee39(arrayBuffer,options,url){var blob,_image7,imagebitmapOptions;return _regeneratorRuntime().wrap(function _callee39$(_context43){while(1){switch(_context43.prev=_context43.next){case 0:if(!isSVG(url)){_context43.next=7;break;}_context43.next=3;return parseToImage(arrayBuffer,options,url);case 3:_image7=_context43.sent;blob=_image7;_context43.next=8;break;case 7:// Create blob from the array buffer
|
|
26507
|
+
blob=getBlob(arrayBuffer,url);case 8:imagebitmapOptions=options&&options.imagebitmap;_context43.next=11;return safeCreateImageBitmap(blob,imagebitmapOptions);case 11:return _context43.abrupt("return",_context43.sent);case 12:case"end":return _context43.stop();}}},_callee39);}));return _parseToImageBitmap.apply(this,arguments);}function safeCreateImageBitmap(_x54){return _safeCreateImageBitmap.apply(this,arguments);}function _safeCreateImageBitmap(){_safeCreateImageBitmap=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee40(blob){var imagebitmapOptions,_args43=arguments;return _regeneratorRuntime().wrap(function _callee40$(_context44){while(1){switch(_context44.prev=_context44.next){case 0:imagebitmapOptions=_args43.length>1&&_args43[1]!==undefined?_args43[1]:null;if(isEmptyObject(imagebitmapOptions)||!imagebitmapOptionsSupported){imagebitmapOptions=null;}if(!imagebitmapOptions){_context44.next=13;break;}_context44.prev=3;_context44.next=6;return createImageBitmap(blob,imagebitmapOptions);case 6:return _context44.abrupt("return",_context44.sent);case 9:_context44.prev=9;_context44.t0=_context44["catch"](3);console.warn(_context44.t0);// eslint-disable-line
|
|
26508
|
+
imagebitmapOptionsSupported=false;case 13:_context44.next=15;return createImageBitmap(blob);case 15:return _context44.abrupt("return",_context44.sent);case 16:case"end":return _context44.stop();}}},_callee40,null,[[3,9]]);}));return _safeCreateImageBitmap.apply(this,arguments);}function isEmptyObject(object){// @ts-ignore
|
|
26508
26509
|
for(var key in object||EMPTY_OBJECT){return false;}return true;}// loaders.gl
|
|
26509
26510
|
// SPDX-License-Identifier: MIT
|
|
26510
26511
|
// Copyright (c) vis.gl contributors
|
|
@@ -26603,14 +26604,14 @@ function toDataView(data){if(data instanceof DataView){return data;}if(ArrayBuff
|
|
|
26603
26604
|
if(data instanceof ArrayBuffer){return new DataView(data);}throw new Error('toDataView');}// Use polyfills if installed to parsed image using get-pixels
|
|
26604
26605
|
function parseToNodeImage(_x55,_x56){return _parseToNodeImage.apply(this,arguments);}// Parse to platform defined image type (data on node, ImageBitmap or HTMLImage on browser)
|
|
26605
26606
|
// eslint-disable-next-line complexity
|
|
26606
|
-
function _parseToNodeImage(){_parseToNodeImage=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
26607
|
+
function _parseToNodeImage(){_parseToNodeImage=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee41(arrayBuffer,options){var _globalThis$loaders8;var _ref39,mimeType,parseImageNode;return _regeneratorRuntime().wrap(function _callee41$(_context45){while(1){switch(_context45.prev=_context45.next){case 0:_ref39=getBinaryImageMetadata(arrayBuffer)||{},mimeType=_ref39.mimeType;// @ts-ignore
|
|
26607
26608
|
parseImageNode=(_globalThis$loaders8=globalThis.loaders)===null||_globalThis$loaders8===void 0?void 0:_globalThis$loaders8.parseImageNode;assert$4(parseImageNode);// '@loaders.gl/polyfills not installed'
|
|
26608
26609
|
// @ts-expect-error TODO should we throw error in this case?
|
|
26609
|
-
|
|
26610
|
-
function _parseImage(){_parseImage=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
26611
|
-
imageType=imageOptions.type||'auto';
|
|
26612
|
-
loadType=getLoadableImageType(imageType);
|
|
26613
|
-
if(imageType==='data'){image=getImageData(image);}return
|
|
26610
|
+
_context45.next=5;return parseImageNode(arrayBuffer,mimeType);case 5:return _context45.abrupt("return",_context45.sent);case 6:case"end":return _context45.stop();}}},_callee41);}));return _parseToNodeImage.apply(this,arguments);}function parseImage(_x57,_x58,_x59){return _parseImage.apply(this,arguments);}// Get a loadable image type from image type
|
|
26611
|
+
function _parseImage(){_parseImage=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee42(arrayBuffer,options,context){var imageOptions,imageType,_ref40,url,loadType,image;return _regeneratorRuntime().wrap(function _callee42$(_context46){while(1){switch(_context46.prev=_context46.next){case 0:options=options||{};imageOptions=options.image||{};// The user can request a specific output format via `options.image.type`
|
|
26612
|
+
imageType=imageOptions.type||'auto';_ref40=context||{},url=_ref40.url;// Note: For options.image.type === `data`, we may still need to load as `image` or `imagebitmap`
|
|
26613
|
+
loadType=getLoadableImageType(imageType);_context46.t0=loadType;_context46.next=_context46.t0==='imagebitmap'?8:_context46.t0==='image'?12:_context46.t0==='data'?16:20;break;case 8:_context46.next=10;return parseToImageBitmap(arrayBuffer,options,url);case 10:image=_context46.sent;return _context46.abrupt("break",21);case 12:_context46.next=14;return parseToImage(arrayBuffer,options,url);case 14:image=_context46.sent;return _context46.abrupt("break",21);case 16:_context46.next=18;return parseToNodeImage(arrayBuffer);case 18:image=_context46.sent;return _context46.abrupt("break",21);case 20:assert$4(false);case 21:// Browser: if options.image.type === 'data', we can now extract data from the loaded image
|
|
26614
|
+
if(imageType==='data'){image=getImageData(image);}return _context46.abrupt("return",image);case 23:case"end":return _context46.stop();}}},_callee42);}));return _parseImage.apply(this,arguments);}function getLoadableImageType(type){switch(type){case'auto':case'data':// Browser: For image data we need still need to load using an image format
|
|
26614
26615
|
// Node: the default image type is `data`.
|
|
26615
26616
|
return getDefaultImageType();default:// Throw an error if not supported
|
|
26616
26617
|
isImageTypeSupported(type);return type;}}// import type { ImageType } from '@loaders.gl/schema';
|
|
@@ -26908,7 +26909,7 @@ var offset=(indY*w+indX)*components;return offset;}/**
|
|
|
26908
26909
|
* @param stringOffsets - Index of the buffer view containing offsets for strings. It should be available for string type.
|
|
26909
26910
|
* @returns String property values
|
|
26910
26911
|
*/function getPropertyDataString(numberOfElements,valuesDataBytes,arrayOffsets,stringOffsets){if(arrayOffsets){// TODO: implement it as soon as we have the corresponding tileset
|
|
26911
|
-
throw new Error('Not implemented - arrayOffsets for strings is specified');}if(stringOffsets){var stringsArray=[];var textDecoder=new TextDecoder('utf8');var stringOffset=0;for(var index=0;index<numberOfElements;index++){var stringByteSize=stringOffsets[index+1]-stringOffsets[index];if(stringByteSize+stringOffset<=valuesDataBytes.length){var stringData=valuesDataBytes.subarray(stringOffset,stringByteSize+stringOffset);var stringAttribute=textDecoder.decode(stringData);stringsArray.push(stringAttribute);stringOffset+=stringByteSize;}}return stringsArray;}return[];}var EXT_MESH_FEATURES_NAME='EXT_mesh_features';var name$
|
|
26912
|
+
throw new Error('Not implemented - arrayOffsets for strings is specified');}if(stringOffsets){var stringsArray=[];var textDecoder=new TextDecoder('utf8');var stringOffset=0;for(var index=0;index<numberOfElements;index++){var stringByteSize=stringOffsets[index+1]-stringOffsets[index];if(stringByteSize+stringOffset<=valuesDataBytes.length){var stringData=valuesDataBytes.subarray(stringOffset,stringByteSize+stringOffset);var stringAttribute=textDecoder.decode(stringData);stringsArray.push(stringAttribute);stringOffset+=stringByteSize;}}return stringsArray;}return[];}var EXT_MESH_FEATURES_NAME='EXT_mesh_features';var name$b=EXT_MESH_FEATURES_NAME;function decode$9(_x60,_x61){return _decode$.apply(this,arguments);}function _decode$(){_decode$=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee43(gltfData,options){var scenegraph;return _regeneratorRuntime().wrap(function _callee43$(_context47){while(1){switch(_context47.prev=_context47.next){case 0:scenegraph=new GLTFScenegraph(gltfData);decodeExtMeshFeatures(scenegraph,options);case 2:case"end":return _context47.stop();}}},_callee43);}));return _decode$.apply(this,arguments);}function encode$5(gltfData,options){var scenegraph=new GLTFScenegraph(gltfData);encodeExtMeshFeatures(scenegraph);scenegraph.createBinaryChunk();return scenegraph.gltf;}/**
|
|
26912
26913
|
* Decodes feature metadata from extension.
|
|
26913
26914
|
* @param {GLTFScenegraph} scenegraph - Instance of the class for structured access to GLTF data.
|
|
26914
26915
|
* @param {GLTFLoaderOptions} options - GLTFLoader options.
|
|
@@ -26953,7 +26954,7 @@ featureIds[elementIndex]={featureCount:typedArray.length,propertyTable:featureId
|
|
|
26953
26954
|
*/function createAccessorKey(attributes){var prefix='_FEATURE_ID_';// Search for all "_FEATURE_ID_n" attribures in the primitive provided if any.
|
|
26954
26955
|
// If there are some, e.g. "_FEATURE_ID_0", "_FEATURE_ID_1",
|
|
26955
26956
|
// we will add a new one with the name "_FEATURE_ID_2"
|
|
26956
|
-
var attrs=Object.keys(attributes).filter(function(item){return item.indexOf(prefix)===0;});var max=-1;var _iterator25=_createForOfIteratorHelper(attrs),_step25;try{for(_iterator25.s();!(_step25=_iterator25.n()).done;){var _a8=_step25.value;var n=Number(_a8.substring(prefix.length));if(n>max){max=n;}}}catch(err){_iterator25.e(err);}finally{_iterator25.f();}max++;var accessorKey="".concat(prefix).concat(max);return{accessorKey:accessorKey,index:max};}var EXT_mesh_features=/*#__PURE__*/Object.freeze({__proto__:null,name:name$
|
|
26957
|
+
var attrs=Object.keys(attributes).filter(function(item){return item.indexOf(prefix)===0;});var max=-1;var _iterator25=_createForOfIteratorHelper(attrs),_step25;try{for(_iterator25.s();!(_step25=_iterator25.n()).done;){var _a8=_step25.value;var n=Number(_a8.substring(prefix.length));if(n>max){max=n;}}}catch(err){_iterator25.e(err);}finally{_iterator25.f();}max++;var accessorKey="".concat(prefix).concat(max);return{accessorKey:accessorKey,index:max};}var EXT_mesh_features=/*#__PURE__*/Object.freeze({__proto__:null,name:name$b,decode:decode$9,encode:encode$5,createExtMeshFeatures:createExtMeshFeatures});var EXT_STRUCTURAL_METADATA_NAME='EXT_structural_metadata';var name$a=EXT_STRUCTURAL_METADATA_NAME;function decode$8(_x62,_x63){return _decode$2.apply(this,arguments);}function _decode$2(){_decode$2=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee44(gltfData,options){var scenegraph;return _regeneratorRuntime().wrap(function _callee44$(_context48){while(1){switch(_context48.prev=_context48.next){case 0:scenegraph=new GLTFScenegraph(gltfData);decodeExtStructuralMetadata(scenegraph,options);case 2:case"end":return _context48.stop();}}},_callee44);}));return _decode$2.apply(this,arguments);}function encode$4(gltfData,options){var scenegraph=new GLTFScenegraph(gltfData);encodeExtStructuralMetadata(scenegraph);scenegraph.createBinaryChunk();return scenegraph.gltf;}/*
|
|
26957
26958
|
// Example of the extension.
|
|
26958
26959
|
// See more info at https://github.com/CesiumGS/glTF/tree/3d-tiles-next/extensions/2.0/Vendor/EXT_structural_metadata
|
|
26959
26960
|
const extensions = {
|
|
@@ -27167,11 +27168,11 @@ if(!table.properties){table.properties={};}// values is a required field. Its re
|
|
|
27167
27168
|
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,
|
|
27168
27169
|
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 _i543=0,_arr2=arr;_i543<_arr2.length;_i543++){var str=_arr2[_i543];strArray.set(str,offset);strOffsets.push(offset);offset+=str.length;}strOffsets.push(offset);// The last offset represents the byte offset after the last string.
|
|
27169
27170
|
var stringOffsetsTypedArray=new Uint32Array(strOffsets);// Its length = len+1
|
|
27170
|
-
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$
|
|
27171
|
+
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);}/**
|
|
27171
27172
|
* Decodes feature metadata from extension.
|
|
27172
27173
|
* @param scenegraph - Instance of the class for structured access to GLTF data.
|
|
27173
27174
|
* @param options - GLTFLoader options.
|
|
27174
|
-
*/function _decode$3(){_decode$3=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
27175
|
+
*/function _decode$3(){_decode$3=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee45(gltfData,options){var scenegraph;return _regeneratorRuntime().wrap(function _callee45$(_context49){while(1){switch(_context49.prev=_context49.next){case 0:scenegraph=new GLTFScenegraph(gltfData);decodeExtFeatureMetadata(scenegraph,options);case 2:case"end":return _context49.stop();}}},_callee45);}));return _decode$3.apply(this,arguments);}function decodeExtFeatureMetadata(scenegraph,options){var _options$gltf5,_options$gltf6;// Decoding metadata involves buffers processing.
|
|
27175
27176
|
// So, if buffers have not been loaded, there is no reason to process metadata.
|
|
27176
27177
|
if(!((_options$gltf5=options.gltf)!==null&&_options$gltf5!==void 0&&_options$gltf5.loadBuffers)){return;}var extension=scenegraph.getExtension(EXT_FEATURE_METADATA_NAME);if(!extension){return;}if((_options$gltf6=options.gltf)!==null&&_options$gltf6!==void 0&&_options$gltf6.loadImages){decodePropertyTextures(scenegraph,extension);}decodePropertyTables(scenegraph,extension);}/**
|
|
27177
27178
|
* Processes the data stored in the textures
|
|
@@ -27264,7 +27265,7 @@ return parseFixedLengthArrayNumeric(valuesData,numberOfElements,arrayCount);}ret
|
|
|
27264
27265
|
* @param featureTextureProperty
|
|
27265
27266
|
* @param featureTextureTable
|
|
27266
27267
|
* @param primitive
|
|
27267
|
-
*/function processPrimitiveTextures(scenegraph,attributeName,featureTextureProperty,featureTextureTable,primitive){var textureInfoTopLevel=_objectSpread({channels:featureTextureProperty.channels},featureTextureProperty.texture);var propertyData=getPrimitiveTextureData(scenegraph,textureInfoTopLevel,primitive);if(!propertyData){return;}primitivePropertyDataToAttributes(scenegraph,attributeName,propertyData,featureTextureTable,primitive);}var EXT_feature_metadata=/*#__PURE__*/Object.freeze({__proto__:null,name:name$
|
|
27268
|
+
*/function processPrimitiveTextures(scenegraph,attributeName,featureTextureProperty,featureTextureTable,primitive){var textureInfoTopLevel=_objectSpread({channels:featureTextureProperty.channels},featureTextureProperty.texture);var propertyData=getPrimitiveTextureData(scenegraph,textureInfoTopLevel,primitive);if(!propertyData){return;}primitivePropertyDataToAttributes(scenegraph,attributeName,propertyData,featureTextureTable,primitive);}var EXT_feature_metadata=/*#__PURE__*/Object.freeze({__proto__:null,name:name$9,decode:decode$7});// Version constant cannot be imported, it needs to correspond to the build version of **this** module.
|
|
27268
27269
|
// __VERSION__ is injected by babel-plugin-version-inline
|
|
27269
27270
|
// @ts-ignore TS2304: Cannot find name '__VERSION__'.
|
|
27270
27271
|
var VERSION$3="4.3.2";// loaders.gl
|
|
@@ -27282,14 +27283,14 @@ var BASIS_EXTERNAL_LIBRARIES={/** Basis transcoder, javascript wrapper part */TR
|
|
|
27282
27283
|
* Loads wasm transcoder module
|
|
27283
27284
|
* @param options
|
|
27284
27285
|
* @returns {BasisFile} promise
|
|
27285
|
-
*/function _loadBasisTranscoderModule(){_loadBasisTranscoderModule=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
27286
|
+
*/function _loadBasisTranscoderModule(){_loadBasisTranscoderModule=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee46(options){var basis;return _regeneratorRuntime().wrap(function _callee46$(_context50){while(1){switch(_context50.prev=_context50.next){case 0:registerJSModules(options.modules);basis=getJSModuleOrNull('basis');if(!basis){_context50.next=4;break;}return _context50.abrupt("return",basis);case 4:loadBasisTranscoderPromise||(loadBasisTranscoderPromise=loadBasisTranscoder(options));_context50.next=7;return loadBasisTranscoderPromise;case 7:return _context50.abrupt("return",_context50.sent);case 8:case"end":return _context50.stop();}}},_callee46);}));return _loadBasisTranscoderModule.apply(this,arguments);}function loadBasisTranscoder(_x67){return _loadBasisTranscoder.apply(this,arguments);}/**
|
|
27286
27287
|
* Initialize wasm transcoder module
|
|
27287
27288
|
* @param BasisModule - js part of the module
|
|
27288
27289
|
* @param wasmBinary - wasm part of the module
|
|
27289
27290
|
* @returns {BasisFile} promise
|
|
27290
|
-
*/function _loadBasisTranscoder(){_loadBasisTranscoder=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
27291
|
+
*/function _loadBasisTranscoder(){_loadBasisTranscoder=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee47(options){var BASIS,wasmBinary,_yield$Promise$all3,_yield$Promise$all4;return _regeneratorRuntime().wrap(function _callee47$(_context51){while(1){switch(_context51.prev=_context51.next){case 0:BASIS=null;wasmBinary=null;_context51.t0=Promise;_context51.next=5;return loadLibrary(BASIS_EXTERNAL_LIBRARIES.TRANSCODER,'textures',options);case 5:_context51.t1=_context51.sent;_context51.next=8;return loadLibrary(BASIS_EXTERNAL_LIBRARIES.TRANSCODER_WASM,'textures',options);case 8:_context51.t2=_context51.sent;_context51.t3=[_context51.t1,_context51.t2];_context51.next=12;return _context51.t0.all.call(_context51.t0,_context51.t3);case 12:_yield$Promise$all3=_context51.sent;_yield$Promise$all4=_slicedToArray(_yield$Promise$all3,2);BASIS=_yield$Promise$all4[0];wasmBinary=_yield$Promise$all4[1];// Depends on how import happened...
|
|
27291
27292
|
// @ts-ignore TS2339: Property does not exist on type
|
|
27292
|
-
BASIS=BASIS||globalThis.BASIS;
|
|
27293
|
+
BASIS=BASIS||globalThis.BASIS;_context51.next=19;return initializeBasisTranscoderModule(BASIS,wasmBinary);case 19:return _context51.abrupt("return",_context51.sent);case 20:case"end":return _context51.stop();}}},_callee47);}));return _loadBasisTranscoder.apply(this,arguments);}function initializeBasisTranscoderModule(BasisModule,wasmBinary){var options={};if(wasmBinary){options.wasmBinary=wasmBinary;}return new Promise(function(resolve){// if you try to return BasisModule the browser crashes!
|
|
27293
27294
|
BasisModule(options).then(function(module){var BasisFile=module.BasisFile,initializeBasis=module.initializeBasis;initializeBasis();resolve({BasisFile:BasisFile});});});}var loadBasisEncoderPromise;/**
|
|
27294
27295
|
* Loads wasm encoder module
|
|
27295
27296
|
* @param options
|
|
@@ -27298,14 +27299,14 @@ BasisModule(options).then(function(module){var BasisFile=module.BasisFile,initia
|
|
|
27298
27299
|
* Loads wasm encoder module
|
|
27299
27300
|
* @param options
|
|
27300
27301
|
* @returns {BasisFile, KTX2File} promise
|
|
27301
|
-
*/function _loadBasisEncoderModule(){_loadBasisEncoderModule=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
27302
|
+
*/function _loadBasisEncoderModule(){_loadBasisEncoderModule=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee48(options){var modules;return _regeneratorRuntime().wrap(function _callee48$(_context52){while(1){switch(_context52.prev=_context52.next){case 0:modules=options.modules||{};if(!modules.basisEncoder){_context52.next=3;break;}return _context52.abrupt("return",modules.basisEncoder);case 3:loadBasisEncoderPromise=loadBasisEncoderPromise||loadBasisEncoder(options);_context52.next=6;return loadBasisEncoderPromise;case 6:return _context52.abrupt("return",_context52.sent);case 7:case"end":return _context52.stop();}}},_callee48);}));return _loadBasisEncoderModule.apply(this,arguments);}function loadBasisEncoder(_x69){return _loadBasisEncoder.apply(this,arguments);}/**
|
|
27302
27303
|
* Initialize wasm transcoder module
|
|
27303
27304
|
* @param BasisEncoderModule - js part of the module
|
|
27304
27305
|
* @param wasmBinary - wasm part of the module
|
|
27305
27306
|
* @returns {BasisFile, KTX2File} promise
|
|
27306
|
-
*/function _loadBasisEncoder(){_loadBasisEncoder=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
27307
|
+
*/function _loadBasisEncoder(){_loadBasisEncoder=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee49(options){var BASIS_ENCODER,wasmBinary,_yield$Promise$all5,_yield$Promise$all6;return _regeneratorRuntime().wrap(function _callee49$(_context53){while(1){switch(_context53.prev=_context53.next){case 0:BASIS_ENCODER=null;wasmBinary=null;_context53.t0=Promise;_context53.next=5;return loadLibrary(BASIS_EXTERNAL_LIBRARIES.ENCODER,'textures',options);case 5:_context53.t1=_context53.sent;_context53.next=8;return loadLibrary(BASIS_EXTERNAL_LIBRARIES.ENCODER_WASM,'textures',options);case 8:_context53.t2=_context53.sent;_context53.t3=[_context53.t1,_context53.t2];_context53.next=12;return _context53.t0.all.call(_context53.t0,_context53.t3);case 12:_yield$Promise$all5=_context53.sent;_yield$Promise$all6=_slicedToArray(_yield$Promise$all5,2);BASIS_ENCODER=_yield$Promise$all6[0];wasmBinary=_yield$Promise$all6[1];// Depends on how import happened...
|
|
27307
27308
|
// @ts-ignore TS2339: Property does not exist on type
|
|
27308
|
-
BASIS_ENCODER=BASIS_ENCODER||globalThis.BASIS;
|
|
27309
|
+
BASIS_ENCODER=BASIS_ENCODER||globalThis.BASIS;_context53.next=19;return initializeBasisEncoderModule(BASIS_ENCODER,wasmBinary);case 19:return _context53.abrupt("return",_context53.sent);case 20:case"end":return _context53.stop();}}},_callee49);}));return _loadBasisEncoder.apply(this,arguments);}function initializeBasisEncoderModule(BasisEncoderModule,wasmBinary){var options={};if(wasmBinary){options.wasmBinary=wasmBinary;}return new Promise(function(resolve){// if you try to return BasisModule the browser crashes!
|
|
27309
27310
|
BasisEncoderModule(options).then(function(module){var BasisFile=module.BasisFile,KTX2File=module.KTX2File,initializeBasis=module.initializeBasis,BasisEncoder=module.BasisEncoder;initializeBasis();resolve({BasisFile:BasisFile,KTX2File:KTX2File,BasisEncoder:BasisEncoder});});});}// loaders.gl
|
|
27310
27311
|
// SPDX-License-Identifier: MIT
|
|
27311
27312
|
// Copyright (c) vis.gl contributors
|
|
@@ -27355,7 +27356,7 @@ var OutputFormat={etc1:{basisFormat:0,compressed:true,format:GL_EXTENSIONS_CONST
|
|
|
27355
27356
|
* @param data
|
|
27356
27357
|
* @param options
|
|
27357
27358
|
* @returns compressed texture data
|
|
27358
|
-
*/function _parseBasis(){_parseBasis=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
27359
|
+
*/function _parseBasis(){_parseBasis=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee50(data,options){var fileConstructors,_yield$loadBasisTrans,BasisFile,_fileConstructors,_yield$loadBasisTrans2,_BasisFile;return _regeneratorRuntime().wrap(function _callee50$(_context54){while(1){switch(_context54.prev=_context54.next){case 0:if(!(options.basis.containerFormat==='auto')){_context54.next=11;break;}if(!isKTX(data)){_context54.next=6;break;}_context54.next=4;return loadBasisEncoderModule(options);case 4:fileConstructors=_context54.sent;return _context54.abrupt("return",parseKTX2File(fileConstructors.KTX2File,data,options));case 6:_context54.next=8;return loadBasisTranscoderModule(options);case 8:_yield$loadBasisTrans=_context54.sent;BasisFile=_yield$loadBasisTrans.BasisFile;return _context54.abrupt("return",parseBasisFile(BasisFile,data,options));case 11:_context54.t0=options.basis.module;_context54.next=_context54.t0==='encoder'?14:_context54.t0==='transcoder'?22:22;break;case 14:_context54.next=16;return loadBasisEncoderModule(options);case 16:_fileConstructors=_context54.sent;_context54.t1=options.basis.containerFormat;_context54.next=_context54.t1==='ktx2'?20:_context54.t1==='basis'?21:21;break;case 20:return _context54.abrupt("return",parseKTX2File(_fileConstructors.KTX2File,data,options));case 21:return _context54.abrupt("return",parseBasisFile(_fileConstructors.BasisFile,data,options));case 22:_context54.next=24;return loadBasisTranscoderModule(options);case 24:_yield$loadBasisTrans2=_context54.sent;_BasisFile=_yield$loadBasisTrans2.BasisFile;return _context54.abrupt("return",parseBasisFile(_BasisFile,data,options));case 27:case"end":return _context54.stop();}}},_callee50);}));return _parseBasis.apply(this,arguments);}function parseBasisFile(BasisFile,data,options){var basisFile=new BasisFile(new Uint8Array(data));try{if(!basisFile.startTranscoding()){throw new Error('Failed to start basis transcoding');}var imageCount=basisFile.getNumImages();var images=[];for(var imageIndex=0;imageIndex<imageCount;imageIndex++){var levelsCount=basisFile.getNumLevels(imageIndex);var levels=[];for(var levelIndex=0;levelIndex<levelsCount;levelIndex++){levels.push(transcodeImage(basisFile,imageIndex,levelIndex,options));}images.push(levels);}return images;}finally{basisFile.close();basisFile["delete"]();}}/**
|
|
27359
27360
|
* Parse the particular level image of a basis file
|
|
27360
27361
|
* @param basisFile
|
|
27361
27362
|
* @param imageIndex
|
|
@@ -27453,25 +27454,25 @@ var wasmpack=new Uint8Array([32,0,65,253,3,1,2,34,4,106,6,5,11,8,7,20,13,33,12,1
|
|
|
27453
27454
|
NONE:'',OCTAHEDRAL:'meshopt_decodeFilterOct',QUATERNION:'meshopt_decodeFilterQuat',EXPONENTIAL:'meshopt_decodeFilterExp'};var DECODERS={// legacy index-based enums for glTF
|
|
27454
27455
|
0:'meshopt_decodeVertexBuffer',1:'meshopt_decodeIndexBuffer',2:'meshopt_decodeIndexSequence',// string-based enums for glTF
|
|
27455
27456
|
ATTRIBUTES:'meshopt_decodeVertexBuffer',TRIANGLES:'meshopt_decodeIndexBuffer',INDICES:'meshopt_decodeIndexSequence'};// eslint-disable-next-line max-params
|
|
27456
|
-
function meshoptDecodeGltfBuffer(_x72,_x73,_x74,_x75,_x76){return _meshoptDecodeGltfBuffer.apply(this,arguments);}function _meshoptDecodeGltfBuffer(){_meshoptDecodeGltfBuffer=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
27457
|
-
if(!wasmPromise){wasmPromise=loadWasmModule();}return
|
|
27458
|
-
console.log('Warning: meshopt_decoder is using experimental SIMD support');}
|
|
27457
|
+
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
|
|
27458
|
+
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
|
|
27459
|
+
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 _i544=0;_i544<data.length;++_i544){var ch=data.charCodeAt(_i544);result[_i544]=ch>96?ch-71:ch>64?ch-65:ch>47?ch+4:ch>46?63:62;}var write=0;for(var _i545=0;_i545<data.length;++_i545){result[write++]=result[_i545]<60?wasmpack[result[_i545]]:(result[_i545]-60)*64+result[++_i545];}return result.buffer.slice(0,write);}// eslint-disable-next-line max-params
|
|
27459
27460
|
function decode$6(instance,fun,target,count,size,source,filter){var sbrk=instance.exports.sbrk;var count4=count+3&~3;// pad for SIMD filter
|
|
27460
|
-
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$
|
|
27461
|
-
}catch(err){
|
|
27462
|
-
scenegraph.removeExtension(EXT_MESHOPT_COMPRESSION);case 9:case"end":return
|
|
27463
|
-
var EXT_TEXTURE_WEBP='EXT_texture_webp';/** Extension name */var name$
|
|
27461
|
+
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
|
|
27462
|
+
}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
|
|
27463
|
+
scenegraph.removeExtension(EXT_MESHOPT_COMPRESSION);case 9:case"end":return _context58.stop();}}},_callee54);}));return _decode$4.apply(this,arguments);}function decodeMeshoptBufferView(_x79,_x80){return _decodeMeshoptBufferView.apply(this,arguments);}function _decodeMeshoptBufferView(){_decodeMeshoptBufferView=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee55(scenegraph,bufferView){var meshoptExtension,_meshoptExtension$byt,byteOffset,_meshoptExtension$byt2,byteLength,byteStride,count,mode,_meshoptExtension$fil,filter,bufferIndex,buffer,source,result;return _regeneratorRuntime().wrap(function _callee55$(_context59){while(1){switch(_context59.prev=_context59.next){case 0:meshoptExtension=scenegraph.getObjectExtension(bufferView,EXT_MESHOPT_COMPRESSION);if(!meshoptExtension){_context59.next=9;break;}_meshoptExtension$byt=meshoptExtension.byteOffset,byteOffset=_meshoptExtension$byt===void 0?0:_meshoptExtension$byt,_meshoptExtension$byt2=meshoptExtension.byteLength,byteLength=_meshoptExtension$byt2===void 0?0:_meshoptExtension$byt2,byteStride=meshoptExtension.byteStride,count=meshoptExtension.count,mode=meshoptExtension.mode,_meshoptExtension$fil=meshoptExtension.filter,filter=_meshoptExtension$fil===void 0?'NONE':_meshoptExtension$fil,bufferIndex=meshoptExtension.buffer;buffer=scenegraph.gltf.buffers[bufferIndex];source=new Uint8Array(buffer.arrayBuffer,buffer.byteOffset+byteOffset,byteLength);result=new Uint8Array(scenegraph.gltf.buffers[bufferView.buffer].arrayBuffer,bufferView.byteOffset,bufferView.byteLength);_context59.next=8;return meshoptDecodeGltfBuffer(result,count,byteStride,source,mode,filter);case 8:scenegraph.removeObjectExtension(bufferView,EXT_MESHOPT_COMPRESSION);case 9:case"end":return _context59.stop();}}},_callee55);}));return _decodeMeshoptBufferView.apply(this,arguments);}var EXT_meshopt_compression=/*#__PURE__*/Object.freeze({__proto__:null,name:name$8,decode:decode$5});// GLTF EXTENSION: EXT_TEXTURE_WEBP
|
|
27464
|
+
var EXT_TEXTURE_WEBP='EXT_texture_webp';/** Extension name */var name$7=EXT_TEXTURE_WEBP;/**
|
|
27464
27465
|
* Replaces a texture source reference with the extension texture
|
|
27465
27466
|
* Done in preprocess() to prevent load of default image
|
|
27466
27467
|
*/function preprocess$3(gltfData,options){var scenegraph=new GLTFScenegraph(gltfData);if(!isImageFormatSupported('image/webp')){if(scenegraph.getRequiredExtensions().includes(EXT_TEXTURE_WEBP)){throw new Error("gltf: Required extension ".concat(EXT_TEXTURE_WEBP," not supported by browser"));}return;}var json=scenegraph.json;var _iterator39=_createForOfIteratorHelper(json.textures||[]),_step39;try{for(_iterator39.s();!(_step39=_iterator39.n()).done;){var texture=_step39.value;var extension=scenegraph.getObjectExtension(texture,EXT_TEXTURE_WEBP);if(extension){// TODO - if multiple texture extensions are present which one wins?
|
|
27467
27468
|
texture.source=extension.source;}scenegraph.removeObjectExtension(texture,EXT_TEXTURE_WEBP);}// Remove the top-level extension
|
|
27468
|
-
}catch(err){_iterator39.e(err);}finally{_iterator39.f();}scenegraph.removeExtension(EXT_TEXTURE_WEBP);}var EXT_texture_webp=/*#__PURE__*/Object.freeze({__proto__:null,name:name$
|
|
27469
|
-
var KHR_TEXTURE_BASISU='KHR_texture_basisu';/** Extension name */var name$
|
|
27469
|
+
}catch(err){_iterator39.e(err);}finally{_iterator39.f();}scenegraph.removeExtension(EXT_TEXTURE_WEBP);}var EXT_texture_webp=/*#__PURE__*/Object.freeze({__proto__:null,name:name$7,preprocess:preprocess$3});// GLTF EXTENSION: KHR_texture_basisu
|
|
27470
|
+
var KHR_TEXTURE_BASISU='KHR_texture_basisu';/** Extension name */var name$6=KHR_TEXTURE_BASISU;/**
|
|
27470
27471
|
* Replaces a texture source reference with the extension texture
|
|
27471
27472
|
* Done in preprocess() to prevent load of default image
|
|
27472
27473
|
*/function preprocess$2(gltfData,options){var scene=new GLTFScenegraph(gltfData);var json=scene.json;var _iterator40=_createForOfIteratorHelper(json.textures||[]),_step40;try{for(_iterator40.s();!(_step40=_iterator40.n()).done;){var texture=_step40.value;var extension=scene.getObjectExtension(texture,KHR_TEXTURE_BASISU);if(extension){// TODO - if multiple texture extensions are present which one wins?
|
|
27473
27474
|
texture.source=extension.source;scene.removeObjectExtension(texture,KHR_TEXTURE_BASISU);}}// Remove the top-level extension
|
|
27474
|
-
}catch(err){_iterator40.e(err);}finally{_iterator40.f();}scene.removeExtension(KHR_TEXTURE_BASISU);}var KHR_texture_basisu=/*#__PURE__*/Object.freeze({__proto__:null,name:name$
|
|
27475
|
+
}catch(err){_iterator40.e(err);}finally{_iterator40.f();}scene.removeExtension(KHR_TEXTURE_BASISU);}var KHR_texture_basisu=/*#__PURE__*/Object.freeze({__proto__:null,name:name$6,preprocess:preprocess$2});// Version constant cannot be imported, it needs to correspond to the build version of **this** module.
|
|
27475
27476
|
// __VERSION__ is injected by babel-plugin-version-inline
|
|
27476
27477
|
// @ts-ignore TS2304: Cannot find name '__VERSION__'.
|
|
27477
27478
|
var VERSION$1="4.3.2";// loaders.gl
|
|
@@ -27585,11 +27586,11 @@ this.metadataQuerier.GetIntEntryArray(dracoMetadata,entryName,dracoArray);var in
|
|
|
27585
27586
|
* Copy a Draco int32 array into a JS typed array
|
|
27586
27587
|
*/function getUint32Array(dracoArray){var numValues=dracoArray.size();var intArray=new Int32Array(numValues);for(var _i549=0;_i549<numValues;_i549++){intArray[_i549]=dracoArray.GetValue(_i549);}return intArray;}// Dynamic DRACO module loading inspired by THREE.DRACOLoader
|
|
27587
27588
|
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
|
|
27588
|
-
function _loadDracoDecoderModule(){_loadDracoDecoderModule=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
27589
|
+
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
|
|
27589
27590
|
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
|
|
27590
|
-
loadDecoderPromise||(loadDecoderPromise=loadDracoDecoder(options));}
|
|
27591
|
+
loadDecoderPromise||(loadDecoderPromise=loadDracoDecoder(options));}_context60.next=4;return loadDecoderPromise;case 4:return _context60.abrupt("return",_context60.sent);case 5:case"end":return _context60.stop();}}},_callee56);}));return _loadDracoDecoderModule.apply(this,arguments);}function loadDracoDecoder(_x82){return _loadDracoDecoder.apply(this,arguments);}function _loadDracoDecoder(){_loadDracoDecoder=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee57(options){var DracoDecoderModule,wasmBinary,_yield$Promise$all7,_yield$Promise$all8;return _regeneratorRuntime().wrap(function _callee57$(_context61){while(1){switch(_context61.prev=_context61.next){case 0:_context61.t0=options.draco&&options.draco.decoderType;_context61.next=_context61.t0==='js'?3:_context61.t0==='wasm'?7:7;break;case 3:_context61.next=5;return loadLibrary(DRACO_EXTERNAL_LIBRARY_URLS[DRACO_EXTERNAL_LIBRARIES.FALLBACK_DECODER],'draco',options,DRACO_EXTERNAL_LIBRARIES.FALLBACK_DECODER);case 5:DracoDecoderModule=_context61.sent;return _context61.abrupt("break",21);case 7:_context61.t1=Promise;_context61.next=10;return loadLibrary(DRACO_EXTERNAL_LIBRARY_URLS[DRACO_EXTERNAL_LIBRARIES.DECODER],'draco',options,DRACO_EXTERNAL_LIBRARIES.DECODER);case 10:_context61.t2=_context61.sent;_context61.next=13;return loadLibrary(DRACO_EXTERNAL_LIBRARY_URLS[DRACO_EXTERNAL_LIBRARIES.DECODER_WASM],'draco',options,DRACO_EXTERNAL_LIBRARIES.DECODER_WASM);case 13:_context61.t3=_context61.sent;_context61.t4=[_context61.t2,_context61.t3];_context61.next=17;return _context61.t1.all.call(_context61.t1,_context61.t4);case 17:_yield$Promise$all7=_context61.sent;_yield$Promise$all8=_slicedToArray(_yield$Promise$all7,2);DracoDecoderModule=_yield$Promise$all8[0];wasmBinary=_yield$Promise$all8[1];case 21:// Depends on how import happened...
|
|
27591
27592
|
// @ts-ignore
|
|
27592
|
-
DracoDecoderModule=DracoDecoderModule||globalThis.DracoDecoderModule;
|
|
27593
|
+
DracoDecoderModule=DracoDecoderModule||globalThis.DracoDecoderModule;_context61.next=24;return initializeDracoDecoder(DracoDecoderModule,wasmBinary);case 24:return _context61.abrupt("return",_context61.sent);case 25:case"end":return _context61.stop();}}},_callee57);}));return _loadDracoDecoder.apply(this,arguments);}function initializeDracoDecoder(DracoDecoderModule,wasmBinary){var options={};if(wasmBinary){options.wasmBinary=wasmBinary;}return new Promise(function(resolve){DracoDecoderModule(_objectSpread(_objectSpread({},options),{},{onModuleLoaded:function onModuleLoaded(draco){return resolve({draco:draco});}// Module is Promise-like. Wrap in object to avoid loop.
|
|
27593
27594
|
}));});}/**
|
|
27594
27595
|
* Browser worker doesn't work because of issue during "draco_encoder.js" loading.
|
|
27595
27596
|
* Refused to execute script from 'https://raw.githubusercontent.com/google/draco/1.4.1/javascript/draco_encoder.js' because its MIME type ('') is not executable.
|
|
@@ -27599,7 +27600,7 @@ DracoDecoderModule=DracoDecoderModule||globalThis.DracoDecoderModule;_context51.
|
|
|
27599
27600
|
// Returns a fresh attributes object with glTF-standardized attributes names
|
|
27600
27601
|
// Attributes that cannot be identified will not be included
|
|
27601
27602
|
// Removes `indices` if present, as it should be stored separately from the attributes
|
|
27602
|
-
function _parse$2(){_parse$2=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
27603
|
+
function _parse$2(){_parse$2=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee58(arrayBuffer,options){var _yield$loadDracoDecod,draco,dracoParser;return _regeneratorRuntime().wrap(function _callee58$(_context62){while(1){switch(_context62.prev=_context62.next){case 0:_context62.next=2;return loadDracoDecoderModule(options);case 2:_yield$loadDracoDecod=_context62.sent;draco=_yield$loadDracoDecod.draco;dracoParser=new DracoParser(draco);_context62.prev=5;return _context62.abrupt("return",dracoParser.parseSync(arrayBuffer,options===null||options===void 0?void 0:options.draco));case 7:_context62.prev=7;dracoParser.destroy();return _context62.finish(7);case 10:case"end":return _context62.stop();}}},_callee58,null,[[5,,7,10]]);}));return _parse$2.apply(this,arguments);}function getGLTFAccessors(attributes){var accessors={};for(var _name6 in attributes){var attribute=attributes[_name6];if(_name6!=='indices'){var glTFAccessor=getGLTFAccessor(attribute);accessors[_name6]=glTFAccessor;}}return accessors;}// Fix up a single accessor.
|
|
27603
27604
|
// Input: typed array or a partial accessor object
|
|
27604
27605
|
// Return: accessor object
|
|
27605
27606
|
function getGLTFAccessor(attribute){var _getAccessorData=getAccessorData(attribute),buffer=_getAccessorData.buffer,size=_getAccessorData.size,count=_getAccessorData.count;var glTFAccessor={// glTF Accessor values
|
|
@@ -27613,9 +27614,9 @@ byteOffset:0,count:count,type:getAccessorTypeFromSize(size),componentType:getCom
|
|
|
27613
27614
|
// }
|
|
27614
27615
|
function getAccessorData(attribute){var buffer=attribute;var size=1;var count=0;if(attribute&&attribute.value){buffer=attribute.value;size=attribute.size||1;}if(buffer){if(!ArrayBuffer.isView(buffer)){buffer=toTypedArray(buffer,Float32Array);}count=buffer.length/size;}return{buffer:buffer,size:size,count:count};}// Convert non-typed arrays to arrays of specified format
|
|
27615
27616
|
function toTypedArray(array,ArrayType){var convertTypedArrays=arguments.length>2&&arguments[2]!==undefined?arguments[2]:false;if(!array){return null;}if(Array.isArray(array)){return new ArrayType(array);}if(convertTypedArrays&&!(array instanceof ArrayType)){return new ArrayType(array);}return array;}// https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_draco_mesh_compression
|
|
27616
|
-
var KHR_DRACO_MESH_COMPRESSION='KHR_draco_mesh_compression';/** Extension name */var name$
|
|
27617
|
-
}catch(err){
|
|
27618
|
-
scenegraph.removeExtension(KHR_DRACO_MESH_COMPRESSION);case 9:case"end":return
|
|
27617
|
+
var KHR_DRACO_MESH_COMPRESSION='KHR_draco_mesh_compression';/** Extension name */var name$5=KHR_DRACO_MESH_COMPRESSION;function preprocess$1(gltfData,options,context){var scenegraph=new GLTFScenegraph(gltfData);var _iterator42=_createForOfIteratorHelper(makeMeshPrimitiveIterator(scenegraph)),_step42;try{for(_iterator42.s();!(_step42=_iterator42.n()).done;){var _primitive5=_step42.value;if(scenegraph.getObjectExtension(_primitive5,KHR_DRACO_MESH_COMPRESSION));}}catch(err){_iterator42.e(err);}finally{_iterator42.f();}}function decode$4(_x85,_x86,_x87){return _decode$5.apply(this,arguments);}function _decode$5(){_decode$5=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee59(gltfData,options,context){var _options$gltf10;var scenegraph,promises,_iterator72,_step72,_primitive10;return _regeneratorRuntime().wrap(function _callee59$(_context63){while(1){switch(_context63.prev=_context63.next){case 0:if(options!==null&&options!==void 0&&(_options$gltf10=options.gltf)!==null&&_options$gltf10!==void 0&&_options$gltf10.decompressMeshes){_context63.next=2;break;}return _context63.abrupt("return");case 2:scenegraph=new GLTFScenegraph(gltfData);promises=[];_iterator72=_createForOfIteratorHelper(makeMeshPrimitiveIterator(scenegraph));try{for(_iterator72.s();!(_step72=_iterator72.n()).done;){_primitive10=_step72.value;if(scenegraph.getObjectExtension(_primitive10,KHR_DRACO_MESH_COMPRESSION)){promises.push(decompressPrimitive(scenegraph,_primitive10,options,context));}}// Decompress meshes in parallel
|
|
27618
|
+
}catch(err){_iterator72.e(err);}finally{_iterator72.f();}_context63.next=8;return Promise.all(promises);case 8:// We have now decompressed all primitives, so remove the top-level extension
|
|
27619
|
+
scenegraph.removeExtension(KHR_DRACO_MESH_COMPRESSION);case 9:case"end":return _context63.stop();}}},_callee59);}));return _decode$5.apply(this,arguments);}function encode$3(gltfData){var options=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};var scenegraph=new GLTFScenegraph(gltfData);var _iterator43=_createForOfIteratorHelper(scenegraph.json.meshes||[]),_step43;try{for(_iterator43.s();!(_step43=_iterator43.n()).done;){var _mesh8=_step43.value;// eslint-disable-next-line camelcase
|
|
27619
27620
|
// @ts-ignore
|
|
27620
27621
|
compressMesh(_mesh8);// NOTE: Only add the extension if something was actually compressed
|
|
27621
27622
|
scenegraph.addRequiredExtension(KHR_DRACO_MESH_COMPRESSION);}}catch(err){_iterator43.e(err);}finally{_iterator43.f();}}// DECODE
|
|
@@ -27626,15 +27627,15 @@ scenegraph.addRequiredExtension(KHR_DRACO_MESH_COMPRESSION);}}catch(err){_iterat
|
|
|
27626
27627
|
function decompressPrimitive(_x88,_x89,_x90,_x91){return _decompressPrimitive.apply(this,arguments);}// ENCODE
|
|
27627
27628
|
// eslint-disable-next-line max-len
|
|
27628
27629
|
// Only TRIANGLES: 0x0004 and TRIANGLE_STRIP: 0x0005 are supported
|
|
27629
|
-
function _decompressPrimitive(){_decompressPrimitive=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
27630
|
+
function _decompressPrimitive(){_decompressPrimitive=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee60(scenegraph,primitive,options,context){var dracoExtension,buffer,bufferCopy,dracoOptions,decodedData,decodedAttributes,_i694,_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
|
|
27630
27631
|
// TODO - remove when `parse` is fixed to handle `byteOffset`s
|
|
27631
27632
|
bufferCopy=sliceArrayBuffer(buffer.buffer,buffer.byteOffset);// , buffer.byteLength);
|
|
27632
27633
|
dracoOptions=_objectSpread({},options);// TODO - remove hack: The entire tileset might be included, too expensive to serialize
|
|
27633
|
-
delete dracoOptions['3d-tiles'];
|
|
27634
|
-
for(
|
|
27634
|
+
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
|
|
27635
|
+
for(_i694=0,_Object$entries9=Object.entries(decodedAttributes);_i694<_Object$entries9.length;_i694++){_Object$entries9$_i=_slicedToArray(_Object$entries9[_i694],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
|
|
27635
27636
|
primitive.attributes=decodedAttributes;if(decodedData.indices){// @ts-ignore
|
|
27636
27637
|
primitive.indices=getGLTFAccessor(decodedData.indices);}// Extension has been processed, delete it
|
|
27637
|
-
scenegraph.removeObjectExtension(primitive,KHR_DRACO_MESH_COMPRESSION);checkPrimitive(primitive);case 16:case"end":return
|
|
27638
|
+
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...
|
|
27638
27639
|
var compressedData=options.DracoWriter.encodeSync({attributes:attributes});// Draco compression may change the order and number of vertices in a mesh.
|
|
27639
27640
|
// To satisfy the requirement that accessors properties be correct for both
|
|
27640
27641
|
// compressed and uncompressed data, generators should create uncompressed
|
|
@@ -27645,7 +27646,7 @@ var decodedData=context===null||context===void 0?void 0:(_context$parseSync=cont
|
|
|
27645
27646
|
mode:mode,// GL.POINTS
|
|
27646
27647
|
extensions:_defineProperty({},KHR_DRACO_MESH_COMPRESSION,{bufferView:bufferViewIndex,attributes:fauxAccessors// TODO - verify with spec
|
|
27647
27648
|
})}]};return glTFMesh;}// UTILS
|
|
27648
|
-
function checkPrimitive(primitive){if(!primitive.attributes&&Object.keys(primitive.attributes).length>0){throw new Error('glTF: Empty primitive detected: Draco decompression failure?');}}function makeMeshPrimitiveIterator(scenegraph){var _iterator44,_step44,_mesh9,_iterator45,_step45,_primitive6;return _regeneratorRuntime().wrap(function makeMeshPrimitiveIterator$(_context10){while(1){switch(_context10.prev=_context10.next){case 0:_iterator44=_createForOfIteratorHelper(scenegraph.json.meshes||[]);_context10.prev=1;_iterator44.s();case 3:if((_step44=_iterator44.n()).done){_context10.next=24;break;}_mesh9=_step44.value;_iterator45=_createForOfIteratorHelper(_mesh9.primitives);_context10.prev=6;_iterator45.s();case 8:if((_step45=_iterator45.n()).done){_context10.next=14;break;}_primitive6=_step45.value;_context10.next=12;return _primitive6;case 12:_context10.next=8;break;case 14:_context10.next=19;break;case 16:_context10.prev=16;_context10.t0=_context10["catch"](6);_iterator45.e(_context10.t0);case 19:_context10.prev=19;_iterator45.f();return _context10.finish(19);case 22:_context10.next=3;break;case 24:_context10.next=29;break;case 26:_context10.prev=26;_context10.t1=_context10["catch"](1);_iterator44.e(_context10.t1);case 29:_context10.prev=29;_iterator44.f();return _context10.finish(29);case 32:case"end":return _context10.stop();}}},_marked3,null,[[1,26,29,32],[6,16,19,22]]);}var KHR_draco_mesh_compression=/*#__PURE__*/Object.freeze({__proto__:null,name:name$
|
|
27649
|
+
function checkPrimitive(primitive){if(!primitive.attributes&&Object.keys(primitive.attributes).length>0){throw new Error('glTF: Empty primitive detected: Draco decompression failure?');}}function makeMeshPrimitiveIterator(scenegraph){var _iterator44,_step44,_mesh9,_iterator45,_step45,_primitive6;return _regeneratorRuntime().wrap(function makeMeshPrimitiveIterator$(_context10){while(1){switch(_context10.prev=_context10.next){case 0:_iterator44=_createForOfIteratorHelper(scenegraph.json.meshes||[]);_context10.prev=1;_iterator44.s();case 3:if((_step44=_iterator44.n()).done){_context10.next=24;break;}_mesh9=_step44.value;_iterator45=_createForOfIteratorHelper(_mesh9.primitives);_context10.prev=6;_iterator45.s();case 8:if((_step45=_iterator45.n()).done){_context10.next=14;break;}_primitive6=_step45.value;_context10.next=12;return _primitive6;case 12:_context10.next=8;break;case 14:_context10.next=19;break;case 16:_context10.prev=16;_context10.t0=_context10["catch"](6);_iterator45.e(_context10.t0);case 19:_context10.prev=19;_iterator45.f();return _context10.finish(19);case 22:_context10.next=3;break;case 24:_context10.next=29;break;case 26:_context10.prev=26;_context10.t1=_context10["catch"](1);_iterator44.e(_context10.t1);case 29:_context10.prev=29;_iterator44.f();return _context10.finish(29);case 32:case"end":return _context10.stop();}}},_marked3,null,[[1,26,29,32],[6,16,19,22]]);}var KHR_draco_mesh_compression=/*#__PURE__*/Object.freeze({__proto__:null,name:name$5,preprocess:preprocess$1,decode:decode$4,encode:encode$3});// math.gl
|
|
27649
27650
|
var DEFAULT_CONFIG={EPSILON:1e-12,debug:false,precision:4,printTypes:false,printDegrees:false,printRowMajor:true,_cartographicRadians:false};// Configuration is truly global as of v3.6 to ensure single config even if multiple copies of math.gl
|
|
27650
27651
|
// Multiple copies of config can be quite tricky to debug...
|
|
27651
27652
|
globalThis.mathgl=globalThis.mathgl||{config:_objectSpread({},DEFAULT_CONFIG)};var config=globalThis.mathgl.config;/**
|
|
@@ -27947,7 +27948,7 @@ this[0]=array[0];this[1]=array[1];this[2]=array[2];this[3]=array[3];this[4]=arra
|
|
|
27947
27948
|
},{key:"multiplyLeft",value:function multiplyLeft(a){multiply(this,a,this);return this.check();}},{key:"multiplyRight",value:function multiplyRight(a){multiply(this,this,a);return this.check();}},{key:"rotate",value:function rotate(radians){_rotate(this,this,radians);return this.check();}},{key:"scale",value:function scale(factor){if(Array.isArray(factor)){_scale6(this,this,factor);}else{_scale6(this,this,[factor,factor]);}return this.check();}},{key:"translate",value:function translate(vec){_translate(this,this,vec);return this.check();}// Transforms
|
|
27948
27949
|
},{key:"transform",value:function transform(vector,result){var out;switch(vector.length){case 2:out=transformMat3$1(result||[-0,-0],vector,this);break;case 3:out=transformMat3(result||[-0,-0,-0],vector,this);break;case 4:out=vec4_transformMat3(result||[-0,-0,-0,-0],vector,this);break;default:throw new Error('Illegal vector');}checkVector(out,vector.length);return out;}/** @deprecated */},{key:"transformVector",value:function transformVector(vector,result){return this.transform(vector,result);}/** @deprecated */},{key:"transformVector2",value:function transformVector2(vector,result){return this.transform(vector,result);}/** @deprecated */},{key:"transformVector3",value:function transformVector3(vector,result){return this.transform(vector,result);}}],[{key:"IDENTITY",get:function get(){return getIdentityMatrix();}},{key:"ZERO",get:function get(){return getZeroMatrix();}}]);return Matrix3;}(Matrix);var ZERO_MATRIX3;var IDENTITY_MATRIX3=null;function getZeroMatrix(){if(!ZERO_MATRIX3){ZERO_MATRIX3=new Matrix3([0,0,0,0,0,0,0,0,0]);Object.freeze(ZERO_MATRIX3);}return ZERO_MATRIX3;}function getIdentityMatrix(){if(!IDENTITY_MATRIX3){IDENTITY_MATRIX3=new Matrix3();Object.freeze(IDENTITY_MATRIX3);}return IDENTITY_MATRIX3;}/**
|
|
27949
27950
|
* https://github.com/KhronosGroup/glTF/blob/main/extensions/2.0/Khronos/KHR_texture_transform/README.md
|
|
27950
|
-
*/ /** Extension name */var KHR_TEXTURE_TRANSFORM='KHR_texture_transform';var name$
|
|
27951
|
+
*/ /** Extension name */var KHR_TEXTURE_TRANSFORM='KHR_texture_transform';var name$4=KHR_TEXTURE_TRANSFORM;var scratchVector=new Vector3();var scratchRotationMatrix=new Matrix3();var scratchScaleMatrix=new Matrix3();/**
|
|
27951
27952
|
* The extension entry to process the transformation
|
|
27952
27953
|
* @param gltfData gltf buffers and json
|
|
27953
27954
|
* @param options GLTFLoader options
|
|
@@ -27955,7 +27956,7 @@ this[0]=array[0];this[1]=array[1];this[2]=array[2];this[3]=array[3];this[4]=arra
|
|
|
27955
27956
|
* Transform TEXCOORD by material
|
|
27956
27957
|
* @param materialIndex processing material index
|
|
27957
27958
|
* @param gltfData gltf buffers and json
|
|
27958
|
-
*/function _decode$6(){_decode$6=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
27959
|
+
*/function _decode$6(){_decode$6=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee61(gltfData,options){var _options$gltf11;var gltfScenegraph,hasExtension,materials,_i695;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(_i695=0;_i695<materials.length;_i695++){transformTexCoords(_i695,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
|
|
27959
27960
|
var processedTexCoords=[];for(var _i585=0,_materialTextures=materialTextures;_i585<_materialTextures.length;_i585++){var _textureInfo$extensio;var textureInfo=_materialTextures[_i585];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);}}}/**
|
|
27960
27961
|
* Transform primitives of the particular material
|
|
27961
27962
|
* @param gltfData gltf data
|
|
@@ -28006,14 +28007,14 @@ createAttribute(texCoord,accessor,primitive,gltfData,result);}}}}}/**
|
|
|
28006
28007
|
* Construct transformation matrix from the extension data (transition, rotation, scale)
|
|
28007
28008
|
* @param extensionData extension data
|
|
28008
28009
|
* @returns transformation matrix
|
|
28009
|
-
*/function makeTransformationMatrix(extensionData){var _extensionData$offset=extensionData.offset,offset=_extensionData$offset===void 0?[0,0]:_extensionData$offset,_extensionData$rotati=extensionData.rotation,rotation=_extensionData$rotati===void 0?0:_extensionData$rotati,_extensionData$scale=extensionData.scale,scale=_extensionData$scale===void 0?[1,1]:_extensionData$scale;var translationMatrix=new Matrix3().set(1,0,0,0,1,0,offset[0],offset[1],1);var rotationMatrix=scratchRotationMatrix.set(Math.cos(rotation),Math.sin(rotation),0,-Math.sin(rotation),Math.cos(rotation),0,0,0,1);var scaleMatrix=scratchScaleMatrix.set(scale[0],0,0,0,scale[1],0,0,0,1);return translationMatrix.multiplyRight(rotationMatrix).multiplyRight(scaleMatrix);}var KHR_texture_transform=/*#__PURE__*/Object.freeze({__proto__:null,name:name$
|
|
28010
|
-
var KHR_LIGHTS_PUNCTUAL='KHR_lights_punctual';var name$
|
|
28011
|
-
function _decode$7(){_decode$7=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
28010
|
+
*/function makeTransformationMatrix(extensionData){var _extensionData$offset=extensionData.offset,offset=_extensionData$offset===void 0?[0,0]:_extensionData$offset,_extensionData$rotati=extensionData.rotation,rotation=_extensionData$rotati===void 0?0:_extensionData$rotati,_extensionData$scale=extensionData.scale,scale=_extensionData$scale===void 0?[1,1]:_extensionData$scale;var translationMatrix=new Matrix3().set(1,0,0,0,1,0,offset[0],offset[1],1);var rotationMatrix=scratchRotationMatrix.set(Math.cos(rotation),Math.sin(rotation),0,-Math.sin(rotation),Math.cos(rotation),0,0,0,1);var scaleMatrix=scratchScaleMatrix.set(scale[0],0,0,0,scale[1],0,0,0,1);return translationMatrix.multiplyRight(rotationMatrix).multiplyRight(scaleMatrix);}var KHR_texture_transform=/*#__PURE__*/Object.freeze({__proto__:null,name:name$4,decode:decode$3});// GLTF EXTENSION: KHR_lights_punctual
|
|
28011
|
+
var KHR_LIGHTS_PUNCTUAL='KHR_lights_punctual';var name$3=KHR_LIGHTS_PUNCTUAL;function decode$2(_x94){return _decode$7.apply(this,arguments);}// Move the light ar ray out of the extension and remove the extension
|
|
28012
|
+
function _decode$7(){_decode$7=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee62(gltfData){var gltfScenegraph,json,extension,_iterator73,_step73,node,nodeExtension;return _regeneratorRuntime().wrap(function _callee62$(_context66){while(1){switch(_context66.prev=_context66.next){case 0:gltfScenegraph=new GLTFScenegraph(gltfData);json=gltfScenegraph.json;// Move the light array out of the extension and remove the extension
|
|
28012
28013
|
extension=gltfScenegraph.getExtension(KHR_LIGHTS_PUNCTUAL);if(extension){// @ts-ignore
|
|
28013
28014
|
gltfScenegraph.json.lights=extension.lights;gltfScenegraph.removeExtension(KHR_LIGHTS_PUNCTUAL);}// Any nodes that have the extension, add lights field pointing to light object
|
|
28014
28015
|
// and remove the extension
|
|
28015
|
-
|
|
28016
|
-
node.light=nodeExtension.light;}gltfScenegraph.removeObjectExtension(node,KHR_LIGHTS_PUNCTUAL);}}catch(err){
|
|
28016
|
+
_iterator73=_createForOfIteratorHelper(json.nodes||[]);try{for(_iterator73.s();!(_step73=_iterator73.n()).done;){node=_step73.value;nodeExtension=gltfScenegraph.getObjectExtension(node,KHR_LIGHTS_PUNCTUAL);if(nodeExtension){// @ts-ignore
|
|
28017
|
+
node.light=nodeExtension.light;}gltfScenegraph.removeObjectExtension(node,KHR_LIGHTS_PUNCTUAL);}}catch(err){_iterator73.e(err);}finally{_iterator73.f();}case 6:case"end":return _context66.stop();}}},_callee62);}));return _decode$7.apply(this,arguments);}function encode$2(_x95){return _encode$.apply(this,arguments);}function _encode$(){_encode$=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee63(gltfData){var gltfScenegraph,json,extension,_iterator74,_step74,light,node;return _regeneratorRuntime().wrap(function _callee63$(_context67){while(1){switch(_context67.prev=_context67.next){case 0:gltfScenegraph=new GLTFScenegraph(gltfData);json=gltfScenegraph.json;// @ts-ignore
|
|
28017
28018
|
if(json.lights){extension=gltfScenegraph.addExtension(KHR_LIGHTS_PUNCTUAL);// @ts-ignore
|
|
28018
28019
|
assert$1(!extension.lights);// @ts-ignore
|
|
28019
28020
|
extension.lights=json.lights;// @ts-ignore
|
|
@@ -28021,24 +28022,24 @@ delete json.lights;}// Any nodes that have lights field pointing to light object
|
|
|
28021
28022
|
// add the extension
|
|
28022
28023
|
// @ts-ignore
|
|
28023
28024
|
if(gltfScenegraph.json.lights){// @ts-ignore
|
|
28024
|
-
|
|
28025
|
-
}catch(err){
|
|
28026
|
-
var KHR_MATERIALS_UNLIT='KHR_materials_unlit';var name$
|
|
28025
|
+
_iterator74=_createForOfIteratorHelper(gltfScenegraph.json.lights);try{for(_iterator74.s();!(_step74=_iterator74.n()).done;){light=_step74.value;node=light.node;gltfScenegraph.addObjectExtension(node,KHR_LIGHTS_PUNCTUAL,light);}// @ts-ignore
|
|
28026
|
+
}catch(err){_iterator74.e(err);}finally{_iterator74.f();}delete gltfScenegraph.json.lights;}case 4:case"end":return _context67.stop();}}},_callee63);}));return _encode$.apply(this,arguments);}var KHR_lights_punctual=/*#__PURE__*/Object.freeze({__proto__:null,name:name$3,decode:decode$2,encode:encode$2});// GLTF EXTENSION: KHR_materials_unlit
|
|
28027
|
+
var KHR_MATERIALS_UNLIT='KHR_materials_unlit';var name$2=KHR_MATERIALS_UNLIT;function decode$1(_x96){return _decode$8.apply(this,arguments);}function _decode$8(){_decode$8=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee64(gltfData){var gltfScenegraph,json,_iterator75,_step75,material,extension;return _regeneratorRuntime().wrap(function _callee64$(_context68){while(1){switch(_context68.prev=_context68.next){case 0:gltfScenegraph=new GLTFScenegraph(gltfData);json=gltfScenegraph.json;// Any nodes that have the extension, add lights field pointing to light object
|
|
28027
28028
|
// and remove the extension
|
|
28028
|
-
|
|
28029
|
+
_iterator75=_createForOfIteratorHelper(json.materials||[]);try{for(_iterator75.s();!(_step75=_iterator75.n()).done;){material=_step75.value;extension=material.extensions&&material.extensions.KHR_materials_unlit;if(extension){// @ts-ignore TODO
|
|
28029
28030
|
material.unlit=true;}gltfScenegraph.removeObjectExtension(material,KHR_MATERIALS_UNLIT);}// Remove the top-level extension
|
|
28030
|
-
}catch(err){
|
|
28031
|
+
}catch(err){_iterator75.e(err);}finally{_iterator75.f();}gltfScenegraph.removeExtension(KHR_MATERIALS_UNLIT);case 5:case"end":return _context68.stop();}}},_callee64);}));return _decode$8.apply(this,arguments);}function encode$1(gltfData){var gltfScenegraph=new GLTFScenegraph(gltfData);var json=gltfScenegraph.json;// Any nodes that have lights field pointing to light object
|
|
28031
28032
|
// add the extension
|
|
28032
28033
|
// @ts-ignore
|
|
28033
28034
|
if(gltfScenegraph.materials){var _iterator48=_createForOfIteratorHelper(json.materials||[]),_step48;try{for(_iterator48.s();!(_step48=_iterator48.n()).done;){var material=_step48.value;// @ts-ignore
|
|
28034
28035
|
if(material.unlit){// @ts-ignore
|
|
28035
|
-
delete material.unlit;gltfScenegraph.addObjectExtension(material,KHR_MATERIALS_UNLIT,{});gltfScenegraph.addExtension(KHR_MATERIALS_UNLIT);}}}catch(err){_iterator48.e(err);}finally{_iterator48.f();}}}var KHR_materials_unlit=/*#__PURE__*/Object.freeze({__proto__:null,name:name$
|
|
28036
|
-
var KHR_TECHNIQUES_WEBGL='KHR_techniques_webgl';var name=KHR_TECHNIQUES_WEBGL;function decode(_x97){return _decode.apply(this,arguments);}// eslint-disable-next-line
|
|
28037
|
-
function _decode(){_decode=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
28036
|
+
delete material.unlit;gltfScenegraph.addObjectExtension(material,KHR_MATERIALS_UNLIT,{});gltfScenegraph.addExtension(KHR_MATERIALS_UNLIT);}}}catch(err){_iterator48.e(err);}finally{_iterator48.f();}}}var KHR_materials_unlit=/*#__PURE__*/Object.freeze({__proto__:null,name:name$2,decode:decode$1,encode:encode$1});// GLTF EXTENSION: KHR_techniques_webgl
|
|
28037
|
+
var KHR_TECHNIQUES_WEBGL='KHR_techniques_webgl';var name$1=KHR_TECHNIQUES_WEBGL;function decode(_x97){return _decode.apply(this,arguments);}// eslint-disable-next-line
|
|
28038
|
+
function _decode(){_decode=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee65(gltfData){var gltfScenegraph,json,extension,techniques,_iterator76,_step76,material,materialExtension;return _regeneratorRuntime().wrap(function _callee65$(_context69){while(1){switch(_context69.prev=_context69.next){case 0:gltfScenegraph=new GLTFScenegraph(gltfData);json=gltfScenegraph.json;extension=gltfScenegraph.getExtension(KHR_TECHNIQUES_WEBGL);if(extension){techniques=resolveTechniques(extension,gltfScenegraph);_iterator76=_createForOfIteratorHelper(json.materials||[]);try{for(_iterator76.s();!(_step76=_iterator76.n()).done;){material=_step76.value;materialExtension=gltfScenegraph.getObjectExtension(material,KHR_TECHNIQUES_WEBGL);if(materialExtension){// @ts-ignore TODO
|
|
28038
28039
|
material.technique=Object.assign({},materialExtension,// @ts-ignore
|
|
28039
28040
|
techniques[materialExtension.technique]);// @ts-ignore TODO
|
|
28040
28041
|
material.technique.values=resolveValues(material.technique,gltfScenegraph);}gltfScenegraph.removeObjectExtension(material,KHR_TECHNIQUES_WEBGL);}// Remove the top-level extension
|
|
28041
|
-
}catch(err){
|
|
28042
|
+
}catch(err){_iterator76.e(err);}finally{_iterator76.f();}gltfScenegraph.removeExtension(KHR_TECHNIQUES_WEBGL);}case 4:case"end":return _context69.stop();}}},_callee65);}));return _decode.apply(this,arguments);}function encode(_x98,_x99){return _encode.apply(this,arguments);}function _encode(){_encode=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee66(gltfData,options){return _regeneratorRuntime().wrap(function _callee66$(_context70){while(1){switch(_context70.prev=_context70.next){case 0:case"end":return _context70.stop();}}},_callee66);}));return _encode.apply(this,arguments);}function resolveTechniques(techniquesExtension,// programs: {[key: string]: any}[],
|
|
28042
28043
|
// shaders: {[key: string]: any}[],
|
|
28043
28044
|
// techniques: {[key: string]: any}[]
|
|
28044
28045
|
gltfScenegraph){var _techniquesExtension$=techniquesExtension.programs,programs=_techniquesExtension$===void 0?[]:_techniquesExtension$,_techniquesExtension$2=techniquesExtension.shaders,shaders=_techniquesExtension$2===void 0?[]:_techniquesExtension$2,_techniquesExtension$3=techniquesExtension.techniques,techniques=_techniquesExtension$3===void 0?[]:_techniquesExtension$3;var textDecoder=new TextDecoder();shaders.forEach(function(shader){if(Number.isFinite(shader.bufferView)){shader.code=textDecoder.decode(gltfScenegraph.getTypedArrayForBufferView(shader.bufferView));}else{// TODO: handle URI shader
|
|
@@ -28046,7 +28047,7 @@ throw new Error('KHR_techniques_webgl: no shader code');}});programs.forEach(fun
|
|
|
28046
28047
|
Object.keys(technique.uniforms||{}).forEach(function(uniform){if(technique.uniforms[uniform].value&&!(uniform in values)){values[uniform]=technique.uniforms[uniform].value;}});// resolve textures
|
|
28047
28048
|
Object.keys(values).forEach(function(uniform){if(_typeof(values[uniform])==='object'&&values[uniform].index!==undefined){// Assume this is a texture
|
|
28048
28049
|
// TODO: find if there are any other types that can be referenced
|
|
28049
|
-
values[uniform].texture=gltfScenegraph.getTexture(values[uniform].index);}});return values;}var KHR_techniques_webgl=/*#__PURE__*/Object.freeze({__proto__:null,name:name,decode:decode,encode:encode});// GLTF 1.0 extensions (decode only)
|
|
28050
|
+
values[uniform].texture=gltfScenegraph.getTexture(values[uniform].index);}});return values;}var KHR_techniques_webgl=/*#__PURE__*/Object.freeze({__proto__:null,name:name$1,decode:decode,encode:encode});// GLTF 1.0 extensions (decode only)
|
|
28050
28051
|
/**
|
|
28051
28052
|
* List of extensions processed by the GLTFLoader
|
|
28052
28053
|
* Note that may extensions can only be handled on the rendering stage and are left out here
|
|
@@ -28056,7 +28057,7 @@ values[uniform].texture=gltfScenegraph.getTexture(values[uniform].index);}});ret
|
|
|
28056
28057
|
// KHR_binary_gltf,
|
|
28057
28058
|
// 2.0
|
|
28058
28059
|
EXT_structural_metadata,EXT_mesh_features,EXT_meshopt_compression,EXT_texture_webp,// Basisu should come after webp, we want basisu to be preferred if both are provided
|
|
28059
|
-
KHR_texture_basisu,KHR_draco_mesh_compression,KHR_lights_punctual,KHR_materials_unlit,KHR_techniques_webgl,KHR_texture_transform,EXT_feature_metadata];/** Call before any resource loading starts */function preprocessExtensions(gltf){var options=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};var context=arguments.length>2?arguments[2]:undefined;var extensions=EXTENSIONS.filter(function(extension){return useExtension(extension.name,options);});var _iterator49=_createForOfIteratorHelper(extensions),_step49;try{for(_iterator49.s();!(_step49=_iterator49.n()).done;){var _extension$preprocess;var extension=_step49.value;(_extension$preprocess=extension.preprocess)===null||_extension$preprocess===void 0?void 0:_extension$preprocess.call(extension,gltf,options,context);}}catch(err){_iterator49.e(err);}finally{_iterator49.f();}}/** Call after resource loading */function decodeExtensions(_x100){return _decodeExtensions.apply(this,arguments);}function _decodeExtensions(){_decodeExtensions=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
28060
|
+
KHR_texture_basisu,KHR_draco_mesh_compression,KHR_lights_punctual,KHR_materials_unlit,KHR_techniques_webgl,KHR_texture_transform,EXT_feature_metadata];/** Call before any resource loading starts */function preprocessExtensions(gltf){var options=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};var context=arguments.length>2?arguments[2]:undefined;var extensions=EXTENSIONS.filter(function(extension){return useExtension(extension.name,options);});var _iterator49=_createForOfIteratorHelper(extensions),_step49;try{for(_iterator49.s();!(_step49=_iterator49.n()).done;){var _extension$preprocess;var extension=_step49.value;(_extension$preprocess=extension.preprocess)===null||_extension$preprocess===void 0?void 0:_extension$preprocess.call(extension,gltf,options,context);}}catch(err){_iterator49.e(err);}finally{_iterator49.f();}}/** Call after resource loading */function decodeExtensions(_x100){return _decodeExtensions.apply(this,arguments);}function _decodeExtensions(){_decodeExtensions=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee67(gltf){var options,context,extensions,_iterator77,_step77,_extension$decode,extension,_args70=arguments;return _regeneratorRuntime().wrap(function _callee67$(_context71){while(1){switch(_context71.prev=_context71.next){case 0:options=_args70.length>1&&_args70[1]!==undefined?_args70[1]:{};context=_args70.length>2?_args70[2]:undefined;extensions=EXTENSIONS.filter(function(extension){return useExtension(extension.name,options);});_iterator77=_createForOfIteratorHelper(extensions);_context71.prev=4;_iterator77.s();case 6:if((_step77=_iterator77.n()).done){_context71.next=12;break;}extension=_step77.value;_context71.next=10;return(_extension$decode=extension.decode)===null||_extension$decode===void 0?void 0:_extension$decode.call(extension,gltf,options,context);case 10:_context71.next=6;break;case 12:_context71.next=17;break;case 14:_context71.prev=14;_context71.t0=_context71["catch"](4);_iterator77.e(_context71.t0);case 17:_context71.prev=17;_iterator77.f();return _context71.finish(17);case 20:case"end":return _context71.stop();}}},_callee67,null,[[4,14,17,20]]);}));return _decodeExtensions.apply(this,arguments);}function useExtension(extensionName,options){var _options$gltf7;var excludes=(options===null||options===void 0?void 0:(_options$gltf7=options.gltf)===null||_options$gltf7===void 0?void 0:_options$gltf7.excludeExtensions)||{};var exclude=extensionName in excludes&&!excludes[extensionName];return!exclude;}// GLTF 1.0 EXTENSION: KHR_binary_glTF
|
|
28060
28061
|
var KHR_BINARY_GLTF='KHR_binary_glTF';function preprocess(gltfData){var gltfScenegraph=new GLTFScenegraph(gltfData);var json=gltfScenegraph.json;// Note: json.buffers.binary_glTF also needs to be replaced
|
|
28061
28062
|
// This is currently done during gltf normalization
|
|
28062
28063
|
// Image and shader nodes can have the extension
|
|
@@ -28149,8 +28150,8 @@ delete buffer.type;}}catch(err){_iterator57.e(err);}finally{_iterator57.f();}}/*
|
|
|
28149
28150
|
* @param data - can be ArrayBuffer (GLB), ArrayBuffer (Binary JSON), String (JSON), or Object (parsed JSON)
|
|
28150
28151
|
* @param byteOffset
|
|
28151
28152
|
* @param options
|
|
28152
|
-
*/function _parseGLTF$(){_parseGLTF$=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
28153
|
-
if(!(options!==null&&options!==void 0&&(_options$gltf13=options.gltf)!==null&&_options$gltf13!==void 0&&_options$gltf13.loadBuffers&&gltf.json.buffers)){
|
|
28153
|
+
*/function _parseGLTF$(){_parseGLTF$=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee68(gltf,arrayBufferOrString){var _options$gltf12,_options$gltf13,_options$gltf14;var byteOffset,options,context,_args71=arguments;return _regeneratorRuntime().wrap(function _callee68$(_context72){while(1){switch(_context72.prev=_context72.next){case 0:byteOffset=_args71.length>2&&_args71[2]!==undefined?_args71[2]:0;options=_args71.length>3?_args71[3]:undefined;context=_args71.length>4?_args71[4]:undefined;parseGLTFContainerSync(gltf,arrayBufferOrString,byteOffset,options);normalizeGLTFV1(gltf,{normalize:options===null||options===void 0?void 0:(_options$gltf12=options.gltf)===null||_options$gltf12===void 0?void 0:_options$gltf12.normalize});preprocessExtensions(gltf,options,context);// Load linked buffers asynchronously and decodes base64 buffers in parallel
|
|
28154
|
+
if(!(options!==null&&options!==void 0&&(_options$gltf13=options.gltf)!==null&&_options$gltf13!==void 0&&_options$gltf13.loadBuffers&&gltf.json.buffers)){_context72.next=9;break;}_context72.next=9;return loadBuffers(gltf,options,context);case 9:if(!(options!==null&&options!==void 0&&(_options$gltf14=options.gltf)!==null&&_options$gltf14!==void 0&&_options$gltf14.loadImages)){_context72.next=12;break;}_context72.next=12;return loadImages(gltf,options,context);case 12:_context72.next=14;return decodeExtensions(gltf,options,context);case 14:return _context72.abrupt("return",gltf);case 15:case"end":return _context72.stop();}}},_callee68);}));return _parseGLTF$.apply(this,arguments);}function parseGLTFContainerSync(gltf,data,byteOffset,options){// Initialize gltf container
|
|
28154
28155
|
if(options.uri){gltf.baseUri=options.uri;}// If data is binary and starting with magic bytes, assume binary JSON text, convert to string
|
|
28155
28156
|
if(data instanceof ArrayBuffer&&!isGLB(data,byteOffset,options)){var textDecoder=new TextDecoder();data=textDecoder.decode(data);}if(typeof data==='string'){// If string, try to parse as JSON
|
|
28156
28157
|
gltf.json=parseJSON(data);}else if(data instanceof ArrayBuffer){// If still ArrayBuffer, parse as GLB container
|
|
@@ -28170,16 +28171,16 @@ var images=gltf.json.images||[];gltf.images=new Array(images.length).fill({});}/
|
|
|
28170
28171
|
* @param options
|
|
28171
28172
|
* @param context
|
|
28172
28173
|
* @returns
|
|
28173
|
-
*/function _loadBuffers(){_loadBuffers=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
28174
|
-
buffers=gltf.json.buffers||[];
|
|
28174
|
+
*/function _loadBuffers(){_loadBuffers=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee69(gltf,options,context){var buffers,_i696,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
|
|
28175
|
+
buffers=gltf.json.buffers||[];_i696=0;case 2:if(!(_i696<buffers.length)){_context73.next=22;break;}buffer=buffers[_i696];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[_i696]={arrayBuffer:arrayBuffer,byteOffset:0,byteLength:arrayBuffer.byteLength};delete buffer.uri;_context73.next=19;break;case 18:if(gltf.buffers[_i696]===null){gltf.buffers[_i696]={arrayBuffer:new ArrayBuffer(buffer.byteLength),byteOffset:0,byteLength:buffer.byteLength};}case 19:++_i696;_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);}/**
|
|
28175
28176
|
* GLTF loader
|
|
28176
|
-
*/function _loadImage(){_loadImage=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
28177
|
-
|
|
28177
|
+
*/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`
|
|
28178
|
+
_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
|
|
28178
28179
|
mipmaps:false,width:parsedImage[0].width,height:parsedImage[0].height,data:parsedImage[0]};}// TODO making sure ImageLoader is overridable by using array of loaders
|
|
28179
28180
|
// const parsedImage = await parse(arrayBuffer, [ImageLoader]);
|
|
28180
28181
|
// Store the loaded image
|
|
28181
28182
|
gltf.images=gltf.images||[];// @ts-expect-error TODO - sort out image typing asap
|
|
28182
|
-
gltf.images[index]=parsedImage;case 18:case"end":return
|
|
28183
|
+
gltf.images[index]=parsedImage;case 18:case"end":return _context75.stop();}}},_callee71);}));return _loadImage.apply(this,arguments);}var GLTFLoader={dataType:null,batchType:null,name:'glTF',id:'gltf',module:'gltf',version:VERSION$3,extensions:['gltf','glb'],mimeTypes:['model/gltf+json','model/gltf-binary'],text:true,binary:true,tests:['glTF'],parse:parse$1,options:{gltf:{normalize:true,// Normalize glTF v1 to glTF v2 format (not yet stable)
|
|
28183
28184
|
loadBuffers:true,// Fetch any linked .BIN buffers, decode base64
|
|
28184
28185
|
loadImages:true,// Create image objects
|
|
28185
28186
|
decompressMeshes:true// Decompress Draco encoded meshes
|
|
@@ -28194,9 +28195,9 @@ log:console// eslint-disable-line
|
|
|
28194
28195
|
// * Translate stringified enum keys and values into WebGL constants.
|
|
28195
28196
|
// * Load images (optional)
|
|
28196
28197
|
// ENUM LOOKUP
|
|
28197
|
-
function _parse$3(){_parse$3=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
28198
|
+
function _parse$3(){_parse$3=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee72(arrayBuffer){var options,context,_options2,_options2$byteOffset,byteOffset,gltf,_args75=arguments;return _regeneratorRuntime().wrap(function _callee72$(_context76){while(1){switch(_context76.prev=_context76.next){case 0:options=_args75.length>1&&_args75[1]!==undefined?_args75[1]:{};context=_args75.length>2?_args75[2]:undefined;// Apps can call the parse method directly, we so apply default options here
|
|
28198
28199
|
options=_objectSpread(_objectSpread({},GLTFLoader.options),options);// @ts-ignore
|
|
28199
|
-
options.gltf=_objectSpread(_objectSpread({},GLTFLoader.options.gltf),options.gltf);_options2=options,_options2$byteOffset=_options2.byteOffset,byteOffset=_options2$byteOffset===void 0?0:_options2$byteOffset;gltf={};
|
|
28200
|
+
options.gltf=_objectSpread(_objectSpread({},GLTFLoader.options.gltf),options.gltf);_options2=options,_options2$byteOffset=_options2.byteOffset,byteOffset=_options2$byteOffset===void 0?0:_options2$byteOffset;gltf={};_context76.next=8;return parseGLTF$1(gltf,arrayBuffer,byteOffset,options,context);case 8:return _context76.abrupt("return",_context76.sent);case 9:case"end":return _context76.stop();}}},_callee72);}));return _parse$3.apply(this,arguments);}var COMPONENTS={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16};var BYTES={5120:1,// BYTE
|
|
28200
28201
|
5121:1,// UNSIGNED_BYTE
|
|
28201
28202
|
5122:2,// SHORT
|
|
28202
28203
|
5123:2,// UNSIGNED_SHORT
|
|
@@ -32689,7 +32690,44 @@ sceneModel.fire("loaded",true,false);// Don't forget the event, for late subscri
|
|
|
32689
32690
|
});}},{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 _this179=this;var lines=this._ifcAPI.GetLineIDsWithType(ctx.modelID,type);for(var _i655=0;_i655<lines.size();_i655++){var relID=lines.get(_i655);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=_this179._ifcAPI.GetLine(ctx.modelID,element2.value);_this179._parseSpatialChildren(ctx,ifcElement,parentMetaObjectId);});}}}}},{key:"_parsePropertySets",value:function _parsePropertySets(ctx){var lines=this._ifcAPI.GetLineIDsWithType(ctx.modelID,this._webIFC.IFCRELDEFINESBYPROPERTIES);for(var _i656=0;_i656<lines.size();_i656++){var relID=lines.get(_i656);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 _i657=0,len=props.length;_i657<len;_i657++){var prop=props[_i657];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 _i658=0,_len127=relatedObjects.length;_i658<_len127;_i658++){var relatedObject=relatedObjects[_i658];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 _this180=this;this._ifcAPI.StreamAllMeshes(ctx.modelID,function(flatMesh){// TODO: Can we do geometry reuse with web-ifc?
|
|
32690
32691
|
var flatMeshExpressID=flatMesh.expressID;var placedGeometries=flatMesh.geometries;var meshIds=[];var properties=_this180._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=_this180._ifcAPI.GetGeometry(ctx.modelID,placedGeometry.geometryExpressID);var vertexData=_this180._ifcAPI.GetVertexArray(geometry.GetVertexData(),geometry.GetVertexDataSize());var indices=_this180._ifcAPI.GetIndexArray(geometry.GetIndexData(),geometry.GetIndexDataSize());// De-interleave vertex arrays
|
|
32691
32692
|
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
|
|
32692
|
-
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);/**
|
|
32693
|
+
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 _ref26=_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 _ref26.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 _len128=arguments.length,paths=new Array(_len128),_key15=0;_key15<_len128;_key15++){paths[_key15]=arguments[_key15];}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 _i659=0,_arr3=["mode","atime","mtime","ctime"];_i659<_arr3.length;_i659++){var key=_arr3[_i659];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 _ref27=_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 _ref27.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(_ref28){var _ref29=_slicedToArray(_ref28,2),k=_ref29[0],v=_ref29[1];return v;}).map(function(_ref30){var _ref31=_slicedToArray(_ref30,2),k=_ref31[0],v=_ref31[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 _super164=_createSuper(InternalError);function InternalError(message){var _this181;_classCallCheck(this,InternalError);_this181=_super164.call(this,message);_this181.name="InternalError";return _this181;}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 _super165=_createSuper(BindingError);function BindingError(message){var _this182;_classCallCheck(this,BindingError);_this182=_super165.call(this,message);_this182.name="BindingError";return _this182;}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 _i660=0,_Object$entries6=Object.entries(imports);_i660<_Object$entries6.length;_i660++){var _Object$entries6$_i=_slicedToArray(_Object$entries6[_i660],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 _loop11=function _loop11(){var _Object$entries7$_i=_slicedToArray(_Object$entries7[_i661],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 _i661=0,_Object$entries7=Object.entries(exports);_i661<_Object$entries7.length;_i661++){_loop11();}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 _len129=arguments.length,args=new Array(_len129),_key16=0;_key16<_len129;_key16++){args[_key16]=arguments[_key16];}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 _len130=arguments.length,args=new Array(_len130),_key17=0;_key17<_len130;_key17++){args[_key17]=arguments[_key17];}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 _super166=_createSuper(UnboundTypeError);function UnboundTypeError(){_classCallCheck(this,UnboundTypeError);return _super166.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:
|
|
32694
|
+
"loadingPriorityTypes":["IFCWALL","IFCSLAB","IFCWINDOW","IFCROOF","IFCFURNISHINGELEMENT","IFCAIRTERMINAL"]//[ "IfcOpeningElement" ],
|
|
32695
|
+
}};/**
|
|
32696
|
+
* Fetches a file from the given URL and returns its contents as text.
|
|
32697
|
+
*
|
|
32698
|
+
* @param {string} url - The URL to fetch the file from.
|
|
32699
|
+
* @returns {Promise<string>} A promise that resolves to the file contents.
|
|
32700
|
+
* @private
|
|
32701
|
+
*/function fetchFile(_x130){return _fetchFile.apply(this,arguments);}/**
|
|
32702
|
+
* {@link Viewer} plugin that uses [CxConverter](https://github.com/Creoox/cxconverter) to load BIM models directly from IFC files, using its WebAssembly buid from [npm package](https://www.npmjs.com/package/@creooxag/cxconverter).
|
|
32703
|
+
*
|
|
32704
|
+
* ## Overview
|
|
32705
|
+
* The WebAssembly build of CxConverter is still in alfa stage, so it may not work as expected. This documentation will be updated as the library and the plugin evolve. The example below shows how to use the plugin:
|
|
32706
|
+
* ````javascript
|
|
32707
|
+
* import { CxConverterIFCLoaderPlugin, Viewer } from "../../dist/xeokit-sdk.es.js";
|
|
32708
|
+
* const cxConverterIFCLoaderPlugin = new CxConverterIFCLoaderPlugin(viewer);
|
|
32709
|
+
*
|
|
32710
|
+
* const sceneModel = await cxConverterIFCLoaderPlugin.load({
|
|
32711
|
+
* src: "../../assets/models/ifc/Duplex.ifc"
|
|
32712
|
+
* });
|
|
32713
|
+
* ````
|
|
32714
|
+
See the code in action [here](https://xeokit.github.io/xeokit-sdk/examples/buildings/#cxConverterIFC_vbo_Duplex).
|
|
32715
|
+
*/function _fetchFile(){_fetchFile=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee74(url){var response;return _regeneratorRuntime().wrap(function _callee74$(_context78){while(1){switch(_context78.prev=_context78.next){case 0:_context78.prev=0;_context78.next=3;return fetch(url);case 3:response=_context78.sent;if(response.ok){_context78.next=6;break;}throw new Error("HTTP error! Status: ".concat(response.status));case 6:return _context78.abrupt("return",response.text());case 9:_context78.prev=9;_context78.t0=_context78["catch"](0);console.error('Error fetching file:',_context78.t0);case 12:case"end":return _context78.stop();}}},_callee74,null,[[0,9]]);}));return _fetchFile.apply(this,arguments);}var CxConverterIFCLoaderPlugin=/*#__PURE__*/function(_Plugin19){_inherits(CxConverterIFCLoaderPlugin,_Plugin19);var _super167=_createSuper(CxConverterIFCLoaderPlugin);/**
|
|
32716
|
+
* @constructor
|
|
32717
|
+
* @param {Viewer} viewer The Viewer.
|
|
32718
|
+
* @param {Object} [cfg={}] Plugin configuration.
|
|
32719
|
+
*/function CxConverterIFCLoaderPlugin(viewer){var _this183;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,CxConverterIFCLoaderPlugin);_this183=_super167.call(this,"ifcLoader",viewer,cfg);/**
|
|
32720
|
+
* The GLTFLoaderPlugin used internally to load the converted GLTF.
|
|
32721
|
+
* @type {GLTFLoaderPlugin}
|
|
32722
|
+
*/_this183.gltfLoader=new GLTFLoaderPlugin(_this183.viewer);return _this183;}/**
|
|
32723
|
+
* Loads an IFC model from the given source.
|
|
32724
|
+
*
|
|
32725
|
+
* @param {Object} [params={}] Loading parameters.
|
|
32726
|
+
* @param {string} params.src Path to an IFC file.
|
|
32727
|
+
* @param {Function} [params.progressCallback] Callback to track loading progress.
|
|
32728
|
+
* @param {Function} [params.progressTextCallback] Callback to track loading progress with text updates.
|
|
32729
|
+
* @returns {Promise<SceneModel>} A promise that resolves to the loaded SceneModel.
|
|
32730
|
+
*/_createClass(CxConverterIFCLoaderPlugin,[{key:"load",value:function(){var _load=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee17(){var params,data,_yield$ifc2gltf,gltf,metaData,sceneModel,_args20=arguments;return _regeneratorRuntime().wrap(function _callee17$(_context21){while(1){switch(_context21.prev=_context21.next){case 0:params=_args20.length>0&&_args20[0]!==undefined?_args20[0]:{};if(!params.src){this.error("load() param expected: src");}_context21.next=4;return fetchFile(params.src);case 4:data=_context21.sent;_context21.next=7;return ifc2gltf(data,{remote:true,progressCallback:params.progressCallback,progressTextCallback:params.progressTextCallback});case 7:_yield$ifc2gltf=_context21.sent;gltf=_yield$ifc2gltf.gltf;metaData=_yield$ifc2gltf.metaData;sceneModel=this.gltfLoader.load({id:"myModel",gltf:gltf,metaModelJSON:metaData});return _context21.abrupt("return",sceneModel);case 12:case"end":return _context21.stop();}}},_callee17,this);}));function load(){return _load.apply(this,arguments);}return load;}()}]);return CxConverterIFCLoaderPlugin;}(Plugin);/**
|
|
32693
32731
|
* Default data access strategy for {@link LASLoaderPlugin}.
|
|
32694
32732
|
*/var LASDefaultDataSource=/*#__PURE__*/function(){function LASDefaultDataSource(){var cfg=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};_classCallCheck(this,LASDefaultDataSource);this.cacheBuster=cfg.cacheBuster!==false;}_createClass(LASDefaultDataSource,[{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;}}/**
|
|
32695
32733
|
* Gets the contents of the given LAS file in an arraybuffer.
|
|
@@ -32737,7 +32775,7 @@ asmGlobalArg,asmLibraryArg,buffer);var __ZSt18uncaught_exceptionv=Module['__ZSt1
|
|
|
32737
32775
|
* @param offset
|
|
32738
32776
|
* @param count
|
|
32739
32777
|
* @returns number | number[] from incoming binary data
|
|
32740
|
-
*/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
|
|
32778
|
+
*/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 _i662=0;_i662<count;_i662++){ret.push(r[_i662]);}return ret;}/**
|
|
32741
32779
|
* Parsing of header's attributes
|
|
32742
32780
|
* @param arraybuffer
|
|
32743
32781
|
* @returns header as LASHeader
|
|
@@ -32757,7 +32795,7 @@ return true;}/**
|
|
|
32757
32795
|
* @param count
|
|
32758
32796
|
* @param skip
|
|
32759
32797
|
* @returns new ArrayBuffer, count, hasMoreData
|
|
32760
|
-
*/},{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
|
|
32798
|
+
*/},{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 _i663=0;_i663<pointsToRead;_i663++){if(_i663%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};}/**
|
|
32761
32799
|
* Method which brings data to null to close the file
|
|
32762
32800
|
* @returns
|
|
32763
32801
|
*/},{key:"close",value:function close(){// @ts-ignore Possibly null
|
|
@@ -32774,7 +32812,7 @@ Module=getModule();}}/**
|
|
|
32774
32812
|
* @param offset
|
|
32775
32813
|
* @param skip
|
|
32776
32814
|
* @returns Data
|
|
32777
|
-
*/},{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
|
|
32815
|
+
*/},{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 _i664=0;_i664<pointsToRead;_i664++){instance.getPoint(bufRead);if(_i664%skip===0){var _a12=new Uint8Array(Module.HEAPU8.buffer,bufRead,header.pointsStructSize);thisBuf.set(_a12,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));}}/**
|
|
32778
32816
|
* Deletes the instance
|
|
32779
32817
|
* @returns boolean
|
|
32780
32818
|
*/},{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;}();/**
|
|
@@ -32831,7 +32869,7 @@ schema:{fields:[],metadata:{}},header:{vertexCount:0,boundingBox:[[0,0,0],[0,0,0
|
|
|
32831
32869
|
};/* eslint-disable max-statements */ // @ts-ignore Possibly undefined
|
|
32832
32870
|
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`
|
|
32833
32871
|
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
|
|
32834
|
-
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
|
|
32872
|
+
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 _i665=0;_i665<batchSize;_i665++){var _decoder$getPoint=decoder.getPoint(_i665),_position3=_decoder$getPoint.position,_color12=_decoder$getPoint.color,intensity=_decoder$getPoint.intensity,classification=_decoder$getPoint.classification;positions[pointIndex*3]=_position3[0]*scaleX+offsetX;positions[pointIndex*3+1]=_position3[1]*scaleY+offsetY;positions[pointIndex*3+2]=_position3[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;}/**
|
|
32835
32873
|
* parse laz data
|
|
32836
32874
|
* @param rawData
|
|
32837
32875
|
* @param skip
|
|
@@ -32846,17 +32884,17 @@ onParseData(unpacker,header);if(!chunk.hasMoreData||totalRead>=totalToRead){brea
|
|
|
32846
32884
|
* @param batchSize
|
|
32847
32885
|
* @param colorDepth
|
|
32848
32886
|
* @returns boolean
|
|
32849
|
-
*/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
|
|
32887
|
+
*/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 _i666=0;_i666<batchSize;_i666++){var _decoder$getPoint2=decoder.getPoint(_i666),_color13=_decoder$getPoint2.color;// eslint-disable-next-line max-depth
|
|
32850
32888
|
if(_color13[0]>255||_color13[1]>255||_color13[2]>255){twoByteColor=true;}}}break;default:// eslint-disable-next-line
|
|
32851
32889
|
console.warn('las: illegal value for options.las.colorDepth');break;}return twoByteColor;}/**
|
|
32852
32890
|
* Loader for the LAS (LASer) point cloud format
|
|
32853
32891
|
* @note Does not support LAS v1.4
|
|
32854
|
-
*/var LASLoader=_objectSpread(_objectSpread({},LASLoader$2),{},{parse:function(){var _parse=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
32892
|
+
*/var LASLoader=_objectSpread(_objectSpread({},LASLoader$2),{},{parse:function(){var _parse=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee18(arrayBuffer,options){return _regeneratorRuntime().wrap(function _callee18$(_context22){while(1){switch(_context22.prev=_context22.next){case 0:return _context22.abrupt("return",parseLAS(arrayBuffer,options));case 1:case"end":return _context22.stop();}}},_callee18);}));function parse(_x131,_x132){return _parse.apply(this,arguments);}return parse;}(),parseSync:function parseSync(arrayBuffer,options){return parseLAS(arrayBuffer,options);}});//import * as epsgCheck from 'epsg-index/all.json';
|
|
32855
32893
|
var headerBlockItems=[{item:'FileSignature',format:'char',size:4},{item:'FileSoureceID',format:'uShort',size:2},{item:'GlobalEncoding',format:'uShort',size:2},{item:'ProjectID1',format:'notUsed',size:4},{item:'ProjectID2',format:'notUsed',size:2},{item:'ProjectID3',format:'notUsed',size:2},{item:'ProjectID4',format:'notUsed',size:8},{item:'VersionMajor',format:'uChar',size:1},{item:'VersionMinor',format:'uChar',size:1},{item:'SystemIdentifier',format:'char',size:32},{item:'GeneratingSoftware',format:'char',size:32},{item:'CreationDay',format:'uShort',size:2},{item:'CreationYear',format:'uShort',size:2},{item:'HeaderSize',format:'uShort',size:2},{item:'OffsetToPointData',format:'uLong',size:4},{item:'NumberOfVariableLengthRecords',format:'uLong',size:4},{item:'PointDataFormatID',format:'uChar',size:1},{item:'PointDataRecordLength',format:'uShort',size:2},{item:'NumberOfPoints',format:'uLong',size:4},{item:'NumberOfPointByReturn',format:'uLong',size:20},{item:'ScaleFactorX',format:'double',size:8},{item:'ScaleFactorY',format:'double',size:8},{item:'ScaleFactorZ',format:'double',size:8},{item:'OffsetX',format:'double',size:8},{item:'OffsetY',format:'double',size:8},{item:'OffsetZ',format:'double',size:8},{item:'MaxX',format:'double',size:8},{item:'MinX',format:'double',size:8},{item:'MaxY',format:'double',size:8},{item:'MinY',format:'double',size:8},{item:'MaxZ',format:'double',size:8},{item:'MinZ',format:'double',size:8}];var variableLengthRecord=[{item:'Reserved',format:'uShort',size:2},{item:'UserId',format:'char',size:16},{item:'RecordId',format:'uShort',size:2},{item:'RecordLengthAfterHeader',format:'uShort',size:2},{item:'Description',format:'char',size:32}];/**
|
|
32856
32894
|
* @private
|
|
32857
32895
|
* @param arrayBuffer
|
|
32858
32896
|
* @returns {{}}
|
|
32859
|
-
*/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(
|
|
32897
|
+
*/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(_ref32){var item=_ref32.item,format=_ref32.format,size=_ref32.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 _loop12=function _loop12(){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--){_loop12();}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 _i667=0;_i667<buf.length;++_i667){view[_i667]=buf[_i667];}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
|
|
32860
32898
|
/**
|
|
32861
32899
|
* {@link Viewer} plugin that loads lidar point cloud geometry from LAS files.
|
|
32862
32900
|
*
|
|
@@ -33047,7 +33085,7 @@ var headerBlockItems=[{item:'FileSignature',format:'char',size:4},{item:'FileSou
|
|
|
33047
33085
|
*
|
|
33048
33086
|
* @class LASLoaderPlugin
|
|
33049
33087
|
* @since 2.0.17
|
|
33050
|
-
*/var LASLoaderPlugin=/*#__PURE__*/function(
|
|
33088
|
+
*/var LASLoaderPlugin=/*#__PURE__*/function(_Plugin20){_inherits(LASLoaderPlugin,_Plugin20);var _super168=_createSuper(LASLoaderPlugin);/**
|
|
33051
33089
|
* @constructor
|
|
33052
33090
|
*
|
|
33053
33091
|
* @param {Viewer} viewer The Viewer.
|
|
@@ -33061,7 +33099,7 @@ var headerBlockItems=[{item:'FileSignature',format:'char',size:4},{item:'FileSou
|
|
|
33061
33099
|
* @param {Boolean} [cfg.rotateX=false] Whether to rotate the LAS point positions 90 degrees. Applied after "center".
|
|
33062
33100
|
* @param {Number[]} [cfg.rotate=[0,0,0]] Rotations to immediately apply to the LAS points, given as Euler angles in degrees, for each of the X, Y and Z axis. Rotation is applied after "center" and "rotateX".
|
|
33063
33101
|
* @param {Number[]} [cfg.transform] 4x4 transform matrix to immediately apply to the LAS points. This is applied after "center", "rotateX" and "rotate". Typically used instead of "rotateX" and "rotate".
|
|
33064
|
-
*/function LASLoaderPlugin(viewer){var
|
|
33102
|
+
*/function LASLoaderPlugin(viewer){var _this184;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,LASLoaderPlugin);_this184=_super168.call(this,"lasLoader",viewer,cfg);_this184.dataSource=cfg.dataSource;_this184.skip=cfg.skip;_this184.fp64=cfg.fp64;_this184.colorDepth=cfg.colorDepth;_this184.center=cfg.center;_this184.rotate=cfg.rotate;_this184.rotateX=cfg.rotateX;_this184.transform=cfg.transform;return _this184;}/**
|
|
33065
33103
|
* Gets the custom data source through which the LASLoaderPlugin can load LAS files.
|
|
33066
33104
|
*
|
|
33067
33105
|
* Default value is {@link LASDefaultDataSource}, which loads via HTTP.
|
|
@@ -33190,12 +33228,12 @@ var headerBlockItems=[{item:'FileSignature',format:'char',size:4},{item:'FileSou
|
|
|
33190
33228
|
* @param {Number[]} [params.matrix=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]] The model's world transform matrix. Overrides the position, scale and rotation parameters. Relative to ````origin````.
|
|
33191
33229
|
* @param {Object} [params.stats] Collects model statistics.
|
|
33192
33230
|
* @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}.
|
|
33193
|
-
*/},{key:"load",value:function load(){var
|
|
33231
|
+
*/},{key:"load",value:function load(){var _this185=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,{maxGeometryBatchSize:MAX_VERTICES,isModel:true}));if(!params.src&&!params.las&&!params.manifest&&!params.manifestSrc){this.error("load() param expected: src or las");return sceneModel;// Return new empty model
|
|
33194
33232
|
}var options={las:{skip:this._skip,fp64:this._fp64,colorDepth:this._colorDepth}};var spinner=this.viewer.scene.canvas.spinner;var done=function done(){sceneModel.scene.once("tick",function(){if(sceneModel.destroyed){return;}sceneModel.scene.fire("modelLoaded",sceneModel.id);// FIXME: Assumes listeners know order of these two events
|
|
33195
33233
|
sceneModel.fire("loaded",true,false);// Don't forget the event, for late subscribers
|
|
33196
|
-
});spinner.processes--;};var error=function error(errMsg){spinner.processes--;
|
|
33234
|
+
});spinner.processes--;};var error=function error(errMsg){spinner.processes--;_this185.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;_this185._dataSource.getLAS("".concat(baseDir).concat(lasFiles[i]),function(arrayBuffer){var modelParams=utils.apply(params,{isManifest:true,index:i});_this185._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++;_this185.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){_this185.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){_this185.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 _this186=this;var spinner=this.viewer.scene.canvas.spinner;spinner.processes++;this._dataSource.getLAS(params.src,function(arrayBuffer){_this186._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
|
|
33197
33235
|
sceneModel.fire("loaded",true,false);// Don't forget the event, for late subscribers
|
|
33198
|
-
});spinner.processes--;},function(errMsg){spinner.processes--;
|
|
33236
|
+
});spinner.processes--;},function(errMsg){spinner.processes--;_this186.error(errMsg);sceneModel.fire("error",errMsg);});},function(errMsg){spinner.processes--;_this186.error(errMsg);sceneModel.fire("error",errMsg);});}},{key:"_parseModel",value:function _parseModel(arrayBuffer,params,options,sceneModel){var _this187=this;var readPositions=function readPositions(attributesPosition){var positionsValue=attributesPosition.value;if(_this187._center){var centerPos=math.vec3();var numPoints=positionsValue.length;for(var _i668=0,len=positionsValue.length;_i668<len;_i668+=3){centerPos[0]+=positionsValue[_i668+0];centerPos[1]+=positionsValue[_i668+1];centerPos[2]+=positionsValue[_i668+2];}centerPos[0]/=numPoints;centerPos[1]/=numPoints;centerPos[2]/=numPoints;for(var _i669=0,_len131=positionsValue.length;_i669<_len131;_i669+=3){positionsValue[_i669+0]-=centerPos[0];positionsValue[_i669+1]-=centerPos[1];positionsValue[_i669+2]-=centerPos[2];}}if(_this187._rotateX){if(positionsValue){for(var _i670=0,_len132=positionsValue.length;_i670<_len132;_i670+=3){var temp=positionsValue[_i670+1];positionsValue[_i670+1]=positionsValue[_i670+2];positionsValue[_i670+2]=temp;}}}if(_this187._rotate){var quaternion=math.identityQuaternion();var mat=math.mat4();math.eulerToQuaternion(_this187._rotate,"XYZ",quaternion);math.quaternionToRotationMat4(quaternion,mat);var pos=math.vec3();for(var _i671=0,_len133=positionsValue.length;_i671<_len133;_i671+=3){pos[0]=positionsValue[_i671+0];pos[1]=positionsValue[_i671+1];pos[2]=positionsValue[_i671+2];math.transformPoint3(mat,pos,pos);positionsValue[_i671+0]=pos[0];positionsValue[_i671+1]=pos[1];positionsValue[_i671+2]=pos[2];}}if(_this187._transform){var _mat=math.mat4(_this187._transform);var _pos=math.vec3();for(var _i672=0,_len134=positionsValue.length;_i672<_len134;_i672+=3){_pos[0]=positionsValue[_i672+0];_pos[1]=positionsValue[_i672+1];_pos[2]=positionsValue[_i672+2];math.transformPoint3(_mat,_pos,_pos);positionsValue[_i672+0]=_pos[0];positionsValue[_i672+1]=_pos[1];positionsValue[_i672+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 _i673=0,j=0,k=0,len=intensities.length;_i673<len;_i673++,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[_i673]/65536*255);}return colorsCompressed;}function readIntensities(attributesIntensity){var intensities=attributesIntensity.value;var colorsCompressedSize=intensities.length*4;var colorsCompressed=new Uint8Array(colorsCompressedSize);for(var _i674=0,j=0,len=intensities.length;_i674<len;_i674++,j+=4){colorsCompressed[j+0]=0;colorsCompressed[j+1]=0;colorsCompressed[j+2]=0;colorsCompressed[j+3]=Math.round(intensities[_i674]/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 _i675=0,len=pointsChunks.length;_i675<len;_i675++){var meshId="".concat(params.isManifest?'model'+params.index:'',"pointsMesh").concat(_i675);meshIds.push(meshId);sceneModel.createMesh({id:meshId,primitive:"points",positions:pointsChunks[_i675],colorsCompressed:_i675<colorsChunks.length?colorsChunks[_i675]:null});}var pointsObjectId=params.entityId||math.createUUID();sceneModel.createEntity({id:pointsObjectId,meshIds:meshIds,isObject:true});sceneModel.finalize();if(params.metaModelJSON){var metaModelId=sceneModel.id;_this187.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;_this187.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 _i676=0;_i676<array.length;_i676+=chunkSize){result.push(array.slice(_i676,_i676+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
|
|
33199
33237
|
return pathArray.join('/')+'/';}/**
|
|
33200
33238
|
* Default data access strategy for {@link CityJSONLoaderPlugin}.
|
|
33201
33239
|
*/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;}}/**
|
|
@@ -33306,7 +33344,7 @@ return pathArray.join('/')+'/';}/**
|
|
|
33306
33344
|
*
|
|
33307
33345
|
* @class CityJSONLoaderPlugin
|
|
33308
33346
|
* @since 2.0.13
|
|
33309
|
-
*/var CityJSONLoaderPlugin=/*#__PURE__*/function(
|
|
33347
|
+
*/var CityJSONLoaderPlugin=/*#__PURE__*/function(_Plugin21){_inherits(CityJSONLoaderPlugin,_Plugin21);var _super169=_createSuper(CityJSONLoaderPlugin);/**
|
|
33310
33348
|
* @constructor
|
|
33311
33349
|
*
|
|
33312
33350
|
* @param {Viewer} viewer The Viewer.
|
|
@@ -33314,7 +33352,7 @@ return pathArray.join('/')+'/';}/**
|
|
|
33314
33352
|
* @param {String} [cfg.id="cityJSONLoader"] Optional ID for this plugin, so that we can find it within {@link Viewer#plugins}.
|
|
33315
33353
|
* @param {Object} [cfg.dataSource] A custom data source through which the CityJSONLoaderPlugin can load model and
|
|
33316
33354
|
* metadata files. Defaults to an instance of {@link CityJSONDefaultDataSource}, which loads over HTTP.
|
|
33317
|
-
*/function CityJSONLoaderPlugin(viewer){var
|
|
33355
|
+
*/function CityJSONLoaderPlugin(viewer){var _this188;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,CityJSONLoaderPlugin);_this188=_super169.call(this,"cityJSONLoader",viewer,cfg);_this188.dataSource=cfg.dataSource;return _this188;}/**
|
|
33318
33356
|
* Gets the custom data source through which the CityJSONLoaderPlugin can load CityJSON files.
|
|
33319
33357
|
*
|
|
33320
33358
|
* Default value is {@link CityJSONDefaultDataSource}, which loads via HTTP.
|
|
@@ -33346,18 +33384,18 @@ return pathArray.join('/')+'/';}/**
|
|
|
33346
33384
|
* primitives. Only works while {@link DTX#enabled} is also ````true````.
|
|
33347
33385
|
* @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}.
|
|
33348
33386
|
*/},{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
|
|
33349
|
-
}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
|
|
33387
|
+
}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 _this189=this;var spinner=this.viewer.scene.canvas.spinner;spinner.processes++;this._dataSource.getCityJSON(params.src,function(data){_this189._parseModel(data,params,options,sceneModel);spinner.processes--;},function(errMsg){spinner.processes--;_this189.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
|
|
33350
33388
|
sceneModel.fire("loaded",true,false);// Don't forget the event, for late subscribers
|
|
33351
|
-
});}},{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
|
|
33389
|
+
});}},{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 _i677=0,j=0;_i677<vertices.length;_i677++,j+=3){var x=vertices[_i677][0]*scale[0]+translate[0];var y=vertices[_i677][1]*scale[1]+translate[1];var _z5=vertices[_i677][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 _i678=0,len=cityObject.geometry.length;_i678<len;_i678++){var geometry=cityObject.geometry[_i678];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[_i678];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 _i679=0;_i679<surfaces.length;_i679++){var surface=surfaces[_i679];var surfaceMaterial=surfaceMaterials[_i679]||{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
|
|
33352
33390
|
geometryCfg.indices.push(face[0]);geometryCfg.indices.push(face[1]);geometryCfg.indices.push(face[2]);}else if(face.length>3){// Polygon
|
|
33353
33391
|
// Prepare to triangulate
|
|
33354
33392
|
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
|
|
33355
33393
|
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
|
|
33356
33394
|
var tr=earcut(pv,holes,2);// Create triangles
|
|
33357
33395
|
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
|
|
33358
|
-
});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
|
|
33396
|
+
});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 _i680=0;_i680<surfaces.length;_i680++){var boundary=[];var holes=[];for(var j=0;j<surfaces[_i680].length;j++){if(boundary.length>0){holes.push(boundary.length);}var newBoundary=this._extractLocalIndices(ctx,surfaces[_i680][j],sharedIndices,primitiveCfg);boundary.push.apply(boundary,_toConsumableArray(newBoundary));}if(boundary.length===3){// Triangle
|
|
33359
33397
|
primitiveCfg.indices.push(boundary[0]);primitiveCfg.indices.push(boundary[1]);primitiveCfg.indices.push(boundary[2]);}else if(boundary.length>3){// Polygon
|
|
33360
|
-
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
|
|
33398
|
+
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 _i681=0,len=boundary.length;_i681<len;_i681++){var index=boundary[_i681];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 _i682=0;_i682<positions.length;_i682++){var nexti=_i682+1;if(nexti===positions.length){nexti=0;}normal[0]+=(positions[_i682].y-positions[nexti].y)*(positions[_i682].z+positions[nexti].z);normal[1]+=(positions[_i682].z-positions[nexti].z)*(positions[_i682].x+positions[nexti].x);normal[2]+=(positions[_i682].x-positions[nexti].x)*(positions[_i682].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);/**
|
|
33361
33399
|
* Default data access strategy for {@link DotBIMLoaderPlugin}.
|
|
33362
33400
|
*
|
|
33363
33401
|
* This just loads assets using XMLHttpRequest.
|
|
@@ -33578,7 +33616,7 @@ var pList=[];for(var k=0;k<boundary.length;k++){pList.push({x:vertices[sharedInd
|
|
|
33578
33616
|
* });
|
|
33579
33617
|
* ````
|
|
33580
33618
|
* @class DotBIMLoaderPlugin
|
|
33581
|
-
*/var DotBIMLoaderPlugin=/*#__PURE__*/function(
|
|
33619
|
+
*/var DotBIMLoaderPlugin=/*#__PURE__*/function(_Plugin22){_inherits(DotBIMLoaderPlugin,_Plugin22);var _super170=_createSuper(DotBIMLoaderPlugin);/**
|
|
33582
33620
|
* @constructor
|
|
33583
33621
|
*
|
|
33584
33622
|
* @param {Viewer} viewer The Viewer.
|
|
@@ -33586,7 +33624,7 @@ var pList=[];for(var k=0;k<boundary.length;k++){pList.push({x:vertices[sharedInd
|
|
|
33586
33624
|
* @param {String} [cfg.id="DotBIMLoader"] Optional ID for this plugin, so that we can find it within {@link Viewer#plugins}.
|
|
33587
33625
|
* @param {Object} [cfg.objectDefaults] Map of initial default states for each loaded {@link Entity} that represents an object. Default value is {@link IFCObjectDefaults}.
|
|
33588
33626
|
* @param {Object} [cfg.dataSource] A custom data source through which the DotBIMLoaderPlugin can load metadata, glTF and binary attachments. Defaults to an instance of {@link DotBIMDefaultDataSource}, which loads over HTTP.
|
|
33589
|
-
*/function DotBIMLoaderPlugin(viewer){var
|
|
33627
|
+
*/function DotBIMLoaderPlugin(viewer){var _this190;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,DotBIMLoaderPlugin);_this190=_super170.call(this,"DotBIMLoader",viewer,cfg);_this190.dataSource=cfg.dataSource;_this190.objectDefaults=cfg.objectDefaults;return _this190;}/**
|
|
33590
33628
|
* Sets a custom data source through which the DotBIMLoaderPlugin can .BIM files.
|
|
33591
33629
|
*
|
|
33592
33630
|
* Default value is {@link DotBIMDefaultDataSource}, which loads via an XMLHttpRequest.
|
|
@@ -33630,15 +33668,15 @@ var pList=[];for(var k=0;k<boundary.length;k++){pList.push({x:vertices[sharedInd
|
|
|
33630
33668
|
* to non-textured triangle meshes, and that VBOs are always used for meshes that have textures, line segments, or point
|
|
33631
33669
|
* primitives. Only works while {@link DTX#enabled} is also ````true````.
|
|
33632
33670
|
* @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}
|
|
33633
|
-
*/,set:function set(value){this._objectDefaults=value||IFCObjectDefaults;}},{key:"load",value:function load(){var
|
|
33671
|
+
*/,set:function set(value){this._objectDefaults=value||IFCObjectDefaults;}},{key:"load",value:function load(){var _this191=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
|
|
33634
33672
|
if(!params.src&&!params.dotBIM){this.error("load() param expected: src or dotBIM");return sceneModel;// Return new empty model
|
|
33635
|
-
}var objectDefaults=params.objectDefaults||this._objectDefaults||IFCObjectDefaults;var includeTypes;if(params.includeTypes){includeTypes={};for(var
|
|
33673
|
+
}var objectDefaults=params.objectDefaults||this._objectDefaults||IFCObjectDefaults;var includeTypes;if(params.includeTypes){includeTypes={};for(var _i683=0,len=params.includeTypes.length;_i683<len;_i683++){includeTypes[params.includeTypes[_i683]]=true;}}var excludeTypes;if(params.excludeTypes){excludeTypes={};if(!includeTypes){includeTypes={};}for(var _i684=0,_len135=params.excludeTypes.length;_i684<_len135;_i684++){includeTypes[params.excludeTypes[_i684]]=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 _loop13=function _loop13(_i685,_len136){var element=dbElements[_i685];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:_i685;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 _i686=0,_len137=faceColors.length;_i686<_len137;_i686+=4){var faceColor=[faceColors[_i686],faceColors[_i686+1],faceColors[_i686+2],faceColors[_i686+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 _i687=0,_Object$entries8=Object.entries(coloredTrianglesDictionary);_i687<_Object$entries8.length;_i687++){var _Object$entries8$_i=_slicedToArray(_Object$entries8[_i687],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 _i685=0,_len136=dbElements.length;_i685<_len136;_i685++){var _ret3=_loop13(_i685,_len136);if(_ret3==="continue")continue;}sceneModel.finalize();_this191.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
|
|
33636
33674
|
sceneModel.fire("loaded",true,false);// Don't forget the event, for late subscribers
|
|
33637
33675
|
});};if(params.src){var src=params.src;this.viewer.scene.canvas.spinner.processes++;this._dataSource.getDotBIM(src,function(fileData){// OK
|
|
33638
|
-
var ctx={fileData:fileData,sceneModel:sceneModel,nextId:0,error:function error(errMsg){}};parseDotBIM(ctx);
|
|
33676
|
+
var ctx={fileData:fileData,sceneModel:sceneModel,nextId:0,error:function error(errMsg){}};parseDotBIM(ctx);_this191.viewer.scene.canvas.spinner.processes--;},function(err){_this191.viewer.scene.canvas.spinner.processes--;_this191.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(){_this191.viewer.metaScene.destroyMetaModel(modelId);});return sceneModel;}/**
|
|
33639
33677
|
* Destroys this DotBIMLoaderPlugin.
|
|
33640
|
-
*/},{key:"destroy",value:function destroy(){_get(_getPrototypeOf(DotBIMLoaderPlugin.prototype),"destroy",this).call(this);}}]);return DotBIMLoaderPlugin;}(Plugin);var hex2rgb=function hex2rgb(color){var rgb=function rgb(idx){return parseInt(color.substr(idx+1,2),16)/255;};return[rgb(0),rgb(2),rgb(4)];};var basePolygon3D=function basePolygon3D(scene,color,alpha){var mesh=null;var updateBase=function updateBase(points){if(points){if(mesh){mesh.destroy();}try{var
|
|
33641
|
-
var ind=(
|
|
33678
|
+
*/},{key:"destroy",value:function destroy(){_get(_getPrototypeOf(DotBIMLoaderPlugin.prototype),"destroy",this).call(this);}}]);return DotBIMLoaderPlugin;}(Plugin);var hex2rgb=function hex2rgb(color){var rgb=function rgb(idx){return parseInt(color.substr(idx+1,2),16)/255;};return[rgb(0),rgb(2),rgb(4)];};var basePolygon3D=function basePolygon3D(scene,color,alpha){var mesh=null;var updateBase=function updateBase(points){if(points){if(mesh){mesh.destroy();}try{var _ref33,_ref34;var _triangulateEarClippi3=triangulateEarClipping(points.map(function(p){return[p[0],p[2]];})),_triangulateEarClippi4=_slicedToArray(_triangulateEarClippi3,2),baseVertices=_triangulateEarClippi4[0],baseTriangles=_triangulateEarClippi4[1];var positions=(_ref33=[]).concat.apply(_ref33,_toConsumableArray(baseVertices.map(function(p){return[p[0],points[0][1],p[1]];})));// To convert from Float64Array into an Array
|
|
33679
|
+
var ind=(_ref34=[]).concat.apply(_ref34,_toConsumableArray(baseTriangles));mesh=new Mesh(scene,{pickable:false,// otherwise there's a WebGL error inside PickMeshRenderer.prototype.drawMesh
|
|
33642
33680
|
geometry:new ReadableGeometry(scene,{positions:positions,indices:ind,normals:math.buildNormals(positions,ind)}),material:new PhongMaterial(scene,{alpha:alpha!==undefined?alpha:0.5,backfaces:true,diffuse:hex2rgb(color)})});}catch(e){mesh=null;}}if(mesh){mesh.visible=!!points;}};updateBase(null);return{updateBase:updateBase,destroy:function destroy(){return mesh&&mesh.destroy();}};};var startAARectCreateUI=function startAARectCreateUI(scene,markersColor,pointerLens,select3dPoint,withPoints,onPointsSelected){var marker1=marker3D(scene,markersColor);var marker2=marker3D(scene,markersColor);var updatePointerLens=pointerLens?function(canvasPos){pointerLens.visible=!!canvasPos;if(canvasPos){pointerLens.canvasPos=canvasPos;}}:function(){};var deactivatePointSelection=select3dPoint(function(){updatePointerLens(null);marker1.update(null);},function(canvasPos,worldPos){updatePointerLens(canvasPos);marker1.update(worldPos);},function(point1CanvasPos,point1WorldPos){marker1.update(point1WorldPos);deactivatePointSelection=select3dPoint(function(){updatePointerLens(null);marker2.update(null);withPoints(null);},function(canvasPos,point2WorldPos){updatePointerLens(canvasPos);marker2.update(point2WorldPos);withPoints(math.distVec3(point1WorldPos,point2WorldPos)>0.01&&[point1WorldPos,point2WorldPos]);},function(point2CanvasPos,point2WorldPos){// `marker2.update' makes sure marker's position has been updated from its default [0,0,0]
|
|
33643
33681
|
// This works around an unidentified bug somewhere around OcclusionLayer, that causes error
|
|
33644
33682
|
// [.WebGL-0x13400c47e00] GL_INVALID_OPERATION: Vertex buffer is not big enough for the draw call
|
|
@@ -33646,22 +33684,22 @@ marker2.update(point2WorldPos);marker1.destroy();marker2.destroy();updatePointer
|
|
|
33646
33684
|
* @desc Renders a transparent box between two 3D points.
|
|
33647
33685
|
*
|
|
33648
33686
|
* See {@link ZonesPlugin} for more info.
|
|
33649
|
-
*/var Zone=/*#__PURE__*/function(_Component41){_inherits(Zone,_Component41);var
|
|
33687
|
+
*/var Zone=/*#__PURE__*/function(_Component41){_inherits(Zone,_Component41);var _super171=_createSuper(Zone);/**
|
|
33650
33688
|
* @private
|
|
33651
|
-
*/function Zone(plugin){var
|
|
33689
|
+
*/function Zone(plugin){var _this192;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,Zone);_this192=_super171.call(this,plugin.viewer.scene,cfg);/**
|
|
33652
33690
|
* The {@link ZonesPlugin} that owns this Zone.
|
|
33653
33691
|
* @type {ZonesPlugin}
|
|
33654
|
-
*/
|
|
33655
|
-
var pos=[];var ind=[];var addPlane=function addPlane(isCeiling){var baseIdx=pos.length;var
|
|
33692
|
+
*/_this192.plugin=plugin;_this192._container=cfg.container;if(!_this192._container){throw"config missing: container";}_this192._eventSubs={};_this192.plugin.viewer.scene;_this192._geometry=cfg.geometry;cfg.onMouseOver?function(event){cfg.onMouseOver(event,_assertThisInitialized(_this192));_this192.plugin.viewer.scene.canvas.canvas.dispatchEvent(new MouseEvent('mouseover',event));}:null;cfg.onMouseLeave?function(event){cfg.onMouseLeave(event,_assertThisInitialized(_this192));_this192.plugin.viewer.scene.canvas.canvas.dispatchEvent(new MouseEvent('mouseleave',event));}:null;cfg.onContextMenu?function(event){cfg.onContextMenu(event,_assertThisInitialized(_this192));}:null;_this192._alpha="alpha"in cfg&&cfg.alpha!==undefined?cfg.alpha:0.5;_this192.color=cfg.color;_this192._visible=true;_this192._rebuildMesh();return _this192;}_createClass(Zone,[{key:"_rebuildMesh",value:function _rebuildMesh(){var _ref35,_this193=this;var scene=this.plugin.viewer.scene;var planeCoords=this._geometry.planeCoordinates.slice();var downward=this._geometry.height<0;var altitude=this._geometry.altitude+(downward?this._geometry.height:0);var height=this._geometry.height*(downward?-1:1);var _triangulateEarClippi5=triangulateEarClipping(planeCoords),_triangulateEarClippi6=_slicedToArray(_triangulateEarClippi5,3),baseVertices=_triangulateEarClippi6[0],baseTriangles=_triangulateEarClippi6[1],isCCW=_triangulateEarClippi6[2];// TODO: prevent crossing edges
|
|
33693
|
+
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
|
|
33656
33694
|
addPlane(true);// ceiling
|
|
33657
33695
|
// sides
|
|
33658
|
-
var
|
|
33659
|
-
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
|
|
33696
|
+
var _loop14=function _loop14(_i688){var a=baseVertices[_i688];var b=baseVertices[(baseVertices.length+_i688+(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 _i688=0;_i688<baseVertices.length;++_i688){_loop14(_i688);}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=(_ref35=[]).concat.apply(_ref35,_toConsumableArray(pos.map(function(p){return math.subVec3(p,_this193._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
|
|
33697
|
+
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 _i689=0;_i689<geo.indices.length;_i689+=3){for(var off=0;off<3;++off){var _p5=pts[off];var pIdx=3*geo.indices[_i689+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 _a13=this._geometry.altitude;var c=_a13+Math.max(0,h);var _f2=_a13+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
|
|
33660
33698
|
addPlane(false);// floor
|
|
33661
33699
|
// sides
|
|
33662
|
-
var _p6=function _p6(idx,y){return[planeCoords[idx][0],y,planeCoords[idx][1]];};for(var
|
|
33663
|
-
var polygonType=0;var
|
|
33664
|
-
switch(polygonType){case COPLANAR:newFaces.push(face);break;case FRONT:newFaces.push(face);break;case BACK:break;case SPANNING:var _f4=[];for(var
|
|
33700
|
+
var _p6=function _p6(idx,y){return[planeCoords[idx][0],y,planeCoords[idx][1]];};for(var _i690=0;_i690<planeCoords.length;++_i690){var _j9=(_i690+1)%planeCoords.length;faces.push([_p6(_i690,_f2),_p6(_j9,_f2),_p6(_j9,c),_p6(_i690,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.
|
|
33701
|
+
var polygonType=0;var _types=[];for(var _i691=0;_i691<face.length;_i691++){var t=math.dotVec3(dir,face[_i691])+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.
|
|
33702
|
+
switch(polygonType){case COPLANAR:newFaces.push(face);break;case FRONT:newFaces.push(face);break;case BACK:break;case SPANNING:var _f4=[];for(var _i692=0;_i692<face.length;_i692++){var j=(_i692+1)%face.length;var ti=_types[_i692];var tj=_types[j];var vi=face[_i692];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;}}/**
|
|
33665
33703
|
* Sets whether this Zone is visible or not.
|
|
33666
33704
|
*
|
|
33667
33705
|
* @type {Boolean}
|
|
@@ -33704,19 +33742,19 @@ switch(polygonType){case COPLANAR:newFaces.push(face);break;case FRONT:newFaces.
|
|
|
33704
33742
|
*
|
|
33705
33743
|
* const zonesControl = new ZonesMouseControl(Zones)
|
|
33706
33744
|
* ````
|
|
33707
|
-
*/var ZonesAAZoneControl=/*#__PURE__*/function(_Component42){_inherits(ZonesAAZoneControl,_Component42);var
|
|
33745
|
+
*/var ZonesAAZoneControl=/*#__PURE__*/function(_Component42){_inherits(ZonesAAZoneControl,_Component42);var _super172=_createSuper(ZonesAAZoneControl);/**
|
|
33708
33746
|
* Creates a ZonesMouseControl bound to the given ZonesPlugin.
|
|
33709
33747
|
*
|
|
33710
33748
|
* @param {ZonesPlugin} zonesPlugin The ZonesPlugin to control.
|
|
33711
33749
|
* @param [cfg] Configuration
|
|
33712
33750
|
* @param {PointerLens} [cfg.pointerLens] A PointerLens to use to provide a magnified view of the cursor when snapping is enabled.
|
|
33713
|
-
*/function ZonesAAZoneControl(zonesPlugin,cfg,createSelect3dPoint){var
|
|
33751
|
+
*/function ZonesAAZoneControl(zonesPlugin,cfg,createSelect3dPoint){var _this194;_classCallCheck(this,ZonesAAZoneControl);_this194=_super172.call(this,zonesPlugin.viewer.scene);_this194.zonesPlugin=zonesPlugin;_this194.pointerLens=cfg.pointerLens;_this194.createSelect3dPoint=createSelect3dPoint;_this194._deactivate=null;return _this194;}_createClass(ZonesAAZoneControl,[{key:"active",get:function get(){return!!this._deactivate;}},{key:"activate",value:function activate(zoneAltitude,zoneHeight,zoneColor,zoneAlpha){if(this._deactivate){return;}if(_typeof(zoneAltitude)==="object"&&zoneAltitude!==null){var params=zoneAltitude;var param=function param(name,defaultValue){if(name in params){return params[name];}else if(defaultValue!==undefined){return defaultValue;}else{throw"config missing: "+name;}};zoneAltitude=param("altitude");zoneHeight=param("height");zoneColor=param("color","#008000");zoneAlpha=param("alpha",0.5);}var zonesPlugin=this.zonesPlugin;var viewer=zonesPlugin.viewer;var scene=viewer.scene;var self=this;var select3dPoint=this.createSelect3dPoint(viewer,function(origin,direction){return planeIntersect(zoneAltitude,math.vec3([0,1,0]),origin,direction);});(function rec(){var basePolygon=basePolygon3D(scene,zoneColor,zoneAlpha);var deactivate=startAARectCreateUI(scene,zoneColor,self.pointerLens,select3dPoint,function(points){if(points){var p0=points[0];var p1=points[1];var min=function min(idx){return Math.min(p0[idx],p1[idx]);};var max=function max(idx){return Math.max(p0[idx],p1[idx]);};var xmin=min(0);var ymin=min(1);var zmin=min(2);var xmax=max(0);max(1);var zmax=max(2);basePolygon.updateBase([[xmin,ymin,zmax],[xmax,ymin,zmax],[xmax,ymin,zmin],[xmin,ymin,zmin]]);}else{basePolygon.updateBase(null);}},function(points){basePolygon.destroy();var zone=createAAZoneFromPoints(points[0],points[1],zoneAltitude,zoneHeight,zoneColor,zoneAlpha,zonesPlugin);var reactivate=true;self._deactivate=function(){reactivate=false;};self.fire("zoneEnd",zone);if(reactivate){rec();}}).deactivate;self._deactivate=function(){deactivate();basePolygon.destroy();};})();}},{key:"deactivate",value:function deactivate(){if(this._deactivate){this._deactivate();this._deactivate=null;}}/**
|
|
33714
33752
|
* Destroys this ZonesMouseControl.
|
|
33715
33753
|
*
|
|
33716
33754
|
* Destroys any {@link Zone} under construction by this ZonesMouseControl.
|
|
33717
|
-
*/},{key:"destroy",value:function destroy(){this.deactivate();_get(_getPrototypeOf(ZonesAAZoneControl.prototype),"destroy",this).call(this);}}]);return ZonesAAZoneControl;}(Component);var ZonesMouseControl=/*#__PURE__*/function(_ZonesAAZoneControl){_inherits(ZonesMouseControl,_ZonesAAZoneControl);var
|
|
33755
|
+
*/},{key:"destroy",value:function destroy(){this.deactivate();_get(_getPrototypeOf(ZonesAAZoneControl.prototype),"destroy",this).call(this);}}]);return ZonesAAZoneControl;}(Component);var ZonesMouseControl=/*#__PURE__*/function(_ZonesAAZoneControl){_inherits(ZonesMouseControl,_ZonesAAZoneControl);var _super173=_createSuper(ZonesMouseControl);function ZonesMouseControl(zonesPlugin){var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,ZonesMouseControl);return _super173.call(this,zonesPlugin,cfg,function(viewer,ray2WorldPos){return mousePointSelector(viewer,ray2WorldPos);});}return _createClass(ZonesMouseControl);}(ZonesAAZoneControl);var ZonesTouchControl=/*#__PURE__*/function(_ZonesAAZoneControl2){_inherits(ZonesTouchControl,_ZonesAAZoneControl2);var _super174=_createSuper(ZonesTouchControl);function ZonesTouchControl(zonesPlugin){var _this195;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,ZonesTouchControl);var pointerCircle=new PointerCircle(zonesPlugin.viewer);_this195=_super174.call(this,zonesPlugin,cfg,function(viewer,ray2WorldPos){return touchPointSelector(viewer,pointerCircle,ray2WorldPos);});_this195.pointerCircle=pointerCircle;return _this195;}_createClass(ZonesTouchControl,[{key:"destroy",value:function destroy(){this.pointerCircle.destroy();_get(_getPrototypeOf(ZonesTouchControl.prototype),"destroy",this).call(this);}}]);return ZonesTouchControl;}(ZonesAAZoneControl);/**
|
|
33718
33756
|
* ZonesPlugin documentation to be added, mostly compatible with DistanceMeasurementsPlugin.
|
|
33719
|
-
*/var ZonesPlugin=/*#__PURE__*/function(
|
|
33757
|
+
*/var ZonesPlugin=/*#__PURE__*/function(_Plugin23){_inherits(ZonesPlugin,_Plugin23);var _super175=_createSuper(ZonesPlugin);/**
|
|
33720
33758
|
* @constructor
|
|
33721
33759
|
* @param {Viewer} viewer The Viewer.
|
|
33722
33760
|
* @param {Object} [cfg] Plugin configuration.
|
|
@@ -33725,7 +33763,7 @@ switch(polygonType){case COPLANAR:newFaces.push(face);break;case FRONT:newFaces.
|
|
|
33725
33763
|
* @param {string} [cfg.defaultColor=#00BBFF] The default color of the length dots, wire and label.
|
|
33726
33764
|
* @param {number} [cfg.zIndex] If set, the wires, dots and labels will have this zIndex (+1 for dots and +2 for labels).
|
|
33727
33765
|
* @param {PointerCircle} [cfg.pointerLens] A PointerLens to help the user position the pointer. This can be shared with other plugins.
|
|
33728
|
-
*/function ZonesPlugin(viewer){var
|
|
33766
|
+
*/function ZonesPlugin(viewer){var _this196;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,ZonesPlugin);_this196=_super175.call(this,"Zones",viewer);_this196._pointerLens=cfg.pointerLens;_this196._container=cfg.container||document.body;_this196._zones=[];_this196.defaultColor=cfg.defaultColor!==undefined?cfg.defaultColor:"#00BBFF";_this196.zIndex=cfg.zIndex||10000;_this196._onMouseOver=function(event,zone){_this196.fire("mouseOver",{plugin:_assertThisInitialized(_this196),zone:zone,event:event});};_this196._onMouseLeave=function(event,zone){_this196.fire("mouseLeave",{plugin:_assertThisInitialized(_this196),zone:zone,event:event});};_this196._onContextMenu=function(event,zone){_this196.fire("contextMenu",{plugin:_assertThisInitialized(_this196),zone:zone,event:event});};return _this196;}/**
|
|
33729
33767
|
* Creates a {@link Zone}.
|
|
33730
33768
|
*
|
|
33731
33769
|
* The Zone is then registered by {@link Zone#id} in {@link ZonesPlugin#zones}.
|
|
@@ -33738,7 +33776,7 @@ switch(polygonType){case COPLANAR:newFaces.push(face);break;case FRONT:newFaces.
|
|
|
33738
33776
|
* @param {Entity} params.target.entity Target Entity.
|
|
33739
33777
|
* @param {string} [params.color] The color of the length dot, wire and label.
|
|
33740
33778
|
* @returns {Zone} The new {@link Zone}.
|
|
33741
|
-
*/_createClass(ZonesPlugin,[{key:"createZone",value:function createZone(){var
|
|
33779
|
+
*/_createClass(ZonesPlugin,[{key:"createZone",value:function createZone(){var _this197=this;var params=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};if(this.viewer.scene.components[params.id]){this.error("Viewer scene component with this ID already exists: "+params.id);delete params.id;}var zone=new Zone(this,{id:params.id,plugin:this,container:this._container,geometry:params.geometry,alpha:params.alpha,color:params.color,onMouseOver:this._onMouseOver,onMouseLeave:this._onMouseLeave,onContextMenu:this._onContextMenu});this._zones.push(zone);zone.on("destroyed",function(){var idx=_this197._zones.indexOf(zone);if(idx>=0){_this197._zones.splice(idx,1);}});this.fire("zoneCreated",zone);return zone;}/**
|
|
33742
33780
|
* Gets the existing {@link Zone}s, each mapped to its {@link Zone#id}.
|
|
33743
33781
|
*
|
|
33744
33782
|
* @type {{String:Zone}}
|
|
@@ -33749,7 +33787,7 @@ switch(polygonType){case COPLANAR:newFaces.push(face);break;case FRONT:newFaces.
|
|
|
33749
33787
|
*/},{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
|
|
33750
33788
|
// clockwise
|
|
33751
33789
|
// counterclockwise
|
|
33752
|
-
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
|
|
33790
|
+
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 _i693=excludeFirstSegment?1:0;_i693<pos2D.length-2-1;++_i693){var c=pos2D[_i693];var d=pos2D[_i693+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
|
|
33753
33791
|
o1===0&&onSegment(a,c,b)||// a, b and c are collinear and c lies on segment ab
|
|
33754
33792
|
o2===0&&onSegment(a,d,b)||// a, b and d are collinear and d lies on segment ab
|
|
33755
33793
|
o3===0&&onSegment(c,a,d)||// c, d and a are collinear and a lies on segment cd
|
|
@@ -33757,4 +33795,4 @@ o4===0&&onSegment(c,b,d))// c, d and b are collinear and b lies on segment cd
|
|
|
33757
33795
|
{return true;}}return false;};}();deactivatePointSelection=select3dPoint(function(){updatePointerLens(null);marker.update(null);wire&&wire.update(wireStart,null);basePolygon.updateBase(markers.length>2?markers.map(function(m){return m.getWorldPos();}):null);},function(canvasPos,worldPos){var snappedFirst=markers.length>2&&getSnappedFirst(canvasPos);firstMarker&&firstMarker.setHighlighted(!!snappedFirst);updatePointerLens(snappedFirst?snappedFirst.canvasPos:canvasPos);marker.update(!snappedFirst&&worldPos);wire&&wire.update(wireStart,snappedFirst?snappedFirst.worldPos:worldPos);if(markers.length>=2){var pos=markers.map(function(m){return m.getWorldPos();}).concat(snappedFirst?[]:[worldPos]);var inter=lastSegmentIntersects(pos.map(function(p){return[p[0],p[2]];}),snappedFirst);basePolygon.updateBase(inter?null:pos);}else basePolygon.updateBase(null);},function(canvasPos,worldPos){var snappedFirst=markers.length>2&&getSnappedFirst(canvasPos);var pos=markers.map(function(m){return m.getWorldPos();}).concat(snappedFirst?[]:[worldPos]);basePolygon.updateBase(pos);var pos2D=pos.map(function(p){return[p[0],p[2]];});if(markers.length>2&&lastSegmentIntersects(pos2D,snappedFirst)){cleanups.pop()();selectNextPoint(markers);}else if(snappedFirst){// `marker2.update' makes sure marker's position has been updated from its default [0,0,0]
|
|
33758
33796
|
// This works around an unidentified bug somewhere around OcclusionLayer, that causes error
|
|
33759
33797
|
// [.WebGL-0x13400c47e00] GL_INVALID_OPERATION: Vertex buffer is not big enough for the draw call
|
|
33760
|
-
marker.update(worldPos);cleanups.forEach(function(c){return c();});onZoneCreated(zonesPlugin.createZone({id:math.createUUID(),geometry:{planeCoordinates:pos2D,altitude:zoneAltitude,height:zoneHeight},alpha:zoneAlpha,color:zoneColor}));}else{marker.update(worldPos);wire&&wire.update(wireStart,worldPos);selectNextPoint(markers.concat(marker));}});})([]);return{closeSurface:function closeSurface(){throw"TODO";},deactivate:function deactivate(){deactivatePointSelection();cleanups.forEach(function(c){return c();});}};};var ZonesPolysurfaceMouseControl=/*#__PURE__*/function(_Component43){_inherits(ZonesPolysurfaceMouseControl,_Component43);var _super172=_createSuper(ZonesPolysurfaceMouseControl);function ZonesPolysurfaceMouseControl(zonesPlugin){var _this195;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,ZonesPolysurfaceMouseControl);_this195=_super172.call(this,zonesPlugin.viewer.scene);_this195.zonesPlugin=zonesPlugin;_this195.pointerLens=cfg.pointerLens;_this195._action=null;return _this195;}_createClass(ZonesPolysurfaceMouseControl,[{key:"active",get:function get(){return!!this._action;}},{key:"activate",value:function activate(zoneAltitude,zoneHeight,zoneColor,zoneAlpha){if(_typeof(zoneAltitude)==="object"&&zoneAltitude!==null){var params=zoneAltitude;var param=function param(name,defaultValue){if(name in params){return params[name];}else if(defaultValue!==undefined){return defaultValue;}else{throw"config missing: "+name;}};zoneAltitude=param("altitude");zoneHeight=param("height");zoneColor=param("color","#008000");zoneAlpha=param("alpha",0.5);}if(this._action){return;}var zonesPlugin=this.zonesPlugin;var viewer=zonesPlugin.viewer;var scene=viewer.scene;var self=this;var select3dPoint=mousePointSelector(viewer,function(origin,direction){return planeIntersect(zoneAltitude,math.vec3([0,1,0]),origin,direction);});(function rec(){self._action=startPolysurfaceZoneCreateUI(scene,zoneAltitude,zoneHeight,zoneColor,zoneAlpha,self.pointerLens,zonesPlugin,select3dPoint,function(zone){var reactivate=true;self._action={deactivate:function deactivate(){reactivate=false;}};self.fire("zoneEnd",zone);if(reactivate){rec();}});})();}},{key:"deactivate",value:function deactivate(){if(this._action){this._action.deactivate();this._action=null;}}},{key:"destroy",value:function destroy(){this.deactivate();_get(_getPrototypeOf(ZonesPolysurfaceMouseControl.prototype),"destroy",this).call(this);}}]);return ZonesPolysurfaceMouseControl;}(Component);var ZonesPolysurfaceTouchControl=/*#__PURE__*/function(_Component44){_inherits(ZonesPolysurfaceTouchControl,_Component44);var _super173=_createSuper(ZonesPolysurfaceTouchControl);function ZonesPolysurfaceTouchControl(zonesPlugin){var _this196;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,ZonesPolysurfaceTouchControl);_this196=_super173.call(this,zonesPlugin.viewer.scene);_this196.zonesPlugin=zonesPlugin;_this196.pointerLens=cfg.pointerLens;_this196.pointerCircle=new PointerCircle(zonesPlugin.viewer);_this196._action=null;return _this196;}_createClass(ZonesPolysurfaceTouchControl,[{key:"active",get:function get(){return!!this._action;}},{key:"activate",value:function activate(zoneAltitude,zoneHeight,zoneColor,zoneAlpha){if(_typeof(zoneAltitude)==="object"&&zoneAltitude!==null){var params=zoneAltitude;var param=function param(name,defaultValue){if(name in params){return params[name];}else if(defaultValue!==undefined){return defaultValue;}else{throw"config missing: "+name;}};zoneAltitude=param("altitude");zoneHeight=param("height");zoneColor=param("color","#008000");zoneAlpha=param("alpha",0.5);}if(this._action){return;}var zonesPlugin=this.zonesPlugin;var viewer=zonesPlugin.viewer;var scene=viewer.scene;var self=this;var select3dPoint=touchPointSelector(viewer,this.pointerCircle,function(origin,direction){return planeIntersect(zoneAltitude,math.vec3([0,1,0]),origin,direction);});(function rec(){self._action=startPolysurfaceZoneCreateUI(scene,zoneAltitude,zoneHeight,zoneColor,zoneAlpha,self.pointerLens,zonesPlugin,select3dPoint,function(zone){var reactivate=true;self._action={deactivate:function deactivate(){reactivate=false;}};self.fire("zoneEnd",zone);if(reactivate){rec();}});})();}},{key:"deactivate",value:function deactivate(){if(this._action){this._action.deactivate();this._action=null;}}},{key:"destroy",value:function destroy(){this.deactivate();_get(_getPrototypeOf(ZonesPolysurfaceTouchControl.prototype),"destroy",this).call(this);}}]);return ZonesPolysurfaceTouchControl;}(Component);var ZoneEditControl=/*#__PURE__*/function(_Component45){_inherits(ZoneEditControl,_Component45);var _super174=_createSuper(ZoneEditControl);function ZoneEditControl(zone,cfg,handleMouseEvents,handleTouchEvents){var _this197;_classCallCheck(this,ZoneEditControl);var viewer=zone.plugin.viewer;var scene=viewer.scene;_this197=_super174.call(this,scene);var altitude=zone._geometry.altitude;var dots=zone._geometry.planeCoordinates.map(function(planeCoord){var dotParent=scene.canvas.canvas.ownerDocument.body;var dot=new Dot3D(scene,{},dotParent,{fillColor:zone._color});dot.worldPos=math.vec3([planeCoord[0],altitude,planeCoord[1]]);dot.on("worldPos",function(){planeCoord[0]=dot.worldPos[0];planeCoord[1]=dot.worldPos[2];try{zone._rebuildMesh();}catch(e){if(zone._zoneMesh){zone._zoneMesh.destroy();zone._zoneMesh=null;}}});return dot;});var cleanupDrag=activateDraggableDots({viewer:viewer,handleMouseEvents:handleMouseEvents,handleTouchEvents:handleTouchEvents,pointerLens:cfg&&cfg.pointerLens,dots:dots,ray2WorldPos:function ray2WorldPos(orig,dir){return planeIntersect(altitude,math.vec3([0,1,0]),orig,dir);},onEnd:function onEnd(initPos,dot){if(zone._zoneMesh){_this197.fire("edited");}return!!zone._zoneMesh;}});var cleanup=function cleanup(){cleanupDrag();dots.forEach(function(d){return d.destroy();});};var destroyCb=zone.on("destroyed",cleanup);_this197._deactivate=function(){zone.off("destroyed",destroyCb);cleanup();};return _this197;}_createClass(ZoneEditControl,[{key:"deactivate",value:function deactivate(){this._deactivate();_get(_getPrototypeOf(ZoneEditControl.prototype),"destroy",this).call(this);}}]);return ZoneEditControl;}(Component);var ZoneEditMouseControl=/*#__PURE__*/function(_ZoneEditControl){_inherits(ZoneEditMouseControl,_ZoneEditControl);var _super175=_createSuper(ZoneEditMouseControl);function ZoneEditMouseControl(zone,cfg){_classCallCheck(this,ZoneEditMouseControl);return _super175.call(this,zone,cfg,true,false);}return _createClass(ZoneEditMouseControl);}(ZoneEditControl);var ZoneEditTouchControl=/*#__PURE__*/function(_ZoneEditControl2){_inherits(ZoneEditTouchControl,_ZoneEditControl2);var _super176=_createSuper(ZoneEditTouchControl);function ZoneEditTouchControl(zone,cfg){_classCallCheck(this,ZoneEditTouchControl);return _super176.call(this,zone,cfg,false,true);}return _createClass(ZoneEditTouchControl);}(ZoneEditControl);var ZoneTranslateControl=/*#__PURE__*/function(_Component46){_inherits(ZoneTranslateControl,_Component46);var _super177=_createSuper(ZoneTranslateControl);function ZoneTranslateControl(zone,cfg,handleMouseEvents,handleTouchEvents){var _this198;_classCallCheck(this,ZoneTranslateControl);var viewer=zone.plugin.viewer;var scene=viewer.scene;var canvas=scene.canvas.canvas;_this198=_super177.call(this,scene);var self=_assertThisInitialized(_this198);var altitude=zone._geometry.altitude;var pointerLens=cfg&&cfg.pointerLens;var updatePointerLens=pointerLens?function(canvasPos){pointerLens.visible=!!canvasPos;if(canvasPos){pointerLens.canvasPos=canvasPos;}}:function(){};var ray2WorldPos=function ray2WorldPos(orig,dir){return planeIntersect(altitude,math.vec3([0,1,0]),orig,dir);};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 copyCanvasPos=function copyCanvasPos(event,vec2){vec2[0]=event.clientX;vec2[1]=event.clientY;transformToNode(canvas.ownerDocument.documentElement,canvas,vec2);return vec2;};var canvasHandle=function canvasHandle(type,cb){var callback=function callback(event){event.preventDefault();cb(event);};canvas.addEventListener(type,callback);return function(){return canvas.removeEventListener(type,callback);};};var _cleanupCurrentDrag=function cleanupCurrentDrag(){};var startDrag=function startDrag(event,onMoveType,onEndType,matchesEvent){var e=matchesEvent(event);var canvasPos=copyCanvasPos(e,math.vec2());var pickRecord=viewer.scene.pick({canvasPos:canvasPos,includeEntities:[zone._zoneMesh.id]});var pickZone=pickRecord&&pickRecord.entity&&pickRecord.entity.zone;if(pickZone===zone){_cleanupCurrentDrag();canvas.style.cursor="move";viewer.cameraControl.active=false;var onChange=function(){var initCoords=zone._geometry.planeCoordinates.map(function(c){return c.slice();});var initWorldPos=pickWorldPos(canvasPos);var initDragCoord=math.vec2([initWorldPos[0],initWorldPos[2]]);var dPos=math.vec2();return function(canvasPos){var worldPos=pickWorldPos(canvasPos);dPos[0]=worldPos[0];dPos[1]=worldPos[2];math.subVec2(initDragCoord,dPos,dPos);zone._geometry.planeCoordinates.forEach(function(planeCoord,idx){math.subVec2(initCoords[idx],dPos,planeCoord);});try{zone._rebuildMesh();}catch(e){if(zone._zoneMesh){zone._zoneMesh.destroy();zone._zoneMesh=null;}}};}();var cleanupMove=canvasHandle(onMoveType,function(event){var e=matchesEvent(event);if(e){var _canvasPos5=copyCanvasPos(e,math.vec2());onChange(_canvasPos5);updatePointerLens(_canvasPos5);}});var cleanupEnd=canvasHandle(onEndType,function(event){var e=matchesEvent(event);if(e){var _canvasPos6=copyCanvasPos(e,math.vec2());onChange(_canvasPos6);updatePointerLens(null);_cleanupCurrentDrag();self.fire("translated");}});_cleanupCurrentDrag=function cleanupCurrentDrag(){_cleanupCurrentDrag=function cleanupCurrentDrag(){};canvas.style.cursor="default";viewer.cameraControl.active=true;cleanupMove();cleanupEnd();};}};var startDragCbs=[];if(handleMouseEvents){startDragCbs.push(canvasHandle("mousedown",function(event){if(event.which===1){startDrag(event,"mousemove","mouseup",function(event){return event.which===1&&event;});}}));}if(handleTouchEvents){startDragCbs.push(canvasHandle("touchstart",function(event){if(event.touches.length===1){var touchStartId=event.touches[0].identifier;startDrag(event,"touchmove","touchend",function(event){return _toConsumableArray(event.changedTouches).find(function(e){return e.identifier===touchStartId;});});}}));}var cleanup=function cleanup(){_cleanupCurrentDrag();startDragCbs.forEach(function(cb){return cb();});updatePointerLens(null);};var destroyCb=zone.on("destroyed",cleanup);_this198._deactivate=function(){zone.off("destroyed",destroyCb);cleanup();};return _this198;}_createClass(ZoneTranslateControl,[{key:"deactivate",value:function deactivate(){this._deactivate();_get(_getPrototypeOf(ZoneTranslateControl.prototype),"destroy",this).call(this);}}]);return ZoneTranslateControl;}(Component);var ZoneTranslateMouseControl=/*#__PURE__*/function(_ZoneTranslateControl){_inherits(ZoneTranslateMouseControl,_ZoneTranslateControl);var _super178=_createSuper(ZoneTranslateMouseControl);function ZoneTranslateMouseControl(zone,cfg){_classCallCheck(this,ZoneTranslateMouseControl);return _super178.call(this,zone,cfg,true,false);}return _createClass(ZoneTranslateMouseControl);}(ZoneTranslateControl);var ZoneTranslateTouchControl=/*#__PURE__*/function(_ZoneTranslateControl2){_inherits(ZoneTranslateTouchControl,_ZoneTranslateControl2);var _super179=_createSuper(ZoneTranslateTouchControl);function ZoneTranslateTouchControl(zone,cfg){_classCallCheck(this,ZoneTranslateTouchControl);return _super179.call(this,zone,cfg,false,true);}return _createClass(ZoneTranslateTouchControl);}(ZoneTranslateControl);export{AlphaFormat,AmbientLight,AngleMeasurementEditMouseControl,AngleMeasurementEditTouchControl,AngleMeasurementsControl,AngleMeasurementsMouseControl,AngleMeasurementsPlugin,AngleMeasurementsTouchControl,AnnotationsPlugin,AxisGizmoPlugin,BCFViewpointsPlugin,Bitmap,ByteType,CameraMemento,CameraPath,CameraPathAnimation,CityJSONLoaderPlugin,ClampToEdgeWrapping,Component,CompressedMediaType,Configs,ContextMenu,CubicBezierCurve,Curve,DefaultLoadingManager,DepthFormat,DepthStencilFormat,DirLight,DistanceMeasurementEditControl,DistanceMeasurementEditMouseControl,DistanceMeasurementEditTouchControl,DistanceMeasurementsControl,DistanceMeasurementsMouseControl,DistanceMeasurementsPlugin,DistanceMeasurementsTouchControl,Dot3D,DotBIMDefaultDataSource,DotBIMLoaderPlugin,EdgeMaterial,EmphasisMaterial,FaceAlignedSectionPlanesPlugin,FastNavPlugin,FloatType,Fresnel,Frustum$1 as Frustum,FrustumPlane,GIFMediaType,GLTFDefaultDataSource,GLTFLoaderPlugin,HalfFloatType,ImagePlane,IntType,JPEGMediaType,KTX2TextureTranscoder,LASLoaderPlugin,Label3D,LambertMaterial,LightMap,LineSet,LinearEncoding,LinearFilter,LinearMipMapLinearFilter,LinearMipMapNearestFilter,LinearMipmapLinearFilter,LinearMipmapNearestFilter,Loader,LoadingManager,LocaleService,LuminanceAlphaFormat,LuminanceFormat,Map$1 as Map,Marker,MarqueePicker,MarqueePickerMouseControl,Mesh,MeshSurfaceArea,MeshVolume,MetallicMaterial,MirroredRepeatWrapping,ModelMemento,NavCubePlugin,NearestFilter,NearestMipMapLinearFilter,NearestMipMapNearestFilter,NearestMipmapLinearFilter,NearestMipmapNearestFilter,Node$1 as Node,OBJLoaderPlugin,ObjectsKdTree3,ObjectsMemento,PNGMediaType,Path,PerformanceModel,PhongMaterial,PickResult,Plugin,PointLight,PointerCircle,PointerLens,QuadraticBezierCurve,Queue,RGBAFormat,RGBAIntegerFormat,RGBA_ASTC_10x10_Format,RGBA_ASTC_10x5_Format,RGBA_ASTC_10x6_Format,RGBA_ASTC_10x8_Format,RGBA_ASTC_12x10_Format,RGBA_ASTC_12x12_Format,RGBA_ASTC_4x4_Format,RGBA_ASTC_5x4_Format,RGBA_ASTC_5x5_Format,RGBA_ASTC_6x5_Format,RGBA_ASTC_6x6_Format,RGBA_ASTC_8x5_Format,RGBA_ASTC_8x6_Format,RGBA_ASTC_8x8_Format,RGBA_BPTC_Format,RGBA_ETC2_EAC_Format,RGBA_PVRTC_2BPPV1_Format,RGBA_PVRTC_4BPPV1_Format,RGBA_S3TC_DXT1_Format,RGBA_S3TC_DXT3_Format,RGBA_S3TC_DXT5_Format,RGBFormat,RGB_ETC1_Format,RGB_ETC2_Format,RGB_PVRTC_2BPPV1_Format,RGB_PVRTC_4BPPV1_Format,RGB_S3TC_DXT1_Format,RGFormat,RGIntegerFormat,ReadableGeometry,RedFormat,RedIntegerFormat,ReflectionMap,RepeatWrapping,STLDefaultDataSource,STLLoaderPlugin,SceneModel,SceneModelMesh,SceneModelTransform,SectionPlane,SectionPlanesPlugin,ShortType,SpecularMaterial,SplineCurve,SpriteMarker,StoreyViewsPlugin,Texture,TextureTranscoder,TransformControl,TreeViewPlugin,UnsignedByteType,UnsignedInt248Type,UnsignedIntType,UnsignedShort4444Type,UnsignedShort5551Type,UnsignedShortType,VBOGeometry,ViewCullPlugin,Viewer,WebIFCLoaderPlugin,Wire3D,WorkerPool$1 as WorkerPool,XKTDefaultDataSource,XKTLoaderPlugin,XML3DLoaderPlugin,ZoneEditControl,ZoneEditMouseControl,ZoneEditTouchControl,ZoneTranslateControl,ZoneTranslateMouseControl,ZoneTranslateTouchControl,ZonesMouseControl,ZonesPlugin,ZonesPolysurfaceMouseControl,ZonesPolysurfaceTouchControl,ZonesTouchControl,activateDraggableDot,activateDraggableDots,addMousePressListener,addTouchPressListener,buildBoxGeometry,buildBoxLinesGeometry,buildBoxLinesGeometryFromAABB,buildCylinderGeometry,buildGridGeometry,buildLineGeometry,buildPlaneGeometry,buildPolylineGeometry,buildPolylineGeometryFromCurve,buildSphereGeometry,buildTorusGeometry,buildVectorTextGeometry,createCombinedTexture,createRTCViewMat,createSkyboxMesh,createSphereMapMesh,frustumIntersectsAABB3,getKTX2TextureTranscoder,getPlaneRTCPos,isTriangleMeshSolid,load3DSGeometry,loadOBJGeometry,marker3D,math,meshSurfaceArea,meshVolume,os,rtcToWorldPos,sRGBEncoding,setFrustum,startPolygonCreate,stats,touchPointSelector,transformToNode,triangulateEarClipping,utils,wire3D,worldToRTCPos,worldToRTCPositions};
|
|
33798
|
+
marker.update(worldPos);cleanups.forEach(function(c){return c();});onZoneCreated(zonesPlugin.createZone({id:math.createUUID(),geometry:{planeCoordinates:pos2D,altitude:zoneAltitude,height:zoneHeight},alpha:zoneAlpha,color:zoneColor}));}else{marker.update(worldPos);wire&&wire.update(wireStart,worldPos);selectNextPoint(markers.concat(marker));}});})([]);return{closeSurface:function closeSurface(){throw"TODO";},deactivate:function deactivate(){deactivatePointSelection();cleanups.forEach(function(c){return c();});}};};var ZonesPolysurfaceMouseControl=/*#__PURE__*/function(_Component43){_inherits(ZonesPolysurfaceMouseControl,_Component43);var _super176=_createSuper(ZonesPolysurfaceMouseControl);function ZonesPolysurfaceMouseControl(zonesPlugin){var _this198;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,ZonesPolysurfaceMouseControl);_this198=_super176.call(this,zonesPlugin.viewer.scene);_this198.zonesPlugin=zonesPlugin;_this198.pointerLens=cfg.pointerLens;_this198._action=null;return _this198;}_createClass(ZonesPolysurfaceMouseControl,[{key:"active",get:function get(){return!!this._action;}},{key:"activate",value:function activate(zoneAltitude,zoneHeight,zoneColor,zoneAlpha){if(_typeof(zoneAltitude)==="object"&&zoneAltitude!==null){var params=zoneAltitude;var param=function param(name,defaultValue){if(name in params){return params[name];}else if(defaultValue!==undefined){return defaultValue;}else{throw"config missing: "+name;}};zoneAltitude=param("altitude");zoneHeight=param("height");zoneColor=param("color","#008000");zoneAlpha=param("alpha",0.5);}if(this._action){return;}var zonesPlugin=this.zonesPlugin;var viewer=zonesPlugin.viewer;var scene=viewer.scene;var self=this;var select3dPoint=mousePointSelector(viewer,function(origin,direction){return planeIntersect(zoneAltitude,math.vec3([0,1,0]),origin,direction);});(function rec(){self._action=startPolysurfaceZoneCreateUI(scene,zoneAltitude,zoneHeight,zoneColor,zoneAlpha,self.pointerLens,zonesPlugin,select3dPoint,function(zone){var reactivate=true;self._action={deactivate:function deactivate(){reactivate=false;}};self.fire("zoneEnd",zone);if(reactivate){rec();}});})();}},{key:"deactivate",value:function deactivate(){if(this._action){this._action.deactivate();this._action=null;}}},{key:"destroy",value:function destroy(){this.deactivate();_get(_getPrototypeOf(ZonesPolysurfaceMouseControl.prototype),"destroy",this).call(this);}}]);return ZonesPolysurfaceMouseControl;}(Component);var ZonesPolysurfaceTouchControl=/*#__PURE__*/function(_Component44){_inherits(ZonesPolysurfaceTouchControl,_Component44);var _super177=_createSuper(ZonesPolysurfaceTouchControl);function ZonesPolysurfaceTouchControl(zonesPlugin){var _this199;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,ZonesPolysurfaceTouchControl);_this199=_super177.call(this,zonesPlugin.viewer.scene);_this199.zonesPlugin=zonesPlugin;_this199.pointerLens=cfg.pointerLens;_this199.pointerCircle=new PointerCircle(zonesPlugin.viewer);_this199._action=null;return _this199;}_createClass(ZonesPolysurfaceTouchControl,[{key:"active",get:function get(){return!!this._action;}},{key:"activate",value:function activate(zoneAltitude,zoneHeight,zoneColor,zoneAlpha){if(_typeof(zoneAltitude)==="object"&&zoneAltitude!==null){var params=zoneAltitude;var param=function param(name,defaultValue){if(name in params){return params[name];}else if(defaultValue!==undefined){return defaultValue;}else{throw"config missing: "+name;}};zoneAltitude=param("altitude");zoneHeight=param("height");zoneColor=param("color","#008000");zoneAlpha=param("alpha",0.5);}if(this._action){return;}var zonesPlugin=this.zonesPlugin;var viewer=zonesPlugin.viewer;var scene=viewer.scene;var self=this;var select3dPoint=touchPointSelector(viewer,this.pointerCircle,function(origin,direction){return planeIntersect(zoneAltitude,math.vec3([0,1,0]),origin,direction);});(function rec(){self._action=startPolysurfaceZoneCreateUI(scene,zoneAltitude,zoneHeight,zoneColor,zoneAlpha,self.pointerLens,zonesPlugin,select3dPoint,function(zone){var reactivate=true;self._action={deactivate:function deactivate(){reactivate=false;}};self.fire("zoneEnd",zone);if(reactivate){rec();}});})();}},{key:"deactivate",value:function deactivate(){if(this._action){this._action.deactivate();this._action=null;}}},{key:"destroy",value:function destroy(){this.deactivate();_get(_getPrototypeOf(ZonesPolysurfaceTouchControl.prototype),"destroy",this).call(this);}}]);return ZonesPolysurfaceTouchControl;}(Component);var ZoneEditControl=/*#__PURE__*/function(_Component45){_inherits(ZoneEditControl,_Component45);var _super178=_createSuper(ZoneEditControl);function ZoneEditControl(zone,cfg,handleMouseEvents,handleTouchEvents){var _this200;_classCallCheck(this,ZoneEditControl);var viewer=zone.plugin.viewer;var scene=viewer.scene;_this200=_super178.call(this,scene);var altitude=zone._geometry.altitude;var dots=zone._geometry.planeCoordinates.map(function(planeCoord){var dotParent=scene.canvas.canvas.ownerDocument.body;var dot=new Dot3D(scene,{},dotParent,{fillColor:zone._color});dot.worldPos=math.vec3([planeCoord[0],altitude,planeCoord[1]]);dot.on("worldPos",function(){planeCoord[0]=dot.worldPos[0];planeCoord[1]=dot.worldPos[2];try{zone._rebuildMesh();}catch(e){if(zone._zoneMesh){zone._zoneMesh.destroy();zone._zoneMesh=null;}}});return dot;});var cleanupDrag=activateDraggableDots({viewer:viewer,handleMouseEvents:handleMouseEvents,handleTouchEvents:handleTouchEvents,pointerLens:cfg&&cfg.pointerLens,dots:dots,ray2WorldPos:function ray2WorldPos(orig,dir){return planeIntersect(altitude,math.vec3([0,1,0]),orig,dir);},onEnd:function onEnd(initPos,dot){if(zone._zoneMesh){_this200.fire("edited");}return!!zone._zoneMesh;}});var cleanup=function cleanup(){cleanupDrag();dots.forEach(function(d){return d.destroy();});};var destroyCb=zone.on("destroyed",cleanup);_this200._deactivate=function(){zone.off("destroyed",destroyCb);cleanup();};return _this200;}_createClass(ZoneEditControl,[{key:"deactivate",value:function deactivate(){this._deactivate();_get(_getPrototypeOf(ZoneEditControl.prototype),"destroy",this).call(this);}}]);return ZoneEditControl;}(Component);var ZoneEditMouseControl=/*#__PURE__*/function(_ZoneEditControl){_inherits(ZoneEditMouseControl,_ZoneEditControl);var _super179=_createSuper(ZoneEditMouseControl);function ZoneEditMouseControl(zone,cfg){_classCallCheck(this,ZoneEditMouseControl);return _super179.call(this,zone,cfg,true,false);}return _createClass(ZoneEditMouseControl);}(ZoneEditControl);var ZoneEditTouchControl=/*#__PURE__*/function(_ZoneEditControl2){_inherits(ZoneEditTouchControl,_ZoneEditControl2);var _super180=_createSuper(ZoneEditTouchControl);function ZoneEditTouchControl(zone,cfg){_classCallCheck(this,ZoneEditTouchControl);return _super180.call(this,zone,cfg,false,true);}return _createClass(ZoneEditTouchControl);}(ZoneEditControl);var ZoneTranslateControl=/*#__PURE__*/function(_Component46){_inherits(ZoneTranslateControl,_Component46);var _super181=_createSuper(ZoneTranslateControl);function ZoneTranslateControl(zone,cfg,handleMouseEvents,handleTouchEvents){var _this201;_classCallCheck(this,ZoneTranslateControl);var viewer=zone.plugin.viewer;var scene=viewer.scene;var canvas=scene.canvas.canvas;_this201=_super181.call(this,scene);var self=_assertThisInitialized(_this201);var altitude=zone._geometry.altitude;var pointerLens=cfg&&cfg.pointerLens;var updatePointerLens=pointerLens?function(canvasPos){pointerLens.visible=!!canvasPos;if(canvasPos){pointerLens.canvasPos=canvasPos;}}:function(){};var ray2WorldPos=function ray2WorldPos(orig,dir){return planeIntersect(altitude,math.vec3([0,1,0]),orig,dir);};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 copyCanvasPos=function copyCanvasPos(event,vec2){vec2[0]=event.clientX;vec2[1]=event.clientY;transformToNode(canvas.ownerDocument.documentElement,canvas,vec2);return vec2;};var canvasHandle=function canvasHandle(type,cb){var callback=function callback(event){event.preventDefault();cb(event);};canvas.addEventListener(type,callback);return function(){return canvas.removeEventListener(type,callback);};};var _cleanupCurrentDrag=function cleanupCurrentDrag(){};var startDrag=function startDrag(event,onMoveType,onEndType,matchesEvent){var e=matchesEvent(event);var canvasPos=copyCanvasPos(e,math.vec2());var pickRecord=viewer.scene.pick({canvasPos:canvasPos,includeEntities:[zone._zoneMesh.id]});var pickZone=pickRecord&&pickRecord.entity&&pickRecord.entity.zone;if(pickZone===zone){_cleanupCurrentDrag();canvas.style.cursor="move";viewer.cameraControl.active=false;var onChange=function(){var initCoords=zone._geometry.planeCoordinates.map(function(c){return c.slice();});var initWorldPos=pickWorldPos(canvasPos);var initDragCoord=math.vec2([initWorldPos[0],initWorldPos[2]]);var dPos=math.vec2();return function(canvasPos){var worldPos=pickWorldPos(canvasPos);dPos[0]=worldPos[0];dPos[1]=worldPos[2];math.subVec2(initDragCoord,dPos,dPos);zone._geometry.planeCoordinates.forEach(function(planeCoord,idx){math.subVec2(initCoords[idx],dPos,planeCoord);});try{zone._rebuildMesh();}catch(e){if(zone._zoneMesh){zone._zoneMesh.destroy();zone._zoneMesh=null;}}};}();var cleanupMove=canvasHandle(onMoveType,function(event){var e=matchesEvent(event);if(e){var _canvasPos5=copyCanvasPos(e,math.vec2());onChange(_canvasPos5);updatePointerLens(_canvasPos5);}});var cleanupEnd=canvasHandle(onEndType,function(event){var e=matchesEvent(event);if(e){var _canvasPos6=copyCanvasPos(e,math.vec2());onChange(_canvasPos6);updatePointerLens(null);_cleanupCurrentDrag();self.fire("translated");}});_cleanupCurrentDrag=function cleanupCurrentDrag(){_cleanupCurrentDrag=function cleanupCurrentDrag(){};canvas.style.cursor="default";viewer.cameraControl.active=true;cleanupMove();cleanupEnd();};}};var startDragCbs=[];if(handleMouseEvents){startDragCbs.push(canvasHandle("mousedown",function(event){if(event.which===1){startDrag(event,"mousemove","mouseup",function(event){return event.which===1&&event;});}}));}if(handleTouchEvents){startDragCbs.push(canvasHandle("touchstart",function(event){if(event.touches.length===1){var touchStartId=event.touches[0].identifier;startDrag(event,"touchmove","touchend",function(event){return _toConsumableArray(event.changedTouches).find(function(e){return e.identifier===touchStartId;});});}}));}var cleanup=function cleanup(){_cleanupCurrentDrag();startDragCbs.forEach(function(cb){return cb();});updatePointerLens(null);};var destroyCb=zone.on("destroyed",cleanup);_this201._deactivate=function(){zone.off("destroyed",destroyCb);cleanup();};return _this201;}_createClass(ZoneTranslateControl,[{key:"deactivate",value:function deactivate(){this._deactivate();_get(_getPrototypeOf(ZoneTranslateControl.prototype),"destroy",this).call(this);}}]);return ZoneTranslateControl;}(Component);var ZoneTranslateMouseControl=/*#__PURE__*/function(_ZoneTranslateControl){_inherits(ZoneTranslateMouseControl,_ZoneTranslateControl);var _super182=_createSuper(ZoneTranslateMouseControl);function ZoneTranslateMouseControl(zone,cfg){_classCallCheck(this,ZoneTranslateMouseControl);return _super182.call(this,zone,cfg,true,false);}return _createClass(ZoneTranslateMouseControl);}(ZoneTranslateControl);var ZoneTranslateTouchControl=/*#__PURE__*/function(_ZoneTranslateControl2){_inherits(ZoneTranslateTouchControl,_ZoneTranslateControl2);var _super183=_createSuper(ZoneTranslateTouchControl);function ZoneTranslateTouchControl(zone,cfg){_classCallCheck(this,ZoneTranslateTouchControl);return _super183.call(this,zone,cfg,false,true);}return _createClass(ZoneTranslateTouchControl);}(ZoneTranslateControl);export{AlphaFormat,AmbientLight,AngleMeasurementEditMouseControl,AngleMeasurementEditTouchControl,AngleMeasurementsControl,AngleMeasurementsMouseControl,AngleMeasurementsPlugin,AngleMeasurementsTouchControl,AnnotationsPlugin,AxisGizmoPlugin,BCFViewpointsPlugin,Bitmap,ByteType,CameraMemento,CameraPath,CameraPathAnimation,CityJSONLoaderPlugin,ClampToEdgeWrapping,Component,CompressedMediaType,Configs,ContextMenu,CubicBezierCurve,Curve,CxConverterIFCLoaderPlugin,DefaultLoadingManager,DepthFormat,DepthStencilFormat,DirLight,DistanceMeasurementEditControl,DistanceMeasurementEditMouseControl,DistanceMeasurementEditTouchControl,DistanceMeasurementsControl,DistanceMeasurementsMouseControl,DistanceMeasurementsPlugin,DistanceMeasurementsTouchControl,Dot3D,DotBIMDefaultDataSource,DotBIMLoaderPlugin,EdgeMaterial,EmphasisMaterial,FaceAlignedSectionPlanesPlugin,FastNavPlugin,FloatType,Fresnel,Frustum$1 as Frustum,FrustumPlane,GIFMediaType,GLTFDefaultDataSource,GLTFLoaderPlugin,HalfFloatType,ImagePlane,IntType,JPEGMediaType,KTX2TextureTranscoder,LASLoaderPlugin,Label3D,LambertMaterial,LightMap,LineSet,LinearEncoding,LinearFilter,LinearMipMapLinearFilter,LinearMipMapNearestFilter,LinearMipmapLinearFilter,LinearMipmapNearestFilter,Loader,LoadingManager,LocaleService,LuminanceAlphaFormat,LuminanceFormat,Map$1 as Map,Marker,MarqueePicker,MarqueePickerMouseControl,Mesh,MeshSurfaceArea,MeshVolume,MetallicMaterial,MirroredRepeatWrapping,ModelMemento,NavCubePlugin,NearestFilter,NearestMipMapLinearFilter,NearestMipMapNearestFilter,NearestMipmapLinearFilter,NearestMipmapNearestFilter,Node$1 as Node,OBJLoaderPlugin,ObjectsKdTree3,ObjectsMemento,PNGMediaType,Path,PerformanceModel,PhongMaterial,PickResult,Plugin,PointLight,PointerCircle,PointerLens,QuadraticBezierCurve,Queue,RGBAFormat,RGBAIntegerFormat,RGBA_ASTC_10x10_Format,RGBA_ASTC_10x5_Format,RGBA_ASTC_10x6_Format,RGBA_ASTC_10x8_Format,RGBA_ASTC_12x10_Format,RGBA_ASTC_12x12_Format,RGBA_ASTC_4x4_Format,RGBA_ASTC_5x4_Format,RGBA_ASTC_5x5_Format,RGBA_ASTC_6x5_Format,RGBA_ASTC_6x6_Format,RGBA_ASTC_8x5_Format,RGBA_ASTC_8x6_Format,RGBA_ASTC_8x8_Format,RGBA_BPTC_Format,RGBA_ETC2_EAC_Format,RGBA_PVRTC_2BPPV1_Format,RGBA_PVRTC_4BPPV1_Format,RGBA_S3TC_DXT1_Format,RGBA_S3TC_DXT3_Format,RGBA_S3TC_DXT5_Format,RGBFormat,RGB_ETC1_Format,RGB_ETC2_Format,RGB_PVRTC_2BPPV1_Format,RGB_PVRTC_4BPPV1_Format,RGB_S3TC_DXT1_Format,RGFormat,RGIntegerFormat,ReadableGeometry,RedFormat,RedIntegerFormat,ReflectionMap,RepeatWrapping,STLDefaultDataSource,STLLoaderPlugin,SceneModel,SceneModelMesh,SceneModelTransform,SectionPlane,SectionPlanesPlugin,ShortType,SpecularMaterial,SplineCurve,SpriteMarker,StoreyViewsPlugin,Texture,TextureTranscoder,TransformControl,TreeViewPlugin,UnsignedByteType,UnsignedInt248Type,UnsignedIntType,UnsignedShort4444Type,UnsignedShort5551Type,UnsignedShortType,VBOGeometry,ViewCullPlugin,Viewer,WebIFCLoaderPlugin,Wire3D,WorkerPool$1 as WorkerPool,XKTDefaultDataSource,XKTLoaderPlugin,XML3DLoaderPlugin,ZoneEditControl,ZoneEditMouseControl,ZoneEditTouchControl,ZoneTranslateControl,ZoneTranslateMouseControl,ZoneTranslateTouchControl,ZonesMouseControl,ZonesPlugin,ZonesPolysurfaceMouseControl,ZonesPolysurfaceTouchControl,ZonesTouchControl,activateDraggableDot,activateDraggableDots,addMousePressListener,addTouchPressListener,buildBoxGeometry,buildBoxLinesGeometry,buildBoxLinesGeometryFromAABB,buildCylinderGeometry,buildGridGeometry,buildLineGeometry,buildPlaneGeometry,buildPolylineGeometry,buildPolylineGeometryFromCurve,buildSphereGeometry,buildTorusGeometry,buildVectorTextGeometry,createCombinedTexture,createRTCViewMat,createSkyboxMesh,createSphereMapMesh,frustumIntersectsAABB3,getKTX2TextureTranscoder,getPlaneRTCPos,isTriangleMeshSolid,load3DSGeometry,loadOBJGeometry,marker3D,math,meshSurfaceArea,meshVolume,os,rtcToWorldPos,sRGBEncoding,setFrustum,startPolygonCreate,stats,touchPointSelector,transformToNode,triangulateEarClipping,utils,wire3D,worldToRTCPos,worldToRTCPositions};
|