@xtctwins/tctwins-core 1.1.8 → 1.1.10

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.
@@ -3045,8 +3045,8 @@ case WAITING_FOR_TARGET_LONG_TOUCH_END$1:if(_this17.pointerLens){_this17.pointer
3045
3045
  * The {@link AnnotationsPlugin} this Annotation was created by.
3046
3046
  * @type {AnnotationsPlugin}
3047
3047
  */_this20.plugin=cfg.plugin;_this20._container=cfg.container;if(!_this20._container){throw"config missing: container";}if(!cfg.markerElement&&!cfg.markerHTML){throw"config missing: need either markerElement or markerHTML";}if(!cfg.labelElement&&!cfg.labelHTML){throw"config missing: need either labelElement or labelHTML";}_this20._htmlDirty=false;if(cfg.markerElement){_this20._marker=cfg.markerElement;_this20._marker.addEventListener("click",_this20._onMouseClickedExternalMarker=function(){_this20.plugin.fire("markerClicked",_this20);});_this20._marker.addEventListener("dblclick",_this20._onMouseDblClickedExternalMarker=function(){_this20.plugin.fire("markerDoubleClicked",_this20);});_this20._marker.addEventListener("mouseenter",_this20._onMouseEnterExternalMarker=function(){_this20.plugin.fire("markerMouseEnter",_this20);});_this20._marker.addEventListener("mouseleave",_this20._onMouseLeaveExternalMarker=function(){_this20.plugin.fire("markerMouseLeave",_this20);});_this20._markerExternal=true;// Don't destroy marker when destroying Annotation
3048
- }else{_this20._markerHTML=cfg.markerHTML;_this20._htmlDirty=true;_this20._markerExternal=false;}if(cfg.labelElement){_this20._label=cfg.labelElement;_this20._labelExternal=true;// Don't destroy marker when destroying Annotation
3049
- }else{_this20._labelHTML=cfg.labelHTML;_this20._htmlDirty=true;_this20._labelExternal=false;}_this20._markerShown=!!cfg.markerShown;_this20._labelShown=!!cfg.labelShown;_this20._values=cfg.values||{};_this20._layoutDirty=true;_this20._visibilityDirty=true;_this20._buildHTML();_this20._onTick=_this20.scene.on("tick",function(){if(_this20._htmlDirty){_this20._buildHTML();_this20._htmlDirty=false;_this20._layoutDirty=true;_this20._visibilityDirty=true;}if(_this20._layoutDirty||_this20._visibilityDirty){if(_this20._markerShown||_this20._labelShown){_this20._updatePosition();_this20._layoutDirty=false;}}if(_this20._visibilityDirty){_this20._marker.style.visibility=_this20.visible&&_this20._markerShown?"visible":"hidden";_this20._label.style.visibility=_this20.visible&&_this20._markerShown&&_this20._labelShown?"visible":"hidden";_this20._visibilityDirty=false;}});_this20.on("canvasPos",function(){_this20._layoutDirty=true;});_this20.on("visible",function(){_this20._visibilityDirty=true;});_this20.setMarkerShown(cfg.markerShown!==false);_this20.setLabelShown(cfg.labelShown);/**
3048
+ }else{_this20._markerHTML=cfg.markerHTML;_this20._htmlDirty=true;_this20._markerExternal=false;}if(cfg.labelElement){_this20._label=cfg.labelElement;_this20._label.addEventListener("click",function(){_this20.plugin.fire("labelClicked",_this20);});_this20._labelExternal=true;// Don't destroy marker when destroying Annotation
3049
+ }else{_this20._labelHTML=cfg.labelHTML;_this20._htmlDirty=true;_this20._labelExternal=false;}_this20._markerShown=!!cfg.markerShown;_this20._labelShown=!!cfg.labelShown;_this20._labelPlacement=cfg.labelPlacement||"right";_this20._labelOffset=cfg.labelOffset||null;_this20._values=cfg.values||{};_this20._layoutDirty=true;_this20._visibilityDirty=true;_this20._buildHTML();_this20._onTick=_this20.scene.on("tick",function(){if(_this20._htmlDirty){_this20._buildHTML();_this20._htmlDirty=false;_this20._layoutDirty=true;_this20._visibilityDirty=true;}if(_this20._layoutDirty||_this20._visibilityDirty){if(_this20._markerShown||_this20._labelShown){_this20._updatePosition();_this20._layoutDirty=false;}}if(_this20._visibilityDirty){_this20._marker.style.visibility=_this20.visible&&_this20._markerShown?"visible":"hidden";_this20._label.style.visibility=_this20.visible&&_this20._markerShown&&_this20._labelShown?"visible":"hidden";_this20._visibilityDirty=false;}});_this20.on("canvasPos",function(){_this20._layoutDirty=true;});_this20.on("visible",function(){_this20._visibilityDirty=true;});_this20.setMarkerShown(cfg.markerShown!==false);_this20.setLabelShown(cfg.labelShown);/**
3050
3050
  * Optional World-space position for {@link Camera#eye}, used when this Annotation is associated with a {@link Camera} position.
3051
3051
  *
3052
3052
  * Undefined by default.
@@ -3074,9 +3074,11 @@ case WAITING_FOR_TARGET_LONG_TOUCH_END$1:if(_this17.pointerLens){_this17.pointer
3074
3074
  * @private
3075
3075
  */_inherits(Annotation,_Marker);return _createClass(Annotation,[{key:"_buildHTML",value:function _buildHTML(){var _this21=this;if(!this._markerExternal){if(this._marker){this._container.removeChild(this._marker);this._marker=null;}var markerHTML=this._markerHTML||"<p></p>";// Make marker
3076
3076
  if(utils.isArray(markerHTML)){markerHTML=markerHTML.join("");}markerHTML=this._renderTemplate(markerHTML.trim());var markerFragment=document.createRange().createContextualFragment(markerHTML);this._marker=markerFragment.firstChild;this._container.appendChild(this._marker);this._marker.style.visibility=this._markerShown?"visible":"hidden";this._marker.addEventListener("click",function(){_this21.plugin.fire("markerClicked",_this21);});this._marker.addEventListener("dblclick",function(){_this21.plugin.fire("markerDoubleClicked",_this21);});this._marker.addEventListener("mouseenter",function(){_this21.plugin.fire("markerMouseEnter",_this21);});this._marker.addEventListener("mouseleave",function(){_this21.plugin.fire("markerMouseLeave",_this21);});this._marker.addEventListener("wheel",function(event){_this21.plugin.viewer.scene.canvas.canvas.dispatchEvent(new WheelEvent("wheel",event));});}if(!this._labelExternal){if(this._label){this._container.removeChild(this._label);this._label=null;}var labelHTML=this._labelHTML||"<p></p>";// Make label
3077
- if(utils.isArray(labelHTML)){labelHTML=labelHTML.join("");}labelHTML=this._renderTemplate(labelHTML.trim());var labelFragment=document.createRange().createContextualFragment(labelHTML);this._label=labelFragment.firstChild;this._container.appendChild(this._label);this._label.style.visibility=this._markerShown&&this._labelShown?"visible":"hidden";this._label.addEventListener("wheel",function(event){_this21.plugin.viewer.scene.canvas.canvas.dispatchEvent(new WheelEvent("wheel",event));});}}/**
3077
+ if(utils.isArray(labelHTML)){labelHTML=labelHTML.join("");}labelHTML=this._renderTemplate(labelHTML.trim());var labelFragment=document.createRange().createContextualFragment(labelHTML);this._label=labelFragment.firstChild;this._container.appendChild(this._label);this._label.style.visibility=this._markerShown&&this._labelShown?"visible":"hidden";this._label.addEventListener("click",function(){_this21.plugin.fire("labelClicked",_this21);});this._label.addEventListener("wheel",function(event){_this21.plugin.viewer.scene.canvas.canvas.dispatchEvent(new WheelEvent("wheel",event));});}}/**
3078
3078
  * @private
3079
- */},{key:"_updatePosition",value:function _updatePosition(){var boundary=this.scene.canvas.boundary;var left=boundary[0];var top=boundary[1];var canvasPos=this.canvasPos;this._marker.style.left=Math.floor(left+canvasPos[0])-12+"px";this._marker.style.top=Math.floor(top+canvasPos[1])-12+"px";this._marker.style["z-index"]=90005+Math.floor(this._viewPos[2])+1;var offsetX=20;var offsetY=-17;this._label.style.left=20+Math.floor(left+canvasPos[0]+offsetX)+"px";this._label.style.top=Math.floor(top+canvasPos[1]+offsetY)+"px";this._label.style["z-index"]=90005+Math.floor(this._viewPos[2])+1;}/**
3079
+ */},{key:"_updatePosition",value:function _updatePosition(){var boundary=this.scene.canvas.boundary;var left=boundary[0];var top=boundary[1];var canvasPos=this.canvasPos;var offset=this._labelOffset||{};var ox=offset.x||0;var oy=offset.y||0;this._marker.style.left=Math.floor(left+canvasPos[0])-12+"px";this._marker.style.top=Math.floor(top+canvasPos[1])-12+"px";this._marker.style["z-index"]=90005+Math.floor(this._viewPos[2])+1;if(this._labelPlacement==="above"){// 将标签居中显示在 marker 正上方,并叠加自定义偏移
3080
+ var labelWidth=this._label.offsetWidth||0;var labelHeight=this._label.offsetHeight||0;this._label.style.left=Math.floor(left+canvasPos[0]-labelWidth/2+ox)+"px";this._label.style.top=Math.floor(top+canvasPos[1]-12-labelHeight-4+oy)+"px";}else{// 默认显示在 marker 右侧,并叠加自定义偏移
3081
+ var offsetX=20+ox;var offsetY=-17+oy;this._label.style.left=20+Math.floor(left+canvasPos[0]+offsetX)+"px";this._label.style.top=Math.floor(top+canvasPos[1]+offsetY)+"px";}this._label.style["z-index"]=90005+Math.floor(this._viewPos[2])+1;}/**
3080
3082
  * @private
3081
3083
  */},{key:"_renderTemplate",value:function _renderTemplate(template){for(var key in this._values){if(this._values.hasOwnProperty(key)){var value=this._values[key];template=template.replace(new RegExp("{{"+key+"}}","g"),value);}}return template;}/**
3082
3084
  * Sets whether or not to show this Annotation's marker.
@@ -3115,13 +3117,21 @@ if(utils.isArray(labelHTML)){labelHTML=labelHTML.join("");}labelHTML=this._rende
3115
3117
  *
3116
3118
  * @returns {Boolean} Whether to show the label.
3117
3119
  */},{key:"getLabelShown",value:function getLabelShown(){return this._labelShown;}/**
3120
+ * Sets the pixel offset applied to the label relative to its default placement.
3121
+ *
3122
+ * @param {{x:Number, y:Number}} value The offset, e.g. `{ x: 0, y: -8 }`.
3123
+ */},{key:"labelOffset",get:/**
3124
+ * Gets the pixel offset applied to the label.
3125
+ *
3126
+ * @returns {{x:Number, y:Number}} The offset.
3127
+ */function get(){return this._labelOffset;}/**
3118
3128
  * Sets the value of a field within the HTML templates for either the Annotation's marker or label.
3119
3129
  *
3120
3130
  * See {@link AnnotationsPlugin} for more info.
3121
3131
  *
3122
3132
  * @param {String} key Identifies the field.
3123
3133
  * @param {String} value The field's value.
3124
- */},{key:"setField",value:function setField(key,value){this._values[key]=value||"";this._htmlDirty=true;}/**
3134
+ */,set:function set(value){this._labelOffset=value||null;this._layoutDirty=true;}},{key:"setField",value:function setField(key,value){this._values[key]=value||"";this._htmlDirty=true;}/**
3125
3135
  * Gets the value of a field within the HTML templates for either the Annotation's marker or label.
3126
3136
  *
3127
3137
  * See {@link AnnotationsPlugin} for more info.
@@ -3520,7 +3530,7 @@ if(utils.isArray(labelHTML)){labelHTML=labelHTML.join("");}labelHTML=this._rende
3520
3530
  */function AnnotationsPlugin(viewer,cfg){var _this22;_classCallCheck(this,AnnotationsPlugin);_this22=_callSuper(this,AnnotationsPlugin,["Annotations",viewer]);_this22._labelHTML=cfg.labelHTML||"<div></div>";_this22._markerHTML=cfg.markerHTML||"<div></div>";_this22._container=cfg.container||document.body;_this22._values=cfg.values||{};/**
3521
3531
  * The {@link Annotation}s created by {@link AnnotationsPlugin#createAnnotation}, each mapped to its {@link Annotation#id}.
3522
3532
  * @type {{String:Annotation}}
3523
- */_this22.annotations={};_this22.surfaceOffset=cfg.surfaceOffset;return _this22;}/**
3533
+ */_this22.annotations={};_this22.surfaceOffset=cfg.surfaceOffset;_this22._labelPlacement=cfg.labelPlacement;_this22._labelOffset=cfg.labelOffset;return _this22;}/**
3524
3534
  * Gets the plugin's HTML container element, if any.
3525
3535
  * @returns {*|HTMLElement|HTMLElement}
3526
3536
  */_inherits(AnnotationsPlugin,_Plugin2);return _createClass(AnnotationsPlugin,[{key:"getContainerElement",value:function getContainerElement(){return this._container;}/**
@@ -3566,7 +3576,7 @@ if(utils.isArray(labelHTML)){labelHTML=labelHTML.join("");}labelHTML=this._rende
3566
3576
  * @param {Number[]} [params.up] Optional World-space position for {@link Camera#up}, used when this Annotation is associated with a {@link Camera} position.
3567
3577
  * @param {String} [params.projection] Optional projection type for {@link Camera#projection}, used when this Annotation is associated with a {@link Camera} position.
3568
3578
  * @returns {Annotation} The new {@link Annotation}.
3569
- */,set:function set(surfaceOffset){if(surfaceOffset===undefined||surfaceOffset===null){surfaceOffset=0.3;}this._surfaceOffset=surfaceOffset;}},{key:"createAnnotation",value:function createAnnotation(params){var _this23=this;if(this.viewer.scene.components[params.id]){this.error("Viewer component with this ID already exists: "+params.id);delete params.id;}var worldPos;var entity;params.pickResult=params.pickResult||params.pickRecord;if(params.pickResult){var pickResult=params.pickResult;if(!pickResult.worldPos||!pickResult.worldNormal){this.error("Param 'pickResult' does not have both worldPos and worldNormal");}else{var normalizedWorldNormal=math.normalizeVec3(pickResult.worldNormal,tempVec3a$I);var offsetVec=math.mulVec3Scalar(normalizedWorldNormal,this._surfaceOffset,tempVec3b$z);var offsetWorldPos=math.addVec3(pickResult.worldPos,offsetVec,tempVec3c$u);worldPos=offsetWorldPos;entity=pickResult.entity;}}else{worldPos=params.worldPos;entity=params.entity;}var markerElement=null;if(params.markerElementId){markerElement=document.getElementById(params.markerElementId);if(!markerElement){this.error("Can't find DOM element for 'markerElementId' value '"+params.markerElementId+"' - defaulting to internally-generated empty DIV");}}var labelElement=null;if(params.labelElementId){labelElement=document.getElementById(params.labelElementId);if(!labelElement){this.error("Can't find DOM element for 'labelElementId' value '"+params.labelElementId+"' - defaulting to internally-generated empty DIV");}}var annotation=new Annotation(this.viewer.scene,{id:params.id,plugin:this,entity:entity,worldPos:worldPos,container:this._container,markerElement:markerElement,labelElement:labelElement,markerHTML:params.markerHTML||this._markerHTML,labelHTML:params.labelHTML||this._labelHTML,occludable:params.occludable,values:utils.apply(params.values,utils.apply(this._values,{})),markerShown:params.markerShown,labelShown:params.labelShown,eye:params.eye,look:params.look,up:params.up,projection:params.projection,visible:params.visible!==false});this.annotations[annotation.id]=annotation;annotation.on("destroyed",function(){delete _this23.annotations[annotation.id];_this23.fire("annotationDestroyed",annotation.id);});this.fire("annotationCreated",annotation.id);return annotation;}/**
3579
+ */,set:function set(surfaceOffset){if(surfaceOffset===undefined||surfaceOffset===null){surfaceOffset=0.3;}this._surfaceOffset=surfaceOffset;}},{key:"createAnnotation",value:function createAnnotation(params){var _this23=this;if(this.viewer.scene.components[params.id]){this.error("Viewer component with this ID already exists: "+params.id);delete params.id;}var worldPos;var entity;params.pickResult=params.pickResult||params.pickRecord;if(params.pickResult){var pickResult=params.pickResult;if(!pickResult.worldPos||!pickResult.worldNormal){this.error("Param 'pickResult' does not have both worldPos and worldNormal");}else{var normalizedWorldNormal=math.normalizeVec3(pickResult.worldNormal,tempVec3a$I);var offsetVec=math.mulVec3Scalar(normalizedWorldNormal,this._surfaceOffset,tempVec3b$z);var offsetWorldPos=math.addVec3(pickResult.worldPos,offsetVec,tempVec3c$u);worldPos=offsetWorldPos;entity=pickResult.entity;}}else{worldPos=params.worldPos;entity=params.entity;}var markerElement=null;if(params.markerElementId){markerElement=document.getElementById(params.markerElementId);if(!markerElement){this.error("Can't find DOM element for 'markerElementId' value '"+params.markerElementId+"' - defaulting to internally-generated empty DIV");}}var labelElement=null;if(params.labelElementId){labelElement=document.getElementById(params.labelElementId);if(!labelElement){this.error("Can't find DOM element for 'labelElementId' value '"+params.labelElementId+"' - defaulting to internally-generated empty DIV");}}var annotation=new Annotation(this.viewer.scene,{id:params.id,plugin:this,entity:entity,worldPos:worldPos,container:this._container,markerElement:markerElement,labelElement:labelElement,markerHTML:params.markerHTML||this._markerHTML,labelHTML:params.labelHTML||this._labelHTML,labelPlacement:params.labelPlacement||this._labelPlacement,labelOffset:params.labelOffset||this._labelOffset,occludable:params.occludable,values:utils.apply(params.values,utils.apply(this._values,{})),markerShown:params.markerShown,labelShown:params.labelShown,eye:params.eye,look:params.look,up:params.up,projection:params.projection,visible:params.visible!==false});this.annotations[annotation.id]=annotation;annotation.on("destroyed",function(){delete _this23.annotations[annotation.id];_this23.fire("annotationDestroyed",annotation.id);});this.fire("annotationCreated",annotation.id);return annotation;}/**
3570
3580
  * Destroys an {@link Annotation}.
3571
3581
  *
3572
3582
  * @param {String} id ID of Annotation to destroy.
@@ -20300,6 +20310,243 @@ case WAITING_FOR_TARGET_LONG_TOUCH_END:if(_this88.pointerLens){_this88.pointerLe
20300
20310
  *
20301
20311
  * Destroys any {@link DistanceMeasurement} under construction by this DistanceMeasurementsMouseControl.
20302
20312
  */},{key:"destroy",value:function destroy(){this.deactivate();this._destroyMarkerDiv();_superPropGet(DistanceMeasurementsSimulateMouseControl,"destroy",this,3)([]);}}]);}(DistanceMeasurementsControl);/**
20313
+ * {@link Viewer} plugin that makes interaction smoother with large models, by temporarily switching
20314
+ * the Viewer to faster, lower-quality rendering modes whenever we interact.
20315
+ *
20316
+ * [<img src="https://xeokit.io/img/docs/FastNavPlugin/FastNavPlugin.gif">](https://xeokit.github.io/xeokit-sdk/examples/#performance_FastNavPlugin)
20317
+ *
20318
+ * FastNavPlugin works by hiding specified Viewer rendering features, and optionally scaling the Viewer's canvas
20319
+ * resolution, whenever we interact with the Viewer. Then, once we've finished interacting, FastNavPlugin restores those
20320
+ * rendering features and the original canvas scale, after a configured delay.
20321
+ *
20322
+ * Depending on how we configure FastNavPlugin, we essentially switch to a smooth-rendering low-quality view while
20323
+ * interacting, then return to the normal higher-quality view after we stop, following an optional delay.
20324
+ *
20325
+ * Down-scaling the canvas resolution gives particularly good results. For example, scaling by ````0.5```` means that
20326
+ * we're rendering a quarter of the pixels while interacting, which can make the Viewer noticeably smoother with big models.
20327
+ *
20328
+ * The screen capture above shows FastNavPlugin in action. In this example, whenever we move the Camera or resize the Canvas,
20329
+ * FastNavPlugin switches off enhanced edges and ambient shadows (SAO), and down-scales the canvas, making it slightly
20330
+ * blurry. When ````0.5```` seconds passes with no interaction, the plugin shows edges and SAO again, and restores the
20331
+ * original canvas scale.
20332
+ *
20333
+ * # Usage
20334
+ *
20335
+ * In the example below, we'll create a {@link Viewer}, add a {@link FastNavPlugin}, then use an {@link XTCLoaderPlugin} to load a model.
20336
+ *
20337
+ * Whenever we interact with the Viewer, our FastNavPlugin will:
20338
+ *
20339
+ * * hide edges,
20340
+ * * hide ambient shadows (SAO),
20341
+ * * hide physically-based materials (switching to non-PBR),
20342
+ * * hide transparent objects, and
20343
+ * * scale the canvas resolution by 0.5, causing the GPU to render 75% less pixels.
20344
+ * <br>
20345
+ *
20346
+ * We'll also configure a 0.5 second delay before we transition back to high-quality each time we stop ineracting, so that we're
20347
+ * not continually flipping between low and high quality as we interact. Since we're only rendering ambient shadows when not interacting, we'll also treat ourselves
20348
+ * to expensive, high-quality SAO settings, that we wouldn't normally configure for an interactive SAO effect.
20349
+ *
20350
+ * * [[Run this example](https://xeokit.github.io/xeokit-sdk/examples/#performance_FastNavPlugin)]
20351
+ *
20352
+ * ````javascript
20353
+ * import {Viewer, XTCLoaderPlugin, FastNavPlugin} from "xeokit-sdk.es.js";
20354
+ *
20355
+ * // Create a Viewer with PBR and SAO enabled
20356
+ *
20357
+ * const viewer = new Viewer({
20358
+ * canvasId: "myCanvas",
20359
+ * transparent: true,
20360
+ * pbr: true, // Enable physically-based rendering for Viewer
20361
+ * sao: true // Enable ambient shadows for Viewer
20362
+ * });
20363
+ *
20364
+ * viewer.scene.camera.eye = [-66.26, 105.84, -281.92];
20365
+ * viewer.scene.camera.look = [42.45, 49.62, -43.59];
20366
+ * viewer.scene.camera.up = [0.05, 0.95, 0.15];
20367
+ *
20368
+ * // Higher-quality SAO settings
20369
+ *
20370
+ * viewer.scene.sao.enabled = true;
20371
+ * viewer.scene.sao.numSamples = 60;
20372
+ * viewer.scene.sao.kernelRadius = 170;
20373
+ *
20374
+ * // Install a FastNavPlugin
20375
+ *
20376
+ * new FastNavPlugin(viewer, {
20377
+ * hideEdges: true, // Don't show edges while we interact (default is true)
20378
+ * hideSAO: true, // Don't show ambient shadows while we interact (default is true)
20379
+ * hideColorTexture: true, // No color textures while we interact (default is true)
20380
+ * hidePBR: true, // No physically-based rendering while we interact (default is true)
20381
+ * hideTransparentObjects: true, // Hide transparent objects while we interact (default is false)
20382
+ * scaleCanvasResolution: true, // Scale canvas resolution while we interact (default is false)
20383
+ * scaleCanvasResolutionFactor: 0.5, // Factor by which we scale canvas resolution when we interact (default is 0.6)
20384
+ * delayBeforeRestore: true, // When we stop interacting, delay before restoring normal render (default is true)
20385
+ * delayBeforeRestoreSeconds: 0.5 // The delay duration, in seconds (default is 0.5)
20386
+ * });
20387
+ *
20388
+ * // Load a BIM model from XTC
20389
+ *
20390
+ * const xtcLoader = new XTCLoaderPlugin(viewer);
20391
+ *
20392
+ * const model = xtcLoader.load({
20393
+ * id: "myModel",
20394
+ * src: "./models/xtc/HolterTower.xtc",
20395
+ * sao: true, // Enable ambient shadows for this model
20396
+ * pbr: true // Enable physically-based rendering for this model
20397
+ * });
20398
+ * ````
20399
+ *
20400
+ * @class FastNavPlugin
20401
+ */var FastNavPlugin=/*#__PURE__*/function(_Plugin6){/**
20402
+ * @constructor
20403
+ * @param {Viewer} viewer The Viewer.
20404
+ * @param {Object} cfg FastNavPlugin configuration.
20405
+ * @param {String} [cfg.id="FastNav"] Optional ID for this plugin, so that we can find it within {@link Viewer#plugins}.
20406
+ * @param {Boolean} [cfg.hideColorTexture=true] Whether to temporarily hide color textures whenever we interact with the Viewer.
20407
+ * @param {Boolean} [cfg.hidePBR=true] Whether to temporarily hide physically-based rendering (PBR) whenever we interact with the Viewer.
20408
+ * @param {Boolean} [cfg.hideSAO=true] Whether to temporarily hide scalable ambient occlusion (SAO) whenever we interact with the Viewer.
20409
+ * @param {Boolean} [cfg.hideEdges=true] Whether to temporarily hide edges whenever we interact with the Viewer.
20410
+ * @param {Boolean} [cfg.hideTransparentObjects=false] Whether to temporarily hide transparent objects whenever we interact with the Viewer.
20411
+ * @param {Number} [cfg.scaleCanvasResolution=false] Whether to temporarily down-scale the canvas resolution whenever we interact with the Viewer.
20412
+ * @param {Number} [cfg.scaleCanvasResolutionFactor=0.6] The factor by which we downscale the canvas resolution whenever we interact with the Viewer.
20413
+ * @param {Boolean} [cfg.delayBeforeRestore=true] Whether to temporarily have a delay before restoring normal rendering after we stop interacting with the Viewer.
20414
+ * @param {Number} [cfg.delayBeforeRestoreSeconds=0.5] Delay in seconds before restoring normal rendering after we stop interacting with the Viewer.
20415
+ */function FastNavPlugin(viewer){var _this91;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,FastNavPlugin);_this91=_callSuper(this,FastNavPlugin,["FastNav",viewer]);_this91._hideColorTexture=cfg.hideColorTexture!==false;_this91._hidePBR=cfg.hidePBR!==false;_this91._hideSAO=cfg.hideSAO!==false;_this91._hideEdges=cfg.hideEdges!==false;_this91._hideTransparentObjects=!!cfg.hideTransparentObjects;_this91._scaleCanvasResolution=!!cfg.scaleCanvasResolution;_this91._scaleCanvasResolutionFactor=cfg.scaleCanvasResolutionFactor||0.6;_this91._delayBeforeRestore=cfg.delayBeforeRestore!==false;_this91._delayBeforeRestoreSeconds=cfg.delayBeforeRestoreSeconds||0.5;var timer=_this91._delayBeforeRestoreSeconds*1000;var fastMode=false;var switchToLowQuality=function switchToLowQuality(){timer=_this91._delayBeforeRestoreSeconds*1000;if(!fastMode){viewer.scene._renderer.setColorTextureEnabled(!_this91._hideColorTexture);viewer.scene._renderer.setPBREnabled(!_this91._hidePBR);viewer.scene._renderer.setSAOEnabled(!_this91._hideSAO);viewer.scene._renderer.setTransparentEnabled(!_this91._hideTransparentObjects);viewer.scene._renderer.setEdgesEnabled(!_this91._hideEdges);if(_this91._scaleCanvasResolution){viewer.scene.canvas.resolutionScale=_this91._scaleCanvasResolutionFactor;}else{viewer.scene.canvas.resolutionScale=1;}fastMode=true;}};var switchToHighQuality=function switchToHighQuality(){viewer.scene.canvas.resolutionScale=1;viewer.scene._renderer.setEdgesEnabled(true);viewer.scene._renderer.setColorTextureEnabled(true);viewer.scene._renderer.setPBREnabled(true);viewer.scene._renderer.setSAOEnabled(true);viewer.scene._renderer.setTransparentEnabled(true);fastMode=false;};_this91._onCanvasBoundary=viewer.scene.canvas.on("boundary",switchToLowQuality);_this91._onCameraMatrix=viewer.scene.camera.on("matrix",switchToLowQuality);_this91._onSceneTick=viewer.scene.on("tick",function(tickEvent){if(!fastMode){return;}timer-=tickEvent.deltaTime;if(!_this91._delayBeforeRestore||timer<=0){switchToHighQuality();}});var down=false;_this91._onSceneMouseDown=viewer.scene.input.on("mousedown",function(){down=true;});_this91._onSceneMouseUp=viewer.scene.input.on("mouseup",function(){down=false;});_this91._onSceneMouseMove=viewer.scene.input.on("mousemove",function(){if(!down){return;}switchToLowQuality();});return _this91;}/**
20416
+ * Gets whether to temporarily hide color textures whenever we interact with the Viewer.
20417
+ *
20418
+ * Default is ````true````.
20419
+ *
20420
+ * @return {Boolean} ````true```` if hiding color textures.
20421
+ */_inherits(FastNavPlugin,_Plugin6);return _createClass(FastNavPlugin,[{key:"hideColorTexture",get:function get(){return this._hideColorTexture;}/**
20422
+ * Sets whether to temporarily hide color textures whenever we interact with the Viewer.
20423
+ *
20424
+ * Default is ````true````.
20425
+ *
20426
+ * @param {Boolean} hideColorTexture ````true```` to hide color textures.
20427
+ */,set:function set(hideColorTexture){this._hideColorTexture=hideColorTexture;}/**
20428
+ * Gets whether to temporarily hide physically-based rendering (PBR) whenever we interact with the Viewer.
20429
+ *
20430
+ * Default is ````true````.
20431
+ *
20432
+ * @return {Boolean} ````true```` if hiding PBR.
20433
+ */},{key:"hidePBR",get:function get(){return this._hidePBR;}/**
20434
+ * Sets whether to temporarily hide physically-based rendering (PBR) whenever we interact with the Viewer.
20435
+ *
20436
+ * Default is ````true````.
20437
+ *
20438
+ * @param {Boolean} hidePBR ````true```` to hide PBR.
20439
+ */,set:function set(hidePBR){this._hidePBR=hidePBR;}/**
20440
+ * Gets whether to temporarily hide scalable ambient shadows (SAO) whenever we interact with the Viewer.
20441
+ *
20442
+ * Default is ````true````.
20443
+ *
20444
+ * @return {Boolean} ````true```` if hiding SAO.
20445
+ */},{key:"hideSAO",get:function get(){return this._hideSAO;}/**
20446
+ * Sets whether to temporarily hide scalable ambient shadows (SAO) whenever we interact with the Viewer.
20447
+ *
20448
+ * Default is ````true````.
20449
+ *
20450
+ * @param {Boolean} hideSAO ````true```` to hide SAO.
20451
+ */,set:function set(hideSAO){this._hideSAO=hideSAO;}/**
20452
+ * Gets whether to temporarily hide edges whenever we interact with the Viewer.
20453
+ *
20454
+ * Default is ````true````.
20455
+ *
20456
+ * @return {Boolean} ````true```` if hiding edges.
20457
+ */},{key:"hideEdges",get:function get(){return this._hideEdges;}/**
20458
+ * Sets whether to temporarily hide edges whenever we interact with the Viewer.
20459
+ *
20460
+ * Default is ````true````.
20461
+ *
20462
+ * @param {Boolean} hideEdges ````true```` to hide edges.
20463
+ */,set:function set(hideEdges){this._hideEdges=hideEdges;}/**
20464
+ * Gets whether to temporarily hide transparent objects whenever we interact with the Viewer.
20465
+ *
20466
+ * Does not hide X-rayed, selected, highlighted objects.
20467
+ *
20468
+ * Default is ````false````.
20469
+ *
20470
+ * @return {Boolean} ````true```` if hiding transparent objects.
20471
+ */},{key:"hideTransparentObjects",get:function get(){return this._hideTransparentObjects;}/**
20472
+ * Sets whether to temporarily hide transparent objects whenever we interact with the Viewer.
20473
+ *
20474
+ * Does not hide X-rayed, selected, highlighted objects.
20475
+ *
20476
+ * Default is ````false````.
20477
+ *
20478
+ * @param {Boolean} hideTransparentObjects ````true```` to hide transparent objects.
20479
+ */,set:function set(hideTransparentObjects){this._hideTransparentObjects=hideTransparentObjects!==false;}/**
20480
+ * Gets whether to temporarily scale the canvas resolution whenever we interact with the Viewer.
20481
+ *
20482
+ * Default is ````false````.
20483
+ *
20484
+ * The scaling factor is configured via {@link FastNavPlugin#scaleCanvasResolutionFactor}.
20485
+ *
20486
+ * @return {Boolean} ````true```` if scaling the canvas resolution.
20487
+ */},{key:"scaleCanvasResolution",get:function get(){return this._scaleCanvasResolution;}/**
20488
+ * Sets whether to temporarily scale the canvas resolution whenever we interact with the Viewer.
20489
+ *
20490
+ * Default is ````false````.
20491
+ *
20492
+ * The scaling factor is configured via {@link FastNavPlugin#scaleCanvasResolutionFactor}.
20493
+ *
20494
+ * @param {Boolean} scaleCanvasResolution ````true```` to scale the canvas resolution.
20495
+ */,set:function set(scaleCanvasResolution){this._scaleCanvasResolution=scaleCanvasResolution;}/**
20496
+ * Gets the factor by which we temporarily scale the canvas resolution when we interact with the viewer.
20497
+ *
20498
+ * Default is ````0.6````.
20499
+ *
20500
+ * Enable canvas resolution scaling by setting {@link FastNavPlugin#scaleCanvasResolution} ````true````.
20501
+ *
20502
+ * @return {Number} Factor by which we scale the canvas resolution.
20503
+ */},{key:"scaleCanvasResolutionFactor",get:function get(){return this._scaleCanvasResolutionFactor;}/**
20504
+ * Sets the factor by which we temporarily scale the canvas resolution when we interact with the viewer.
20505
+ *
20506
+ * Accepted range is ````[0.0 .. 1.0]````.
20507
+ *
20508
+ * Default is ````0.6````.
20509
+ *
20510
+ * Enable canvas resolution scaling by setting {@link FastNavPlugin#scaleCanvasResolution} ````true````.
20511
+ *
20512
+ * @param {Number} scaleCanvasResolutionFactor Factor by which we scale the canvas resolution.
20513
+ */,set:function set(scaleCanvasResolutionFactor){this._scaleCanvasResolutionFactor=scaleCanvasResolutionFactor||0.6;}/**
20514
+ * Gets whether to have a delay before restoring normal rendering after we stop interacting with the Viewer.
20515
+ *
20516
+ * The delay duration is configured via {@link FastNavPlugin#delayBeforeRestoreSeconds}.
20517
+ *
20518
+ * Default is ````true````.
20519
+ *
20520
+ * @return {Boolean} Whether to have a delay.
20521
+ */},{key:"delayBeforeRestore",get:function get(){return this._delayBeforeRestore;}/**
20522
+ * Sets whether to have a delay before restoring normal rendering after we stop interacting with the Viewer.
20523
+ *
20524
+ * The delay duration is configured via {@link FastNavPlugin#delayBeforeRestoreSeconds}.
20525
+ *
20526
+ * Default is ````true````.
20527
+ *
20528
+ * @param {Boolean} delayBeforeRestore Whether to have a delay.
20529
+ */,set:function set(delayBeforeRestore){this._delayBeforeRestore=delayBeforeRestore;}/**
20530
+ * Gets the delay before restoring normal rendering after we stop interacting with the Viewer.
20531
+ *
20532
+ * The delay is enabled when {@link FastNavPlugin#delayBeforeRestore} is ````true````.
20533
+ *
20534
+ * Default is ````0.5```` seconds.
20535
+ *
20536
+ * @return {Number} Delay in seconds.
20537
+ */},{key:"delayBeforeRestoreSeconds",get:function get(){return this._delayBeforeRestoreSeconds;}/**
20538
+ * Sets the delay before restoring normal rendering after we stop interacting with the Viewer.
20539
+ *
20540
+ * The delay is enabled when {@link FastNavPlugin#delayBeforeRestore} is ````true````.
20541
+ *
20542
+ * Default is ````0.5```` seconds.
20543
+ *
20544
+ * @param {Number} delayBeforeRestoreSeconds Delay in seconds.
20545
+ */,set:function set(delayBeforeRestoreSeconds){this._delayBeforeRestoreSeconds=delayBeforeRestoreSeconds!==null&&delayBeforeRestoreSeconds!==undefined?delayBeforeRestoreSeconds:0.5;}/**
20546
+ * @private
20547
+ */},{key:"send",value:function send(name,value){}/**
20548
+ * Destroys this plugin.
20549
+ */},{key:"destroy",value:function destroy(){this.viewer.scene.camera.off(this._onCameraMatrix);this.viewer.scene.canvas.off(this._onCanvasBoundary);this.viewer.scene.input.off(this._onSceneMouseDown);this.viewer.scene.input.off(this._onSceneMouseUp);this.viewer.scene.input.off(this._onSceneMouseMove);this.viewer.scene.off(this._onSceneTick);_superPropGet(FastNavPlugin,"destroy",this,3)([]);}}]);}(Plugin);/**
20303
20550
  * Default data access strategy for {@link GLTFLoaderPlugin}.
20304
20551
  *
20305
20552
  * This just loads assets using XMLHttpRequest.
@@ -20621,7 +20868,7 @@ subs[subId]={callback:callback};this._eventSubEvents[subId]=event;var value=this
20621
20868
  * @param {String} [cfg.id] Optional ID, unique among all components in the parent {@link Curve}, generated automatically when omitted.
20622
20869
  * @param {Object} [cfg] Configs for this Curve.
20623
20870
  * @param {Number} [cfg.t=0] Current position on this Curve, in range between ````0..1````.
20624
- */function Curve(owner){var _this91;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,Curve);_this91=_callSuper(this,Curve,[owner,cfg]);_this91.t=cfg.t;return _this91;}/**
20871
+ */function Curve(owner){var _this92;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,Curve);_this92=_callSuper(this,Curve,[owner,cfg]);_this92.t=cfg.t;return _this92;}/**
20625
20872
  * Sets the progress along this Curve.
20626
20873
  *
20627
20874
  * Automatically clamps to range ````[0..1]````.
@@ -20676,7 +20923,7 @@ comparison=arcLengths[i]-targetArcLength;if(comparison<0){low=i+1;}else if(compa
20676
20923
  * @param {Array} [cfg.points=[]] Control points on this SplineCurve.
20677
20924
  * @param {Number} [cfg.t=0] Current position on this SplineCurve, in range between 0..1.
20678
20925
  * @param {Number} [cfg.t=0] Current position on this CubicBezierCurve, in range between 0..1.
20679
- */function SplineCurve(owner){var _this92;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,SplineCurve);_this92=_callSuper(this,SplineCurve,[owner,cfg]);_this92.points=cfg.points;_this92.t=cfg.t;return _this92;}/**
20926
+ */function SplineCurve(owner){var _this93;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,SplineCurve);_this93=_callSuper(this,SplineCurve,[owner,cfg]);_this93.points=cfg.points;_this93.t=cfg.t;return _this93;}/**
20680
20927
  * Sets the control points on this SplineCurve.
20681
20928
  *
20682
20929
  * Default value is ````[]````.
@@ -20723,7 +20970,7 @@ comparison=arcLengths[i]-targetArcLength;if(comparison<0){low=i+1;}else if(compa
20723
20970
  * @param [cfg] {*} Configuration
20724
20971
  * @param {String} [cfg.id] Optional ID, unique among all components in the parent {@link Scene}, generated automatically when omitted.
20725
20972
  * @param {{t:Number, eye:Object, look:Object, up: Object}[]} [cfg.frames] Initial sequence of frames.
20726
- */function CameraPath(owner){var _this93;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,CameraPath);_this93=_callSuper(this,CameraPath,[owner,cfg]);_this93._frames=[];_this93._eyeCurve=new SplineCurve(_this93);_this93._lookCurve=new SplineCurve(_this93);_this93._upCurve=new SplineCurve(_this93);if(cfg.frames){_this93.addFrames(cfg.frames);_this93.smoothFrameTimes(1);}return _this93;}/**
20973
+ */function CameraPath(owner){var _this94;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,CameraPath);_this94=_callSuper(this,CameraPath,[owner,cfg]);_this94._frames=[];_this94._eyeCurve=new SplineCurve(_this94);_this94._lookCurve=new SplineCurve(_this94);_this94._upCurve=new SplineCurve(_this94);if(cfg.frames){_this94.addFrames(cfg.frames);_this94.smoothFrameTimes(1);}return _this94;}/**
20727
20974
  * Gets the camera frames in this CameraPath.
20728
20975
  *
20729
20976
  * @returns {{t:Number, eye:Object, look:Object, up: Object}[]} The frames on this CameraPath.
@@ -20868,7 +21115,7 @@ comparison=arcLengths[i]-targetArcLength;if(comparison<0){low=i+1;}else if(compa
20868
21115
  */var CameraFlightAnimation=/*#__PURE__*/function(_Component33){/**
20869
21116
  @constructor
20870
21117
  @private
20871
- */function CameraFlightAnimation(owner){var _this94;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,CameraFlightAnimation);_this94=_callSuper(this,CameraFlightAnimation,[owner,cfg]);_this94._look1=math.vec3();_this94._eye1=math.vec3();_this94._up1=math.vec3();_this94._look2=math.vec3();_this94._eye2=math.vec3();_this94._up2=math.vec3();_this94._orthoScale1=1;_this94._orthoScale2=1;_this94._flying=false;_this94._flyEyeLookUp=false;_this94._flyingEye=false;_this94._flyingLook=false;_this94._callback=null;_this94._callbackScope=null;_this94._time1=null;_this94._time2=null;_this94.easing=cfg.easing!==false;_this94.duration=cfg.duration;_this94.fit=cfg.fit;_this94.fitFOV=cfg.fitFOV;_this94.trail=cfg.trail;return _this94;}/**
21118
+ */function CameraFlightAnimation(owner){var _this95;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,CameraFlightAnimation);_this95=_callSuper(this,CameraFlightAnimation,[owner,cfg]);_this95._look1=math.vec3();_this95._eye1=math.vec3();_this95._up1=math.vec3();_this95._look2=math.vec3();_this95._eye2=math.vec3();_this95._up2=math.vec3();_this95._orthoScale1=1;_this95._orthoScale2=1;_this95._flying=false;_this95._flyEyeLookUp=false;_this95._flyingEye=false;_this95._flyingLook=false;_this95._callback=null;_this95._callbackScope=null;_this95._time1=null;_this95._time2=null;_this95.easing=cfg.easing!==false;_this95.duration=cfg.duration;_this95.fit=cfg.fit;_this95.fitFOV=cfg.fitFOV;_this95.trail=cfg.trail;return _this95;}/**
20872
21119
  * Flies the {@link Camera} to a target.
20873
21120
  *
20874
21121
  * * When the target is a boundary, the {@link Camera} will fly towards the target and stop when the target fills most of the canvas.
@@ -21063,7 +21310,7 @@ t/=d;return-c*t*(t-2)+b;}},{key:"_easeInCubic",value:function _easeInCubic(t,b,c
21063
21310
  * @param {*} [cfg] Configuration
21064
21311
  * @param {String} [cfg.id] Optional ID, unique among all components in the parent {@link Scene}, generated automatically when omitted.
21065
21312
  * @param {CameraPath} [cfg.eyeCurve] A {@link CameraPath} that defines the path of a {@link Camera}.
21066
- */function CameraPathAnimation(owner){var _this95;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,CameraPathAnimation);_this95=_callSuper(this,CameraPathAnimation,[owner,cfg]);_this95._cameraFlightAnimation=new CameraFlightAnimation(_this95);_this95._t=0;_this95.state=CameraPathAnimation.SCRUBBING;_this95._playingFromT=0;_this95._playingToT=0;_this95._playingRate=cfg.playingRate||1.0;_this95._playingDir=1.0;_this95._lastTime=null;_this95.cameraPath=cfg.cameraPath;_this95._tick=_this95.scene.on("tick",_this95._updateT,_this95);return _this95;}_inherits(CameraPathAnimation,_Component34);return _createClass(CameraPathAnimation,[{key:"type",get:/**
21313
+ */function CameraPathAnimation(owner){var _this96;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,CameraPathAnimation);_this96=_callSuper(this,CameraPathAnimation,[owner,cfg]);_this96._cameraFlightAnimation=new CameraFlightAnimation(_this96);_this96._t=0;_this96.state=CameraPathAnimation.SCRUBBING;_this96._playingFromT=0;_this96._playingToT=0;_this96._playingRate=cfg.playingRate||1.0;_this96._playingDir=1.0;_this96._lastTime=null;_this96.cameraPath=cfg.cameraPath;_this96._tick=_this96.scene.on("tick",_this96._updateT,_this96);return _this96;}_inherits(CameraPathAnimation,_Component34);return _createClass(CameraPathAnimation,[{key:"type",get:/**
21067
21314
  * Returns "CameraPathAnimation".
21068
21315
  *
21069
21316
  * @private
@@ -21244,7 +21491,7 @@ t/=d;return-c*t*(t-2)+b;}},{key:"_easeInCubic",value:function _easeInCubic(t,b,c
21244
21491
  * @param {Number} [cfg.opacity=1.0] ````ImagePlane````'s initial opacity factor, multiplies by the rendered fragment alpha.
21245
21492
  * @param {String} [cfg.src] URL of image. Accepted file types are PNG and JPEG.
21246
21493
  * @param {HTMLImageElement} [cfg.image] An ````HTMLImageElement```` to source the image from. Overrides ````src````.
21247
- */function ImagePlane(owner){var _this96;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,ImagePlane);_this96=_callSuper(this,ImagePlane,[owner,cfg]);_this96._src=null;_this96._image=null;_this96._pos=math.vec3();_this96._origin=math.vec3();_this96._rtcPos=math.vec3();_this96._dir=math.vec3();_this96._size=1.0;_this96._imageSize=math.vec2();_this96._texture=new Texture(_this96);_this96._plane=new Mesh(_this96,{geometry:new ReadableGeometry(_this96,buildPlaneGeometry({center:[0,0,0],xSize:1,zSize:1,xSegments:10,zSegments:10})),material:new PhongMaterial(_this96,{diffuse:[0,0,0],ambient:[0,0,0],specular:[0,0,0],diffuseMap:_this96._texture,emissiveMap:_this96._texture,backfaces:true}),clippable:cfg.clippable});_this96._grid=new Mesh(_this96,{geometry:new ReadableGeometry(_this96,buildGridGeometry({size:1,divisions:10})),material:new PhongMaterial(_this96,{diffuse:[0.0,0.0,0.0],ambient:[0.0,0.0,0.0],emissive:[0.2,0.8,0.2]}),position:[0,0.001,0.0],clippable:cfg.clippable});_this96._node=new Node$1(_this96,{rotation:[0,0,0],position:[0,0,0],scale:[1,1,1],clippable:false,children:[_this96._plane,_this96._grid]});_this96._gridVisible=false;_this96.visible=true;_this96.gridVisible=cfg.gridVisible;_this96.position=cfg.position;_this96.rotation=cfg.rotation;_this96.dir=cfg.dir;_this96.size=cfg.size;_this96.collidable=cfg.collidable;_this96.clippable=cfg.clippable;_this96.pickable=cfg.pickable;_this96.opacity=cfg.opacity;if(cfg.image){_this96.image=cfg.image;}else{_this96.src=cfg.src;}return _this96;}/**
21494
+ */function ImagePlane(owner){var _this97;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,ImagePlane);_this97=_callSuper(this,ImagePlane,[owner,cfg]);_this97._src=null;_this97._image=null;_this97._pos=math.vec3();_this97._origin=math.vec3();_this97._rtcPos=math.vec3();_this97._dir=math.vec3();_this97._size=1.0;_this97._imageSize=math.vec2();_this97._texture=new Texture(_this97);_this97._plane=new Mesh(_this97,{geometry:new ReadableGeometry(_this97,buildPlaneGeometry({center:[0,0,0],xSize:1,zSize:1,xSegments:10,zSegments:10})),material:new PhongMaterial(_this97,{diffuse:[0,0,0],ambient:[0,0,0],specular:[0,0,0],diffuseMap:_this97._texture,emissiveMap:_this97._texture,backfaces:true}),clippable:cfg.clippable});_this97._grid=new Mesh(_this97,{geometry:new ReadableGeometry(_this97,buildGridGeometry({size:1,divisions:10})),material:new PhongMaterial(_this97,{diffuse:[0.0,0.0,0.0],ambient:[0.0,0.0,0.0],emissive:[0.2,0.8,0.2]}),position:[0,0.001,0.0],clippable:cfg.clippable});_this97._node=new Node$1(_this97,{rotation:[0,0,0],position:[0,0,0],scale:[1,1,1],clippable:false,children:[_this97._plane,_this97._grid]});_this97._gridVisible=false;_this97.visible=true;_this97.gridVisible=cfg.gridVisible;_this97.position=cfg.position;_this97.rotation=cfg.rotation;_this97.dir=cfg.dir;_this97.size=cfg.size;_this97.collidable=cfg.collidable;_this97.clippable=cfg.clippable;_this97.pickable=cfg.pickable;_this97.opacity=cfg.opacity;if(cfg.image){_this97.image=cfg.image;}else{_this97.src=cfg.src;}return _this97;}/**
21248
21495
  * Sets if this ````ImagePlane```` is visible or not.
21249
21496
  *
21250
21497
  * Default value is ````true````.
@@ -21302,7 +21549,7 @@ t/=d;return-c*t*(t-2)+b;}},{key:"_easeInCubic",value:function _easeInCubic(t,b,c
21302
21549
  * Default value is ````[0, 0, 0]````.
21303
21550
  *
21304
21551
  * @param {Number[]} value New position.
21305
- */,set:function set(src){var _this97=this;this._src=src;if(this._src){this._image=null;var _image4=new Image();_image4.onload=function(){_this97._texture.image=_image4;_this97._imageSize[0]=_image4.width;_this97._imageSize[1]=_image4.height;_this97._updatePlaneSizeFromImage();};_image4.src=this._src;}}},{key:"position",get:/**
21552
+ */,set:function set(src){var _this98=this;this._src=src;if(this._src){this._image=null;var _image4=new Image();_image4.onload=function(){_this98._texture.image=_image4;_this98._imageSize[0]=_image4.width;_this98._imageSize[1]=_image4.height;_this98._updatePlaneSizeFromImage();};_image4.src=this._src;}}},{key:"position",get:/**
21306
21553
  * Gets the World-space position of this ````ImagePlane````.
21307
21554
  *
21308
21555
  * Default value is ````[0, 0, 0]````.
@@ -21498,9 +21745,9 @@ t/=d;return-c*t*(t-2)+b;}},{key:"_easeInCubic",value:function _easeInCubic(t,b,c
21498
21745
  * @param {Number} [cfg.quadraticAttenuation=0]Quadratic attenuation factor.
21499
21746
  * @param {String} [cfg.space="view"]The coordinate system this PointLight is defined in - "view" or "world".
21500
21747
  * @param {Boolean} [cfg.castsShadow=false] Flag which indicates if this PointLight casts a castsShadow.
21501
- */function PointLight(owner){var _this98;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,PointLight);_this98=_callSuper(this,PointLight,[owner,cfg]);var self=_this98;_this98._shadowRenderBuf=null;_this98._shadowViewMatrix=null;_this98._shadowProjMatrix=null;_this98._shadowViewMatrixDirty=true;_this98._shadowProjMatrixDirty=true;var camera=_this98.scene.camera;var canvas=_this98.scene.canvas;_this98._onCameraViewMatrix=camera.on("viewMatrix",function(){_this98._shadowViewMatrixDirty=true;});_this98._onCameraProjMatrix=camera.on("projMatrix",function(){_this98._shadowProjMatrixDirty=true;});_this98._onCanvasBoundary=canvas.on("boundary",function(){_this98._shadowProjMatrixDirty=true;});_this98._state=new RenderState({type:"point",pos:math.vec3([1.0,1.0,1.0]),color:math.vec3([0.7,0.7,0.8]),intensity:1.0,attenuation:[0.0,0.0,0.0],space:cfg.space||"view",castsShadow:false,getShadowViewMatrix:function getShadowViewMatrix(){if(self._shadowViewMatrixDirty){if(!self._shadowViewMatrix){self._shadowViewMatrix=math.identityMat4();}var eye=self._state.pos;var look=camera.look;var up=camera.up;math.lookAtMat4v(eye,look,up,self._shadowViewMatrix);self._shadowViewMatrixDirty=false;}return self._shadowViewMatrix;},getShadowProjMatrix:function getShadowProjMatrix(){if(self._shadowProjMatrixDirty){// TODO: Set when canvas resizes
21748
+ */function PointLight(owner){var _this99;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,PointLight);_this99=_callSuper(this,PointLight,[owner,cfg]);var self=_this99;_this99._shadowRenderBuf=null;_this99._shadowViewMatrix=null;_this99._shadowProjMatrix=null;_this99._shadowViewMatrixDirty=true;_this99._shadowProjMatrixDirty=true;var camera=_this99.scene.camera;var canvas=_this99.scene.canvas;_this99._onCameraViewMatrix=camera.on("viewMatrix",function(){_this99._shadowViewMatrixDirty=true;});_this99._onCameraProjMatrix=camera.on("projMatrix",function(){_this99._shadowProjMatrixDirty=true;});_this99._onCanvasBoundary=canvas.on("boundary",function(){_this99._shadowProjMatrixDirty=true;});_this99._state=new RenderState({type:"point",pos:math.vec3([1.0,1.0,1.0]),color:math.vec3([0.7,0.7,0.8]),intensity:1.0,attenuation:[0.0,0.0,0.0],space:cfg.space||"view",castsShadow:false,getShadowViewMatrix:function getShadowViewMatrix(){if(self._shadowViewMatrixDirty){if(!self._shadowViewMatrix){self._shadowViewMatrix=math.identityMat4();}var eye=self._state.pos;var look=camera.look;var up=camera.up;math.lookAtMat4v(eye,look,up,self._shadowViewMatrix);self._shadowViewMatrixDirty=false;}return self._shadowViewMatrix;},getShadowProjMatrix:function getShadowProjMatrix(){if(self._shadowProjMatrixDirty){// TODO: Set when canvas resizes
21502
21749
  if(!self._shadowProjMatrix){self._shadowProjMatrix=math.identityMat4();}var _canvas4=self.scene.canvas.canvas;math.perspectiveMat4(70*(Math.PI/180.0),_canvas4.clientWidth/_canvas4.clientHeight,0.1,500.0,self._shadowProjMatrix);self._shadowProjMatrixDirty=false;}return self._shadowProjMatrix;},getShadowRenderBuf:function getShadowRenderBuf(){if(!self._shadowRenderBuf){self._shadowRenderBuf=new RenderBuffer(self.scene.canvas.canvas,self.scene.canvas.gl,{size:[1024,1024]});// Super old mobile devices have a limit of 1024x1024 textures
21503
- }return self._shadowRenderBuf;}});_this98.pos=cfg.pos;_this98.color=cfg.color;_this98.intensity=cfg.intensity;_this98.constantAttenuation=cfg.constantAttenuation;_this98.linearAttenuation=cfg.linearAttenuation;_this98.quadraticAttenuation=cfg.quadraticAttenuation;_this98.castsShadow=cfg.castsShadow;_this98.scene._lightCreated(_this98);return _this98;}/**
21750
+ }return self._shadowRenderBuf;}});_this99.pos=cfg.pos;_this99.color=cfg.color;_this99.intensity=cfg.intensity;_this99.constantAttenuation=cfg.constantAttenuation;_this99.linearAttenuation=cfg.linearAttenuation;_this99.quadraticAttenuation=cfg.quadraticAttenuation;_this99.castsShadow=cfg.castsShadow;_this99.scene._lightCreated(_this99);return _this99;}/**
21504
21751
  * Sets the position of this PointLight.
21505
21752
  *
21506
21753
  * This will be either World- or View-space, depending on the value of {@link PointLight#space}.
@@ -21602,7 +21849,7 @@ if(!self._shadowProjMatrix){self._shadowProjMatrix=math.identityMat4();}var _can
21602
21849
  * @param {String[]} [cfg.src=null] Paths to six image files to load into this CubeTexture.
21603
21850
  * @param {Boolean} [cfg.flipY=false] Flips this CubeTexture's source data along its vertical axis when true.
21604
21851
  * @param {Number} [cfg.encoding=LinearEncoding] Encoding format. Supported values are {@link LinearEncoding} and {@link sRGBEncoding}.
21605
- */function CubeTexture(owner){var _this99;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,CubeTexture);_this99=_callSuper(this,CubeTexture,[owner,cfg]);var gl=_this99.scene.canvas.gl;_this99._state=new RenderState({texture:new Texture2D({gl:gl,target:gl.TEXTURE_CUBE_MAP}),flipY:_this99._checkFlipY(cfg.minFilter),encoding:_this99._checkEncoding(cfg.encoding),minFilter:LinearMipmapLinearFilter,magFilter:LinearFilter,wrapS:ClampToEdgeWrapping,wrapT:ClampToEdgeWrapping,mipmaps:true});_this99._src=cfg.src;_this99._images=[];_this99._loadSrc(cfg.src);stats.memory.textures++;return _this99;}_inherits(CubeTexture,_Component36);return _createClass(CubeTexture,[{key:"type",get:/**
21852
+ */function CubeTexture(owner){var _this100;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,CubeTexture);_this100=_callSuper(this,CubeTexture,[owner,cfg]);var gl=_this100.scene.canvas.gl;_this100._state=new RenderState({texture:new Texture2D({gl:gl,target:gl.TEXTURE_CUBE_MAP}),flipY:_this100._checkFlipY(cfg.minFilter),encoding:_this100._checkEncoding(cfg.encoding),minFilter:LinearMipmapLinearFilter,magFilter:LinearFilter,wrapS:ClampToEdgeWrapping,wrapT:ClampToEdgeWrapping,mipmaps:true});_this100._src=cfg.src;_this100._images=[];_this100._loadSrc(cfg.src);stats.memory.textures++;return _this100;}_inherits(CubeTexture,_Component36);return _createClass(CubeTexture,[{key:"type",get:/**
21606
21853
  @private
21607
21854
  */function get(){return"CubeTexture";}},{key:"_checkFlipY",value:function _checkFlipY(value){return!!value;}},{key:"_checkEncoding",value:function _checkEncoding(value){value=value||LinearEncoding;if(value!==LinearEncoding&&value!==sRGBEncoding){this.error("Unsupported value for 'encoding' - supported values are LinearEncoding and sRGBEncoding. Defaulting to LinearEncoding.");value=LinearEncoding;}return value;}},{key:"_webglContextRestored",value:function _webglContextRestored(){this.scene.canvas.gl;this._state.texture=null;// if (this._images.length > 0) {
21608
21855
  // this._state.texture = new xeokit.renderer.Texture2D(gl, gl.TEXTURE_CUBE_MAP);
@@ -21662,7 +21909,7 @@ if(this._src){this._loadSrc(this._src);}}},{key:"_loadSrc",value:function _loadS
21662
21909
  * @param {String[]} [cfg.src=null] Paths to six image files to load into this ReflectionMap.
21663
21910
  * @param {Boolean} [cfg.flipY=false] Flips this ReflectionMap's source data along its vertical axis when true.
21664
21911
  * @param {Number} [cfg.encoding=LinearEncoding] Encoding format. Supported values are {@link LinearEncoding} and {@link sRGBEncoding}.
21665
- */function ReflectionMap(owner){var _this100;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,ReflectionMap);_this100=_callSuper(this,ReflectionMap,[owner,cfg]);_this100.scene._lightsState.addReflectionMap(_this100._state);_this100.scene._reflectionMapCreated(_this100);return _this100;}/**
21912
+ */function ReflectionMap(owner){var _this101;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,ReflectionMap);_this101=_callSuper(this,ReflectionMap,[owner,cfg]);_this101.scene._lightsState.addReflectionMap(_this101._state);_this101.scene._reflectionMapCreated(_this101);return _this101;}/**
21666
21913
  * Destroys this ReflectionMap.
21667
21914
  */_inherits(ReflectionMap,_CubeTexture);return _createClass(ReflectionMap,[{key:"type",get:/**
21668
21915
  @private
@@ -21718,7 +21965,7 @@ if(this._src){this._loadSrc(this._src);}}},{key:"_loadSrc",value:function _loadS
21718
21965
  * @param {String[]} [cfg.src=null] Paths to six image files to load into this LightMap.
21719
21966
  * @param {Boolean} [cfg.flipY=false] Flips this LightMap's source data along its vertical axis when true.
21720
21967
  * @param {Number} [cfg.encoding=LinearEncoding] Encoding format. Supported values are {@link LinearEncoding} and {@link sRGBEncoding}.
21721
- */function LightMap(owner){var _this101;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,LightMap);_this101=_callSuper(this,LightMap,[owner,cfg]);_this101.scene._lightMapCreated(_this101);return _this101;}_inherits(LightMap,_CubeTexture2);return _createClass(LightMap,[{key:"type",get:/**
21968
+ */function LightMap(owner){var _this102;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,LightMap);_this102=_callSuper(this,LightMap,[owner,cfg]);_this102.scene._lightMapCreated(_this102);return _this102;}_inherits(LightMap,_CubeTexture2);return _createClass(LightMap,[{key:"type",get:/**
21722
21969
  @private
21723
21970
  */function get(){return"LightMap";}},{key:"destroy",value:function destroy(){_superPropGet(LightMap,"destroy",this,3)([]);this.scene._lightMapDestroyed(this);}}]);}(CubeTexture);/**
21724
21971
  * A {@link Marker} with a billboarded and textured quad attached to it.
@@ -21771,10 +22018,10 @@ if(this._src){this._loadSrc(this._src);}}},{key:"_loadSrc",value:function _loadS
21771
22018
  * @param {HTMLImageElement} [cfg.image=null] HTML Image object to load into this SpriteMarker. See the {@link SpriteMarker#image} property for more info.
21772
22019
  * @param {Boolean} [cfg.flipY=false] Flips this SpriteMarker's texture image along its vertical axis when true.
21773
22020
  * @param {String} [cfg.encoding="linear"] Texture encoding format. See the {@link Texture#encoding} property for more info.
21774
- */function SpriteMarker(owner){var _this102;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,SpriteMarker);_this102=_callSuper(this,SpriteMarker,[owner,{entity:cfg.entity,occludable:cfg.occludable,worldPos:cfg.worldPos}]);_this102._occluded=false;_this102._visible=true;_this102._src=null;_this102._image=null;_this102._pos=math.vec3();_this102._origin=math.vec3();_this102._rtcPos=math.vec3();_this102._dir=math.vec3();_this102._size=1.0;_this102._imageSize=math.vec2();_this102._texture=new Texture(_this102,{src:cfg.src});_this102._geometry=new ReadableGeometry(_this102,{primitive:"triangles",positions:[3,3,0,-3,3,0,-3,-3,0,3,-3,0],normals:[-1,0,0,-1,0,0,-1,0,0,-1,0,0],uv:[1,-1,0,-1,0,0,1,0],indices:[0,1,2,0,2,3]// Ensure these will be front-faces
21775
- });_this102._mesh=new Mesh(_this102,{geometry:_this102._geometry,material:new PhongMaterial(_this102,{ambient:[0.9,0.3,0.9],shininess:30,diffuseMap:_this102._texture,backfaces:true}),scale:[1,1,1],// Note: by design, scale does not work with billboard
22021
+ */function SpriteMarker(owner){var _this103;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,SpriteMarker);_this103=_callSuper(this,SpriteMarker,[owner,{entity:cfg.entity,occludable:cfg.occludable,worldPos:cfg.worldPos}]);_this103._occluded=false;_this103._visible=true;_this103._src=null;_this103._image=null;_this103._pos=math.vec3();_this103._origin=math.vec3();_this103._rtcPos=math.vec3();_this103._dir=math.vec3();_this103._size=1.0;_this103._imageSize=math.vec2();_this103._texture=new Texture(_this103,{src:cfg.src});_this103._geometry=new ReadableGeometry(_this103,{primitive:"triangles",positions:[3,3,0,-3,3,0,-3,-3,0,3,-3,0],normals:[-1,0,0,-1,0,0,-1,0,0,-1,0,0],uv:[1,-1,0,-1,0,0,1,0],indices:[0,1,2,0,2,3]// Ensure these will be front-faces
22022
+ });_this103._mesh=new Mesh(_this103,{geometry:_this103._geometry,material:new PhongMaterial(_this103,{ambient:[0.9,0.3,0.9],shininess:30,diffuseMap:_this103._texture,backfaces:true}),scale:[1,1,1],// Note: by design, scale does not work with billboard
21776
22023
  position:cfg.worldPos,rotation:[90,0,0],billboard:"spherical",occluder:false// Don't occlude SpriteMarkers or Annotations
21777
- });_this102.visible=true;_this102.collidable=cfg.collidable;_this102.clippable=cfg.clippable;_this102.pickable=cfg.pickable;_this102.opacity=cfg.opacity;_this102.size=cfg.size;if(cfg.image){_this102.image=cfg.image;}else{_this102.src=cfg.src;}return _this102;}_inherits(SpriteMarker,_Marker2);return _createClass(SpriteMarker,[{key:"_setVisible",value:function _setVisible(visible){// Called by VisibilityTester and this._entity.on("destroyed"..)
22024
+ });_this103.visible=true;_this103.collidable=cfg.collidable;_this103.clippable=cfg.clippable;_this103.pickable=cfg.pickable;_this103.opacity=cfg.opacity;_this103.size=cfg.size;if(cfg.image){_this103.image=cfg.image;}else{_this103.src=cfg.src;}return _this103;}_inherits(SpriteMarker,_Marker2);return _createClass(SpriteMarker,[{key:"_setVisible",value:function _setVisible(visible){// Called by VisibilityTester and this._entity.on("destroyed"..)
21778
22025
  this._occluded=!visible;this._mesh.visible=this._visible&&!this._occluded;_superPropGet(SpriteMarker,"_setVisible",this,3)([visible]);}/**
21779
22026
  * Sets if this ````SpriteMarker```` is visible or not.
21780
22027
  *
@@ -21822,7 +22069,7 @@ this._occluded=!visible;this._mesh.visible=this._visible&&!this._occluded;_super
21822
22069
  * Default value is ````1.0````.
21823
22070
  *
21824
22071
  * @param {Number} size New World-space size of the ````SpriteMarker````.
21825
- */,set:function set(src){var _this103=this;this._src=src;if(this._src){this._image=null;var _image5=new Image();_image5.onload=function(){_this103._texture.image=_image5;_this103._imageSize[0]=_image5.width;_this103._imageSize[1]=_image5.height;_this103._updatePlaneSizeFromImage();};_image5.src=this._src;}}},{key:"size",get:/**
22072
+ */,set:function set(src){var _this104=this;this._src=src;if(this._src){this._image=null;var _image5=new Image();_image5.onload=function(){_this104._texture.image=_image5;_this104._imageSize[0]=_image5.width;_this104._imageSize[1]=_image5.height;_this104._updatePlaneSizeFromImage();};_image5.src=this._src;}}},{key:"size",get:/**
21826
22073
  * Gets the World-space size of the longest edge of the ````SpriteMarker````.
21827
22074
  *
21828
22075
  * Returns {Number} World-space size of the ````SpriteMarker````.
@@ -22146,7 +22393,7 @@ this._occluded=!visible;this._mesh.visible=this._visible&&!this._occluded;_super
22146
22393
  * @param {Number[]} [cfg.v2=[0,0,0]] The middle control point.
22147
22394
  * @param {Number[]} [cfg.v3=[0,0,0]] The ending point.
22148
22395
  * @param {Number} [cfg.t=0] Current position on this CubicBezierCurve, in range between 0..1.
22149
- */function CubicBezierCurve(owner){var _this104;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,CubicBezierCurve);_this104=_callSuper(this,CubicBezierCurve,[owner,cfg]);_this104.v0=cfg.v0;_this104.v1=cfg.v1;_this104.v2=cfg.v2;_this104.v3=cfg.v3;_this104.t=cfg.t;return _this104;}/**
22396
+ */function CubicBezierCurve(owner){var _this105;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,CubicBezierCurve);_this105=_callSuper(this,CubicBezierCurve,[owner,cfg]);_this105.v0=cfg.v0;_this105.v1=cfg.v1;_this105.v2=cfg.v2;_this105.v3=cfg.v3;_this105.t=cfg.t;return _this105;}/**
22150
22397
  * Sets the starting point on this CubicBezierCurve.
22151
22398
  *
22152
22399
  * Default value is ````[0.0, 0.0, 0.0]````
@@ -22235,12 +22482,12 @@ this._occluded=!visible;this._mesh.visible=this._visible&&!this._occluded;_super
22235
22482
  * @param {String} [cfg.id] Optional ID, unique among all components in the parent {@link Scene}, generated automatically when omitted.
22236
22483
  * @param {String []} [cfg.paths=[]] IDs or instances of {{#crossLink "path"}}{{/crossLink}} subtypes to add to this Path.
22237
22484
  * @param {Number} [cfg.t=0] Current position on this Path, in range between 0..1.
22238
- */function Path(owner){var _this105;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,Path);_this105=_callSuper(this,Path,[owner,cfg]);_this105._cachedLengths=[];_this105._dirty=true;_this105._curves=[];// Array of child Curve components
22239
- _this105._t=0;_this105._dirtySubs=[];// Subscriptions to "dirty" events from child Curve components
22240
- _this105._destroyedSubs=[];// Subscriptions to "destroyed" events from child Curve components
22241
- _this105.curves=cfg.curves||[];// Add initial curves
22242
- _this105.t=cfg.t;// Set initial progress
22243
- return _this105;}/**
22485
+ */function Path(owner){var _this106;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,Path);_this106=_callSuper(this,Path,[owner,cfg]);_this106._cachedLengths=[];_this106._dirty=true;_this106._curves=[];// Array of child Curve components
22486
+ _this106._t=0;_this106._dirtySubs=[];// Subscriptions to "dirty" events from child Curve components
22487
+ _this106._destroyedSubs=[];// Subscriptions to "destroyed" events from child Curve components
22488
+ _this106.curves=cfg.curves||[];// Add initial curves
22489
+ _this106.t=cfg.t;// Set initial progress
22490
+ return _this106;}/**
22244
22491
  * Adds a {@link Curve} to this Path.
22245
22492
  *
22246
22493
  * @param {Curve} curve The {@link Curve} to add.
@@ -22305,7 +22552,7 @@ var id=curve;curve=this.scene.components[id];if(!curve){this.error("Component no
22305
22552
  * @param {Number[]} [cfg.v1=[0,0,0]] The middle control point.
22306
22553
  * @param {Number[]} [cfg.v2=[0,0,0]] The end point.
22307
22554
  * @param {Number[]} [cfg.t=0] Current position on this QuadraticBezierCurve, in range between ````0..1````.
22308
- */function QuadraticBezierCurve(owner){var _this106;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,QuadraticBezierCurve);_this106=_callSuper(this,QuadraticBezierCurve,[owner,cfg]);_this106.v0=cfg.v0;_this106.v1=cfg.v1;_this106.v2=cfg.v2;_this106.t=cfg.t;return _this106;}/**
22555
+ */function QuadraticBezierCurve(owner){var _this107;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,QuadraticBezierCurve);_this107=_callSuper(this,QuadraticBezierCurve,[owner,cfg]);_this107.v0=cfg.v0;_this107.v1=cfg.v1;_this107.v2=cfg.v2;_this107.t=cfg.t;return _this107;}/**
22309
22556
  * Sets the starting point on this QuadraticBezierCurve.
22310
22557
  *
22311
22558
  * Default value is ````[0.0, 0.0, 0.0]````.
@@ -22389,13 +22636,13 @@ var id=curve;curve=this.scene.components[id];if(!curve){this.error("Component no
22389
22636
  * @param {Boolean} [cfg.active=true] Indicates whether or not this SectionBox is active.
22390
22637
  * @param {Number[]} [cfg.pos=[0,0,0]] World-space position of the SectionBox.
22391
22638
  * @param {Number[]} [cfg.dir=[0,0,-1]] Vector perpendicular to the plane surface, indicating the SectionBox plane orientation.
22392
- */function SectionBox(owner){var _this107;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,SectionBox);_this107=_callSuper(this,SectionBox,[owner,cfg]);_this107._state=new RenderState({active:true,pos:math.vec3(),dir:math.vec3(),dist:0});_this107.active=cfg.active?cfg.active:true;_this107.pickable=cfg.pickable?cfg.pickable:false;_this107.enableClip=cfg.enableClip?cfg.enableClip:true;_this107.controlIdName=cfg.controlIdName?cfg.controlIdName:"";_this107.lineBox=cfg.lineBox?cfg.lineBox:null;_this107.visible=false;_this107.planes=[];_this107.boxRanges=[];_this107.scene._sectionBoxCreated(_this107);_this107._initBoxPlanes();return _this107;}_inherits(SectionBox,_Component37);return _createClass(SectionBox,[{key:"type",get:/**
22639
+ */function SectionBox(owner){var _this108;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,SectionBox);_this108=_callSuper(this,SectionBox,[owner,cfg]);_this108._state=new RenderState({active:true,pos:math.vec3(),dir:math.vec3(),dist:0});_this108.active=cfg.active?cfg.active:true;_this108.pickable=cfg.pickable?cfg.pickable:false;_this108.enableClip=cfg.enableClip?cfg.enableClip:true;_this108.controlIdName=cfg.controlIdName?cfg.controlIdName:"";_this108.lineBox=cfg.lineBox?cfg.lineBox:null;_this108.visible=false;_this108.planes=[];_this108.boxRanges=[];_this108.scene._sectionBoxCreated(_this108);_this108._initBoxPlanes();return _this108;}_inherits(SectionBox,_Component37);return _createClass(SectionBox,[{key:"type",get:/**
22393
22640
  @private
22394
- */function get(){return"SectionBox";}},{key:"_initBoxPlanes",value:function _initBoxPlanes(){var _this108=this;var self=this;var aabb=this.scene.aabb;var center=this.scene.center;var xRange=aabb[3]-aabb[0];//前后
22641
+ */function get(){return"SectionBox";}},{key:"_initBoxPlanes",value:function _initBoxPlanes(){var _this109=this;var self=this;var aabb=this.scene.aabb;var center=this.scene.center;var xRange=aabb[3]-aabb[0];//前后
22395
22642
  var yRange=aabb[4]-aabb[1];//上下
22396
22643
  var zRange=aabb[5]-aabb[2];//左右
22397
22644
  // let offset = 0.21;
22398
- var offset=0;function getPos(num){var rateDis;switch(num){case 0:rateDis=1*xRange+offset;return[center[0]-xRange/2+rateDis,center[1],center[2]];case 1:rateDis=1*yRange+offset;return[center[0],center[1]-yRange/2+rateDis,center[2]];case 2:rateDis=1*zRange+offset;return[center[0],center[1],center[2]-zRange/2+rateDis];case 3:rateDis=0*xRange-offset;return[center[0]-xRange/2+rateDis,center[1],center[2]];case 4:rateDis=0*yRange-offset;return[center[0],center[1]-yRange/2+rateDis,center[2]];case 5:rateDis=0*zRange-offset;return[center[0],center[1],center[2]-zRange/2+rateDis];}}function getDir(num){switch(num){case 0:return[-1,0,0];case 1:return[0,-1,0];case 2:return[0,0,-1];case 3:return[1,0,0];case 4:return[0,1,0];case 5:return[0,0,1];}}var _loop2=function _loop2(_i479){_this108.boxRanges.push(getPos(_i479));var dir=getDir(_i479);var sectionPlane=new SectionPlane(_this108.scene,{active:_this108.active,controlId:_this108.controlIdName+_i479.toString(),planeId:_i479,box:self,dir:dir,pos:getPos(_i479),enableClip:_this108.enableClip,pickable:_this108.pickable});_this108.planes.push(sectionPlane);if(_i479==5){_this108.lineBox._maxRange=_this108.boxRanges;}sectionPlane.on("pos",function(pos){if(pos==_this108.boxRanges[_i479])return;if(_this108.boxRanges.length<6)return;_this108.lineBox.updateBox(sectionPlane.dir,_this108.boxRanges);});};for(var _i479=0;_i479<6;_i479++){_loop2(_i479);}}/**
22645
+ var offset=0;function getPos(num){var rateDis;switch(num){case 0:rateDis=1*xRange+offset;return[center[0]-xRange/2+rateDis,center[1],center[2]];case 1:rateDis=1*yRange+offset;return[center[0],center[1]-yRange/2+rateDis,center[2]];case 2:rateDis=1*zRange+offset;return[center[0],center[1],center[2]-zRange/2+rateDis];case 3:rateDis=0*xRange-offset;return[center[0]-xRange/2+rateDis,center[1],center[2]];case 4:rateDis=0*yRange-offset;return[center[0],center[1]-yRange/2+rateDis,center[2]];case 5:rateDis=0*zRange-offset;return[center[0],center[1],center[2]-zRange/2+rateDis];}}function getDir(num){switch(num){case 0:return[-1,0,0];case 1:return[0,-1,0];case 2:return[0,0,-1];case 3:return[1,0,0];case 4:return[0,1,0];case 5:return[0,0,1];}}var _loop2=function _loop2(_i479){_this109.boxRanges.push(getPos(_i479));var dir=getDir(_i479);var sectionPlane=new SectionPlane(_this109.scene,{active:_this109.active,controlId:_this109.controlIdName+_i479.toString(),planeId:_i479,box:self,dir:dir,pos:getPos(_i479),enableClip:_this109.enableClip,pickable:_this109.pickable});_this109.planes.push(sectionPlane);if(_i479==5){_this109.lineBox._maxRange=_this109.boxRanges;}sectionPlane.on("pos",function(pos){if(pos==_this109.boxRanges[_i479])return;if(_this109.boxRanges.length<6)return;_this109.lineBox.updateBox(sectionPlane.dir,_this109.boxRanges);});};for(var _i479=0;_i479<6;_i479++){_loop2(_i479);}}/**
22399
22646
  * Sets if this SectionBox is active or not.
22400
22647
  *
22401
22648
  * Default value is ````true````.
@@ -22429,7 +22676,7 @@ var offset=0;function getPos(num){var rateDis;switch(num){case 0:rateDis=1*xRang
22429
22676
  * @param {String} [cfg.encoding="linear"] Texture encoding format. See the {@link Texture#encoding} property for more info.
22430
22677
  * @param {Number} [cfg.size=1000] Size of this Skybox, given as the distance from the center at ````[0,0,0]```` to each face.
22431
22678
  * @param {Boolean} [cfg.active=true] True when this Skybox is visible.
22432
- */function Skybox(owner){var _this109;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,Skybox);_this109=_callSuper(this,Skybox,[owner,cfg]);_this109._skyboxMesh=new Mesh(_this109,{geometry:new ReadableGeometry(_this109,{// Box-shaped geometry
22679
+ */function Skybox(owner){var _this110;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,Skybox);_this110=_callSuper(this,Skybox,[owner,cfg]);_this110._skyboxMesh=new Mesh(_this110,{geometry:new ReadableGeometry(_this110,{// Box-shaped geometry
22433
22680
  primitive:"triangles",positions:[1,1,1,-1,1,1,-1,-1,1,1,-1,1,// v0-v1-v2-v3 front
22434
22681
  1,1,1,1,-1,1,1,-1,-1,1,1,-1,// v0-v3-v4-v5 right
22435
22682
  1,1,1,1,1,-1,-1,1,-1,-1,1,1,// v0-v5-v6-v1 top
@@ -22437,10 +22684,10 @@ primitive:"triangles",positions:[1,1,1,-1,1,1,-1,-1,1,1,-1,1,// v0-v1-v2-v3 fron
22437
22684
  -1,-1,-1,1,-1,-1,1,-1,1,-1,-1,1,// v7-v4-v3-v2 bottom
22438
22685
  1,-1,-1,-1,-1,-1,-1,1,-1,1,1,-1// v4-v7-v6-v5 back
22439
22686
  ],uv:[0.5,0.6666,0.25,0.6666,0.25,0.3333,0.5,0.3333,0.5,0.6666,0.5,0.3333,0.75,0.3333,0.75,0.6666,0.5,0.6666,0.5,1,0.25,1,0.25,0.6666,0.25,0.6666,0.0,0.6666,0.0,0.3333,0.25,0.3333,0.25,0,0.5,0,0.5,0.3333,0.25,0.3333,0.75,0.3333,1.0,0.3333,1.0,0.6666,0.75,0.6666],indices:[0,1,2,0,2,3,4,5,6,4,6,7,8,9,10,8,10,11,12,13,14,12,14,15,16,17,18,16,18,19,20,21,22,20,22,23]}),background:true,scale:[2000,2000,2000],// Overridden when we initialize the 'size' property, below
22440
- rotation:[0,-90,0],material:new PhongMaterial(_this109,{ambient:[0,0,0],diffuse:[0,0,0],specular:[0,0,0],emissive:[1,1,1],emissiveMap:new Texture(_this109,{scale:cfg.scale,src:cfg.src,image:cfg.image,flipY:true,wrapS:1000,wrapT:1000,encoding:cfg.encoding||"sRGB"}),backfaces:true// Show interior faces of our skybox geometry
22687
+ rotation:[0,-90,0],material:new PhongMaterial(_this110,{ambient:[0,0,0],diffuse:[0,0,0],specular:[0,0,0],emissive:[1,1,1],emissiveMap:new Texture(_this110,{scale:cfg.scale,src:cfg.src,image:cfg.image,flipY:true,wrapS:1000,wrapT:1000,encoding:cfg.encoding||"sRGB"}),backfaces:true// Show interior faces of our skybox geometry
22441
22688
  }),// stationary: true,
22442
- visible:false,pickable:false,clippable:false,collidable:false});_this109.size=cfg.size;// Sets 'xyz' property on the Mesh's Scale transform
22443
- _this109.active=cfg.active;return _this109;}/**
22689
+ visible:false,pickable:false,clippable:false,collidable:false});_this110.size=cfg.size;// Sets 'xyz' property on the Mesh's Scale transform
22690
+ _this110.active=cfg.active;return _this110;}/**
22444
22691
  * Sets the size of this Skybox, given as the distance from the center at [0,0,0] to each face.
22445
22692
  *
22446
22693
  * Default value is ````1000````.
@@ -22505,10 +22752,10 @@ var eyeTargetVec=math.subVec3(optionalTargetWorldPos,camera.eye,tempVec3a$4);var
22505
22752
  var worldPos1=this._unproject(targetCanvasPos,tempVec4a$2);camera.ortho.scale=camera.ortho.scale-dollyDelta;camera.ortho._update();// HACK
22506
22753
  var worldPos2=this._unproject(targetCanvasPos,tempVec4b$2);var _offset=math.subVec3(worldPos2,worldPos1,tempVec4c$1);var eyeLookMoveVec=math.mulVec3Scalar(math.normalizeVec3(math.subVec3(camera.look,camera.eye,tempVec3a$4)),-dollyDelta,tempVec3b$3);var _moveVec=math.addVec3(_offset,eyeLookMoveVec,tempVec3c$2);camera.eye=[camera.eye[0]-_moveVec[0],camera.eye[1]-_moveVec[1],camera.eye[2]-_moveVec[2]];camera.look=[camera.look[0]-_moveVec[0],camera.look[1]-_moveVec[1],camera.look[2]-_moveVec[2]];}return dolliedThroughSurface;}},{key:"_unproject",value:function _unproject(canvasPos,worldPos){var camera=this._scene.camera;var transposedProjectMat=camera.project.transposedMatrix;var Pt3=transposedProjectMat.subarray(8,12);var Pt4=transposedProjectMat.subarray(12);var D=[0,0,-1.0,1];var screenZ=math.dotVec4(D,Pt3)/math.dotVec4(D,Pt4);camera.project.unproject(canvasPos,screenZ,screenPos,viewPos,worldPos);return worldPos;}},{key:"destroy",value:function destroy(){}}]);}();var tempVec3a$3=math.vec3();var tempVec3b$2=math.vec3();var tempVec3c$1=math.vec3();var tempVec4a$1=math.vec4();var tempVec4b$1=math.vec4();var tempVec4c=math.vec4();/** @private */var PivotController=/*#__PURE__*/function(){/**
22507
22754
  * @private
22508
- */function PivotController(scene,configs){var _this110=this;_classCallCheck(this,PivotController);// Pivot math by: http://www.derschmale.com/
22755
+ */function PivotController(scene,configs){var _this111=this;_classCallCheck(this,PivotController);// Pivot math by: http://www.derschmale.com/
22509
22756
  this._scene=scene;this._configs=configs;this._pivotWorldPos=math.vec3();this._cameraOffset=math.vec3();this._azimuth=0;this._polar=0;this._radius=0;this._pivotPosSet=false;// Initially false, true as soon as _pivotWorldPos has been set to some value
22510
22757
  this._pivoting=false;// True while pivoting
22511
- this._shown=false;this._pivotSphereEnabled=false;this._pivotSphere=null;this._pivotSphereSize=1;this._pivotSphereGeometry=null;this._pivotSphereMaterial=null;this._rtcCenter=math.vec3();this._rtcPos=math.vec3();this._pivotViewPos=math.vec4();this._pivotProjPos=math.vec4();this._pivotCanvasPos=math.vec2();this._cameraDirty=true;this._onViewMatrix=this._scene.camera.on("viewMatrix",function(){_this110._cameraDirty=true;});this._onProjMatrix=this._scene.camera.on("projMatrix",function(){_this110._cameraDirty=true;});this._onTick=this._scene.on("tick",function(){_this110.updatePivotElement();_this110.updatePivotSphere();});}return _createClass(PivotController,[{key:"createPivotSphere",value:function createPivotSphere(){var currentPos=this.getPivotPos();var cameraPos=math.vec3();math.decomposeMat4(math.inverseMat4(this._scene.viewer.camera.viewMatrix,math.mat4()),cameraPos,math.vec4(),math.vec3());var length=math.distVec3(cameraPos,currentPos);var radius=Math.tan(Math.PI/500)*length*this._pivotSphereSize;if(this._scene.camera.projection=="ortho"){radius/=this._scene.camera.ortho.scale/2;}worldToRTCPos(currentPos,this._rtcCenter,this._rtcPos);this._pivotSphereGeometry=new VBOGeometry(this._scene,buildSphereGeometry({radius:radius}));this._pivotSphere=new Mesh(this._scene,{geometry:this._pivotSphereGeometry,material:this._pivotSphereMaterial,pickable:false,position:this._rtcPos,rtcCenter:this._rtcCenter});}},{key:"destroyPivotSphere",value:function destroyPivotSphere(){if(this._pivotSphere){this._pivotSphere.destroy();this._pivotSphere=null;}if(this._pivotSphereGeometry){this._pivotSphereGeometry.destroy();this._pivotSphereGeometry=null;}}},{key:"getPointScreenPos",value:function getPointScreenPos(pos){var camera=this._scene.camera;var canvas=this._scene.canvas;var canvasAABB=canvas.boundary;var canvasWidth=canvasAABB[2];var canvasHeight=canvasAABB[3];var pos11=math.vec4();var pos22=math.vec4();var screenPos=math.vec2();math.transformPoint3(camera.viewMatrix,pos,pos11);math.transformPoint4(camera.projMatrix,pos,pos22);screenPos[0]=Math.floor((1+pos22[0]/pos22[3])*canvasWidth/2);screenPos[1]=Math.floor((1-pos22[1]/pos22[3])*canvasHeight/2);return screenPos;}},{key:"updatePivotElement",value:function updatePivotElement(){var camera=this._scene.camera;var canvas=this._scene.canvas;if(this._pivoting&&this._cameraDirty){math.transformPoint3(camera.viewMatrix,this.getPivotPos(),this._pivotViewPos);this._pivotViewPos[3]=1;math.transformPoint4(camera.projMatrix,this._pivotViewPos,this._pivotProjPos);var canvasAABB=canvas.boundary;var canvasWidth=canvasAABB[2];var canvasHeight=canvasAABB[3];this._pivotCanvasPos[0]=Math.floor((1+this._pivotProjPos[0]/this._pivotProjPos[3])*canvasWidth/2);this._pivotCanvasPos[1]=Math.floor((1-this._pivotProjPos[1]/this._pivotProjPos[3])*canvasHeight/2);// data-textures: avoid to do continuous DOM layout calculations
22758
+ this._shown=false;this._pivotSphereEnabled=false;this._pivotSphere=null;this._pivotSphereSize=1;this._pivotSphereGeometry=null;this._pivotSphereMaterial=null;this._rtcCenter=math.vec3();this._rtcPos=math.vec3();this._pivotViewPos=math.vec4();this._pivotProjPos=math.vec4();this._pivotCanvasPos=math.vec2();this._cameraDirty=true;this._onViewMatrix=this._scene.camera.on("viewMatrix",function(){_this111._cameraDirty=true;});this._onProjMatrix=this._scene.camera.on("projMatrix",function(){_this111._cameraDirty=true;});this._onTick=this._scene.on("tick",function(){_this111.updatePivotElement();_this111.updatePivotSphere();});}return _createClass(PivotController,[{key:"createPivotSphere",value:function createPivotSphere(){var currentPos=this.getPivotPos();var cameraPos=math.vec3();math.decomposeMat4(math.inverseMat4(this._scene.viewer.camera.viewMatrix,math.mat4()),cameraPos,math.vec4(),math.vec3());var length=math.distVec3(cameraPos,currentPos);var radius=Math.tan(Math.PI/500)*length*this._pivotSphereSize;if(this._scene.camera.projection=="ortho"){radius/=this._scene.camera.ortho.scale/2;}worldToRTCPos(currentPos,this._rtcCenter,this._rtcPos);this._pivotSphereGeometry=new VBOGeometry(this._scene,buildSphereGeometry({radius:radius}));this._pivotSphere=new Mesh(this._scene,{geometry:this._pivotSphereGeometry,material:this._pivotSphereMaterial,pickable:false,position:this._rtcPos,rtcCenter:this._rtcCenter});}},{key:"destroyPivotSphere",value:function destroyPivotSphere(){if(this._pivotSphere){this._pivotSphere.destroy();this._pivotSphere=null;}if(this._pivotSphereGeometry){this._pivotSphereGeometry.destroy();this._pivotSphereGeometry=null;}}},{key:"getPointScreenPos",value:function getPointScreenPos(pos){var camera=this._scene.camera;var canvas=this._scene.canvas;var canvasAABB=canvas.boundary;var canvasWidth=canvasAABB[2];var canvasHeight=canvasAABB[3];var pos11=math.vec4();var pos22=math.vec4();var screenPos=math.vec2();math.transformPoint3(camera.viewMatrix,pos,pos11);math.transformPoint4(camera.projMatrix,pos,pos22);screenPos[0]=Math.floor((1+pos22[0]/pos22[3])*canvasWidth/2);screenPos[1]=Math.floor((1-pos22[1]/pos22[3])*canvasHeight/2);return screenPos;}},{key:"updatePivotElement",value:function updatePivotElement(){var camera=this._scene.camera;var canvas=this._scene.canvas;if(this._pivoting&&this._cameraDirty){math.transformPoint3(camera.viewMatrix,this.getPivotPos(),this._pivotViewPos);this._pivotViewPos[3]=1;math.transformPoint4(camera.projMatrix,this._pivotViewPos,this._pivotProjPos);var canvasAABB=canvas.boundary;var canvasWidth=canvasAABB[2];var canvasHeight=canvasAABB[3];this._pivotCanvasPos[0]=Math.floor((1+this._pivotProjPos[0]/this._pivotProjPos[3])*canvasWidth/2);this._pivotCanvasPos[1]=Math.floor((1-this._pivotProjPos[1]/this._pivotProjPos[3])*canvasHeight/2);// data-textures: avoid to do continuous DOM layout calculations
22512
22759
  var canvasBoundingRect=canvas._lastBoundingClientRect;var canvasElem=canvas.canvas;canvasBoundingRect=canvas._lastBoundingClientRect=canvasElem.getBoundingClientRect();if(this._pivotElement){this._pivotElement.style.left=Math.floor(canvasBoundingRect.left+this._pivotCanvasPos[0])-this._pivotElement.clientWidth/2+window.scrollX;this._pivotElement.style.top=Math.floor(canvasBoundingRect.top+this._pivotCanvasPos[1])-this._pivotElement.clientHeight/2+window.scrollY;}this._cameraDirty=false;}}},{key:"updatePivotSphere",value:function updatePivotSphere(){if(this._pivoting&&this._pivotSphere){worldToRTCPos(this.getPivotPos(),this._rtcCenter,this._rtcPos);if(!math.compareVec3(this._rtcPos,this._pivotSphere.position)){this.destroyPivotSphere();this.createPivotSphere();}}}/**
22513
22760
  * Sets the HTML DOM element that will represent the pivot position.
22514
22761
  *
@@ -22609,41 +22856,41 @@ pagePos:[Math.round(e.pageX),Math.round(e.pageY)],canvasPos:canvasPos,event:e},t
22609
22856
  */var KeyboardAxisViewHandler=/*#__PURE__*/function(){function KeyboardAxisViewHandler(scene,controllers,configs,states){_classCallCheck(this,KeyboardAxisViewHandler);this._scene=scene;this.input=scene.input;var cameraControl=controllers.cameraControl;var camera=scene.camera;this._onSceneKeyDown=scene.input.on("keydown",function(){if(!(configs.active&&configs.pointerEnabled)||!scene.input.keyboardEnabled){return;}if(!states.mouseover){return;}var axisViewRight=cameraControl._isKeyDownForAction(cameraControl.AXIS_VIEW_RIGHT);var axisViewBack=cameraControl._isKeyDownForAction(cameraControl.AXIS_VIEW_BACK);var axisViewLeft=cameraControl._isKeyDownForAction(cameraControl.AXIS_VIEW_LEFT);var axisViewFront=cameraControl._isKeyDownForAction(cameraControl.AXIS_VIEW_FRONT);var axisViewTop=cameraControl._isKeyDownForAction(cameraControl.AXIS_VIEW_TOP);var axisViewBottom=cameraControl._isKeyDownForAction(cameraControl.AXIS_VIEW_BOTTOM);if(!axisViewRight&&!axisViewBack&&!axisViewLeft&&!axisViewFront&&!axisViewTop&&!axisViewBottom){return;}var aabb=scene.aabb;var diag=math.getAABB3Diag(aabb);math.getAABB3Center(aabb,center);var perspectiveDist=Math.abs(diag/Math.tan(controllers.cameraFlight.fitFOV*math.DEGTORAD));var orthoScale=diag*1.1;tempCameraTarget.orthoScale=orthoScale;// 点击键盘切换相机方向
22610
22857
  if(axisViewRight){tempCameraTarget.eye.set(math.addVec3(center,math.mulVec3Scalar(camera.worldRight,perspectiveDist,tempVec3a$2),tempVec3d));tempCameraTarget.look.set(center);tempCameraTarget.up.set(camera.worldUp);}else if(axisViewBack){tempCameraTarget.eye.set(math.addVec3(center,math.mulVec3Scalar(camera.worldForward,perspectiveDist,tempVec3a$2),tempVec3d));tempCameraTarget.look.set(center);tempCameraTarget.up.set(camera.worldUp);}else if(axisViewLeft){tempCameraTarget.eye.set(math.addVec3(center,math.mulVec3Scalar(camera.worldRight,-perspectiveDist,tempVec3a$2),tempVec3d));tempCameraTarget.look.set(center);tempCameraTarget.up.set(camera.worldUp);}else if(axisViewFront){tempCameraTarget.eye.set(math.addVec3(center,math.mulVec3Scalar(camera.worldForward,-perspectiveDist,tempVec3a$2),tempVec3d));tempCameraTarget.look.set(center);tempCameraTarget.up.set(camera.worldUp);}else if(axisViewTop){tempCameraTarget.eye.set(math.addVec3(center,math.mulVec3Scalar(camera.worldUp,perspectiveDist,tempVec3a$2),tempVec3d));tempCameraTarget.look.set(center);tempCameraTarget.up.set(math.normalizeVec3(math.mulVec3Scalar(camera.worldForward,1,tempVec3b$1),tempVec3c));}else if(axisViewBottom){tempCameraTarget.eye.set(math.addVec3(center,math.mulVec3Scalar(camera.worldUp,-perspectiveDist,tempVec3a$2),tempVec3d));tempCameraTarget.look.set(center);tempCameraTarget.up.set(math.normalizeVec3(math.mulVec3Scalar(camera.worldForward,-1,tempVec3b$1)));}if(!configs.firstPerson&&configs.followPointer){controllers.pivotController.setPivotPos(center);}if(controllers.cameraFlight.duration>0){controllers.cameraFlight.flyTo(tempCameraTarget,function(){if(controllers.pivotController.getPivoting()&&configs.followPointer){controllers.pivotController.showPivot();}});}else{controllers.cameraFlight.jumpTo(tempCameraTarget);if(controllers.pivotController.getPivoting()&&configs.followPointer){controllers.pivotController.showPivot();}}});}return _createClass(KeyboardAxisViewHandler,[{key:"reset",value:function reset(){}},{key:"destroy",value:function destroy(){this.input.off(this._onSceneKeyDown);}}]);}();/**
22611
22858
  * @private
22612
- */var MousePickHandler=/*#__PURE__*/function(){function MousePickHandler(scene,controllers,configs,states,updates){var _this111=this;_classCallCheck(this,MousePickHandler);this._scene=scene;var pickController=controllers.pickController;var pivotController=controllers.pivotController;var cameraControl=controllers.cameraControl;this._clicks=0;this._timeout=null;this._lastPickedEntityId=null;this._lastClickedWorldPos=null;var leftDown=false;var rightDown=false;this.canvas=this._scene.canvas.canvas;var flyCameraTo=function flyCameraTo(pickResult){var pos;if(pickResult&&pickResult.worldPos){pos=pickResult.worldPos;}var aabb=pickResult&&pickResult.entity?pickResult.entity.aabb:scene.aabb;if(pos){// Fly to look at point, don't change eye->look dist
22859
+ */var MousePickHandler=/*#__PURE__*/function(){function MousePickHandler(scene,controllers,configs,states,updates){var _this112=this;_classCallCheck(this,MousePickHandler);this._scene=scene;var pickController=controllers.pickController;var pivotController=controllers.pivotController;var cameraControl=controllers.cameraControl;this._clicks=0;this._timeout=null;this._lastPickedEntityId=null;this._lastClickedWorldPos=null;var leftDown=false;var rightDown=false;this.canvas=this._scene.canvas.canvas;var flyCameraTo=function flyCameraTo(pickResult){var pos;if(pickResult&&pickResult.worldPos){pos=pickResult.worldPos;}var aabb=pickResult&&pickResult.entity?pickResult.entity.aabb:scene.aabb;if(pos){// Fly to look at point, don't change eye->look dist
22613
22860
  var camera=scene.camera;math.subVec3(camera.eye,camera.look,[]);controllers.cameraFlight.flyTo({// look: pos,
22614
22861
  // eye: xeokit.math.addVec3(pos, diff, []),
22615
22862
  // up: camera.up,
22616
22863
  aabb:aabb});// TODO: Option to back off to fit AABB in view
22617
22864
  }else{// Fly to fit target boundary in view
22618
- controllers.cameraFlight.flyTo({aabb:aabb});}};var tickifiedMouseMoveFn=scene.tickify(this._canvasMouseMoveHandler=function(e){if(!(configs.active&&configs.pointerEnabled)){return;}if(leftDown||rightDown){return;}if(cameraControl.hasSubs("rayMove")){var origin=math.vec3();var _direction2=math.vec3();math.canvasPosToWorldRay(scene.canvas.canvas,scene.camera.viewMatrix,scene.camera.projMatrix,scene.camera.projection,states.pointerCanvasPos,origin,_direction2);cameraControl.fire("rayMove",{canvasPos:states.pointerCanvasPos,ray:{origin:origin,direction:_direction2,canvasPos:states.pointerCanvasPos}},true);}var hoverSubs=cameraControl.hasSubs("hover");var hoverEnterSubs=cameraControl.hasSubs("hoverEnter");var hoverOutSubs=cameraControl.hasSubs("hoverOut");var hoverOffSubs=cameraControl.hasSubs("hoverOff");var hoverSurfaceSubs=cameraControl.hasSubs("hoverSurface");var hoverSnapOrSurfaceSubs=cameraControl.hasSubs("hoverSnapOrSurface");if(hoverSubs||hoverEnterSubs||hoverOutSubs||hoverOffSubs||hoverSurfaceSubs||hoverSnapOrSurfaceSubs){pickController.pickCursorPos=states.pointerCanvasPos;pickController.schedulePickEntity=true;pickController.schedulePickSurface=hoverSurfaceSubs;pickController.scheduleSnapOrPick=hoverSnapOrSurfaceSubs;pickController.update();if(pickController.pickResult){if(pickController.pickResult.entity){var pickedEntityId=pickController.pickResult.entity.id;if(_this111._lastPickedEntityId!==pickedEntityId){if(_this111._lastPickedEntityId!==undefined){cameraControl.fire("hoverOut",{// Hovered off an entity
22619
- entity:scene.objects[_this111._lastPickedEntityId]},true);}cameraControl.fire("hoverEnter",pickController.pickResult,true);// Hovering over a new entity
22620
- _this111._lastPickedEntityId=pickedEntityId;}}cameraControl.fire("hover",pickController.pickResult,true);if(pickController.pickResult.worldPos||pickController.pickResult.snappedWorldPos){// Hovering the surface of an entity
22621
- cameraControl.fire("hoverSurface",pickController.pickResult,true);}}else{if(_this111._lastPickedEntityId!==undefined){cameraControl.fire("hoverOut",{// Hovered off an entity
22622
- entity:scene.objects[_this111._lastPickedEntityId]},true);_this111._lastPickedEntityId=undefined;}cameraControl.fire("hoverOff",{// Not hovering on any entity
22865
+ controllers.cameraFlight.flyTo({aabb:aabb});}};var tickifiedMouseMoveFn=scene.tickify(this._canvasMouseMoveHandler=function(e){if(!(configs.active&&configs.pointerEnabled)){return;}if(leftDown||rightDown){return;}if(cameraControl.hasSubs("rayMove")){var origin=math.vec3();var _direction2=math.vec3();math.canvasPosToWorldRay(scene.canvas.canvas,scene.camera.viewMatrix,scene.camera.projMatrix,scene.camera.projection,states.pointerCanvasPos,origin,_direction2);cameraControl.fire("rayMove",{canvasPos:states.pointerCanvasPos,ray:{origin:origin,direction:_direction2,canvasPos:states.pointerCanvasPos}},true);}var hoverSubs=cameraControl.hasSubs("hover");var hoverEnterSubs=cameraControl.hasSubs("hoverEnter");var hoverOutSubs=cameraControl.hasSubs("hoverOut");var hoverOffSubs=cameraControl.hasSubs("hoverOff");var hoverSurfaceSubs=cameraControl.hasSubs("hoverSurface");var hoverSnapOrSurfaceSubs=cameraControl.hasSubs("hoverSnapOrSurface");if(hoverSubs||hoverEnterSubs||hoverOutSubs||hoverOffSubs||hoverSurfaceSubs||hoverSnapOrSurfaceSubs){pickController.pickCursorPos=states.pointerCanvasPos;pickController.schedulePickEntity=true;pickController.schedulePickSurface=hoverSurfaceSubs;pickController.scheduleSnapOrPick=hoverSnapOrSurfaceSubs;pickController.update();if(pickController.pickResult){if(pickController.pickResult.entity){var pickedEntityId=pickController.pickResult.entity.id;if(_this112._lastPickedEntityId!==pickedEntityId){if(_this112._lastPickedEntityId!==undefined){cameraControl.fire("hoverOut",{// Hovered off an entity
22866
+ entity:scene.objects[_this112._lastPickedEntityId]},true);}cameraControl.fire("hoverEnter",pickController.pickResult,true);// Hovering over a new entity
22867
+ _this112._lastPickedEntityId=pickedEntityId;}}cameraControl.fire("hover",pickController.pickResult,true);if(pickController.pickResult.worldPos||pickController.pickResult.snappedWorldPos){// Hovering the surface of an entity
22868
+ cameraControl.fire("hoverSurface",pickController.pickResult,true);}}else{if(_this112._lastPickedEntityId!==undefined){cameraControl.fire("hoverOut",{// Hovered off an entity
22869
+ entity:scene.objects[_this112._lastPickedEntityId]},true);_this112._lastPickedEntityId=undefined;}cameraControl.fire("hoverOff",{// Not hovering on any entity
22623
22870
  canvasPos:pickController.pickCursorPos},true);}}});this.canvas.addEventListener("mousemove",tickifiedMouseMoveFn);this.canvas.addEventListener("dblclick",this._canvasDblClickHandler=function(e){states.mouseDownClientX=e.clientX;states.mouseDownClientY=e.clientY;states.mouseDownCursorX=states.pointerCanvasPos[0];states.mouseDownCursorY=states.pointerCanvasPos[1];if(configs.followPointer){// if (!configs.firstPerson && configs.followPointer) {
22624
22871
  pickController.pickCursorPos=states.pointerCanvasPos;pickController.schedulePickSurface=true;pickController.update();}var pickResult=pickController.pickResult;if(pickResult){cameraControl.fire("doublePicked",pickController.pickResult,true);if(pickController.pickedSurface){cameraControl.fire("doublePickedSurface",pickController.pickResult,true);}}else{cameraControl.fire("doublePickedNothing",{canvasPos:states.pointerCanvasPos},true);}});this.canvas.addEventListener("mousedown",this._canvasMouseDownHandler=function(e){if(e.which===1){leftDown=true;}if(e.which===3){rightDown=true;}var leftButtonDown=e.which===1;if(!leftButtonDown){return;}if(!(configs.active&&configs.pointerEnabled)){return;}// Left mouse button down to start pivoting
22625
22872
  states.mouseDownClientX=e.clientX;states.mouseDownClientY=e.clientY;states.mouseDownCursorX=states.pointerCanvasPos[0];states.mouseDownCursorY=states.pointerCanvasPos[1];if(!configs.firstPerson&&configs.followPointer){// if (!configs.firstPerson && configs.followPointer) {
22626
22873
  pickController.pickCursorPos=states.pointerCanvasPos;pickController.schedulePickSurface=true;pickController.update();if(e.which===1){// Left button
22627
22874
  var pickResult=pickController.pickResult;if(pickResult&&pickResult.worldPos){pivotController.setCanvasPivotPos(states.pointerCanvasPos);// pivotController.startPivot(); // 显示pivot
22628
- cameraControl.fire("mouseDownEntity",pickController.pickResult,true);_this111._lastClickedWorldPos=pickResult.worldPos;}else{if(configs.smartPivot){pivotController.setCanvasPivotPos(states.pointerCanvasPos);}else{if(_this111._lastClickedWorldPos){pivotController.setPivotPos(_this111._lastClickedWorldPos);}else{pivotController.setPivotPos(scene.camera.look);}}pivotController.startPivot();cameraControl.fire("mouseDownNothing",pickController.pickResult,true);}}}});document.addEventListener("mouseup",this._documentMouseUpHandler=function(e){if(e.which===1){leftDown=false;}if(e.which===3){rightDown=false;}if(pivotController.getPivoting()){pivotController.endPivot();}});this.canvas.addEventListener("mouseup",this._canvasMouseUpHandler=function(e){if(!(configs.active&&configs.pointerEnabled)){return;}var leftButtonUp=e.which===1;if(!leftButtonUp){return;}// Left mouse button up to possibly pick or double-pick
22875
+ cameraControl.fire("mouseDownEntity",pickController.pickResult,true);_this112._lastClickedWorldPos=pickResult.worldPos;}else{if(configs.smartPivot){pivotController.setCanvasPivotPos(states.pointerCanvasPos);}else{if(_this112._lastClickedWorldPos){pivotController.setPivotPos(_this112._lastClickedWorldPos);}else{pivotController.setPivotPos(scene.camera.look);}}pivotController.startPivot();cameraControl.fire("mouseDownNothing",pickController.pickResult,true);}}}});document.addEventListener("mouseup",this._documentMouseUpHandler=function(e){if(e.which===1){leftDown=false;}if(e.which===3){rightDown=false;}if(pivotController.getPivoting()){pivotController.endPivot();}});this.canvas.addEventListener("mouseup",this._canvasMouseUpHandler=function(e){if(!(configs.active&&configs.pointerEnabled)){return;}var leftButtonUp=e.which===1;if(!leftButtonUp){return;}// Left mouse button up to possibly pick or double-pick
22629
22876
  pivotController.hidePivot();if(Math.abs(e.clientX-states.mouseDownClientX)>3||Math.abs(e.clientY-states.mouseDownClientY)>3){return;}var pickedSubs=cameraControl.hasSubs("picked");var pickedNothingSubs=cameraControl.hasSubs("pickedNothing");var pickedSurfaceSubs=cameraControl.hasSubs("pickedSurface");var doublePickedSubs=cameraControl.hasSubs("doublePicked");var doublePickedSurfaceSubs=cameraControl.hasSubs("doublePickedSurface");var doublePickedNothingSubs=cameraControl.hasSubs("doublePickedNothing");if(!configs.doublePickFlyTo&&!doublePickedSubs&&!doublePickedSurfaceSubs&&!doublePickedNothingSubs){// Avoid the single/double click differentiation timeout
22630
- if(pickedSubs||pickedNothingSubs||pickedSurfaceSubs){pickController.pickCursorPos=states.pointerCanvasPos;pickController.schedulePickEntity=true;pickController.schedulePickSurface=pickedSurfaceSubs;pickController.update();if(pickController.pickResult){cameraControl.fire("picked",pickController.pickResult,true);if(pickController.pickedSurface){cameraControl.fire("pickedSurface",pickController.pickResult,true);}}else{cameraControl.fire("pickedNothing",{canvasPos:states.pointerCanvasPos},true);}}_this111._clicks=0;// clickedEntity = null;
22631
- return;}_this111._clicks++;if(_this111._clicks===1){// First click
22632
- pickController.pickCursorPos=states.pointerCanvasPos;pickController.schedulePickEntity=configs.doublePickFlyTo;pickController.schedulePickSurface=pickedSurfaceSubs;pickController.update();var firstClickPickResult=pickController.pickResult;var firstClickPickSurface=pickController.pickedSurface;_this111._timeout=setTimeout(function(){if(firstClickPickResult&&firstClickPickResult.worldPos){cameraControl.fire("picked",firstClickPickResult,true);if(firstClickPickSurface){cameraControl.fire("pickedSurface",firstClickPickResult,true);// if (configs.followPointer) {
22633
- if(!configs.firstPerson&&configs.followPointer){controllers.pivotController.setPivotPos(firstClickPickResult.worldPos);if(controllers.pivotController.startPivot()){controllers.pivotController.showPivot();}}}}else{cameraControl.fire("pickedNothing",{canvasPos:states.pointerCanvasPos},true);}_this111._clicks=0;},configs.doubleClickTimeFrame);}else{// Second click
22634
- if(_this111._timeout!==null){window.clearTimeout(_this111._timeout);_this111._timeout=null;}pickController.pickCursorPos=states.pointerCanvasPos;pickController.schedulePickEntity=configs.doublePickFlyTo||doublePickedSubs||doublePickedSurfaceSubs;pickController.schedulePickSurface=pickController.schedulePickEntity&&doublePickedSurfaceSubs;pickController.update();if(pickController.pickResult){cameraControl.fire("doublePicked",pickController.pickResult,true);if(pickController.pickedSurface){cameraControl.fire("doublePickedSurface",pickController.pickResult,true);}if(configs.doublePickFlyTo){flyCameraTo(pickController.pickResult);if(!configs.firstPerson&&configs.followPointer){var pickedEntityAABB=pickController.pickResult.entity.aabb;var pickedEntityCenterPos=math.getAABB3Center(pickedEntityAABB);controllers.pivotController.setPivotPos(pickedEntityCenterPos);if(controllers.pivotController.startPivot()){controllers.pivotController.showPivot();}}}}else{cameraControl.fire("doublePickedNothing",{canvasPos:states.pointerCanvasPos},true);if(configs.doublePickFlyTo){flyCameraTo();if(!configs.firstPerson&&configs.followPointer){var sceneAABB=scene.aabb;var sceneCenterPos=math.getAABB3Center(sceneAABB);controllers.pivotController.setPivotPos(sceneCenterPos);if(controllers.pivotController.startPivot()){controllers.pivotController.showPivot();}}}}_this111._clicks=0;}},false);}return _createClass(MousePickHandler,[{key:"reset",value:function reset(){this._clicks=0;this._lastPickedEntityId=null;if(this._timeout){window.clearTimeout(this._timeout);this._timeout=null;}}},{key:"destroy",value:function destroy(){if(this.canvas!=null){this.canvas.removeEventListener("mousemove",this._canvasMouseMoveHandler);this.canvas.removeEventListener("mousedown",this._canvasMouseDownHandler);this.canvas.removeEventListener("dblclick",this._canvasDblClickHandler);this.canvas.removeEventListener("mouseup",this._canvasMouseUpHandler);}document.removeEventListener("mouseup",this._documentMouseUpHandler);if(this._timeout){window.clearTimeout(this._timeout);this._timeout=null;}}}]);}();/**
22877
+ if(pickedSubs||pickedNothingSubs||pickedSurfaceSubs){pickController.pickCursorPos=states.pointerCanvasPos;pickController.schedulePickEntity=true;pickController.schedulePickSurface=pickedSurfaceSubs;pickController.update();if(pickController.pickResult){cameraControl.fire("picked",pickController.pickResult,true);if(pickController.pickedSurface){cameraControl.fire("pickedSurface",pickController.pickResult,true);}}else{cameraControl.fire("pickedNothing",{canvasPos:states.pointerCanvasPos},true);}}_this112._clicks=0;// clickedEntity = null;
22878
+ return;}_this112._clicks++;if(_this112._clicks===1){// First click
22879
+ pickController.pickCursorPos=states.pointerCanvasPos;pickController.schedulePickEntity=configs.doublePickFlyTo;pickController.schedulePickSurface=pickedSurfaceSubs;pickController.update();var firstClickPickResult=pickController.pickResult;var firstClickPickSurface=pickController.pickedSurface;_this112._timeout=setTimeout(function(){if(firstClickPickResult&&firstClickPickResult.worldPos){cameraControl.fire("picked",firstClickPickResult,true);if(firstClickPickSurface){cameraControl.fire("pickedSurface",firstClickPickResult,true);// if (configs.followPointer) {
22880
+ if(!configs.firstPerson&&configs.followPointer){controllers.pivotController.setPivotPos(firstClickPickResult.worldPos);if(controllers.pivotController.startPivot()){controllers.pivotController.showPivot();}}}}else{cameraControl.fire("pickedNothing",{canvasPos:states.pointerCanvasPos},true);}_this112._clicks=0;},configs.doubleClickTimeFrame);}else{// Second click
22881
+ if(_this112._timeout!==null){window.clearTimeout(_this112._timeout);_this112._timeout=null;}pickController.pickCursorPos=states.pointerCanvasPos;pickController.schedulePickEntity=configs.doublePickFlyTo||doublePickedSubs||doublePickedSurfaceSubs;pickController.schedulePickSurface=pickController.schedulePickEntity&&doublePickedSurfaceSubs;pickController.update();if(pickController.pickResult){cameraControl.fire("doublePicked",pickController.pickResult,true);if(pickController.pickedSurface){cameraControl.fire("doublePickedSurface",pickController.pickResult,true);}if(configs.doublePickFlyTo){flyCameraTo(pickController.pickResult);if(!configs.firstPerson&&configs.followPointer){var pickedEntityAABB=pickController.pickResult.entity.aabb;var pickedEntityCenterPos=math.getAABB3Center(pickedEntityAABB);controllers.pivotController.setPivotPos(pickedEntityCenterPos);if(controllers.pivotController.startPivot()){controllers.pivotController.showPivot();}}}}else{cameraControl.fire("doublePickedNothing",{canvasPos:states.pointerCanvasPos},true);if(configs.doublePickFlyTo){flyCameraTo();if(!configs.firstPerson&&configs.followPointer){var sceneAABB=scene.aabb;var sceneCenterPos=math.getAABB3Center(sceneAABB);controllers.pivotController.setPivotPos(sceneCenterPos);if(controllers.pivotController.startPivot()){controllers.pivotController.showPivot();}}}}_this112._clicks=0;}},false);}return _createClass(MousePickHandler,[{key:"reset",value:function reset(){this._clicks=0;this._lastPickedEntityId=null;if(this._timeout){window.clearTimeout(this._timeout);this._timeout=null;}}},{key:"destroy",value:function destroy(){if(this.canvas!=null){this.canvas.removeEventListener("mousemove",this._canvasMouseMoveHandler);this.canvas.removeEventListener("mousedown",this._canvasMouseDownHandler);this.canvas.removeEventListener("dblclick",this._canvasDblClickHandler);this.canvas.removeEventListener("mouseup",this._canvasMouseUpHandler);}document.removeEventListener("mouseup",this._documentMouseUpHandler);if(this._timeout){window.clearTimeout(this._timeout);this._timeout=null;}}}]);}();/**
22635
22882
  * @private
22636
- */var KeyboardPanRotateDollyHandler=/*#__PURE__*/function(){function KeyboardPanRotateDollyHandler(scene,controllers,configs,states,updates,cameraControl){var _this112=this;_classCallCheck(this,KeyboardPanRotateDollyHandler);this._scene=scene;this._updates=updates;this._cameraControl=cameraControl;var input=scene.input;this.input=input;var keyDownMap=[];this._movespeed=6;this._movespeedList=[0.02,0.05,0.1,0.2,0.3,0.5,1.0,1.5,2.0,2.5,3.0,3.5,4.0,8.0,10.0,12.0,16.0,24.0,32.0];var canvas=scene.canvas.canvas;var enableSetSpeedUp=false;var enableSetSpeedDown=false;var mouseMovedSinceLastKeyboardDolly=true;this._onSceneMouseMove=input.on("mousemove",function(){mouseMovedSinceLastKeyboardDolly=true;});this._onSceneKeyDown=input.on("keydown",function(keyCode){if(!(configs.active&&configs.pointerEnabled)||!scene.input.keyboardEnabled){return;}if(!states.mouseover){return;}keyDownMap[keyCode]=true;if(keyCode===input.KEY_SHIFT){canvas.style.cursor="move";}if(keyCode===input.KEY_EQUAL_SIGN){if(!enableSetSpeedUp){enableSetSpeedUp=true;}}if(keyCode===input.KEY_DASH){if(!enableSetSpeedDown){enableSetSpeedDown=true;}}});this._onSceneKeyUp=input.on("keyup",function(keyCode){if(!(configs.active&&configs.pointerEnabled)||!scene.input.keyboardEnabled){return;}keyDownMap[keyCode]=false;if(keyCode===input.KEY_SHIFT){canvas.style.cursor=null;}if(controllers.pivotController.getPivoting()){controllers.pivotController.endPivot();}if(keyCode===input.KEY_ADD){enableSetSpeedUp=false;}if(keyCode===input.KEY_SUBTRACT){enableSetSpeedDown=false;}});//碰撞停止
22883
+ */var KeyboardPanRotateDollyHandler=/*#__PURE__*/function(){function KeyboardPanRotateDollyHandler(scene,controllers,configs,states,updates,cameraControl){var _this113=this;_classCallCheck(this,KeyboardPanRotateDollyHandler);this._scene=scene;this._updates=updates;this._cameraControl=cameraControl;var input=scene.input;this.input=input;var keyDownMap=[];this._movespeed=6;this._movespeedList=[0.02,0.05,0.1,0.2,0.3,0.5,1.0,1.5,2.0,2.5,3.0,3.5,4.0,8.0,10.0,12.0,16.0,24.0,32.0];var canvas=scene.canvas.canvas;var enableSetSpeedUp=false;var enableSetSpeedDown=false;var mouseMovedSinceLastKeyboardDolly=true;this._onSceneMouseMove=input.on("mousemove",function(){mouseMovedSinceLastKeyboardDolly=true;});this._onSceneKeyDown=input.on("keydown",function(keyCode){if(!(configs.active&&configs.pointerEnabled)||!scene.input.keyboardEnabled){return;}if(!states.mouseover){return;}keyDownMap[keyCode]=true;if(keyCode===input.KEY_SHIFT){canvas.style.cursor="move";}if(keyCode===input.KEY_EQUAL_SIGN){if(!enableSetSpeedUp){enableSetSpeedUp=true;}}if(keyCode===input.KEY_DASH){if(!enableSetSpeedDown){enableSetSpeedDown=true;}}});this._onSceneKeyUp=input.on("keyup",function(keyCode){if(!(configs.active&&configs.pointerEnabled)||!scene.input.keyboardEnabled){return;}keyDownMap[keyCode]=false;if(keyCode===input.KEY_SHIFT){canvas.style.cursor=null;}if(controllers.pivotController.getPivoting()){controllers.pivotController.endPivot();}if(keyCode===input.KEY_ADD){enableSetSpeedUp=false;}if(keyCode===input.KEY_SUBTRACT){enableSetSpeedDown=false;}});//碰撞停止
22637
22884
  var enableForward=true;this._scene.on("collideWithEntity",function(collideWithEntity){enableForward=!collideWithEntity;});this._onTick=scene.on("tick",function(e){if(!(configs.active&&configs.pointerEnabled)||!scene.input.keyboardEnabled){return;}if(!states.mouseover){return;}var cameraControl=controllers.cameraControl;var elapsedSecs=e.deltaTime/1000.0;//-------------------------------------------------------------------------------------------------
22638
22885
  // Keyboard rotation
22639
22886
  //-------------------------------------------------------------------------------------------------
22640
- if(!configs.planView){var rotateYPos=cameraControl._isKeyDownForAction(cameraControl.ROTATE_Y_POS,keyDownMap);var rotateYNeg=cameraControl._isKeyDownForAction(cameraControl.ROTATE_Y_NEG,keyDownMap);var rotateXPos=cameraControl._isKeyDownForAction(cameraControl.ROTATE_X_POS,keyDownMap);var rotateXNeg=cameraControl._isKeyDownForAction(cameraControl.ROTATE_X_NEG,keyDownMap);var orbitDelta=elapsedSecs*configs.keyboardRotationRate;if(rotateYPos||rotateYNeg||rotateXPos||rotateXNeg){if(!configs.firstPerson&&configs.followPointer){controllers.pivotController.startPivot();}if(rotateYPos){updates.rotateDeltaY+=orbitDelta*_this112._movespeedList[_this112._movespeed];}else if(rotateYNeg){updates.rotateDeltaY-=orbitDelta*_this112._movespeedList[_this112._movespeed];}if(rotateXPos){updates.rotateDeltaX+=orbitDelta*_this112._movespeedList[_this112._movespeed];}else if(rotateXNeg){updates.rotateDeltaX-=orbitDelta*_this112._movespeedList[_this112._movespeed];}if(!configs.firstPerson&&configs.followPointer){controllers.pivotController.startPivot();}}}//-------------------------------------------------------------------------------------------------
22887
+ if(!configs.planView){var rotateYPos=cameraControl._isKeyDownForAction(cameraControl.ROTATE_Y_POS,keyDownMap);var rotateYNeg=cameraControl._isKeyDownForAction(cameraControl.ROTATE_Y_NEG,keyDownMap);var rotateXPos=cameraControl._isKeyDownForAction(cameraControl.ROTATE_X_POS,keyDownMap);var rotateXNeg=cameraControl._isKeyDownForAction(cameraControl.ROTATE_X_NEG,keyDownMap);var orbitDelta=elapsedSecs*configs.keyboardRotationRate;if(rotateYPos||rotateYNeg||rotateXPos||rotateXNeg){if(!configs.firstPerson&&configs.followPointer){controllers.pivotController.startPivot();}if(rotateYPos){updates.rotateDeltaY+=orbitDelta*_this113._movespeedList[_this113._movespeed];}else if(rotateYNeg){updates.rotateDeltaY-=orbitDelta*_this113._movespeedList[_this113._movespeed];}if(rotateXPos){updates.rotateDeltaX+=orbitDelta*_this113._movespeedList[_this113._movespeed];}else if(rotateXNeg){updates.rotateDeltaX-=orbitDelta*_this113._movespeedList[_this113._movespeed];}if(!configs.firstPerson&&configs.followPointer){controllers.pivotController.startPivot();}}}//-------------------------------------------------------------------------------------------------
22641
22888
  // Keyboard panning
22642
22889
  //-------------------------------------------------------------------------------------------------
22643
- if(!keyDownMap[input.KEY_CTRL]&&!keyDownMap[input.KEY_ALT]){var dollyBackwards=cameraControl._isKeyDownForAction(cameraControl.DOLLY_BACKWARDS,keyDownMap);var dollyForwards=cameraControl._isKeyDownForAction(cameraControl.DOLLY_FORWARDS,keyDownMap);if(dollyBackwards||dollyForwards){var dollyDelta=elapsedSecs*configs.keyboardDollyRate;if(!configs.firstPerson&&configs.followPointer){controllers.pivotController.startPivot();}if(dollyForwards){if(!enableForward)return;updates.dollyDelta-=dollyDelta*_this112._movespeedList[_this112._movespeed];}else if(dollyBackwards){updates.dollyDelta+=dollyDelta*_this112._movespeedList[_this112._movespeed];}if(mouseMovedSinceLastKeyboardDolly){states.followPointerDirty=true;mouseMovedSinceLastKeyboardDolly=false;}}}// 调整移动速度
22644
- var speedUP=cameraControl._isKeyDownForAction(cameraControl.SPEED_UP,keyDownMap);var speedDown=cameraControl._isKeyDownForAction(cameraControl.SPEED_DOWN,keyDownMap);if(speedUP||speedDown){if(enableSetSpeedUp){if(_this112._movespeed<_this112._movespeedList.length-1){_this112._movespeed+=1;}_this112._cameraControl.fire("personModeSpeedUp",_this112._movespeedList[_this112._movespeed]);enableSetSpeedUp=false;}if(enableSetSpeedDown){if(_this112._movespeed>0){_this112._movespeed-=1;}_this112._cameraControl.fire("personModeSpeedDown",_this112._movespeedList[_this112._movespeed]);enableSetSpeedDown=false;}}//判断是否能用
22890
+ if(!keyDownMap[input.KEY_CTRL]&&!keyDownMap[input.KEY_ALT]){var dollyBackwards=cameraControl._isKeyDownForAction(cameraControl.DOLLY_BACKWARDS,keyDownMap);var dollyForwards=cameraControl._isKeyDownForAction(cameraControl.DOLLY_FORWARDS,keyDownMap);if(dollyBackwards||dollyForwards){var dollyDelta=elapsedSecs*configs.keyboardDollyRate;if(!configs.firstPerson&&configs.followPointer){controllers.pivotController.startPivot();}if(dollyForwards){if(!enableForward)return;updates.dollyDelta-=dollyDelta*_this113._movespeedList[_this113._movespeed];}else if(dollyBackwards){updates.dollyDelta+=dollyDelta*_this113._movespeedList[_this113._movespeed];}if(mouseMovedSinceLastKeyboardDolly){states.followPointerDirty=true;mouseMovedSinceLastKeyboardDolly=false;}}}// 调整移动速度
22891
+ var speedUP=cameraControl._isKeyDownForAction(cameraControl.SPEED_UP,keyDownMap);var speedDown=cameraControl._isKeyDownForAction(cameraControl.SPEED_DOWN,keyDownMap);if(speedUP||speedDown){if(enableSetSpeedUp){if(_this113._movespeed<_this113._movespeedList.length-1){_this113._movespeed+=1;}_this113._cameraControl.fire("personModeSpeedUp",_this113._movespeedList[_this113._movespeed]);enableSetSpeedUp=false;}if(enableSetSpeedDown){if(_this113._movespeed>0){_this113._movespeed-=1;}_this113._cameraControl.fire("personModeSpeedDown",_this113._movespeedList[_this113._movespeed]);enableSetSpeedDown=false;}}//判断是否能用
22645
22892
  var panForwards=cameraControl._isKeyDownForAction(cameraControl.PAN_FORWARDS,keyDownMap);var panBackwards=cameraControl._isKeyDownForAction(cameraControl.PAN_BACKWARDS,keyDownMap);var panLeft=cameraControl._isKeyDownForAction(cameraControl.PAN_LEFT,keyDownMap);var panRight=cameraControl._isKeyDownForAction(cameraControl.PAN_RIGHT,keyDownMap);var panUp=cameraControl._isKeyDownForAction(cameraControl.PAN_UP,keyDownMap);var panDown=cameraControl._isKeyDownForAction(cameraControl.PAN_DOWN,keyDownMap);// const panDelta = (keyDownMap[input.KEY_ALT] ? 0.3 : 1.0) * elapsedSecs * configs.keyboardPanRate; // ALT for slower pan rate
22646
- var panDelta=_this112._movespeedList[_this112._movespeed]*elapsedSecs*configs.keyboardPanRate;// ALT for slower pan rate
22893
+ var panDelta=_this113._movespeedList[_this113._movespeed]*elapsedSecs*configs.keyboardPanRate;// ALT for slower pan rate
22647
22894
  if(panForwards||panBackwards||panLeft||panRight||panUp||panDown){if(!configs.firstPerson&&configs.followPointer){controllers.pivotController.startPivot();}if(panDown){updates.panDeltaY+=panDelta;}else if(panUp){updates.panDeltaY+=-panDelta;}if(panRight){updates.panDeltaX+=-panDelta;}else if(panLeft){updates.panDeltaX+=panDelta;}if(panBackwards){updates.panDeltaZ+=panDelta;}else if(panForwards){updates.panDeltaZ+=-panDelta;}}});}return _createClass(KeyboardPanRotateDollyHandler,[{key:"movespeed",get:function get(){return this._movespeed;},set:function set(value){this._movespeed=value;}},{key:"moveRate",get:function get(){return this._movespeedList[this._movespeed];}},{key:"speedUp",value:function speedUp(){if(this._movespeed<this._movespeedList.length-1){this._movespeed+=1;}this._cameraControl.fire("personModeSpeedUp",this._movespeedList[this._movespeed]);}},{key:"speedDown",value:function speedDown(){if(this._movespeed>0){this._movespeed-=1;}this._cameraControl.fire("personModeSpeedDown",this._movespeedList[this._movespeed]);}},{key:"reset",value:function reset(){}},{key:"destroy",value:function destroy(){this._scene.off(this._onTick);this.input.off(this._onSceneMouseMove);this.input.off(this._onSceneKeyDown);this.input.off(this._onSceneKeyUp);}}]);}();var SCALE_DOLLY_EACH_FRAME=1;// Recalculate dolly speed for eye->target distance on each Nth frame
22648
22895
  var EPSILON=0.001;var tempVec3$1=math.vec3();/**
22649
22896
  * Handles camera updates on each "tick" that were scheduled by the various controllers.
@@ -22682,13 +22929,13 @@ if(Math.abs(updates.panDeltaX)<EPSILON*dynamicEPSILON){updates.panDeltaX=0;}if(M
22682
22929
  if(dollyDeltaForDist!==0){if(dollyDeltaForDist<0){cursorType="zoom-in";}else{cursorType="zoom-out";}if(configs.firstPerson){var _verticalEye;var _verticalLook;if(configs.constrainVertical){if(camera.xUp){_verticalEye=camera.eye[0];_verticalLook=camera.look[0];}else if(camera.yUp){_verticalEye=camera.eye[1];_verticalLook=camera.look[1];}else if(camera.zUp){_verticalEye=camera.eye[2];_verticalLook=camera.look[2];}}if(configs.followPointer){var dolliedThroughSurface=panController.dollyToCanvasPos(followPointerWorldPos,states.pointerCanvasPos,-dollyDeltaForDist);if(dolliedThroughSurface){states.followPointerDirty=true;}}else{camera.pan([0,0,dollyDeltaForDist]);camera.ortho.scale=camera.ortho.scale-dollyDeltaForDist;}if(configs.constrainVertical){var _eye=camera.eye;var _look=camera.look;if(camera.xUp){_eye[0]=_verticalEye;_look[0]=_verticalLook;}else if(camera.yUp){_eye[1]=_verticalEye;_look[1]=_verticalLook;}else if(camera.zUp){_eye[2]=_verticalEye;_look[2]=_verticalLook;}camera.eye=_eye;camera.look=_look;}}else if(configs.planView){if(configs.followPointer){var _dolliedThroughSurface=panController.dollyToCanvasPos(followPointerWorldPos,states.pointerCanvasPos,-dollyDeltaForDist);if(_dolliedThroughSurface){states.followPointerDirty=true;}}else{camera.ortho.scale=camera.ortho.scale+dollyDeltaForDist;camera.zoom(dollyDeltaForDist);}}else{// Orbiting
22683
22930
  if(configs.followPointer){var _dolliedThroughSurface2=panController.dollyToCanvasPos(followPointerWorldPos,states.pointerCanvasPos,-dollyDeltaForDist);if(_dolliedThroughSurface2){states.followPointerDirty=true;}}else{camera.ortho.scale=camera.ortho.scale+dollyDeltaForDist;camera.zoom(dollyDeltaForDist);}}updates.dollyDelta*=configs.dollyInertia;}pickController.fireEvents();if(!viewer.navCube.MOUSEDOWN&&!viewer.navCube.MOUSEOVER){document.body.style.cursor=cursorType;}});}return _createClass(CameraUpdater,[{key:"destroy",value:function destroy(){this._scene.off(this._onTick);}}]);}();/**
22684
22931
  * @private
22685
- */var MouseMiscHandler=/*#__PURE__*/function(){function MouseMiscHandler(scene,controllers,configs,states,updates){var _this113=this;_classCallCheck(this,MouseMiscHandler);this._scene=scene;this.canvas=this._scene.canvas.canvas;this.canvas.addEventListener("mouseenter",this._mouseEnterHandler=function(){states.mouseover=true;});this.canvas.addEventListener("mouseleave",this._mouseLeaveHandler=function(){states.mouseover=false;_this113.canvas.style.cursor=null;});document.addEventListener("mousemove",this._mouseMoveHandler=function(e){getCanvasPosFromEvent$2(e,_this113.canvas,states.pointerCanvasPos);});this.canvas.addEventListener("mousedown",this._mouseDownHandler=function(e){if(!(configs.active&&configs.pointerEnabled)){return;}getCanvasPosFromEvent$2(e,_this113.canvas,states.pointerCanvasPos);states.mouseover=true;});this.canvas.addEventListener("mouseup",this._mouseUpHandler=function(e){if(!(configs.active&&configs.pointerEnabled)){return;}});}return _createClass(MouseMiscHandler,[{key:"reset",value:function reset(){}},{key:"destroy",value:function destroy(){//网络问题导致的模型加载失败等情况时,如果切换模型,会找不到canvas
22932
+ */var MouseMiscHandler=/*#__PURE__*/function(){function MouseMiscHandler(scene,controllers,configs,states,updates){var _this114=this;_classCallCheck(this,MouseMiscHandler);this._scene=scene;this.canvas=this._scene.canvas.canvas;this.canvas.addEventListener("mouseenter",this._mouseEnterHandler=function(){states.mouseover=true;});this.canvas.addEventListener("mouseleave",this._mouseLeaveHandler=function(){states.mouseover=false;_this114.canvas.style.cursor=null;});document.addEventListener("mousemove",this._mouseMoveHandler=function(e){getCanvasPosFromEvent$2(e,_this114.canvas,states.pointerCanvasPos);});this.canvas.addEventListener("mousedown",this._mouseDownHandler=function(e){if(!(configs.active&&configs.pointerEnabled)){return;}getCanvasPosFromEvent$2(e,_this114.canvas,states.pointerCanvasPos);states.mouseover=true;});this.canvas.addEventListener("mouseup",this._mouseUpHandler=function(e){if(!(configs.active&&configs.pointerEnabled)){return;}});}return _createClass(MouseMiscHandler,[{key:"reset",value:function reset(){}},{key:"destroy",value:function destroy(){//网络问题导致的模型加载失败等情况时,如果切换模型,会找不到canvas
22686
22933
  //因此暂时在此加判断
22687
22934
  if(this.canvas!=null){this.canvas.removeEventListener("mouseenter",this._mouseEnterHandler);this.canvas.removeEventListener("mouseleave",this._mouseLeaveHandler);this.canvas.removeEventListener("mousedown",this._mouseDownHandler);this.canvas.removeEventListener("mouseup",this._mouseUpHandler);}document.removeEventListener("mousemove",this._mouseMoveHandler);}}]);}();function getCanvasPosFromEvent$2(event,canvas,canvasPos){if(!event){event=window.event;canvasPos[0]=event.x;canvasPos[1]=event.y;}else{var _canvas$getBoundingCl=canvas.getBoundingClientRect(),x=_canvas$getBoundingCl.x,y=_canvas$getBoundingCl.y;canvasPos[0]=event.clientX-x;canvasPos[1]=event.clientY-y;}return canvasPos;}var getCanvasPosFromEvent$1=function getCanvasPosFromEvent$1(event,canvasPos){if(!event){event=window.event;canvasPos[0]=event.x;canvasPos[1]=event.y;}else{var element=event.target;var totalOffsetLeft=0;var totalOffsetTop=0;while(element.offsetParent){totalOffsetLeft+=element.offsetLeft;totalOffsetTop+=element.offsetTop;element=element.offsetParent;}canvasPos[0]=event.pageX-totalOffsetLeft;canvasPos[1]=event.pageY-totalOffsetTop;}return canvasPos;};/**
22688
22935
  * @private
22689
- */var TouchPanRotateAndDollyHandler=/*#__PURE__*/function(){function TouchPanRotateAndDollyHandler(scene,controllers,configs,states,updates,cameraControl){var _this114=this;_classCallCheck(this,TouchPanRotateAndDollyHandler);this._scene=scene;this._cameraControl=cameraControl;var pickController=controllers.pickController;var pivotController=controllers.pivotController;var tapStartCanvasPos=math.vec2();var tapCanvasPos0=math.vec2();var tapCanvasPos1=math.vec2();var touch0Vec=math.vec2();this._dollyspeed=1;this._panspeed=1;var lastCanvasTouchPosList=[];this.canvas=this._scene.canvas.canvas;var numTouches=0;var waitForTick=false;this._onTick=scene.on("tick",function(){waitForTick=false;});this.canvas.addEventListener("touchstart",this._canvasTouchStartHandler=function(event){if(!(configs.active&&configs.pointerEnabled)){return;}if(!event.isTrusted)return;event.preventDefault();var touches=event.touches;var changedTouches=event.changedTouches;states.touchStartTime=Date.now();if(touches.length===1&&changedTouches.length===1){states.touchStartTime;getCanvasPosFromEvent$1(touches[0],tapStartCanvasPos);if(configs.followPointer){pickController.pickCursorPos=tapStartCanvasPos;pickController.schedulePickSurface=true;pickController.update();pivotController.setPivotPos(scene.camera.look);if(!configs.planView){if(pickController.picked&&pickController.pickedSurface&&pickController.pickResult&&pickController.pickResult.worldPos){// pivotController.setPivotPos(pickController.pickResult.worldPos);
22936
+ */var TouchPanRotateAndDollyHandler=/*#__PURE__*/function(){function TouchPanRotateAndDollyHandler(scene,controllers,configs,states,updates,cameraControl){var _this115=this;_classCallCheck(this,TouchPanRotateAndDollyHandler);this._scene=scene;this._cameraControl=cameraControl;var pickController=controllers.pickController;var pivotController=controllers.pivotController;var tapStartCanvasPos=math.vec2();var tapCanvasPos0=math.vec2();var tapCanvasPos1=math.vec2();var touch0Vec=math.vec2();this._dollyspeed=1;this._panspeed=1;var lastCanvasTouchPosList=[];this.canvas=this._scene.canvas.canvas;var numTouches=0;var waitForTick=false;this._onTick=scene.on("tick",function(){waitForTick=false;});this.canvas.addEventListener("touchstart",this._canvasTouchStartHandler=function(event){if(!(configs.active&&configs.pointerEnabled)){return;}if(!event.isTrusted)return;event.preventDefault();var touches=event.touches;var changedTouches=event.changedTouches;states.touchStartTime=Date.now();if(touches.length===1&&changedTouches.length===1){states.touchStartTime;getCanvasPosFromEvent$1(touches[0],tapStartCanvasPos);if(configs.followPointer){pickController.pickCursorPos=tapStartCanvasPos;pickController.schedulePickSurface=true;pickController.update();pivotController.setPivotPos(scene.camera.look);if(!configs.planView){if(pickController.picked&&pickController.pickedSurface&&pickController.pickResult&&pickController.pickResult.worldPos){// pivotController.setPivotPos(pickController.pickResult.worldPos);
22690
22937
  pivotController.setPivotPos(scene.camera.look);if(!configs.firstPerson&&pivotController.startPivot());}else{if(configs.smartPivot){pivotController.setPivotPos(scene.camera.look);// pivotController.setCanvasPivotPos(states.pointerCanvasPos);
22691
- }else{pivotController.setPivotPos(scene.camera.look);}if(!configs.firstPerson&&pivotController.startPivot());}}}}while(lastCanvasTouchPosList.length<touches.length){lastCanvasTouchPosList.push(math.vec2());}for(var _i480=0,len=touches.length;_i480<len;++_i480){getCanvasPosFromEvent$1(touches[_i480],lastCanvasTouchPosList[_i480]);}numTouches=touches.length;});this.canvas.addEventListener("touchend",this._canvasTouchEndHandler=function(){if(pivotController.getPivoting()){pivotController.endPivot();pivotController.hidePivot();}});this.canvas.addEventListener("touchcancel",this._canvasTouchEndHandler);this.canvas.addEventListener("touchmove",this._canvasTouchMoveHandler=function(event){if(!(configs.active&&configs.pointerEnabled)){return;}_this114._cameraControl.fire("touchmoveCanvas");event.stopPropagation();event.preventDefault();if(waitForTick){// Limit changes detection to one per frame
22938
+ }else{pivotController.setPivotPos(scene.camera.look);}if(!configs.firstPerson&&pivotController.startPivot());}}}}while(lastCanvasTouchPosList.length<touches.length){lastCanvasTouchPosList.push(math.vec2());}for(var _i480=0,len=touches.length;_i480<len;++_i480){getCanvasPosFromEvent$1(touches[_i480],lastCanvasTouchPosList[_i480]);}numTouches=touches.length;});this.canvas.addEventListener("touchend",this._canvasTouchEndHandler=function(){if(pivotController.getPivoting()){pivotController.endPivot();pivotController.hidePivot();}});this.canvas.addEventListener("touchcancel",this._canvasTouchEndHandler);this.canvas.addEventListener("touchmove",this._canvasTouchMoveHandler=function(event){if(!(configs.active&&configs.pointerEnabled)){return;}_this115._cameraControl.fire("touchmoveCanvas");event.stopPropagation();event.preventDefault();if(waitForTick){// Limit changes detection to one per frame
22692
22939
  return;}waitForTick=true;// Scaling drag-rotate to canvas boundary
22693
22940
  var canvasBoundary=scene.canvas.boundary;var canvasWidth=canvasBoundary[2];var canvasHeight=canvasBoundary[3];var touches=event.touches;if(event.touches.length!==numTouches){// Two fingers were pressed, then one of them is removed
22694
22941
  // We don't want to rotate in this case (weird behavior)
@@ -22697,7 +22944,7 @@ return;}if(numTouches===1){getCanvasPosFromEvent$1(touches[0],tapCanvasPos0);//-
22697
22944
  //-----------------------------------------------------------------------------------------------
22698
22945
  math.subVec2(tapCanvasPos0,lastCanvasTouchPosList[0],touch0Vec);var xPanDelta=touch0Vec[0];var yPanDelta=touch0Vec[1];if(states.longTouchTimeout!==null&&(Math.abs(xPanDelta)>configs.longTapRadius||Math.abs(yPanDelta)>configs.longTapRadius)){clearTimeout(states.longTouchTimeout);states.longTouchTimeout=null;}if(configs.planView){// No rotating in plan-view mode
22699
22946
  var camera=scene.camera;// We use only canvasHeight here so that aspect ratio does not distort speed
22700
- if(camera.projection==="perspective"){var depth=Math.abs(scene.camera.eyeLookDist);var targetDistance=depth*Math.tan(camera.perspective.fov/2*Math.PI/180.0);updates.panDeltaX+=xPanDelta*targetDistance/canvasHeight*configs.touchPanRate*_this114._panspeed;updates.panDeltaY+=yPanDelta*targetDistance/canvasHeight*configs.touchPanRate*_this114._panspeed;}else{updates.panDeltaX+=0.5*camera.ortho.scale*(xPanDelta/canvasHeight)*configs.touchPanRate*_this114._panspeed;updates.panDeltaY+=0.5*camera.ortho.scale*(yPanDelta/canvasHeight)*configs.touchPanRate*_this114._panspeed;}}else{// if (!absorbTinyFirstDrag) {
22947
+ if(camera.projection==="perspective"){var depth=Math.abs(scene.camera.eyeLookDist);var targetDistance=depth*Math.tan(camera.perspective.fov/2*Math.PI/180.0);updates.panDeltaX+=xPanDelta*targetDistance/canvasHeight*configs.touchPanRate*_this115._panspeed;updates.panDeltaY+=yPanDelta*targetDistance/canvasHeight*configs.touchPanRate*_this115._panspeed;}else{updates.panDeltaX+=0.5*camera.ortho.scale*(xPanDelta/canvasHeight)*configs.touchPanRate*_this115._panspeed;updates.panDeltaY+=0.5*camera.ortho.scale*(yPanDelta/canvasHeight)*configs.touchPanRate*_this115._panspeed;}}else{// if (!absorbTinyFirstDrag) {
22701
22948
  updates.rotateDeltaY-=xPanDelta/canvasWidth*(configs.dragRotationRate*1.0);// Full horizontal rotation
22702
22949
  updates.rotateDeltaX+=yPanDelta/canvasHeight*(configs.dragRotationRate*1.5);// Half vertical rotation
22703
22950
  // } else {
@@ -22712,8 +22959,8 @@ updates.rotateDeltaX+=yPanDelta/canvasHeight*(configs.dragRotationRate*1.5);// H
22712
22959
  // }
22713
22960
  // }
22714
22961
  }}else if(numTouches===2){pivotController.hidePivot();var touch0=touches[0];var touch1=touches[1];getCanvasPosFromEvent$1(touch0,tapCanvasPos0);getCanvasPosFromEvent$1(touch1,tapCanvasPos1);var lastMiddleTouch=math.geometricMeanVec2(lastCanvasTouchPosList[0],lastCanvasTouchPosList[1]);var currentMiddleTouch=math.geometricMeanVec2(tapCanvasPos0,tapCanvasPos1);var touchDelta=math.vec2();math.subVec2(lastMiddleTouch,currentMiddleTouch,touchDelta);var _xPanDelta=touchDelta[0];var _yPanDelta=touchDelta[1];var _camera2=scene.camera;// Dollying
22715
- var d1=math.distVec2([touch0.pageX,touch0.pageY],[touch1.pageX,touch1.pageY]);var d2=math.distVec2(lastCanvasTouchPosList[0],lastCanvasTouchPosList[1]);var dollyDelta=(d2-d1)*configs.touchDollyRate*_this114._dollyspeed;updates.dollyDelta=dollyDelta;if(Math.abs(dollyDelta)<1.0){// We use only canvasHeight here so that aspect ratio does not distort speed
22716
- if(_camera2.projection==="perspective"){var pickedWorldPos=pickController.pickResult?pickController.pickResult.worldPos:scene.center;var _depth=Math.abs(math.lenVec3(math.subVec3(pickedWorldPos,scene.camera.eye,[])));var _targetDistance=_depth*Math.tan(_camera2.perspective.fov/2*Math.PI/180.0);updates.panDeltaX-=_xPanDelta*_targetDistance/canvasHeight*configs.touchPanRate*_this114._panspeed;updates.panDeltaY-=_yPanDelta*_targetDistance/canvasHeight*configs.touchPanRate*_this114._panspeed;}else{updates.panDeltaX-=0.5*_camera2.ortho.scale*(_xPanDelta/canvasHeight)*configs.touchPanRate*_this114._panspeed;updates.panDeltaY-=0.5*_camera2.ortho.scale*(_yPanDelta/canvasHeight)*configs.touchPanRate*_this114._panspeed;}}states.pointerCanvasPos=currentMiddleTouch;}for(var _i481=0;_i481<numTouches;++_i481){getCanvasPosFromEvent$1(touches[_i481],lastCanvasTouchPosList[_i481]);}});}return _createClass(TouchPanRotateAndDollyHandler,[{key:"dollyspeed",get:function get(){return this._dollyspeed;},set:function set(speed){if(speed<=0)return;this._dollyspeed=+speed.toFixed(1);this._cameraControl.fire("touchDollySpeed",this._dollyspeed);}},{key:"panspeed",get:function get(){return this._panspeed;},set:function set(speed){if(speed<=0)return;this._panspeed=+speed.toFixed(1);this._cameraControl.fire("touchPanSpeed",this._panspeed);}},{key:"reset",value:function reset(){}},{key:"destroy",value:function destroy(){if(this.canvas!=null){this.canvas.removeEventListener("touchstart",this._canvasTouchStartHandler);this.canvas.removeEventListener("touchend",this._canvasTouchEndHandler);this.canvas.removeEventListener("touchcancel",this._canvasTouchEndHandler);this.canvas.removeEventListener("touchmove",this._canvasTouchMoveHandler);}this._scene.off(this._onTick);}}]);}();var TAP_INTERVAL=150;var DBL_TAP_INTERVAL=325;var TAP_DISTANCE_THRESHOLD=1000;var getCanvasPosFromEvent=function getCanvasPosFromEvent(event,canvasPos){if(!event){event=window.event;canvasPos[0]=event.x;canvasPos[1]=event.y;}else{var element=event.target;var totalOffsetLeft=0;var totalOffsetTop=0;while(element.offsetParent){totalOffsetLeft+=element.offsetLeft;totalOffsetTop+=element.offsetTop;element=element.offsetParent;}canvasPos[0]=event.pageX-totalOffsetLeft;canvasPos[1]=event.pageY-totalOffsetTop;}return canvasPos;};/**
22962
+ var d1=math.distVec2([touch0.pageX,touch0.pageY],[touch1.pageX,touch1.pageY]);var d2=math.distVec2(lastCanvasTouchPosList[0],lastCanvasTouchPosList[1]);var dollyDelta=(d2-d1)*configs.touchDollyRate*_this115._dollyspeed;updates.dollyDelta=dollyDelta;if(Math.abs(dollyDelta)<1.0){// We use only canvasHeight here so that aspect ratio does not distort speed
22963
+ if(_camera2.projection==="perspective"){var pickedWorldPos=pickController.pickResult?pickController.pickResult.worldPos:scene.center;var _depth=Math.abs(math.lenVec3(math.subVec3(pickedWorldPos,scene.camera.eye,[])));var _targetDistance=_depth*Math.tan(_camera2.perspective.fov/2*Math.PI/180.0);updates.panDeltaX-=_xPanDelta*_targetDistance/canvasHeight*configs.touchPanRate*_this115._panspeed;updates.panDeltaY-=_yPanDelta*_targetDistance/canvasHeight*configs.touchPanRate*_this115._panspeed;}else{updates.panDeltaX-=0.5*_camera2.ortho.scale*(_xPanDelta/canvasHeight)*configs.touchPanRate*_this115._panspeed;updates.panDeltaY-=0.5*_camera2.ortho.scale*(_yPanDelta/canvasHeight)*configs.touchPanRate*_this115._panspeed;}}states.pointerCanvasPos=currentMiddleTouch;}for(var _i481=0;_i481<numTouches;++_i481){getCanvasPosFromEvent$1(touches[_i481],lastCanvasTouchPosList[_i481]);}});}return _createClass(TouchPanRotateAndDollyHandler,[{key:"dollyspeed",get:function get(){return this._dollyspeed;},set:function set(speed){if(speed<=0)return;this._dollyspeed=+speed.toFixed(1);this._cameraControl.fire("touchDollySpeed",this._dollyspeed);}},{key:"panspeed",get:function get(){return this._panspeed;},set:function set(speed){if(speed<=0)return;this._panspeed=+speed.toFixed(1);this._cameraControl.fire("touchPanSpeed",this._panspeed);}},{key:"reset",value:function reset(){}},{key:"destroy",value:function destroy(){if(this.canvas!=null){this.canvas.removeEventListener("touchstart",this._canvasTouchStartHandler);this.canvas.removeEventListener("touchend",this._canvasTouchEndHandler);this.canvas.removeEventListener("touchcancel",this._canvasTouchEndHandler);this.canvas.removeEventListener("touchmove",this._canvasTouchMoveHandler);}this._scene.off(this._onTick);}}]);}();var TAP_INTERVAL=150;var DBL_TAP_INTERVAL=325;var TAP_DISTANCE_THRESHOLD=1000;var getCanvasPosFromEvent=function getCanvasPosFromEvent(event,canvasPos){if(!event){event=window.event;canvasPos[0]=event.x;canvasPos[1]=event.y;}else{var element=event.target;var totalOffsetLeft=0;var totalOffsetTop=0;while(element.offsetParent){totalOffsetLeft+=element.offsetLeft;totalOffsetTop+=element.offsetTop;element=element.offsetParent;}canvasPos[0]=event.pageX-totalOffsetLeft;canvasPos[1]=event.pageY-totalOffsetTop;}return canvasPos;};/**
22717
22964
  * @private
22718
22965
  */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;this.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
22719
22966
  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
@@ -23194,81 +23441,81 @@ cameraControl.fire("touchPickedNothing");}lastTapTime=currentTime;}tapStartTime=
23194
23441
  */var CameraControl=/*#__PURE__*/function(_Component39){/**
23195
23442
  * @private
23196
23443
  * @constructor
23197
- */function CameraControl(owner){var _this115;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,CameraControl);_this115=_callSuper(this,CameraControl,[owner,cfg]);/**
23444
+ */function CameraControl(owner){var _this116;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,CameraControl);_this116=_callSuper(this,CameraControl,[owner,cfg]);/**
23198
23445
  * Identifies the XX action.
23199
23446
  * @final
23200
23447
  * @type {Number}
23201
- */_this115.PAN_LEFT=0;/**
23448
+ */_this116.PAN_LEFT=0;/**
23202
23449
  * Identifies the XX action.
23203
23450
  * @final
23204
23451
  * @type {Number}
23205
- */_this115.PAN_RIGHT=1;/**
23452
+ */_this116.PAN_RIGHT=1;/**
23206
23453
  * Identifies the XX action.
23207
23454
  * @final
23208
23455
  * @type {Number}
23209
- */_this115.PAN_UP=2;/**
23456
+ */_this116.PAN_UP=2;/**
23210
23457
  * Identifies the XX action.
23211
23458
  * @final
23212
23459
  * @type {Number}
23213
- */_this115.PAN_DOWN=3;/**
23460
+ */_this116.PAN_DOWN=3;/**
23214
23461
  * Identifies the XX action.
23215
23462
  * @final
23216
23463
  * @type {Number}
23217
- */_this115.PAN_FORWARDS=4;/**
23464
+ */_this116.PAN_FORWARDS=4;/**
23218
23465
  * Identifies the XX action.
23219
23466
  * @final
23220
23467
  * @type {Number}
23221
- */_this115.PAN_BACKWARDS=5;/**
23468
+ */_this116.PAN_BACKWARDS=5;/**
23222
23469
  * Identifies the XX action.
23223
23470
  * @final
23224
23471
  * @type {Number}
23225
- */_this115.ROTATE_X_POS=6;/**
23472
+ */_this116.ROTATE_X_POS=6;/**
23226
23473
  * Identifies the XX action.
23227
23474
  * @final
23228
23475
  * @type {Number}
23229
- */_this115.ROTATE_X_NEG=7;/**
23476
+ */_this116.ROTATE_X_NEG=7;/**
23230
23477
  * Identifies the XX action.
23231
23478
  * @final
23232
23479
  * @type {Number}
23233
- */_this115.ROTATE_Y_POS=8;/**
23480
+ */_this116.ROTATE_Y_POS=8;/**
23234
23481
  * Identifies the XX action.
23235
23482
  * @final
23236
23483
  * @type {Number}
23237
- */_this115.ROTATE_Y_NEG=9;/**
23484
+ */_this116.ROTATE_Y_NEG=9;/**
23238
23485
  * Identifies the XX action.
23239
23486
  * @final
23240
23487
  * @type {Number}
23241
- */_this115.DOLLY_FORWARDS=10;/**
23488
+ */_this116.DOLLY_FORWARDS=10;/**
23242
23489
  * Identifies the XX action.
23243
23490
  * @final
23244
23491
  * @type {Number}
23245
- */_this115.DOLLY_BACKWARDS=11;/**
23492
+ */_this116.DOLLY_BACKWARDS=11;/**
23246
23493
  * Identifies the XX action.
23247
23494
  * @final
23248
23495
  * @type {Number}
23249
- */_this115.AXIS_VIEW_RIGHT=12;/**
23496
+ */_this116.AXIS_VIEW_RIGHT=12;/**
23250
23497
  * Identifies the XX action.
23251
23498
  * @final
23252
23499
  * @type {Number}
23253
- */_this115.AXIS_VIEW_BACK=13;/**
23500
+ */_this116.AXIS_VIEW_BACK=13;/**
23254
23501
  * Identifies the XX action.
23255
23502
  * @final
23256
23503
  * @type {Number}
23257
- */_this115.AXIS_VIEW_LEFT=14;/**
23504
+ */_this116.AXIS_VIEW_LEFT=14;/**
23258
23505
  * Identifies the XX action.
23259
23506
  * @final
23260
23507
  * @type {Number}
23261
- */_this115.AXIS_VIEW_FRONT=15;/**
23508
+ */_this116.AXIS_VIEW_FRONT=15;/**
23262
23509
  * Identifies the XX action.
23263
23510
  * @final
23264
23511
  * @type {Number}
23265
- */_this115.AXIS_VIEW_TOP=16;/**
23512
+ */_this116.AXIS_VIEW_TOP=16;/**
23266
23513
  * Identifies the XX action.
23267
23514
  * @final
23268
23515
  * @type {Number}
23269
- */_this115.AXIS_VIEW_BOTTOM=17;_this115.SPEED_UP=107;_this115.SPEED_DOWN=109;_this115._keyMap={};// Maps key codes to the above actions
23270
- _this115.scene.canvas.canvas.oncontextmenu=function(e){e.preventDefault();};// User-settable CameraControl configurations
23271
- _this115.scene.on("aabb",function(aabb){var x=aabb[3]-aabb[0];var y=aabb[4]-aabb[1];var z=aabb[5]-aabb[2];var maxV=Math.max(x,y,z);var minV=Math.min(x,y,z);if(maxV>100){if(minV>20){var mouseRate=parseInt((maxV+minV)/2);_this115.mouseWheelDollyRate=mouseRate/maxV*100;}}if(maxV>50&&maxV<100){var keyRate=parseInt(maxV/20)*2;_this115.keyboardDollyRate=keyRate*15;_this115.keyboardPanRate=keyRate*1.5;}if(maxV>100&&maxV<600){var _keyRate=parseInt(maxV/50)*4;_this115.keyboardDollyRate=_keyRate*15;_this115.keyboardPanRate=_keyRate*1.5;}if(maxV>600){var _keyRate2=parseInt(maxV/100)*8;_this115.keyboardDollyRate=_keyRate2*15;_this115.keyboardPanRate=_keyRate2*1.5;}if(minV==0){var rate=parseInt((maxV+0.0001)/2*100000)/100000;_this115.mouseWheelDollyRate=rate*100;_this115.keyboardDollyRate=rate*10;_this115.keyboardPanRate=rate*1.0;return;}if((minV+maxV)/2<10){var _rate3=parseInt((maxV+minV)/2*10000)/10000/4;_this115.mouseWheelDollyRate=_rate3*100;_this115.keyboardDollyRate=_rate3*10;_this115.keyboardPanRate=_rate3*1.0;}if((minV+maxV)/2<0.1){var _rate4=parseInt((maxV+minV)/2*10000)/10000;_this115.mouseWheelDollyRate=_rate4*100;_this115.keyboardDollyRate=_rate4*10;_this115.keyboardPanRate=_rate4*1.0;}});_this115._configs={// Private
23516
+ */_this116.AXIS_VIEW_BOTTOM=17;_this116.SPEED_UP=107;_this116.SPEED_DOWN=109;_this116._keyMap={};// Maps key codes to the above actions
23517
+ _this116.scene.canvas.canvas.oncontextmenu=function(e){e.preventDefault();};// User-settable CameraControl configurations
23518
+ _this116.scene.on("aabb",function(aabb){var x=aabb[3]-aabb[0];var y=aabb[4]-aabb[1];var z=aabb[5]-aabb[2];var maxV=Math.max(x,y,z);var minV=Math.min(x,y,z);if(maxV>100){if(minV>20){var mouseRate=parseInt((maxV+minV)/2);_this116.mouseWheelDollyRate=mouseRate/maxV*100;}}if(maxV>50&&maxV<100){var keyRate=parseInt(maxV/20)*2;_this116.keyboardDollyRate=keyRate*15;_this116.keyboardPanRate=keyRate*1.5;}if(maxV>100&&maxV<600){var _keyRate=parseInt(maxV/50)*4;_this116.keyboardDollyRate=_keyRate*15;_this116.keyboardPanRate=_keyRate*1.5;}if(maxV>600){var _keyRate2=parseInt(maxV/100)*8;_this116.keyboardDollyRate=_keyRate2*15;_this116.keyboardPanRate=_keyRate2*1.5;}if(minV==0){var rate=parseInt((maxV+0.0001)/2*100000)/100000;_this116.mouseWheelDollyRate=rate*100;_this116.keyboardDollyRate=rate*10;_this116.keyboardPanRate=rate*1.0;return;}if((minV+maxV)/2<10){var _rate3=parseInt((maxV+minV)/2*10000)/10000/4;_this116.mouseWheelDollyRate=_rate3*100;_this116.keyboardDollyRate=_rate3*10;_this116.keyboardPanRate=_rate3*1.0;}if((minV+maxV)/2<0.1){var _rate4=parseInt((maxV+minV)/2*10000)/10000;_this116.mouseWheelDollyRate=_rate4*100;_this116.keyboardDollyRate=_rate4*10;_this116.keyboardPanRate=_rate4*1.0;}});_this116._configs={// Private
23272
23519
  longTapTimeout:600,// Millisecs
23273
23520
  longTapRadius:5,// Pixels
23274
23521
  // General
@@ -23276,13 +23523,13 @@ active:true,keyboardLayout:"qwerty",navMode:"orbit",planView:false,firstPerson:f
23276
23523
  dragRotationRate:360.0,keyboardRotationRate:90.0,rotationInertia:0.0,// Panning
23277
23524
  keyboardPanRate:1.0,touchPanRate:1.0,panInertia:0.5,// Dollying
23278
23525
  keyboardDollyRate:10,mouseWheelDollyRate:100,touchDollyRate:0.2,dollyInertia:0,dollyProximityThreshold:30.0,dollyMinSpeed:0.04};// Current runtime state of the CameraControl
23279
- _this115._states={pointerCanvasPos:math.vec2(),mouseover:false,followPointerDirty:true,mouseDownClientX:0,mouseDownClientY:0,mouseDownCursorX:0,mouseDownCursorY:0,touchStartTime:null,touchEndTime:null,activeTouches:[],tapStartPos:math.vec2(),tapStartTime:-1,lastTapTime:-1,longTouchTimeout:null};// Updates for CameraUpdater to process on next Scene "tick" event
23280
- _this115._updates={rotateDeltaX:0,rotateDeltaY:0,panDeltaX:0,panDeltaY:0,panDeltaZ:0,dollyDelta:0};// Controllers to assist input event handlers with controlling the Camera
23281
- var scene=_this115.scene;_this115._controllers={cameraControl:_this115,pickController:new PickController(_this115,_this115._configs),pivotController:new PivotController(scene,_this115._configs),panController:new PanController(scene),cameraFlight:new CameraFlightAnimation(_this115,{duration:0.5})};// Input event handlers
23282
- _this115._handlers=[new MouseMiscHandler(_this115.scene,_this115._controllers,_this115._configs,_this115._states,_this115._updates),new TouchPanRotateAndDollyHandler(_this115.scene,_this115._controllers,_this115._configs,_this115._states,_this115._updates,_this115),new MousePanRotateDollyHandler(_this115.scene,_this115._controllers,_this115._configs,_this115._states,_this115._updates),new KeyboardAxisViewHandler(_this115.scene,_this115._controllers,_this115._configs,_this115._states,_this115._updates),new MousePickHandler(_this115.scene,_this115._controllers,_this115._configs,_this115._states,_this115._updates),new TouchPickHandler(_this115.scene,_this115._controllers,_this115._configs,_this115._states,_this115._updates),new KeyboardPanRotateDollyHandler(_this115.scene,_this115._controllers,_this115._configs,_this115._states,_this115._updates,_this115)];// Applies scheduled updates to the Camera on each Scene "tick" event
23283
- _this115._cameraUpdater=new CameraUpdater(_this115.scene,_this115._controllers,_this115._configs,_this115._states,_this115._updates);// Set initial user configurations
23284
- _this115.navMode=cfg.navMode;if(cfg.planView){_this115.planView=cfg.planView;}_this115.constrainVertical=cfg.constrainVertical;if(cfg.keyboardLayout){_this115.keyboardLayout=cfg.keyboardLayout;// Deprecated
23285
- }else{_this115.keyMap=cfg.keyMap;}_this115.doublePickFlyTo=cfg.doublePickFlyTo;_this115.panRightClick=cfg.panRightClick;_this115.active=cfg.active;_this115.followPointer=cfg.followPointer;_this115.rotationInertia=cfg.rotationInertia;_this115.keyboardPanRate=cfg.keyboardPanRate;_this115.touchPanRate=cfg.touchPanRate;_this115.keyboardRotationRate=cfg.keyboardRotationRate;_this115.dragRotationRate=cfg.dragRotationRate;_this115.touchDollyRate=cfg.touchDollyRate;_this115.dollyInertia=cfg.dollyInertia;_this115.dollyProximityThreshold=cfg.dollyProximityThreshold;_this115.dollyMinSpeed=cfg.dollyMinSpeed;_this115.panInertia=cfg.panInertia;_this115.pointerEnabled=true;_this115.keyboardDollyRate=cfg.keyboardDollyRate;_this115.mouseWheelDollyRate=cfg.mouseWheelDollyRate;_this115._moveRate=1;_this115.scene.on("tick",function(){if(!(_this115._goLeft||_this115._goRight||_this115._goUp||_this115._goDown||_this115._goForward||_this115._goBackward)){return;}if(_this115._goRight){_this115._updates.panDeltaX+=-0.1*_this115._moveRate;}else if(_this115._goLeft){_this115._updates.panDeltaX+=0.1*_this115._moveRate;}if(_this115._goUp){_this115._updates.panDeltaY+=0.1*_this115._moveRate;}else if(_this115._goDown){_this115._updates.panDeltaY+=-0.1*_this115._moveRate;}if(_this115._goForward){_this115._updates.panDeltaZ+=-0.1*_this115._moveRate;}else if(_this115._goBackward){_this115._updates.panDeltaZ+=+0.1*_this115._moveRate;}});return _this115;}/**
23526
+ _this116._states={pointerCanvasPos:math.vec2(),mouseover:false,followPointerDirty:true,mouseDownClientX:0,mouseDownClientY:0,mouseDownCursorX:0,mouseDownCursorY:0,touchStartTime:null,touchEndTime:null,activeTouches:[],tapStartPos:math.vec2(),tapStartTime:-1,lastTapTime:-1,longTouchTimeout:null};// Updates for CameraUpdater to process on next Scene "tick" event
23527
+ _this116._updates={rotateDeltaX:0,rotateDeltaY:0,panDeltaX:0,panDeltaY:0,panDeltaZ:0,dollyDelta:0};// Controllers to assist input event handlers with controlling the Camera
23528
+ var scene=_this116.scene;_this116._controllers={cameraControl:_this116,pickController:new PickController(_this116,_this116._configs),pivotController:new PivotController(scene,_this116._configs),panController:new PanController(scene),cameraFlight:new CameraFlightAnimation(_this116,{duration:0.5})};// Input event handlers
23529
+ _this116._handlers=[new MouseMiscHandler(_this116.scene,_this116._controllers,_this116._configs,_this116._states,_this116._updates),new TouchPanRotateAndDollyHandler(_this116.scene,_this116._controllers,_this116._configs,_this116._states,_this116._updates,_this116),new MousePanRotateDollyHandler(_this116.scene,_this116._controllers,_this116._configs,_this116._states,_this116._updates),new KeyboardAxisViewHandler(_this116.scene,_this116._controllers,_this116._configs,_this116._states,_this116._updates),new MousePickHandler(_this116.scene,_this116._controllers,_this116._configs,_this116._states,_this116._updates),new TouchPickHandler(_this116.scene,_this116._controllers,_this116._configs,_this116._states,_this116._updates),new KeyboardPanRotateDollyHandler(_this116.scene,_this116._controllers,_this116._configs,_this116._states,_this116._updates,_this116)];// Applies scheduled updates to the Camera on each Scene "tick" event
23530
+ _this116._cameraUpdater=new CameraUpdater(_this116.scene,_this116._controllers,_this116._configs,_this116._states,_this116._updates);// Set initial user configurations
23531
+ _this116.navMode=cfg.navMode;if(cfg.planView){_this116.planView=cfg.planView;}_this116.constrainVertical=cfg.constrainVertical;if(cfg.keyboardLayout){_this116.keyboardLayout=cfg.keyboardLayout;// Deprecated
23532
+ }else{_this116.keyMap=cfg.keyMap;}_this116.doublePickFlyTo=cfg.doublePickFlyTo;_this116.panRightClick=cfg.panRightClick;_this116.active=cfg.active;_this116.followPointer=cfg.followPointer;_this116.rotationInertia=cfg.rotationInertia;_this116.keyboardPanRate=cfg.keyboardPanRate;_this116.touchPanRate=cfg.touchPanRate;_this116.keyboardRotationRate=cfg.keyboardRotationRate;_this116.dragRotationRate=cfg.dragRotationRate;_this116.touchDollyRate=cfg.touchDollyRate;_this116.dollyInertia=cfg.dollyInertia;_this116.dollyProximityThreshold=cfg.dollyProximityThreshold;_this116.dollyMinSpeed=cfg.dollyMinSpeed;_this116.panInertia=cfg.panInertia;_this116.pointerEnabled=true;_this116.keyboardDollyRate=cfg.keyboardDollyRate;_this116.mouseWheelDollyRate=cfg.mouseWheelDollyRate;_this116._moveRate=1;_this116.scene.on("tick",function(){if(!(_this116._goLeft||_this116._goRight||_this116._goUp||_this116._goDown||_this116._goForward||_this116._goBackward)){return;}if(_this116._goRight){_this116._updates.panDeltaX+=-0.1*_this116._moveRate;}else if(_this116._goLeft){_this116._updates.panDeltaX+=0.1*_this116._moveRate;}if(_this116._goUp){_this116._updates.panDeltaY+=0.1*_this116._moveRate;}else if(_this116._goDown){_this116._updates.panDeltaY+=-0.1*_this116._moveRate;}if(_this116._goForward){_this116._updates.panDeltaZ+=-0.1*_this116._moveRate;}else if(_this116._goBackward){_this116._updates.panDeltaZ+=+0.1*_this116._moveRate;}});return _this116;}/**
23286
23533
  * 停止漫游
23287
23534
  */_inherits(CameraControl,_Component39);return _createClass(CameraControl,[{key:"setdirectionChangeCancel",value:function setdirectionChangeCancel(){this._goLeft=false;this._goRight=false;this._goUp=false;this._goDown=false;this._goForward=false;this._goBackward=false;}/**
23288
23535
  * 设置触屏缩放速率
@@ -24621,7 +24868,7 @@ var documentBackgroundColor=ownerDocument.documentElement?parseColor(context,get
24621
24868
  * configures renderer logic for the specified number of SectionPlanes, eliminating the need for setting up logic with each SectionPlane creation and thereby enhancing
24622
24869
  * responsiveness. It is important to consider that each SectionPlane impacts rendering performance, so it is recommended to set this value to a quantity that aligns with
24623
24870
  * your expected usage.
24624
- */function Viewer(cfg){var _this116=this;_classCallCheck(this,Viewer);this.container=cfg.viewerElement;/**
24871
+ */function Viewer(cfg){var _this117=this;_classCallCheck(this,Viewer);this.container=cfg.viewerElement;/**
24625
24872
  * The Viewer's current language setting.
24626
24873
  * @property language
24627
24874
  * @deprecated
@@ -24666,7 +24913,7 @@ var documentBackgroundColor=ownerDocument.documentElement?parseColor(context,get
24666
24913
  * @property cameraControl
24667
24914
  * @type {CameraControl}
24668
24915
  */this.cameraControl=new CameraControl(this.scene,{// panToPointer: true,
24669
- snapRadius:cfg.snapRadius,doublePickFlyTo:true});this.scene.canvas.on("boundary",function(event){_this116.cameraControl.updatePivotElement();});this._plugins=[];/**
24916
+ snapRadius:cfg.snapRadius,doublePickFlyTo:true});this.scene.canvas.on("boundary",function(event){_this117.cameraControl.updatePivotElement();});this._plugins=[];/**
24670
24917
  * Subscriptions to events sent with {@link fire}.
24671
24918
  * @private
24672
24919
  */this._eventSubs={};}/**
@@ -24794,7 +25041,7 @@ _scale6=_i504==0?snapshotCanvas.width/_containerElement.clientWidth:1;off=math.v
24794
25041
  */)},{key:"endSnapshot",value:function endSnapshot(){if(!this._snapshotBegun){return;}this.scene._renderer.endSnapshot();this.scene._renderer.render({force:true});this._snapshotBegun=false;}/**
24795
25042
  * Destroys this Viewer.
24796
25043
  */},{key:"destroy",value:function destroy(callback){var plugins=this._plugins.slice();// Array will modify as we delete plugins
24797
- if(plugins.length>0){for(var _i505=0,len=plugins.length;_i505<len;_i505++){var plugin=plugins[_i505];plugin.destroy();}}this.cameraControl.destroy();this.scene.destroy(callback);}}]);}();function assert$9(condition,message){if(!condition){throw new Error(message||'loader assertion failed.');}}var isBrowser$5=Boolean((typeof process==="undefined"?"undefined":_typeof2(process))!=='object'||String(process)!=='[object process]'||process.browser);var matches$4=typeof process!=='undefined'&&process.version&&/v([0-9]*)/.exec(process.version);matches$4&&parseFloat(matches$4[1])||0;var VERSION$9="3.4.15";function assert$8(condition,message){if(!condition){throw new Error(message||'loaders.gl assertion failed.');}}var isBrowser$4=(typeof process==="undefined"?"undefined":_typeof2(process))!=='object'||String(process)!=='[object process]'||process.browser;var isMobile=typeof window!=='undefined'&&typeof window.orientation!=='undefined';var matches$3=typeof process!=='undefined'&&process.version&&/v([0-9]*)/.exec(process.version);matches$3&&parseFloat(matches$3[1])||0;function _typeof(o){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(o){return typeof o;}:function(o){return o&&"function"==typeof Symbol&&o.constructor===Symbol&&o!==Symbol.prototype?"symbol":typeof o;},_typeof(o);}function toPrimitive(t,r){if("object"!=_typeof(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var i=e.call(t,r||"default");if("object"!=_typeof(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.");}return("string"===r?String:Number)(t);}function toPropertyKey(t){var i=toPrimitive(t,"string");return"symbol"==_typeof(i)?i:String(i);}function _defineProperty(obj,key,value){key=toPropertyKey(key);if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true});}else{obj[key]=value;}return obj;}var WorkerJob=/*#__PURE__*/function(){function WorkerJob(jobName,workerThread){var _this117=this;_classCallCheck(this,WorkerJob);_defineProperty(this,"name",void 0);_defineProperty(this,"workerThread",void 0);_defineProperty(this,"isRunning",true);_defineProperty(this,"result",void 0);_defineProperty(this,"_resolve",function(){});_defineProperty(this,"_reject",function(){});this.name=jobName;this.workerThread=workerThread;this.result=new Promise(function(resolve,reject){_this117._resolve=resolve;_this117._reject=reject;});}return _createClass(WorkerJob,[{key:"postMessage",value:function postMessage(type,payload){this.workerThread.postMessage({source:'loaders.gl',type:type,payload:payload});}},{key:"done",value:function done(value){assert$8(this.isRunning);this.isRunning=false;this._resolve(value);}},{key:"error",value:function error(_error){assert$8(this.isRunning);this.isRunning=false;this._reject(_error);}}]);}();var Worker$1=/*#__PURE__*/function(){function Worker$1(){_classCallCheck(this,Worker$1);}return _createClass(Worker$1,[{key:"terminate",value:function terminate(){}}]);}();var workerURLCache=new Map();function getLoadableWorkerURL(props){assert$8(props.source&&!props.url||!props.source&&props.url);var workerURL=workerURLCache.get(props.source||props.url);if(!workerURL){if(props.url){workerURL=getLoadableWorkerURLFromURL(props.url);workerURLCache.set(props.url,workerURL);}if(props.source){workerURL=getLoadableWorkerURLFromSource(props.source);workerURLCache.set(props.source,workerURL);}}assert$8(workerURL);return workerURL;}function getLoadableWorkerURLFromURL(url){if(!url.startsWith('http')){return url;}var workerSource=buildScriptSource(url);return getLoadableWorkerURLFromSource(workerSource);}function getLoadableWorkerURLFromSource(workerSource){var blob=new Blob([workerSource],{type:'application/javascript'});return URL.createObjectURL(blob);}function buildScriptSource(workerUrl){return"try {\n importScripts('".concat(workerUrl,"');\n} catch (error) {\n console.error(error);\n throw error;\n}");}function getTransferList(object){var recursive=arguments.length>1&&arguments[1]!==undefined?arguments[1]:true;var transfers=arguments.length>2?arguments[2]:undefined;var transfersSet=transfers||new Set();if(!object);else if(isTransferable(object)){transfersSet.add(object);}else if(isTransferable(object.buffer)){transfersSet.add(object.buffer);}else if(ArrayBuffer.isView(object));else if(recursive&&_typeof2(object)==='object'){for(var key in object){getTransferList(object[key],recursive,transfersSet);}}return transfers===undefined?Array.from(transfersSet):[];}function isTransferable(object){if(!object){return false;}if(object instanceof ArrayBuffer){return true;}if(typeof MessagePort!=='undefined'&&object instanceof MessagePort){return true;}if(typeof ImageBitmap!=='undefined'&&object instanceof ImageBitmap){return true;}if(typeof OffscreenCanvas!=='undefined'&&object instanceof OffscreenCanvas){return true;}return false;}var NOOP=function NOOP(){};var WorkerThread=/*#__PURE__*/function(){function WorkerThread(props){_classCallCheck(this,WorkerThread);_defineProperty(this,"name",void 0);_defineProperty(this,"source",void 0);_defineProperty(this,"url",void 0);_defineProperty(this,"terminated",false);_defineProperty(this,"worker",void 0);_defineProperty(this,"onMessage",void 0);_defineProperty(this,"onError",void 0);_defineProperty(this,"_loadableURL",'');var name=props.name,source=props.source,url=props.url;assert$8(source||url);this.name=name;this.source=source;this.url=url;this.onMessage=NOOP;this.onError=function(error){return console.log(error);};this.worker=isBrowser$4?this._createBrowserWorker():this._createNodeWorker();}return _createClass(WorkerThread,[{key:"destroy",value:function destroy(){this.onMessage=NOOP;this.onError=NOOP;this.worker.terminate();this.terminated=true;}},{key:"isRunning",get:function get(){return Boolean(this.onMessage);}},{key:"postMessage",value:function postMessage(data,transferList){transferList=transferList||getTransferList(data);this.worker.postMessage(data,transferList);}},{key:"_getErrorFromErrorEvent",value:function _getErrorFromErrorEvent(event){var message='Failed to load ';message+="worker ".concat(this.name," from ").concat(this.url,". ");if(event.message){message+="".concat(event.message," in ");}if(event.lineno){message+=":".concat(event.lineno,":").concat(event.colno);}return new Error(message);}},{key:"_createBrowserWorker",value:function _createBrowserWorker(){var _this118=this;this._loadableURL=getLoadableWorkerURL({source:this.source,url:this.url});var worker=new Worker(this._loadableURL,{name:this.name});worker.onmessage=function(event){if(!event.data){_this118.onError(new Error('No data received'));}else{_this118.onMessage(event.data);}};worker.onerror=function(error){_this118.onError(_this118._getErrorFromErrorEvent(error));_this118.terminated=true;};worker.onmessageerror=function(event){return console.error(event);};return worker;}},{key:"_createNodeWorker",value:function _createNodeWorker(){var _this119=this;var worker;if(this.url){var absolute=this.url.includes(':/')||this.url.startsWith('/');var url=absolute?this.url:"./".concat(this.url);worker=new Worker$1(url,{eval:false});}else if(this.source){worker=new Worker$1(this.source,{eval:true});}else{throw new Error('no worker');}worker.on('message',function(data){_this119.onMessage(data);});worker.on('error',function(error){_this119.onError(error);});worker.on('exit',function(code){});return worker;}}],[{key:"isSupported",value:function isSupported(){return typeof Worker!=='undefined'&&isBrowser$4||typeof Worker$1!=='undefined'&&!isBrowser$4;}}]);}();var WorkerPool=/*#__PURE__*/function(){function WorkerPool(props){_classCallCheck(this,WorkerPool);_defineProperty(this,"name",'unnamed');_defineProperty(this,"source",void 0);_defineProperty(this,"url",void 0);_defineProperty(this,"maxConcurrency",1);_defineProperty(this,"maxMobileConcurrency",1);_defineProperty(this,"onDebug",function(){});_defineProperty(this,"reuseWorkers",true);_defineProperty(this,"props",{});_defineProperty(this,"jobQueue",[]);_defineProperty(this,"idleQueue",[]);_defineProperty(this,"count",0);_defineProperty(this,"isDestroyed",false);this.source=props.source;this.url=props.url;this.setProps(props);}return _createClass(WorkerPool,[{key:"destroy",value:function destroy(){this.idleQueue.forEach(function(worker){return worker.destroy();});this.isDestroyed=true;}},{key:"setProps",value:function setProps(props){this.props=_objectSpread(_objectSpread({},this.props),props);if(props.name!==undefined){this.name=props.name;}if(props.maxConcurrency!==undefined){this.maxConcurrency=props.maxConcurrency;}if(props.maxMobileConcurrency!==undefined){this.maxMobileConcurrency=props.maxMobileConcurrency;}if(props.reuseWorkers!==undefined){this.reuseWorkers=props.reuseWorkers;}if(props.onDebug!==undefined){this.onDebug=props.onDebug;}}},{key:"startJob",value:function(){var _startJob=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2(name){var _this120=this;var onMessage,onError,startPromise,_args2=arguments;return _regeneratorRuntime().wrap(function _callee2$(_context3){while(1)switch(_context3.prev=_context3.next){case 0:onMessage=_args2.length>1&&_args2[1]!==undefined?_args2[1]:function(job,type,data){return job.done(data);};onError=_args2.length>2&&_args2[2]!==undefined?_args2[2]:function(job,error){return job.error(error);};startPromise=new Promise(function(onStart){_this120.jobQueue.push({name:name,onMessage:onMessage,onError:onError,onStart:onStart});return _this120;});this._startQueuedJob();_context3.next=6;return startPromise;case 6:return _context3.abrupt("return",_context3.sent);case 7:case"end":return _context3.stop();}},_callee2,this);}));function startJob(_x7){return _startJob.apply(this,arguments);}return startJob;}()},{key:"_startQueuedJob",value:function(){var _startQueuedJob2=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee3(){var workerThread,queuedJob,job;return _regeneratorRuntime().wrap(function _callee3$(_context4){while(1)switch(_context4.prev=_context4.next){case 0:if(this.jobQueue.length){_context4.next=2;break;}return _context4.abrupt("return");case 2:workerThread=this._getAvailableWorker();if(workerThread){_context4.next=5;break;}return _context4.abrupt("return");case 5:queuedJob=this.jobQueue.shift();if(!queuedJob){_context4.next=18;break;}this.onDebug({message:'Starting job',name:queuedJob.name,workerThread:workerThread,backlog:this.jobQueue.length});job=new WorkerJob(queuedJob.name,workerThread);workerThread.onMessage=function(data){return queuedJob.onMessage(job,data.type,data.payload);};workerThread.onError=function(error){return queuedJob.onError(job,error);};queuedJob.onStart(job);_context4.prev=12;_context4.next=15;return job.result;case 15:_context4.prev=15;this.returnWorkerToQueue(workerThread);return _context4.finish(15);case 18:case"end":return _context4.stop();}},_callee3,this,[[12,,15,18]]);}));function _startQueuedJob(){return _startQueuedJob2.apply(this,arguments);}return _startQueuedJob;}()},{key:"returnWorkerToQueue",value:function returnWorkerToQueue(worker){var shouldDestroyWorker=this.isDestroyed||!this.reuseWorkers||this.count>this._getMaxConcurrency();if(shouldDestroyWorker){worker.destroy();this.count--;}else{this.idleQueue.push(worker);}if(!this.isDestroyed){this._startQueuedJob();}}},{key:"_getAvailableWorker",value:function _getAvailableWorker(){if(this.idleQueue.length>0){return this.idleQueue.shift()||null;}if(this.count<this._getMaxConcurrency()){this.count++;var _name5="".concat(this.name.toLowerCase()," (#").concat(this.count," of ").concat(this.maxConcurrency,")");return new WorkerThread({name:_name5,source:this.source,url:this.url});}return null;}},{key:"_getMaxConcurrency",value:function _getMaxConcurrency(){return isMobile?this.maxMobileConcurrency:this.maxConcurrency;}}],[{key:"isSupported",value:function isSupported(){return WorkerThread.isSupported();}}]);}();var DEFAULT_PROPS={maxConcurrency:3,maxMobileConcurrency:1,reuseWorkers:true,onDebug:function onDebug(){}};var WorkerFarm=/*#__PURE__*/function(){function WorkerFarm(props){_classCallCheck(this,WorkerFarm);_defineProperty(this,"props",void 0);_defineProperty(this,"workerPools",new Map());this.props=_objectSpread({},DEFAULT_PROPS);this.setProps(props);this.workerPools=new Map();}return _createClass(WorkerFarm,[{key:"destroy",value:function destroy(){var _iterator4=_createForOfIteratorHelper(this.workerPools.values()),_step4;try{for(_iterator4.s();!(_step4=_iterator4.n()).done;){var workerPool=_step4.value;workerPool.destroy();}}catch(err){_iterator4.e(err);}finally{_iterator4.f();}this.workerPools=new Map();}},{key:"setProps",value:function setProps(props){this.props=_objectSpread(_objectSpread({},this.props),props);var _iterator5=_createForOfIteratorHelper(this.workerPools.values()),_step5;try{for(_iterator5.s();!(_step5=_iterator5.n()).done;){var workerPool=_step5.value;workerPool.setProps(this._getWorkerPoolProps());}}catch(err){_iterator5.e(err);}finally{_iterator5.f();}}},{key:"getWorkerPool",value:function getWorkerPool(options){var name=options.name,source=options.source,url=options.url;var workerPool=this.workerPools.get(name);if(!workerPool){workerPool=new WorkerPool({name:name,source:source,url:url});workerPool.setProps(this._getWorkerPoolProps());this.workerPools.set(name,workerPool);}return workerPool;}},{key:"_getWorkerPoolProps",value:function _getWorkerPoolProps(){return{maxConcurrency:this.props.maxConcurrency,maxMobileConcurrency:this.props.maxMobileConcurrency,reuseWorkers:this.props.reuseWorkers,onDebug:this.props.onDebug};}}],[{key:"isSupported",value:function isSupported(){return WorkerThread.isSupported();}},{key:"getWorkerFarm",value:function getWorkerFarm(){var props=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};WorkerFarm._workerFarm=WorkerFarm._workerFarm||new WorkerFarm({});WorkerFarm._workerFarm.setProps(props);return WorkerFarm._workerFarm;}}]);}();_defineProperty(WorkerFarm,"_workerFarm",void 0);var NPM_TAG='latest';function getWorkerURL(worker){var options=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};var workerOptions=options[worker.id]||{};var workerFile="".concat(worker.id,"-worker.js");var url=workerOptions.workerUrl;if(!url&&worker.id==='compression'){url=options.workerUrl;}if(options._workerType==='test'){url="modules/".concat(worker.module,"/dist/").concat(workerFile);}if(!url){var version=worker.version;if(version==='latest'){version=NPM_TAG;}var versionTag=version?"@".concat(version):'';url="https://unpkg.com/@loaders.gl/".concat(worker.module).concat(versionTag,"/dist/").concat(workerFile);}assert$8(url);return url;}function validateWorkerVersion(worker){var coreVersion=arguments.length>1&&arguments[1]!==undefined?arguments[1]:VERSION$9;assert$8(worker,'no worker provided');var workerVersion=worker.version;if(!coreVersion||!workerVersion){return false;}return true;}function canParseWithWorker(loader,options){if(!WorkerFarm.isSupported()){return false;}if(!isBrowser$4&&!(options!==null&&options!==void 0&&options._nodeWorkers)){return false;}return loader.worker&&(options===null||options===void 0?void 0:options.worker);}function parseWithWorker(_x8,_x9,_x10,_x11,_x12){return _parseWithWorker.apply(this,arguments);}function _parseWithWorker(){_parseWithWorker=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee9(loader,data,options,context,parseOnMainThread){var name,url,workerFarm,workerPool,job,result;return _regeneratorRuntime().wrap(function _callee9$(_context12){while(1)switch(_context12.prev=_context12.next){case 0:name=loader.id;url=getWorkerURL(loader,options);workerFarm=WorkerFarm.getWorkerFarm(options);workerPool=workerFarm.getWorkerPool({name:name,url:url});options=JSON.parse(JSON.stringify(options));context=JSON.parse(JSON.stringify(context||{}));_context12.next=8;return workerPool.startJob('process-on-worker',onMessage.bind(null,parseOnMainThread));case 8:job=_context12.sent;job.postMessage('process',{input:data,options:options,context:context});_context12.next=12;return job.result;case 12:result=_context12.sent;_context12.next=15;return result.result;case 15:return _context12.abrupt("return",_context12.sent);case 16:case"end":return _context12.stop();}},_callee9);}));return _parseWithWorker.apply(this,arguments);}function onMessage(_x13,_x14,_x15,_x16){return _onMessage2.apply(this,arguments);}function _onMessage2(){_onMessage2=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee10(parseOnMainThread,job,type,payload){var id,input,options,result,message;return _regeneratorRuntime().wrap(function _callee10$(_context13){while(1)switch(_context13.prev=_context13.next){case 0:_context13.t0=type;_context13.next=_context13.t0==='done'?3:_context13.t0==='error'?5:_context13.t0==='process'?7:20;break;case 3:job.done(payload);return _context13.abrupt("break",21);case 5:job.error(new Error(payload.error));return _context13.abrupt("break",21);case 7:id=payload.id,input=payload.input,options=payload.options;_context13.prev=8;_context13.next=11;return parseOnMainThread(input,options);case 11:result=_context13.sent;job.postMessage('done',{id:id,result:result});_context13.next=19;break;case 15:_context13.prev=15;_context13.t1=_context13["catch"](8);message=_context13.t1 instanceof Error?_context13.t1.message:'unknown error';job.postMessage('error',{id:id,error:message});case 19:return _context13.abrupt("break",21);case 20:console.warn("parse-with-worker unknown message ".concat(type));case 21:case"end":return _context13.stop();}},_callee10,null,[[8,15]]);}));return _onMessage2.apply(this,arguments);}function compareArrayBuffers(arrayBuffer1,arrayBuffer2,byteLength){byteLength=byteLength||arrayBuffer1.byteLength;if(arrayBuffer1.byteLength<byteLength||arrayBuffer2.byteLength<byteLength){return false;}var array1=new Uint8Array(arrayBuffer1);var array2=new Uint8Array(arrayBuffer2);for(var _i506=0;_i506<array1.length;++_i506){if(array1[_i506]!==array2[_i506]){return false;}}return true;}function concatenateArrayBuffers(){for(var _len=arguments.length,sources=new Array(_len),_key=0;_key<_len;_key++){sources[_key]=arguments[_key];}var sourceArrays=sources.map(function(source2){return source2 instanceof ArrayBuffer?new Uint8Array(source2):source2;});var byteLength=sourceArrays.reduce(function(length,typedArray){return length+typedArray.byteLength;},0);var result=new Uint8Array(byteLength);var offset=0;var _iterator6=_createForOfIteratorHelper(sourceArrays),_step6;try{for(_iterator6.s();!(_step6=_iterator6.n()).done;){var sourceArray=_step6.value;result.set(sourceArray,offset);offset+=sourceArray.byteLength;}}catch(err){_iterator6.e(err);}finally{_iterator6.f();}return result.buffer;}function concatenateArrayBuffersAsync(_x17){return _concatenateArrayBuffersAsync.apply(this,arguments);}function _concatenateArrayBuffersAsync(){_concatenateArrayBuffersAsync=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee11(asyncIterator){var arrayBuffers,_iteratorAbruptCompletion,_didIteratorError,_iteratorError,_iterator,_step,chunk;return _regeneratorRuntime().wrap(function _callee11$(_context14){while(1)switch(_context14.prev=_context14.next){case 0:arrayBuffers=[];_iteratorAbruptCompletion=false;_didIteratorError=false;_context14.prev=3;_iterator=_asyncIterator(asyncIterator);case 5:_context14.next=7;return _iterator.next();case 7:if(!(_iteratorAbruptCompletion=!(_step=_context14.sent).done)){_context14.next=13;break;}chunk=_step.value;arrayBuffers.push(chunk);case 10:_iteratorAbruptCompletion=false;_context14.next=5;break;case 13:_context14.next=19;break;case 15:_context14.prev=15;_context14.t0=_context14["catch"](3);_didIteratorError=true;_iteratorError=_context14.t0;case 19:_context14.prev=19;_context14.prev=20;if(!(_iteratorAbruptCompletion&&_iterator["return"]!=null)){_context14.next=24;break;}_context14.next=24;return _iterator["return"]();case 24:_context14.prev=24;if(!_didIteratorError){_context14.next=27;break;}throw _iteratorError;case 27:return _context14.finish(24);case 28:return _context14.finish(19);case 29:return _context14.abrupt("return",concatenateArrayBuffers.apply(void 0,arrayBuffers));case 30:case"end":return _context14.stop();}},_callee11,null,[[3,15,19,29],[20,,24,28]]);}));return _concatenateArrayBuffersAsync.apply(this,arguments);}var pathPrefix='';var fileAliases={};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;}function toArrayBuffer$1(buffer){return buffer;}function isBuffer$1(value){return value&&_typeof2(value)==='object'&&value.isBuffer;}function toArrayBuffer(data){if(isBuffer$1(data)){return toArrayBuffer$1(data);}if(data instanceof ArrayBuffer){return data;}if(ArrayBuffer.isView(data)){if(data.byteOffset===0&&data.byteLength===data.buffer.byteLength){return data.buffer;}return data.buffer.slice(data.byteOffset,data.byteOffset+data.byteLength);}if(typeof data==='string'){var text=data;var uint8Array=new TextEncoder().encode(text);return uint8Array.buffer;}if(data&&_typeof2(data)==='object'&&data._toArrayBuffer){return data._toArrayBuffer();}throw new Error('toArrayBuffer');}function filename(url){var slashIndex=url?url.lastIndexOf('/'):-1;return slashIndex>=0?url.substr(slashIndex+1):'';}function dirname(url){var slashIndex=url?url.lastIndexOf('/'):-1;return slashIndex>=0?url.substr(0,slashIndex):'';}var isBoolean=function isBoolean(x){return typeof x==='boolean';};var isFunction=function isFunction(x){return typeof x==='function';};var isObject=function isObject(x){return x!==null&&_typeof2(x)==='object';};var isPureObject=function isPureObject(x){return isObject(x)&&x.constructor==={}.constructor;};var isIterable=function isIterable(x){return x&&typeof x[Symbol.iterator]==='function';};var isAsyncIterable=function isAsyncIterable(x){return x&&typeof x[Symbol.asyncIterator]==='function';};var isResponse=function isResponse(x){return typeof Response!=='undefined'&&x instanceof Response||x&&x.arrayBuffer&&x.text&&x.json;};var isBlob=function isBlob(x){return typeof Blob!=='undefined'&&x instanceof Blob;};var isBuffer=function isBuffer(x){return x&&_typeof2(x)==='object'&&x.isBuffer;};var isReadableDOMStream=function isReadableDOMStream(x){return typeof ReadableStream!=='undefined'&&x instanceof ReadableStream||isObject(x)&&isFunction(x.tee)&&isFunction(x.cancel)&&isFunction(x.getReader);};var isReadableNodeStream=function isReadableNodeStream(x){return isObject(x)&&isFunction(x.read)&&isFunction(x.pipe)&&isBoolean(x.readable);};var isReadableStream=function isReadableStream(x){return isReadableDOMStream(x)||isReadableNodeStream(x);};var DATA_URL_PATTERN=/^data:([-\w.]+\/[-\w.+]+)(;|,)/;var MIME_TYPE_PATTERN=/^([-\w.]+\/[-\w.+]+)/;function parseMIMEType(mimeString){var matches=MIME_TYPE_PATTERN.exec(mimeString);if(matches){return matches[1];}return mimeString;}function parseMIMETypeFromURL(url){var matches=DATA_URL_PATTERN.exec(url);if(matches){return matches[1];}return'';}var QUERY_STRING_PATTERN=/\?.*/;function extractQueryString(url){var matches=url.match(QUERY_STRING_PATTERN);return matches&&matches[0];}function stripQueryString(url){return url.replace(QUERY_STRING_PATTERN,'');}function getResourceUrl(resource){if(isResponse(resource)){var response=resource;return response.url;}if(isBlob(resource)){var blob=resource;return blob.name||'';}if(typeof resource==='string'){return resource;}return'';}function getResourceMIMEType(resource){if(isResponse(resource)){var response=resource;var contentTypeHeader=response.headers.get('content-type')||'';var noQueryUrl=stripQueryString(response.url);return parseMIMEType(contentTypeHeader)||parseMIMETypeFromURL(noQueryUrl);}if(isBlob(resource)){var blob=resource;return blob.type||'';}if(typeof resource==='string'){return parseMIMETypeFromURL(resource);}return'';}function getResourceContentLength(resource){if(isResponse(resource)){var response=resource;return response.headers['content-length']||-1;}if(isBlob(resource)){var blob=resource;return blob.size;}if(typeof resource==='string'){return resource.length;}if(resource instanceof ArrayBuffer){return resource.byteLength;}if(ArrayBuffer.isView(resource)){return resource.byteLength;}return-1;}function makeResponse(_x18){return _makeResponse.apply(this,arguments);}function _makeResponse(){_makeResponse=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee12(resource){var headers,contentLength,url,type,initialDataUrl,response;return _regeneratorRuntime().wrap(function _callee12$(_context15){while(1)switch(_context15.prev=_context15.next){case 0:if(!isResponse(resource)){_context15.next=2;break;}return _context15.abrupt("return",resource);case 2:headers={};contentLength=getResourceContentLength(resource);if(contentLength>=0){headers['content-length']=String(contentLength);}url=getResourceUrl(resource);type=getResourceMIMEType(resource);if(type){headers['content-type']=type;}_context15.next=10;return getInitialDataUrl(resource);case 10:initialDataUrl=_context15.sent;if(initialDataUrl){headers['x-first-bytes']=initialDataUrl;}if(typeof resource==='string'){resource=new TextEncoder().encode(resource);}response=new Response(resource,{headers:headers});Object.defineProperty(response,'url',{value:url});return _context15.abrupt("return",response);case 16:case"end":return _context15.stop();}},_callee12);}));return _makeResponse.apply(this,arguments);}function checkResponse(_x19){return _checkResponse.apply(this,arguments);}function _checkResponse(){_checkResponse=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee13(response){var message;return _regeneratorRuntime().wrap(function _callee13$(_context16){while(1)switch(_context16.prev=_context16.next){case 0:if(response.ok){_context16.next=5;break;}_context16.next=3;return getResponseError(response);case 3:message=_context16.sent;throw new Error(message);case 5:case"end":return _context16.stop();}},_callee13);}));return _checkResponse.apply(this,arguments);}function getResponseError(_x20){return _getResponseError.apply(this,arguments);}function _getResponseError(){_getResponseError=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee14(response){var message,contentType,text;return _regeneratorRuntime().wrap(function _callee14$(_context17){while(1)switch(_context17.prev=_context17.next){case 0:message="Failed to fetch resource ".concat(response.url," (").concat(response.status,"): ");_context17.prev=1;contentType=response.headers.get('Content-Type');text=response.statusText;if(!contentType.includes('application/json')){_context17.next=11;break;}_context17.t0=text;_context17.t1=" ";_context17.next=9;return response.text();case 9:_context17.t2=_context17.sent;text=_context17.t0+=_context17.t1.concat.call(_context17.t1,_context17.t2);case 11:message+=text;message=message.length>60?"".concat(message.slice(0,60),"..."):message;_context17.next=17;break;case 15:_context17.prev=15;_context17.t3=_context17["catch"](1);case 17:return _context17.abrupt("return",message);case 18:case"end":return _context17.stop();}},_callee14,null,[[1,15]]);}));return _getResponseError.apply(this,arguments);}function getInitialDataUrl(_x21){return _getInitialDataUrl.apply(this,arguments);}function _getInitialDataUrl(){_getInitialDataUrl=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee15(resource){var INITIAL_DATA_LENGTH,blobSlice,slice,_base;return _regeneratorRuntime().wrap(function _callee15$(_context18){while(1)switch(_context18.prev=_context18.next){case 0:INITIAL_DATA_LENGTH=5;if(!(typeof resource==='string')){_context18.next=3;break;}return _context18.abrupt("return","data:,".concat(resource.slice(0,INITIAL_DATA_LENGTH)));case 3:if(!(resource instanceof Blob)){_context18.next=8;break;}blobSlice=resource.slice(0,5);_context18.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 _context18.abrupt("return",_context18.sent);case 8:if(!(resource instanceof ArrayBuffer)){_context18.next=12;break;}slice=resource.slice(0,INITIAL_DATA_LENGTH);_base=arrayBufferToBase64(slice);return _context18.abrupt("return","data:base64,".concat(_base));case 12:return _context18.abrupt("return",null);case 13:case"end":return _context18.stop();}},_callee15);}));return _getInitialDataUrl.apply(this,arguments);}function arrayBufferToBase64(buffer){var binary='';var bytes=new Uint8Array(buffer);for(var _i507=0;_i507<bytes.byteLength;_i507++){binary+=String.fromCharCode(bytes[_i507]);}return btoa(binary);}function fetchFile(_x22,_x23){return _fetchFile.apply(this,arguments);}function _fetchFile(){_fetchFile=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee16(url,options){var fetchOptions;return _regeneratorRuntime().wrap(function _callee16$(_context19){while(1)switch(_context19.prev=_context19.next){case 0:if(!(typeof url==='string')){_context19.next=7;break;}url=resolvePath(url);fetchOptions=options;if(options!==null&&options!==void 0&&options.fetch&&typeof(options===null||options===void 0?void 0:options.fetch)!=='function'){fetchOptions=options.fetch;}_context19.next=6;return fetch(url,fetchOptions);case 6:return _context19.abrupt("return",_context19.sent);case 7:_context19.next=9;return makeResponse(url);case 9:return _context19.abrupt("return",_context19.sent);case 10:case"end":return _context19.stop();}},_callee16);}));return _fetchFile.apply(this,arguments);}function isElectron(mockUserAgent){if(typeof window!=='undefined'&&_typeof2(window.process)==='object'&&window.process.type==='renderer'){return true;}if(typeof process!=='undefined'&&_typeof2(process.versions)==='object'&&Boolean(process.versions['electron'])){return true;}var realUserAgent=(typeof navigator==="undefined"?"undefined":_typeof2(navigator))==='object'&&typeof navigator.userAgent==='string'&&navigator.userAgent;var userAgent=mockUserAgent||realUserAgent;if(userAgent&&userAgent.indexOf('Electron')>=0){return true;}return false;}function isBrowser$3(){var isNode=(typeof process==="undefined"?"undefined":_typeof2(process))==='object'&&String(process)==='[object process]'&&!process.browser;return!isNode||isElectron();}var globals$2={self:typeof self!=='undefined'&&self,window:typeof window!=='undefined'&&window,global:typeof global!=='undefined'&&global,document:typeof document!=='undefined'&&document,process:(typeof process==="undefined"?"undefined":_typeof2(process))==='object'&&process};var window_=globals$2.window||globals$2.self||globals$2.global;var process_=globals$2.process||{};var VERSION$8=typeof __VERSION__!=='undefined'?__VERSION__:'untranspiled source';isBrowser$3();function getStorage(type){try{var storage=window[type];var x='__storage_test__';storage.setItem(x,x);storage.removeItem(x);return storage;}catch(e){return null;}}var LocalStorage=/*#__PURE__*/function(){function LocalStorage(id,defaultConfig){_classCallCheck(this,LocalStorage);var type=arguments.length>2&&arguments[2]!==undefined?arguments[2]:'sessionStorage';_defineProperty(this,"storage",void 0);_defineProperty(this,"id",void 0);_defineProperty(this,"config",void 0);this.storage=getStorage(type);this.id=id;this.config=defaultConfig;this._loadConfiguration();}return _createClass(LocalStorage,[{key:"getConfiguration",value:function getConfiguration(){return this.config;}},{key:"setConfiguration",value:function setConfiguration(configuration){Object.assign(this.config,configuration);if(this.storage){var serialized=JSON.stringify(this.config);this.storage.setItem(this.id,serialized);}}},{key:"_loadConfiguration",value:function _loadConfiguration(){var configuration={};if(this.storage){var serializedConfiguration=this.storage.getItem(this.id);configuration=serializedConfiguration?JSON.parse(serializedConfiguration):{};}Object.assign(this.config,configuration);return this;}}]);}();function formatTime(ms){var formatted;if(ms<10){formatted="".concat(ms.toFixed(2),"ms");}else if(ms<100){formatted="".concat(ms.toFixed(1),"ms");}else if(ms<1000){formatted="".concat(ms.toFixed(0),"ms");}else{formatted="".concat((ms/1000).toFixed(2),"s");}return formatted;}function leftPad(string){var length=arguments.length>1&&arguments[1]!==undefined?arguments[1]:8;var padLength=Math.max(length-string.length,0);return"".concat(' '.repeat(padLength)).concat(string);}function formatImage(image,message,scale){var maxWidth=arguments.length>3&&arguments[3]!==undefined?arguments[3]:600;var imageUrl=image.src.replace(/\(/g,'%28').replace(/\)/g,'%29');if(image.width>maxWidth){scale=Math.min(scale,maxWidth/image.width);}var width=image.width*scale;var height=image.height*scale;var style=['font-size:1px;',"padding:".concat(Math.floor(height/2),"px ").concat(Math.floor(width/2),"px;"),"line-height:".concat(height,"px;"),"background:url(".concat(imageUrl,");"),"background-size:".concat(width,"px ").concat(height,"px;"),'color:transparent;'].join('');return["".concat(message," %c+"),style];}var COLOR;(function(COLOR){COLOR[COLOR["BLACK"]=30]="BLACK";COLOR[COLOR["RED"]=31]="RED";COLOR[COLOR["GREEN"]=32]="GREEN";COLOR[COLOR["YELLOW"]=33]="YELLOW";COLOR[COLOR["BLUE"]=34]="BLUE";COLOR[COLOR["MAGENTA"]=35]="MAGENTA";COLOR[COLOR["CYAN"]=36]="CYAN";COLOR[COLOR["WHITE"]=37]="WHITE";COLOR[COLOR["BRIGHT_BLACK"]=90]="BRIGHT_BLACK";COLOR[COLOR["BRIGHT_RED"]=91]="BRIGHT_RED";COLOR[COLOR["BRIGHT_GREEN"]=92]="BRIGHT_GREEN";COLOR[COLOR["BRIGHT_YELLOW"]=93]="BRIGHT_YELLOW";COLOR[COLOR["BRIGHT_BLUE"]=94]="BRIGHT_BLUE";COLOR[COLOR["BRIGHT_MAGENTA"]=95]="BRIGHT_MAGENTA";COLOR[COLOR["BRIGHT_CYAN"]=96]="BRIGHT_CYAN";COLOR[COLOR["BRIGHT_WHITE"]=97]="BRIGHT_WHITE";})(COLOR||(COLOR={}));function getColor(color){return typeof color==='string'?COLOR[color.toUpperCase()]||COLOR.WHITE:color;}function addColor(string,color,background){if(!isBrowser$3&&typeof string==='string'){if(color){color=getColor(color);string="\x1B[".concat(color,"m").concat(string,"\x1B[39m");}if(background){color=getColor(background);string="\x1B[".concat(background+10,"m").concat(string,"\x1B[49m");}}return string;}function autobind(obj){var predefined=arguments.length>1&&arguments[1]!==undefined?arguments[1]:['constructor'];var proto=Object.getPrototypeOf(obj);var propNames=Object.getOwnPropertyNames(proto);var _iterator7=_createForOfIteratorHelper(propNames),_step7;try{var _loop3=function _loop3(){var key=_step7.value;if(typeof obj[key]==='function'){if(!predefined.find(function(name){return key===name;})){obj[key]=obj[key].bind(obj);}}};for(_iterator7.s();!(_step7=_iterator7.n()).done;){_loop3();}}catch(err){_iterator7.e(err);}finally{_iterator7.f();}}function assert$7(condition,message){if(!condition){throw new Error(message||'Assertion failed');}}function getHiResTimestamp(){var timestamp;if(isBrowser$3&&'performance'in window_){var _window$performance,_window$performance$n;timestamp=window_===null||window_===void 0?void 0:(_window$performance=window_.performance)===null||_window$performance===void 0?void 0:(_window$performance$n=_window$performance.now)===null||_window$performance$n===void 0?void 0:_window$performance$n.call(_window$performance);}else if('hrtime'in process_){var _process$hrtime;var timeParts=process_===null||process_===void 0?void 0:(_process$hrtime=process_.hrtime)===null||_process$hrtime===void 0?void 0:_process$hrtime.call(process_);timestamp=timeParts[0]*1000+timeParts[1]/1e6;}else{timestamp=Date.now();}return timestamp;}var originalConsole={debug:isBrowser$3?console.debug||console.log:console.log,log:console.log,info:console.info,warn:console.warn,error:console.error};var DEFAULT_SETTINGS={enabled:true,level:0};function noop(){}var cache={};var ONCE={once:true};var Log=/*#__PURE__*/function(){function Log(){_classCallCheck(this,Log);var _ref16=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{id:''},id=_ref16.id;_defineProperty(this,"id",void 0);_defineProperty(this,"VERSION",VERSION$8);_defineProperty(this,"_startTs",getHiResTimestamp());_defineProperty(this,"_deltaTs",getHiResTimestamp());_defineProperty(this,"_storage",void 0);_defineProperty(this,"userData",{});_defineProperty(this,"LOG_THROTTLE_TIMEOUT",0);this.id=id;this.userData={};this._storage=new LocalStorage("__probe-".concat(this.id,"__"),DEFAULT_SETTINGS);this.timeStamp("".concat(this.id," started"));autobind(this);Object.seal(this);}return _createClass(Log,[{key:"level",get:function get(){return this.getLevel();},set:function set(newLevel){this.setLevel(newLevel);}},{key:"isEnabled",value:function isEnabled(){return this._storage.config.enabled;}},{key:"getLevel",value:function getLevel(){return this._storage.config.level;}},{key:"getTotal",value:function getTotal(){return Number((getHiResTimestamp()-this._startTs).toPrecision(10));}},{key:"getDelta",value:function getDelta(){return Number((getHiResTimestamp()-this._deltaTs).toPrecision(10));}},{key:"priority",get:function get(){return this.level;},set:function set(newPriority){this.level=newPriority;}},{key:"getPriority",value:function getPriority(){return this.level;}},{key:"enable",value:function enable(){var enabled=arguments.length>0&&arguments[0]!==undefined?arguments[0]:true;this._storage.setConfiguration({enabled:enabled});return this;}},{key:"setLevel",value:function setLevel(level){this._storage.setConfiguration({level:level});return this;}},{key:"get",value:function get(setting){return this._storage.config[setting];}},{key:"set",value:function set(setting,value){this._storage.setConfiguration(_defineProperty2({},setting,value));}},{key:"settings",value:function settings(){if(console.table){console.table(this._storage.config);}else{console.log(this._storage.config);}}},{key:"assert",value:function assert(condition,message){assert$7(condition,message);}},{key:"warn",value:function warn(message){return this._getLogFunction(0,message,originalConsole.warn,arguments,ONCE);}},{key:"error",value:function error(message){return this._getLogFunction(0,message,originalConsole.error,arguments);}},{key:"deprecated",value:function deprecated(oldUsage,newUsage){return this.warn("`".concat(oldUsage,"` is deprecated and will be removed in a later version. Use `").concat(newUsage,"` instead"));}},{key:"removed",value:function removed(oldUsage,newUsage){return this.error("`".concat(oldUsage,"` has been removed. Use `").concat(newUsage,"` instead"));}},{key:"probe",value:function probe(logLevel,message){return this._getLogFunction(logLevel,message,originalConsole.log,arguments,{time:true,once:true});}},{key:"log",value:function log(logLevel,message){return this._getLogFunction(logLevel,message,originalConsole.debug,arguments);}},{key:"info",value:function info(logLevel,message){return this._getLogFunction(logLevel,message,console.info,arguments);}},{key:"once",value:function once(logLevel,message){for(var _len=arguments.length,args=new Array(_len>2?_len-2:0),_key=2;_key<_len;_key++){args[_key-2]=arguments[_key];}return this._getLogFunction(logLevel,message,originalConsole.debug||originalConsole.info,arguments,ONCE);}},{key:"table",value:function table(logLevel,_table,columns){if(_table){return this._getLogFunction(logLevel,_table,console.table||noop,columns&&[columns],{tag:getTableHeader(_table)});}return noop;}},{key:"image",value:function image(_ref){var logLevel=_ref.logLevel,priority=_ref.priority,image=_ref.image,_ref$message=_ref.message,message=_ref$message===void 0?'':_ref$message,_ref$scale=_ref.scale,scale=_ref$scale===void 0?1:_ref$scale;if(!this._shouldLog(logLevel||priority)){return noop;}return isBrowser$3?logImageInBrowser({image:image,message:message,scale:scale}):logImageInNode();}},{key:"time",value:function time(logLevel,message){return this._getLogFunction(logLevel,message,console.time?console.time:console.info);}},{key:"timeEnd",value:function timeEnd(logLevel,message){return this._getLogFunction(logLevel,message,console.timeEnd?console.timeEnd:console.info);}},{key:"timeStamp",value:function timeStamp(logLevel,message){return this._getLogFunction(logLevel,message,console.timeStamp||noop);}},{key:"group",value:function group(logLevel,message){var opts=arguments.length>2&&arguments[2]!==undefined?arguments[2]:{collapsed:false};var options=normalizeArguments({logLevel:logLevel,message:message,opts:opts});var collapsed=opts.collapsed;options.method=(collapsed?console.groupCollapsed:console.group)||console.info;return this._getLogFunction(options);}},{key:"groupCollapsed",value:function groupCollapsed(logLevel,message){var opts=arguments.length>2&&arguments[2]!==undefined?arguments[2]:{};return this.group(logLevel,message,Object.assign({},opts,{collapsed:true}));}},{key:"groupEnd",value:function groupEnd(logLevel){return this._getLogFunction(logLevel,'',console.groupEnd||noop);}},{key:"withGroup",value:function withGroup(logLevel,message,func){this.group(logLevel,message)();try{func();}finally{this.groupEnd(logLevel)();}}},{key:"trace",value:function trace(){if(console.trace){console.trace();}}},{key:"_shouldLog",value:function _shouldLog(logLevel){return this.isEnabled()&&this.getLevel()>=normalizeLogLevel(logLevel);}},{key:"_getLogFunction",value:function _getLogFunction(logLevel,message,method,args,opts){if(this._shouldLog(logLevel)){var _method;opts=normalizeArguments({logLevel:logLevel,message:message,args:args,opts:opts});method=method||opts.method;assert$7(method);opts.total=this.getTotal();opts.delta=this.getDelta();this._deltaTs=getHiResTimestamp();var tag=opts.tag||opts.message;if(opts.once){if(!cache[tag]){cache[tag]=getHiResTimestamp();}else{return noop;}}message=decorateMessage(this.id,opts.message,opts);return(_method=method).bind.apply(_method,[console,message].concat(_toConsumableArray(opts.args)));}return noop;}}]);}();_defineProperty(Log,"VERSION",VERSION$8);function normalizeLogLevel(logLevel){if(!logLevel){return 0;}var resolvedLevel;switch(_typeof2(logLevel)){case'number':resolvedLevel=logLevel;break;case'object':resolvedLevel=logLevel.logLevel||logLevel.priority||0;break;default:return 0;}assert$7(Number.isFinite(resolvedLevel)&&resolvedLevel>=0);return resolvedLevel;}function normalizeArguments(opts){var logLevel=opts.logLevel,message=opts.message;opts.logLevel=normalizeLogLevel(logLevel);var args=opts.args?Array.from(opts.args):[];while(args.length&&args.shift()!==message){}switch(_typeof2(logLevel)){case'string':case'function':if(message!==undefined){args.unshift(message);}opts.message=logLevel;break;case'object':Object.assign(opts,logLevel);break;}if(typeof opts.message==='function'){opts.message=opts.message();}var messageType=_typeof2(opts.message);assert$7(messageType==='string'||messageType==='object');return Object.assign(opts,{args:args},opts.opts);}function decorateMessage(id,message,opts){if(typeof message==='string'){var _time=opts.time?leftPad(formatTime(opts.total)):'';message=opts.time?"".concat(id,": ").concat(_time," ").concat(message):"".concat(id,": ").concat(message);message=addColor(message,opts.color,opts.background);}return message;}function logImageInNode(_ref2){console.warn('removed');return noop;}function logImageInBrowser(_ref3){var image=_ref3.image,_ref3$message=_ref3.message,message=_ref3$message===void 0?'':_ref3$message,_ref3$scale=_ref3.scale,scale=_ref3$scale===void 0?1:_ref3$scale;if(typeof image==='string'){var img=new Image();img.onload=function(){var _console;var args=formatImage(img,message,scale);(_console=console).log.apply(_console,_toConsumableArray(args));};img.src=image;return noop;}var element=image.nodeName||'';if(element.toLowerCase()==='img'){var _console2;(_console2=console).log.apply(_console2,_toConsumableArray(formatImage(image,message,scale)));return noop;}if(element.toLowerCase()==='canvas'){var _img=new Image();_img.onload=function(){var _console3;return(_console3=console).log.apply(_console3,_toConsumableArray(formatImage(_img,message,scale)));};_img.src=image.toDataURL();return noop;}return noop;}function getTableHeader(table){for(var key in table){for(var title in table[key]){return title||'untitled';}}return'empty';}var probeLog=new Log({id:'loaders.gl'});var NullLog=/*#__PURE__*/function(){function NullLog(){_classCallCheck(this,NullLog);}return _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(){};}}]);}();var ConsoleLog=/*#__PURE__*/function(){function ConsoleLog(){_classCallCheck(this,ConsoleLog);_defineProperty(this,"console",void 0);this.console=console;}return _createClass(ConsoleLog,[{key:"log",value:function log(){var _this$console$log;for(var _len=arguments.length,args=new Array(_len),_key=0;_key<_len;_key++){args[_key]=arguments[_key];}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 _len2=arguments.length,args=new Array(_len2),_key2=0;_key2<_len2;_key2++){args[_key2]=arguments[_key2];}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 _len3=arguments.length,args=new Array(_len3),_key3=0;_key3<_len3;_key3++){args[_key3]=arguments[_key3];}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 _len4=arguments.length,args=new Array(_len4),_key4=0;_key4<_len4;_key4++){args[_key4]=arguments[_key4];}return(_this$console$error=this.console.error).bind.apply(_this$console$error,[this.console].concat(args));}}]);}();var DEFAULT_LOADER_OPTIONS={fetch:null,mimeType:undefined,nothrow:false,log:new ConsoleLog(),CDN:'https://unpkg.com/@loaders.gl',worker:true,maxConcurrency:3,maxMobileConcurrency:1,reuseWorkers:isBrowser$5,_nodeWorkers:false,_workerType:'',limit:0,_limitMB:0,batchSize:'auto',batchDebounceMs:0,metadata:false,transforms:[]};var REMOVED_LOADER_OPTIONS={"throws":'nothrow',dataType:'(no longer used)',uri:'baseUri',method:'fetch.method',headers:'fetch.headers',body:'fetch.body',mode:'fetch.mode',credentials:'fetch.credentials',cache:'fetch.cache',redirect:'fetch.redirect',referrer:'fetch.referrer',referrerPolicy:'fetch.referrerPolicy',integrity:'fetch.integrity',keepalive:'fetch.keepalive',signal:'fetch.signal'};function getGlobalLoaderState(){globalThis.loaders=globalThis.loaders||{};var loaders=globalThis.loaders;loaders._state=loaders._state||{};return loaders._state;}var getGlobalLoaderOptions=function getGlobalLoaderOptions(){var state=getGlobalLoaderState();state.globalOptions=state.globalOptions||_objectSpread({},DEFAULT_LOADER_OPTIONS);return state.globalOptions;};function normalizeOptions(options,loader,loaders,url){loaders=loaders||[];loaders=Array.isArray(loaders)?loaders:[loaders];validateOptions(options,loaders);return normalizeOptionsInternal(loader,options,url);}function validateOptions(options,loaders){validateOptionsObject(options,null,DEFAULT_LOADER_OPTIONS,REMOVED_LOADER_OPTIONS,loaders);var _iterator8=_createForOfIteratorHelper(loaders),_step8;try{for(_iterator8.s();!(_step8=_iterator8.n()).done;){var loader=_step8.value;var idOptions=options&&options[loader.id]||{};var loaderOptions=loader.options&&loader.options[loader.id]||{};var deprecatedOptions=loader.deprecatedOptions&&loader.deprecatedOptions[loader.id]||{};validateOptionsObject(idOptions,loader.id,loaderOptions,deprecatedOptions,loaders);}}catch(err){_iterator8.e(err);}finally{_iterator8.f();}}function validateOptionsObject(options,id,defaultOptions,deprecatedOptions,loaders){var loaderName=id||'Top level';var prefix=id?"".concat(id,"."):'';for(var key in options){var isSubOptions=!id&&isObject(options[key]);var isBaseUriOption=key==='baseUri'&&!id;var isWorkerUrlOption=key==='workerUrl'&&id;if(!(key in defaultOptions)&&!isBaseUriOption&&!isWorkerUrlOption){if(key in deprecatedOptions){probeLog.warn("".concat(loaderName," loader option '").concat(prefix).concat(key,"' no longer supported, use '").concat(deprecatedOptions[key],"'"))();}else if(!isSubOptions){var suggestion=findSimilarOption(key,loaders);probeLog.warn("".concat(loaderName," loader option '").concat(prefix).concat(key,"' not recognized. ").concat(suggestion))();}}}}function findSimilarOption(optionKey,loaders){var lowerCaseOptionKey=optionKey.toLowerCase();var bestSuggestion='';var _iterator9=_createForOfIteratorHelper(loaders),_step9;try{for(_iterator9.s();!(_step9=_iterator9.n()).done;){var loader=_step9.value;for(var key in loader.options){if(optionKey===key){return"Did you mean '".concat(loader.id,".").concat(key,"'?");}var lowerCaseKey=key.toLowerCase();var isPartialMatch=lowerCaseOptionKey.startsWith(lowerCaseKey)||lowerCaseKey.startsWith(lowerCaseOptionKey);if(isPartialMatch){bestSuggestion=bestSuggestion||"Did you mean '".concat(loader.id,".").concat(key,"'?");}}}}catch(err){_iterator9.e(err);}finally{_iterator9.f();}return bestSuggestion;}function normalizeOptionsInternal(loader,options,url){var loaderDefaultOptions=loader.options||{};var mergedOptions=_objectSpread({},loaderDefaultOptions);addUrlOptions(mergedOptions,url);if(mergedOptions.log===null){mergedOptions.log=new NullLog();}mergeNestedFields(mergedOptions,getGlobalLoaderOptions());mergeNestedFields(mergedOptions,options);return mergedOptions;}function mergeNestedFields(mergedOptions,options){for(var key in options){if(key in options){var value=options[key];if(isPureObject(value)&&isPureObject(mergedOptions[key])){mergedOptions[key]=_objectSpread(_objectSpread({},mergedOptions[key]),options[key]);}else{mergedOptions[key]=options[key];}}}}function addUrlOptions(options,url){if(url&&!('baseUri'in options)){options.baseUri=url;}}function isLoaderObject(loader){var _loader;if(!loader){return false;}if(Array.isArray(loader)){loader=loader[0];}var hasExtensions=Array.isArray((_loader=loader)===null||_loader===void 0?void 0:_loader.extensions);return hasExtensions;}function normalizeLoader(loader){var _loader2,_loader3;assert$9(loader,'null loader');assert$9(isLoaderObject(loader),'invalid loader');var options;if(Array.isArray(loader)){options=loader[1];loader=loader[0];loader=_objectSpread(_objectSpread({},loader),{},{options:_objectSpread(_objectSpread({},loader.options),options)});}if((_loader2=loader)!==null&&_loader2!==void 0&&_loader2.parseTextSync||(_loader3=loader)!==null&&_loader3!==void 0&&_loader3.parseText){loader.text=true;}if(!loader.text){loader.binary=true;}return loader;}var getGlobalLoaderRegistry=function getGlobalLoaderRegistry(){var state=getGlobalLoaderState();state.loaderRegistry=state.loaderRegistry||[];return state.loaderRegistry;};function getRegisteredLoaders(){return getGlobalLoaderRegistry();}var log=new Log({id:'loaders.gl'});var EXT_PATTERN=/\.([^.]+)$/;function selectLoader(_x24){return _selectLoader.apply(this,arguments);}function _selectLoader(){_selectLoader=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee17(data){var loaders,options,context,loader,_args13=arguments;return _regeneratorRuntime().wrap(function _callee17$(_context20){while(1)switch(_context20.prev=_context20.next){case 0:loaders=_args13.length>1&&_args13[1]!==undefined?_args13[1]:[];options=_args13.length>2?_args13[2]:undefined;context=_args13.length>3?_args13[3]:undefined;if(validHTTPResponse(data)){_context20.next=5;break;}return _context20.abrupt("return",null);case 5:loader=selectLoaderSync(data,loaders,_objectSpread(_objectSpread({},options),{},{nothrow:true}),context);if(!loader){_context20.next=8;break;}return _context20.abrupt("return",loader);case 8:if(!isBlob(data)){_context20.next=13;break;}_context20.next=11;return data.slice(0,10).arrayBuffer();case 11:data=_context20.sent;loader=selectLoaderSync(data,loaders,options,context);case 13:if(!(!loader&&!(options!==null&&options!==void 0&&options.nothrow))){_context20.next=15;break;}throw new Error(getNoValidLoaderMessage(data));case 15:return _context20.abrupt("return",loader);case 16:case"end":return _context20.stop();}},_callee17);}));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;}if(loaders&&!Array.isArray(loaders)){return normalizeLoader(loaders);}var candidateLoaders=[];if(loaders){candidateLoaders=candidateLoaders.concat(loaders);}if(!(options!==null&&options!==void 0&&options.ignoreRegisteredLoaders)){var _candidateLoaders;(_candidateLoaders=candidateLoaders).push.apply(_candidateLoaders,_toConsumableArray(getRegisteredLoaders()));}normalizeLoaders(candidateLoaders);var loader=selectLoaderInternal(data,candidateLoaders,options,context);if(!loader&&!(options!==null&&options!==void 0&&options.nothrow)){throw new Error(getNoValidLoaderMessage(data));}return loader;}function selectLoaderInternal(data,loaders,options,context){var url=getResourceUrl(data);var type=getResourceMIMEType(data);var testUrl=stripQueryString(url)||(context===null||context===void 0?void 0:context.url);var loader=null;var reason='';if(options!==null&&options!==void 0&&options.mimeType){loader=findLoaderByMIMEType(loaders,options===null||options===void 0?void 0:options.mimeType);reason="match forced by supplied MIME type ".concat(options===null||options===void 0?void 0:options.mimeType);}loader=loader||findLoaderByUrl(loaders,testUrl);reason=reason||(loader?"matched url ".concat(testUrl):'');loader=loader||findLoaderByMIMEType(loaders,type);reason=reason||(loader?"matched MIME type ".concat(type):'');loader=loader||findLoaderByInitialBytes(loaders,data);reason=reason||(loader?"matched initial data ".concat(getFirstCharacters$1(data)):'');loader=loader||findLoaderByMIMEType(loaders,options===null||options===void 0?void 0:options.fallbackMimeType);reason=reason||(loader?"matched fallback MIME type ".concat(type):'');if(reason){var _loader;log.log(1,"selectLoader selected ".concat((_loader=loader)===null||_loader===void 0?void 0:_loader.name,": ").concat(reason,"."));}return loader;}function validHTTPResponse(data){if(data instanceof Response){if(data.status===204){return false;}}return true;}function getNoValidLoaderMessage(data){var url=getResourceUrl(data);var type=getResourceMIMEType(data);var message='No valid loader found (';message+=url?"".concat(filename(url),", "):'no url provided, ';message+="MIME type: ".concat(type?"\"".concat(type,"\""):'not provided',", ");var firstCharacters=data?getFirstCharacters$1(data):'';message+=firstCharacters?" first bytes: \"".concat(firstCharacters,"\""):'first bytes: not available';message+=')';return message;}function normalizeLoaders(loaders){var _iterator10=_createForOfIteratorHelper(loaders),_step10;try{for(_iterator10.s();!(_step10=_iterator10.n()).done;){var loader=_step10.value;normalizeLoader(loader);}}catch(err){_iterator10.e(err);}finally{_iterator10.f();}}function findLoaderByUrl(loaders,url){var match=url&&EXT_PATTERN.exec(url);var extension=match&&match[1];return extension?findLoaderByExtension(loaders,extension):null;}function findLoaderByExtension(loaders,extension){extension=extension.toLowerCase();var _iterator11=_createForOfIteratorHelper(loaders),_step11;try{for(_iterator11.s();!(_step11=_iterator11.n()).done;){var loader=_step11.value;var _iterator12=_createForOfIteratorHelper(loader.extensions),_step12;try{for(_iterator12.s();!(_step12=_iterator12.n()).done;){var loaderExtension=_step12.value;if(loaderExtension.toLowerCase()===extension){return loader;}}}catch(err){_iterator12.e(err);}finally{_iterator12.f();}}}catch(err){_iterator11.e(err);}finally{_iterator11.f();}return null;}function findLoaderByMIMEType(loaders,mimeType){var _iterator13=_createForOfIteratorHelper(loaders),_step13;try{for(_iterator13.s();!(_step13=_iterator13.n()).done;){var loader=_step13.value;if(loader.mimeTypes&&loader.mimeTypes.includes(mimeType)){return loader;}if(mimeType==="application/x.".concat(loader.id)){return loader;}}}catch(err){_iterator13.e(err);}finally{_iterator13.f();}return null;}function findLoaderByInitialBytes(loaders,data){if(!data){return null;}var _iterator14=_createForOfIteratorHelper(loaders),_step14;try{for(_iterator14.s();!(_step14=_iterator14.n()).done;){var loader=_step14.value;if(typeof data==='string'){if(testDataAgainstText(data,loader)){return loader;}}else if(ArrayBuffer.isView(data)){if(testDataAgainstBinary(data.buffer,data.byteOffset,loader)){return loader;}}else if(data instanceof ArrayBuffer){var byteOffset=0;if(testDataAgainstBinary(data,byteOffset,loader)){return loader;}}}}catch(err){_iterator14.e(err);}finally{_iterator14.f();}return null;}function testDataAgainstText(data,loader){if(loader.testText){return loader.testText(data);}var tests=Array.isArray(loader.tests)?loader.tests:[loader.tests];return tests.some(function(test){return data.startsWith(test);});}function testDataAgainstBinary(data,byteOffset,loader){var tests=Array.isArray(loader.tests)?loader.tests:[loader.tests];return tests.some(function(test){return testBinary(data,byteOffset,loader,test);});}function testBinary(data,byteOffset,loader,test){if(test instanceof ArrayBuffer){return compareArrayBuffers(test,data,test.byteLength);}switch(_typeof2(test)){case'function':return test(data,loader);case'string':var magic=getMagicString$2(data,byteOffset,test.length);return test===magic;default:return false;}}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)){return getMagicString$2(data.buffer,data.byteOffset,length);}else if(data instanceof ArrayBuffer){var byteOffset=0;return getMagicString$2(data,byteOffset,length);}return'';}function getMagicString$2(arrayBuffer,byteOffset,length){if(arrayBuffer.byteLength<byteOffset+length){return'';}var dataView=new DataView(arrayBuffer);var magic='';for(var _i508=0;_i508<length;_i508++){magic+=String.fromCharCode(dataView.getUint8(byteOffset+_i508));}return magic;}var DEFAULT_CHUNK_SIZE$2=256*1024;function makeStringIterator(string,options){var chunkSize,offset,textEncoder,chunkLength,chunk;return _regeneratorRuntime().wrap(function makeStringIterator$(_context5){while(1)switch(_context5.prev=_context5.next){case 0:chunkSize=(options===null||options===void 0?void 0:options.chunkSize)||DEFAULT_CHUNK_SIZE$2;offset=0;textEncoder=new TextEncoder();case 3:if(!(offset<string.length)){_context5.next=11;break;}chunkLength=Math.min(string.length-offset,chunkSize);chunk=string.slice(offset,offset+chunkLength);offset+=chunkLength;_context5.next=9;return textEncoder.encode(chunk);case 9:_context5.next=3;break;case 11:case"end":return _context5.stop();}},_marked);}var DEFAULT_CHUNK_SIZE$1=256*1024;function makeArrayBufferIterator(arrayBuffer){var options=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};return/*#__PURE__*/_regeneratorRuntime().mark(function _callee4(){var _options$chunkSize,chunkSize,byteOffset,chunkByteLength,chunk,sourceArray,_chunkArray;return _regeneratorRuntime().wrap(function _callee4$(_context6){while(1)switch(_context6.prev=_context6.next){case 0:_options$chunkSize=options.chunkSize,chunkSize=_options$chunkSize===void 0?DEFAULT_CHUNK_SIZE$1:_options$chunkSize;byteOffset=0;case 2:if(!(byteOffset<arrayBuffer.byteLength)){_context6.next=13;break;}chunkByteLength=Math.min(arrayBuffer.byteLength-byteOffset,chunkSize);chunk=new ArrayBuffer(chunkByteLength);sourceArray=new Uint8Array(arrayBuffer,byteOffset,chunkByteLength);_chunkArray=new Uint8Array(chunk);_chunkArray.set(sourceArray);byteOffset+=chunkByteLength;_context6.next=11;return chunk;case 11:_context6.next=2;break;case 13:case"end":return _context6.stop();}},_callee4);})();}var DEFAULT_CHUNK_SIZE=1024*1024;function makeBlobIterator(_x,_x2){return _makeBlobIterator.apply(this,arguments);}function _makeBlobIterator(){_makeBlobIterator=_wrapAsyncGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee5(blob,options){var chunkSize,offset,end,chunk;return _regeneratorRuntime().wrap(function _callee5$(_context7){while(1)switch(_context7.prev=_context7.next){case 0:chunkSize=(options===null||options===void 0?void 0:options.chunkSize)||DEFAULT_CHUNK_SIZE;offset=0;case 2:if(!(offset<blob.size)){_context7.next=12;break;}end=offset+chunkSize;_context7.next=6;return _awaitAsyncGenerator(blob.slice(offset,end).arrayBuffer());case 6:chunk=_context7.sent;offset=end;_context7.next=10;return chunk;case 10:_context7.next=2;break;case 12:case"end":return _context7.stop();}},_callee5);}));return _makeBlobIterator.apply(this,arguments);}function makeStreamIterator(stream,options){return isBrowser$5?makeBrowserStreamIterator(stream,options):makeNodeStreamIterator(stream);}function makeBrowserStreamIterator(_x3,_x4){return _makeBrowserStreamIterator.apply(this,arguments);}function _makeBrowserStreamIterator(){_makeBrowserStreamIterator=_wrapAsyncGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee6(stream,options){var reader,nextBatchPromise,currentBatchPromise,_yield$_awaitAsyncGen,done,value;return _regeneratorRuntime().wrap(function _callee6$(_context8){while(1)switch(_context8.prev=_context8.next){case 0:reader=stream.getReader();_context8.prev=1;case 2:if(!true){_context8.next=16;break;}currentBatchPromise=nextBatchPromise||reader.read();if(options!==null&&options!==void 0&&options._streamReadAhead){nextBatchPromise=reader.read();}_context8.next=7;return _awaitAsyncGenerator(currentBatchPromise);case 7:_yield$_awaitAsyncGen=_context8.sent;done=_yield$_awaitAsyncGen.done;value=_yield$_awaitAsyncGen.value;if(!done){_context8.next=12;break;}return _context8.abrupt("return");case 12:_context8.next=14;return toArrayBuffer(value);case 14:_context8.next=2;break;case 16:_context8.next=21;break;case 18:_context8.prev=18;_context8.t0=_context8["catch"](1);reader.releaseLock();case 21:case"end":return _context8.stop();}},_callee6,null,[[1,18]]);}));return _makeBrowserStreamIterator.apply(this,arguments);}function makeNodeStreamIterator(_x5,_x6){return _makeNodeStreamIterator.apply(this,arguments);}function _makeNodeStreamIterator(){_makeNodeStreamIterator=_wrapAsyncGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee7(stream,options){var _iteratorAbruptCompletion2,_didIteratorError2,_iteratorError2,_iterator2,_step2,chunk;return _regeneratorRuntime().wrap(function _callee7$(_context9){while(1)switch(_context9.prev=_context9.next){case 0:_iteratorAbruptCompletion2=false;_didIteratorError2=false;_context9.prev=2;_iterator2=_asyncIterator(stream);case 4:_context9.next=6;return _awaitAsyncGenerator(_iterator2.next());case 6:if(!(_iteratorAbruptCompletion2=!(_step2=_context9.sent).done)){_context9.next=13;break;}chunk=_step2.value;_context9.next=10;return toArrayBuffer(chunk);case 10:_iteratorAbruptCompletion2=false;_context9.next=4;break;case 13:_context9.next=19;break;case 15:_context9.prev=15;_context9.t0=_context9["catch"](2);_didIteratorError2=true;_iteratorError2=_context9.t0;case 19:_context9.prev=19;_context9.prev=20;if(!(_iteratorAbruptCompletion2&&_iterator2["return"]!=null)){_context9.next=24;break;}_context9.next=24;return _awaitAsyncGenerator(_iterator2["return"]());case 24:_context9.prev=24;if(!_didIteratorError2){_context9.next=27;break;}throw _iteratorError2;case 27:return _context9.finish(24);case 28:return _context9.finish(19);case 29:case"end":return _context9.stop();}},_callee7,null,[[2,15,19,29],[20,,24,28]]);}));return _makeNodeStreamIterator.apply(this,arguments);}function makeIterator(data,options){if(typeof data==='string'){return makeStringIterator(data,options);}if(data instanceof ArrayBuffer){return makeArrayBufferIterator(data,options);}if(isBlob(data)){return makeBlobIterator(data,options);}if(isReadableStream(data)){return makeStreamIterator(data,options);}if(isResponse(data)){var response=data;return makeStreamIterator(response.body,options);}throw new Error('makeIterator');}var ERR_DATA='Cannot convert supplied data type';function getArrayBufferOrStringFromDataSync(data,loader,options){if(loader.text&&typeof data==='string'){return data;}if(isBuffer(data)){data=data.buffer;}if(data instanceof ArrayBuffer){var arrayBuffer=data;if(loader.text&&!loader.binary){var textDecoder=new TextDecoder('utf8');return textDecoder.decode(arrayBuffer);}return arrayBuffer;}if(ArrayBuffer.isView(data)){if(loader.text&&!loader.binary){var _textDecoder=new TextDecoder('utf8');return _textDecoder.decode(data);}var _arrayBuffer=data.buffer;var byteLength=data.byteLength||data.length;if(data.byteOffset!==0||byteLength!==_arrayBuffer.byteLength){_arrayBuffer=_arrayBuffer.slice(data.byteOffset,data.byteOffset+byteLength);}return _arrayBuffer;}throw new Error(ERR_DATA);}function getArrayBufferOrStringFromData(_x25,_x26,_x27){return _getArrayBufferOrStringFromData.apply(this,arguments);}function _getArrayBufferOrStringFromData(){_getArrayBufferOrStringFromData=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee18(data,loader,options){var isArrayBuffer,response;return _regeneratorRuntime().wrap(function _callee18$(_context21){while(1)switch(_context21.prev=_context21.next){case 0:isArrayBuffer=data instanceof ArrayBuffer||ArrayBuffer.isView(data);if(!(typeof data==='string'||isArrayBuffer)){_context21.next=3;break;}return _context21.abrupt("return",getArrayBufferOrStringFromDataSync(data,loader));case 3:if(!isBlob(data)){_context21.next=7;break;}_context21.next=6;return makeResponse(data);case 6:data=_context21.sent;case 7:if(!isResponse(data)){_context21.next=21;break;}response=data;_context21.next=11;return checkResponse(response);case 11:if(!loader.binary){_context21.next=17;break;}_context21.next=14;return response.arrayBuffer();case 14:_context21.t0=_context21.sent;_context21.next=20;break;case 17:_context21.next=19;return response.text();case 19:_context21.t0=_context21.sent;case 20:return _context21.abrupt("return",_context21.t0);case 21:if(isReadableStream(data)){data=makeIterator(data,options);}if(!(isIterable(data)||isAsyncIterable(data))){_context21.next=24;break;}return _context21.abrupt("return",concatenateArrayBuffersAsync(data));case 24:throw new Error(ERR_DATA);case 25:case"end":return _context21.stop();}},_callee18);}));return _getArrayBufferOrStringFromData.apply(this,arguments);}function getFetchFunction(options,context){var globalOptions=getGlobalLoaderOptions();var fetchOptions=options||globalOptions;if(typeof fetchOptions.fetch==='function'){return fetchOptions.fetch;}if(isObject(fetchOptions.fetch)){return function(url){return fetchFile(url,fetchOptions);};}if(context!==null&&context!==void 0&&context.fetch){return context===null||context===void 0?void 0:context.fetch;}return fetchFile;}function getLoaderContext(context,options,parentContext){if(parentContext){return parentContext;}var newContext=_objectSpread({fetch:getFetchFunction(options,context)},context);if(newContext.url){var baseUrl=stripQueryString(newContext.url);newContext.baseUrl=baseUrl;newContext.queryString=extractQueryString(newContext.url);newContext.filename=filename(baseUrl);newContext.baseUrl=dirname(baseUrl);}if(!Array.isArray(newContext.loaders)){newContext.loaders=null;}return newContext;}function getLoadersFromContext(loaders,context){if(!context&&loaders&&!Array.isArray(loaders)){return loaders;}var candidateLoaders;if(loaders){candidateLoaders=Array.isArray(loaders)?loaders:[loaders];}if(context&&context.loaders){var contextLoaders=Array.isArray(context.loaders)?context.loaders:[context.loaders];candidateLoaders=candidateLoaders?[].concat(_toConsumableArray(candidateLoaders),_toConsumableArray(contextLoaders)):contextLoaders;}return candidateLoaders&&candidateLoaders.length?candidateLoaders:null;}function parse$2(_x28,_x29,_x30,_x31){return _parse$.apply(this,arguments);}function _parse$(){_parse$=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee19(data,loaders,options,context){var url,typedLoaders,candidateLoaders,loader;return _regeneratorRuntime().wrap(function _callee19$(_context22){while(1)switch(_context22.prev=_context22.next){case 0:assert$8(!context||_typeof2(context)==='object');if(loaders&&!Array.isArray(loaders)&&!isLoaderObject(loaders)){context=undefined;options=loaders;loaders=undefined;}_context22.next=4;return data;case 4:data=_context22.sent;options=options||{};url=getResourceUrl(data);typedLoaders=loaders;candidateLoaders=getLoadersFromContext(typedLoaders,context);_context22.next=11;return selectLoader(data,candidateLoaders,options);case 11:loader=_context22.sent;if(loader){_context22.next=14;break;}return _context22.abrupt("return",null);case 14:options=normalizeOptions(options,loader,candidateLoaders,url);context=getLoaderContext({url:url,parse:parse$2,loaders:candidateLoaders},options,context||null);_context22.next=18;return parseWithLoader(loader,data,options,context);case 18:return _context22.abrupt("return",_context22.sent);case 19:case"end":return _context22.stop();}},_callee19);}));return _parse$.apply(this,arguments);}function parseWithLoader(_x32,_x33,_x34,_x35){return _parseWithLoader.apply(this,arguments);}function _parseWithLoader(){_parseWithLoader=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee20(loader,data,options,context){var response,ok,redirected,status,statusText,type,url,headers;return _regeneratorRuntime().wrap(function _callee20$(_context23){while(1)switch(_context23.prev=_context23.next){case 0:validateWorkerVersion(loader);if(isResponse(data)){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());context.response={headers:headers,ok:ok,redirected:redirected,status:status,statusText:statusText,type:type,url:url};}_context23.next=4;return getArrayBufferOrStringFromData(data,loader,options);case 4:data=_context23.sent;if(!(loader.parseTextSync&&typeof data==='string')){_context23.next=8;break;}options.dataType='text';return _context23.abrupt("return",loader.parseTextSync(data,options,context,loader));case 8:if(!canParseWithWorker(loader,options)){_context23.next=12;break;}_context23.next=11;return parseWithWorker(loader,data,options,context,parse$2);case 11:return _context23.abrupt("return",_context23.sent);case 12:if(!(loader.parseText&&typeof data==='string')){_context23.next=16;break;}_context23.next=15;return loader.parseText(data,options,context,loader);case 15:return _context23.abrupt("return",_context23.sent);case 16:if(!loader.parse){_context23.next=20;break;}_context23.next=19;return loader.parse(data,options,context,loader);case 19:return _context23.abrupt("return",_context23.sent);case 20:assert$8(!loader.parseSync);throw new Error("".concat(loader.id," loader - no parser found and worker is disabled"));case 22:case"end":return _context23.stop();}},_callee20);}));return _parseWithLoader.apply(this,arguments);}var VERSION$7="3.4.15";function assert$6(condition,message){if(!condition){throw new Error(message||'loaders.gl assertion failed.');}}var globals$1={self:typeof self!=='undefined'&&self,window:typeof window!=='undefined'&&window,global:typeof global!=='undefined'&&global,document:typeof document!=='undefined'&&document};var global_$1=globals$1.global||globals$1.self||globals$1.window||{};var isBrowser$2=(typeof process==="undefined"?"undefined":_typeof2(process))!=='object'||String(process)!=='[object process]'||process.browser;var isWorker$1=typeof importScripts==='function';var matches$2=typeof process!=='undefined'&&process.version&&/v([0-9]*)/.exec(process.version);matches$2&&parseFloat(matches$2[1])||0;var readFileAsArrayBuffer$1=null;var readFileAsText$1=null;var requireFromFile$1=null;var requireFromString$1=null;var node$1=/*#__PURE__*/Object.freeze({__proto__:null,readFileAsArrayBuffer:readFileAsArrayBuffer$1,readFileAsText:readFileAsText$1,requireFromFile:requireFromFile$1,requireFromString:requireFromString$1});var VERSION$6="3.4.15";var loadLibraryPromises$1={};function loadLibrary$1(_x36){return _loadLibrary$.apply(this,arguments);}function _loadLibrary$(){_loadLibrary$=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee21(libraryUrl){var moduleName,options,_args17=arguments;return _regeneratorRuntime().wrap(function _callee21$(_context24){while(1)switch(_context24.prev=_context24.next){case 0:moduleName=_args17.length>1&&_args17[1]!==undefined?_args17[1]:null;options=_args17.length>2&&_args17[2]!==undefined?_args17[2]:{};if(moduleName){libraryUrl=getLibraryUrl$1(libraryUrl,moduleName,options);}loadLibraryPromises$1[libraryUrl]=loadLibraryPromises$1[libraryUrl]||loadLibraryFromFile$1(libraryUrl);_context24.next=6;return loadLibraryPromises$1[libraryUrl];case 6:return _context24.abrupt("return",_context24.sent);case 7:case"end":return _context24.stop();}},_callee21);}));return _loadLibrary$.apply(this,arguments);}function getLibraryUrl$1(library,moduleName,options){if(library.startsWith('http')){return library;}var modules=options.modules||{};if(modules[library]){return modules[library];}if(!isBrowser$2){return"modules/".concat(moduleName,"/dist/libs/").concat(library);}if(options.CDN){assert$6(options.CDN.startsWith('http'));return"".concat(options.CDN,"/").concat(moduleName,"@").concat(VERSION$6,"/dist/libs/").concat(library);}if(isWorker$1){return"../src/libs/".concat(library);}return"modules/".concat(moduleName,"/src/libs/").concat(library);}function loadLibraryFromFile$1(_x37){return _loadLibraryFromFile$.apply(this,arguments);}function _loadLibraryFromFile$(){_loadLibraryFromFile$=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee22(libraryUrl){var _response,response,scriptSource;return _regeneratorRuntime().wrap(function _callee22$(_context25){while(1)switch(_context25.prev=_context25.next){case 0:if(!libraryUrl.endsWith('wasm')){_context25.next=7;break;}_context25.next=3;return fetch(libraryUrl);case 3:_response=_context25.sent;_context25.next=6;return _response.arrayBuffer();case 6:return _context25.abrupt("return",_context25.sent);case 7:if(isBrowser$2){_context25.next=20;break;}_context25.prev=8;_context25.t0=node$1&&requireFromFile$1;if(!_context25.t0){_context25.next=14;break;}_context25.next=13;return requireFromFile$1(libraryUrl);case 13:_context25.t0=_context25.sent;case 14:return _context25.abrupt("return",_context25.t0);case 17:_context25.prev=17;_context25.t1=_context25["catch"](8);return _context25.abrupt("return",null);case 20:if(!isWorker$1){_context25.next=22;break;}return _context25.abrupt("return",importScripts(libraryUrl));case 22:_context25.next=24;return fetch(libraryUrl);case 24:response=_context25.sent;_context25.next=27;return response.text();case 27:scriptSource=_context25.sent;return _context25.abrupt("return",loadLibraryFromString$1(scriptSource,libraryUrl));case 29:case"end":return _context25.stop();}},_callee22,null,[[8,17]]);}));return _loadLibraryFromFile$.apply(this,arguments);}function loadLibraryFromString$1(scriptSource,id){if(!isBrowser$2){return requireFromString$1;}if(isWorker$1){eval.call(global_$1,scriptSource);return null;}var script=document.createElement('script');script.id=id;try{script.appendChild(document.createTextNode(scriptSource));}catch(e){script.text=scriptSource;}document.body.appendChild(script);return null;}var VERSION$5="3.4.15";var VERSION$4="3.4.15";var BASIS_CDN_ENCODER_WASM="https://unpkg.com/@loaders.gl/textures@".concat(VERSION$4,"/dist/libs/basis_encoder.wasm");var BASIS_CDN_ENCODER_JS="https://unpkg.com/@loaders.gl/textures@".concat(VERSION$4,"/dist/libs/basis_encoder.js");var loadBasisTranscoderPromise;function loadBasisTrascoderModule(_x38){return _loadBasisTrascoderModule.apply(this,arguments);}function _loadBasisTrascoderModule(){_loadBasisTrascoderModule=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee23(options){var modules;return _regeneratorRuntime().wrap(function _callee23$(_context26){while(1)switch(_context26.prev=_context26.next){case 0:modules=options.modules||{};if(!modules.basis){_context26.next=3;break;}return _context26.abrupt("return",modules.basis);case 3:loadBasisTranscoderPromise=loadBasisTranscoderPromise||loadBasisTrascoder(options);_context26.next=6;return loadBasisTranscoderPromise;case 6:return _context26.abrupt("return",_context26.sent);case 7:case"end":return _context26.stop();}},_callee23);}));return _loadBasisTrascoderModule.apply(this,arguments);}function loadBasisTrascoder(_x39){return _loadBasisTrascoder.apply(this,arguments);}function _loadBasisTrascoder(){_loadBasisTrascoder=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee24(options){var BASIS,wasmBinary,_yield$Promise$all,_yield$Promise$all2;return _regeneratorRuntime().wrap(function _callee24$(_context27){while(1)switch(_context27.prev=_context27.next){case 0:BASIS=null;wasmBinary=null;_context27.t0=Promise;_context27.next=5;return loadLibrary$1('basis_transcoder.js','textures',options);case 5:_context27.t1=_context27.sent;_context27.next=8;return loadLibrary$1('basis_transcoder.wasm','textures',options);case 8:_context27.t2=_context27.sent;_context27.t3=[_context27.t1,_context27.t2];_context27.next=12;return _context27.t0.all.call(_context27.t0,_context27.t3);case 12:_yield$Promise$all=_context27.sent;_yield$Promise$all2=_slicedToArray(_yield$Promise$all,2);BASIS=_yield$Promise$all2[0];wasmBinary=_yield$Promise$all2[1];BASIS=BASIS||globalThis.BASIS;_context27.next=19;return initializeBasisTrascoderModule(BASIS,wasmBinary);case 19:return _context27.abrupt("return",_context27.sent);case 20:case"end":return _context27.stop();}},_callee24);}));return _loadBasisTrascoder.apply(this,arguments);}function initializeBasisTrascoderModule(BasisModule,wasmBinary){var options={};if(wasmBinary){options.wasmBinary=wasmBinary;}return new Promise(function(resolve){BasisModule(options).then(function(module){var BasisFile=module.BasisFile,initializeBasis=module.initializeBasis;initializeBasis();resolve({BasisFile:BasisFile});});});}var loadBasisEncoderPromise;function loadBasisEncoderModule(_x40){return _loadBasisEncoderModule.apply(this,arguments);}function _loadBasisEncoderModule(){_loadBasisEncoderModule=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee25(options){var modules;return _regeneratorRuntime().wrap(function _callee25$(_context28){while(1)switch(_context28.prev=_context28.next){case 0:modules=options.modules||{};if(!modules.basisEncoder){_context28.next=3;break;}return _context28.abrupt("return",modules.basisEncoder);case 3:loadBasisEncoderPromise=loadBasisEncoderPromise||loadBasisEncoder(options);_context28.next=6;return loadBasisEncoderPromise;case 6:return _context28.abrupt("return",_context28.sent);case 7:case"end":return _context28.stop();}},_callee25);}));return _loadBasisEncoderModule.apply(this,arguments);}function loadBasisEncoder(_x41){return _loadBasisEncoder.apply(this,arguments);}function _loadBasisEncoder(){_loadBasisEncoder=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee26(options){var BASIS_ENCODER,wasmBinary,_yield$Promise$all3,_yield$Promise$all4;return _regeneratorRuntime().wrap(function _callee26$(_context29){while(1)switch(_context29.prev=_context29.next){case 0:BASIS_ENCODER=null;wasmBinary=null;_context29.t0=Promise;_context29.next=5;return loadLibrary$1(BASIS_CDN_ENCODER_JS,'textures',options);case 5:_context29.t1=_context29.sent;_context29.next=8;return loadLibrary$1(BASIS_CDN_ENCODER_WASM,'textures',options);case 8:_context29.t2=_context29.sent;_context29.t3=[_context29.t1,_context29.t2];_context29.next=12;return _context29.t0.all.call(_context29.t0,_context29.t3);case 12:_yield$Promise$all3=_context29.sent;_yield$Promise$all4=_slicedToArray(_yield$Promise$all3,2);BASIS_ENCODER=_yield$Promise$all4[0];wasmBinary=_yield$Promise$all4[1];BASIS_ENCODER=BASIS_ENCODER||globalThis.BASIS;_context29.next=19;return initializeBasisEncoderModule(BASIS_ENCODER,wasmBinary);case 19:return _context29.abrupt("return",_context29.sent);case 20:case"end":return _context29.stop();}},_callee26);}));return _loadBasisEncoder.apply(this,arguments);}function initializeBasisEncoderModule(BasisEncoderModule,wasmBinary){var options={};if(wasmBinary){options.wasmBinary=wasmBinary;}return new Promise(function(resolve){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});});});}var GL_EXTENSIONS_CONSTANTS={COMPRESSED_RGB_S3TC_DXT1_EXT:0x83f0,COMPRESSED_RGBA_S3TC_DXT1_EXT:0x83f1,COMPRESSED_RGBA_S3TC_DXT3_EXT:0x83f2,COMPRESSED_RGBA_S3TC_DXT5_EXT:0x83f3,COMPRESSED_R11_EAC:0x9270,COMPRESSED_SIGNED_R11_EAC:0x9271,COMPRESSED_RG11_EAC:0x9272,COMPRESSED_SIGNED_RG11_EAC:0x9273,COMPRESSED_RGB8_ETC2:0x9274,COMPRESSED_RGBA8_ETC2_EAC:0x9275,COMPRESSED_SRGB8_ETC2:0x9276,COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:0x9277,COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2:0x9278,COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2:0x9279,COMPRESSED_RGB_PVRTC_4BPPV1_IMG:0x8c00,COMPRESSED_RGBA_PVRTC_4BPPV1_IMG:0x8c02,COMPRESSED_RGB_PVRTC_2BPPV1_IMG:0x8c01,COMPRESSED_RGBA_PVRTC_2BPPV1_IMG:0x8c03,COMPRESSED_RGB_ETC1_WEBGL:0x8d64,COMPRESSED_RGB_ATC_WEBGL:0x8c92,COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL:0x8c93,COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL:0x87ee,COMPRESSED_RGBA_ASTC_4X4_KHR:0x93b0,COMPRESSED_RGBA_ASTC_5X4_KHR:0x93b1,COMPRESSED_RGBA_ASTC_5X5_KHR:0x93b2,COMPRESSED_RGBA_ASTC_6X5_KHR:0x93b3,COMPRESSED_RGBA_ASTC_6X6_KHR:0x93b4,COMPRESSED_RGBA_ASTC_8X5_KHR:0x93b5,COMPRESSED_RGBA_ASTC_8X6_KHR:0x93b6,COMPRESSED_RGBA_ASTC_8X8_KHR:0x93b7,COMPRESSED_RGBA_ASTC_10X5_KHR:0x93b8,COMPRESSED_RGBA_ASTC_10X6_KHR:0x93b9,COMPRESSED_RGBA_ASTC_10X8_KHR:0x93ba,COMPRESSED_RGBA_ASTC_10X10_KHR:0x93bb,COMPRESSED_RGBA_ASTC_12X10_KHR:0x93bc,COMPRESSED_RGBA_ASTC_12X12_KHR:0x93bd,COMPRESSED_SRGB8_ALPHA8_ASTC_4X4_KHR:0x93d0,COMPRESSED_SRGB8_ALPHA8_ASTC_5X4_KHR:0x93d1,COMPRESSED_SRGB8_ALPHA8_ASTC_5X5_KHR:0x93d2,COMPRESSED_SRGB8_ALPHA8_ASTC_6X5_KHR:0x93d3,COMPRESSED_SRGB8_ALPHA8_ASTC_6X6_KHR:0x93d4,COMPRESSED_SRGB8_ALPHA8_ASTC_8X5_KHR:0x93d5,COMPRESSED_SRGB8_ALPHA8_ASTC_8X6_KHR:0x93d6,COMPRESSED_SRGB8_ALPHA8_ASTC_8X8_KHR:0x93d7,COMPRESSED_SRGB8_ALPHA8_ASTC_10X5_KHR:0x93d8,COMPRESSED_SRGB8_ALPHA8_ASTC_10X6_KHR:0x93d9,COMPRESSED_SRGB8_ALPHA8_ASTC_10X8_KHR:0x93da,COMPRESSED_SRGB8_ALPHA8_ASTC_10X10_KHR:0x93db,COMPRESSED_SRGB8_ALPHA8_ASTC_12X10_KHR:0x93dc,COMPRESSED_SRGB8_ALPHA8_ASTC_12X12_KHR:0x93dd,COMPRESSED_RED_RGTC1_EXT:0x8dbb,COMPRESSED_SIGNED_RED_RGTC1_EXT:0x8dbc,COMPRESSED_RED_GREEN_RGTC2_EXT:0x8dbd,COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT:0x8dbe,COMPRESSED_SRGB_S3TC_DXT1_EXT:0x8c4c,COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT:0x8c4d,COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT:0x8c4e,COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT:0x8c4f};var BROWSER_PREFIXES=['','WEBKIT_','MOZ_'];var WEBGL_EXTENSIONS={WEBGL_compressed_texture_s3tc:'dxt',WEBGL_compressed_texture_s3tc_srgb:'dxt-srgb',WEBGL_compressed_texture_etc1:'etc1',WEBGL_compressed_texture_etc:'etc2',WEBGL_compressed_texture_pvrtc:'pvrtc',WEBGL_compressed_texture_atc:'atc',WEBGL_compressed_texture_astc:'astc',EXT_texture_compression_rgtc:'rgtc'};var formats=null;function getSupportedGPUTextureFormats(gl){if(!formats){gl=gl||getWebGLContext()||undefined;formats=new Set();var _iterator15=_createForOfIteratorHelper(BROWSER_PREFIXES),_step15;try{for(_iterator15.s();!(_step15=_iterator15.n()).done;){var prefix=_step15.value;for(var extension in WEBGL_EXTENSIONS){if(gl&&gl.getExtension("".concat(prefix).concat(extension))){var gpuTextureFormat=WEBGL_EXTENSIONS[extension];formats.add(gpuTextureFormat);}}}}catch(err){_iterator15.e(err);}finally{_iterator15.f();}}return formats;}function getWebGLContext(){try{var _canvas6=document.createElement('canvas');return _canvas6.getContext('webgl');}catch(error){return null;}}var n,i,s,a,r,o,l,f;!function(t){t[t.NONE=0]="NONE",t[t.BASISLZ=1]="BASISLZ",t[t.ZSTD=2]="ZSTD",t[t.ZLIB=3]="ZLIB";}(n||(n={})),function(t){t[t.BASICFORMAT=0]="BASICFORMAT";}(i||(i={})),function(t){t[t.UNSPECIFIED=0]="UNSPECIFIED",t[t.ETC1S=163]="ETC1S",t[t.UASTC=166]="UASTC";}(s||(s={})),function(t){t[t.UNSPECIFIED=0]="UNSPECIFIED",t[t.SRGB=1]="SRGB";}(a||(a={})),function(t){t[t.UNSPECIFIED=0]="UNSPECIFIED",t[t.LINEAR=1]="LINEAR",t[t.SRGB=2]="SRGB",t[t.ITU=3]="ITU",t[t.NTSC=4]="NTSC",t[t.SLOG=5]="SLOG",t[t.SLOG2=6]="SLOG2";}(r||(r={})),function(t){t[t.ALPHA_STRAIGHT=0]="ALPHA_STRAIGHT",t[t.ALPHA_PREMULTIPLIED=1]="ALPHA_PREMULTIPLIED";}(o||(o={})),function(t){t[t.RGB=0]="RGB",t[t.RRR=3]="RRR",t[t.GGG=4]="GGG",t[t.AAA=15]="AAA";}(l||(l={})),function(t){t[t.RGB=0]="RGB",t[t.RGBA=3]="RGBA",t[t.RRR=4]="RRR",t[t.RRRG=5]="RRRG";}(f||(f={}));var KTX2_ID=[0xab,0x4b,0x54,0x58,0x20,0x32,0x30,0xbb,0x0d,0x0a,0x1a,0x0a];function isKTX(data){var id=new Uint8Array(data);var notKTX=id.byteLength<KTX2_ID.length||id[0]!==KTX2_ID[0]||id[1]!==KTX2_ID[1]||id[2]!==KTX2_ID[2]||id[3]!==KTX2_ID[3]||id[4]!==KTX2_ID[4]||id[5]!==KTX2_ID[5]||id[6]!==KTX2_ID[6]||id[7]!==KTX2_ID[7]||id[8]!==KTX2_ID[8]||id[9]!==KTX2_ID[9]||id[10]!==KTX2_ID[10]||id[11]!==KTX2_ID[11];return!notKTX;}var OutputFormat={etc1:{basisFormat:0,compressed:true,format:GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGB_ETC1_WEBGL},etc2:{basisFormat:1,compressed:true},bc1:{basisFormat:2,compressed:true,format:GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGB_S3TC_DXT1_EXT},bc3:{basisFormat:3,compressed:true,format:GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_S3TC_DXT5_EXT},bc4:{basisFormat:4,compressed:true},bc5:{basisFormat:5,compressed:true},'bc7-m6-opaque-only':{basisFormat:6,compressed:true},'bc7-m5':{basisFormat:7,compressed:true},'pvrtc1-4-rgb':{basisFormat:8,compressed:true,format:GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGB_PVRTC_4BPPV1_IMG},'pvrtc1-4-rgba':{basisFormat:9,compressed:true,format:GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG},'astc-4x4':{basisFormat:10,compressed:true,format:GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_4X4_KHR},'atc-rgb':{basisFormat:11,compressed:true},'atc-rgba-interpolated-alpha':{basisFormat:12,compressed:true},rgba32:{basisFormat:13,compressed:false},rgb565:{basisFormat:14,compressed:false},bgr565:{basisFormat:15,compressed:false},rgba4444:{basisFormat:16,compressed:false}};function parseBasis(_x42,_x43){return _parseBasis.apply(this,arguments);}function _parseBasis(){_parseBasis=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee27(data,options){var fileConstructors,_yield$loadBasisTrasc,BasisFile,_fileConstructors,_yield$loadBasisTrasc2,_BasisFile;return _regeneratorRuntime().wrap(function _callee27$(_context30){while(1)switch(_context30.prev=_context30.next){case 0:if(!(options.basis.containerFormat==='auto')){_context30.next=11;break;}if(!isKTX(data)){_context30.next=6;break;}_context30.next=4;return loadBasisEncoderModule(options);case 4:fileConstructors=_context30.sent;return _context30.abrupt("return",parseKTX2File(fileConstructors.KTX2File,data,options));case 6:_context30.next=8;return loadBasisTrascoderModule(options);case 8:_yield$loadBasisTrasc=_context30.sent;BasisFile=_yield$loadBasisTrasc.BasisFile;return _context30.abrupt("return",parseBasisFile(BasisFile,data,options));case 11:_context30.t0=options.basis.module;_context30.next=_context30.t0==='encoder'?14:_context30.t0==='transcoder'?22:22;break;case 14:_context30.next=16;return loadBasisEncoderModule(options);case 16:_fileConstructors=_context30.sent;_context30.t1=options.basis.containerFormat;_context30.next=_context30.t1==='ktx2'?20:_context30.t1==='basis'?21:21;break;case 20:return _context30.abrupt("return",parseKTX2File(_fileConstructors.KTX2File,data,options));case 21:return _context30.abrupt("return",parseBasisFile(_fileConstructors.BasisFile,data,options));case 22:_context30.next=24;return loadBasisTrascoderModule(options);case 24:_yield$loadBasisTrasc2=_context30.sent;_BasisFile=_yield$loadBasisTrasc2.BasisFile;return _context30.abrupt("return",parseBasisFile(_BasisFile,data,options));case 27:case"end":return _context30.stop();}},_callee27);}));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"]();}}function transcodeImage(basisFile,imageIndex,levelIndex,options){var width=basisFile.getImageWidth(imageIndex,levelIndex);var height=basisFile.getImageHeight(imageIndex,levelIndex);var hasAlpha=basisFile.getHasAlpha();var _getBasisOptions=getBasisOptions(options,hasAlpha),compressed=_getBasisOptions.compressed,format=_getBasisOptions.format,basisFormat=_getBasisOptions.basisFormat;var decodedSize=basisFile.getImageTranscodedSizeInBytes(imageIndex,levelIndex,basisFormat);var decodedData=new Uint8Array(decodedSize);if(!basisFile.transcodeImage(decodedData,imageIndex,levelIndex,basisFormat,0,0)){throw new Error('failed to start Basis transcoding');}return{width:width,height:height,data:decodedData,compressed:compressed,format:format,hasAlpha:hasAlpha};}function parseKTX2File(KTX2File,data,options){var ktx2File=new KTX2File(new Uint8Array(data));try{if(!ktx2File.startTranscoding()){throw new Error('failed to start KTX2 transcoding');}var levelsCount=ktx2File.getLevels();var levels=[];for(var levelIndex=0;levelIndex<levelsCount;levelIndex++){levels.push(transcodeKTX2Image(ktx2File,levelIndex,options));break;}return[levels];}finally{ktx2File.close();ktx2File["delete"]();}}function transcodeKTX2Image(ktx2File,levelIndex,options){var _ktx2File$getImageLev=ktx2File.getImageLevelInfo(levelIndex,0,0),alphaFlag=_ktx2File$getImageLev.alphaFlag,height=_ktx2File$getImageLev.height,width=_ktx2File$getImageLev.width;var _getBasisOptions2=getBasisOptions(options,alphaFlag),compressed=_getBasisOptions2.compressed,format=_getBasisOptions2.format,basisFormat=_getBasisOptions2.basisFormat;var decodedSize=ktx2File.getImageTranscodedSizeInBytes(levelIndex,0,0,basisFormat);var decodedData=new Uint8Array(decodedSize);if(!ktx2File.transcodeImage(decodedData,levelIndex,0,0,basisFormat,0,-1,-1)){throw new Error('Failed to transcode KTX2 image');}return{width:width,height:height,data:decodedData,compressed:compressed,levelSize:decodedSize,hasAlpha:alphaFlag,format:format};}function getBasisOptions(options,hasAlpha){var format=options&&options.basis&&options.basis.format;if(format==='auto'){format=selectSupportedBasisFormat();}if(_typeof2(format)==='object'){format=hasAlpha?format.alpha:format.noAlpha;}format=format.toLowerCase();return OutputFormat[format];}function selectSupportedBasisFormat(){var supportedFormats=getSupportedGPUTextureFormats();if(supportedFormats.has('astc')){return'astc-4x4';}else if(supportedFormats.has('dxt')){return{alpha:'bc3',noAlpha:'bc1'};}else if(supportedFormats.has('pvrtc')){return{alpha:'pvrtc1-4-rgba',noAlpha:'pvrtc1-4-rgb'};}else if(supportedFormats.has('etc1')){return'etc1';}else if(supportedFormats.has('etc2')){return'etc2';}return'rgb565';}var BasisWorkerLoader={name:'Basis',id:isBrowser$2?'basis':'basis-nodejs',module:'textures',version:VERSION$5,worker:true,extensions:['basis','ktx2'],mimeTypes:['application/octet-stream','image/ktx2'],tests:['sB'],binary:true,options:{basis:{format:'auto',libraryPath:'libs/',containerFormat:'auto',module:'transcoder'}}};var BasisLoader=_objectSpread(_objectSpread({},BasisWorkerLoader),{},{parse:parseBasis});var VERSION$3="3.4.15";function assert$5(condition,message){if(!condition){throw new Error(message||'loader assertion failed.');}}var isBrowser$1=Boolean((typeof process==="undefined"?"undefined":_typeof2(process))!=='object'||String(process)!=='[object process]'||process.browser);var matches$1=typeof process!=='undefined'&&process.version&&/v([0-9]*)/.exec(process.version);matches$1&&parseFloat(matches$1[1])||0;var _parseImageNode=globalThis._parseImageNode;var IMAGE_SUPPORTED=typeof Image!=='undefined';var IMAGE_BITMAP_SUPPORTED=typeof ImageBitmap!=='undefined';var NODE_IMAGE_SUPPORTED=Boolean(_parseImageNode);var DATA_SUPPORTED=isBrowser$1?true:NODE_IMAGE_SUPPORTED;function isImageTypeSupported(type){switch(type){case'auto':return IMAGE_BITMAP_SUPPORTED||IMAGE_SUPPORTED||DATA_SUPPORTED;case'imagebitmap':return IMAGE_BITMAP_SUPPORTED;case'image':return IMAGE_SUPPORTED;case'data':return DATA_SUPPORTED;default:throw new Error("@loaders.gl/images: image ".concat(type," not supported in this environment"));}}function getDefaultImageType(){if(IMAGE_BITMAP_SUPPORTED){return'imagebitmap';}if(IMAGE_SUPPORTED){return'image';}if(DATA_SUPPORTED){return'data';}throw new Error('Install \'@loaders.gl/polyfills\' to parse images under Node.js');}function getImageType(image){var format=getImageTypeOrNull(image);if(!format){throw new Error('Not an image');}return format;}function getImageData(image){switch(getImageType(image)){case'data':return image;case'image':case'imagebitmap':var _canvas7=document.createElement('canvas');var context=_canvas7.getContext('2d');if(!context){throw new Error('getImageData');}_canvas7.width=image.width;_canvas7.height=image.height;context.drawImage(image,0,0);return context.getImageData(0,0,image.width,image.height);default:throw new Error('getImageData');}}function getImageTypeOrNull(image){if(typeof ImageBitmap!=='undefined'&&image instanceof ImageBitmap){return'imagebitmap';}if(typeof Image!=='undefined'&&image instanceof Image){return'image';}if(image&&_typeof2(image)==='object'&&image.data&&image.width&&image.height){return'data';}return null;}var SVG_DATA_URL_PATTERN=/^data:image\/svg\+xml/;var SVG_URL_PATTERN=/\.svg((\?|#).*)?$/;function isSVG(url){return url&&(SVG_DATA_URL_PATTERN.test(url)||SVG_URL_PATTERN.test(url));}function getBlobOrSVGDataUrl(arrayBuffer,url){if(isSVG(url)){var textDecoder=new TextDecoder();var xmlText=textDecoder.decode(arrayBuffer);try{if(typeof unescape==='function'&&typeof encodeURIComponent==='function'){xmlText=unescape(encodeURIComponent(xmlText));}}catch(error){throw new Error(error.message);}var src="data:image/svg+xml;base64,".concat(btoa(xmlText));return src;}return getBlob(arrayBuffer,url);}function getBlob(arrayBuffer,url){if(isSVG(url)){throw new Error('SVG cannot be parsed directly to imagebitmap');}return new Blob([new Uint8Array(arrayBuffer)]);}function parseToImage(_x44,_x45,_x46){return _parseToImage.apply(this,arguments);}function _parseToImage(){_parseToImage=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee28(arrayBuffer,options,url){var blobOrDataUrl,URL,objectUrl;return _regeneratorRuntime().wrap(function _callee28$(_context31){while(1)switch(_context31.prev=_context31.next){case 0:blobOrDataUrl=getBlobOrSVGDataUrl(arrayBuffer,url);URL=self.URL||self.webkitURL;objectUrl=typeof blobOrDataUrl!=='string'&&URL.createObjectURL(blobOrDataUrl);_context31.prev=3;_context31.next=6;return loadToImage(objectUrl||blobOrDataUrl,options);case 6:return _context31.abrupt("return",_context31.sent);case 7:_context31.prev=7;if(objectUrl){URL.revokeObjectURL(objectUrl);}return _context31.finish(7);case 10:case"end":return _context31.stop();}},_callee28,null,[[3,,7,10]]);}));return _parseToImage.apply(this,arguments);}function loadToImage(_x47,_x48){return _loadToImage.apply(this,arguments);}function _loadToImage(){_loadToImage=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee29(url,options){var image;return _regeneratorRuntime().wrap(function _callee29$(_context32){while(1)switch(_context32.prev=_context32.next){case 0:image=new Image();image.src=url;if(!(options.image&&options.image.decode&&image.decode)){_context32.next=6;break;}_context32.next=5;return image.decode();case 5:return _context32.abrupt("return",image);case 6:_context32.next=8;return new Promise(function(resolve,reject){try{image.onload=function(){return resolve(image);};image.onerror=function(err){return reject(new Error("Could not load image ".concat(url,": ").concat(err)));};}catch(error){reject(error);}});case 8:return _context32.abrupt("return",_context32.sent);case 9:case"end":return _context32.stop();}},_callee29);}));return _loadToImage.apply(this,arguments);}var EMPTY_OBJECT={};var imagebitmapOptionsSupported=true;function parseToImageBitmap(_x49,_x50,_x51){return _parseToImageBitmap.apply(this,arguments);}function _parseToImageBitmap(){_parseToImageBitmap=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee30(arrayBuffer,options,url){var blob,_image7,imagebitmapOptions;return _regeneratorRuntime().wrap(function _callee30$(_context33){while(1)switch(_context33.prev=_context33.next){case 0:if(!isSVG(url)){_context33.next=7;break;}_context33.next=3;return parseToImage(arrayBuffer,options,url);case 3:_image7=_context33.sent;blob=_image7;_context33.next=8;break;case 7:blob=getBlob(arrayBuffer,url);case 8:imagebitmapOptions=options&&options.imagebitmap;_context33.next=11;return safeCreateImageBitmap(blob,imagebitmapOptions);case 11:return _context33.abrupt("return",_context33.sent);case 12:case"end":return _context33.stop();}},_callee30);}));return _parseToImageBitmap.apply(this,arguments);}function safeCreateImageBitmap(_x52){return _safeCreateImageBitmap.apply(this,arguments);}function _safeCreateImageBitmap(){_safeCreateImageBitmap=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee31(blob){var imagebitmapOptions,_args27=arguments;return _regeneratorRuntime().wrap(function _callee31$(_context34){while(1)switch(_context34.prev=_context34.next){case 0:imagebitmapOptions=_args27.length>1&&_args27[1]!==undefined?_args27[1]:null;if(isEmptyObject(imagebitmapOptions)||!imagebitmapOptionsSupported){imagebitmapOptions=null;}if(!imagebitmapOptions){_context34.next=13;break;}_context34.prev=3;_context34.next=6;return createImageBitmap(blob,imagebitmapOptions);case 6:return _context34.abrupt("return",_context34.sent);case 9:_context34.prev=9;_context34.t0=_context34["catch"](3);console.warn(_context34.t0);imagebitmapOptionsSupported=false;case 13:_context34.next=15;return createImageBitmap(blob);case 15:return _context34.abrupt("return",_context34.sent);case 16:case"end":return _context34.stop();}},_callee31,null,[[3,9]]);}));return _safeCreateImageBitmap.apply(this,arguments);}function isEmptyObject(object){for(var key in object||EMPTY_OBJECT){return false;}return true;}function getISOBMFFMediaType(buffer){if(!checkString(buffer,'ftyp',4)){return null;}if((buffer[8]&0x60)===0x00){return null;}return decodeMajorBrand(buffer);}function decodeMajorBrand(buffer){var brandMajor=getUTF8String(buffer,8,12).replace('\0',' ').trim();switch(brandMajor){case'avif':case'avis':return{extension:'avif',mimeType:'image/avif'};default:return null;}}function getUTF8String(array,start,end){return String.fromCharCode.apply(String,_toConsumableArray(array.slice(start,end)));}function stringToBytes(string){return _toConsumableArray(string).map(function(character){return character.charCodeAt(0);});}function checkString(buffer,header){var offset=arguments.length>2&&arguments[2]!==undefined?arguments[2]:0;var headerBytes=stringToBytes(header);for(var _i509=0;_i509<headerBytes.length;++_i509){if(headerBytes[_i509]!==buffer[_i509+offset]){return false;}}return true;}var BIG_ENDIAN=false;var LITTLE_ENDIAN=true;function getBinaryImageMetadata(binaryData){var dataView=toDataView(binaryData);return getPngMetadata(dataView)||getJpegMetadata(dataView)||getGifMetadata(dataView)||getBmpMetadata(dataView)||getISOBMFFMetadata(dataView);}function getISOBMFFMetadata(binaryData){var buffer=new Uint8Array(binaryData instanceof DataView?binaryData.buffer:binaryData);var mediaType=getISOBMFFMediaType(buffer);if(!mediaType){return null;}return{mimeType:mediaType.mimeType,width:0,height:0};}function getPngMetadata(binaryData){var dataView=toDataView(binaryData);var isPng=dataView.byteLength>=24&&dataView.getUint32(0,BIG_ENDIAN)===0x89504e47;if(!isPng){return null;}return{mimeType:'image/png',width:dataView.getUint32(16,BIG_ENDIAN),height:dataView.getUint32(20,BIG_ENDIAN)};}function getGifMetadata(binaryData){var dataView=toDataView(binaryData);var isGif=dataView.byteLength>=10&&dataView.getUint32(0,BIG_ENDIAN)===0x47494638;if(!isGif){return null;}return{mimeType:'image/gif',width:dataView.getUint16(6,LITTLE_ENDIAN),height:dataView.getUint16(8,LITTLE_ENDIAN)};}function getBmpMetadata(binaryData){var dataView=toDataView(binaryData);var isBmp=dataView.byteLength>=14&&dataView.getUint16(0,BIG_ENDIAN)===0x424d&&dataView.getUint32(2,LITTLE_ENDIAN)===dataView.byteLength;if(!isBmp){return null;}return{mimeType:'image/bmp',width:dataView.getUint32(18,LITTLE_ENDIAN),height:dataView.getUint32(22,LITTLE_ENDIAN)};}function getJpegMetadata(binaryData){var dataView=toDataView(binaryData);var isJpeg=dataView.byteLength>=3&&dataView.getUint16(0,BIG_ENDIAN)===0xffd8&&dataView.getUint8(2)===0xff;if(!isJpeg){return null;}var _getJpegMarkers=getJpegMarkers(),tableMarkers=_getJpegMarkers.tableMarkers,sofMarkers=_getJpegMarkers.sofMarkers;var i=2;while(i+9<dataView.byteLength){var marker=dataView.getUint16(i,BIG_ENDIAN);if(sofMarkers.has(marker)){return{mimeType:'image/jpeg',height:dataView.getUint16(i+5,BIG_ENDIAN),width:dataView.getUint16(i+7,BIG_ENDIAN)};}if(!tableMarkers.has(marker)){return null;}i+=2;i+=dataView.getUint16(i,BIG_ENDIAN);}return null;}function getJpegMarkers(){var tableMarkers=new Set([0xffdb,0xffc4,0xffcc,0xffdd,0xfffe]);for(var _i510=0xffe0;_i510<0xfff0;++_i510){tableMarkers.add(_i510);}var sofMarkers=new Set([0xffc0,0xffc1,0xffc2,0xffc3,0xffc5,0xffc6,0xffc7,0xffc9,0xffca,0xffcb,0xffcd,0xffce,0xffcf,0xffde]);return{tableMarkers:tableMarkers,sofMarkers:sofMarkers};}function toDataView(data){if(data instanceof DataView){return data;}if(ArrayBuffer.isView(data)){return new DataView(data.buffer);}if(data instanceof ArrayBuffer){return new DataView(data);}throw new Error('toDataView');}function parseToNodeImage(_x53,_x54){return _parseToNodeImage.apply(this,arguments);}function _parseToNodeImage(){_parseToNodeImage=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee32(arrayBuffer,options){var _ref23,mimeType,_parseImageNode;return _regeneratorRuntime().wrap(function _callee32$(_context35){while(1)switch(_context35.prev=_context35.next){case 0:_ref23=getBinaryImageMetadata(arrayBuffer)||{},mimeType=_ref23.mimeType;_parseImageNode=globalThis._parseImageNode;assert$5(_parseImageNode);_context35.next=5;return _parseImageNode(arrayBuffer,mimeType);case 5:return _context35.abrupt("return",_context35.sent);case 6:case"end":return _context35.stop();}},_callee32);}));return _parseToNodeImage.apply(this,arguments);}function parseImage(_x55,_x56,_x57){return _parseImage.apply(this,arguments);}function _parseImage(){_parseImage=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee33(arrayBuffer,options,context){var imageOptions,imageType,_ref24,url,loadType,image;return _regeneratorRuntime().wrap(function _callee33$(_context36){while(1)switch(_context36.prev=_context36.next){case 0:options=options||{};imageOptions=options.image||{};imageType=imageOptions.type||'auto';_ref24=context||{},url=_ref24.url;loadType=getLoadableImageType(imageType);_context36.t0=loadType;_context36.next=_context36.t0==='imagebitmap'?8:_context36.t0==='image'?12:_context36.t0==='data'?16:20;break;case 8:_context36.next=10;return parseToImageBitmap(arrayBuffer,options,url);case 10:image=_context36.sent;return _context36.abrupt("break",21);case 12:_context36.next=14;return parseToImage(arrayBuffer,options,url);case 14:image=_context36.sent;return _context36.abrupt("break",21);case 16:_context36.next=18;return parseToNodeImage(arrayBuffer);case 18:image=_context36.sent;return _context36.abrupt("break",21);case 20:assert$5(false);case 21:if(imageType==='data'){image=getImageData(image);}return _context36.abrupt("return",image);case 23:case"end":return _context36.stop();}},_callee33);}));return _parseImage.apply(this,arguments);}function getLoadableImageType(type){switch(type){case'auto':case'data':return getDefaultImageType();default:isImageTypeSupported(type);return type;}}var EXTENSIONS$1=['png','jpg','jpeg','gif','webp','bmp','ico','svg','avif'];var MIME_TYPES=['image/png','image/jpeg','image/gif','image/webp','image/avif','image/bmp','image/vnd.microsoft.icon','image/svg+xml'];var DEFAULT_IMAGE_LOADER_OPTIONS={image:{type:'auto',decode:true}};var ImageLoader={id:'image',module:'images',name:'Images',version:VERSION$3,mimeTypes:MIME_TYPES,extensions:EXTENSIONS$1,parse:parseImage,tests:[function(arrayBuffer){return Boolean(getBinaryImageMetadata(new DataView(arrayBuffer)));}],options:DEFAULT_IMAGE_LOADER_OPTIONS};var mimeTypeSupportedSync={};function isImageFormatSupported(mimeType){if(mimeTypeSupportedSync[mimeType]===undefined){var supported=isBrowser$1?checkBrowserImageFormatSupport(mimeType):checkNodeImageFormatSupport(mimeType);mimeTypeSupportedSync[mimeType]=supported;}return mimeTypeSupportedSync[mimeType];}function checkNodeImageFormatSupport(mimeType){var NODE_FORMAT_SUPPORT=['image/png','image/jpeg','image/gif'];var _parseImageNode=globalThis._parseImageNode,_globalThis$_imageFor=globalThis._imageFormatsNode,_imageFormatsNode=_globalThis$_imageFor===void 0?NODE_FORMAT_SUPPORT:_globalThis$_imageFor;return Boolean(_parseImageNode)&&_imageFormatsNode.includes(mimeType);}function checkBrowserImageFormatSupport(mimeType){switch(mimeType){case'image/avif':case'image/webp':return testBrowserImageFormatSupport(mimeType);default:return true;}}function testBrowserImageFormatSupport(mimeType){try{var element=document.createElement('canvas');var dataURL=element.toDataURL(mimeType);return dataURL.indexOf("data:".concat(mimeType))===0;}catch(_unused){return false;}}function assert$4(condition,message){if(!condition){throw new Error(message||'loader assertion failed.');}}function getFirstCharacters(data){var length=arguments.length>1&&arguments[1]!==undefined?arguments[1]:5;if(typeof data==='string'){return data.slice(0,length);}else if(ArrayBuffer.isView(data)){return getMagicString$1(data.buffer,data.byteOffset,length);}else if(data instanceof ArrayBuffer){var byteOffset=0;return getMagicString$1(data,byteOffset,length);}return'';}function getMagicString$1(arrayBuffer,byteOffset,length){if(arrayBuffer.byteLength<=byteOffset+length){return'';}var dataView=new DataView(arrayBuffer);var magic='';for(var _i511=0;_i511<length;_i511++){magic+=String.fromCharCode(dataView.getUint8(byteOffset+_i511));}return magic;}function parseJSON(string){try{return JSON.parse(string);}catch(_){throw new Error("Failed to parse JSON from data starting with \"".concat(getFirstCharacters(string),"\""));}}function sliceArrayBuffer(arrayBuffer,byteOffset,byteLength){var subArray=byteLength!==undefined?new Uint8Array(arrayBuffer).subarray(byteOffset,byteOffset+byteLength):new Uint8Array(arrayBuffer).subarray(byteOffset);var arrayCopy=new Uint8Array(subArray);return arrayCopy.buffer;}function padToNBytes(byteLength,padding){assert$4(byteLength>=0);assert$4(padding>0);return byteLength+(padding-1)&~(padding-1);}function copyToArray(source,target,targetOffset){var sourceArray;if(source instanceof ArrayBuffer){sourceArray=new Uint8Array(source);}else{var srcByteOffset=source.byteOffset;var srcByteLength=source.byteLength;sourceArray=new Uint8Array(source.buffer||source.arrayBuffer,srcByteOffset,srcByteLength);}target.set(sourceArray,targetOffset);return targetOffset+padToNBytes(sourceArray.byteLength,4);}function assert$3(condition,message){if(!condition){throw new Error(message||'assert failed: gltf');}}function resolveUrl(url,options){var absolute=url.startsWith('data:')||url.startsWith('http:')||url.startsWith('https:');if(absolute){return url;}var baseUrl=options.baseUri||options.uri;if(!baseUrl){throw new Error("'baseUri' must be provided to resolve relative url ".concat(url));}return baseUrl.substr(0,baseUrl.lastIndexOf('/')+1)+url;}function getTypedArrayForBufferView(json,buffers,bufferViewIndex){var bufferView=json.bufferViews[bufferViewIndex];assert$3(bufferView);var bufferIndex=bufferView.buffer;var binChunk=buffers[bufferIndex];assert$3(binChunk);var byteOffset=(bufferView.byteOffset||0)+binChunk.byteOffset;return new Uint8Array(binChunk.arrayBuffer,byteOffset,bufferView.byteLength);}var TYPES=['SCALAR','VEC2','VEC3','VEC4'];var ARRAY_CONSTRUCTOR_TO_WEBGL_CONSTANT=[[Int8Array,5120],[Uint8Array,5121],[Int16Array,5122],[Uint16Array,5123],[Uint32Array,5125],[Float32Array,5126],[Float64Array,5130]];var ARRAY_TO_COMPONENT_TYPE=new Map(ARRAY_CONSTRUCTOR_TO_WEBGL_CONSTANT);var ATTRIBUTE_TYPE_TO_COMPONENTS={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16};var ATTRIBUTE_COMPONENT_TYPE_TO_BYTE_SIZE={5120:1,5121:1,5122:2,5123:2,5125:4,5126:4};var ATTRIBUTE_COMPONENT_TYPE_TO_ARRAY={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array};function getAccessorTypeFromSize(size){var type=TYPES[size-1];return type||TYPES[0];}function getComponentTypeFromArray(typedArray){var componentType=ARRAY_TO_COMPONENT_TYPE.get(typedArray.constructor);if(!componentType){throw new Error('Illegal typed array');}return componentType;}function getAccessorArrayTypeAndLength(accessor,bufferView){var ArrayType=ATTRIBUTE_COMPONENT_TYPE_TO_ARRAY[accessor.componentType];var components=ATTRIBUTE_TYPE_TO_COMPONENTS[accessor.type];var bytesPerComponent=ATTRIBUTE_COMPONENT_TYPE_TO_BYTE_SIZE[accessor.componentType];var length=accessor.count*components;var byteLength=accessor.count*components*bytesPerComponent;assert$3(byteLength>=0&&byteLength<=bufferView.byteLength);return{ArrayType:ArrayType,length:length,byteLength:byteLength};}var DEFAULT_GLTF_JSON={asset:{version:'2.0',generator:'loaders.gl'},buffers:[]};var GLTFScenegraph=/*#__PURE__*/function(){function GLTFScenegraph(gltf){_classCallCheck(this,GLTFScenegraph);_defineProperty(this,"gltf",void 0);_defineProperty(this,"sourceBuffers",void 0);_defineProperty(this,"byteLength",void 0);this.gltf=gltf||{json:_objectSpread({},DEFAULT_GLTF_JSON),buffers:[]};this.sourceBuffers=[];this.byteLength=0;if(this.gltf.buffers&&this.gltf.buffers[0]){this.byteLength=this.gltf.buffers[0].byteLength;this.sourceBuffers=[this.gltf.buffers[0]];}}return _createClass(GLTFScenegraph,[{key:"json",get:function get(){return this.gltf.json;}},{key:"getApplicationData",value:function getApplicationData(key){var data=this.json[key];return data;}},{key:"getExtraData",value:function getExtraData(key){var extras=this.json.extras||{};return extras[key];}},{key:"getExtension",value:function getExtension(extensionName){var isExtension=this.getUsedExtensions().find(function(name){return name===extensionName;});var extensions=this.json.extensions||{};return isExtension?extensions[extensionName]||true:null;}},{key:"getRequiredExtension",value:function getRequiredExtension(extensionName){var isRequired=this.getRequiredExtensions().find(function(name){return name===extensionName;});return isRequired?this.getExtension(extensionName):null;}},{key:"getRequiredExtensions",value:function getRequiredExtensions(){return this.json.extensionsRequired||[];}},{key:"getUsedExtensions",value:function getUsedExtensions(){return this.json.extensionsUsed||[];}},{key:"getRemovedExtensions",value:function getRemovedExtensions(){return this.json.extensionsRemoved||[];}},{key:"getObjectExtension",value:function getObjectExtension(object,extensionName){var extensions=object.extensions||{};return extensions[extensionName];}},{key:"getScene",value:function getScene(index){return this.getObject('scenes',index);}},{key:"getNode",value:function getNode(index){return this.getObject('nodes',index);}},{key:"getSkin",value:function getSkin(index){return this.getObject('skins',index);}},{key:"getMesh",value:function getMesh(index){return this.getObject('meshes',index);}},{key:"getMaterial",value:function getMaterial(index){return this.getObject('materials',index);}},{key:"getAccessor",value:function getAccessor(index){return this.getObject('accessors',index);}},{key:"getTexture",value:function getTexture(index){return this.getObject('textures',index);}},{key:"getSampler",value:function getSampler(index){return this.getObject('samplers',index);}},{key:"getImage",value:function getImage(index){return this.getObject('images',index);}},{key:"getBufferView",value:function getBufferView(index){return this.getObject('bufferViews',index);}},{key:"getBuffer",value:function getBuffer(index){return this.getObject('buffers',index);}},{key:"getObject",value:function getObject(array,index){if(_typeof2(index)==='object'){return index;}var object=this.json[array]&&this.json[array][index];if(!object){throw new Error("glTF file error: Could not find ".concat(array,"[").concat(index,"]"));}return object;}},{key:"getTypedArrayForBufferView",value:function getTypedArrayForBufferView(bufferView){bufferView=this.getBufferView(bufferView);var bufferIndex=bufferView.buffer;var binChunk=this.gltf.buffers[bufferIndex];assert$3(binChunk);var byteOffset=(bufferView.byteOffset||0)+binChunk.byteOffset;return new Uint8Array(binChunk.arrayBuffer,byteOffset,bufferView.byteLength);}},{key:"getTypedArrayForAccessor",value:function getTypedArrayForAccessor(accessor){accessor=this.getAccessor(accessor);var bufferView=this.getBufferView(accessor.bufferView);var buffer=this.getBuffer(bufferView.buffer);var arrayBuffer=buffer.data;var _getAccessorArrayType=getAccessorArrayTypeAndLength(accessor,bufferView),ArrayType=_getAccessorArrayType.ArrayType,length=_getAccessorArrayType.length;var byteOffset=bufferView.byteOffset+accessor.byteOffset;return new ArrayType(arrayBuffer,byteOffset,length);}},{key:"getTypedArrayForImageData",value:function getTypedArrayForImageData(image){image=this.getAccessor(image);var bufferView=this.getBufferView(image.bufferView);var buffer=this.getBuffer(bufferView.buffer);var arrayBuffer=buffer.data;var byteOffset=bufferView.byteOffset||0;return new Uint8Array(arrayBuffer,byteOffset,bufferView.byteLength);}},{key:"addApplicationData",value:function addApplicationData(key,data){this.json[key]=data;return this;}},{key:"addExtraData",value:function addExtraData(key,data){this.json.extras=this.json.extras||{};this.json.extras[key]=data;return this;}},{key:"addObjectExtension",value:function addObjectExtension(object,extensionName,data){object.extensions=object.extensions||{};object.extensions[extensionName]=data;this.registerUsedExtension(extensionName);return this;}},{key:"setObjectExtension",value:function setObjectExtension(object,extensionName,data){var extensions=object.extensions||{};extensions[extensionName]=data;}},{key:"removeObjectExtension",value:function removeObjectExtension(object,extensionName){var extensions=object.extensions||{};var extension=extensions[extensionName];delete extensions[extensionName];return extension;}},{key:"addExtension",value:function addExtension(extensionName){var extensionData=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};assert$3(extensionData);this.json.extensions=this.json.extensions||{};this.json.extensions[extensionName]=extensionData;this.registerUsedExtension(extensionName);return extensionData;}},{key:"addRequiredExtension",value:function addRequiredExtension(extensionName){var extensionData=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};assert$3(extensionData);this.addExtension(extensionName,extensionData);this.registerRequiredExtension(extensionName);return extensionData;}},{key:"registerUsedExtension",value:function registerUsedExtension(extensionName){this.json.extensionsUsed=this.json.extensionsUsed||[];if(!this.json.extensionsUsed.find(function(ext){return ext===extensionName;})){this.json.extensionsUsed.push(extensionName);}}},{key:"registerRequiredExtension",value:function registerRequiredExtension(extensionName){this.registerUsedExtension(extensionName);this.json.extensionsRequired=this.json.extensionsRequired||[];if(!this.json.extensionsRequired.find(function(ext){return ext===extensionName;})){this.json.extensionsRequired.push(extensionName);}}},{key:"removeExtension",value:function removeExtension(extensionName){if(!this.getExtension(extensionName)){return;}if(this.json.extensionsRequired){this._removeStringFromArray(this.json.extensionsRequired,extensionName);}if(this.json.extensionsUsed){this._removeStringFromArray(this.json.extensionsUsed,extensionName);}if(this.json.extensions){delete this.json.extensions[extensionName];}if(!Array.isArray(this.json.extensionsRemoved)){this.json.extensionsRemoved=[];}var extensionsRemoved=this.json.extensionsRemoved;if(!extensionsRemoved.includes(extensionName)){extensionsRemoved.push(extensionName);}}},{key:"setDefaultScene",value:function setDefaultScene(sceneIndex){this.json.scene=sceneIndex;}},{key:"addScene",value:function addScene(scene){var nodeIndices=scene.nodeIndices;this.json.scenes=this.json.scenes||[];this.json.scenes.push({nodes:nodeIndices});return this.json.scenes.length-1;}},{key:"addNode",value:function addNode(node){var meshIndex=node.meshIndex,matrix=node.matrix;this.json.nodes=this.json.nodes||[];var nodeData={mesh:meshIndex};if(matrix){nodeData.matrix=matrix;}this.json.nodes.push(nodeData);return this.json.nodes.length-1;}},{key:"addMesh",value:function addMesh(mesh){var attributes=mesh.attributes,indices=mesh.indices,material=mesh.material,_mesh$mode=mesh.mode,mode=_mesh$mode===void 0?4:_mesh$mode;var accessors=this._addAttributes(attributes);var glTFMesh={primitives:[{attributes:accessors,mode:mode}]};if(indices){var indicesAccessor=this._addIndices(indices);glTFMesh.primitives[0].indices=indicesAccessor;}if(Number.isFinite(material)){glTFMesh.primitives[0].material=material;}this.json.meshes=this.json.meshes||[];this.json.meshes.push(glTFMesh);return this.json.meshes.length-1;}},{key:"addPointCloud",value:function addPointCloud(attributes){var accessorIndices=this._addAttributes(attributes);var glTFMesh={primitives:[{attributes:accessorIndices,mode:0}]};this.json.meshes=this.json.meshes||[];this.json.meshes.push(glTFMesh);return this.json.meshes.length-1;}},{key:"addImage",value:function addImage(imageData,mimeTypeOpt){var metadata=getBinaryImageMetadata(imageData);var mimeType=mimeTypeOpt||(metadata===null||metadata===void 0?void 0:metadata.mimeType);var bufferViewIndex=this.addBufferView(imageData);var glTFImage={bufferView:bufferViewIndex,mimeType:mimeType};this.json.images=this.json.images||[];this.json.images.push(glTFImage);return this.json.images.length-1;}},{key:"addBufferView",value:function addBufferView(buffer){var byteLength=buffer.byteLength;assert$3(Number.isFinite(byteLength));this.sourceBuffers=this.sourceBuffers||[];this.sourceBuffers.push(buffer);var glTFBufferView={buffer:0,byteOffset:this.byteLength,byteLength:byteLength};this.byteLength+=padToNBytes(byteLength,4);this.json.bufferViews=this.json.bufferViews||[];this.json.bufferViews.push(glTFBufferView);return this.json.bufferViews.length-1;}},{key:"addAccessor",value:function addAccessor(bufferViewIndex,accessor){var glTFAccessor={bufferView:bufferViewIndex,type:getAccessorTypeFromSize(accessor.size),componentType:accessor.componentType,count:accessor.count,max:accessor.max,min:accessor.min};this.json.accessors=this.json.accessors||[];this.json.accessors.push(glTFAccessor);return this.json.accessors.length-1;}},{key:"addBinaryBuffer",value:function addBinaryBuffer(sourceBuffer){var accessor=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{size:3};var bufferViewIndex=this.addBufferView(sourceBuffer);var minMax={min:accessor.min,max:accessor.max};if(!minMax.min||!minMax.max){minMax=this._getAccessorMinMax(sourceBuffer,accessor.size);}var accessorDefaults={size:accessor.size,componentType:getComponentTypeFromArray(sourceBuffer),count:Math.round(sourceBuffer.length/accessor.size),min:minMax.min,max:minMax.max};return this.addAccessor(bufferViewIndex,Object.assign(accessorDefaults,accessor));}},{key:"addTexture",value:function addTexture(texture){var imageIndex=texture.imageIndex;var glTFTexture={source:imageIndex};this.json.textures=this.json.textures||[];this.json.textures.push(glTFTexture);return this.json.textures.length-1;}},{key:"addMaterial",value:function addMaterial(pbrMaterialInfo){this.json.materials=this.json.materials||[];this.json.materials.push(pbrMaterialInfo);return this.json.materials.length-1;}},{key:"createBinaryChunk",value:function createBinaryChunk(){var _this$json,_this$json$buffers;this.gltf.buffers=[];var totalByteLength=this.byteLength;var arrayBuffer=new ArrayBuffer(totalByteLength);var targetArray=new Uint8Array(arrayBuffer);var dstByteOffset=0;var _iterator16=_createForOfIteratorHelper(this.sourceBuffers||[]),_step16;try{for(_iterator16.s();!(_step16=_iterator16.n()).done;){var sourceBuffer=_step16.value;dstByteOffset=copyToArray(sourceBuffer,targetArray,dstByteOffset);}}catch(err){_iterator16.e(err);}finally{_iterator16.f();}if((_this$json=this.json)!==null&&_this$json!==void 0&&(_this$json$buffers=_this$json.buffers)!==null&&_this$json$buffers!==void 0&&_this$json$buffers[0]){this.json.buffers[0].byteLength=totalByteLength;}else{this.json.buffers=[{byteLength:totalByteLength}];}this.gltf.binary=arrayBuffer;this.sourceBuffers=[arrayBuffer];}},{key:"_removeStringFromArray",value:function _removeStringFromArray(array,string){var found=true;while(found){var index=array.indexOf(string);if(index>-1){array.splice(index,1);}else{found=false;}}}},{key:"_addAttributes",value:function _addAttributes(){var attributes=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};var result={};for(var attributeKey in attributes){var attributeData=attributes[attributeKey];var attrName=this._getGltfAttributeName(attributeKey);var accessor=this.addBinaryBuffer(attributeData.value,attributeData);result[attrName]=accessor;}return result;}},{key:"_addIndices",value:function _addIndices(indices){return this.addBinaryBuffer(indices,{size:1});}},{key:"_getGltfAttributeName",value:function _getGltfAttributeName(attributeName){switch(attributeName.toLowerCase()){case'position':case'positions':case'vertices':return'POSITION';case'normal':case'normals':return'NORMAL';case'color':case'colors':return'COLOR_0';case'texcoord':case'texcoords':return'TEXCOORD_0';default:return attributeName;}}},{key:"_getAccessorMinMax",value:function _getAccessorMinMax(buffer,size){var result={min:null,max:null};if(buffer.length<size){return result;}result.min=[];result.max=[];var initValues=buffer.subarray(0,size);var _iterator17=_createForOfIteratorHelper(initValues),_step17;try{for(_iterator17.s();!(_step17=_iterator17.n()).done;){var value=_step17.value;result.min.push(value);result.max.push(value);}}catch(err){_iterator17.e(err);}finally{_iterator17.f();}for(var index=size;index<buffer.length;index+=size){for(var componentIndex=0;componentIndex<size;componentIndex++){result.min[0+componentIndex]=Math.min(result.min[0+componentIndex],buffer[index+componentIndex]);result.max[0+componentIndex]=Math.max(result.max[0+componentIndex],buffer[index+componentIndex]);}}return result;}}]);}();var wasm_base='B9h9z9tFBBBF8fL9gBB9gLaaaaaFa9gEaaaB9gFaFa9gEaaaFaEMcBFFFGGGEIIILF9wFFFLEFBFKNFaFCx/IFMO/LFVK9tv9t9vq95GBt9f9f939h9z9t9f9j9h9s9s9f9jW9vq9zBBp9tv9z9o9v9wW9f9kv9j9v9kv9WvqWv94h919m9mvqBF8Z9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv94h919m9mvqBGy9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv949TvZ91v9u9jvBEn9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9P9jWBIi9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9R919hWBLn9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9F949wBKI9z9iqlBOc+x8ycGBM/qQFTa8jUUUUBCU/EBlHL8kUUUUBC9+RKGXAGCFJAI9LQBCaRKAE2BBC+gF9HQBALAEAIJHOAGlAGTkUUUBRNCUoBAG9uC/wgBZHKCUGAKCUG9JyRVAECFJRICBRcGXEXAcAF9PQFAVAFAclAcAVJAF9JyRMGXGXAG9FQBAMCbJHKC9wZRSAKCIrCEJCGrRQANCUGJRfCBRbAIRTEXGXAOATlAQ9PQBCBRISEMATAQJRIGXAS9FQBCBRtCBREEXGXAOAIlCi9PQBCBRISLMANCU/CBJAEJRKGXGXGXGXGXATAECKrJ2BBAtCKZrCEZfIBFGEBMAKhB83EBAKCNJhB83EBSEMAKAI2BIAI2BBHmCKrHYAYCE6HYy86BBAKCFJAICIJAYJHY2BBAmCIrCEZHPAPCE6HPy86BBAKCGJAYAPJHY2BBAmCGrCEZHPAPCE6HPy86BBAKCEJAYAPJHY2BBAmCEZHmAmCE6Hmy86BBAKCIJAYAmJHY2BBAI2BFHmCKrHPAPCE6HPy86BBAKCLJAYAPJHY2BBAmCIrCEZHPAPCE6HPy86BBAKCKJAYAPJHY2BBAmCGrCEZHPAPCE6HPy86BBAKCOJAYAPJHY2BBAmCEZHmAmCE6Hmy86BBAKCNJAYAmJHY2BBAI2BGHmCKrHPAPCE6HPy86BBAKCVJAYAPJHY2BBAmCIrCEZHPAPCE6HPy86BBAKCcJAYAPJHY2BBAmCGrCEZHPAPCE6HPy86BBAKCMJAYAPJHY2BBAmCEZHmAmCE6Hmy86BBAKCSJAYAmJHm2BBAI2BEHICKrHYAYCE6HYy86BBAKCQJAmAYJHm2BBAICIrCEZHYAYCE6HYy86BBAKCfJAmAYJHm2BBAICGrCEZHYAYCE6HYy86BBAKCbJAmAYJHK2BBAICEZHIAICE6HIy86BBAKAIJRISGMAKAI2BNAI2BBHmCIrHYAYCb6HYy86BBAKCFJAICNJAYJHY2BBAmCbZHmAmCb6Hmy86BBAKCGJAYAmJHm2BBAI2BFHYCIrHPAPCb6HPy86BBAKCEJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCIJAmAYJHm2BBAI2BGHYCIrHPAPCb6HPy86BBAKCLJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCKJAmAYJHm2BBAI2BEHYCIrHPAPCb6HPy86BBAKCOJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCNJAmAYJHm2BBAI2BIHYCIrHPAPCb6HPy86BBAKCVJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCcJAmAYJHm2BBAI2BLHYCIrHPAPCb6HPy86BBAKCMJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCSJAmAYJHm2BBAI2BKHYCIrHPAPCb6HPy86BBAKCQJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCfJAmAYJHm2BBAI2BOHICIrHYAYCb6HYy86BBAKCbJAmAYJHK2BBAICbZHIAICb6HIy86BBAKAIJRISFMAKAI8pBB83BBAKCNJAICNJ8pBB83BBAICTJRIMAtCGJRtAECTJHEAS9JQBMMGXAIQBCBRISEMGXAM9FQBANAbJ2BBRtCBRKAfREEXAEANCU/CBJAKJ2BBHTCFrCBATCFZl9zAtJHt86BBAEAGJREAKCFJHKAM9HQBMMAfCFJRfAIRTAbCFJHbAG9HQBMMABAcAG9sJANCUGJAMAG9sTkUUUBpANANCUGJAMCaJAG9sJAGTkUUUBpMAMCBAIyAcJRcAIQBMC9+RKSFMCBC99AOAIlAGCAAGCA9Ly6yRKMALCU/EBJ8kUUUUBAKM+OmFTa8jUUUUBCoFlHL8kUUUUBC9+RKGXAFCE9uHOCtJAI9LQBCaRKAE2BBHNC/wFZC/gF9HQBANCbZHVCF9LQBALCoBJCgFCUFT+JUUUBpALC84Jha83EBALC8wJha83EBALC8oJha83EBALCAJha83EBALCiJha83EBALCTJha83EBALha83ENALha83EBAEAIJC9wJRcAECFJHNAOJRMGXAF9FQBCQCbAVCF6yRSABRECBRVCBRQCBRfCBRICBRKEXGXAMAcuQBC9+RKSEMGXGXAN2BBHOC/vF9LQBALCoBJAOCIrCa9zAKJCbZCEWJHb8oGIRTAb8oGBRtGXAOCbZHbAS9PQBALAOCa9zAIJCbZCGWJ8oGBAVAbyROAb9FRbGXGXAGCG9HQBABAt87FBABCIJAO87FBABCGJAT87FBSFMAEAtjGBAECNJAOjGBAECIJATjGBMAVAbJRVALCoBJAKCEWJHmAOjGBAmATjGIALAICGWJAOjGBALCoBJAKCFJCbZHKCEWJHTAtjGBATAOjGIAIAbJRIAKCFJRKSGMGXGXAbCb6QBAQAbJAbC989zJCFJRQSFMAM1BBHbCgFZROGXGXAbCa9MQBAMCFJRMSFMAM1BFHbCgBZCOWAOCgBZqROGXAbCa9MQBAMCGJRMSFMAM1BGHbCgBZCfWAOqROGXAbCa9MQBAMCEJRMSFMAM1BEHbCgBZCdWAOqROGXAbCa9MQBAMCIJRMSFMAM2BIC8cWAOqROAMCLJRMMAOCFrCBAOCFZl9zAQJRQMGXGXAGCG9HQBABAt87FBABCIJAQ87FBABCGJAT87FBSFMAEAtjGBAECNJAQjGBAECIJATjGBMALCoBJAKCEWJHOAQjGBAOATjGIALAICGWJAQjGBALCoBJAKCFJCbZHKCEWJHOAtjGBAOAQjGIAICFJRIAKCFJRKSFMGXAOCDF9LQBALAIAcAOCbZJ2BBHbCIrHTlCbZCGWJ8oGBAVCFJHtATyROALAIAblCbZCGWJ8oGBAtAT9FHmJHtAbCbZHTyRbAT9FRTGXGXAGCG9HQBABAV87FBABCIJAb87FBABCGJAO87FBSFMAEAVjGBAECNJAbjGBAECIJAOjGBMALAICGWJAVjGBALCoBJAKCEWJHYAOjGBAYAVjGIALAICFJHICbZCGWJAOjGBALCoBJAKCFJCbZCEWJHYAbjGBAYAOjGIALAIAmJCbZHICGWJAbjGBALCoBJAKCGJCbZHKCEWJHOAVjGBAOAbjGIAKCFJRKAIATJRIAtATJRVSFMAVCBAM2BBHYyHTAOC/+F6HPJROAYCbZRtGXGXAYCIrHmQBAOCFJRbSFMAORbALAIAmlCbZCGWJ8oGBROMGXGXAtQBAbCFJRVSFMAbRVALAIAYlCbZCGWJ8oGBRbMGXGXAP9FQBAMCFJRYSFMAM1BFHYCgFZRTGXGXAYCa9MQBAMCGJRYSFMAM1BGHYCgBZCOWATCgBZqRTGXAYCa9MQBAMCEJRYSFMAM1BEHYCgBZCfWATqRTGXAYCa9MQBAMCIJRYSFMAM1BIHYCgBZCdWATqRTGXAYCa9MQBAMCLJRYSFMAMCKJRYAM2BLC8cWATqRTMATCFrCBATCFZl9zAQJHQRTMGXGXAmCb6QBAYRPSFMAY1BBHMCgFZROGXGXAMCa9MQBAYCFJRPSFMAY1BFHMCgBZCOWAOCgBZqROGXAMCa9MQBAYCGJRPSFMAY1BGHMCgBZCfWAOqROGXAMCa9MQBAYCEJRPSFMAY1BEHMCgBZCdWAOqROGXAMCa9MQBAYCIJRPSFMAYCLJRPAY2BIC8cWAOqROMAOCFrCBAOCFZl9zAQJHQROMGXGXAtCb6QBAPRMSFMAP1BBHMCgFZRbGXGXAMCa9MQBAPCFJRMSFMAP1BFHMCgBZCOWAbCgBZqRbGXAMCa9MQBAPCGJRMSFMAP1BGHMCgBZCfWAbqRbGXAMCa9MQBAPCEJRMSFMAP1BEHMCgBZCdWAbqRbGXAMCa9MQBAPCIJRMSFMAPCLJRMAP2BIC8cWAbqRbMAbCFrCBAbCFZl9zAQJHQRbMGXGXAGCG9HQBABAT87FBABCIJAb87FBABCGJAO87FBSFMAEATjGBAECNJAbjGBAECIJAOjGBMALCoBJAKCEWJHYAOjGBAYATjGIALAICGWJATjGBALCoBJAKCFJCbZCEWJHYAbjGBAYAOjGIALAICFJHICbZCGWJAOjGBALCoBJAKCGJCbZCEWJHOATjGBAOAbjGIALAIAm9FAmCb6qJHICbZCGWJAbjGBAIAt9FAtCb6qJRIAKCEJRKMANCFJRNABCKJRBAECSJREAKCbZRKAICbZRIAfCEJHfAF9JQBMMCBC99AMAc6yRKMALCoFJ8kUUUUBAKM/tIFGa8jUUUUBCTlRLC9+RKGXAFCLJAI9LQBCaRKAE2BBC/+FZC/QF9HQBALhB83ENAECFJRKAEAIJC98JREGXAF9FQBGXAGCG6QBEXGXAKAE9JQBC9+bMAK1BBHGCgFZRIGXGXAGCa9MQBAKCFJRKSFMAK1BFHGCgBZCOWAICgBZqRIGXAGCa9MQBAKCGJRKSFMAK1BGHGCgBZCfWAIqRIGXAGCa9MQBAKCEJRKSFMAK1BEHGCgBZCdWAIqRIGXAGCa9MQBAKCIJRKSFMAK2BIC8cWAIqRIAKCLJRKMALCNJAICFZCGWqHGAICGrCBAICFrCFZl9zAG8oGBJHIjGBABAIjGBABCIJRBAFCaJHFQBSGMMEXGXAKAE9JQBC9+bMAK1BBHGCgFZRIGXGXAGCa9MQBAKCFJRKSFMAK1BFHGCgBZCOWAICgBZqRIGXAGCa9MQBAKCGJRKSFMAK1BGHGCgBZCfWAIqRIGXAGCa9MQBAKCEJRKSFMAK1BEHGCgBZCdWAIqRIGXAGCa9MQBAKCIJRKSFMAK2BIC8cWAIqRIAKCLJRKMABAICGrCBAICFrCFZl9zALCNJAICFZCGWqHI8oGBJHG87FBAIAGjGBABCGJRBAFCaJHFQBMMCBC99AKAE6yRKMAKM+lLKFaF99GaG99FaG99GXGXAGCI9HQBAF9FQFEXGXGX9DBBB8/9DBBB+/ABCGJHG1BB+yAB1BBHE+yHI+L+TABCFJHL1BBHK+yHO+L+THN9DBBBB9gHVyAN9DBB/+hANAN+U9DBBBBANAVyHcAc+MHMAECa3yAI+SHIAI+UAcAMAKCa3yAO+SHcAc+U+S+S+R+VHO+U+SHN+L9DBBB9P9d9FQBAN+oRESFMCUUUU94REMAGAE86BBGXGX9DBBB8/9DBBB+/Ac9DBBBB9gyAcAO+U+SHN+L9DBBB9P9d9FQBAN+oRGSFMCUUUU94RGMALAG86BBGXGX9DBBB8/9DBBB+/AI9DBBBB9gyAIAO+U+SHN+L9DBBB9P9d9FQBAN+oRGSFMCUUUU94RGMABAG86BBABCIJRBAFCaJHFQBSGMMAF9FQBEXGXGX9DBBB8/9DBBB+/ABCIJHG8uFB+yAB8uFBHE+yHI+L+TABCGJHL8uFBHK+yHO+L+THN9DBBBB9gHVyAN9DB/+g6ANAN+U9DBBBBANAVyHcAc+MHMAECa3yAI+SHIAI+UAcAMAKCa3yAO+SHcAc+U+S+S+R+VHO+U+SHN+L9DBBB9P9d9FQBAN+oRESFMCUUUU94REMAGAE87FBGXGX9DBBB8/9DBBB+/Ac9DBBBB9gyAcAO+U+SHN+L9DBBB9P9d9FQBAN+oRGSFMCUUUU94RGMALAG87FBGXGX9DBBB8/9DBBB+/AI9DBBBB9gyAIAO+U+SHN+L9DBBB9P9d9FQBAN+oRGSFMCUUUU94RGMABAG87FBABCNJRBAFCaJHFQBMMM/SEIEaE99EaF99GXAF9FQBCBREABRIEXGXGX9D/zI818/AICKJ8uFBHLCEq+y+VHKAI8uFB+y+UHO9DB/+g6+U9DBBB8/9DBBB+/AO9DBBBB9gy+SHN+L9DBBB9P9d9FQBAN+oRVSFMCUUUU94RVMAICIJ8uFBRcAICGJ8uFBRMABALCFJCEZAEqCFWJAV87FBGXGXAKAM+y+UHN9DB/+g6+U9DBBB8/9DBBB+/AN9DBBBB9gy+SHS+L9DBBB9P9d9FQBAS+oRMSFMCUUUU94RMMABALCGJCEZAEqCFWJAM87FBGXGXAKAc+y+UHK9DB/+g6+U9DBBB8/9DBBB+/AK9DBBBB9gy+SHS+L9DBBB9P9d9FQBAS+oRcSFMCUUUU94RcMABALCaJCEZAEqCFWJAc87FBGXGX9DBBU8/AOAO+U+TANAN+U+TAKAK+U+THO9DBBBBAO9DBBBB9gy+R9DB/+g6+U9DBBB8/+SHO+L9DBBB9P9d9FQBAO+oRcSFMCUUUU94RcMABALCEZAEqCFWJAc87FBAICNJRIAECIJREAFCaJHFQBMMM9JBGXAGCGrAF9sHF9FQBEXABAB8oGBHGCNWCN91+yAGCi91CnWCUUU/8EJ+++U84GBABCIJRBAFCaJHFQBMMM9TFEaCBCB8oGUkUUBHFABCEJC98ZJHBjGUkUUBGXGXAB8/BCTWHGuQBCaREABAGlCggEJCTrXBCa6QFMAFREMAEM/lFFFaGXGXAFABqCEZ9FQBABRESFMGXGXAGCT9PQBABRESFMABREEXAEAF8oGBjGBAECIJAFCIJ8oGBjGBAECNJAFCNJ8oGBjGBAECSJAFCSJ8oGBjGBAECTJREAFCTJRFAGC9wJHGCb9LQBMMAGCI9JQBEXAEAF8oGBjGBAFCIJRFAECIJREAGC98JHGCE9LQBMMGXAG9FQBEXAEAF2BB86BBAECFJREAFCFJRFAGCaJHGQBMMABMoFFGaGXGXABCEZ9FQBABRESFMAFCgFZC+BwsN9sRIGXGXAGCT9PQBABRESFMABREEXAEAIjGBAECSJAIjGBAECNJAIjGBAECIJAIjGBAECTJREAGC9wJHGCb9LQBMMAGCI9JQBEXAEAIjGBAECIJREAGC98JHGCE9LQBMMGXAG9FQBEXAEAF86BBAECFJREAGCaJHGQBMMABMMMFBCUNMIT9kBB';var wasm_simd='B9h9z9tFBBBF8dL9gBB9gLaaaaaFa9gEaaaB9gGaaB9gFaFaEQSBBFBFFGEGEGIILF9wFFFLEFBFKNFaFCx/aFMO/LFVK9tv9t9vq95GBt9f9f939h9z9t9f9j9h9s9s9f9jW9vq9zBBp9tv9z9o9v9wW9f9kv9j9v9kv9WvqWv94h919m9mvqBG8Z9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv94h919m9mvqBIy9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv949TvZ91v9u9jvBLn9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9P9jWBKi9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9R919hWBNn9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9F949wBcI9z9iqlBMc/j9JSIBTEM9+FLa8jUUUUBCTlRBCBRFEXCBRGCBREEXABCNJAGJAECUaAFAGrCFZHIy86BBAEAIJREAGCFJHGCN9HQBMAFCx+YUUBJAE86BBAFCEWCxkUUBJAB8pEN83EBAFCFJHFCUG9HQBMMkRIbaG97FaK978jUUUUBCU/KBlHL8kUUUUBC9+RKGXAGCFJAI9LQBCaRKAE2BBC+gF9HQBALAEAIJHOAGlAG/8cBBCUoBAG9uC/wgBZHKCUGAKCUG9JyRNAECFJRKCBRVGXEXAVAF9PQFANAFAVlAVANJAF9JyRcGXGXAG9FQBAcCbJHIC9wZHMCE9sRSAMCFWRQAICIrCEJCGrRfCBRbEXAKRTCBRtGXEXGXAOATlAf9PQBCBRKSLMALCU/CBJAtAM9sJRmATAfJRKCBREGXAMCoB9JQBAOAKlC/gB9JQBCBRIEXAmAIJREGXGXGXGXGXATAICKrJ2BBHYCEZfIBFGEBMAECBDtDMIBSEMAEAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPD8dBhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBAeCx+YUUBJDBBBHnAnDQBBBBBBBBBBBBBBBBAPD8dFhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIBAKCIJAnDeBJAeCx+YUUBJ2BBJRKSGMAEAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPD8dBhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBAeCx+YUUBJDBBBHnAnDQBBBBBBBBBBBBBBBBAPD8dFhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIBAKCNJAnDeBJAeCx+YUUBJ2BBJRKSFMAEAKDBBBDMIBAKCTJRKMGXGXGXGXGXAYCGrCEZfIBFGEBMAECBDtDMITSEMAEAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPD8dBhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBAeCx+YUUBJDBBBHnAnDQBBBBBBBBBBBBBBBBAPD8dFhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMITAKCIJAnDeBJAeCx+YUUBJ2BBJRKSGMAEAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPD8dBhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBAeCx+YUUBJDBBBHnAnDQBBBBBBBBBBBBBBBBAPD8dFhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMITAKCNJAnDeBJAeCx+YUUBJ2BBJRKSFMAEAKDBBBDMITAKCTJRKMGXGXGXGXGXAYCIrCEZfIBFGEBMAECBDtDMIASEMAEAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPD8dBhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBAeCx+YUUBJDBBBHnAnDQBBBBBBBBBBBBBBBBAPD8dFhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIAAKCIJAnDeBJAeCx+YUUBJ2BBJRKSGMAEAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPD8dBhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBAeCx+YUUBJDBBBHnAnDQBBBBBBBBBBBBBBBBAPD8dFhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIAAKCNJAnDeBJAeCx+YUUBJ2BBJRKSFMAEAKDBBBDMIAAKCTJRKMGXGXGXGXGXAYCKrfIBFGEBMAECBDtDMI8wSEMAEAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPD8dBhUg/8/4/w/goB9+h84k7HYCEWCxkUUBJDBEBAYCx+YUUBJDBBBHnAnDQBBBBBBBBBBBBBBBBAPD8dFhUg/8/4/w/goB9+h84k7HYCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMI8wAKCIJAnDeBJAYCx+YUUBJ2BBJRKSGMAEAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPD8dBhUg/8/4/w/goB9+h84k7HYCEWCxkUUBJDBEBAYCx+YUUBJDBBBHnAnDQBBBBBBBBBBBBBBBBAPD8dFhUg/8/4/w/goB9+h84k7HYCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMI8wAKCNJAnDeBJAYCx+YUUBJ2BBJRKSFMAEAKDBBBDMI8wAKCTJRKMAICoBJREAICUFJAM9LQFAERIAOAKlC/fB9LQBMMGXAEAM9PQBAECErRIEXGXAOAKlCi9PQBCBRKSOMAmAEJRYGXGXGXGXGXATAECKrJ2BBAICKZrCEZfIBFGEBMAYCBDtDMIBSEMAYAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPD8dBhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBAeCx+YUUBJDBBBHnAnDQBBBBBBBBBBBBBBBBAPD8dFhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIBAKCIJAnDeBJAeCx+YUUBJ2BBJRKSGMAYAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPD8dBhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBAeCx+YUUBJDBBBHnAnDQBBBBBBBBBBBBBBBBAPD8dFhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIBAKCNJAnDeBJAeCx+YUUBJ2BBJRKSFMAYAKDBBBDMIBAKCTJRKMAICGJRIAECTJHEAM9JQBMMGXAK9FQBAKRTAtCFJHtCI6QGSFMMCBRKSEMGXAM9FQBALCUGJAbJREALAbJDBGBRnCBRYEXAEALCU/CBJAYJHIDBIBHdCFD9tAdCFDbHPD9OD9hD9RHdAIAMJDBIBHiCFD9tAiAPD9OD9hD9RHiDQBTFtGmEYIPLdKeOnH8ZAIAQJDBIBHpCFD9tApAPD9OD9hD9RHpAIASJDBIBHyCFD9tAyAPD9OD9hD9RHyDQBTFtGmEYIPLdKeOnH8cDQBFTtGEmYILPdKOenHPAPDQBFGEBFGEBFGEBFGEAnD9uHnDyBjGBAEAGJHIAnAPAPDQILKOILKOILKOILKOD9uHnDyBjGBAIAGJHIAnAPAPDQNVcMNVcMNVcMNVcMD9uHnDyBjGBAIAGJHIAnAPAPDQSQfbSQfbSQfbSQfbD9uHnDyBjGBAIAGJHIAnA8ZA8cDQNVi8ZcMpySQ8c8dfb8e8fHPAPDQBFGEBFGEBFGEBFGED9uHnDyBjGBAIAGJHIAnAPAPDQILKOILKOILKOILKOD9uHnDyBjGBAIAGJHIAnAPAPDQNVcMNVcMNVcMNVcMD9uHnDyBjGBAIAGJHIAnAPAPDQSQfbSQfbSQfbSQfbD9uHnDyBjGBAIAGJHIAnAdAiDQNiV8ZcpMyS8cQ8df8eb8fHdApAyDQNiV8ZcpMyS8cQ8df8eb8fHiDQBFTtGEmYILPdKOenHPAPDQBFGEBFGEBFGEBFGED9uHnDyBjGBAIAGJHIAnAPAPDQILKOILKOILKOILKOD9uHnDyBjGBAIAGJHIAnAPAPDQNVcMNVcMNVcMNVcMD9uHnDyBjGBAIAGJHIAnAPAPDQSQfbSQfbSQfbSQfbD9uHnDyBjGBAIAGJHIAnAdAiDQNVi8ZcMpySQ8c8dfb8e8fHPAPDQBFGEBFGEBFGEBFGED9uHnDyBjGBAIAGJHIAnAPAPDQILKOILKOILKOILKOD9uHnDyBjGBAIAGJHIAnAPAPDQNVcMNVcMNVcMNVcMD9uHnDyBjGBAIAGJHIAnAPAPDQSQfbSQfbSQfbSQfbD9uHnDyBjGBAIAGJREAYCTJHYAM9JQBMMAbCIJHbAG9JQBMMABAVAG9sJALCUGJAcAG9s/8cBBALALCUGJAcCaJAG9sJAG/8cBBMAcCBAKyAVJRVAKQBMC9+RKSFMCBC99AOAKlAGCAAGCA9Ly6yRKMALCU/KBJ8kUUUUBAKMNBT+BUUUBM+KmFTa8jUUUUBCoFlHL8kUUUUBC9+RKGXAFCE9uHOCtJAI9LQBCaRKAE2BBHNC/wFZC/gF9HQBANCbZHVCF9LQBALCoBJCgFCUF/8MBALC84Jha83EBALC8wJha83EBALC8oJha83EBALCAJha83EBALCiJha83EBALCTJha83EBALha83ENALha83EBAEAIJC9wJRcAECFJHNAOJRMGXAF9FQBCQCbAVCF6yRSABRECBRVCBRQCBRfCBRICBRKEXGXAMAcuQBC9+RKSEMGXGXAN2BBHOC/vF9LQBALCoBJAOCIrCa9zAKJCbZCEWJHb8oGIRTAb8oGBRtGXAOCbZHbAS9PQBALAOCa9zAIJCbZCGWJ8oGBAVAbyROAb9FRbGXGXAGCG9HQBABAt87FBABCIJAO87FBABCGJAT87FBSFMAEAtjGBAECNJAOjGBAECIJATjGBMAVAbJRVALCoBJAKCEWJHmAOjGBAmATjGIALAICGWJAOjGBALCoBJAKCFJCbZHKCEWJHTAtjGBATAOjGIAIAbJRIAKCFJRKSGMGXGXAbCb6QBAQAbJAbC989zJCFJRQSFMAM1BBHbCgFZROGXGXAbCa9MQBAMCFJRMSFMAM1BFHbCgBZCOWAOCgBZqROGXAbCa9MQBAMCGJRMSFMAM1BGHbCgBZCfWAOqROGXAbCa9MQBAMCEJRMSFMAM1BEHbCgBZCdWAOqROGXAbCa9MQBAMCIJRMSFMAM2BIC8cWAOqROAMCLJRMMAOCFrCBAOCFZl9zAQJRQMGXGXAGCG9HQBABAt87FBABCIJAQ87FBABCGJAT87FBSFMAEAtjGBAECNJAQjGBAECIJATjGBMALCoBJAKCEWJHOAQjGBAOATjGIALAICGWJAQjGBALCoBJAKCFJCbZHKCEWJHOAtjGBAOAQjGIAICFJRIAKCFJRKSFMGXAOCDF9LQBALAIAcAOCbZJ2BBHbCIrHTlCbZCGWJ8oGBAVCFJHtATyROALAIAblCbZCGWJ8oGBAtAT9FHmJHtAbCbZHTyRbAT9FRTGXGXAGCG9HQBABAV87FBABCIJAb87FBABCGJAO87FBSFMAEAVjGBAECNJAbjGBAECIJAOjGBMALAICGWJAVjGBALCoBJAKCEWJHYAOjGBAYAVjGIALAICFJHICbZCGWJAOjGBALCoBJAKCFJCbZCEWJHYAbjGBAYAOjGIALAIAmJCbZHICGWJAbjGBALCoBJAKCGJCbZHKCEWJHOAVjGBAOAbjGIAKCFJRKAIATJRIAtATJRVSFMAVCBAM2BBHYyHTAOC/+F6HPJROAYCbZRtGXGXAYCIrHmQBAOCFJRbSFMAORbALAIAmlCbZCGWJ8oGBROMGXGXAtQBAbCFJRVSFMAbRVALAIAYlCbZCGWJ8oGBRbMGXGXAP9FQBAMCFJRYSFMAM1BFHYCgFZRTGXGXAYCa9MQBAMCGJRYSFMAM1BGHYCgBZCOWATCgBZqRTGXAYCa9MQBAMCEJRYSFMAM1BEHYCgBZCfWATqRTGXAYCa9MQBAMCIJRYSFMAM1BIHYCgBZCdWATqRTGXAYCa9MQBAMCLJRYSFMAMCKJRYAM2BLC8cWATqRTMATCFrCBATCFZl9zAQJHQRTMGXGXAmCb6QBAYRPSFMAY1BBHMCgFZROGXGXAMCa9MQBAYCFJRPSFMAY1BFHMCgBZCOWAOCgBZqROGXAMCa9MQBAYCGJRPSFMAY1BGHMCgBZCfWAOqROGXAMCa9MQBAYCEJRPSFMAY1BEHMCgBZCdWAOqROGXAMCa9MQBAYCIJRPSFMAYCLJRPAY2BIC8cWAOqROMAOCFrCBAOCFZl9zAQJHQROMGXGXAtCb6QBAPRMSFMAP1BBHMCgFZRbGXGXAMCa9MQBAPCFJRMSFMAP1BFHMCgBZCOWAbCgBZqRbGXAMCa9MQBAPCGJRMSFMAP1BGHMCgBZCfWAbqRbGXAMCa9MQBAPCEJRMSFMAP1BEHMCgBZCdWAbqRbGXAMCa9MQBAPCIJRMSFMAPCLJRMAP2BIC8cWAbqRbMAbCFrCBAbCFZl9zAQJHQRbMGXGXAGCG9HQBABAT87FBABCIJAb87FBABCGJAO87FBSFMAEATjGBAECNJAbjGBAECIJAOjGBMALCoBJAKCEWJHYAOjGBAYATjGIALAICGWJATjGBALCoBJAKCFJCbZCEWJHYAbjGBAYAOjGIALAICFJHICbZCGWJAOjGBALCoBJAKCGJCbZCEWJHOATjGBAOAbjGIALAIAm9FAmCb6qJHICbZCGWJAbjGBAIAt9FAtCb6qJRIAKCEJRKMANCFJRNABCKJRBAECSJREAKCbZRKAICbZRIAfCEJHfAF9JQBMMCBC99AMAc6yRKMALCoFJ8kUUUUBAKM/tIFGa8jUUUUBCTlRLC9+RKGXAFCLJAI9LQBCaRKAE2BBC/+FZC/QF9HQBALhB83ENAECFJRKAEAIJC98JREGXAF9FQBGXAGCG6QBEXGXAKAE9JQBC9+bMAK1BBHGCgFZRIGXGXAGCa9MQBAKCFJRKSFMAK1BFHGCgBZCOWAICgBZqRIGXAGCa9MQBAKCGJRKSFMAK1BGHGCgBZCfWAIqRIGXAGCa9MQBAKCEJRKSFMAK1BEHGCgBZCdWAIqRIGXAGCa9MQBAKCIJRKSFMAK2BIC8cWAIqRIAKCLJRKMALCNJAICFZCGWqHGAICGrCBAICFrCFZl9zAG8oGBJHIjGBABAIjGBABCIJRBAFCaJHFQBSGMMEXGXAKAE9JQBC9+bMAK1BBHGCgFZRIGXGXAGCa9MQBAKCFJRKSFMAK1BFHGCgBZCOWAICgBZqRIGXAGCa9MQBAKCGJRKSFMAK1BGHGCgBZCfWAIqRIGXAGCa9MQBAKCEJRKSFMAK1BEHGCgBZCdWAIqRIGXAGCa9MQBAKCIJRKSFMAK2BIC8cWAIqRIAKCLJRKMABAICGrCBAICFrCFZl9zALCNJAICFZCGWqHI8oGBJHG87FBAIAGjGBABCGJRBAFCaJHFQBMMCBC99AKAE6yRKMAKM/xLGEaK978jUUUUBCAlHE8kUUUUBGXGXAGCI9HQBGXAFC98ZHI9FQBABRGCBRLEXAGAGDBBBHKCiD+rFCiD+sFD/6FHOAKCND+rFCiD+sFD/6FAOD/gFAKCTD+rFCiD+sFD/6FHND/gFD/kFD/lFHVCBDtD+2FHcAOCUUUU94DtHMD9OD9RD/kFHO9DBB/+hDYAOAOD/mFAVAVD/mFANAcANAMD9OD9RD/kFHOAOD/mFD/kFD/kFD/jFD/nFHND/mF9DBBX9LDYHcD/kFCgFDtD9OAKCUUU94DtD9OD9QAOAND/mFAcD/kFCND+rFCU/+EDtD9OD9QAVAND/mFAcD/kFCTD+rFCUU/8ODtD9OD9QDMBBAGCTJRGALCIJHLAI9JQBMMAIAF9PQFAEAFCEZHLCGWHGqCBCTAGl/8MBAEABAICGWJHIAG/8cBBGXAL9FQBAEAEDBIBHKCiD+rFCiD+sFD/6FHOAKCND+rFCiD+sFD/6FAOD/gFAKCTD+rFCiD+sFD/6FHND/gFD/kFD/lFHVCBDtD+2FHcAOCUUUU94DtHMD9OD9RD/kFHO9DBB/+hDYAOAOD/mFAVAVD/mFANAcANAMD9OD9RD/kFHOAOD/mFD/kFD/kFD/jFD/nFHND/mF9DBBX9LDYHcD/kFCgFDtD9OAKCUUU94DtD9OD9QAOAND/mFAcD/kFCND+rFCU/+EDtD9OD9QAVAND/mFAcD/kFCTD+rFCUU/8ODtD9OD9QDMIBMAIAEAG/8cBBSFMABAFC98ZHGT+HUUUBAGAF9PQBAEAFCEZHICEWHLJCBCAALl/8MBAEABAGCEWJHGAL/8cBBAEAIT+HUUUBAGAEAL/8cBBMAECAJ8kUUUUBM+yEGGaO97GXAF9FQBCBRGEXABCTJHEAEDBBBHICBDtHLCUU98D8cFCUU98D8cEHKD9OABDBBBHOAIDQILKOSQfbPden8c8d8e8fCggFDtD9OD/6FAOAIDQBFGENVcMTtmYi8ZpyHICTD+sFD/6FHND/gFAICTD+rFCTD+sFD/6FHVD/gFD/kFD/lFHI9DB/+g6DYAVAIALD+2FHLAVCUUUU94DtHcD9OD9RD/kFHVAVD/mFAIAID/mFANALANAcD9OD9RD/kFHIAID/mFD/kFD/kFD/jFD/nFHND/mF9DBBX9LDYHLD/kFCTD+rFAVAND/mFALD/kFCggEDtD9OD9QHVAIAND/mFALD/kFCaDbCBDnGCBDnECBDnKCBDnOCBDncCBDnMCBDnfCBDnbD9OHIDQNVi8ZcMpySQ8c8dfb8e8fD9QDMBBABAOAKD9OAVAIDQBFTtGEmYILPdKOenD9QDMBBABCAJRBAGCIJHGAF9JQBMMM94FEa8jUUUUBCAlHE8kUUUUBABAFC98ZHIT+JUUUBGXAIAF9PQBAEAFCEZHLCEWHFJCBCAAFl/8MBAEABAICEWJHBAF/8cBBAEALT+JUUUBABAEAF/8cBBMAECAJ8kUUUUBM/hEIGaF97FaL978jUUUUBCTlRGGXAF9FQBCBREEXAGABDBBBHIABCTJHLDBBBHKDQILKOSQfbPden8c8d8e8fHOCTD+sFHNCID+rFDMIBAB9DBBU8/DY9D/zI818/DYANCEDtD9QD/6FD/nFHNAIAKDQBFGENVcMTtmYi8ZpyHICTD+rFCTD+sFD/6FD/mFHKAKD/mFANAICTD+sFD/6FD/mFHVAVD/mFANAOCTD+rFCTD+sFD/6FD/mFHOAOD/mFD/kFD/kFD/lFCBDtD+4FD/jF9DB/+g6DYHND/mF9DBBX9LDYHID/kFCggEDtHcD9OAVAND/mFAID/kFCTD+rFD9QHVAOAND/mFAID/kFCTD+rFAKAND/mFAID/kFAcD9OD9QHNDQBFTtGEmYILPdKOenHID8dBAGDBIBDyB+t+J83EBABCNJAID8dFAGDBIBDyF+t+J83EBALAVANDQNVi8ZcMpySQ8c8dfb8e8fHND8dBAGDBIBDyG+t+J83EBABCiJAND8dFAGDBIBDyE+t+J83EBABCAJRBAECIJHEAF9JQBMMM/3FGEaF978jUUUUBCoBlREGXAGCGrAF9sHIC98ZHL9FQBCBRGABRFEXAFAFDBBBHKCND+rFCND+sFD/6FAKCiD+sFCnD+rFCUUU/8EDtD+uFD/mFDMBBAFCTJRFAGCIJHGAL9JQBMMGXALAI9PQBAEAICEZHGCGWHFqCBCoBAFl/8MBAEABALCGWJHLAF/8cBBGXAG9FQBAEAEDBIBHKCND+rFCND+sFD/6FAKCiD+sFCnD+rFCUUU/8EDtD+uFD/mFDMIBMALAEAF/8cBBMM9TFEaCBCB8oGUkUUBHFABCEJC98ZJHBjGUkUUBGXGXAB8/BCTWHGuQBCaREABAGlCggEJCTrXBCa6QFMAFREMAEMMMFBCUNMIT9tBB';var detector=new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,3,2,0,0,5,3,1,0,1,12,1,0,10,22,2,12,0,65,0,65,0,65,0,252,10,0,0,11,7,0,65,0,253,15,26,11]);var wasmpack=new Uint8Array([32,0,65,253,3,1,2,34,4,106,6,5,11,8,7,20,13,33,12,16,128,9,116,64,19,113,127,15,10,21,22,14,255,66,24,54,136,107,18,23,192,26,114,118,132,17,77,101,130,144,27,87,131,44,45,74,156,154,70,167]);var FILTERS={0:'',1:'meshopt_decodeFilterOct',2:'meshopt_decodeFilterQuat',3:'meshopt_decodeFilterExp',NONE:'',OCTAHEDRAL:'meshopt_decodeFilterOct',QUATERNION:'meshopt_decodeFilterQuat',EXPONENTIAL:'meshopt_decodeFilterExp'};var DECODERS={0:'meshopt_decodeVertexBuffer',1:'meshopt_decodeIndexBuffer',2:'meshopt_decodeIndexSequence',ATTRIBUTES:'meshopt_decodeVertexBuffer',TRIANGLES:'meshopt_decodeIndexBuffer',INDICES:'meshopt_decodeIndexSequence'};function meshoptDecodeGltfBuffer(_x58,_x59,_x60,_x61,_x62){return _meshoptDecodeGltfBuffer.apply(this,arguments);}function _meshoptDecodeGltfBuffer(){_meshoptDecodeGltfBuffer=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee34(target,count,size,source,mode){var filter,instance,_args30=arguments;return _regeneratorRuntime().wrap(function _callee34$(_context37){while(1)switch(_context37.prev=_context37.next){case 0:filter=_args30.length>5&&_args30[5]!==undefined?_args30[5]:'NONE';_context37.next=3;return loadWasmInstance();case 3:instance=_context37.sent;decode$7(instance,instance.exports[DECODERS[mode]],target,count,size,source,instance.exports[FILTERS[filter||'NONE']]);case 5:case"end":return _context37.stop();}},_callee34);}));return _meshoptDecodeGltfBuffer.apply(this,arguments);}var wasmPromise;function loadWasmInstance(){return _loadWasmInstance.apply(this,arguments);}function _loadWasmInstance(){_loadWasmInstance=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee35(){return _regeneratorRuntime().wrap(function _callee35$(_context38){while(1)switch(_context38.prev=_context38.next){case 0:if(!wasmPromise){wasmPromise=loadWasmModule();}return _context38.abrupt("return",wasmPromise);case 2:case"end":return _context38.stop();}},_callee35);}));return _loadWasmInstance.apply(this,arguments);}function loadWasmModule(){return _loadWasmModule.apply(this,arguments);}function _loadWasmModule(){_loadWasmModule=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee36(){var wasm,result;return _regeneratorRuntime().wrap(function _callee36$(_context39){while(1)switch(_context39.prev=_context39.next){case 0:wasm=wasm_base;if(WebAssembly.validate(detector)){wasm=wasm_simd;console.log('Warning: meshopt_decoder is using experimental SIMD support');}_context39.next=4;return WebAssembly.instantiate(unpack(wasm),{});case 4:result=_context39.sent;_context39.next=7;return result.instance.exports.__wasm_call_ctors();case 7:return _context39.abrupt("return",result.instance);case 8:case"end":return _context39.stop();}},_callee36);}));return _loadWasmModule.apply(this,arguments);}function unpack(data){var result=new Uint8Array(data.length);for(var _i512=0;_i512<data.length;++_i512){var ch=data.charCodeAt(_i512);result[_i512]=ch>96?ch-71:ch>64?ch-65:ch>47?ch+4:ch>46?63:62;}var write=0;for(var _i513=0;_i513<data.length;++_i513){result[write++]=result[_i513]<60?wasmpack[result[_i513]]:(result[_i513]-60)*64+result[++_i513];}return result.buffer.slice(0,write);}function decode$7(instance,fun,target,count,size,source,filter){var sbrk=instance.exports.sbrk;var count4=count+3&~3;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));}}var EXT_MESHOPT_COMPRESSION='EXT_meshopt_compression';var name$8=EXT_MESHOPT_COMPRESSION;function decode$6(_x63,_x64){return _decode$.apply(this,arguments);}function _decode$(){_decode$=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee37(gltfData,options){var _options$gltf,scenegraph,promises,_iterator42,_step42,bufferViewIndex;return _regeneratorRuntime().wrap(function _callee37$(_context40){while(1)switch(_context40.prev=_context40.next){case 0:scenegraph=new GLTFScenegraph(gltfData);if(options!==null&&options!==void 0&&(_options$gltf=options.gltf)!==null&&_options$gltf!==void 0&&_options$gltf.decompressMeshes){_context40.next=3;break;}return _context40.abrupt("return");case 3:promises=[];_iterator42=_createForOfIteratorHelper(gltfData.json.bufferViews||[]);try{for(_iterator42.s();!(_step42=_iterator42.n()).done;){bufferViewIndex=_step42.value;promises.push(decodeMeshoptBufferView(scenegraph,bufferViewIndex));}}catch(err){_iterator42.e(err);}finally{_iterator42.f();}_context40.next=8;return Promise.all(promises);case 8:scenegraph.removeExtension(EXT_MESHOPT_COMPRESSION);case 9:case"end":return _context40.stop();}},_callee37);}));return _decode$.apply(this,arguments);}function decodeMeshoptBufferView(_x65,_x66){return _decodeMeshoptBufferView.apply(this,arguments);}function _decodeMeshoptBufferView(){_decodeMeshoptBufferView=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee38(scenegraph,bufferView){var meshoptExtension,_meshoptExtension$byt,byteOffset,_meshoptExtension$byt2,byteLength,byteStride,count,mode,_meshoptExtension$fil,filter,bufferIndex,buffer,source,result;return _regeneratorRuntime().wrap(function _callee38$(_context41){while(1)switch(_context41.prev=_context41.next){case 0:meshoptExtension=scenegraph.getObjectExtension(bufferView,EXT_MESHOPT_COMPRESSION);if(!meshoptExtension){_context41.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);_context41.next=8;return meshoptDecodeGltfBuffer(result,count,byteStride,source,mode,filter);case 8:return _context41.abrupt("return",result);case 9:return _context41.abrupt("return",null);case 10:case"end":return _context41.stop();}},_callee38);}));return _decodeMeshoptBufferView.apply(this,arguments);}var EXT_meshopt_compression=/*#__PURE__*/Object.freeze({__proto__:null,name:name$8,decode:decode$6});var EXT_TEXTURE_WEBP='EXT_texture_webp';var name$7=EXT_TEXTURE_WEBP;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 _iterator18=_createForOfIteratorHelper(json.textures||[]),_step18;try{for(_iterator18.s();!(_step18=_iterator18.n()).done;){var texture=_step18.value;var extension=scenegraph.getObjectExtension(texture,EXT_TEXTURE_WEBP);if(extension){texture.source=extension.source;}scenegraph.removeObjectExtension(texture,EXT_TEXTURE_WEBP);}}catch(err){_iterator18.e(err);}finally{_iterator18.f();}scenegraph.removeExtension(EXT_TEXTURE_WEBP);}var EXT_texture_webp=/*#__PURE__*/Object.freeze({__proto__:null,name:name$7,preprocess:preprocess$3});var KHR_TEXTURE_BASISU='KHR_texture_basisu';var name$6=KHR_TEXTURE_BASISU;function preprocess$2(gltfData,options){var scene=new GLTFScenegraph(gltfData);var json=scene.json;var _iterator19=_createForOfIteratorHelper(json.textures||[]),_step19;try{for(_iterator19.s();!(_step19=_iterator19.n()).done;){var texture=_step19.value;var extension=scene.getObjectExtension(texture,KHR_TEXTURE_BASISU);if(extension){texture.source=extension.source;}scene.removeObjectExtension(texture,KHR_TEXTURE_BASISU);}}catch(err){_iterator19.e(err);}finally{_iterator19.f();}scene.removeExtension(KHR_TEXTURE_BASISU);}var KHR_texture_basisu=/*#__PURE__*/Object.freeze({__proto__:null,name:name$6,preprocess:preprocess$2});function assert$2(condition,message){if(!condition){throw new Error(message||'loaders.gl assertion failed.');}}var globals={self:typeof self!=='undefined'&&self,window:typeof window!=='undefined'&&window,global:typeof global!=='undefined'&&global,document:typeof document!=='undefined'&&document};var global_=globals.global||globals.self||globals.window||{};var isBrowser=(typeof process==="undefined"?"undefined":_typeof2(process))!=='object'||String(process)!=='[object process]'||process.browser;var isWorker=typeof importScripts==='function';var matches=typeof process!=='undefined'&&process.version&&/v([0-9]*)/.exec(process.version);matches&&parseFloat(matches[1])||0;var readFileAsArrayBuffer=null;var readFileAsText=null;var requireFromFile=null;var requireFromString=null;var node=/*#__PURE__*/Object.freeze({__proto__:null,readFileAsArrayBuffer:readFileAsArrayBuffer,readFileAsText:readFileAsText,requireFromFile:requireFromFile,requireFromString:requireFromString});var VERSION$2="3.4.15";var loadLibraryPromises={};function loadLibrary(_x67){return _loadLibrary.apply(this,arguments);}function _loadLibrary(){_loadLibrary=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee39(libraryUrl){var moduleName,options,_args35=arguments;return _regeneratorRuntime().wrap(function _callee39$(_context42){while(1)switch(_context42.prev=_context42.next){case 0:moduleName=_args35.length>1&&_args35[1]!==undefined?_args35[1]:null;options=_args35.length>2&&_args35[2]!==undefined?_args35[2]:{};if(moduleName){libraryUrl=getLibraryUrl(libraryUrl,moduleName,options);}loadLibraryPromises[libraryUrl]=loadLibraryPromises[libraryUrl]||loadLibraryFromFile(libraryUrl);_context42.next=6;return loadLibraryPromises[libraryUrl];case 6:return _context42.abrupt("return",_context42.sent);case 7:case"end":return _context42.stop();}},_callee39);}));return _loadLibrary.apply(this,arguments);}function getLibraryUrl(library,moduleName,options){if(library.startsWith('http')){return library;}var modules=options.modules||{};if(modules[library]){return modules[library];}if(!isBrowser){return"modules/".concat(moduleName,"/dist/libs/").concat(library);}if(options.CDN){assert$2(options.CDN.startsWith('http'));return"".concat(options.CDN,"/").concat(moduleName,"@").concat(VERSION$2,"/dist/libs/").concat(library);}if(isWorker){return"../src/libs/".concat(library);}return"modules/".concat(moduleName,"/src/libs/").concat(library);}function loadLibraryFromFile(_x68){return _loadLibraryFromFile.apply(this,arguments);}function _loadLibraryFromFile(){_loadLibraryFromFile=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee40(libraryUrl){var _response2,response,scriptSource;return _regeneratorRuntime().wrap(function _callee40$(_context43){while(1)switch(_context43.prev=_context43.next){case 0:if(!libraryUrl.endsWith('wasm')){_context43.next=7;break;}_context43.next=3;return fetch(libraryUrl);case 3:_response2=_context43.sent;_context43.next=6;return _response2.arrayBuffer();case 6:return _context43.abrupt("return",_context43.sent);case 7:if(isBrowser){_context43.next=20;break;}_context43.prev=8;_context43.t0=node&&requireFromFile;if(!_context43.t0){_context43.next=14;break;}_context43.next=13;return requireFromFile(libraryUrl);case 13:_context43.t0=_context43.sent;case 14:return _context43.abrupt("return",_context43.t0);case 17:_context43.prev=17;_context43.t1=_context43["catch"](8);return _context43.abrupt("return",null);case 20:if(!isWorker){_context43.next=22;break;}return _context43.abrupt("return",importScripts(libraryUrl));case 22:_context43.next=24;return fetch(libraryUrl);case 24:response=_context43.sent;_context43.next=27;return response.text();case 27:scriptSource=_context43.sent;return _context43.abrupt("return",loadLibraryFromString(scriptSource,libraryUrl));case 29:case"end":return _context43.stop();}},_callee40,null,[[8,17]]);}));return _loadLibraryFromFile.apply(this,arguments);}function loadLibraryFromString(scriptSource,id){if(!isBrowser){return requireFromString;}if(isWorker){eval.call(global_,scriptSource);return null;}var script=document.createElement('script');script.id=id;try{script.appendChild(document.createTextNode(scriptSource));}catch(e){script.text=scriptSource;}document.body.appendChild(script);return null;}var VERSION$1="3.4.15";var DEFAULT_DRACO_OPTIONS={draco:{decoderType:(typeof WebAssembly==="undefined"?"undefined":_typeof2(WebAssembly))==='object'?'wasm':'js',libraryPath:'libs/',extraAttributes:{},attributeNameEntry:undefined}};var DracoLoader$1={name:'Draco',id:isBrowser?'draco':'draco-nodejs',module:'draco',shapes:['mesh'],version:VERSION$1,worker:true,extensions:['drc'],mimeTypes:['application/octet-stream'],binary:true,tests:['DRACO'],options:DEFAULT_DRACO_OPTIONS};function getMeshBoundingBox(attributes){var minX=Infinity;var minY=Infinity;var minZ=Infinity;var maxX=-Infinity;var maxY=-Infinity;var maxZ=-Infinity;var positions=attributes.POSITION?attributes.POSITION.value:[];var len=positions&&positions.length;for(var _i514=0;_i514<len;_i514+=3){var x=positions[_i514];var y=positions[_i514+1];var _z4=positions[_i514+2];minX=x<minX?x:minX;minY=y<minY?y:minY;minZ=_z4<minZ?_z4:minZ;maxX=x>maxX?x:maxX;maxY=y>maxY?y:maxY;maxZ=_z4>maxZ?_z4:maxZ;}return[[minX,minY,minZ],[maxX,maxY,maxZ]];}function assert$1(condition,message){if(!condition){throw new Error(message||'loader assertion failed.');}}var Schema=/*#__PURE__*/function(){function Schema(fields,metadata){_classCallCheck(this,Schema);_defineProperty(this,"fields",void 0);_defineProperty(this,"metadata",void 0);assert$1(Array.isArray(fields));checkNames(fields);this.fields=fields;this.metadata=metadata||new Map();}return _createClass(Schema,[{key:"compareTo",value:function compareTo(other){if(this.metadata!==other.metadata){return false;}if(this.fields.length!==other.fields.length){return false;}for(var _i515=0;_i515<this.fields.length;++_i515){if(!this.fields[_i515].compareTo(other.fields[_i515])){return false;}}return true;}},{key:"select",value:function select(){var nameMap=Object.create(null);for(var _len=arguments.length,columnNames=new Array(_len),_key=0;_key<_len;_key++){columnNames[_key]=arguments[_key];}for(var _i516=0,_columnNames=columnNames;_i516<_columnNames.length;_i516++){var _name6=_columnNames[_i516];nameMap[_name6]=true;}var selectedFields=this.fields.filter(function(field){return nameMap[field.name];});return new Schema(selectedFields,this.metadata);}},{key:"selectAt",value:function selectAt(){var _this121=this;for(var _len2=arguments.length,columnIndices=new Array(_len2),_key2=0;_key2<_len2;_key2++){columnIndices[_key2]=arguments[_key2];}var selectedFields=columnIndices.map(function(index){return _this121.fields[index];}).filter(Boolean);return new Schema(selectedFields,this.metadata);}},{key:"assign",value:function assign(schemaOrFields){var fields;var metadata=this.metadata;if(schemaOrFields instanceof Schema){var otherSchema=schemaOrFields;fields=otherSchema.fields;metadata=mergeMaps(mergeMaps(new Map(),this.metadata),otherSchema.metadata);}else{fields=schemaOrFields;}var fieldMap=Object.create(null);var _iterator20=_createForOfIteratorHelper(this.fields),_step20;try{for(_iterator20.s();!(_step20=_iterator20.n()).done;){var field=_step20.value;fieldMap[field.name]=field;}}catch(err){_iterator20.e(err);}finally{_iterator20.f();}var _iterator21=_createForOfIteratorHelper(fields),_step21;try{for(_iterator21.s();!(_step21=_iterator21.n()).done;){var _field=_step21.value;fieldMap[_field.name]=_field;}}catch(err){_iterator21.e(err);}finally{_iterator21.f();}var mergedFields=Object.values(fieldMap);return new Schema(mergedFields,metadata);}}]);}();function checkNames(fields){var usedNames={};var _iterator22=_createForOfIteratorHelper(fields),_step22;try{for(_iterator22.s();!(_step22=_iterator22.n()).done;){var field=_step22.value;if(usedNames[field.name]){console.warn('Schema: duplicated field name',field.name,field);}usedNames[field.name]=true;}}catch(err){_iterator22.e(err);}finally{_iterator22.f();}}function mergeMaps(m1,m2){return new Map([].concat(_toConsumableArray(m1||new Map()),_toConsumableArray(m2||new Map())));}var Field=/*#__PURE__*/function(){function Field(name,type){_classCallCheck(this,Field);var nullable=arguments.length>2&&arguments[2]!==undefined?arguments[2]:false;var metadata=arguments.length>3&&arguments[3]!==undefined?arguments[3]:new Map();_defineProperty(this,"name",void 0);_defineProperty(this,"type",void 0);_defineProperty(this,"nullable",void 0);_defineProperty(this,"metadata",void 0);this.name=name;this.type=type;this.nullable=nullable;this.metadata=metadata;}return _createClass(Field,[{key:"typeId",get:function get(){return this.type&&this.type.typeId;}},{key:"clone",value:function clone(){return new Field(this.name,this.type,this.nullable,this.metadata);}},{key:"compareTo",value:function compareTo(other){return this.name===other.name&&this.type===other.type&&this.nullable===other.nullable&&this.metadata===other.metadata;}},{key:"toString",value:function toString(){return"".concat(this.type).concat(this.nullable?', nullable':'').concat(this.metadata?", metadata: ".concat(this.metadata):'');}}]);}();var Type=function(Type){Type[Type["NONE"]=0]="NONE";Type[Type["Null"]=1]="Null";Type[Type["Int"]=2]="Int";Type[Type["Float"]=3]="Float";Type[Type["Binary"]=4]="Binary";Type[Type["Utf8"]=5]="Utf8";Type[Type["Bool"]=6]="Bool";Type[Type["Decimal"]=7]="Decimal";Type[Type["Date"]=8]="Date";Type[Type["Time"]=9]="Time";Type[Type["Timestamp"]=10]="Timestamp";Type[Type["Interval"]=11]="Interval";Type[Type["List"]=12]="List";Type[Type["Struct"]=13]="Struct";Type[Type["Union"]=14]="Union";Type[Type["FixedSizeBinary"]=15]="FixedSizeBinary";Type[Type["FixedSizeList"]=16]="FixedSizeList";Type[Type["Map"]=17]="Map";Type[Type["Dictionary"]=-1]="Dictionary";Type[Type["Int8"]=-2]="Int8";Type[Type["Int16"]=-3]="Int16";Type[Type["Int32"]=-4]="Int32";Type[Type["Int64"]=-5]="Int64";Type[Type["Uint8"]=-6]="Uint8";Type[Type["Uint16"]=-7]="Uint16";Type[Type["Uint32"]=-8]="Uint32";Type[Type["Uint64"]=-9]="Uint64";Type[Type["Float16"]=-10]="Float16";Type[Type["Float32"]=-11]="Float32";Type[Type["Float64"]=-12]="Float64";Type[Type["DateDay"]=-13]="DateDay";Type[Type["DateMillisecond"]=-14]="DateMillisecond";Type[Type["TimestampSecond"]=-15]="TimestampSecond";Type[Type["TimestampMillisecond"]=-16]="TimestampMillisecond";Type[Type["TimestampMicrosecond"]=-17]="TimestampMicrosecond";Type[Type["TimestampNanosecond"]=-18]="TimestampNanosecond";Type[Type["TimeSecond"]=-19]="TimeSecond";Type[Type["TimeMillisecond"]=-20]="TimeMillisecond";Type[Type["TimeMicrosecond"]=-21]="TimeMicrosecond";Type[Type["TimeNanosecond"]=-22]="TimeNanosecond";Type[Type["DenseUnion"]=-23]="DenseUnion";Type[Type["SparseUnion"]=-24]="SparseUnion";Type[Type["IntervalDayTime"]=-25]="IntervalDayTime";Type[Type["IntervalYearMonth"]=-26]="IntervalYearMonth";return Type;}({});var _Symbol$toStringTag,_Symbol$toStringTag2,_Symbol$toStringTag7;var DataType=/*#__PURE__*/function(){function DataType(){_classCallCheck(this,DataType);}return _createClass(DataType,[{key:"typeId",get:function get(){return Type.NONE;}},{key:"compareTo",value:function compareTo(other){return this===other;}}],[{key:"isNull",value:function isNull(x){return x&&x.typeId===Type.Null;}},{key:"isInt",value:function isInt(x){return x&&x.typeId===Type.Int;}},{key:"isFloat",value:function isFloat(x){return x&&x.typeId===Type.Float;}},{key:"isBinary",value:function isBinary(x){return x&&x.typeId===Type.Binary;}},{key:"isUtf8",value:function isUtf8(x){return x&&x.typeId===Type.Utf8;}},{key:"isBool",value:function isBool(x){return x&&x.typeId===Type.Bool;}},{key:"isDecimal",value:function isDecimal(x){return x&&x.typeId===Type.Decimal;}},{key:"isDate",value:function isDate(x){return x&&x.typeId===Type.Date;}},{key:"isTime",value:function isTime(x){return x&&x.typeId===Type.Time;}},{key:"isTimestamp",value:function isTimestamp(x){return x&&x.typeId===Type.Timestamp;}},{key:"isInterval",value:function isInterval(x){return x&&x.typeId===Type.Interval;}},{key:"isList",value:function isList(x){return x&&x.typeId===Type.List;}},{key:"isStruct",value:function isStruct(x){return x&&x.typeId===Type.Struct;}},{key:"isUnion",value:function isUnion(x){return x&&x.typeId===Type.Union;}},{key:"isFixedSizeBinary",value:function isFixedSizeBinary(x){return x&&x.typeId===Type.FixedSizeBinary;}},{key:"isFixedSizeList",value:function isFixedSizeList(x){return x&&x.typeId===Type.FixedSizeList;}},{key:"isMap",value:function isMap(x){return x&&x.typeId===Type.Map;}},{key:"isDictionary",value:function isDictionary(x){return x&&x.typeId===Type.Dictionary;}}]);}();_Symbol$toStringTag=Symbol.toStringTag;var Int=/*#__PURE__*/function(_DataType,_Symbol$toStringTag3){function Int(isSigned,bitWidth){var _this122;_classCallCheck(this,Int);_this122=_callSuper(this,Int);_defineProperty(_this122,"isSigned",void 0);_defineProperty(_this122,"bitWidth",void 0);_this122.isSigned=isSigned;_this122.bitWidth=bitWidth;return _this122;}_inherits(Int,_DataType);return _createClass(Int,[{key:"typeId",get:function get(){return Type.Int;}},{key:_Symbol$toStringTag3,get:function get(){return'Int';}},{key:"toString",value:function toString(){return"".concat(this.isSigned?'I':'Ui',"nt").concat(this.bitWidth);}}]);}(DataType,_Symbol$toStringTag);var Int8=/*#__PURE__*/function(_Int){function Int8(){_classCallCheck(this,Int8);return _callSuper(this,Int8,[true,8]);}_inherits(Int8,_Int);return _createClass(Int8);}(Int);var Int16=/*#__PURE__*/function(_Int2){function Int16(){_classCallCheck(this,Int16);return _callSuper(this,Int16,[true,16]);}_inherits(Int16,_Int2);return _createClass(Int16);}(Int);var Int32=/*#__PURE__*/function(_Int3){function Int32(){_classCallCheck(this,Int32);return _callSuper(this,Int32,[true,32]);}_inherits(Int32,_Int3);return _createClass(Int32);}(Int);var Uint8=/*#__PURE__*/function(_Int4){function Uint8(){_classCallCheck(this,Uint8);return _callSuper(this,Uint8,[false,8]);}_inherits(Uint8,_Int4);return _createClass(Uint8);}(Int);var Uint16=/*#__PURE__*/function(_Int5){function Uint16(){_classCallCheck(this,Uint16);return _callSuper(this,Uint16,[false,16]);}_inherits(Uint16,_Int5);return _createClass(Uint16);}(Int);var Uint32=/*#__PURE__*/function(_Int6){function Uint32(){_classCallCheck(this,Uint32);return _callSuper(this,Uint32,[false,32]);}_inherits(Uint32,_Int6);return _createClass(Uint32);}(Int);var Precision={HALF:16,SINGLE:32,DOUBLE:64};_Symbol$toStringTag2=Symbol.toStringTag;var Float=/*#__PURE__*/function(_DataType2,_Symbol$toStringTag4){function Float(precision){var _this123;_classCallCheck(this,Float);_this123=_callSuper(this,Float);_defineProperty(_this123,"precision",void 0);_this123.precision=precision;return _this123;}_inherits(Float,_DataType2);return _createClass(Float,[{key:"typeId",get:function get(){return Type.Float;}},{key:_Symbol$toStringTag4,get:function get(){return'Float';}},{key:"toString",value:function toString(){return"Float".concat(this.precision);}}]);}(DataType,_Symbol$toStringTag2);var Float32=/*#__PURE__*/function(_Float){function Float32(){_classCallCheck(this,Float32);return _callSuper(this,Float32,[Precision.SINGLE]);}_inherits(Float32,_Float);return _createClass(Float32);}(Float);var Float64=/*#__PURE__*/function(_Float2){function Float64(){_classCallCheck(this,Float64);return _callSuper(this,Float64,[Precision.DOUBLE]);}_inherits(Float64,_Float2);return _createClass(Float64);}(Float);_Symbol$toStringTag7=Symbol.toStringTag;var FixedSizeList=/*#__PURE__*/function(_DataType3,_Symbol$toStringTag5){function FixedSizeList(listSize,child){var _this124;_classCallCheck(this,FixedSizeList);_this124=_callSuper(this,FixedSizeList);_defineProperty(_this124,"listSize",void 0);_defineProperty(_this124,"children",void 0);_this124.listSize=listSize;_this124.children=[child];return _this124;}_inherits(FixedSizeList,_DataType3);return _createClass(FixedSizeList,[{key:"typeId",get:function get(){return Type.FixedSizeList;}},{key:"valueType",get:function get(){return this.children[0].type;}},{key:"valueField",get:function get(){return this.children[0];}},{key:_Symbol$toStringTag5,get:function get(){return'FixedSizeList';}},{key:"toString",value:function toString(){return"FixedSizeList[".concat(this.listSize,"]<").concat(this.valueType,">");}}]);}(DataType,_Symbol$toStringTag7);function getArrowTypeFromTypedArray(array){switch(array.constructor){case Int8Array:return new Int8();case Uint8Array:return new Uint8();case Int16Array:return new Int16();case Uint16Array:return new Uint16();case Int32Array:return new Int32();case Uint32Array:return new Uint32();case Float32Array:return new Float32();case Float64Array:return new Float64();default:throw new Error('array type not supported');}}function deduceMeshField(attributeName,attribute,optionalMetadata){var type=getArrowTypeFromTypedArray(attribute.value);var metadata=optionalMetadata?optionalMetadata:makeMeshAttributeMetadata(attribute);var field=new Field(attributeName,new FixedSizeList(attribute.size,new Field('value',type)),false,metadata);return field;}function makeMeshAttributeMetadata(attribute){var result=new Map();if('byteOffset'in attribute){result.set('byteOffset',attribute.byteOffset.toString(10));}if('byteStride'in attribute){result.set('byteStride',attribute.byteStride.toString(10));}if('normalized'in attribute){result.set('normalized',attribute.normalized.toString());}return result;}function getDracoSchema(attributes,loaderData,indices){var metadataMap=makeMetadata(loaderData.metadata);var fields=[];var namedLoaderDataAttributes=transformAttributesLoaderData(loaderData.attributes);for(var attributeName in attributes){var attribute=attributes[attributeName];var field=getArrowFieldFromAttribute(attributeName,attribute,namedLoaderDataAttributes[attributeName]);fields.push(field);}if(indices){var indicesField=getArrowFieldFromAttribute('indices',indices);fields.push(indicesField);}return new Schema(fields,metadataMap);}function transformAttributesLoaderData(loaderData){var result={};for(var key in loaderData){var dracoAttribute=loaderData[key];result[dracoAttribute.name||'undefined']=dracoAttribute;}return result;}function getArrowFieldFromAttribute(attributeName,attribute,loaderData){var metadataMap=loaderData?makeMetadata(loaderData.metadata):undefined;var field=deduceMeshField(attributeName,attribute,metadataMap);return field;}function makeMetadata(metadata){var metadataMap=new Map();for(var key in metadata){metadataMap.set("".concat(key,".string"),JSON.stringify(metadata[key]));}return metadataMap;}var DRACO_TO_GLTF_ATTRIBUTE_NAME_MAP={POSITION:'POSITION',NORMAL:'NORMAL',COLOR:'COLOR_0',TEX_COORD:'TEXCOORD_0'};var DRACO_DATA_TYPE_TO_TYPED_ARRAY_MAP={1:Int8Array,2:Uint8Array,3:Int16Array,4:Uint16Array,5:Int32Array,6:Uint32Array,9:Float32Array};var INDEX_ITEM_SIZE=4;var DracoParser=/*#__PURE__*/function(){function DracoParser(draco){_classCallCheck(this,DracoParser);_defineProperty(this,"draco",void 0);_defineProperty(this,"decoder",void 0);_defineProperty(this,"metadataQuerier",void 0);this.draco=draco;this.decoder=new this.draco.Decoder();this.metadataQuerier=new this.draco.MetadataQuerier();}return _createClass(DracoParser,[{key:"destroy",value:function destroy(){this.draco.destroy(this.decoder);this.draco.destroy(this.metadataQuerier);}},{key:"parseSync",value:function parseSync(arrayBuffer){var options=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};var buffer=new this.draco.DecoderBuffer();buffer.Init(new Int8Array(arrayBuffer),arrayBuffer.byteLength);this._disableAttributeTransforms(options);var geometry_type=this.decoder.GetEncodedGeometryType(buffer);var dracoGeometry=geometry_type===this.draco.TRIANGULAR_MESH?new this.draco.Mesh():new this.draco.PointCloud();try{var dracoStatus;switch(geometry_type){case this.draco.TRIANGULAR_MESH:dracoStatus=this.decoder.DecodeBufferToMesh(buffer,dracoGeometry);break;case this.draco.POINT_CLOUD:dracoStatus=this.decoder.DecodeBufferToPointCloud(buffer,dracoGeometry);break;default:throw new Error('DRACO: Unknown geometry type.');}if(!dracoStatus.ok()||!dracoGeometry.ptr){var message="DRACO decompression failed: ".concat(dracoStatus.error_msg());throw new Error(message);}var loaderData=this._getDracoLoaderData(dracoGeometry,geometry_type,options);var geometry=this._getMeshData(dracoGeometry,loaderData,options);var boundingBox=getMeshBoundingBox(geometry.attributes);var schema=getDracoSchema(geometry.attributes,loaderData,geometry.indices);var data=_objectSpread(_objectSpread({loader:'draco',loaderData:loaderData,header:{vertexCount:dracoGeometry.num_points(),boundingBox:boundingBox}},geometry),{},{schema:schema});return data;}finally{this.draco.destroy(buffer);if(dracoGeometry){this.draco.destroy(dracoGeometry);}}}},{key:"_getDracoLoaderData",value:function _getDracoLoaderData(dracoGeometry,geometry_type,options){var metadata=this._getTopLevelMetadata(dracoGeometry);var attributes=this._getDracoAttributes(dracoGeometry,options);return{geometry_type:geometry_type,num_attributes:dracoGeometry.num_attributes(),num_points:dracoGeometry.num_points(),num_faces:dracoGeometry instanceof this.draco.Mesh?dracoGeometry.num_faces():0,metadata:metadata,attributes:attributes};}},{key:"_getDracoAttributes",value:function _getDracoAttributes(dracoGeometry,options){var dracoAttributes={};for(var attributeId=0;attributeId<dracoGeometry.num_attributes();attributeId++){var dracoAttribute=this.decoder.GetAttribute(dracoGeometry,attributeId);var metadata=this._getAttributeMetadata(dracoGeometry,attributeId);dracoAttributes[dracoAttribute.unique_id()]={unique_id:dracoAttribute.unique_id(),attribute_type:dracoAttribute.attribute_type(),data_type:dracoAttribute.data_type(),num_components:dracoAttribute.num_components(),byte_offset:dracoAttribute.byte_offset(),byte_stride:dracoAttribute.byte_stride(),normalized:dracoAttribute.normalized(),attribute_index:attributeId,metadata:metadata};var quantization=this._getQuantizationTransform(dracoAttribute,options);if(quantization){dracoAttributes[dracoAttribute.unique_id()].quantization_transform=quantization;}var octahedron=this._getOctahedronTransform(dracoAttribute,options);if(octahedron){dracoAttributes[dracoAttribute.unique_id()].octahedron_transform=octahedron;}}return dracoAttributes;}},{key:"_getMeshData",value:function _getMeshData(dracoGeometry,loaderData,options){var attributes=this._getMeshAttributes(loaderData,dracoGeometry,options);var positionAttribute=attributes.POSITION;if(!positionAttribute){throw new Error('DRACO: No position attribute found.');}if(dracoGeometry instanceof this.draco.Mesh){switch(options.topology){case'triangle-strip':return{topology:'triangle-strip',mode:4,attributes:attributes,indices:{value:this._getTriangleStripIndices(dracoGeometry),size:1}};case'triangle-list':default:return{topology:'triangle-list',mode:5,attributes:attributes,indices:{value:this._getTriangleListIndices(dracoGeometry),size:1}};}}return{topology:'point-list',mode:0,attributes:attributes};}},{key:"_getMeshAttributes",value:function _getMeshAttributes(loaderData,dracoGeometry,options){var attributes={};for(var _i517=0,_Object$values=Object.values(loaderData.attributes);_i517<_Object$values.length;_i517++){var loaderAttribute=_Object$values[_i517];var attributeName=this._deduceAttributeName(loaderAttribute,options);loaderAttribute.name=attributeName;var _this$_getAttributeVa=this._getAttributeValues(dracoGeometry,loaderAttribute),value=_this$_getAttributeVa.value,size=_this$_getAttributeVa.size;attributes[attributeName]={value:value,size:size,byteOffset:loaderAttribute.byte_offset,byteStride:loaderAttribute.byte_stride,normalized:loaderAttribute.normalized};}return attributes;}},{key:"_getTriangleListIndices",value:function _getTriangleListIndices(dracoGeometry){var numFaces=dracoGeometry.num_faces();var numIndices=numFaces*3;var byteLength=numIndices*INDEX_ITEM_SIZE;var ptr=this.draco._malloc(byteLength);try{this.decoder.GetTrianglesUInt32Array(dracoGeometry,byteLength,ptr);return new Uint32Array(this.draco.HEAPF32.buffer,ptr,numIndices).slice();}finally{this.draco._free(ptr);}}},{key:"_getTriangleStripIndices",value:function _getTriangleStripIndices(dracoGeometry){var dracoArray=new this.draco.DracoInt32Array();try{this.decoder.GetTriangleStripsFromMesh(dracoGeometry,dracoArray);return getUint32Array(dracoArray);}finally{this.draco.destroy(dracoArray);}}},{key:"_getAttributeValues",value:function _getAttributeValues(dracoGeometry,attribute){var TypedArrayCtor=DRACO_DATA_TYPE_TO_TYPED_ARRAY_MAP[attribute.data_type];var numComponents=attribute.num_components;var numPoints=dracoGeometry.num_points();var numValues=numPoints*numComponents;var byteLength=numValues*TypedArrayCtor.BYTES_PER_ELEMENT;var dataType=getDracoDataType(this.draco,TypedArrayCtor);var value;var ptr=this.draco._malloc(byteLength);try{var dracoAttribute=this.decoder.GetAttribute(dracoGeometry,attribute.attribute_index);this.decoder.GetAttributeDataArrayForAllPoints(dracoGeometry,dracoAttribute,dataType,byteLength,ptr);value=new TypedArrayCtor(this.draco.HEAPF32.buffer,ptr,numValues).slice();}finally{this.draco._free(ptr);}return{value:value,size:numComponents};}},{key:"_deduceAttributeName",value:function _deduceAttributeName(attribute,options){var uniqueId=attribute.unique_id;for(var _i518=0,_Object$entries4=Object.entries(options.extraAttributes||{});_i518<_Object$entries4.length;_i518++){var _Object$entries4$_i=_slicedToArray(_Object$entries4[_i518],2),attributeName=_Object$entries4$_i[0],attributeUniqueId=_Object$entries4$_i[1];if(attributeUniqueId===uniqueId){return attributeName;}}var thisAttributeType=attribute.attribute_type;for(var dracoAttributeConstant in DRACO_TO_GLTF_ATTRIBUTE_NAME_MAP){var attributeType=this.draco[dracoAttributeConstant];if(attributeType===thisAttributeType){return DRACO_TO_GLTF_ATTRIBUTE_NAME_MAP[dracoAttributeConstant];}}var entryName=options.attributeNameEntry||'name';if(attribute.metadata[entryName]){return attribute.metadata[entryName].string;}return"CUSTOM_ATTRIBUTE_".concat(uniqueId);}},{key:"_getTopLevelMetadata",value:function _getTopLevelMetadata(dracoGeometry){var dracoMetadata=this.decoder.GetMetadata(dracoGeometry);return this._getDracoMetadata(dracoMetadata);}},{key:"_getAttributeMetadata",value:function _getAttributeMetadata(dracoGeometry,attributeId){var dracoMetadata=this.decoder.GetAttributeMetadata(dracoGeometry,attributeId);return this._getDracoMetadata(dracoMetadata);}},{key:"_getDracoMetadata",value:function _getDracoMetadata(dracoMetadata){if(!dracoMetadata||!dracoMetadata.ptr){return{};}var result={};var numEntries=this.metadataQuerier.NumEntries(dracoMetadata);for(var entryIndex=0;entryIndex<numEntries;entryIndex++){var entryName=this.metadataQuerier.GetEntryName(dracoMetadata,entryIndex);result[entryName]=this._getDracoMetadataField(dracoMetadata,entryName);}return result;}},{key:"_getDracoMetadataField",value:function _getDracoMetadataField(dracoMetadata,entryName){var dracoArray=new this.draco.DracoInt32Array();try{this.metadataQuerier.GetIntEntryArray(dracoMetadata,entryName,dracoArray);var intArray=getInt32Array(dracoArray);return{"int":this.metadataQuerier.GetIntEntry(dracoMetadata,entryName),string:this.metadataQuerier.GetStringEntry(dracoMetadata,entryName),"double":this.metadataQuerier.GetDoubleEntry(dracoMetadata,entryName),intArray:intArray};}finally{this.draco.destroy(dracoArray);}}},{key:"_disableAttributeTransforms",value:function _disableAttributeTransforms(options){var _options$quantizedAtt=options.quantizedAttributes,quantizedAttributes=_options$quantizedAtt===void 0?[]:_options$quantizedAtt,_options$octahedronAt=options.octahedronAttributes,octahedronAttributes=_options$octahedronAt===void 0?[]:_options$octahedronAt;var skipAttributes=[].concat(_toConsumableArray(quantizedAttributes),_toConsumableArray(octahedronAttributes));var _iterator23=_createForOfIteratorHelper(skipAttributes),_step23;try{for(_iterator23.s();!(_step23=_iterator23.n()).done;){var dracoAttributeName=_step23.value;this.decoder.SkipAttributeTransform(this.draco[dracoAttributeName]);}}catch(err){_iterator23.e(err);}finally{_iterator23.f();}}},{key:"_getQuantizationTransform",value:function _getQuantizationTransform(dracoAttribute,options){var _this125=this;var _options$quantizedAtt2=options.quantizedAttributes,quantizedAttributes=_options$quantizedAtt2===void 0?[]:_options$quantizedAtt2;var attribute_type=dracoAttribute.attribute_type();var skip=quantizedAttributes.map(function(type){return _this125.decoder[type];}).includes(attribute_type);if(skip){var _transform2=new this.draco.AttributeQuantizationTransform();try{if(_transform2.InitFromAttribute(dracoAttribute)){return{quantization_bits:_transform2.quantization_bits(),range:_transform2.range(),min_values:new Float32Array([1,2,3]).map(function(i){return _transform2.min_value(i);})};}}finally{this.draco.destroy(_transform2);}}return null;}},{key:"_getOctahedronTransform",value:function _getOctahedronTransform(dracoAttribute,options){var _this126=this;var _options$octahedronAt2=options.octahedronAttributes,octahedronAttributes=_options$octahedronAt2===void 0?[]:_options$octahedronAt2;var attribute_type=dracoAttribute.attribute_type();var octahedron=octahedronAttributes.map(function(type){return _this126.decoder[type];}).includes(attribute_type);if(octahedron){var _transform3=new this.draco.AttributeQuantizationTransform();try{if(_transform3.InitFromAttribute(dracoAttribute)){return{quantization_bits:_transform3.quantization_bits()};}}finally{this.draco.destroy(_transform3);}}return null;}}]);}();function getDracoDataType(draco,attributeType){switch(attributeType){case Float32Array:return draco.DT_FLOAT32;case Int8Array:return draco.DT_INT8;case Int16Array:return draco.DT_INT16;case Int32Array:return draco.DT_INT32;case Uint8Array:return draco.DT_UINT8;case Uint16Array:return draco.DT_UINT16;case Uint32Array:return draco.DT_UINT32;default:return draco.DT_INVALID;}}function getInt32Array(dracoArray){var numValues=dracoArray.size();var intArray=new Int32Array(numValues);for(var _i519=0;_i519<numValues;_i519++){intArray[_i519]=dracoArray.GetValue(_i519);}return intArray;}function getUint32Array(dracoArray){var numValues=dracoArray.size();var intArray=new Int32Array(numValues);for(var _i520=0;_i520<numValues;_i520++){intArray[_i520]=dracoArray.GetValue(_i520);}return intArray;}var DRACO_DECODER_VERSION='1.5.5';var STATIC_DECODER_URL="https://www.gstatic.com/draco/versioned/decoders/".concat(DRACO_DECODER_VERSION);var DRACO_JS_DECODER_URL="".concat(STATIC_DECODER_URL,"/draco_decoder.js");var DRACO_WASM_WRAPPER_URL="".concat(STATIC_DECODER_URL,"/draco_wasm_wrapper.js");var DRACO_WASM_DECODER_URL="".concat(STATIC_DECODER_URL,"/draco_decoder.wasm");var loadDecoderPromise;function loadDracoDecoderModule(_x69){return _loadDracoDecoderModule.apply(this,arguments);}function _loadDracoDecoderModule(){_loadDracoDecoderModule=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee41(options){var modules;return _regeneratorRuntime().wrap(function _callee41$(_context44){while(1)switch(_context44.prev=_context44.next){case 0:modules=options.modules||{};if(modules.draco3d){loadDecoderPromise=loadDecoderPromise||modules.draco3d.createDecoderModule({}).then(function(draco){return{draco:draco};});}else{loadDecoderPromise=loadDecoderPromise||loadDracoDecoder(options);}_context44.next=4;return loadDecoderPromise;case 4:return _context44.abrupt("return",_context44.sent);case 5:case"end":return _context44.stop();}},_callee41);}));return _loadDracoDecoderModule.apply(this,arguments);}function loadDracoDecoder(_x70){return _loadDracoDecoder.apply(this,arguments);}function _loadDracoDecoder(){_loadDracoDecoder=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee42(options){var DracoDecoderModule,wasmBinary,_yield$Promise$all5,_yield$Promise$all6;return _regeneratorRuntime().wrap(function _callee42$(_context45){while(1)switch(_context45.prev=_context45.next){case 0:_context45.t0=options.draco&&options.draco.decoderType;_context45.next=_context45.t0==='js'?3:_context45.t0==='wasm'?7:7;break;case 3:_context45.next=5;return loadLibrary(DRACO_JS_DECODER_URL,'draco',options);case 5:DracoDecoderModule=_context45.sent;return _context45.abrupt("break",21);case 7:_context45.t1=Promise;_context45.next=10;return loadLibrary(DRACO_WASM_WRAPPER_URL,'draco',options);case 10:_context45.t2=_context45.sent;_context45.next=13;return loadLibrary(DRACO_WASM_DECODER_URL,'draco',options);case 13:_context45.t3=_context45.sent;_context45.t4=[_context45.t2,_context45.t3];_context45.next=17;return _context45.t1.all.call(_context45.t1,_context45.t4);case 17:_yield$Promise$all5=_context45.sent;_yield$Promise$all6=_slicedToArray(_yield$Promise$all5,2);DracoDecoderModule=_yield$Promise$all6[0];wasmBinary=_yield$Promise$all6[1];case 21:DracoDecoderModule=DracoDecoderModule||globalThis.DracoDecoderModule;_context45.next=24;return initializeDracoDecoder(DracoDecoderModule,wasmBinary);case 24:return _context45.abrupt("return",_context45.sent);case 25:case"end":return _context45.stop();}},_callee42);}));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});}}));});}({id:isBrowser?'draco-writer':'draco-writer-nodejs',name:'Draco compressed geometry writer',module:'draco',version:VERSION$1,worker:true,options:{draco:{},source:null}});var DracoLoader=_objectSpread(_objectSpread({},DracoLoader$1),{},{parse:parse$1});function parse$1(_x71,_x72){return _parse$2.apply(this,arguments);}function _parse$2(){_parse$2=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee43(arrayBuffer,options){var _yield$loadDracoDecod,draco,dracoParser;return _regeneratorRuntime().wrap(function _callee43$(_context46){while(1)switch(_context46.prev=_context46.next){case 0:_context46.next=2;return loadDracoDecoderModule(options);case 2:_yield$loadDracoDecod=_context46.sent;draco=_yield$loadDracoDecod.draco;dracoParser=new DracoParser(draco);_context46.prev=5;return _context46.abrupt("return",dracoParser.parseSync(arrayBuffer,options===null||options===void 0?void 0:options.draco));case 7:_context46.prev=7;dracoParser.destroy();return _context46.finish(7);case 10:case"end":return _context46.stop();}},_callee43,null,[[5,,7,10]]);}));return _parse$2.apply(this,arguments);}function getGLTFAccessors(attributes){var accessors={};for(var _name7 in attributes){var attribute=attributes[_name7];if(_name7!=='indices'){var glTFAccessor=getGLTFAccessor(attribute);accessors[_name7]=glTFAccessor;}}return accessors;}function getGLTFAccessor(attribute){var _getAccessorData=getAccessorData(attribute),buffer=_getAccessorData.buffer,size=_getAccessorData.size,count=_getAccessorData.count;var glTFAccessor={value:buffer,size:size,byteOffset:0,count:count,type:getAccessorTypeFromSize(size),componentType:getComponentTypeFromArray(buffer)};return glTFAccessor;}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};}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;}var KHR_DRACO_MESH_COMPRESSION='KHR_draco_mesh_compression';var name$5=KHR_DRACO_MESH_COMPRESSION;function preprocess$1(gltfData,options,context){var scenegraph=new GLTFScenegraph(gltfData);var _iterator24=_createForOfIteratorHelper(makeMeshPrimitiveIterator(scenegraph)),_step24;try{for(_iterator24.s();!(_step24=_iterator24.n()).done;){var _primitive=_step24.value;if(scenegraph.getObjectExtension(_primitive,KHR_DRACO_MESH_COMPRESSION));}}catch(err){_iterator24.e(err);}finally{_iterator24.f();}}function decode$5(_x73,_x74,_x75){return _decode$2.apply(this,arguments);}function _decode$2(){_decode$2=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee44(gltfData,options,context){var _options$gltf,scenegraph,promises,_iterator43,_step43,_primitive6;return _regeneratorRuntime().wrap(function _callee44$(_context47){while(1)switch(_context47.prev=_context47.next){case 0:if(options!==null&&options!==void 0&&(_options$gltf=options.gltf)!==null&&_options$gltf!==void 0&&_options$gltf.decompressMeshes){_context47.next=2;break;}return _context47.abrupt("return");case 2:scenegraph=new GLTFScenegraph(gltfData);promises=[];_iterator43=_createForOfIteratorHelper(makeMeshPrimitiveIterator(scenegraph));try{for(_iterator43.s();!(_step43=_iterator43.n()).done;){_primitive6=_step43.value;if(scenegraph.getObjectExtension(_primitive6,KHR_DRACO_MESH_COMPRESSION)){promises.push(decompressPrimitive(scenegraph,_primitive6,options,context));}}}catch(err){_iterator43.e(err);}finally{_iterator43.f();}_context47.next=8;return Promise.all(promises);case 8:scenegraph.removeExtension(KHR_DRACO_MESH_COMPRESSION);case 9:case"end":return _context47.stop();}},_callee44);}));return _decode$2.apply(this,arguments);}function encode$3(gltfData){var options=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};var scenegraph=new GLTFScenegraph(gltfData);var _iterator25=_createForOfIteratorHelper(scenegraph.json.meshes||[]),_step25;try{for(_iterator25.s();!(_step25=_iterator25.n()).done;){var _mesh4=_step25.value;compressMesh(_mesh4,options);scenegraph.addRequiredExtension(KHR_DRACO_MESH_COMPRESSION);}}catch(err){_iterator25.e(err);}finally{_iterator25.f();}}function decompressPrimitive(_x76,_x77,_x78,_x79){return _decompressPrimitive.apply(this,arguments);}function _decompressPrimitive(){_decompressPrimitive=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee45(scenegraph,primitive,options,context){var dracoExtension,buffer,bufferCopy,parse,dracoOptions,decodedData,decodedAttributes,_i633,_Object$entries5,_Object$entries5$_i,attributeName,decodedAttribute,accessorIndex,accessor;return _regeneratorRuntime().wrap(function _callee45$(_context48){while(1)switch(_context48.prev=_context48.next){case 0:dracoExtension=scenegraph.getObjectExtension(primitive,KHR_DRACO_MESH_COMPRESSION);if(dracoExtension){_context48.next=3;break;}return _context48.abrupt("return");case 3:buffer=scenegraph.getTypedArrayForBufferView(dracoExtension.bufferView);bufferCopy=sliceArrayBuffer(buffer.buffer,buffer.byteOffset);parse=context.parse;dracoOptions=_objectSpread({},options);delete dracoOptions['3d-tiles'];_context48.next=10;return parse(bufferCopy,DracoLoader,dracoOptions,context);case 10:decodedData=_context48.sent;decodedAttributes=getGLTFAccessors(decodedData.attributes);for(_i633=0,_Object$entries5=Object.entries(decodedAttributes);_i633<_Object$entries5.length;_i633++){_Object$entries5$_i=_slicedToArray(_Object$entries5[_i633],2),attributeName=_Object$entries5$_i[0],decodedAttribute=_Object$entries5$_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;}}}primitive.attributes=decodedAttributes;if(decodedData.indices){primitive.indices=getGLTFAccessor(decodedData.indices);}checkPrimitive(primitive);case 16:case"end":return _context48.stop();}},_callee45);}));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');}var compressedData=options.DracoWriter.encodeSync({attributes:attributes});var decodedData=context===null||context===void 0?void 0:(_context$parseSync=context.parseSync)===null||_context$parseSync===void 0?void 0:_context$parseSync.call(context,{attributes:attributes});var fauxAccessors=options._addFauxAttributes(decodedData.attributes);var bufferViewIndex=options.addBufferView(compressedData);var glTFMesh={primitives:[{attributes:fauxAccessors,mode:mode,extensions:_defineProperty2({},KHR_DRACO_MESH_COMPRESSION,{bufferView:bufferViewIndex,attributes:fauxAccessors})}]};return glTFMesh;}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 _iterator26,_step26,_mesh5,_iterator27,_step27,_primitive2;return _regeneratorRuntime().wrap(function makeMeshPrimitiveIterator$(_context10){while(1)switch(_context10.prev=_context10.next){case 0:_iterator26=_createForOfIteratorHelper(scenegraph.json.meshes||[]);_context10.prev=1;_iterator26.s();case 3:if((_step26=_iterator26.n()).done){_context10.next=24;break;}_mesh5=_step26.value;_iterator27=_createForOfIteratorHelper(_mesh5.primitives);_context10.prev=6;_iterator27.s();case 8:if((_step27=_iterator27.n()).done){_context10.next=14;break;}_primitive2=_step27.value;_context10.next=12;return _primitive2;case 12:_context10.next=8;break;case 14:_context10.next=19;break;case 16:_context10.prev=16;_context10.t0=_context10["catch"](6);_iterator27.e(_context10.t0);case 19:_context10.prev=19;_iterator27.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);_iterator26.e(_context10.t1);case 29:_context10.prev=29;_iterator26.f();return _context10.finish(29);case 32:case"end":return _context10.stop();}},_marked2,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$5,encode:encode$3});function assert(condition,message){if(!condition){throw new Error("math.gl assertion ".concat(message));}}var config={EPSILON:1e-12,debug:false,precision:4,printTypes:false,printDegrees:false,printRowMajor:true};function formatValue(value){var _ref17=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{},_ref17$precision=_ref17.precision,precision=_ref17$precision===void 0?config.precision:_ref17$precision;value=round(value);return"".concat(parseFloat(value.toPrecision(precision)));}function isArray(value){return Array.isArray(value)||ArrayBuffer.isView(value)&&!(value instanceof DataView);}function _equals(a,b,epsilon){var oldEpsilon=config.EPSILON;if(epsilon){config.EPSILON=epsilon;}try{if(a===b){return true;}if(isArray(a)&&isArray(b)){if(a.length!==b.length){return false;}for(var _i521=0;_i521<a.length;++_i521){if(!_equals(a[_i521],b[_i521])){return false;}}return true;}if(a&&a.equals){return a.equals(b);}if(b&&b.equals){return b.equals(a);}if(typeof a==='number'&&typeof b==='number'){return Math.abs(a-b)<=config.EPSILON*Math.max(1,Math.abs(a),Math.abs(b));}return false;}finally{config.EPSILON=oldEpsilon;}}function round(value){return Math.round(value/config.EPSILON)*config.EPSILON;}function _extendableBuiltin(cls){function ExtendableBuiltin(){var instance=Reflect.construct(cls,Array.from(arguments));Object.setPrototypeOf(instance,Object.getPrototypeOf(this));return instance;}ExtendableBuiltin.prototype=Object.create(cls.prototype,{constructor:{value:cls,enumerable:false,writable:true,configurable:true}});if(Object.setPrototypeOf){Object.setPrototypeOf(ExtendableBuiltin,cls);}else{ExtendableBuiltin.__proto__=cls;}return ExtendableBuiltin;}var MathArray=/*#__PURE__*/function(_extendableBuiltin2){function MathArray(){_classCallCheck(this,MathArray);return _callSuper(this,MathArray,arguments);}_inherits(MathArray,_extendableBuiltin2);return _createClass(MathArray,[{key:"clone",value:function clone(){return new this.constructor().copy(this);}},{key:"fromArray",value:function fromArray(array){var offset=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0;for(var _i522=0;_i522<this.ELEMENTS;++_i522){this[_i522]=array[_i522+offset];}return this.check();}},{key:"toArray",value:function toArray(){var targetArray=arguments.length>0&&arguments[0]!==undefined?arguments[0]:[];var offset=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0;for(var _i523=0;_i523<this.ELEMENTS;++_i523){targetArray[offset+_i523]=this[_i523];}return targetArray;}},{key:"from",value:function from(arrayOrObject){return Array.isArray(arrayOrObject)?this.copy(arrayOrObject):this.fromObject(arrayOrObject);}},{key:"to",value:function to(arrayOrObject){if(arrayOrObject===this){return this;}return isArray(arrayOrObject)?this.toArray(arrayOrObject):this.toObject(arrayOrObject);}},{key:"toTarget",value:function toTarget(target){return target?this.to(target):this;}},{key:"toFloat32Array",value:function toFloat32Array(){return new Float32Array(this);}},{key:"toString",value:function toString(){return this.formatString(config);}},{key:"formatString",value:function formatString(opts){var string='';for(var _i524=0;_i524<this.ELEMENTS;++_i524){string+=(_i524>0?', ':'')+formatValue(this[_i524],opts);}return"".concat(opts.printTypes?this.constructor.name:'',"[").concat(string,"]");}},{key:"equals",value:function equals(array){if(!array||this.length!==array.length){return false;}for(var _i525=0;_i525<this.ELEMENTS;++_i525){if(!_equals(this[_i525],array[_i525])){return false;}}return true;}},{key:"exactEquals",value:function exactEquals(array){if(!array||this.length!==array.length){return false;}for(var _i526=0;_i526<this.ELEMENTS;++_i526){if(this[_i526]!==array[_i526]){return false;}}return true;}},{key:"negate",value:function negate(){for(var _i527=0;_i527<this.ELEMENTS;++_i527){this[_i527]=-this[_i527];}return this.check();}},{key:"lerp",value:function lerp(a,b,t){if(t===undefined){return this.lerp(this,a,b);}for(var _i528=0;_i528<this.ELEMENTS;++_i528){var ai=a[_i528];this[_i528]=ai+t*(b[_i528]-ai);}return this.check();}},{key:"min",value:function min(vector){for(var _i529=0;_i529<this.ELEMENTS;++_i529){this[_i529]=Math.min(vector[_i529],this[_i529]);}return this.check();}},{key:"max",value:function max(vector){for(var _i530=0;_i530<this.ELEMENTS;++_i530){this[_i530]=Math.max(vector[_i530],this[_i530]);}return this.check();}},{key:"clamp",value:function clamp(minVector,maxVector){for(var _i531=0;_i531<this.ELEMENTS;++_i531){this[_i531]=Math.min(Math.max(this[_i531],minVector[_i531]),maxVector[_i531]);}return this.check();}},{key:"add",value:function add(){for(var _len101=arguments.length,vectors=new Array(_len101),_key8=0;_key8<_len101;_key8++){vectors[_key8]=arguments[_key8];}for(var _i532=0,_vectors=vectors;_i532<_vectors.length;_i532++){var vector=_vectors[_i532];for(var _i533=0;_i533<this.ELEMENTS;++_i533){this[_i533]+=vector[_i533];}}return this.check();}},{key:"subtract",value:function subtract(){for(var _len102=arguments.length,vectors=new Array(_len102),_key9=0;_key9<_len102;_key9++){vectors[_key9]=arguments[_key9];}for(var _i534=0,_vectors2=vectors;_i534<_vectors2.length;_i534++){var vector=_vectors2[_i534];for(var _i535=0;_i535<this.ELEMENTS;++_i535){this[_i535]-=vector[_i535];}}return this.check();}},{key:"scale",value:function scale(_scale7){if(typeof _scale7==='number'){for(var _i536=0;_i536<this.ELEMENTS;++_i536){this[_i536]*=_scale7;}}else{for(var _i537=0;_i537<this.ELEMENTS&&_i537<_scale7.length;++_i537){this[_i537]*=_scale7[_i537];}}return this.check();}},{key:"multiplyByScalar",value:function multiplyByScalar(scalar){for(var _i538=0;_i538<this.ELEMENTS;++_i538){this[_i538]*=scalar;}return this.check();}},{key:"check",value:function check(){if(config.debug&&!this.validate()){throw new Error("math.gl: ".concat(this.constructor.name," some fields set to invalid numbers'"));}return this;}},{key:"validate",value:function validate(){var valid=this.length===this.ELEMENTS;for(var _i539=0;_i539<this.ELEMENTS;++_i539){valid=valid&&Number.isFinite(this[_i539]);}return valid;}},{key:"sub",value:function sub(a){return this.subtract(a);}},{key:"setScalar",value:function setScalar(a){for(var _i540=0;_i540<this.ELEMENTS;++_i540){this[_i540]=a;}return this.check();}},{key:"addScalar",value:function addScalar(a){for(var _i541=0;_i541<this.ELEMENTS;++_i541){this[_i541]+=a;}return this.check();}},{key:"subScalar",value:function subScalar(a){return this.addScalar(-a);}},{key:"multiplyScalar",value:function multiplyScalar(scalar){for(var _i542=0;_i542<this.ELEMENTS;++_i542){this[_i542]*=scalar;}return this.check();}},{key:"divideScalar",value:function divideScalar(a){return this.multiplyByScalar(1/a);}},{key:"clampScalar",value:function clampScalar(min,max){for(var _i543=0;_i543<this.ELEMENTS;++_i543){this[_i543]=Math.min(Math.max(this[_i543],min),max);}return this.check();}},{key:"elements",get:function get(){return this;}}]);}(_extendableBuiltin(Array));function validateVector(v,length){if(v.length!==length){return false;}for(var _i544=0;_i544<v.length;++_i544){if(!Number.isFinite(v[_i544])){return false;}}return true;}function checkNumber(value){if(!Number.isFinite(value)){throw new Error("Invalid number ".concat(value));}return value;}function checkVector(v,length){var callerName=arguments.length>2&&arguments[2]!==undefined?arguments[2]:'';if(config.debug&&!validateVector(v,length)){throw new Error("math.gl: ".concat(callerName," some fields set to invalid numbers'"));}return v;}var Vector=/*#__PURE__*/function(_MathArray){function Vector(){_classCallCheck(this,Vector);return _callSuper(this,Vector,arguments);}_inherits(Vector,_MathArray);return _createClass(Vector,[{key:"x",get:function get(){return this[0];},set:function set(value){this[0]=checkNumber(value);}},{key:"y",get:function get(){return this[1];},set:function set(value){this[1]=checkNumber(value);}},{key:"len",value:function len(){return Math.sqrt(this.lengthSquared());}},{key:"magnitude",value:function magnitude(){return this.len();}},{key:"lengthSquared",value:function lengthSquared(){var length=0;for(var _i545=0;_i545<this.ELEMENTS;++_i545){length+=this[_i545]*this[_i545];}return length;}},{key:"magnitudeSquared",value:function magnitudeSquared(){return this.lengthSquared();}},{key:"distance",value:function distance(mathArray){return Math.sqrt(this.distanceSquared(mathArray));}},{key:"distanceSquared",value:function distanceSquared(mathArray){var length=0;for(var _i546=0;_i546<this.ELEMENTS;++_i546){var dist=this[_i546]-mathArray[_i546];length+=dist*dist;}return checkNumber(length);}},{key:"dot",value:function dot(mathArray){var product=0;for(var _i547=0;_i547<this.ELEMENTS;++_i547){product+=this[_i547]*mathArray[_i547];}return checkNumber(product);}},{key:"normalize",value:function normalize(){var length=this.magnitude();if(length!==0){for(var _i548=0;_i548<this.ELEMENTS;++_i548){this[_i548]/=length;}}return this.check();}},{key:"multiply",value:function multiply(){for(var _len103=arguments.length,vectors=new Array(_len103),_key10=0;_key10<_len103;_key10++){vectors[_key10]=arguments[_key10];}for(var _i549=0,_vectors3=vectors;_i549<_vectors3.length;_i549++){var vector=_vectors3[_i549];for(var _i550=0;_i550<this.ELEMENTS;++_i550){this[_i550]*=vector[_i550];}}return this.check();}},{key:"divide",value:function divide(){for(var _len104=arguments.length,vectors=new Array(_len104),_key11=0;_key11<_len104;_key11++){vectors[_key11]=arguments[_key11];}for(var _i551=0,_vectors4=vectors;_i551<_vectors4.length;_i551++){var vector=_vectors4[_i551];for(var _i552=0;_i552<this.ELEMENTS;++_i552){this[_i552]/=vector[_i552];}}return this.check();}},{key:"lengthSq",value:function lengthSq(){return this.lengthSquared();}},{key:"distanceTo",value:function distanceTo(vector){return this.distance(vector);}},{key:"distanceToSquared",value:function distanceToSquared(vector){return this.distanceSquared(vector);}},{key:"getComponent",value:function getComponent(i){assert(i>=0&&i<this.ELEMENTS,'index is out of range');return checkNumber(this[i]);}},{key:"setComponent",value:function setComponent(i,value){assert(i>=0&&i<this.ELEMENTS,'index is out of range');this[i]=value;return this.check();}},{key:"addVectors",value:function addVectors(a,b){return this.copy(a).add(b);}},{key:"subVectors",value:function subVectors(a,b){return this.copy(a).subtract(b);}},{key:"multiplyVectors",value:function multiplyVectors(a,b){return this.copy(a).multiply(b);}},{key:"addScaledVector",value:function addScaledVector(a,b){return this.add(new this.constructor(a).multiplyScalar(b));}}]);}(MathArray);/**
25044
+ if(plugins.length>0){for(var _i505=0,len=plugins.length;_i505<len;_i505++){var plugin=plugins[_i505];plugin.destroy();}}this.cameraControl.destroy();this.scene.destroy(callback);}}]);}();function assert$9(condition,message){if(!condition){throw new Error(message||'loader assertion failed.');}}var isBrowser$5=Boolean((typeof process==="undefined"?"undefined":_typeof2(process))!=='object'||String(process)!=='[object process]'||process.browser);var matches$4=typeof process!=='undefined'&&process.version&&/v([0-9]*)/.exec(process.version);matches$4&&parseFloat(matches$4[1])||0;var VERSION$9="3.4.15";function assert$8(condition,message){if(!condition){throw new Error(message||'loaders.gl assertion failed.');}}var isBrowser$4=(typeof process==="undefined"?"undefined":_typeof2(process))!=='object'||String(process)!=='[object process]'||process.browser;var isMobile=typeof window!=='undefined'&&typeof window.orientation!=='undefined';var matches$3=typeof process!=='undefined'&&process.version&&/v([0-9]*)/.exec(process.version);matches$3&&parseFloat(matches$3[1])||0;function _typeof(o){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(o){return typeof o;}:function(o){return o&&"function"==typeof Symbol&&o.constructor===Symbol&&o!==Symbol.prototype?"symbol":typeof o;},_typeof(o);}function toPrimitive(t,r){if("object"!=_typeof(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var i=e.call(t,r||"default");if("object"!=_typeof(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.");}return("string"===r?String:Number)(t);}function toPropertyKey(t){var i=toPrimitive(t,"string");return"symbol"==_typeof(i)?i:String(i);}function _defineProperty(obj,key,value){key=toPropertyKey(key);if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true});}else{obj[key]=value;}return obj;}var WorkerJob=/*#__PURE__*/function(){function WorkerJob(jobName,workerThread){var _this118=this;_classCallCheck(this,WorkerJob);_defineProperty(this,"name",void 0);_defineProperty(this,"workerThread",void 0);_defineProperty(this,"isRunning",true);_defineProperty(this,"result",void 0);_defineProperty(this,"_resolve",function(){});_defineProperty(this,"_reject",function(){});this.name=jobName;this.workerThread=workerThread;this.result=new Promise(function(resolve,reject){_this118._resolve=resolve;_this118._reject=reject;});}return _createClass(WorkerJob,[{key:"postMessage",value:function postMessage(type,payload){this.workerThread.postMessage({source:'loaders.gl',type:type,payload:payload});}},{key:"done",value:function done(value){assert$8(this.isRunning);this.isRunning=false;this._resolve(value);}},{key:"error",value:function error(_error){assert$8(this.isRunning);this.isRunning=false;this._reject(_error);}}]);}();var Worker$1=/*#__PURE__*/function(){function Worker$1(){_classCallCheck(this,Worker$1);}return _createClass(Worker$1,[{key:"terminate",value:function terminate(){}}]);}();var workerURLCache=new Map();function getLoadableWorkerURL(props){assert$8(props.source&&!props.url||!props.source&&props.url);var workerURL=workerURLCache.get(props.source||props.url);if(!workerURL){if(props.url){workerURL=getLoadableWorkerURLFromURL(props.url);workerURLCache.set(props.url,workerURL);}if(props.source){workerURL=getLoadableWorkerURLFromSource(props.source);workerURLCache.set(props.source,workerURL);}}assert$8(workerURL);return workerURL;}function getLoadableWorkerURLFromURL(url){if(!url.startsWith('http')){return url;}var workerSource=buildScriptSource(url);return getLoadableWorkerURLFromSource(workerSource);}function getLoadableWorkerURLFromSource(workerSource){var blob=new Blob([workerSource],{type:'application/javascript'});return URL.createObjectURL(blob);}function buildScriptSource(workerUrl){return"try {\n importScripts('".concat(workerUrl,"');\n} catch (error) {\n console.error(error);\n throw error;\n}");}function getTransferList(object){var recursive=arguments.length>1&&arguments[1]!==undefined?arguments[1]:true;var transfers=arguments.length>2?arguments[2]:undefined;var transfersSet=transfers||new Set();if(!object);else if(isTransferable(object)){transfersSet.add(object);}else if(isTransferable(object.buffer)){transfersSet.add(object.buffer);}else if(ArrayBuffer.isView(object));else if(recursive&&_typeof2(object)==='object'){for(var key in object){getTransferList(object[key],recursive,transfersSet);}}return transfers===undefined?Array.from(transfersSet):[];}function isTransferable(object){if(!object){return false;}if(object instanceof ArrayBuffer){return true;}if(typeof MessagePort!=='undefined'&&object instanceof MessagePort){return true;}if(typeof ImageBitmap!=='undefined'&&object instanceof ImageBitmap){return true;}if(typeof OffscreenCanvas!=='undefined'&&object instanceof OffscreenCanvas){return true;}return false;}var NOOP=function NOOP(){};var WorkerThread=/*#__PURE__*/function(){function WorkerThread(props){_classCallCheck(this,WorkerThread);_defineProperty(this,"name",void 0);_defineProperty(this,"source",void 0);_defineProperty(this,"url",void 0);_defineProperty(this,"terminated",false);_defineProperty(this,"worker",void 0);_defineProperty(this,"onMessage",void 0);_defineProperty(this,"onError",void 0);_defineProperty(this,"_loadableURL",'');var name=props.name,source=props.source,url=props.url;assert$8(source||url);this.name=name;this.source=source;this.url=url;this.onMessage=NOOP;this.onError=function(error){return console.log(error);};this.worker=isBrowser$4?this._createBrowserWorker():this._createNodeWorker();}return _createClass(WorkerThread,[{key:"destroy",value:function destroy(){this.onMessage=NOOP;this.onError=NOOP;this.worker.terminate();this.terminated=true;}},{key:"isRunning",get:function get(){return Boolean(this.onMessage);}},{key:"postMessage",value:function postMessage(data,transferList){transferList=transferList||getTransferList(data);this.worker.postMessage(data,transferList);}},{key:"_getErrorFromErrorEvent",value:function _getErrorFromErrorEvent(event){var message='Failed to load ';message+="worker ".concat(this.name," from ").concat(this.url,". ");if(event.message){message+="".concat(event.message," in ");}if(event.lineno){message+=":".concat(event.lineno,":").concat(event.colno);}return new Error(message);}},{key:"_createBrowserWorker",value:function _createBrowserWorker(){var _this119=this;this._loadableURL=getLoadableWorkerURL({source:this.source,url:this.url});var worker=new Worker(this._loadableURL,{name:this.name});worker.onmessage=function(event){if(!event.data){_this119.onError(new Error('No data received'));}else{_this119.onMessage(event.data);}};worker.onerror=function(error){_this119.onError(_this119._getErrorFromErrorEvent(error));_this119.terminated=true;};worker.onmessageerror=function(event){return console.error(event);};return worker;}},{key:"_createNodeWorker",value:function _createNodeWorker(){var _this120=this;var worker;if(this.url){var absolute=this.url.includes(':/')||this.url.startsWith('/');var url=absolute?this.url:"./".concat(this.url);worker=new Worker$1(url,{eval:false});}else if(this.source){worker=new Worker$1(this.source,{eval:true});}else{throw new Error('no worker');}worker.on('message',function(data){_this120.onMessage(data);});worker.on('error',function(error){_this120.onError(error);});worker.on('exit',function(code){});return worker;}}],[{key:"isSupported",value:function isSupported(){return typeof Worker!=='undefined'&&isBrowser$4||typeof Worker$1!=='undefined'&&!isBrowser$4;}}]);}();var WorkerPool=/*#__PURE__*/function(){function WorkerPool(props){_classCallCheck(this,WorkerPool);_defineProperty(this,"name",'unnamed');_defineProperty(this,"source",void 0);_defineProperty(this,"url",void 0);_defineProperty(this,"maxConcurrency",1);_defineProperty(this,"maxMobileConcurrency",1);_defineProperty(this,"onDebug",function(){});_defineProperty(this,"reuseWorkers",true);_defineProperty(this,"props",{});_defineProperty(this,"jobQueue",[]);_defineProperty(this,"idleQueue",[]);_defineProperty(this,"count",0);_defineProperty(this,"isDestroyed",false);this.source=props.source;this.url=props.url;this.setProps(props);}return _createClass(WorkerPool,[{key:"destroy",value:function destroy(){this.idleQueue.forEach(function(worker){return worker.destroy();});this.isDestroyed=true;}},{key:"setProps",value:function setProps(props){this.props=_objectSpread(_objectSpread({},this.props),props);if(props.name!==undefined){this.name=props.name;}if(props.maxConcurrency!==undefined){this.maxConcurrency=props.maxConcurrency;}if(props.maxMobileConcurrency!==undefined){this.maxMobileConcurrency=props.maxMobileConcurrency;}if(props.reuseWorkers!==undefined){this.reuseWorkers=props.reuseWorkers;}if(props.onDebug!==undefined){this.onDebug=props.onDebug;}}},{key:"startJob",value:function(){var _startJob=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2(name){var _this121=this;var onMessage,onError,startPromise,_args2=arguments;return _regeneratorRuntime().wrap(function _callee2$(_context3){while(1)switch(_context3.prev=_context3.next){case 0:onMessage=_args2.length>1&&_args2[1]!==undefined?_args2[1]:function(job,type,data){return job.done(data);};onError=_args2.length>2&&_args2[2]!==undefined?_args2[2]:function(job,error){return job.error(error);};startPromise=new Promise(function(onStart){_this121.jobQueue.push({name:name,onMessage:onMessage,onError:onError,onStart:onStart});return _this121;});this._startQueuedJob();_context3.next=6;return startPromise;case 6:return _context3.abrupt("return",_context3.sent);case 7:case"end":return _context3.stop();}},_callee2,this);}));function startJob(_x7){return _startJob.apply(this,arguments);}return startJob;}()},{key:"_startQueuedJob",value:function(){var _startQueuedJob2=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee3(){var workerThread,queuedJob,job;return _regeneratorRuntime().wrap(function _callee3$(_context4){while(1)switch(_context4.prev=_context4.next){case 0:if(this.jobQueue.length){_context4.next=2;break;}return _context4.abrupt("return");case 2:workerThread=this._getAvailableWorker();if(workerThread){_context4.next=5;break;}return _context4.abrupt("return");case 5:queuedJob=this.jobQueue.shift();if(!queuedJob){_context4.next=18;break;}this.onDebug({message:'Starting job',name:queuedJob.name,workerThread:workerThread,backlog:this.jobQueue.length});job=new WorkerJob(queuedJob.name,workerThread);workerThread.onMessage=function(data){return queuedJob.onMessage(job,data.type,data.payload);};workerThread.onError=function(error){return queuedJob.onError(job,error);};queuedJob.onStart(job);_context4.prev=12;_context4.next=15;return job.result;case 15:_context4.prev=15;this.returnWorkerToQueue(workerThread);return _context4.finish(15);case 18:case"end":return _context4.stop();}},_callee3,this,[[12,,15,18]]);}));function _startQueuedJob(){return _startQueuedJob2.apply(this,arguments);}return _startQueuedJob;}()},{key:"returnWorkerToQueue",value:function returnWorkerToQueue(worker){var shouldDestroyWorker=this.isDestroyed||!this.reuseWorkers||this.count>this._getMaxConcurrency();if(shouldDestroyWorker){worker.destroy();this.count--;}else{this.idleQueue.push(worker);}if(!this.isDestroyed){this._startQueuedJob();}}},{key:"_getAvailableWorker",value:function _getAvailableWorker(){if(this.idleQueue.length>0){return this.idleQueue.shift()||null;}if(this.count<this._getMaxConcurrency()){this.count++;var _name5="".concat(this.name.toLowerCase()," (#").concat(this.count," of ").concat(this.maxConcurrency,")");return new WorkerThread({name:_name5,source:this.source,url:this.url});}return null;}},{key:"_getMaxConcurrency",value:function _getMaxConcurrency(){return isMobile?this.maxMobileConcurrency:this.maxConcurrency;}}],[{key:"isSupported",value:function isSupported(){return WorkerThread.isSupported();}}]);}();var DEFAULT_PROPS={maxConcurrency:3,maxMobileConcurrency:1,reuseWorkers:true,onDebug:function onDebug(){}};var WorkerFarm=/*#__PURE__*/function(){function WorkerFarm(props){_classCallCheck(this,WorkerFarm);_defineProperty(this,"props",void 0);_defineProperty(this,"workerPools",new Map());this.props=_objectSpread({},DEFAULT_PROPS);this.setProps(props);this.workerPools=new Map();}return _createClass(WorkerFarm,[{key:"destroy",value:function destroy(){var _iterator4=_createForOfIteratorHelper(this.workerPools.values()),_step4;try{for(_iterator4.s();!(_step4=_iterator4.n()).done;){var workerPool=_step4.value;workerPool.destroy();}}catch(err){_iterator4.e(err);}finally{_iterator4.f();}this.workerPools=new Map();}},{key:"setProps",value:function setProps(props){this.props=_objectSpread(_objectSpread({},this.props),props);var _iterator5=_createForOfIteratorHelper(this.workerPools.values()),_step5;try{for(_iterator5.s();!(_step5=_iterator5.n()).done;){var workerPool=_step5.value;workerPool.setProps(this._getWorkerPoolProps());}}catch(err){_iterator5.e(err);}finally{_iterator5.f();}}},{key:"getWorkerPool",value:function getWorkerPool(options){var name=options.name,source=options.source,url=options.url;var workerPool=this.workerPools.get(name);if(!workerPool){workerPool=new WorkerPool({name:name,source:source,url:url});workerPool.setProps(this._getWorkerPoolProps());this.workerPools.set(name,workerPool);}return workerPool;}},{key:"_getWorkerPoolProps",value:function _getWorkerPoolProps(){return{maxConcurrency:this.props.maxConcurrency,maxMobileConcurrency:this.props.maxMobileConcurrency,reuseWorkers:this.props.reuseWorkers,onDebug:this.props.onDebug};}}],[{key:"isSupported",value:function isSupported(){return WorkerThread.isSupported();}},{key:"getWorkerFarm",value:function getWorkerFarm(){var props=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};WorkerFarm._workerFarm=WorkerFarm._workerFarm||new WorkerFarm({});WorkerFarm._workerFarm.setProps(props);return WorkerFarm._workerFarm;}}]);}();_defineProperty(WorkerFarm,"_workerFarm",void 0);var NPM_TAG='latest';function getWorkerURL(worker){var options=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};var workerOptions=options[worker.id]||{};var workerFile="".concat(worker.id,"-worker.js");var url=workerOptions.workerUrl;if(!url&&worker.id==='compression'){url=options.workerUrl;}if(options._workerType==='test'){url="modules/".concat(worker.module,"/dist/").concat(workerFile);}if(!url){var version=worker.version;if(version==='latest'){version=NPM_TAG;}var versionTag=version?"@".concat(version):'';url="https://unpkg.com/@loaders.gl/".concat(worker.module).concat(versionTag,"/dist/").concat(workerFile);}assert$8(url);return url;}function validateWorkerVersion(worker){var coreVersion=arguments.length>1&&arguments[1]!==undefined?arguments[1]:VERSION$9;assert$8(worker,'no worker provided');var workerVersion=worker.version;if(!coreVersion||!workerVersion){return false;}return true;}function canParseWithWorker(loader,options){if(!WorkerFarm.isSupported()){return false;}if(!isBrowser$4&&!(options!==null&&options!==void 0&&options._nodeWorkers)){return false;}return loader.worker&&(options===null||options===void 0?void 0:options.worker);}function parseWithWorker(_x8,_x9,_x10,_x11,_x12){return _parseWithWorker.apply(this,arguments);}function _parseWithWorker(){_parseWithWorker=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee10(loader,data,options,context,parseOnMainThread){var name,url,workerFarm,workerPool,job,result;return _regeneratorRuntime().wrap(function _callee10$(_context13){while(1)switch(_context13.prev=_context13.next){case 0:name=loader.id;url=getWorkerURL(loader,options);workerFarm=WorkerFarm.getWorkerFarm(options);workerPool=workerFarm.getWorkerPool({name:name,url:url});options=JSON.parse(JSON.stringify(options));context=JSON.parse(JSON.stringify(context||{}));_context13.next=8;return workerPool.startJob('process-on-worker',onMessage.bind(null,parseOnMainThread));case 8:job=_context13.sent;job.postMessage('process',{input:data,options:options,context:context});_context13.next=12;return job.result;case 12:result=_context13.sent;_context13.next=15;return result.result;case 15:return _context13.abrupt("return",_context13.sent);case 16:case"end":return _context13.stop();}},_callee10);}));return _parseWithWorker.apply(this,arguments);}function onMessage(_x13,_x14,_x15,_x16){return _onMessage2.apply(this,arguments);}function _onMessage2(){_onMessage2=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee11(parseOnMainThread,job,type,payload){var id,input,options,result,message;return _regeneratorRuntime().wrap(function _callee11$(_context14){while(1)switch(_context14.prev=_context14.next){case 0:_context14.t0=type;_context14.next=_context14.t0==='done'?3:_context14.t0==='error'?5:_context14.t0==='process'?7:20;break;case 3:job.done(payload);return _context14.abrupt("break",21);case 5:job.error(new Error(payload.error));return _context14.abrupt("break",21);case 7:id=payload.id,input=payload.input,options=payload.options;_context14.prev=8;_context14.next=11;return parseOnMainThread(input,options);case 11:result=_context14.sent;job.postMessage('done',{id:id,result:result});_context14.next=19;break;case 15:_context14.prev=15;_context14.t1=_context14["catch"](8);message=_context14.t1 instanceof Error?_context14.t1.message:'unknown error';job.postMessage('error',{id:id,error:message});case 19:return _context14.abrupt("break",21);case 20:console.warn("parse-with-worker unknown message ".concat(type));case 21:case"end":return _context14.stop();}},_callee11,null,[[8,15]]);}));return _onMessage2.apply(this,arguments);}function compareArrayBuffers(arrayBuffer1,arrayBuffer2,byteLength){byteLength=byteLength||arrayBuffer1.byteLength;if(arrayBuffer1.byteLength<byteLength||arrayBuffer2.byteLength<byteLength){return false;}var array1=new Uint8Array(arrayBuffer1);var array2=new Uint8Array(arrayBuffer2);for(var _i506=0;_i506<array1.length;++_i506){if(array1[_i506]!==array2[_i506]){return false;}}return true;}function concatenateArrayBuffers(){for(var _len=arguments.length,sources=new Array(_len),_key=0;_key<_len;_key++){sources[_key]=arguments[_key];}var sourceArrays=sources.map(function(source2){return source2 instanceof ArrayBuffer?new Uint8Array(source2):source2;});var byteLength=sourceArrays.reduce(function(length,typedArray){return length+typedArray.byteLength;},0);var result=new Uint8Array(byteLength);var offset=0;var _iterator6=_createForOfIteratorHelper(sourceArrays),_step6;try{for(_iterator6.s();!(_step6=_iterator6.n()).done;){var sourceArray=_step6.value;result.set(sourceArray,offset);offset+=sourceArray.byteLength;}}catch(err){_iterator6.e(err);}finally{_iterator6.f();}return result.buffer;}function concatenateArrayBuffersAsync(_x17){return _concatenateArrayBuffersAsync.apply(this,arguments);}function _concatenateArrayBuffersAsync(){_concatenateArrayBuffersAsync=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee12(asyncIterator){var arrayBuffers,_iteratorAbruptCompletion,_didIteratorError,_iteratorError,_iterator,_step,chunk;return _regeneratorRuntime().wrap(function _callee12$(_context15){while(1)switch(_context15.prev=_context15.next){case 0:arrayBuffers=[];_iteratorAbruptCompletion=false;_didIteratorError=false;_context15.prev=3;_iterator=_asyncIterator(asyncIterator);case 5:_context15.next=7;return _iterator.next();case 7:if(!(_iteratorAbruptCompletion=!(_step=_context15.sent).done)){_context15.next=13;break;}chunk=_step.value;arrayBuffers.push(chunk);case 10:_iteratorAbruptCompletion=false;_context15.next=5;break;case 13:_context15.next=19;break;case 15:_context15.prev=15;_context15.t0=_context15["catch"](3);_didIteratorError=true;_iteratorError=_context15.t0;case 19:_context15.prev=19;_context15.prev=20;if(!(_iteratorAbruptCompletion&&_iterator["return"]!=null)){_context15.next=24;break;}_context15.next=24;return _iterator["return"]();case 24:_context15.prev=24;if(!_didIteratorError){_context15.next=27;break;}throw _iteratorError;case 27:return _context15.finish(24);case 28:return _context15.finish(19);case 29:return _context15.abrupt("return",concatenateArrayBuffers.apply(void 0,arrayBuffers));case 30:case"end":return _context15.stop();}},_callee12,null,[[3,15,19,29],[20,,24,28]]);}));return _concatenateArrayBuffersAsync.apply(this,arguments);}var pathPrefix='';var fileAliases={};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;}function toArrayBuffer$1(buffer){return buffer;}function isBuffer$1(value){return value&&_typeof2(value)==='object'&&value.isBuffer;}function toArrayBuffer(data){if(isBuffer$1(data)){return toArrayBuffer$1(data);}if(data instanceof ArrayBuffer){return data;}if(ArrayBuffer.isView(data)){if(data.byteOffset===0&&data.byteLength===data.buffer.byteLength){return data.buffer;}return data.buffer.slice(data.byteOffset,data.byteOffset+data.byteLength);}if(typeof data==='string'){var text=data;var uint8Array=new TextEncoder().encode(text);return uint8Array.buffer;}if(data&&_typeof2(data)==='object'&&data._toArrayBuffer){return data._toArrayBuffer();}throw new Error('toArrayBuffer');}function filename(url){var slashIndex=url?url.lastIndexOf('/'):-1;return slashIndex>=0?url.substr(slashIndex+1):'';}function dirname(url){var slashIndex=url?url.lastIndexOf('/'):-1;return slashIndex>=0?url.substr(0,slashIndex):'';}var isBoolean=function isBoolean(x){return typeof x==='boolean';};var isFunction=function isFunction(x){return typeof x==='function';};var isObject=function isObject(x){return x!==null&&_typeof2(x)==='object';};var isPureObject=function isPureObject(x){return isObject(x)&&x.constructor==={}.constructor;};var isIterable=function isIterable(x){return x&&typeof x[Symbol.iterator]==='function';};var isAsyncIterable=function isAsyncIterable(x){return x&&typeof x[Symbol.asyncIterator]==='function';};var isResponse=function isResponse(x){return typeof Response!=='undefined'&&x instanceof Response||x&&x.arrayBuffer&&x.text&&x.json;};var isBlob=function isBlob(x){return typeof Blob!=='undefined'&&x instanceof Blob;};var isBuffer=function isBuffer(x){return x&&_typeof2(x)==='object'&&x.isBuffer;};var isReadableDOMStream=function isReadableDOMStream(x){return typeof ReadableStream!=='undefined'&&x instanceof ReadableStream||isObject(x)&&isFunction(x.tee)&&isFunction(x.cancel)&&isFunction(x.getReader);};var isReadableNodeStream=function isReadableNodeStream(x){return isObject(x)&&isFunction(x.read)&&isFunction(x.pipe)&&isBoolean(x.readable);};var isReadableStream=function isReadableStream(x){return isReadableDOMStream(x)||isReadableNodeStream(x);};var DATA_URL_PATTERN=/^data:([-\w.]+\/[-\w.+]+)(;|,)/;var MIME_TYPE_PATTERN=/^([-\w.]+\/[-\w.+]+)/;function parseMIMEType(mimeString){var matches=MIME_TYPE_PATTERN.exec(mimeString);if(matches){return matches[1];}return mimeString;}function parseMIMETypeFromURL(url){var matches=DATA_URL_PATTERN.exec(url);if(matches){return matches[1];}return'';}var QUERY_STRING_PATTERN=/\?.*/;function extractQueryString(url){var matches=url.match(QUERY_STRING_PATTERN);return matches&&matches[0];}function stripQueryString(url){return url.replace(QUERY_STRING_PATTERN,'');}function getResourceUrl(resource){if(isResponse(resource)){var response=resource;return response.url;}if(isBlob(resource)){var blob=resource;return blob.name||'';}if(typeof resource==='string'){return resource;}return'';}function getResourceMIMEType(resource){if(isResponse(resource)){var response=resource;var contentTypeHeader=response.headers.get('content-type')||'';var noQueryUrl=stripQueryString(response.url);return parseMIMEType(contentTypeHeader)||parseMIMETypeFromURL(noQueryUrl);}if(isBlob(resource)){var blob=resource;return blob.type||'';}if(typeof resource==='string'){return parseMIMETypeFromURL(resource);}return'';}function getResourceContentLength(resource){if(isResponse(resource)){var response=resource;return response.headers['content-length']||-1;}if(isBlob(resource)){var blob=resource;return blob.size;}if(typeof resource==='string'){return resource.length;}if(resource instanceof ArrayBuffer){return resource.byteLength;}if(ArrayBuffer.isView(resource)){return resource.byteLength;}return-1;}function makeResponse(_x18){return _makeResponse.apply(this,arguments);}function _makeResponse(){_makeResponse=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee13(resource){var headers,contentLength,url,type,initialDataUrl,response;return _regeneratorRuntime().wrap(function _callee13$(_context16){while(1)switch(_context16.prev=_context16.next){case 0:if(!isResponse(resource)){_context16.next=2;break;}return _context16.abrupt("return",resource);case 2:headers={};contentLength=getResourceContentLength(resource);if(contentLength>=0){headers['content-length']=String(contentLength);}url=getResourceUrl(resource);type=getResourceMIMEType(resource);if(type){headers['content-type']=type;}_context16.next=10;return getInitialDataUrl(resource);case 10:initialDataUrl=_context16.sent;if(initialDataUrl){headers['x-first-bytes']=initialDataUrl;}if(typeof resource==='string'){resource=new TextEncoder().encode(resource);}response=new Response(resource,{headers:headers});Object.defineProperty(response,'url',{value:url});return _context16.abrupt("return",response);case 16:case"end":return _context16.stop();}},_callee13);}));return _makeResponse.apply(this,arguments);}function checkResponse(_x19){return _checkResponse.apply(this,arguments);}function _checkResponse(){_checkResponse=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee14(response){var message;return _regeneratorRuntime().wrap(function _callee14$(_context17){while(1)switch(_context17.prev=_context17.next){case 0:if(response.ok){_context17.next=5;break;}_context17.next=3;return getResponseError(response);case 3:message=_context17.sent;throw new Error(message);case 5:case"end":return _context17.stop();}},_callee14);}));return _checkResponse.apply(this,arguments);}function getResponseError(_x20){return _getResponseError.apply(this,arguments);}function _getResponseError(){_getResponseError=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee15(response){var message,contentType,text;return _regeneratorRuntime().wrap(function _callee15$(_context18){while(1)switch(_context18.prev=_context18.next){case 0:message="Failed to fetch resource ".concat(response.url," (").concat(response.status,"): ");_context18.prev=1;contentType=response.headers.get('Content-Type');text=response.statusText;if(!contentType.includes('application/json')){_context18.next=11;break;}_context18.t0=text;_context18.t1=" ";_context18.next=9;return response.text();case 9:_context18.t2=_context18.sent;text=_context18.t0+=_context18.t1.concat.call(_context18.t1,_context18.t2);case 11:message+=text;message=message.length>60?"".concat(message.slice(0,60),"..."):message;_context18.next=17;break;case 15:_context18.prev=15;_context18.t3=_context18["catch"](1);case 17:return _context18.abrupt("return",message);case 18:case"end":return _context18.stop();}},_callee15,null,[[1,15]]);}));return _getResponseError.apply(this,arguments);}function getInitialDataUrl(_x21){return _getInitialDataUrl.apply(this,arguments);}function _getInitialDataUrl(){_getInitialDataUrl=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee16(resource){var INITIAL_DATA_LENGTH,blobSlice,slice,_base;return _regeneratorRuntime().wrap(function _callee16$(_context19){while(1)switch(_context19.prev=_context19.next){case 0:INITIAL_DATA_LENGTH=5;if(!(typeof resource==='string')){_context19.next=3;break;}return _context19.abrupt("return","data:,".concat(resource.slice(0,INITIAL_DATA_LENGTH)));case 3:if(!(resource instanceof Blob)){_context19.next=8;break;}blobSlice=resource.slice(0,5);_context19.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 _context19.abrupt("return",_context19.sent);case 8:if(!(resource instanceof ArrayBuffer)){_context19.next=12;break;}slice=resource.slice(0,INITIAL_DATA_LENGTH);_base=arrayBufferToBase64(slice);return _context19.abrupt("return","data:base64,".concat(_base));case 12:return _context19.abrupt("return",null);case 13:case"end":return _context19.stop();}},_callee16);}));return _getInitialDataUrl.apply(this,arguments);}function arrayBufferToBase64(buffer){var binary='';var bytes=new Uint8Array(buffer);for(var _i507=0;_i507<bytes.byteLength;_i507++){binary+=String.fromCharCode(bytes[_i507]);}return btoa(binary);}function fetchFile(_x22,_x23){return _fetchFile.apply(this,arguments);}function _fetchFile(){_fetchFile=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee17(url,options){var fetchOptions;return _regeneratorRuntime().wrap(function _callee17$(_context20){while(1)switch(_context20.prev=_context20.next){case 0:if(!(typeof url==='string')){_context20.next=7;break;}url=resolvePath(url);fetchOptions=options;if(options!==null&&options!==void 0&&options.fetch&&typeof(options===null||options===void 0?void 0:options.fetch)!=='function'){fetchOptions=options.fetch;}_context20.next=6;return fetch(url,fetchOptions);case 6:return _context20.abrupt("return",_context20.sent);case 7:_context20.next=9;return makeResponse(url);case 9:return _context20.abrupt("return",_context20.sent);case 10:case"end":return _context20.stop();}},_callee17);}));return _fetchFile.apply(this,arguments);}function isElectron(mockUserAgent){if(typeof window!=='undefined'&&_typeof2(window.process)==='object'&&window.process.type==='renderer'){return true;}if(typeof process!=='undefined'&&_typeof2(process.versions)==='object'&&Boolean(process.versions['electron'])){return true;}var realUserAgent=(typeof navigator==="undefined"?"undefined":_typeof2(navigator))==='object'&&typeof navigator.userAgent==='string'&&navigator.userAgent;var userAgent=mockUserAgent||realUserAgent;if(userAgent&&userAgent.indexOf('Electron')>=0){return true;}return false;}function isBrowser$3(){var isNode=(typeof process==="undefined"?"undefined":_typeof2(process))==='object'&&String(process)==='[object process]'&&!process.browser;return!isNode||isElectron();}var globals$2={self:typeof self!=='undefined'&&self,window:typeof window!=='undefined'&&window,global:typeof global!=='undefined'&&global,document:typeof document!=='undefined'&&document,process:(typeof process==="undefined"?"undefined":_typeof2(process))==='object'&&process};var window_=globals$2.window||globals$2.self||globals$2.global;var process_=globals$2.process||{};var VERSION$8=typeof __VERSION__!=='undefined'?__VERSION__:'untranspiled source';isBrowser$3();function getStorage(type){try{var storage=window[type];var x='__storage_test__';storage.setItem(x,x);storage.removeItem(x);return storage;}catch(e){return null;}}var LocalStorage=/*#__PURE__*/function(){function LocalStorage(id,defaultConfig){_classCallCheck(this,LocalStorage);var type=arguments.length>2&&arguments[2]!==undefined?arguments[2]:'sessionStorage';_defineProperty(this,"storage",void 0);_defineProperty(this,"id",void 0);_defineProperty(this,"config",void 0);this.storage=getStorage(type);this.id=id;this.config=defaultConfig;this._loadConfiguration();}return _createClass(LocalStorage,[{key:"getConfiguration",value:function getConfiguration(){return this.config;}},{key:"setConfiguration",value:function setConfiguration(configuration){Object.assign(this.config,configuration);if(this.storage){var serialized=JSON.stringify(this.config);this.storage.setItem(this.id,serialized);}}},{key:"_loadConfiguration",value:function _loadConfiguration(){var configuration={};if(this.storage){var serializedConfiguration=this.storage.getItem(this.id);configuration=serializedConfiguration?JSON.parse(serializedConfiguration):{};}Object.assign(this.config,configuration);return this;}}]);}();function formatTime(ms){var formatted;if(ms<10){formatted="".concat(ms.toFixed(2),"ms");}else if(ms<100){formatted="".concat(ms.toFixed(1),"ms");}else if(ms<1000){formatted="".concat(ms.toFixed(0),"ms");}else{formatted="".concat((ms/1000).toFixed(2),"s");}return formatted;}function leftPad(string){var length=arguments.length>1&&arguments[1]!==undefined?arguments[1]:8;var padLength=Math.max(length-string.length,0);return"".concat(' '.repeat(padLength)).concat(string);}function formatImage(image,message,scale){var maxWidth=arguments.length>3&&arguments[3]!==undefined?arguments[3]:600;var imageUrl=image.src.replace(/\(/g,'%28').replace(/\)/g,'%29');if(image.width>maxWidth){scale=Math.min(scale,maxWidth/image.width);}var width=image.width*scale;var height=image.height*scale;var style=['font-size:1px;',"padding:".concat(Math.floor(height/2),"px ").concat(Math.floor(width/2),"px;"),"line-height:".concat(height,"px;"),"background:url(".concat(imageUrl,");"),"background-size:".concat(width,"px ").concat(height,"px;"),'color:transparent;'].join('');return["".concat(message," %c+"),style];}var COLOR;(function(COLOR){COLOR[COLOR["BLACK"]=30]="BLACK";COLOR[COLOR["RED"]=31]="RED";COLOR[COLOR["GREEN"]=32]="GREEN";COLOR[COLOR["YELLOW"]=33]="YELLOW";COLOR[COLOR["BLUE"]=34]="BLUE";COLOR[COLOR["MAGENTA"]=35]="MAGENTA";COLOR[COLOR["CYAN"]=36]="CYAN";COLOR[COLOR["WHITE"]=37]="WHITE";COLOR[COLOR["BRIGHT_BLACK"]=90]="BRIGHT_BLACK";COLOR[COLOR["BRIGHT_RED"]=91]="BRIGHT_RED";COLOR[COLOR["BRIGHT_GREEN"]=92]="BRIGHT_GREEN";COLOR[COLOR["BRIGHT_YELLOW"]=93]="BRIGHT_YELLOW";COLOR[COLOR["BRIGHT_BLUE"]=94]="BRIGHT_BLUE";COLOR[COLOR["BRIGHT_MAGENTA"]=95]="BRIGHT_MAGENTA";COLOR[COLOR["BRIGHT_CYAN"]=96]="BRIGHT_CYAN";COLOR[COLOR["BRIGHT_WHITE"]=97]="BRIGHT_WHITE";})(COLOR||(COLOR={}));function getColor(color){return typeof color==='string'?COLOR[color.toUpperCase()]||COLOR.WHITE:color;}function addColor(string,color,background){if(!isBrowser$3&&typeof string==='string'){if(color){color=getColor(color);string="\x1B[".concat(color,"m").concat(string,"\x1B[39m");}if(background){color=getColor(background);string="\x1B[".concat(background+10,"m").concat(string,"\x1B[49m");}}return string;}function autobind(obj){var predefined=arguments.length>1&&arguments[1]!==undefined?arguments[1]:['constructor'];var proto=Object.getPrototypeOf(obj);var propNames=Object.getOwnPropertyNames(proto);var _iterator7=_createForOfIteratorHelper(propNames),_step7;try{var _loop3=function _loop3(){var key=_step7.value;if(typeof obj[key]==='function'){if(!predefined.find(function(name){return key===name;})){obj[key]=obj[key].bind(obj);}}};for(_iterator7.s();!(_step7=_iterator7.n()).done;){_loop3();}}catch(err){_iterator7.e(err);}finally{_iterator7.f();}}function assert$7(condition,message){if(!condition){throw new Error(message||'Assertion failed');}}function getHiResTimestamp(){var timestamp;if(isBrowser$3&&'performance'in window_){var _window$performance,_window$performance$n;timestamp=window_===null||window_===void 0?void 0:(_window$performance=window_.performance)===null||_window$performance===void 0?void 0:(_window$performance$n=_window$performance.now)===null||_window$performance$n===void 0?void 0:_window$performance$n.call(_window$performance);}else if('hrtime'in process_){var _process$hrtime;var timeParts=process_===null||process_===void 0?void 0:(_process$hrtime=process_.hrtime)===null||_process$hrtime===void 0?void 0:_process$hrtime.call(process_);timestamp=timeParts[0]*1000+timeParts[1]/1e6;}else{timestamp=Date.now();}return timestamp;}var originalConsole={debug:isBrowser$3?console.debug||console.log:console.log,log:console.log,info:console.info,warn:console.warn,error:console.error};var DEFAULT_SETTINGS={enabled:true,level:0};function noop(){}var cache={};var ONCE={once:true};var Log=/*#__PURE__*/function(){function Log(){_classCallCheck(this,Log);var _ref16=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{id:''},id=_ref16.id;_defineProperty(this,"id",void 0);_defineProperty(this,"VERSION",VERSION$8);_defineProperty(this,"_startTs",getHiResTimestamp());_defineProperty(this,"_deltaTs",getHiResTimestamp());_defineProperty(this,"_storage",void 0);_defineProperty(this,"userData",{});_defineProperty(this,"LOG_THROTTLE_TIMEOUT",0);this.id=id;this.userData={};this._storage=new LocalStorage("__probe-".concat(this.id,"__"),DEFAULT_SETTINGS);this.timeStamp("".concat(this.id," started"));autobind(this);Object.seal(this);}return _createClass(Log,[{key:"level",get:function get(){return this.getLevel();},set:function set(newLevel){this.setLevel(newLevel);}},{key:"isEnabled",value:function isEnabled(){return this._storage.config.enabled;}},{key:"getLevel",value:function getLevel(){return this._storage.config.level;}},{key:"getTotal",value:function getTotal(){return Number((getHiResTimestamp()-this._startTs).toPrecision(10));}},{key:"getDelta",value:function getDelta(){return Number((getHiResTimestamp()-this._deltaTs).toPrecision(10));}},{key:"priority",get:function get(){return this.level;},set:function set(newPriority){this.level=newPriority;}},{key:"getPriority",value:function getPriority(){return this.level;}},{key:"enable",value:function enable(){var enabled=arguments.length>0&&arguments[0]!==undefined?arguments[0]:true;this._storage.setConfiguration({enabled:enabled});return this;}},{key:"setLevel",value:function setLevel(level){this._storage.setConfiguration({level:level});return this;}},{key:"get",value:function get(setting){return this._storage.config[setting];}},{key:"set",value:function set(setting,value){this._storage.setConfiguration(_defineProperty2({},setting,value));}},{key:"settings",value:function settings(){if(console.table){console.table(this._storage.config);}else{console.log(this._storage.config);}}},{key:"assert",value:function assert(condition,message){assert$7(condition,message);}},{key:"warn",value:function warn(message){return this._getLogFunction(0,message,originalConsole.warn,arguments,ONCE);}},{key:"error",value:function error(message){return this._getLogFunction(0,message,originalConsole.error,arguments);}},{key:"deprecated",value:function deprecated(oldUsage,newUsage){return this.warn("`".concat(oldUsage,"` is deprecated and will be removed in a later version. Use `").concat(newUsage,"` instead"));}},{key:"removed",value:function removed(oldUsage,newUsage){return this.error("`".concat(oldUsage,"` has been removed. Use `").concat(newUsage,"` instead"));}},{key:"probe",value:function probe(logLevel,message){return this._getLogFunction(logLevel,message,originalConsole.log,arguments,{time:true,once:true});}},{key:"log",value:function log(logLevel,message){return this._getLogFunction(logLevel,message,originalConsole.debug,arguments);}},{key:"info",value:function info(logLevel,message){return this._getLogFunction(logLevel,message,console.info,arguments);}},{key:"once",value:function once(logLevel,message){for(var _len=arguments.length,args=new Array(_len>2?_len-2:0),_key=2;_key<_len;_key++){args[_key-2]=arguments[_key];}return this._getLogFunction(logLevel,message,originalConsole.debug||originalConsole.info,arguments,ONCE);}},{key:"table",value:function table(logLevel,_table,columns){if(_table){return this._getLogFunction(logLevel,_table,console.table||noop,columns&&[columns],{tag:getTableHeader(_table)});}return noop;}},{key:"image",value:function image(_ref){var logLevel=_ref.logLevel,priority=_ref.priority,image=_ref.image,_ref$message=_ref.message,message=_ref$message===void 0?'':_ref$message,_ref$scale=_ref.scale,scale=_ref$scale===void 0?1:_ref$scale;if(!this._shouldLog(logLevel||priority)){return noop;}return isBrowser$3?logImageInBrowser({image:image,message:message,scale:scale}):logImageInNode();}},{key:"time",value:function time(logLevel,message){return this._getLogFunction(logLevel,message,console.time?console.time:console.info);}},{key:"timeEnd",value:function timeEnd(logLevel,message){return this._getLogFunction(logLevel,message,console.timeEnd?console.timeEnd:console.info);}},{key:"timeStamp",value:function timeStamp(logLevel,message){return this._getLogFunction(logLevel,message,console.timeStamp||noop);}},{key:"group",value:function group(logLevel,message){var opts=arguments.length>2&&arguments[2]!==undefined?arguments[2]:{collapsed:false};var options=normalizeArguments({logLevel:logLevel,message:message,opts:opts});var collapsed=opts.collapsed;options.method=(collapsed?console.groupCollapsed:console.group)||console.info;return this._getLogFunction(options);}},{key:"groupCollapsed",value:function groupCollapsed(logLevel,message){var opts=arguments.length>2&&arguments[2]!==undefined?arguments[2]:{};return this.group(logLevel,message,Object.assign({},opts,{collapsed:true}));}},{key:"groupEnd",value:function groupEnd(logLevel){return this._getLogFunction(logLevel,'',console.groupEnd||noop);}},{key:"withGroup",value:function withGroup(logLevel,message,func){this.group(logLevel,message)();try{func();}finally{this.groupEnd(logLevel)();}}},{key:"trace",value:function trace(){if(console.trace){console.trace();}}},{key:"_shouldLog",value:function _shouldLog(logLevel){return this.isEnabled()&&this.getLevel()>=normalizeLogLevel(logLevel);}},{key:"_getLogFunction",value:function _getLogFunction(logLevel,message,method,args,opts){if(this._shouldLog(logLevel)){var _method;opts=normalizeArguments({logLevel:logLevel,message:message,args:args,opts:opts});method=method||opts.method;assert$7(method);opts.total=this.getTotal();opts.delta=this.getDelta();this._deltaTs=getHiResTimestamp();var tag=opts.tag||opts.message;if(opts.once){if(!cache[tag]){cache[tag]=getHiResTimestamp();}else{return noop;}}message=decorateMessage(this.id,opts.message,opts);return(_method=method).bind.apply(_method,[console,message].concat(_toConsumableArray(opts.args)));}return noop;}}]);}();_defineProperty(Log,"VERSION",VERSION$8);function normalizeLogLevel(logLevel){if(!logLevel){return 0;}var resolvedLevel;switch(_typeof2(logLevel)){case'number':resolvedLevel=logLevel;break;case'object':resolvedLevel=logLevel.logLevel||logLevel.priority||0;break;default:return 0;}assert$7(Number.isFinite(resolvedLevel)&&resolvedLevel>=0);return resolvedLevel;}function normalizeArguments(opts){var logLevel=opts.logLevel,message=opts.message;opts.logLevel=normalizeLogLevel(logLevel);var args=opts.args?Array.from(opts.args):[];while(args.length&&args.shift()!==message){}switch(_typeof2(logLevel)){case'string':case'function':if(message!==undefined){args.unshift(message);}opts.message=logLevel;break;case'object':Object.assign(opts,logLevel);break;}if(typeof opts.message==='function'){opts.message=opts.message();}var messageType=_typeof2(opts.message);assert$7(messageType==='string'||messageType==='object');return Object.assign(opts,{args:args},opts.opts);}function decorateMessage(id,message,opts){if(typeof message==='string'){var _time=opts.time?leftPad(formatTime(opts.total)):'';message=opts.time?"".concat(id,": ").concat(_time," ").concat(message):"".concat(id,": ").concat(message);message=addColor(message,opts.color,opts.background);}return message;}function logImageInNode(_ref2){console.warn('removed');return noop;}function logImageInBrowser(_ref3){var image=_ref3.image,_ref3$message=_ref3.message,message=_ref3$message===void 0?'':_ref3$message,_ref3$scale=_ref3.scale,scale=_ref3$scale===void 0?1:_ref3$scale;if(typeof image==='string'){var img=new Image();img.onload=function(){var _console;var args=formatImage(img,message,scale);(_console=console).log.apply(_console,_toConsumableArray(args));};img.src=image;return noop;}var element=image.nodeName||'';if(element.toLowerCase()==='img'){var _console2;(_console2=console).log.apply(_console2,_toConsumableArray(formatImage(image,message,scale)));return noop;}if(element.toLowerCase()==='canvas'){var _img=new Image();_img.onload=function(){var _console3;return(_console3=console).log.apply(_console3,_toConsumableArray(formatImage(_img,message,scale)));};_img.src=image.toDataURL();return noop;}return noop;}function getTableHeader(table){for(var key in table){for(var title in table[key]){return title||'untitled';}}return'empty';}var probeLog=new Log({id:'loaders.gl'});var NullLog=/*#__PURE__*/function(){function NullLog(){_classCallCheck(this,NullLog);}return _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(){};}}]);}();var ConsoleLog=/*#__PURE__*/function(){function ConsoleLog(){_classCallCheck(this,ConsoleLog);_defineProperty(this,"console",void 0);this.console=console;}return _createClass(ConsoleLog,[{key:"log",value:function log(){var _this$console$log;for(var _len=arguments.length,args=new Array(_len),_key=0;_key<_len;_key++){args[_key]=arguments[_key];}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 _len2=arguments.length,args=new Array(_len2),_key2=0;_key2<_len2;_key2++){args[_key2]=arguments[_key2];}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 _len3=arguments.length,args=new Array(_len3),_key3=0;_key3<_len3;_key3++){args[_key3]=arguments[_key3];}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 _len4=arguments.length,args=new Array(_len4),_key4=0;_key4<_len4;_key4++){args[_key4]=arguments[_key4];}return(_this$console$error=this.console.error).bind.apply(_this$console$error,[this.console].concat(args));}}]);}();var DEFAULT_LOADER_OPTIONS={fetch:null,mimeType:undefined,nothrow:false,log:new ConsoleLog(),CDN:'https://unpkg.com/@loaders.gl',worker:true,maxConcurrency:3,maxMobileConcurrency:1,reuseWorkers:isBrowser$5,_nodeWorkers:false,_workerType:'',limit:0,_limitMB:0,batchSize:'auto',batchDebounceMs:0,metadata:false,transforms:[]};var REMOVED_LOADER_OPTIONS={"throws":'nothrow',dataType:'(no longer used)',uri:'baseUri',method:'fetch.method',headers:'fetch.headers',body:'fetch.body',mode:'fetch.mode',credentials:'fetch.credentials',cache:'fetch.cache',redirect:'fetch.redirect',referrer:'fetch.referrer',referrerPolicy:'fetch.referrerPolicy',integrity:'fetch.integrity',keepalive:'fetch.keepalive',signal:'fetch.signal'};function getGlobalLoaderState(){globalThis.loaders=globalThis.loaders||{};var loaders=globalThis.loaders;loaders._state=loaders._state||{};return loaders._state;}var getGlobalLoaderOptions=function getGlobalLoaderOptions(){var state=getGlobalLoaderState();state.globalOptions=state.globalOptions||_objectSpread({},DEFAULT_LOADER_OPTIONS);return state.globalOptions;};function normalizeOptions(options,loader,loaders,url){loaders=loaders||[];loaders=Array.isArray(loaders)?loaders:[loaders];validateOptions(options,loaders);return normalizeOptionsInternal(loader,options,url);}function validateOptions(options,loaders){validateOptionsObject(options,null,DEFAULT_LOADER_OPTIONS,REMOVED_LOADER_OPTIONS,loaders);var _iterator8=_createForOfIteratorHelper(loaders),_step8;try{for(_iterator8.s();!(_step8=_iterator8.n()).done;){var loader=_step8.value;var idOptions=options&&options[loader.id]||{};var loaderOptions=loader.options&&loader.options[loader.id]||{};var deprecatedOptions=loader.deprecatedOptions&&loader.deprecatedOptions[loader.id]||{};validateOptionsObject(idOptions,loader.id,loaderOptions,deprecatedOptions,loaders);}}catch(err){_iterator8.e(err);}finally{_iterator8.f();}}function validateOptionsObject(options,id,defaultOptions,deprecatedOptions,loaders){var loaderName=id||'Top level';var prefix=id?"".concat(id,"."):'';for(var key in options){var isSubOptions=!id&&isObject(options[key]);var isBaseUriOption=key==='baseUri'&&!id;var isWorkerUrlOption=key==='workerUrl'&&id;if(!(key in defaultOptions)&&!isBaseUriOption&&!isWorkerUrlOption){if(key in deprecatedOptions){probeLog.warn("".concat(loaderName," loader option '").concat(prefix).concat(key,"' no longer supported, use '").concat(deprecatedOptions[key],"'"))();}else if(!isSubOptions){var suggestion=findSimilarOption(key,loaders);probeLog.warn("".concat(loaderName," loader option '").concat(prefix).concat(key,"' not recognized. ").concat(suggestion))();}}}}function findSimilarOption(optionKey,loaders){var lowerCaseOptionKey=optionKey.toLowerCase();var bestSuggestion='';var _iterator9=_createForOfIteratorHelper(loaders),_step9;try{for(_iterator9.s();!(_step9=_iterator9.n()).done;){var loader=_step9.value;for(var key in loader.options){if(optionKey===key){return"Did you mean '".concat(loader.id,".").concat(key,"'?");}var lowerCaseKey=key.toLowerCase();var isPartialMatch=lowerCaseOptionKey.startsWith(lowerCaseKey)||lowerCaseKey.startsWith(lowerCaseOptionKey);if(isPartialMatch){bestSuggestion=bestSuggestion||"Did you mean '".concat(loader.id,".").concat(key,"'?");}}}}catch(err){_iterator9.e(err);}finally{_iterator9.f();}return bestSuggestion;}function normalizeOptionsInternal(loader,options,url){var loaderDefaultOptions=loader.options||{};var mergedOptions=_objectSpread({},loaderDefaultOptions);addUrlOptions(mergedOptions,url);if(mergedOptions.log===null){mergedOptions.log=new NullLog();}mergeNestedFields(mergedOptions,getGlobalLoaderOptions());mergeNestedFields(mergedOptions,options);return mergedOptions;}function mergeNestedFields(mergedOptions,options){for(var key in options){if(key in options){var value=options[key];if(isPureObject(value)&&isPureObject(mergedOptions[key])){mergedOptions[key]=_objectSpread(_objectSpread({},mergedOptions[key]),options[key]);}else{mergedOptions[key]=options[key];}}}}function addUrlOptions(options,url){if(url&&!('baseUri'in options)){options.baseUri=url;}}function isLoaderObject(loader){var _loader;if(!loader){return false;}if(Array.isArray(loader)){loader=loader[0];}var hasExtensions=Array.isArray((_loader=loader)===null||_loader===void 0?void 0:_loader.extensions);return hasExtensions;}function normalizeLoader(loader){var _loader2,_loader3;assert$9(loader,'null loader');assert$9(isLoaderObject(loader),'invalid loader');var options;if(Array.isArray(loader)){options=loader[1];loader=loader[0];loader=_objectSpread(_objectSpread({},loader),{},{options:_objectSpread(_objectSpread({},loader.options),options)});}if((_loader2=loader)!==null&&_loader2!==void 0&&_loader2.parseTextSync||(_loader3=loader)!==null&&_loader3!==void 0&&_loader3.parseText){loader.text=true;}if(!loader.text){loader.binary=true;}return loader;}var getGlobalLoaderRegistry=function getGlobalLoaderRegistry(){var state=getGlobalLoaderState();state.loaderRegistry=state.loaderRegistry||[];return state.loaderRegistry;};function getRegisteredLoaders(){return getGlobalLoaderRegistry();}var log=new Log({id:'loaders.gl'});var EXT_PATTERN=/\.([^.]+)$/;function selectLoader(_x24){return _selectLoader.apply(this,arguments);}function _selectLoader(){_selectLoader=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee18(data){var loaders,options,context,loader,_args14=arguments;return _regeneratorRuntime().wrap(function _callee18$(_context21){while(1)switch(_context21.prev=_context21.next){case 0:loaders=_args14.length>1&&_args14[1]!==undefined?_args14[1]:[];options=_args14.length>2?_args14[2]:undefined;context=_args14.length>3?_args14[3]:undefined;if(validHTTPResponse(data)){_context21.next=5;break;}return _context21.abrupt("return",null);case 5:loader=selectLoaderSync(data,loaders,_objectSpread(_objectSpread({},options),{},{nothrow:true}),context);if(!loader){_context21.next=8;break;}return _context21.abrupt("return",loader);case 8:if(!isBlob(data)){_context21.next=13;break;}_context21.next=11;return data.slice(0,10).arrayBuffer();case 11:data=_context21.sent;loader=selectLoaderSync(data,loaders,options,context);case 13:if(!(!loader&&!(options!==null&&options!==void 0&&options.nothrow))){_context21.next=15;break;}throw new Error(getNoValidLoaderMessage(data));case 15:return _context21.abrupt("return",loader);case 16:case"end":return _context21.stop();}},_callee18);}));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;}if(loaders&&!Array.isArray(loaders)){return normalizeLoader(loaders);}var candidateLoaders=[];if(loaders){candidateLoaders=candidateLoaders.concat(loaders);}if(!(options!==null&&options!==void 0&&options.ignoreRegisteredLoaders)){var _candidateLoaders;(_candidateLoaders=candidateLoaders).push.apply(_candidateLoaders,_toConsumableArray(getRegisteredLoaders()));}normalizeLoaders(candidateLoaders);var loader=selectLoaderInternal(data,candidateLoaders,options,context);if(!loader&&!(options!==null&&options!==void 0&&options.nothrow)){throw new Error(getNoValidLoaderMessage(data));}return loader;}function selectLoaderInternal(data,loaders,options,context){var url=getResourceUrl(data);var type=getResourceMIMEType(data);var testUrl=stripQueryString(url)||(context===null||context===void 0?void 0:context.url);var loader=null;var reason='';if(options!==null&&options!==void 0&&options.mimeType){loader=findLoaderByMIMEType(loaders,options===null||options===void 0?void 0:options.mimeType);reason="match forced by supplied MIME type ".concat(options===null||options===void 0?void 0:options.mimeType);}loader=loader||findLoaderByUrl(loaders,testUrl);reason=reason||(loader?"matched url ".concat(testUrl):'');loader=loader||findLoaderByMIMEType(loaders,type);reason=reason||(loader?"matched MIME type ".concat(type):'');loader=loader||findLoaderByInitialBytes(loaders,data);reason=reason||(loader?"matched initial data ".concat(getFirstCharacters$1(data)):'');loader=loader||findLoaderByMIMEType(loaders,options===null||options===void 0?void 0:options.fallbackMimeType);reason=reason||(loader?"matched fallback MIME type ".concat(type):'');if(reason){var _loader;log.log(1,"selectLoader selected ".concat((_loader=loader)===null||_loader===void 0?void 0:_loader.name,": ").concat(reason,"."));}return loader;}function validHTTPResponse(data){if(data instanceof Response){if(data.status===204){return false;}}return true;}function getNoValidLoaderMessage(data){var url=getResourceUrl(data);var type=getResourceMIMEType(data);var message='No valid loader found (';message+=url?"".concat(filename(url),", "):'no url provided, ';message+="MIME type: ".concat(type?"\"".concat(type,"\""):'not provided',", ");var firstCharacters=data?getFirstCharacters$1(data):'';message+=firstCharacters?" first bytes: \"".concat(firstCharacters,"\""):'first bytes: not available';message+=')';return message;}function normalizeLoaders(loaders){var _iterator10=_createForOfIteratorHelper(loaders),_step10;try{for(_iterator10.s();!(_step10=_iterator10.n()).done;){var loader=_step10.value;normalizeLoader(loader);}}catch(err){_iterator10.e(err);}finally{_iterator10.f();}}function findLoaderByUrl(loaders,url){var match=url&&EXT_PATTERN.exec(url);var extension=match&&match[1];return extension?findLoaderByExtension(loaders,extension):null;}function findLoaderByExtension(loaders,extension){extension=extension.toLowerCase();var _iterator11=_createForOfIteratorHelper(loaders),_step11;try{for(_iterator11.s();!(_step11=_iterator11.n()).done;){var loader=_step11.value;var _iterator12=_createForOfIteratorHelper(loader.extensions),_step12;try{for(_iterator12.s();!(_step12=_iterator12.n()).done;){var loaderExtension=_step12.value;if(loaderExtension.toLowerCase()===extension){return loader;}}}catch(err){_iterator12.e(err);}finally{_iterator12.f();}}}catch(err){_iterator11.e(err);}finally{_iterator11.f();}return null;}function findLoaderByMIMEType(loaders,mimeType){var _iterator13=_createForOfIteratorHelper(loaders),_step13;try{for(_iterator13.s();!(_step13=_iterator13.n()).done;){var loader=_step13.value;if(loader.mimeTypes&&loader.mimeTypes.includes(mimeType)){return loader;}if(mimeType==="application/x.".concat(loader.id)){return loader;}}}catch(err){_iterator13.e(err);}finally{_iterator13.f();}return null;}function findLoaderByInitialBytes(loaders,data){if(!data){return null;}var _iterator14=_createForOfIteratorHelper(loaders),_step14;try{for(_iterator14.s();!(_step14=_iterator14.n()).done;){var loader=_step14.value;if(typeof data==='string'){if(testDataAgainstText(data,loader)){return loader;}}else if(ArrayBuffer.isView(data)){if(testDataAgainstBinary(data.buffer,data.byteOffset,loader)){return loader;}}else if(data instanceof ArrayBuffer){var byteOffset=0;if(testDataAgainstBinary(data,byteOffset,loader)){return loader;}}}}catch(err){_iterator14.e(err);}finally{_iterator14.f();}return null;}function testDataAgainstText(data,loader){if(loader.testText){return loader.testText(data);}var tests=Array.isArray(loader.tests)?loader.tests:[loader.tests];return tests.some(function(test){return data.startsWith(test);});}function testDataAgainstBinary(data,byteOffset,loader){var tests=Array.isArray(loader.tests)?loader.tests:[loader.tests];return tests.some(function(test){return testBinary(data,byteOffset,loader,test);});}function testBinary(data,byteOffset,loader,test){if(test instanceof ArrayBuffer){return compareArrayBuffers(test,data,test.byteLength);}switch(_typeof2(test)){case'function':return test(data,loader);case'string':var magic=getMagicString$2(data,byteOffset,test.length);return test===magic;default:return false;}}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)){return getMagicString$2(data.buffer,data.byteOffset,length);}else if(data instanceof ArrayBuffer){var byteOffset=0;return getMagicString$2(data,byteOffset,length);}return'';}function getMagicString$2(arrayBuffer,byteOffset,length){if(arrayBuffer.byteLength<byteOffset+length){return'';}var dataView=new DataView(arrayBuffer);var magic='';for(var _i508=0;_i508<length;_i508++){magic+=String.fromCharCode(dataView.getUint8(byteOffset+_i508));}return magic;}var DEFAULT_CHUNK_SIZE$2=256*1024;function makeStringIterator(string,options){var chunkSize,offset,textEncoder,chunkLength,chunk;return _regeneratorRuntime().wrap(function makeStringIterator$(_context5){while(1)switch(_context5.prev=_context5.next){case 0:chunkSize=(options===null||options===void 0?void 0:options.chunkSize)||DEFAULT_CHUNK_SIZE$2;offset=0;textEncoder=new TextEncoder();case 3:if(!(offset<string.length)){_context5.next=11;break;}chunkLength=Math.min(string.length-offset,chunkSize);chunk=string.slice(offset,offset+chunkLength);offset+=chunkLength;_context5.next=9;return textEncoder.encode(chunk);case 9:_context5.next=3;break;case 11:case"end":return _context5.stop();}},_marked);}var DEFAULT_CHUNK_SIZE$1=256*1024;function makeArrayBufferIterator(arrayBuffer){var options=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};return/*#__PURE__*/_regeneratorRuntime().mark(function _callee4(){var _options$chunkSize,chunkSize,byteOffset,chunkByteLength,chunk,sourceArray,_chunkArray;return _regeneratorRuntime().wrap(function _callee4$(_context6){while(1)switch(_context6.prev=_context6.next){case 0:_options$chunkSize=options.chunkSize,chunkSize=_options$chunkSize===void 0?DEFAULT_CHUNK_SIZE$1:_options$chunkSize;byteOffset=0;case 2:if(!(byteOffset<arrayBuffer.byteLength)){_context6.next=13;break;}chunkByteLength=Math.min(arrayBuffer.byteLength-byteOffset,chunkSize);chunk=new ArrayBuffer(chunkByteLength);sourceArray=new Uint8Array(arrayBuffer,byteOffset,chunkByteLength);_chunkArray=new Uint8Array(chunk);_chunkArray.set(sourceArray);byteOffset+=chunkByteLength;_context6.next=11;return chunk;case 11:_context6.next=2;break;case 13:case"end":return _context6.stop();}},_callee4);})();}var DEFAULT_CHUNK_SIZE=1024*1024;function makeBlobIterator(_x,_x2){return _makeBlobIterator.apply(this,arguments);}function _makeBlobIterator(){_makeBlobIterator=_wrapAsyncGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee5(blob,options){var chunkSize,offset,end,chunk;return _regeneratorRuntime().wrap(function _callee5$(_context7){while(1)switch(_context7.prev=_context7.next){case 0:chunkSize=(options===null||options===void 0?void 0:options.chunkSize)||DEFAULT_CHUNK_SIZE;offset=0;case 2:if(!(offset<blob.size)){_context7.next=12;break;}end=offset+chunkSize;_context7.next=6;return _awaitAsyncGenerator(blob.slice(offset,end).arrayBuffer());case 6:chunk=_context7.sent;offset=end;_context7.next=10;return chunk;case 10:_context7.next=2;break;case 12:case"end":return _context7.stop();}},_callee5);}));return _makeBlobIterator.apply(this,arguments);}function makeStreamIterator(stream,options){return isBrowser$5?makeBrowserStreamIterator(stream,options):makeNodeStreamIterator(stream);}function makeBrowserStreamIterator(_x3,_x4){return _makeBrowserStreamIterator.apply(this,arguments);}function _makeBrowserStreamIterator(){_makeBrowserStreamIterator=_wrapAsyncGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee6(stream,options){var reader,nextBatchPromise,currentBatchPromise,_yield$_awaitAsyncGen,done,value;return _regeneratorRuntime().wrap(function _callee6$(_context8){while(1)switch(_context8.prev=_context8.next){case 0:reader=stream.getReader();_context8.prev=1;case 2:if(!true){_context8.next=16;break;}currentBatchPromise=nextBatchPromise||reader.read();if(options!==null&&options!==void 0&&options._streamReadAhead){nextBatchPromise=reader.read();}_context8.next=7;return _awaitAsyncGenerator(currentBatchPromise);case 7:_yield$_awaitAsyncGen=_context8.sent;done=_yield$_awaitAsyncGen.done;value=_yield$_awaitAsyncGen.value;if(!done){_context8.next=12;break;}return _context8.abrupt("return");case 12:_context8.next=14;return toArrayBuffer(value);case 14:_context8.next=2;break;case 16:_context8.next=21;break;case 18:_context8.prev=18;_context8.t0=_context8["catch"](1);reader.releaseLock();case 21:case"end":return _context8.stop();}},_callee6,null,[[1,18]]);}));return _makeBrowserStreamIterator.apply(this,arguments);}function makeNodeStreamIterator(_x5,_x6){return _makeNodeStreamIterator.apply(this,arguments);}function _makeNodeStreamIterator(){_makeNodeStreamIterator=_wrapAsyncGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee7(stream,options){var _iteratorAbruptCompletion2,_didIteratorError2,_iteratorError2,_iterator2,_step2,chunk;return _regeneratorRuntime().wrap(function _callee7$(_context9){while(1)switch(_context9.prev=_context9.next){case 0:_iteratorAbruptCompletion2=false;_didIteratorError2=false;_context9.prev=2;_iterator2=_asyncIterator(stream);case 4:_context9.next=6;return _awaitAsyncGenerator(_iterator2.next());case 6:if(!(_iteratorAbruptCompletion2=!(_step2=_context9.sent).done)){_context9.next=13;break;}chunk=_step2.value;_context9.next=10;return toArrayBuffer(chunk);case 10:_iteratorAbruptCompletion2=false;_context9.next=4;break;case 13:_context9.next=19;break;case 15:_context9.prev=15;_context9.t0=_context9["catch"](2);_didIteratorError2=true;_iteratorError2=_context9.t0;case 19:_context9.prev=19;_context9.prev=20;if(!(_iteratorAbruptCompletion2&&_iterator2["return"]!=null)){_context9.next=24;break;}_context9.next=24;return _awaitAsyncGenerator(_iterator2["return"]());case 24:_context9.prev=24;if(!_didIteratorError2){_context9.next=27;break;}throw _iteratorError2;case 27:return _context9.finish(24);case 28:return _context9.finish(19);case 29:case"end":return _context9.stop();}},_callee7,null,[[2,15,19,29],[20,,24,28]]);}));return _makeNodeStreamIterator.apply(this,arguments);}function makeIterator(data,options){if(typeof data==='string'){return makeStringIterator(data,options);}if(data instanceof ArrayBuffer){return makeArrayBufferIterator(data,options);}if(isBlob(data)){return makeBlobIterator(data,options);}if(isReadableStream(data)){return makeStreamIterator(data,options);}if(isResponse(data)){var response=data;return makeStreamIterator(response.body,options);}throw new Error('makeIterator');}var ERR_DATA='Cannot convert supplied data type';function getArrayBufferOrStringFromDataSync(data,loader,options){if(loader.text&&typeof data==='string'){return data;}if(isBuffer(data)){data=data.buffer;}if(data instanceof ArrayBuffer){var arrayBuffer=data;if(loader.text&&!loader.binary){var textDecoder=new TextDecoder('utf8');return textDecoder.decode(arrayBuffer);}return arrayBuffer;}if(ArrayBuffer.isView(data)){if(loader.text&&!loader.binary){var _textDecoder=new TextDecoder('utf8');return _textDecoder.decode(data);}var _arrayBuffer=data.buffer;var byteLength=data.byteLength||data.length;if(data.byteOffset!==0||byteLength!==_arrayBuffer.byteLength){_arrayBuffer=_arrayBuffer.slice(data.byteOffset,data.byteOffset+byteLength);}return _arrayBuffer;}throw new Error(ERR_DATA);}function getArrayBufferOrStringFromData(_x25,_x26,_x27){return _getArrayBufferOrStringFromData.apply(this,arguments);}function _getArrayBufferOrStringFromData(){_getArrayBufferOrStringFromData=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee19(data,loader,options){var isArrayBuffer,response;return _regeneratorRuntime().wrap(function _callee19$(_context22){while(1)switch(_context22.prev=_context22.next){case 0:isArrayBuffer=data instanceof ArrayBuffer||ArrayBuffer.isView(data);if(!(typeof data==='string'||isArrayBuffer)){_context22.next=3;break;}return _context22.abrupt("return",getArrayBufferOrStringFromDataSync(data,loader));case 3:if(!isBlob(data)){_context22.next=7;break;}_context22.next=6;return makeResponse(data);case 6:data=_context22.sent;case 7:if(!isResponse(data)){_context22.next=21;break;}response=data;_context22.next=11;return checkResponse(response);case 11:if(!loader.binary){_context22.next=17;break;}_context22.next=14;return response.arrayBuffer();case 14:_context22.t0=_context22.sent;_context22.next=20;break;case 17:_context22.next=19;return response.text();case 19:_context22.t0=_context22.sent;case 20:return _context22.abrupt("return",_context22.t0);case 21:if(isReadableStream(data)){data=makeIterator(data,options);}if(!(isIterable(data)||isAsyncIterable(data))){_context22.next=24;break;}return _context22.abrupt("return",concatenateArrayBuffersAsync(data));case 24:throw new Error(ERR_DATA);case 25:case"end":return _context22.stop();}},_callee19);}));return _getArrayBufferOrStringFromData.apply(this,arguments);}function getFetchFunction(options,context){var globalOptions=getGlobalLoaderOptions();var fetchOptions=options||globalOptions;if(typeof fetchOptions.fetch==='function'){return fetchOptions.fetch;}if(isObject(fetchOptions.fetch)){return function(url){return fetchFile(url,fetchOptions);};}if(context!==null&&context!==void 0&&context.fetch){return context===null||context===void 0?void 0:context.fetch;}return fetchFile;}function getLoaderContext(context,options,parentContext){if(parentContext){return parentContext;}var newContext=_objectSpread({fetch:getFetchFunction(options,context)},context);if(newContext.url){var baseUrl=stripQueryString(newContext.url);newContext.baseUrl=baseUrl;newContext.queryString=extractQueryString(newContext.url);newContext.filename=filename(baseUrl);newContext.baseUrl=dirname(baseUrl);}if(!Array.isArray(newContext.loaders)){newContext.loaders=null;}return newContext;}function getLoadersFromContext(loaders,context){if(!context&&loaders&&!Array.isArray(loaders)){return loaders;}var candidateLoaders;if(loaders){candidateLoaders=Array.isArray(loaders)?loaders:[loaders];}if(context&&context.loaders){var contextLoaders=Array.isArray(context.loaders)?context.loaders:[context.loaders];candidateLoaders=candidateLoaders?[].concat(_toConsumableArray(candidateLoaders),_toConsumableArray(contextLoaders)):contextLoaders;}return candidateLoaders&&candidateLoaders.length?candidateLoaders:null;}function parse$2(_x28,_x29,_x30,_x31){return _parse$.apply(this,arguments);}function _parse$(){_parse$=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee20(data,loaders,options,context){var url,typedLoaders,candidateLoaders,loader;return _regeneratorRuntime().wrap(function _callee20$(_context23){while(1)switch(_context23.prev=_context23.next){case 0:assert$8(!context||_typeof2(context)==='object');if(loaders&&!Array.isArray(loaders)&&!isLoaderObject(loaders)){context=undefined;options=loaders;loaders=undefined;}_context23.next=4;return data;case 4:data=_context23.sent;options=options||{};url=getResourceUrl(data);typedLoaders=loaders;candidateLoaders=getLoadersFromContext(typedLoaders,context);_context23.next=11;return selectLoader(data,candidateLoaders,options);case 11:loader=_context23.sent;if(loader){_context23.next=14;break;}return _context23.abrupt("return",null);case 14:options=normalizeOptions(options,loader,candidateLoaders,url);context=getLoaderContext({url:url,parse:parse$2,loaders:candidateLoaders},options,context||null);_context23.next=18;return parseWithLoader(loader,data,options,context);case 18:return _context23.abrupt("return",_context23.sent);case 19:case"end":return _context23.stop();}},_callee20);}));return _parse$.apply(this,arguments);}function parseWithLoader(_x32,_x33,_x34,_x35){return _parseWithLoader.apply(this,arguments);}function _parseWithLoader(){_parseWithLoader=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee21(loader,data,options,context){var response,ok,redirected,status,statusText,type,url,headers;return _regeneratorRuntime().wrap(function _callee21$(_context24){while(1)switch(_context24.prev=_context24.next){case 0:validateWorkerVersion(loader);if(isResponse(data)){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());context.response={headers:headers,ok:ok,redirected:redirected,status:status,statusText:statusText,type:type,url:url};}_context24.next=4;return getArrayBufferOrStringFromData(data,loader,options);case 4:data=_context24.sent;if(!(loader.parseTextSync&&typeof data==='string')){_context24.next=8;break;}options.dataType='text';return _context24.abrupt("return",loader.parseTextSync(data,options,context,loader));case 8:if(!canParseWithWorker(loader,options)){_context24.next=12;break;}_context24.next=11;return parseWithWorker(loader,data,options,context,parse$2);case 11:return _context24.abrupt("return",_context24.sent);case 12:if(!(loader.parseText&&typeof data==='string')){_context24.next=16;break;}_context24.next=15;return loader.parseText(data,options,context,loader);case 15:return _context24.abrupt("return",_context24.sent);case 16:if(!loader.parse){_context24.next=20;break;}_context24.next=19;return loader.parse(data,options,context,loader);case 19:return _context24.abrupt("return",_context24.sent);case 20:assert$8(!loader.parseSync);throw new Error("".concat(loader.id," loader - no parser found and worker is disabled"));case 22:case"end":return _context24.stop();}},_callee21);}));return _parseWithLoader.apply(this,arguments);}var VERSION$7="3.4.15";function assert$6(condition,message){if(!condition){throw new Error(message||'loaders.gl assertion failed.');}}var globals$1={self:typeof self!=='undefined'&&self,window:typeof window!=='undefined'&&window,global:typeof global!=='undefined'&&global,document:typeof document!=='undefined'&&document};var global_$1=globals$1.global||globals$1.self||globals$1.window||{};var isBrowser$2=(typeof process==="undefined"?"undefined":_typeof2(process))!=='object'||String(process)!=='[object process]'||process.browser;var isWorker$1=typeof importScripts==='function';var matches$2=typeof process!=='undefined'&&process.version&&/v([0-9]*)/.exec(process.version);matches$2&&parseFloat(matches$2[1])||0;var readFileAsArrayBuffer$1=null;var readFileAsText$1=null;var requireFromFile$1=null;var requireFromString$1=null;var node$1=/*#__PURE__*/Object.freeze({__proto__:null,readFileAsArrayBuffer:readFileAsArrayBuffer$1,readFileAsText:readFileAsText$1,requireFromFile:requireFromFile$1,requireFromString:requireFromString$1});var VERSION$6="3.4.15";var loadLibraryPromises$1={};function loadLibrary$1(_x36){return _loadLibrary$.apply(this,arguments);}function _loadLibrary$(){_loadLibrary$=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee22(libraryUrl){var moduleName,options,_args18=arguments;return _regeneratorRuntime().wrap(function _callee22$(_context25){while(1)switch(_context25.prev=_context25.next){case 0:moduleName=_args18.length>1&&_args18[1]!==undefined?_args18[1]:null;options=_args18.length>2&&_args18[2]!==undefined?_args18[2]:{};if(moduleName){libraryUrl=getLibraryUrl$1(libraryUrl,moduleName,options);}loadLibraryPromises$1[libraryUrl]=loadLibraryPromises$1[libraryUrl]||loadLibraryFromFile$1(libraryUrl);_context25.next=6;return loadLibraryPromises$1[libraryUrl];case 6:return _context25.abrupt("return",_context25.sent);case 7:case"end":return _context25.stop();}},_callee22);}));return _loadLibrary$.apply(this,arguments);}function getLibraryUrl$1(library,moduleName,options){if(library.startsWith('http')){return library;}var modules=options.modules||{};if(modules[library]){return modules[library];}if(!isBrowser$2){return"modules/".concat(moduleName,"/dist/libs/").concat(library);}if(options.CDN){assert$6(options.CDN.startsWith('http'));return"".concat(options.CDN,"/").concat(moduleName,"@").concat(VERSION$6,"/dist/libs/").concat(library);}if(isWorker$1){return"../src/libs/".concat(library);}return"modules/".concat(moduleName,"/src/libs/").concat(library);}function loadLibraryFromFile$1(_x37){return _loadLibraryFromFile$.apply(this,arguments);}function _loadLibraryFromFile$(){_loadLibraryFromFile$=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee23(libraryUrl){var _response,response,scriptSource;return _regeneratorRuntime().wrap(function _callee23$(_context26){while(1)switch(_context26.prev=_context26.next){case 0:if(!libraryUrl.endsWith('wasm')){_context26.next=7;break;}_context26.next=3;return fetch(libraryUrl);case 3:_response=_context26.sent;_context26.next=6;return _response.arrayBuffer();case 6:return _context26.abrupt("return",_context26.sent);case 7:if(isBrowser$2){_context26.next=20;break;}_context26.prev=8;_context26.t0=node$1&&requireFromFile$1;if(!_context26.t0){_context26.next=14;break;}_context26.next=13;return requireFromFile$1(libraryUrl);case 13:_context26.t0=_context26.sent;case 14:return _context26.abrupt("return",_context26.t0);case 17:_context26.prev=17;_context26.t1=_context26["catch"](8);return _context26.abrupt("return",null);case 20:if(!isWorker$1){_context26.next=22;break;}return _context26.abrupt("return",importScripts(libraryUrl));case 22:_context26.next=24;return fetch(libraryUrl);case 24:response=_context26.sent;_context26.next=27;return response.text();case 27:scriptSource=_context26.sent;return _context26.abrupt("return",loadLibraryFromString$1(scriptSource,libraryUrl));case 29:case"end":return _context26.stop();}},_callee23,null,[[8,17]]);}));return _loadLibraryFromFile$.apply(this,arguments);}function loadLibraryFromString$1(scriptSource,id){if(!isBrowser$2){return requireFromString$1;}if(isWorker$1){eval.call(global_$1,scriptSource);return null;}var script=document.createElement('script');script.id=id;try{script.appendChild(document.createTextNode(scriptSource));}catch(e){script.text=scriptSource;}document.body.appendChild(script);return null;}var VERSION$5="3.4.15";var VERSION$4="3.4.15";var BASIS_CDN_ENCODER_WASM="https://unpkg.com/@loaders.gl/textures@".concat(VERSION$4,"/dist/libs/basis_encoder.wasm");var BASIS_CDN_ENCODER_JS="https://unpkg.com/@loaders.gl/textures@".concat(VERSION$4,"/dist/libs/basis_encoder.js");var loadBasisTranscoderPromise;function loadBasisTrascoderModule(_x38){return _loadBasisTrascoderModule.apply(this,arguments);}function _loadBasisTrascoderModule(){_loadBasisTrascoderModule=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee24(options){var modules;return _regeneratorRuntime().wrap(function _callee24$(_context27){while(1)switch(_context27.prev=_context27.next){case 0:modules=options.modules||{};if(!modules.basis){_context27.next=3;break;}return _context27.abrupt("return",modules.basis);case 3:loadBasisTranscoderPromise=loadBasisTranscoderPromise||loadBasisTrascoder(options);_context27.next=6;return loadBasisTranscoderPromise;case 6:return _context27.abrupt("return",_context27.sent);case 7:case"end":return _context27.stop();}},_callee24);}));return _loadBasisTrascoderModule.apply(this,arguments);}function loadBasisTrascoder(_x39){return _loadBasisTrascoder.apply(this,arguments);}function _loadBasisTrascoder(){_loadBasisTrascoder=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee25(options){var BASIS,wasmBinary,_yield$Promise$all,_yield$Promise$all2;return _regeneratorRuntime().wrap(function _callee25$(_context28){while(1)switch(_context28.prev=_context28.next){case 0:BASIS=null;wasmBinary=null;_context28.t0=Promise;_context28.next=5;return loadLibrary$1('basis_transcoder.js','textures',options);case 5:_context28.t1=_context28.sent;_context28.next=8;return loadLibrary$1('basis_transcoder.wasm','textures',options);case 8:_context28.t2=_context28.sent;_context28.t3=[_context28.t1,_context28.t2];_context28.next=12;return _context28.t0.all.call(_context28.t0,_context28.t3);case 12:_yield$Promise$all=_context28.sent;_yield$Promise$all2=_slicedToArray(_yield$Promise$all,2);BASIS=_yield$Promise$all2[0];wasmBinary=_yield$Promise$all2[1];BASIS=BASIS||globalThis.BASIS;_context28.next=19;return initializeBasisTrascoderModule(BASIS,wasmBinary);case 19:return _context28.abrupt("return",_context28.sent);case 20:case"end":return _context28.stop();}},_callee25);}));return _loadBasisTrascoder.apply(this,arguments);}function initializeBasisTrascoderModule(BasisModule,wasmBinary){var options={};if(wasmBinary){options.wasmBinary=wasmBinary;}return new Promise(function(resolve){BasisModule(options).then(function(module){var BasisFile=module.BasisFile,initializeBasis=module.initializeBasis;initializeBasis();resolve({BasisFile:BasisFile});});});}var loadBasisEncoderPromise;function loadBasisEncoderModule(_x40){return _loadBasisEncoderModule.apply(this,arguments);}function _loadBasisEncoderModule(){_loadBasisEncoderModule=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee26(options){var modules;return _regeneratorRuntime().wrap(function _callee26$(_context29){while(1)switch(_context29.prev=_context29.next){case 0:modules=options.modules||{};if(!modules.basisEncoder){_context29.next=3;break;}return _context29.abrupt("return",modules.basisEncoder);case 3:loadBasisEncoderPromise=loadBasisEncoderPromise||loadBasisEncoder(options);_context29.next=6;return loadBasisEncoderPromise;case 6:return _context29.abrupt("return",_context29.sent);case 7:case"end":return _context29.stop();}},_callee26);}));return _loadBasisEncoderModule.apply(this,arguments);}function loadBasisEncoder(_x41){return _loadBasisEncoder.apply(this,arguments);}function _loadBasisEncoder(){_loadBasisEncoder=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee27(options){var BASIS_ENCODER,wasmBinary,_yield$Promise$all3,_yield$Promise$all4;return _regeneratorRuntime().wrap(function _callee27$(_context30){while(1)switch(_context30.prev=_context30.next){case 0:BASIS_ENCODER=null;wasmBinary=null;_context30.t0=Promise;_context30.next=5;return loadLibrary$1(BASIS_CDN_ENCODER_JS,'textures',options);case 5:_context30.t1=_context30.sent;_context30.next=8;return loadLibrary$1(BASIS_CDN_ENCODER_WASM,'textures',options);case 8:_context30.t2=_context30.sent;_context30.t3=[_context30.t1,_context30.t2];_context30.next=12;return _context30.t0.all.call(_context30.t0,_context30.t3);case 12:_yield$Promise$all3=_context30.sent;_yield$Promise$all4=_slicedToArray(_yield$Promise$all3,2);BASIS_ENCODER=_yield$Promise$all4[0];wasmBinary=_yield$Promise$all4[1];BASIS_ENCODER=BASIS_ENCODER||globalThis.BASIS;_context30.next=19;return initializeBasisEncoderModule(BASIS_ENCODER,wasmBinary);case 19:return _context30.abrupt("return",_context30.sent);case 20:case"end":return _context30.stop();}},_callee27);}));return _loadBasisEncoder.apply(this,arguments);}function initializeBasisEncoderModule(BasisEncoderModule,wasmBinary){var options={};if(wasmBinary){options.wasmBinary=wasmBinary;}return new Promise(function(resolve){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});});});}var GL_EXTENSIONS_CONSTANTS={COMPRESSED_RGB_S3TC_DXT1_EXT:0x83f0,COMPRESSED_RGBA_S3TC_DXT1_EXT:0x83f1,COMPRESSED_RGBA_S3TC_DXT3_EXT:0x83f2,COMPRESSED_RGBA_S3TC_DXT5_EXT:0x83f3,COMPRESSED_R11_EAC:0x9270,COMPRESSED_SIGNED_R11_EAC:0x9271,COMPRESSED_RG11_EAC:0x9272,COMPRESSED_SIGNED_RG11_EAC:0x9273,COMPRESSED_RGB8_ETC2:0x9274,COMPRESSED_RGBA8_ETC2_EAC:0x9275,COMPRESSED_SRGB8_ETC2:0x9276,COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:0x9277,COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2:0x9278,COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2:0x9279,COMPRESSED_RGB_PVRTC_4BPPV1_IMG:0x8c00,COMPRESSED_RGBA_PVRTC_4BPPV1_IMG:0x8c02,COMPRESSED_RGB_PVRTC_2BPPV1_IMG:0x8c01,COMPRESSED_RGBA_PVRTC_2BPPV1_IMG:0x8c03,COMPRESSED_RGB_ETC1_WEBGL:0x8d64,COMPRESSED_RGB_ATC_WEBGL:0x8c92,COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL:0x8c93,COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL:0x87ee,COMPRESSED_RGBA_ASTC_4X4_KHR:0x93b0,COMPRESSED_RGBA_ASTC_5X4_KHR:0x93b1,COMPRESSED_RGBA_ASTC_5X5_KHR:0x93b2,COMPRESSED_RGBA_ASTC_6X5_KHR:0x93b3,COMPRESSED_RGBA_ASTC_6X6_KHR:0x93b4,COMPRESSED_RGBA_ASTC_8X5_KHR:0x93b5,COMPRESSED_RGBA_ASTC_8X6_KHR:0x93b6,COMPRESSED_RGBA_ASTC_8X8_KHR:0x93b7,COMPRESSED_RGBA_ASTC_10X5_KHR:0x93b8,COMPRESSED_RGBA_ASTC_10X6_KHR:0x93b9,COMPRESSED_RGBA_ASTC_10X8_KHR:0x93ba,COMPRESSED_RGBA_ASTC_10X10_KHR:0x93bb,COMPRESSED_RGBA_ASTC_12X10_KHR:0x93bc,COMPRESSED_RGBA_ASTC_12X12_KHR:0x93bd,COMPRESSED_SRGB8_ALPHA8_ASTC_4X4_KHR:0x93d0,COMPRESSED_SRGB8_ALPHA8_ASTC_5X4_KHR:0x93d1,COMPRESSED_SRGB8_ALPHA8_ASTC_5X5_KHR:0x93d2,COMPRESSED_SRGB8_ALPHA8_ASTC_6X5_KHR:0x93d3,COMPRESSED_SRGB8_ALPHA8_ASTC_6X6_KHR:0x93d4,COMPRESSED_SRGB8_ALPHA8_ASTC_8X5_KHR:0x93d5,COMPRESSED_SRGB8_ALPHA8_ASTC_8X6_KHR:0x93d6,COMPRESSED_SRGB8_ALPHA8_ASTC_8X8_KHR:0x93d7,COMPRESSED_SRGB8_ALPHA8_ASTC_10X5_KHR:0x93d8,COMPRESSED_SRGB8_ALPHA8_ASTC_10X6_KHR:0x93d9,COMPRESSED_SRGB8_ALPHA8_ASTC_10X8_KHR:0x93da,COMPRESSED_SRGB8_ALPHA8_ASTC_10X10_KHR:0x93db,COMPRESSED_SRGB8_ALPHA8_ASTC_12X10_KHR:0x93dc,COMPRESSED_SRGB8_ALPHA8_ASTC_12X12_KHR:0x93dd,COMPRESSED_RED_RGTC1_EXT:0x8dbb,COMPRESSED_SIGNED_RED_RGTC1_EXT:0x8dbc,COMPRESSED_RED_GREEN_RGTC2_EXT:0x8dbd,COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT:0x8dbe,COMPRESSED_SRGB_S3TC_DXT1_EXT:0x8c4c,COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT:0x8c4d,COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT:0x8c4e,COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT:0x8c4f};var BROWSER_PREFIXES=['','WEBKIT_','MOZ_'];var WEBGL_EXTENSIONS={WEBGL_compressed_texture_s3tc:'dxt',WEBGL_compressed_texture_s3tc_srgb:'dxt-srgb',WEBGL_compressed_texture_etc1:'etc1',WEBGL_compressed_texture_etc:'etc2',WEBGL_compressed_texture_pvrtc:'pvrtc',WEBGL_compressed_texture_atc:'atc',WEBGL_compressed_texture_astc:'astc',EXT_texture_compression_rgtc:'rgtc'};var formats=null;function getSupportedGPUTextureFormats(gl){if(!formats){gl=gl||getWebGLContext()||undefined;formats=new Set();var _iterator15=_createForOfIteratorHelper(BROWSER_PREFIXES),_step15;try{for(_iterator15.s();!(_step15=_iterator15.n()).done;){var prefix=_step15.value;for(var extension in WEBGL_EXTENSIONS){if(gl&&gl.getExtension("".concat(prefix).concat(extension))){var gpuTextureFormat=WEBGL_EXTENSIONS[extension];formats.add(gpuTextureFormat);}}}}catch(err){_iterator15.e(err);}finally{_iterator15.f();}}return formats;}function getWebGLContext(){try{var _canvas6=document.createElement('canvas');return _canvas6.getContext('webgl');}catch(error){return null;}}var n,i,s,a,r,o,l,f;!function(t){t[t.NONE=0]="NONE",t[t.BASISLZ=1]="BASISLZ",t[t.ZSTD=2]="ZSTD",t[t.ZLIB=3]="ZLIB";}(n||(n={})),function(t){t[t.BASICFORMAT=0]="BASICFORMAT";}(i||(i={})),function(t){t[t.UNSPECIFIED=0]="UNSPECIFIED",t[t.ETC1S=163]="ETC1S",t[t.UASTC=166]="UASTC";}(s||(s={})),function(t){t[t.UNSPECIFIED=0]="UNSPECIFIED",t[t.SRGB=1]="SRGB";}(a||(a={})),function(t){t[t.UNSPECIFIED=0]="UNSPECIFIED",t[t.LINEAR=1]="LINEAR",t[t.SRGB=2]="SRGB",t[t.ITU=3]="ITU",t[t.NTSC=4]="NTSC",t[t.SLOG=5]="SLOG",t[t.SLOG2=6]="SLOG2";}(r||(r={})),function(t){t[t.ALPHA_STRAIGHT=0]="ALPHA_STRAIGHT",t[t.ALPHA_PREMULTIPLIED=1]="ALPHA_PREMULTIPLIED";}(o||(o={})),function(t){t[t.RGB=0]="RGB",t[t.RRR=3]="RRR",t[t.GGG=4]="GGG",t[t.AAA=15]="AAA";}(l||(l={})),function(t){t[t.RGB=0]="RGB",t[t.RGBA=3]="RGBA",t[t.RRR=4]="RRR",t[t.RRRG=5]="RRRG";}(f||(f={}));var KTX2_ID=[0xab,0x4b,0x54,0x58,0x20,0x32,0x30,0xbb,0x0d,0x0a,0x1a,0x0a];function isKTX(data){var id=new Uint8Array(data);var notKTX=id.byteLength<KTX2_ID.length||id[0]!==KTX2_ID[0]||id[1]!==KTX2_ID[1]||id[2]!==KTX2_ID[2]||id[3]!==KTX2_ID[3]||id[4]!==KTX2_ID[4]||id[5]!==KTX2_ID[5]||id[6]!==KTX2_ID[6]||id[7]!==KTX2_ID[7]||id[8]!==KTX2_ID[8]||id[9]!==KTX2_ID[9]||id[10]!==KTX2_ID[10]||id[11]!==KTX2_ID[11];return!notKTX;}var OutputFormat={etc1:{basisFormat:0,compressed:true,format:GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGB_ETC1_WEBGL},etc2:{basisFormat:1,compressed:true},bc1:{basisFormat:2,compressed:true,format:GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGB_S3TC_DXT1_EXT},bc3:{basisFormat:3,compressed:true,format:GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_S3TC_DXT5_EXT},bc4:{basisFormat:4,compressed:true},bc5:{basisFormat:5,compressed:true},'bc7-m6-opaque-only':{basisFormat:6,compressed:true},'bc7-m5':{basisFormat:7,compressed:true},'pvrtc1-4-rgb':{basisFormat:8,compressed:true,format:GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGB_PVRTC_4BPPV1_IMG},'pvrtc1-4-rgba':{basisFormat:9,compressed:true,format:GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG},'astc-4x4':{basisFormat:10,compressed:true,format:GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_4X4_KHR},'atc-rgb':{basisFormat:11,compressed:true},'atc-rgba-interpolated-alpha':{basisFormat:12,compressed:true},rgba32:{basisFormat:13,compressed:false},rgb565:{basisFormat:14,compressed:false},bgr565:{basisFormat:15,compressed:false},rgba4444:{basisFormat:16,compressed:false}};function parseBasis(_x42,_x43){return _parseBasis.apply(this,arguments);}function _parseBasis(){_parseBasis=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee28(data,options){var fileConstructors,_yield$loadBasisTrasc,BasisFile,_fileConstructors,_yield$loadBasisTrasc2,_BasisFile;return _regeneratorRuntime().wrap(function _callee28$(_context31){while(1)switch(_context31.prev=_context31.next){case 0:if(!(options.basis.containerFormat==='auto')){_context31.next=11;break;}if(!isKTX(data)){_context31.next=6;break;}_context31.next=4;return loadBasisEncoderModule(options);case 4:fileConstructors=_context31.sent;return _context31.abrupt("return",parseKTX2File(fileConstructors.KTX2File,data,options));case 6:_context31.next=8;return loadBasisTrascoderModule(options);case 8:_yield$loadBasisTrasc=_context31.sent;BasisFile=_yield$loadBasisTrasc.BasisFile;return _context31.abrupt("return",parseBasisFile(BasisFile,data,options));case 11:_context31.t0=options.basis.module;_context31.next=_context31.t0==='encoder'?14:_context31.t0==='transcoder'?22:22;break;case 14:_context31.next=16;return loadBasisEncoderModule(options);case 16:_fileConstructors=_context31.sent;_context31.t1=options.basis.containerFormat;_context31.next=_context31.t1==='ktx2'?20:_context31.t1==='basis'?21:21;break;case 20:return _context31.abrupt("return",parseKTX2File(_fileConstructors.KTX2File,data,options));case 21:return _context31.abrupt("return",parseBasisFile(_fileConstructors.BasisFile,data,options));case 22:_context31.next=24;return loadBasisTrascoderModule(options);case 24:_yield$loadBasisTrasc2=_context31.sent;_BasisFile=_yield$loadBasisTrasc2.BasisFile;return _context31.abrupt("return",parseBasisFile(_BasisFile,data,options));case 27:case"end":return _context31.stop();}},_callee28);}));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"]();}}function transcodeImage(basisFile,imageIndex,levelIndex,options){var width=basisFile.getImageWidth(imageIndex,levelIndex);var height=basisFile.getImageHeight(imageIndex,levelIndex);var hasAlpha=basisFile.getHasAlpha();var _getBasisOptions=getBasisOptions(options,hasAlpha),compressed=_getBasisOptions.compressed,format=_getBasisOptions.format,basisFormat=_getBasisOptions.basisFormat;var decodedSize=basisFile.getImageTranscodedSizeInBytes(imageIndex,levelIndex,basisFormat);var decodedData=new Uint8Array(decodedSize);if(!basisFile.transcodeImage(decodedData,imageIndex,levelIndex,basisFormat,0,0)){throw new Error('failed to start Basis transcoding');}return{width:width,height:height,data:decodedData,compressed:compressed,format:format,hasAlpha:hasAlpha};}function parseKTX2File(KTX2File,data,options){var ktx2File=new KTX2File(new Uint8Array(data));try{if(!ktx2File.startTranscoding()){throw new Error('failed to start KTX2 transcoding');}var levelsCount=ktx2File.getLevels();var levels=[];for(var levelIndex=0;levelIndex<levelsCount;levelIndex++){levels.push(transcodeKTX2Image(ktx2File,levelIndex,options));break;}return[levels];}finally{ktx2File.close();ktx2File["delete"]();}}function transcodeKTX2Image(ktx2File,levelIndex,options){var _ktx2File$getImageLev=ktx2File.getImageLevelInfo(levelIndex,0,0),alphaFlag=_ktx2File$getImageLev.alphaFlag,height=_ktx2File$getImageLev.height,width=_ktx2File$getImageLev.width;var _getBasisOptions2=getBasisOptions(options,alphaFlag),compressed=_getBasisOptions2.compressed,format=_getBasisOptions2.format,basisFormat=_getBasisOptions2.basisFormat;var decodedSize=ktx2File.getImageTranscodedSizeInBytes(levelIndex,0,0,basisFormat);var decodedData=new Uint8Array(decodedSize);if(!ktx2File.transcodeImage(decodedData,levelIndex,0,0,basisFormat,0,-1,-1)){throw new Error('Failed to transcode KTX2 image');}return{width:width,height:height,data:decodedData,compressed:compressed,levelSize:decodedSize,hasAlpha:alphaFlag,format:format};}function getBasisOptions(options,hasAlpha){var format=options&&options.basis&&options.basis.format;if(format==='auto'){format=selectSupportedBasisFormat();}if(_typeof2(format)==='object'){format=hasAlpha?format.alpha:format.noAlpha;}format=format.toLowerCase();return OutputFormat[format];}function selectSupportedBasisFormat(){var supportedFormats=getSupportedGPUTextureFormats();if(supportedFormats.has('astc')){return'astc-4x4';}else if(supportedFormats.has('dxt')){return{alpha:'bc3',noAlpha:'bc1'};}else if(supportedFormats.has('pvrtc')){return{alpha:'pvrtc1-4-rgba',noAlpha:'pvrtc1-4-rgb'};}else if(supportedFormats.has('etc1')){return'etc1';}else if(supportedFormats.has('etc2')){return'etc2';}return'rgb565';}var BasisWorkerLoader={name:'Basis',id:isBrowser$2?'basis':'basis-nodejs',module:'textures',version:VERSION$5,worker:true,extensions:['basis','ktx2'],mimeTypes:['application/octet-stream','image/ktx2'],tests:['sB'],binary:true,options:{basis:{format:'auto',libraryPath:'libs/',containerFormat:'auto',module:'transcoder'}}};var BasisLoader=_objectSpread(_objectSpread({},BasisWorkerLoader),{},{parse:parseBasis});var VERSION$3="3.4.15";function assert$5(condition,message){if(!condition){throw new Error(message||'loader assertion failed.');}}var isBrowser$1=Boolean((typeof process==="undefined"?"undefined":_typeof2(process))!=='object'||String(process)!=='[object process]'||process.browser);var matches$1=typeof process!=='undefined'&&process.version&&/v([0-9]*)/.exec(process.version);matches$1&&parseFloat(matches$1[1])||0;var _parseImageNode=globalThis._parseImageNode;var IMAGE_SUPPORTED=typeof Image!=='undefined';var IMAGE_BITMAP_SUPPORTED=typeof ImageBitmap!=='undefined';var NODE_IMAGE_SUPPORTED=Boolean(_parseImageNode);var DATA_SUPPORTED=isBrowser$1?true:NODE_IMAGE_SUPPORTED;function isImageTypeSupported(type){switch(type){case'auto':return IMAGE_BITMAP_SUPPORTED||IMAGE_SUPPORTED||DATA_SUPPORTED;case'imagebitmap':return IMAGE_BITMAP_SUPPORTED;case'image':return IMAGE_SUPPORTED;case'data':return DATA_SUPPORTED;default:throw new Error("@loaders.gl/images: image ".concat(type," not supported in this environment"));}}function getDefaultImageType(){if(IMAGE_BITMAP_SUPPORTED){return'imagebitmap';}if(IMAGE_SUPPORTED){return'image';}if(DATA_SUPPORTED){return'data';}throw new Error('Install \'@loaders.gl/polyfills\' to parse images under Node.js');}function getImageType(image){var format=getImageTypeOrNull(image);if(!format){throw new Error('Not an image');}return format;}function getImageData(image){switch(getImageType(image)){case'data':return image;case'image':case'imagebitmap':var _canvas7=document.createElement('canvas');var context=_canvas7.getContext('2d');if(!context){throw new Error('getImageData');}_canvas7.width=image.width;_canvas7.height=image.height;context.drawImage(image,0,0);return context.getImageData(0,0,image.width,image.height);default:throw new Error('getImageData');}}function getImageTypeOrNull(image){if(typeof ImageBitmap!=='undefined'&&image instanceof ImageBitmap){return'imagebitmap';}if(typeof Image!=='undefined'&&image instanceof Image){return'image';}if(image&&_typeof2(image)==='object'&&image.data&&image.width&&image.height){return'data';}return null;}var SVG_DATA_URL_PATTERN=/^data:image\/svg\+xml/;var SVG_URL_PATTERN=/\.svg((\?|#).*)?$/;function isSVG(url){return url&&(SVG_DATA_URL_PATTERN.test(url)||SVG_URL_PATTERN.test(url));}function getBlobOrSVGDataUrl(arrayBuffer,url){if(isSVG(url)){var textDecoder=new TextDecoder();var xmlText=textDecoder.decode(arrayBuffer);try{if(typeof unescape==='function'&&typeof encodeURIComponent==='function'){xmlText=unescape(encodeURIComponent(xmlText));}}catch(error){throw new Error(error.message);}var src="data:image/svg+xml;base64,".concat(btoa(xmlText));return src;}return getBlob(arrayBuffer,url);}function getBlob(arrayBuffer,url){if(isSVG(url)){throw new Error('SVG cannot be parsed directly to imagebitmap');}return new Blob([new Uint8Array(arrayBuffer)]);}function parseToImage(_x44,_x45,_x46){return _parseToImage.apply(this,arguments);}function _parseToImage(){_parseToImage=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee29(arrayBuffer,options,url){var blobOrDataUrl,URL,objectUrl;return _regeneratorRuntime().wrap(function _callee29$(_context32){while(1)switch(_context32.prev=_context32.next){case 0:blobOrDataUrl=getBlobOrSVGDataUrl(arrayBuffer,url);URL=self.URL||self.webkitURL;objectUrl=typeof blobOrDataUrl!=='string'&&URL.createObjectURL(blobOrDataUrl);_context32.prev=3;_context32.next=6;return loadToImage(objectUrl||blobOrDataUrl,options);case 6:return _context32.abrupt("return",_context32.sent);case 7:_context32.prev=7;if(objectUrl){URL.revokeObjectURL(objectUrl);}return _context32.finish(7);case 10:case"end":return _context32.stop();}},_callee29,null,[[3,,7,10]]);}));return _parseToImage.apply(this,arguments);}function loadToImage(_x47,_x48){return _loadToImage.apply(this,arguments);}function _loadToImage(){_loadToImage=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee30(url,options){var image;return _regeneratorRuntime().wrap(function _callee30$(_context33){while(1)switch(_context33.prev=_context33.next){case 0:image=new Image();image.src=url;if(!(options.image&&options.image.decode&&image.decode)){_context33.next=6;break;}_context33.next=5;return image.decode();case 5:return _context33.abrupt("return",image);case 6:_context33.next=8;return new Promise(function(resolve,reject){try{image.onload=function(){return resolve(image);};image.onerror=function(err){return reject(new Error("Could not load image ".concat(url,": ").concat(err)));};}catch(error){reject(error);}});case 8:return _context33.abrupt("return",_context33.sent);case 9:case"end":return _context33.stop();}},_callee30);}));return _loadToImage.apply(this,arguments);}var EMPTY_OBJECT={};var imagebitmapOptionsSupported=true;function parseToImageBitmap(_x49,_x50,_x51){return _parseToImageBitmap.apply(this,arguments);}function _parseToImageBitmap(){_parseToImageBitmap=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee31(arrayBuffer,options,url){var blob,_image7,imagebitmapOptions;return _regeneratorRuntime().wrap(function _callee31$(_context34){while(1)switch(_context34.prev=_context34.next){case 0:if(!isSVG(url)){_context34.next=7;break;}_context34.next=3;return parseToImage(arrayBuffer,options,url);case 3:_image7=_context34.sent;blob=_image7;_context34.next=8;break;case 7:blob=getBlob(arrayBuffer,url);case 8:imagebitmapOptions=options&&options.imagebitmap;_context34.next=11;return safeCreateImageBitmap(blob,imagebitmapOptions);case 11:return _context34.abrupt("return",_context34.sent);case 12:case"end":return _context34.stop();}},_callee31);}));return _parseToImageBitmap.apply(this,arguments);}function safeCreateImageBitmap(_x52){return _safeCreateImageBitmap.apply(this,arguments);}function _safeCreateImageBitmap(){_safeCreateImageBitmap=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee32(blob){var imagebitmapOptions,_args28=arguments;return _regeneratorRuntime().wrap(function _callee32$(_context35){while(1)switch(_context35.prev=_context35.next){case 0:imagebitmapOptions=_args28.length>1&&_args28[1]!==undefined?_args28[1]:null;if(isEmptyObject(imagebitmapOptions)||!imagebitmapOptionsSupported){imagebitmapOptions=null;}if(!imagebitmapOptions){_context35.next=13;break;}_context35.prev=3;_context35.next=6;return createImageBitmap(blob,imagebitmapOptions);case 6:return _context35.abrupt("return",_context35.sent);case 9:_context35.prev=9;_context35.t0=_context35["catch"](3);console.warn(_context35.t0);imagebitmapOptionsSupported=false;case 13:_context35.next=15;return createImageBitmap(blob);case 15:return _context35.abrupt("return",_context35.sent);case 16:case"end":return _context35.stop();}},_callee32,null,[[3,9]]);}));return _safeCreateImageBitmap.apply(this,arguments);}function isEmptyObject(object){for(var key in object||EMPTY_OBJECT){return false;}return true;}function getISOBMFFMediaType(buffer){if(!checkString(buffer,'ftyp',4)){return null;}if((buffer[8]&0x60)===0x00){return null;}return decodeMajorBrand(buffer);}function decodeMajorBrand(buffer){var brandMajor=getUTF8String(buffer,8,12).replace('\0',' ').trim();switch(brandMajor){case'avif':case'avis':return{extension:'avif',mimeType:'image/avif'};default:return null;}}function getUTF8String(array,start,end){return String.fromCharCode.apply(String,_toConsumableArray(array.slice(start,end)));}function stringToBytes(string){return _toConsumableArray(string).map(function(character){return character.charCodeAt(0);});}function checkString(buffer,header){var offset=arguments.length>2&&arguments[2]!==undefined?arguments[2]:0;var headerBytes=stringToBytes(header);for(var _i509=0;_i509<headerBytes.length;++_i509){if(headerBytes[_i509]!==buffer[_i509+offset]){return false;}}return true;}var BIG_ENDIAN=false;var LITTLE_ENDIAN=true;function getBinaryImageMetadata(binaryData){var dataView=toDataView(binaryData);return getPngMetadata(dataView)||getJpegMetadata(dataView)||getGifMetadata(dataView)||getBmpMetadata(dataView)||getISOBMFFMetadata(dataView);}function getISOBMFFMetadata(binaryData){var buffer=new Uint8Array(binaryData instanceof DataView?binaryData.buffer:binaryData);var mediaType=getISOBMFFMediaType(buffer);if(!mediaType){return null;}return{mimeType:mediaType.mimeType,width:0,height:0};}function getPngMetadata(binaryData){var dataView=toDataView(binaryData);var isPng=dataView.byteLength>=24&&dataView.getUint32(0,BIG_ENDIAN)===0x89504e47;if(!isPng){return null;}return{mimeType:'image/png',width:dataView.getUint32(16,BIG_ENDIAN),height:dataView.getUint32(20,BIG_ENDIAN)};}function getGifMetadata(binaryData){var dataView=toDataView(binaryData);var isGif=dataView.byteLength>=10&&dataView.getUint32(0,BIG_ENDIAN)===0x47494638;if(!isGif){return null;}return{mimeType:'image/gif',width:dataView.getUint16(6,LITTLE_ENDIAN),height:dataView.getUint16(8,LITTLE_ENDIAN)};}function getBmpMetadata(binaryData){var dataView=toDataView(binaryData);var isBmp=dataView.byteLength>=14&&dataView.getUint16(0,BIG_ENDIAN)===0x424d&&dataView.getUint32(2,LITTLE_ENDIAN)===dataView.byteLength;if(!isBmp){return null;}return{mimeType:'image/bmp',width:dataView.getUint32(18,LITTLE_ENDIAN),height:dataView.getUint32(22,LITTLE_ENDIAN)};}function getJpegMetadata(binaryData){var dataView=toDataView(binaryData);var isJpeg=dataView.byteLength>=3&&dataView.getUint16(0,BIG_ENDIAN)===0xffd8&&dataView.getUint8(2)===0xff;if(!isJpeg){return null;}var _getJpegMarkers=getJpegMarkers(),tableMarkers=_getJpegMarkers.tableMarkers,sofMarkers=_getJpegMarkers.sofMarkers;var i=2;while(i+9<dataView.byteLength){var marker=dataView.getUint16(i,BIG_ENDIAN);if(sofMarkers.has(marker)){return{mimeType:'image/jpeg',height:dataView.getUint16(i+5,BIG_ENDIAN),width:dataView.getUint16(i+7,BIG_ENDIAN)};}if(!tableMarkers.has(marker)){return null;}i+=2;i+=dataView.getUint16(i,BIG_ENDIAN);}return null;}function getJpegMarkers(){var tableMarkers=new Set([0xffdb,0xffc4,0xffcc,0xffdd,0xfffe]);for(var _i510=0xffe0;_i510<0xfff0;++_i510){tableMarkers.add(_i510);}var sofMarkers=new Set([0xffc0,0xffc1,0xffc2,0xffc3,0xffc5,0xffc6,0xffc7,0xffc9,0xffca,0xffcb,0xffcd,0xffce,0xffcf,0xffde]);return{tableMarkers:tableMarkers,sofMarkers:sofMarkers};}function toDataView(data){if(data instanceof DataView){return data;}if(ArrayBuffer.isView(data)){return new DataView(data.buffer);}if(data instanceof ArrayBuffer){return new DataView(data);}throw new Error('toDataView');}function parseToNodeImage(_x53,_x54){return _parseToNodeImage.apply(this,arguments);}function _parseToNodeImage(){_parseToNodeImage=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee33(arrayBuffer,options){var _ref23,mimeType,_parseImageNode;return _regeneratorRuntime().wrap(function _callee33$(_context36){while(1)switch(_context36.prev=_context36.next){case 0:_ref23=getBinaryImageMetadata(arrayBuffer)||{},mimeType=_ref23.mimeType;_parseImageNode=globalThis._parseImageNode;assert$5(_parseImageNode);_context36.next=5;return _parseImageNode(arrayBuffer,mimeType);case 5:return _context36.abrupt("return",_context36.sent);case 6:case"end":return _context36.stop();}},_callee33);}));return _parseToNodeImage.apply(this,arguments);}function parseImage(_x55,_x56,_x57){return _parseImage.apply(this,arguments);}function _parseImage(){_parseImage=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee34(arrayBuffer,options,context){var imageOptions,imageType,_ref24,url,loadType,image;return _regeneratorRuntime().wrap(function _callee34$(_context37){while(1)switch(_context37.prev=_context37.next){case 0:options=options||{};imageOptions=options.image||{};imageType=imageOptions.type||'auto';_ref24=context||{},url=_ref24.url;loadType=getLoadableImageType(imageType);_context37.t0=loadType;_context37.next=_context37.t0==='imagebitmap'?8:_context37.t0==='image'?12:_context37.t0==='data'?16:20;break;case 8:_context37.next=10;return parseToImageBitmap(arrayBuffer,options,url);case 10:image=_context37.sent;return _context37.abrupt("break",21);case 12:_context37.next=14;return parseToImage(arrayBuffer,options,url);case 14:image=_context37.sent;return _context37.abrupt("break",21);case 16:_context37.next=18;return parseToNodeImage(arrayBuffer);case 18:image=_context37.sent;return _context37.abrupt("break",21);case 20:assert$5(false);case 21:if(imageType==='data'){image=getImageData(image);}return _context37.abrupt("return",image);case 23:case"end":return _context37.stop();}},_callee34);}));return _parseImage.apply(this,arguments);}function getLoadableImageType(type){switch(type){case'auto':case'data':return getDefaultImageType();default:isImageTypeSupported(type);return type;}}var EXTENSIONS$1=['png','jpg','jpeg','gif','webp','bmp','ico','svg','avif'];var MIME_TYPES=['image/png','image/jpeg','image/gif','image/webp','image/avif','image/bmp','image/vnd.microsoft.icon','image/svg+xml'];var DEFAULT_IMAGE_LOADER_OPTIONS={image:{type:'auto',decode:true}};var ImageLoader={id:'image',module:'images',name:'Images',version:VERSION$3,mimeTypes:MIME_TYPES,extensions:EXTENSIONS$1,parse:parseImage,tests:[function(arrayBuffer){return Boolean(getBinaryImageMetadata(new DataView(arrayBuffer)));}],options:DEFAULT_IMAGE_LOADER_OPTIONS};var mimeTypeSupportedSync={};function isImageFormatSupported(mimeType){if(mimeTypeSupportedSync[mimeType]===undefined){var supported=isBrowser$1?checkBrowserImageFormatSupport(mimeType):checkNodeImageFormatSupport(mimeType);mimeTypeSupportedSync[mimeType]=supported;}return mimeTypeSupportedSync[mimeType];}function checkNodeImageFormatSupport(mimeType){var NODE_FORMAT_SUPPORT=['image/png','image/jpeg','image/gif'];var _parseImageNode=globalThis._parseImageNode,_globalThis$_imageFor=globalThis._imageFormatsNode,_imageFormatsNode=_globalThis$_imageFor===void 0?NODE_FORMAT_SUPPORT:_globalThis$_imageFor;return Boolean(_parseImageNode)&&_imageFormatsNode.includes(mimeType);}function checkBrowserImageFormatSupport(mimeType){switch(mimeType){case'image/avif':case'image/webp':return testBrowserImageFormatSupport(mimeType);default:return true;}}function testBrowserImageFormatSupport(mimeType){try{var element=document.createElement('canvas');var dataURL=element.toDataURL(mimeType);return dataURL.indexOf("data:".concat(mimeType))===0;}catch(_unused){return false;}}function assert$4(condition,message){if(!condition){throw new Error(message||'loader assertion failed.');}}function getFirstCharacters(data){var length=arguments.length>1&&arguments[1]!==undefined?arguments[1]:5;if(typeof data==='string'){return data.slice(0,length);}else if(ArrayBuffer.isView(data)){return getMagicString$1(data.buffer,data.byteOffset,length);}else if(data instanceof ArrayBuffer){var byteOffset=0;return getMagicString$1(data,byteOffset,length);}return'';}function getMagicString$1(arrayBuffer,byteOffset,length){if(arrayBuffer.byteLength<=byteOffset+length){return'';}var dataView=new DataView(arrayBuffer);var magic='';for(var _i511=0;_i511<length;_i511++){magic+=String.fromCharCode(dataView.getUint8(byteOffset+_i511));}return magic;}function parseJSON(string){try{return JSON.parse(string);}catch(_){throw new Error("Failed to parse JSON from data starting with \"".concat(getFirstCharacters(string),"\""));}}function sliceArrayBuffer(arrayBuffer,byteOffset,byteLength){var subArray=byteLength!==undefined?new Uint8Array(arrayBuffer).subarray(byteOffset,byteOffset+byteLength):new Uint8Array(arrayBuffer).subarray(byteOffset);var arrayCopy=new Uint8Array(subArray);return arrayCopy.buffer;}function padToNBytes(byteLength,padding){assert$4(byteLength>=0);assert$4(padding>0);return byteLength+(padding-1)&~(padding-1);}function copyToArray(source,target,targetOffset){var sourceArray;if(source instanceof ArrayBuffer){sourceArray=new Uint8Array(source);}else{var srcByteOffset=source.byteOffset;var srcByteLength=source.byteLength;sourceArray=new Uint8Array(source.buffer||source.arrayBuffer,srcByteOffset,srcByteLength);}target.set(sourceArray,targetOffset);return targetOffset+padToNBytes(sourceArray.byteLength,4);}function assert$3(condition,message){if(!condition){throw new Error(message||'assert failed: gltf');}}function resolveUrl(url,options){var absolute=url.startsWith('data:')||url.startsWith('http:')||url.startsWith('https:');if(absolute){return url;}var baseUrl=options.baseUri||options.uri;if(!baseUrl){throw new Error("'baseUri' must be provided to resolve relative url ".concat(url));}return baseUrl.substr(0,baseUrl.lastIndexOf('/')+1)+url;}function getTypedArrayForBufferView(json,buffers,bufferViewIndex){var bufferView=json.bufferViews[bufferViewIndex];assert$3(bufferView);var bufferIndex=bufferView.buffer;var binChunk=buffers[bufferIndex];assert$3(binChunk);var byteOffset=(bufferView.byteOffset||0)+binChunk.byteOffset;return new Uint8Array(binChunk.arrayBuffer,byteOffset,bufferView.byteLength);}var TYPES=['SCALAR','VEC2','VEC3','VEC4'];var ARRAY_CONSTRUCTOR_TO_WEBGL_CONSTANT=[[Int8Array,5120],[Uint8Array,5121],[Int16Array,5122],[Uint16Array,5123],[Uint32Array,5125],[Float32Array,5126],[Float64Array,5130]];var ARRAY_TO_COMPONENT_TYPE=new Map(ARRAY_CONSTRUCTOR_TO_WEBGL_CONSTANT);var ATTRIBUTE_TYPE_TO_COMPONENTS={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16};var ATTRIBUTE_COMPONENT_TYPE_TO_BYTE_SIZE={5120:1,5121:1,5122:2,5123:2,5125:4,5126:4};var ATTRIBUTE_COMPONENT_TYPE_TO_ARRAY={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array};function getAccessorTypeFromSize(size){var type=TYPES[size-1];return type||TYPES[0];}function getComponentTypeFromArray(typedArray){var componentType=ARRAY_TO_COMPONENT_TYPE.get(typedArray.constructor);if(!componentType){throw new Error('Illegal typed array');}return componentType;}function getAccessorArrayTypeAndLength(accessor,bufferView){var ArrayType=ATTRIBUTE_COMPONENT_TYPE_TO_ARRAY[accessor.componentType];var components=ATTRIBUTE_TYPE_TO_COMPONENTS[accessor.type];var bytesPerComponent=ATTRIBUTE_COMPONENT_TYPE_TO_BYTE_SIZE[accessor.componentType];var length=accessor.count*components;var byteLength=accessor.count*components*bytesPerComponent;assert$3(byteLength>=0&&byteLength<=bufferView.byteLength);return{ArrayType:ArrayType,length:length,byteLength:byteLength};}var DEFAULT_GLTF_JSON={asset:{version:'2.0',generator:'loaders.gl'},buffers:[]};var GLTFScenegraph=/*#__PURE__*/function(){function GLTFScenegraph(gltf){_classCallCheck(this,GLTFScenegraph);_defineProperty(this,"gltf",void 0);_defineProperty(this,"sourceBuffers",void 0);_defineProperty(this,"byteLength",void 0);this.gltf=gltf||{json:_objectSpread({},DEFAULT_GLTF_JSON),buffers:[]};this.sourceBuffers=[];this.byteLength=0;if(this.gltf.buffers&&this.gltf.buffers[0]){this.byteLength=this.gltf.buffers[0].byteLength;this.sourceBuffers=[this.gltf.buffers[0]];}}return _createClass(GLTFScenegraph,[{key:"json",get:function get(){return this.gltf.json;}},{key:"getApplicationData",value:function getApplicationData(key){var data=this.json[key];return data;}},{key:"getExtraData",value:function getExtraData(key){var extras=this.json.extras||{};return extras[key];}},{key:"getExtension",value:function getExtension(extensionName){var isExtension=this.getUsedExtensions().find(function(name){return name===extensionName;});var extensions=this.json.extensions||{};return isExtension?extensions[extensionName]||true:null;}},{key:"getRequiredExtension",value:function getRequiredExtension(extensionName){var isRequired=this.getRequiredExtensions().find(function(name){return name===extensionName;});return isRequired?this.getExtension(extensionName):null;}},{key:"getRequiredExtensions",value:function getRequiredExtensions(){return this.json.extensionsRequired||[];}},{key:"getUsedExtensions",value:function getUsedExtensions(){return this.json.extensionsUsed||[];}},{key:"getRemovedExtensions",value:function getRemovedExtensions(){return this.json.extensionsRemoved||[];}},{key:"getObjectExtension",value:function getObjectExtension(object,extensionName){var extensions=object.extensions||{};return extensions[extensionName];}},{key:"getScene",value:function getScene(index){return this.getObject('scenes',index);}},{key:"getNode",value:function getNode(index){return this.getObject('nodes',index);}},{key:"getSkin",value:function getSkin(index){return this.getObject('skins',index);}},{key:"getMesh",value:function getMesh(index){return this.getObject('meshes',index);}},{key:"getMaterial",value:function getMaterial(index){return this.getObject('materials',index);}},{key:"getAccessor",value:function getAccessor(index){return this.getObject('accessors',index);}},{key:"getTexture",value:function getTexture(index){return this.getObject('textures',index);}},{key:"getSampler",value:function getSampler(index){return this.getObject('samplers',index);}},{key:"getImage",value:function getImage(index){return this.getObject('images',index);}},{key:"getBufferView",value:function getBufferView(index){return this.getObject('bufferViews',index);}},{key:"getBuffer",value:function getBuffer(index){return this.getObject('buffers',index);}},{key:"getObject",value:function getObject(array,index){if(_typeof2(index)==='object'){return index;}var object=this.json[array]&&this.json[array][index];if(!object){throw new Error("glTF file error: Could not find ".concat(array,"[").concat(index,"]"));}return object;}},{key:"getTypedArrayForBufferView",value:function getTypedArrayForBufferView(bufferView){bufferView=this.getBufferView(bufferView);var bufferIndex=bufferView.buffer;var binChunk=this.gltf.buffers[bufferIndex];assert$3(binChunk);var byteOffset=(bufferView.byteOffset||0)+binChunk.byteOffset;return new Uint8Array(binChunk.arrayBuffer,byteOffset,bufferView.byteLength);}},{key:"getTypedArrayForAccessor",value:function getTypedArrayForAccessor(accessor){accessor=this.getAccessor(accessor);var bufferView=this.getBufferView(accessor.bufferView);var buffer=this.getBuffer(bufferView.buffer);var arrayBuffer=buffer.data;var _getAccessorArrayType=getAccessorArrayTypeAndLength(accessor,bufferView),ArrayType=_getAccessorArrayType.ArrayType,length=_getAccessorArrayType.length;var byteOffset=bufferView.byteOffset+accessor.byteOffset;return new ArrayType(arrayBuffer,byteOffset,length);}},{key:"getTypedArrayForImageData",value:function getTypedArrayForImageData(image){image=this.getAccessor(image);var bufferView=this.getBufferView(image.bufferView);var buffer=this.getBuffer(bufferView.buffer);var arrayBuffer=buffer.data;var byteOffset=bufferView.byteOffset||0;return new Uint8Array(arrayBuffer,byteOffset,bufferView.byteLength);}},{key:"addApplicationData",value:function addApplicationData(key,data){this.json[key]=data;return this;}},{key:"addExtraData",value:function addExtraData(key,data){this.json.extras=this.json.extras||{};this.json.extras[key]=data;return this;}},{key:"addObjectExtension",value:function addObjectExtension(object,extensionName,data){object.extensions=object.extensions||{};object.extensions[extensionName]=data;this.registerUsedExtension(extensionName);return this;}},{key:"setObjectExtension",value:function setObjectExtension(object,extensionName,data){var extensions=object.extensions||{};extensions[extensionName]=data;}},{key:"removeObjectExtension",value:function removeObjectExtension(object,extensionName){var extensions=object.extensions||{};var extension=extensions[extensionName];delete extensions[extensionName];return extension;}},{key:"addExtension",value:function addExtension(extensionName){var extensionData=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};assert$3(extensionData);this.json.extensions=this.json.extensions||{};this.json.extensions[extensionName]=extensionData;this.registerUsedExtension(extensionName);return extensionData;}},{key:"addRequiredExtension",value:function addRequiredExtension(extensionName){var extensionData=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};assert$3(extensionData);this.addExtension(extensionName,extensionData);this.registerRequiredExtension(extensionName);return extensionData;}},{key:"registerUsedExtension",value:function registerUsedExtension(extensionName){this.json.extensionsUsed=this.json.extensionsUsed||[];if(!this.json.extensionsUsed.find(function(ext){return ext===extensionName;})){this.json.extensionsUsed.push(extensionName);}}},{key:"registerRequiredExtension",value:function registerRequiredExtension(extensionName){this.registerUsedExtension(extensionName);this.json.extensionsRequired=this.json.extensionsRequired||[];if(!this.json.extensionsRequired.find(function(ext){return ext===extensionName;})){this.json.extensionsRequired.push(extensionName);}}},{key:"removeExtension",value:function removeExtension(extensionName){if(!this.getExtension(extensionName)){return;}if(this.json.extensionsRequired){this._removeStringFromArray(this.json.extensionsRequired,extensionName);}if(this.json.extensionsUsed){this._removeStringFromArray(this.json.extensionsUsed,extensionName);}if(this.json.extensions){delete this.json.extensions[extensionName];}if(!Array.isArray(this.json.extensionsRemoved)){this.json.extensionsRemoved=[];}var extensionsRemoved=this.json.extensionsRemoved;if(!extensionsRemoved.includes(extensionName)){extensionsRemoved.push(extensionName);}}},{key:"setDefaultScene",value:function setDefaultScene(sceneIndex){this.json.scene=sceneIndex;}},{key:"addScene",value:function addScene(scene){var nodeIndices=scene.nodeIndices;this.json.scenes=this.json.scenes||[];this.json.scenes.push({nodes:nodeIndices});return this.json.scenes.length-1;}},{key:"addNode",value:function addNode(node){var meshIndex=node.meshIndex,matrix=node.matrix;this.json.nodes=this.json.nodes||[];var nodeData={mesh:meshIndex};if(matrix){nodeData.matrix=matrix;}this.json.nodes.push(nodeData);return this.json.nodes.length-1;}},{key:"addMesh",value:function addMesh(mesh){var attributes=mesh.attributes,indices=mesh.indices,material=mesh.material,_mesh$mode=mesh.mode,mode=_mesh$mode===void 0?4:_mesh$mode;var accessors=this._addAttributes(attributes);var glTFMesh={primitives:[{attributes:accessors,mode:mode}]};if(indices){var indicesAccessor=this._addIndices(indices);glTFMesh.primitives[0].indices=indicesAccessor;}if(Number.isFinite(material)){glTFMesh.primitives[0].material=material;}this.json.meshes=this.json.meshes||[];this.json.meshes.push(glTFMesh);return this.json.meshes.length-1;}},{key:"addPointCloud",value:function addPointCloud(attributes){var accessorIndices=this._addAttributes(attributes);var glTFMesh={primitives:[{attributes:accessorIndices,mode:0}]};this.json.meshes=this.json.meshes||[];this.json.meshes.push(glTFMesh);return this.json.meshes.length-1;}},{key:"addImage",value:function addImage(imageData,mimeTypeOpt){var metadata=getBinaryImageMetadata(imageData);var mimeType=mimeTypeOpt||(metadata===null||metadata===void 0?void 0:metadata.mimeType);var bufferViewIndex=this.addBufferView(imageData);var glTFImage={bufferView:bufferViewIndex,mimeType:mimeType};this.json.images=this.json.images||[];this.json.images.push(glTFImage);return this.json.images.length-1;}},{key:"addBufferView",value:function addBufferView(buffer){var byteLength=buffer.byteLength;assert$3(Number.isFinite(byteLength));this.sourceBuffers=this.sourceBuffers||[];this.sourceBuffers.push(buffer);var glTFBufferView={buffer:0,byteOffset:this.byteLength,byteLength:byteLength};this.byteLength+=padToNBytes(byteLength,4);this.json.bufferViews=this.json.bufferViews||[];this.json.bufferViews.push(glTFBufferView);return this.json.bufferViews.length-1;}},{key:"addAccessor",value:function addAccessor(bufferViewIndex,accessor){var glTFAccessor={bufferView:bufferViewIndex,type:getAccessorTypeFromSize(accessor.size),componentType:accessor.componentType,count:accessor.count,max:accessor.max,min:accessor.min};this.json.accessors=this.json.accessors||[];this.json.accessors.push(glTFAccessor);return this.json.accessors.length-1;}},{key:"addBinaryBuffer",value:function addBinaryBuffer(sourceBuffer){var accessor=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{size:3};var bufferViewIndex=this.addBufferView(sourceBuffer);var minMax={min:accessor.min,max:accessor.max};if(!minMax.min||!minMax.max){minMax=this._getAccessorMinMax(sourceBuffer,accessor.size);}var accessorDefaults={size:accessor.size,componentType:getComponentTypeFromArray(sourceBuffer),count:Math.round(sourceBuffer.length/accessor.size),min:minMax.min,max:minMax.max};return this.addAccessor(bufferViewIndex,Object.assign(accessorDefaults,accessor));}},{key:"addTexture",value:function addTexture(texture){var imageIndex=texture.imageIndex;var glTFTexture={source:imageIndex};this.json.textures=this.json.textures||[];this.json.textures.push(glTFTexture);return this.json.textures.length-1;}},{key:"addMaterial",value:function addMaterial(pbrMaterialInfo){this.json.materials=this.json.materials||[];this.json.materials.push(pbrMaterialInfo);return this.json.materials.length-1;}},{key:"createBinaryChunk",value:function createBinaryChunk(){var _this$json,_this$json$buffers;this.gltf.buffers=[];var totalByteLength=this.byteLength;var arrayBuffer=new ArrayBuffer(totalByteLength);var targetArray=new Uint8Array(arrayBuffer);var dstByteOffset=0;var _iterator16=_createForOfIteratorHelper(this.sourceBuffers||[]),_step16;try{for(_iterator16.s();!(_step16=_iterator16.n()).done;){var sourceBuffer=_step16.value;dstByteOffset=copyToArray(sourceBuffer,targetArray,dstByteOffset);}}catch(err){_iterator16.e(err);}finally{_iterator16.f();}if((_this$json=this.json)!==null&&_this$json!==void 0&&(_this$json$buffers=_this$json.buffers)!==null&&_this$json$buffers!==void 0&&_this$json$buffers[0]){this.json.buffers[0].byteLength=totalByteLength;}else{this.json.buffers=[{byteLength:totalByteLength}];}this.gltf.binary=arrayBuffer;this.sourceBuffers=[arrayBuffer];}},{key:"_removeStringFromArray",value:function _removeStringFromArray(array,string){var found=true;while(found){var index=array.indexOf(string);if(index>-1){array.splice(index,1);}else{found=false;}}}},{key:"_addAttributes",value:function _addAttributes(){var attributes=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};var result={};for(var attributeKey in attributes){var attributeData=attributes[attributeKey];var attrName=this._getGltfAttributeName(attributeKey);var accessor=this.addBinaryBuffer(attributeData.value,attributeData);result[attrName]=accessor;}return result;}},{key:"_addIndices",value:function _addIndices(indices){return this.addBinaryBuffer(indices,{size:1});}},{key:"_getGltfAttributeName",value:function _getGltfAttributeName(attributeName){switch(attributeName.toLowerCase()){case'position':case'positions':case'vertices':return'POSITION';case'normal':case'normals':return'NORMAL';case'color':case'colors':return'COLOR_0';case'texcoord':case'texcoords':return'TEXCOORD_0';default:return attributeName;}}},{key:"_getAccessorMinMax",value:function _getAccessorMinMax(buffer,size){var result={min:null,max:null};if(buffer.length<size){return result;}result.min=[];result.max=[];var initValues=buffer.subarray(0,size);var _iterator17=_createForOfIteratorHelper(initValues),_step17;try{for(_iterator17.s();!(_step17=_iterator17.n()).done;){var value=_step17.value;result.min.push(value);result.max.push(value);}}catch(err){_iterator17.e(err);}finally{_iterator17.f();}for(var index=size;index<buffer.length;index+=size){for(var componentIndex=0;componentIndex<size;componentIndex++){result.min[0+componentIndex]=Math.min(result.min[0+componentIndex],buffer[index+componentIndex]);result.max[0+componentIndex]=Math.max(result.max[0+componentIndex],buffer[index+componentIndex]);}}return result;}}]);}();var wasm_base='B9h9z9tFBBBF8fL9gBB9gLaaaaaFa9gEaaaB9gFaFa9gEaaaFaEMcBFFFGGGEIIILF9wFFFLEFBFKNFaFCx/IFMO/LFVK9tv9t9vq95GBt9f9f939h9z9t9f9j9h9s9s9f9jW9vq9zBBp9tv9z9o9v9wW9f9kv9j9v9kv9WvqWv94h919m9mvqBF8Z9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv94h919m9mvqBGy9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv949TvZ91v9u9jvBEn9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9P9jWBIi9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9R919hWBLn9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9F949wBKI9z9iqlBOc+x8ycGBM/qQFTa8jUUUUBCU/EBlHL8kUUUUBC9+RKGXAGCFJAI9LQBCaRKAE2BBC+gF9HQBALAEAIJHOAGlAGTkUUUBRNCUoBAG9uC/wgBZHKCUGAKCUG9JyRVAECFJRICBRcGXEXAcAF9PQFAVAFAclAcAVJAF9JyRMGXGXAG9FQBAMCbJHKC9wZRSAKCIrCEJCGrRQANCUGJRfCBRbAIRTEXGXAOATlAQ9PQBCBRISEMATAQJRIGXAS9FQBCBRtCBREEXGXAOAIlCi9PQBCBRISLMANCU/CBJAEJRKGXGXGXGXGXATAECKrJ2BBAtCKZrCEZfIBFGEBMAKhB83EBAKCNJhB83EBSEMAKAI2BIAI2BBHmCKrHYAYCE6HYy86BBAKCFJAICIJAYJHY2BBAmCIrCEZHPAPCE6HPy86BBAKCGJAYAPJHY2BBAmCGrCEZHPAPCE6HPy86BBAKCEJAYAPJHY2BBAmCEZHmAmCE6Hmy86BBAKCIJAYAmJHY2BBAI2BFHmCKrHPAPCE6HPy86BBAKCLJAYAPJHY2BBAmCIrCEZHPAPCE6HPy86BBAKCKJAYAPJHY2BBAmCGrCEZHPAPCE6HPy86BBAKCOJAYAPJHY2BBAmCEZHmAmCE6Hmy86BBAKCNJAYAmJHY2BBAI2BGHmCKrHPAPCE6HPy86BBAKCVJAYAPJHY2BBAmCIrCEZHPAPCE6HPy86BBAKCcJAYAPJHY2BBAmCGrCEZHPAPCE6HPy86BBAKCMJAYAPJHY2BBAmCEZHmAmCE6Hmy86BBAKCSJAYAmJHm2BBAI2BEHICKrHYAYCE6HYy86BBAKCQJAmAYJHm2BBAICIrCEZHYAYCE6HYy86BBAKCfJAmAYJHm2BBAICGrCEZHYAYCE6HYy86BBAKCbJAmAYJHK2BBAICEZHIAICE6HIy86BBAKAIJRISGMAKAI2BNAI2BBHmCIrHYAYCb6HYy86BBAKCFJAICNJAYJHY2BBAmCbZHmAmCb6Hmy86BBAKCGJAYAmJHm2BBAI2BFHYCIrHPAPCb6HPy86BBAKCEJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCIJAmAYJHm2BBAI2BGHYCIrHPAPCb6HPy86BBAKCLJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCKJAmAYJHm2BBAI2BEHYCIrHPAPCb6HPy86BBAKCOJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCNJAmAYJHm2BBAI2BIHYCIrHPAPCb6HPy86BBAKCVJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCcJAmAYJHm2BBAI2BLHYCIrHPAPCb6HPy86BBAKCMJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCSJAmAYJHm2BBAI2BKHYCIrHPAPCb6HPy86BBAKCQJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCfJAmAYJHm2BBAI2BOHICIrHYAYCb6HYy86BBAKCbJAmAYJHK2BBAICbZHIAICb6HIy86BBAKAIJRISFMAKAI8pBB83BBAKCNJAICNJ8pBB83BBAICTJRIMAtCGJRtAECTJHEAS9JQBMMGXAIQBCBRISEMGXAM9FQBANAbJ2BBRtCBRKAfREEXAEANCU/CBJAKJ2BBHTCFrCBATCFZl9zAtJHt86BBAEAGJREAKCFJHKAM9HQBMMAfCFJRfAIRTAbCFJHbAG9HQBMMABAcAG9sJANCUGJAMAG9sTkUUUBpANANCUGJAMCaJAG9sJAGTkUUUBpMAMCBAIyAcJRcAIQBMC9+RKSFMCBC99AOAIlAGCAAGCA9Ly6yRKMALCU/EBJ8kUUUUBAKM+OmFTa8jUUUUBCoFlHL8kUUUUBC9+RKGXAFCE9uHOCtJAI9LQBCaRKAE2BBHNC/wFZC/gF9HQBANCbZHVCF9LQBALCoBJCgFCUFT+JUUUBpALC84Jha83EBALC8wJha83EBALC8oJha83EBALCAJha83EBALCiJha83EBALCTJha83EBALha83ENALha83EBAEAIJC9wJRcAECFJHNAOJRMGXAF9FQBCQCbAVCF6yRSABRECBRVCBRQCBRfCBRICBRKEXGXAMAcuQBC9+RKSEMGXGXAN2BBHOC/vF9LQBALCoBJAOCIrCa9zAKJCbZCEWJHb8oGIRTAb8oGBRtGXAOCbZHbAS9PQBALAOCa9zAIJCbZCGWJ8oGBAVAbyROAb9FRbGXGXAGCG9HQBABAt87FBABCIJAO87FBABCGJAT87FBSFMAEAtjGBAECNJAOjGBAECIJATjGBMAVAbJRVALCoBJAKCEWJHmAOjGBAmATjGIALAICGWJAOjGBALCoBJAKCFJCbZHKCEWJHTAtjGBATAOjGIAIAbJRIAKCFJRKSGMGXGXAbCb6QBAQAbJAbC989zJCFJRQSFMAM1BBHbCgFZROGXGXAbCa9MQBAMCFJRMSFMAM1BFHbCgBZCOWAOCgBZqROGXAbCa9MQBAMCGJRMSFMAM1BGHbCgBZCfWAOqROGXAbCa9MQBAMCEJRMSFMAM1BEHbCgBZCdWAOqROGXAbCa9MQBAMCIJRMSFMAM2BIC8cWAOqROAMCLJRMMAOCFrCBAOCFZl9zAQJRQMGXGXAGCG9HQBABAt87FBABCIJAQ87FBABCGJAT87FBSFMAEAtjGBAECNJAQjGBAECIJATjGBMALCoBJAKCEWJHOAQjGBAOATjGIALAICGWJAQjGBALCoBJAKCFJCbZHKCEWJHOAtjGBAOAQjGIAICFJRIAKCFJRKSFMGXAOCDF9LQBALAIAcAOCbZJ2BBHbCIrHTlCbZCGWJ8oGBAVCFJHtATyROALAIAblCbZCGWJ8oGBAtAT9FHmJHtAbCbZHTyRbAT9FRTGXGXAGCG9HQBABAV87FBABCIJAb87FBABCGJAO87FBSFMAEAVjGBAECNJAbjGBAECIJAOjGBMALAICGWJAVjGBALCoBJAKCEWJHYAOjGBAYAVjGIALAICFJHICbZCGWJAOjGBALCoBJAKCFJCbZCEWJHYAbjGBAYAOjGIALAIAmJCbZHICGWJAbjGBALCoBJAKCGJCbZHKCEWJHOAVjGBAOAbjGIAKCFJRKAIATJRIAtATJRVSFMAVCBAM2BBHYyHTAOC/+F6HPJROAYCbZRtGXGXAYCIrHmQBAOCFJRbSFMAORbALAIAmlCbZCGWJ8oGBROMGXGXAtQBAbCFJRVSFMAbRVALAIAYlCbZCGWJ8oGBRbMGXGXAP9FQBAMCFJRYSFMAM1BFHYCgFZRTGXGXAYCa9MQBAMCGJRYSFMAM1BGHYCgBZCOWATCgBZqRTGXAYCa9MQBAMCEJRYSFMAM1BEHYCgBZCfWATqRTGXAYCa9MQBAMCIJRYSFMAM1BIHYCgBZCdWATqRTGXAYCa9MQBAMCLJRYSFMAMCKJRYAM2BLC8cWATqRTMATCFrCBATCFZl9zAQJHQRTMGXGXAmCb6QBAYRPSFMAY1BBHMCgFZROGXGXAMCa9MQBAYCFJRPSFMAY1BFHMCgBZCOWAOCgBZqROGXAMCa9MQBAYCGJRPSFMAY1BGHMCgBZCfWAOqROGXAMCa9MQBAYCEJRPSFMAY1BEHMCgBZCdWAOqROGXAMCa9MQBAYCIJRPSFMAYCLJRPAY2BIC8cWAOqROMAOCFrCBAOCFZl9zAQJHQROMGXGXAtCb6QBAPRMSFMAP1BBHMCgFZRbGXGXAMCa9MQBAPCFJRMSFMAP1BFHMCgBZCOWAbCgBZqRbGXAMCa9MQBAPCGJRMSFMAP1BGHMCgBZCfWAbqRbGXAMCa9MQBAPCEJRMSFMAP1BEHMCgBZCdWAbqRbGXAMCa9MQBAPCIJRMSFMAPCLJRMAP2BIC8cWAbqRbMAbCFrCBAbCFZl9zAQJHQRbMGXGXAGCG9HQBABAT87FBABCIJAb87FBABCGJAO87FBSFMAEATjGBAECNJAbjGBAECIJAOjGBMALCoBJAKCEWJHYAOjGBAYATjGIALAICGWJATjGBALCoBJAKCFJCbZCEWJHYAbjGBAYAOjGIALAICFJHICbZCGWJAOjGBALCoBJAKCGJCbZCEWJHOATjGBAOAbjGIALAIAm9FAmCb6qJHICbZCGWJAbjGBAIAt9FAtCb6qJRIAKCEJRKMANCFJRNABCKJRBAECSJREAKCbZRKAICbZRIAfCEJHfAF9JQBMMCBC99AMAc6yRKMALCoFJ8kUUUUBAKM/tIFGa8jUUUUBCTlRLC9+RKGXAFCLJAI9LQBCaRKAE2BBC/+FZC/QF9HQBALhB83ENAECFJRKAEAIJC98JREGXAF9FQBGXAGCG6QBEXGXAKAE9JQBC9+bMAK1BBHGCgFZRIGXGXAGCa9MQBAKCFJRKSFMAK1BFHGCgBZCOWAICgBZqRIGXAGCa9MQBAKCGJRKSFMAK1BGHGCgBZCfWAIqRIGXAGCa9MQBAKCEJRKSFMAK1BEHGCgBZCdWAIqRIGXAGCa9MQBAKCIJRKSFMAK2BIC8cWAIqRIAKCLJRKMALCNJAICFZCGWqHGAICGrCBAICFrCFZl9zAG8oGBJHIjGBABAIjGBABCIJRBAFCaJHFQBSGMMEXGXAKAE9JQBC9+bMAK1BBHGCgFZRIGXGXAGCa9MQBAKCFJRKSFMAK1BFHGCgBZCOWAICgBZqRIGXAGCa9MQBAKCGJRKSFMAK1BGHGCgBZCfWAIqRIGXAGCa9MQBAKCEJRKSFMAK1BEHGCgBZCdWAIqRIGXAGCa9MQBAKCIJRKSFMAK2BIC8cWAIqRIAKCLJRKMABAICGrCBAICFrCFZl9zALCNJAICFZCGWqHI8oGBJHG87FBAIAGjGBABCGJRBAFCaJHFQBMMCBC99AKAE6yRKMAKM+lLKFaF99GaG99FaG99GXGXAGCI9HQBAF9FQFEXGXGX9DBBB8/9DBBB+/ABCGJHG1BB+yAB1BBHE+yHI+L+TABCFJHL1BBHK+yHO+L+THN9DBBBB9gHVyAN9DBB/+hANAN+U9DBBBBANAVyHcAc+MHMAECa3yAI+SHIAI+UAcAMAKCa3yAO+SHcAc+U+S+S+R+VHO+U+SHN+L9DBBB9P9d9FQBAN+oRESFMCUUUU94REMAGAE86BBGXGX9DBBB8/9DBBB+/Ac9DBBBB9gyAcAO+U+SHN+L9DBBB9P9d9FQBAN+oRGSFMCUUUU94RGMALAG86BBGXGX9DBBB8/9DBBB+/AI9DBBBB9gyAIAO+U+SHN+L9DBBB9P9d9FQBAN+oRGSFMCUUUU94RGMABAG86BBABCIJRBAFCaJHFQBSGMMAF9FQBEXGXGX9DBBB8/9DBBB+/ABCIJHG8uFB+yAB8uFBHE+yHI+L+TABCGJHL8uFBHK+yHO+L+THN9DBBBB9gHVyAN9DB/+g6ANAN+U9DBBBBANAVyHcAc+MHMAECa3yAI+SHIAI+UAcAMAKCa3yAO+SHcAc+U+S+S+R+VHO+U+SHN+L9DBBB9P9d9FQBAN+oRESFMCUUUU94REMAGAE87FBGXGX9DBBB8/9DBBB+/Ac9DBBBB9gyAcAO+U+SHN+L9DBBB9P9d9FQBAN+oRGSFMCUUUU94RGMALAG87FBGXGX9DBBB8/9DBBB+/AI9DBBBB9gyAIAO+U+SHN+L9DBBB9P9d9FQBAN+oRGSFMCUUUU94RGMABAG87FBABCNJRBAFCaJHFQBMMM/SEIEaE99EaF99GXAF9FQBCBREABRIEXGXGX9D/zI818/AICKJ8uFBHLCEq+y+VHKAI8uFB+y+UHO9DB/+g6+U9DBBB8/9DBBB+/AO9DBBBB9gy+SHN+L9DBBB9P9d9FQBAN+oRVSFMCUUUU94RVMAICIJ8uFBRcAICGJ8uFBRMABALCFJCEZAEqCFWJAV87FBGXGXAKAM+y+UHN9DB/+g6+U9DBBB8/9DBBB+/AN9DBBBB9gy+SHS+L9DBBB9P9d9FQBAS+oRMSFMCUUUU94RMMABALCGJCEZAEqCFWJAM87FBGXGXAKAc+y+UHK9DB/+g6+U9DBBB8/9DBBB+/AK9DBBBB9gy+SHS+L9DBBB9P9d9FQBAS+oRcSFMCUUUU94RcMABALCaJCEZAEqCFWJAc87FBGXGX9DBBU8/AOAO+U+TANAN+U+TAKAK+U+THO9DBBBBAO9DBBBB9gy+R9DB/+g6+U9DBBB8/+SHO+L9DBBB9P9d9FQBAO+oRcSFMCUUUU94RcMABALCEZAEqCFWJAc87FBAICNJRIAECIJREAFCaJHFQBMMM9JBGXAGCGrAF9sHF9FQBEXABAB8oGBHGCNWCN91+yAGCi91CnWCUUU/8EJ+++U84GBABCIJRBAFCaJHFQBMMM9TFEaCBCB8oGUkUUBHFABCEJC98ZJHBjGUkUUBGXGXAB8/BCTWHGuQBCaREABAGlCggEJCTrXBCa6QFMAFREMAEM/lFFFaGXGXAFABqCEZ9FQBABRESFMGXGXAGCT9PQBABRESFMABREEXAEAF8oGBjGBAECIJAFCIJ8oGBjGBAECNJAFCNJ8oGBjGBAECSJAFCSJ8oGBjGBAECTJREAFCTJRFAGC9wJHGCb9LQBMMAGCI9JQBEXAEAF8oGBjGBAFCIJRFAECIJREAGC98JHGCE9LQBMMGXAG9FQBEXAEAF2BB86BBAECFJREAFCFJRFAGCaJHGQBMMABMoFFGaGXGXABCEZ9FQBABRESFMAFCgFZC+BwsN9sRIGXGXAGCT9PQBABRESFMABREEXAEAIjGBAECSJAIjGBAECNJAIjGBAECIJAIjGBAECTJREAGC9wJHGCb9LQBMMAGCI9JQBEXAEAIjGBAECIJREAGC98JHGCE9LQBMMGXAG9FQBEXAEAF86BBAECFJREAGCaJHGQBMMABMMMFBCUNMIT9kBB';var wasm_simd='B9h9z9tFBBBF8dL9gBB9gLaaaaaFa9gEaaaB9gGaaB9gFaFaEQSBBFBFFGEGEGIILF9wFFFLEFBFKNFaFCx/aFMO/LFVK9tv9t9vq95GBt9f9f939h9z9t9f9j9h9s9s9f9jW9vq9zBBp9tv9z9o9v9wW9f9kv9j9v9kv9WvqWv94h919m9mvqBG8Z9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv94h919m9mvqBIy9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv949TvZ91v9u9jvBLn9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9P9jWBKi9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9R919hWBNn9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9F949wBcI9z9iqlBMc/j9JSIBTEM9+FLa8jUUUUBCTlRBCBRFEXCBRGCBREEXABCNJAGJAECUaAFAGrCFZHIy86BBAEAIJREAGCFJHGCN9HQBMAFCx+YUUBJAE86BBAFCEWCxkUUBJAB8pEN83EBAFCFJHFCUG9HQBMMkRIbaG97FaK978jUUUUBCU/KBlHL8kUUUUBC9+RKGXAGCFJAI9LQBCaRKAE2BBC+gF9HQBALAEAIJHOAGlAG/8cBBCUoBAG9uC/wgBZHKCUGAKCUG9JyRNAECFJRKCBRVGXEXAVAF9PQFANAFAVlAVANJAF9JyRcGXGXAG9FQBAcCbJHIC9wZHMCE9sRSAMCFWRQAICIrCEJCGrRfCBRbEXAKRTCBRtGXEXGXAOATlAf9PQBCBRKSLMALCU/CBJAtAM9sJRmATAfJRKCBREGXAMCoB9JQBAOAKlC/gB9JQBCBRIEXAmAIJREGXGXGXGXGXATAICKrJ2BBHYCEZfIBFGEBMAECBDtDMIBSEMAEAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPD8dBhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBAeCx+YUUBJDBBBHnAnDQBBBBBBBBBBBBBBBBAPD8dFhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIBAKCIJAnDeBJAeCx+YUUBJ2BBJRKSGMAEAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPD8dBhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBAeCx+YUUBJDBBBHnAnDQBBBBBBBBBBBBBBBBAPD8dFhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIBAKCNJAnDeBJAeCx+YUUBJ2BBJRKSFMAEAKDBBBDMIBAKCTJRKMGXGXGXGXGXAYCGrCEZfIBFGEBMAECBDtDMITSEMAEAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPD8dBhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBAeCx+YUUBJDBBBHnAnDQBBBBBBBBBBBBBBBBAPD8dFhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMITAKCIJAnDeBJAeCx+YUUBJ2BBJRKSGMAEAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPD8dBhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBAeCx+YUUBJDBBBHnAnDQBBBBBBBBBBBBBBBBAPD8dFhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMITAKCNJAnDeBJAeCx+YUUBJ2BBJRKSFMAEAKDBBBDMITAKCTJRKMGXGXGXGXGXAYCIrCEZfIBFGEBMAECBDtDMIASEMAEAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPD8dBhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBAeCx+YUUBJDBBBHnAnDQBBBBBBBBBBBBBBBBAPD8dFhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIAAKCIJAnDeBJAeCx+YUUBJ2BBJRKSGMAEAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPD8dBhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBAeCx+YUUBJDBBBHnAnDQBBBBBBBBBBBBBBBBAPD8dFhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIAAKCNJAnDeBJAeCx+YUUBJ2BBJRKSFMAEAKDBBBDMIAAKCTJRKMGXGXGXGXGXAYCKrfIBFGEBMAECBDtDMI8wSEMAEAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPD8dBhUg/8/4/w/goB9+h84k7HYCEWCxkUUBJDBEBAYCx+YUUBJDBBBHnAnDQBBBBBBBBBBBBBBBBAPD8dFhUg/8/4/w/goB9+h84k7HYCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMI8wAKCIJAnDeBJAYCx+YUUBJ2BBJRKSGMAEAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPD8dBhUg/8/4/w/goB9+h84k7HYCEWCxkUUBJDBEBAYCx+YUUBJDBBBHnAnDQBBBBBBBBBBBBBBBBAPD8dFhUg/8/4/w/goB9+h84k7HYCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMI8wAKCNJAnDeBJAYCx+YUUBJ2BBJRKSFMAEAKDBBBDMI8wAKCTJRKMAICoBJREAICUFJAM9LQFAERIAOAKlC/fB9LQBMMGXAEAM9PQBAECErRIEXGXAOAKlCi9PQBCBRKSOMAmAEJRYGXGXGXGXGXATAECKrJ2BBAICKZrCEZfIBFGEBMAYCBDtDMIBSEMAYAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPD8dBhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBAeCx+YUUBJDBBBHnAnDQBBBBBBBBBBBBBBBBAPD8dFhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIBAKCIJAnDeBJAeCx+YUUBJ2BBJRKSGMAYAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPD8dBhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBAeCx+YUUBJDBBBHnAnDQBBBBBBBBBBBBBBBBAPD8dFhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIBAKCNJAnDeBJAeCx+YUUBJ2BBJRKSFMAYAKDBBBDMIBAKCTJRKMAICGJRIAECTJHEAM9JQBMMGXAK9FQBAKRTAtCFJHtCI6QGSFMMCBRKSEMGXAM9FQBALCUGJAbJREALAbJDBGBRnCBRYEXAEALCU/CBJAYJHIDBIBHdCFD9tAdCFDbHPD9OD9hD9RHdAIAMJDBIBHiCFD9tAiAPD9OD9hD9RHiDQBTFtGmEYIPLdKeOnH8ZAIAQJDBIBHpCFD9tApAPD9OD9hD9RHpAIASJDBIBHyCFD9tAyAPD9OD9hD9RHyDQBTFtGmEYIPLdKeOnH8cDQBFTtGEmYILPdKOenHPAPDQBFGEBFGEBFGEBFGEAnD9uHnDyBjGBAEAGJHIAnAPAPDQILKOILKOILKOILKOD9uHnDyBjGBAIAGJHIAnAPAPDQNVcMNVcMNVcMNVcMD9uHnDyBjGBAIAGJHIAnAPAPDQSQfbSQfbSQfbSQfbD9uHnDyBjGBAIAGJHIAnA8ZA8cDQNVi8ZcMpySQ8c8dfb8e8fHPAPDQBFGEBFGEBFGEBFGED9uHnDyBjGBAIAGJHIAnAPAPDQILKOILKOILKOILKOD9uHnDyBjGBAIAGJHIAnAPAPDQNVcMNVcMNVcMNVcMD9uHnDyBjGBAIAGJHIAnAPAPDQSQfbSQfbSQfbSQfbD9uHnDyBjGBAIAGJHIAnAdAiDQNiV8ZcpMyS8cQ8df8eb8fHdApAyDQNiV8ZcpMyS8cQ8df8eb8fHiDQBFTtGEmYILPdKOenHPAPDQBFGEBFGEBFGEBFGED9uHnDyBjGBAIAGJHIAnAPAPDQILKOILKOILKOILKOD9uHnDyBjGBAIAGJHIAnAPAPDQNVcMNVcMNVcMNVcMD9uHnDyBjGBAIAGJHIAnAPAPDQSQfbSQfbSQfbSQfbD9uHnDyBjGBAIAGJHIAnAdAiDQNVi8ZcMpySQ8c8dfb8e8fHPAPDQBFGEBFGEBFGEBFGED9uHnDyBjGBAIAGJHIAnAPAPDQILKOILKOILKOILKOD9uHnDyBjGBAIAGJHIAnAPAPDQNVcMNVcMNVcMNVcMD9uHnDyBjGBAIAGJHIAnAPAPDQSQfbSQfbSQfbSQfbD9uHnDyBjGBAIAGJREAYCTJHYAM9JQBMMAbCIJHbAG9JQBMMABAVAG9sJALCUGJAcAG9s/8cBBALALCUGJAcCaJAG9sJAG/8cBBMAcCBAKyAVJRVAKQBMC9+RKSFMCBC99AOAKlAGCAAGCA9Ly6yRKMALCU/KBJ8kUUUUBAKMNBT+BUUUBM+KmFTa8jUUUUBCoFlHL8kUUUUBC9+RKGXAFCE9uHOCtJAI9LQBCaRKAE2BBHNC/wFZC/gF9HQBANCbZHVCF9LQBALCoBJCgFCUF/8MBALC84Jha83EBALC8wJha83EBALC8oJha83EBALCAJha83EBALCiJha83EBALCTJha83EBALha83ENALha83EBAEAIJC9wJRcAECFJHNAOJRMGXAF9FQBCQCbAVCF6yRSABRECBRVCBRQCBRfCBRICBRKEXGXAMAcuQBC9+RKSEMGXGXAN2BBHOC/vF9LQBALCoBJAOCIrCa9zAKJCbZCEWJHb8oGIRTAb8oGBRtGXAOCbZHbAS9PQBALAOCa9zAIJCbZCGWJ8oGBAVAbyROAb9FRbGXGXAGCG9HQBABAt87FBABCIJAO87FBABCGJAT87FBSFMAEAtjGBAECNJAOjGBAECIJATjGBMAVAbJRVALCoBJAKCEWJHmAOjGBAmATjGIALAICGWJAOjGBALCoBJAKCFJCbZHKCEWJHTAtjGBATAOjGIAIAbJRIAKCFJRKSGMGXGXAbCb6QBAQAbJAbC989zJCFJRQSFMAM1BBHbCgFZROGXGXAbCa9MQBAMCFJRMSFMAM1BFHbCgBZCOWAOCgBZqROGXAbCa9MQBAMCGJRMSFMAM1BGHbCgBZCfWAOqROGXAbCa9MQBAMCEJRMSFMAM1BEHbCgBZCdWAOqROGXAbCa9MQBAMCIJRMSFMAM2BIC8cWAOqROAMCLJRMMAOCFrCBAOCFZl9zAQJRQMGXGXAGCG9HQBABAt87FBABCIJAQ87FBABCGJAT87FBSFMAEAtjGBAECNJAQjGBAECIJATjGBMALCoBJAKCEWJHOAQjGBAOATjGIALAICGWJAQjGBALCoBJAKCFJCbZHKCEWJHOAtjGBAOAQjGIAICFJRIAKCFJRKSFMGXAOCDF9LQBALAIAcAOCbZJ2BBHbCIrHTlCbZCGWJ8oGBAVCFJHtATyROALAIAblCbZCGWJ8oGBAtAT9FHmJHtAbCbZHTyRbAT9FRTGXGXAGCG9HQBABAV87FBABCIJAb87FBABCGJAO87FBSFMAEAVjGBAECNJAbjGBAECIJAOjGBMALAICGWJAVjGBALCoBJAKCEWJHYAOjGBAYAVjGIALAICFJHICbZCGWJAOjGBALCoBJAKCFJCbZCEWJHYAbjGBAYAOjGIALAIAmJCbZHICGWJAbjGBALCoBJAKCGJCbZHKCEWJHOAVjGBAOAbjGIAKCFJRKAIATJRIAtATJRVSFMAVCBAM2BBHYyHTAOC/+F6HPJROAYCbZRtGXGXAYCIrHmQBAOCFJRbSFMAORbALAIAmlCbZCGWJ8oGBROMGXGXAtQBAbCFJRVSFMAbRVALAIAYlCbZCGWJ8oGBRbMGXGXAP9FQBAMCFJRYSFMAM1BFHYCgFZRTGXGXAYCa9MQBAMCGJRYSFMAM1BGHYCgBZCOWATCgBZqRTGXAYCa9MQBAMCEJRYSFMAM1BEHYCgBZCfWATqRTGXAYCa9MQBAMCIJRYSFMAM1BIHYCgBZCdWATqRTGXAYCa9MQBAMCLJRYSFMAMCKJRYAM2BLC8cWATqRTMATCFrCBATCFZl9zAQJHQRTMGXGXAmCb6QBAYRPSFMAY1BBHMCgFZROGXGXAMCa9MQBAYCFJRPSFMAY1BFHMCgBZCOWAOCgBZqROGXAMCa9MQBAYCGJRPSFMAY1BGHMCgBZCfWAOqROGXAMCa9MQBAYCEJRPSFMAY1BEHMCgBZCdWAOqROGXAMCa9MQBAYCIJRPSFMAYCLJRPAY2BIC8cWAOqROMAOCFrCBAOCFZl9zAQJHQROMGXGXAtCb6QBAPRMSFMAP1BBHMCgFZRbGXGXAMCa9MQBAPCFJRMSFMAP1BFHMCgBZCOWAbCgBZqRbGXAMCa9MQBAPCGJRMSFMAP1BGHMCgBZCfWAbqRbGXAMCa9MQBAPCEJRMSFMAP1BEHMCgBZCdWAbqRbGXAMCa9MQBAPCIJRMSFMAPCLJRMAP2BIC8cWAbqRbMAbCFrCBAbCFZl9zAQJHQRbMGXGXAGCG9HQBABAT87FBABCIJAb87FBABCGJAO87FBSFMAEATjGBAECNJAbjGBAECIJAOjGBMALCoBJAKCEWJHYAOjGBAYATjGIALAICGWJATjGBALCoBJAKCFJCbZCEWJHYAbjGBAYAOjGIALAICFJHICbZCGWJAOjGBALCoBJAKCGJCbZCEWJHOATjGBAOAbjGIALAIAm9FAmCb6qJHICbZCGWJAbjGBAIAt9FAtCb6qJRIAKCEJRKMANCFJRNABCKJRBAECSJREAKCbZRKAICbZRIAfCEJHfAF9JQBMMCBC99AMAc6yRKMALCoFJ8kUUUUBAKM/tIFGa8jUUUUBCTlRLC9+RKGXAFCLJAI9LQBCaRKAE2BBC/+FZC/QF9HQBALhB83ENAECFJRKAEAIJC98JREGXAF9FQBGXAGCG6QBEXGXAKAE9JQBC9+bMAK1BBHGCgFZRIGXGXAGCa9MQBAKCFJRKSFMAK1BFHGCgBZCOWAICgBZqRIGXAGCa9MQBAKCGJRKSFMAK1BGHGCgBZCfWAIqRIGXAGCa9MQBAKCEJRKSFMAK1BEHGCgBZCdWAIqRIGXAGCa9MQBAKCIJRKSFMAK2BIC8cWAIqRIAKCLJRKMALCNJAICFZCGWqHGAICGrCBAICFrCFZl9zAG8oGBJHIjGBABAIjGBABCIJRBAFCaJHFQBSGMMEXGXAKAE9JQBC9+bMAK1BBHGCgFZRIGXGXAGCa9MQBAKCFJRKSFMAK1BFHGCgBZCOWAICgBZqRIGXAGCa9MQBAKCGJRKSFMAK1BGHGCgBZCfWAIqRIGXAGCa9MQBAKCEJRKSFMAK1BEHGCgBZCdWAIqRIGXAGCa9MQBAKCIJRKSFMAK2BIC8cWAIqRIAKCLJRKMABAICGrCBAICFrCFZl9zALCNJAICFZCGWqHI8oGBJHG87FBAIAGjGBABCGJRBAFCaJHFQBMMCBC99AKAE6yRKMAKM/xLGEaK978jUUUUBCAlHE8kUUUUBGXGXAGCI9HQBGXAFC98ZHI9FQBABRGCBRLEXAGAGDBBBHKCiD+rFCiD+sFD/6FHOAKCND+rFCiD+sFD/6FAOD/gFAKCTD+rFCiD+sFD/6FHND/gFD/kFD/lFHVCBDtD+2FHcAOCUUUU94DtHMD9OD9RD/kFHO9DBB/+hDYAOAOD/mFAVAVD/mFANAcANAMD9OD9RD/kFHOAOD/mFD/kFD/kFD/jFD/nFHND/mF9DBBX9LDYHcD/kFCgFDtD9OAKCUUU94DtD9OD9QAOAND/mFAcD/kFCND+rFCU/+EDtD9OD9QAVAND/mFAcD/kFCTD+rFCUU/8ODtD9OD9QDMBBAGCTJRGALCIJHLAI9JQBMMAIAF9PQFAEAFCEZHLCGWHGqCBCTAGl/8MBAEABAICGWJHIAG/8cBBGXAL9FQBAEAEDBIBHKCiD+rFCiD+sFD/6FHOAKCND+rFCiD+sFD/6FAOD/gFAKCTD+rFCiD+sFD/6FHND/gFD/kFD/lFHVCBDtD+2FHcAOCUUUU94DtHMD9OD9RD/kFHO9DBB/+hDYAOAOD/mFAVAVD/mFANAcANAMD9OD9RD/kFHOAOD/mFD/kFD/kFD/jFD/nFHND/mF9DBBX9LDYHcD/kFCgFDtD9OAKCUUU94DtD9OD9QAOAND/mFAcD/kFCND+rFCU/+EDtD9OD9QAVAND/mFAcD/kFCTD+rFCUU/8ODtD9OD9QDMIBMAIAEAG/8cBBSFMABAFC98ZHGT+HUUUBAGAF9PQBAEAFCEZHICEWHLJCBCAALl/8MBAEABAGCEWJHGAL/8cBBAEAIT+HUUUBAGAEAL/8cBBMAECAJ8kUUUUBM+yEGGaO97GXAF9FQBCBRGEXABCTJHEAEDBBBHICBDtHLCUU98D8cFCUU98D8cEHKD9OABDBBBHOAIDQILKOSQfbPden8c8d8e8fCggFDtD9OD/6FAOAIDQBFGENVcMTtmYi8ZpyHICTD+sFD/6FHND/gFAICTD+rFCTD+sFD/6FHVD/gFD/kFD/lFHI9DB/+g6DYAVAIALD+2FHLAVCUUUU94DtHcD9OD9RD/kFHVAVD/mFAIAID/mFANALANAcD9OD9RD/kFHIAID/mFD/kFD/kFD/jFD/nFHND/mF9DBBX9LDYHLD/kFCTD+rFAVAND/mFALD/kFCggEDtD9OD9QHVAIAND/mFALD/kFCaDbCBDnGCBDnECBDnKCBDnOCBDncCBDnMCBDnfCBDnbD9OHIDQNVi8ZcMpySQ8c8dfb8e8fD9QDMBBABAOAKD9OAVAIDQBFTtGEmYILPdKOenD9QDMBBABCAJRBAGCIJHGAF9JQBMMM94FEa8jUUUUBCAlHE8kUUUUBABAFC98ZHIT+JUUUBGXAIAF9PQBAEAFCEZHLCEWHFJCBCAAFl/8MBAEABAICEWJHBAF/8cBBAEALT+JUUUBABAEAF/8cBBMAECAJ8kUUUUBM/hEIGaF97FaL978jUUUUBCTlRGGXAF9FQBCBREEXAGABDBBBHIABCTJHLDBBBHKDQILKOSQfbPden8c8d8e8fHOCTD+sFHNCID+rFDMIBAB9DBBU8/DY9D/zI818/DYANCEDtD9QD/6FD/nFHNAIAKDQBFGENVcMTtmYi8ZpyHICTD+rFCTD+sFD/6FD/mFHKAKD/mFANAICTD+sFD/6FD/mFHVAVD/mFANAOCTD+rFCTD+sFD/6FD/mFHOAOD/mFD/kFD/kFD/lFCBDtD+4FD/jF9DB/+g6DYHND/mF9DBBX9LDYHID/kFCggEDtHcD9OAVAND/mFAID/kFCTD+rFD9QHVAOAND/mFAID/kFCTD+rFAKAND/mFAID/kFAcD9OD9QHNDQBFTtGEmYILPdKOenHID8dBAGDBIBDyB+t+J83EBABCNJAID8dFAGDBIBDyF+t+J83EBALAVANDQNVi8ZcMpySQ8c8dfb8e8fHND8dBAGDBIBDyG+t+J83EBABCiJAND8dFAGDBIBDyE+t+J83EBABCAJRBAECIJHEAF9JQBMMM/3FGEaF978jUUUUBCoBlREGXAGCGrAF9sHIC98ZHL9FQBCBRGABRFEXAFAFDBBBHKCND+rFCND+sFD/6FAKCiD+sFCnD+rFCUUU/8EDtD+uFD/mFDMBBAFCTJRFAGCIJHGAL9JQBMMGXALAI9PQBAEAICEZHGCGWHFqCBCoBAFl/8MBAEABALCGWJHLAF/8cBBGXAG9FQBAEAEDBIBHKCND+rFCND+sFD/6FAKCiD+sFCnD+rFCUUU/8EDtD+uFD/mFDMIBMALAEAF/8cBBMM9TFEaCBCB8oGUkUUBHFABCEJC98ZJHBjGUkUUBGXGXAB8/BCTWHGuQBCaREABAGlCggEJCTrXBCa6QFMAFREMAEMMMFBCUNMIT9tBB';var detector=new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,3,2,0,0,5,3,1,0,1,12,1,0,10,22,2,12,0,65,0,65,0,65,0,252,10,0,0,11,7,0,65,0,253,15,26,11]);var wasmpack=new Uint8Array([32,0,65,253,3,1,2,34,4,106,6,5,11,8,7,20,13,33,12,16,128,9,116,64,19,113,127,15,10,21,22,14,255,66,24,54,136,107,18,23,192,26,114,118,132,17,77,101,130,144,27,87,131,44,45,74,156,154,70,167]);var FILTERS={0:'',1:'meshopt_decodeFilterOct',2:'meshopt_decodeFilterQuat',3:'meshopt_decodeFilterExp',NONE:'',OCTAHEDRAL:'meshopt_decodeFilterOct',QUATERNION:'meshopt_decodeFilterQuat',EXPONENTIAL:'meshopt_decodeFilterExp'};var DECODERS={0:'meshopt_decodeVertexBuffer',1:'meshopt_decodeIndexBuffer',2:'meshopt_decodeIndexSequence',ATTRIBUTES:'meshopt_decodeVertexBuffer',TRIANGLES:'meshopt_decodeIndexBuffer',INDICES:'meshopt_decodeIndexSequence'};function meshoptDecodeGltfBuffer(_x58,_x59,_x60,_x61,_x62){return _meshoptDecodeGltfBuffer.apply(this,arguments);}function _meshoptDecodeGltfBuffer(){_meshoptDecodeGltfBuffer=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee35(target,count,size,source,mode){var filter,instance,_args31=arguments;return _regeneratorRuntime().wrap(function _callee35$(_context38){while(1)switch(_context38.prev=_context38.next){case 0:filter=_args31.length>5&&_args31[5]!==undefined?_args31[5]:'NONE';_context38.next=3;return loadWasmInstance();case 3:instance=_context38.sent;decode$7(instance,instance.exports[DECODERS[mode]],target,count,size,source,instance.exports[FILTERS[filter||'NONE']]);case 5:case"end":return _context38.stop();}},_callee35);}));return _meshoptDecodeGltfBuffer.apply(this,arguments);}var wasmPromise;function loadWasmInstance(){return _loadWasmInstance.apply(this,arguments);}function _loadWasmInstance(){_loadWasmInstance=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee36(){return _regeneratorRuntime().wrap(function _callee36$(_context39){while(1)switch(_context39.prev=_context39.next){case 0:if(!wasmPromise){wasmPromise=loadWasmModule();}return _context39.abrupt("return",wasmPromise);case 2:case"end":return _context39.stop();}},_callee36);}));return _loadWasmInstance.apply(this,arguments);}function loadWasmModule(){return _loadWasmModule.apply(this,arguments);}function _loadWasmModule(){_loadWasmModule=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee37(){var wasm,result;return _regeneratorRuntime().wrap(function _callee37$(_context40){while(1)switch(_context40.prev=_context40.next){case 0:wasm=wasm_base;if(WebAssembly.validate(detector)){wasm=wasm_simd;console.log('Warning: meshopt_decoder is using experimental SIMD support');}_context40.next=4;return WebAssembly.instantiate(unpack(wasm),{});case 4:result=_context40.sent;_context40.next=7;return result.instance.exports.__wasm_call_ctors();case 7:return _context40.abrupt("return",result.instance);case 8:case"end":return _context40.stop();}},_callee37);}));return _loadWasmModule.apply(this,arguments);}function unpack(data){var result=new Uint8Array(data.length);for(var _i512=0;_i512<data.length;++_i512){var ch=data.charCodeAt(_i512);result[_i512]=ch>96?ch-71:ch>64?ch-65:ch>47?ch+4:ch>46?63:62;}var write=0;for(var _i513=0;_i513<data.length;++_i513){result[write++]=result[_i513]<60?wasmpack[result[_i513]]:(result[_i513]-60)*64+result[++_i513];}return result.buffer.slice(0,write);}function decode$7(instance,fun,target,count,size,source,filter){var sbrk=instance.exports.sbrk;var count4=count+3&~3;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));}}var EXT_MESHOPT_COMPRESSION='EXT_meshopt_compression';var name$8=EXT_MESHOPT_COMPRESSION;function decode$6(_x63,_x64){return _decode$.apply(this,arguments);}function _decode$(){_decode$=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee38(gltfData,options){var _options$gltf,scenegraph,promises,_iterator44,_step44,bufferViewIndex;return _regeneratorRuntime().wrap(function _callee38$(_context41){while(1)switch(_context41.prev=_context41.next){case 0:scenegraph=new GLTFScenegraph(gltfData);if(options!==null&&options!==void 0&&(_options$gltf=options.gltf)!==null&&_options$gltf!==void 0&&_options$gltf.decompressMeshes){_context41.next=3;break;}return _context41.abrupt("return");case 3:promises=[];_iterator44=_createForOfIteratorHelper(gltfData.json.bufferViews||[]);try{for(_iterator44.s();!(_step44=_iterator44.n()).done;){bufferViewIndex=_step44.value;promises.push(decodeMeshoptBufferView(scenegraph,bufferViewIndex));}}catch(err){_iterator44.e(err);}finally{_iterator44.f();}_context41.next=8;return Promise.all(promises);case 8:scenegraph.removeExtension(EXT_MESHOPT_COMPRESSION);case 9:case"end":return _context41.stop();}},_callee38);}));return _decode$.apply(this,arguments);}function decodeMeshoptBufferView(_x65,_x66){return _decodeMeshoptBufferView.apply(this,arguments);}function _decodeMeshoptBufferView(){_decodeMeshoptBufferView=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee39(scenegraph,bufferView){var meshoptExtension,_meshoptExtension$byt,byteOffset,_meshoptExtension$byt2,byteLength,byteStride,count,mode,_meshoptExtension$fil,filter,bufferIndex,buffer,source,result;return _regeneratorRuntime().wrap(function _callee39$(_context42){while(1)switch(_context42.prev=_context42.next){case 0:meshoptExtension=scenegraph.getObjectExtension(bufferView,EXT_MESHOPT_COMPRESSION);if(!meshoptExtension){_context42.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);_context42.next=8;return meshoptDecodeGltfBuffer(result,count,byteStride,source,mode,filter);case 8:return _context42.abrupt("return",result);case 9:return _context42.abrupt("return",null);case 10:case"end":return _context42.stop();}},_callee39);}));return _decodeMeshoptBufferView.apply(this,arguments);}var EXT_meshopt_compression=/*#__PURE__*/Object.freeze({__proto__:null,name:name$8,decode:decode$6});var EXT_TEXTURE_WEBP='EXT_texture_webp';var name$7=EXT_TEXTURE_WEBP;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 _iterator18=_createForOfIteratorHelper(json.textures||[]),_step18;try{for(_iterator18.s();!(_step18=_iterator18.n()).done;){var texture=_step18.value;var extension=scenegraph.getObjectExtension(texture,EXT_TEXTURE_WEBP);if(extension){texture.source=extension.source;}scenegraph.removeObjectExtension(texture,EXT_TEXTURE_WEBP);}}catch(err){_iterator18.e(err);}finally{_iterator18.f();}scenegraph.removeExtension(EXT_TEXTURE_WEBP);}var EXT_texture_webp=/*#__PURE__*/Object.freeze({__proto__:null,name:name$7,preprocess:preprocess$3});var KHR_TEXTURE_BASISU='KHR_texture_basisu';var name$6=KHR_TEXTURE_BASISU;function preprocess$2(gltfData,options){var scene=new GLTFScenegraph(gltfData);var json=scene.json;var _iterator19=_createForOfIteratorHelper(json.textures||[]),_step19;try{for(_iterator19.s();!(_step19=_iterator19.n()).done;){var texture=_step19.value;var extension=scene.getObjectExtension(texture,KHR_TEXTURE_BASISU);if(extension){texture.source=extension.source;}scene.removeObjectExtension(texture,KHR_TEXTURE_BASISU);}}catch(err){_iterator19.e(err);}finally{_iterator19.f();}scene.removeExtension(KHR_TEXTURE_BASISU);}var KHR_texture_basisu=/*#__PURE__*/Object.freeze({__proto__:null,name:name$6,preprocess:preprocess$2});function assert$2(condition,message){if(!condition){throw new Error(message||'loaders.gl assertion failed.');}}var globals={self:typeof self!=='undefined'&&self,window:typeof window!=='undefined'&&window,global:typeof global!=='undefined'&&global,document:typeof document!=='undefined'&&document};var global_=globals.global||globals.self||globals.window||{};var isBrowser=(typeof process==="undefined"?"undefined":_typeof2(process))!=='object'||String(process)!=='[object process]'||process.browser;var isWorker=typeof importScripts==='function';var matches=typeof process!=='undefined'&&process.version&&/v([0-9]*)/.exec(process.version);matches&&parseFloat(matches[1])||0;var readFileAsArrayBuffer=null;var readFileAsText=null;var requireFromFile=null;var requireFromString=null;var node=/*#__PURE__*/Object.freeze({__proto__:null,readFileAsArrayBuffer:readFileAsArrayBuffer,readFileAsText:readFileAsText,requireFromFile:requireFromFile,requireFromString:requireFromString});var VERSION$2="3.4.15";var loadLibraryPromises={};function loadLibrary(_x67){return _loadLibrary.apply(this,arguments);}function _loadLibrary(){_loadLibrary=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee40(libraryUrl){var moduleName,options,_args36=arguments;return _regeneratorRuntime().wrap(function _callee40$(_context43){while(1)switch(_context43.prev=_context43.next){case 0:moduleName=_args36.length>1&&_args36[1]!==undefined?_args36[1]:null;options=_args36.length>2&&_args36[2]!==undefined?_args36[2]:{};if(moduleName){libraryUrl=getLibraryUrl(libraryUrl,moduleName,options);}loadLibraryPromises[libraryUrl]=loadLibraryPromises[libraryUrl]||loadLibraryFromFile(libraryUrl);_context43.next=6;return loadLibraryPromises[libraryUrl];case 6:return _context43.abrupt("return",_context43.sent);case 7:case"end":return _context43.stop();}},_callee40);}));return _loadLibrary.apply(this,arguments);}function getLibraryUrl(library,moduleName,options){if(library.startsWith('http')){return library;}var modules=options.modules||{};if(modules[library]){return modules[library];}if(!isBrowser){return"modules/".concat(moduleName,"/dist/libs/").concat(library);}if(options.CDN){assert$2(options.CDN.startsWith('http'));return"".concat(options.CDN,"/").concat(moduleName,"@").concat(VERSION$2,"/dist/libs/").concat(library);}if(isWorker){return"../src/libs/".concat(library);}return"modules/".concat(moduleName,"/src/libs/").concat(library);}function loadLibraryFromFile(_x68){return _loadLibraryFromFile.apply(this,arguments);}function _loadLibraryFromFile(){_loadLibraryFromFile=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee41(libraryUrl){var _response2,response,scriptSource;return _regeneratorRuntime().wrap(function _callee41$(_context44){while(1)switch(_context44.prev=_context44.next){case 0:if(!libraryUrl.endsWith('wasm')){_context44.next=7;break;}_context44.next=3;return fetch(libraryUrl);case 3:_response2=_context44.sent;_context44.next=6;return _response2.arrayBuffer();case 6:return _context44.abrupt("return",_context44.sent);case 7:if(isBrowser){_context44.next=20;break;}_context44.prev=8;_context44.t0=node&&requireFromFile;if(!_context44.t0){_context44.next=14;break;}_context44.next=13;return requireFromFile(libraryUrl);case 13:_context44.t0=_context44.sent;case 14:return _context44.abrupt("return",_context44.t0);case 17:_context44.prev=17;_context44.t1=_context44["catch"](8);return _context44.abrupt("return",null);case 20:if(!isWorker){_context44.next=22;break;}return _context44.abrupt("return",importScripts(libraryUrl));case 22:_context44.next=24;return fetch(libraryUrl);case 24:response=_context44.sent;_context44.next=27;return response.text();case 27:scriptSource=_context44.sent;return _context44.abrupt("return",loadLibraryFromString(scriptSource,libraryUrl));case 29:case"end":return _context44.stop();}},_callee41,null,[[8,17]]);}));return _loadLibraryFromFile.apply(this,arguments);}function loadLibraryFromString(scriptSource,id){if(!isBrowser){return requireFromString;}if(isWorker){eval.call(global_,scriptSource);return null;}var script=document.createElement('script');script.id=id;try{script.appendChild(document.createTextNode(scriptSource));}catch(e){script.text=scriptSource;}document.body.appendChild(script);return null;}var VERSION$1="3.4.15";var DEFAULT_DRACO_OPTIONS={draco:{decoderType:(typeof WebAssembly==="undefined"?"undefined":_typeof2(WebAssembly))==='object'?'wasm':'js',libraryPath:'libs/',extraAttributes:{},attributeNameEntry:undefined}};var DracoLoader$1={name:'Draco',id:isBrowser?'draco':'draco-nodejs',module:'draco',shapes:['mesh'],version:VERSION$1,worker:true,extensions:['drc'],mimeTypes:['application/octet-stream'],binary:true,tests:['DRACO'],options:DEFAULT_DRACO_OPTIONS};function getMeshBoundingBox(attributes){var minX=Infinity;var minY=Infinity;var minZ=Infinity;var maxX=-Infinity;var maxY=-Infinity;var maxZ=-Infinity;var positions=attributes.POSITION?attributes.POSITION.value:[];var len=positions&&positions.length;for(var _i514=0;_i514<len;_i514+=3){var x=positions[_i514];var y=positions[_i514+1];var _z4=positions[_i514+2];minX=x<minX?x:minX;minY=y<minY?y:minY;minZ=_z4<minZ?_z4:minZ;maxX=x>maxX?x:maxX;maxY=y>maxY?y:maxY;maxZ=_z4>maxZ?_z4:maxZ;}return[[minX,minY,minZ],[maxX,maxY,maxZ]];}function assert$1(condition,message){if(!condition){throw new Error(message||'loader assertion failed.');}}var Schema=/*#__PURE__*/function(){function Schema(fields,metadata){_classCallCheck(this,Schema);_defineProperty(this,"fields",void 0);_defineProperty(this,"metadata",void 0);assert$1(Array.isArray(fields));checkNames(fields);this.fields=fields;this.metadata=metadata||new Map();}return _createClass(Schema,[{key:"compareTo",value:function compareTo(other){if(this.metadata!==other.metadata){return false;}if(this.fields.length!==other.fields.length){return false;}for(var _i515=0;_i515<this.fields.length;++_i515){if(!this.fields[_i515].compareTo(other.fields[_i515])){return false;}}return true;}},{key:"select",value:function select(){var nameMap=Object.create(null);for(var _len=arguments.length,columnNames=new Array(_len),_key=0;_key<_len;_key++){columnNames[_key]=arguments[_key];}for(var _i516=0,_columnNames=columnNames;_i516<_columnNames.length;_i516++){var _name6=_columnNames[_i516];nameMap[_name6]=true;}var selectedFields=this.fields.filter(function(field){return nameMap[field.name];});return new Schema(selectedFields,this.metadata);}},{key:"selectAt",value:function selectAt(){var _this122=this;for(var _len2=arguments.length,columnIndices=new Array(_len2),_key2=0;_key2<_len2;_key2++){columnIndices[_key2]=arguments[_key2];}var selectedFields=columnIndices.map(function(index){return _this122.fields[index];}).filter(Boolean);return new Schema(selectedFields,this.metadata);}},{key:"assign",value:function assign(schemaOrFields){var fields;var metadata=this.metadata;if(schemaOrFields instanceof Schema){var otherSchema=schemaOrFields;fields=otherSchema.fields;metadata=mergeMaps(mergeMaps(new Map(),this.metadata),otherSchema.metadata);}else{fields=schemaOrFields;}var fieldMap=Object.create(null);var _iterator20=_createForOfIteratorHelper(this.fields),_step20;try{for(_iterator20.s();!(_step20=_iterator20.n()).done;){var field=_step20.value;fieldMap[field.name]=field;}}catch(err){_iterator20.e(err);}finally{_iterator20.f();}var _iterator21=_createForOfIteratorHelper(fields),_step21;try{for(_iterator21.s();!(_step21=_iterator21.n()).done;){var _field=_step21.value;fieldMap[_field.name]=_field;}}catch(err){_iterator21.e(err);}finally{_iterator21.f();}var mergedFields=Object.values(fieldMap);return new Schema(mergedFields,metadata);}}]);}();function checkNames(fields){var usedNames={};var _iterator22=_createForOfIteratorHelper(fields),_step22;try{for(_iterator22.s();!(_step22=_iterator22.n()).done;){var field=_step22.value;if(usedNames[field.name]){console.warn('Schema: duplicated field name',field.name,field);}usedNames[field.name]=true;}}catch(err){_iterator22.e(err);}finally{_iterator22.f();}}function mergeMaps(m1,m2){return new Map([].concat(_toConsumableArray(m1||new Map()),_toConsumableArray(m2||new Map())));}var Field=/*#__PURE__*/function(){function Field(name,type){_classCallCheck(this,Field);var nullable=arguments.length>2&&arguments[2]!==undefined?arguments[2]:false;var metadata=arguments.length>3&&arguments[3]!==undefined?arguments[3]:new Map();_defineProperty(this,"name",void 0);_defineProperty(this,"type",void 0);_defineProperty(this,"nullable",void 0);_defineProperty(this,"metadata",void 0);this.name=name;this.type=type;this.nullable=nullable;this.metadata=metadata;}return _createClass(Field,[{key:"typeId",get:function get(){return this.type&&this.type.typeId;}},{key:"clone",value:function clone(){return new Field(this.name,this.type,this.nullable,this.metadata);}},{key:"compareTo",value:function compareTo(other){return this.name===other.name&&this.type===other.type&&this.nullable===other.nullable&&this.metadata===other.metadata;}},{key:"toString",value:function toString(){return"".concat(this.type).concat(this.nullable?', nullable':'').concat(this.metadata?", metadata: ".concat(this.metadata):'');}}]);}();var Type=function(Type){Type[Type["NONE"]=0]="NONE";Type[Type["Null"]=1]="Null";Type[Type["Int"]=2]="Int";Type[Type["Float"]=3]="Float";Type[Type["Binary"]=4]="Binary";Type[Type["Utf8"]=5]="Utf8";Type[Type["Bool"]=6]="Bool";Type[Type["Decimal"]=7]="Decimal";Type[Type["Date"]=8]="Date";Type[Type["Time"]=9]="Time";Type[Type["Timestamp"]=10]="Timestamp";Type[Type["Interval"]=11]="Interval";Type[Type["List"]=12]="List";Type[Type["Struct"]=13]="Struct";Type[Type["Union"]=14]="Union";Type[Type["FixedSizeBinary"]=15]="FixedSizeBinary";Type[Type["FixedSizeList"]=16]="FixedSizeList";Type[Type["Map"]=17]="Map";Type[Type["Dictionary"]=-1]="Dictionary";Type[Type["Int8"]=-2]="Int8";Type[Type["Int16"]=-3]="Int16";Type[Type["Int32"]=-4]="Int32";Type[Type["Int64"]=-5]="Int64";Type[Type["Uint8"]=-6]="Uint8";Type[Type["Uint16"]=-7]="Uint16";Type[Type["Uint32"]=-8]="Uint32";Type[Type["Uint64"]=-9]="Uint64";Type[Type["Float16"]=-10]="Float16";Type[Type["Float32"]=-11]="Float32";Type[Type["Float64"]=-12]="Float64";Type[Type["DateDay"]=-13]="DateDay";Type[Type["DateMillisecond"]=-14]="DateMillisecond";Type[Type["TimestampSecond"]=-15]="TimestampSecond";Type[Type["TimestampMillisecond"]=-16]="TimestampMillisecond";Type[Type["TimestampMicrosecond"]=-17]="TimestampMicrosecond";Type[Type["TimestampNanosecond"]=-18]="TimestampNanosecond";Type[Type["TimeSecond"]=-19]="TimeSecond";Type[Type["TimeMillisecond"]=-20]="TimeMillisecond";Type[Type["TimeMicrosecond"]=-21]="TimeMicrosecond";Type[Type["TimeNanosecond"]=-22]="TimeNanosecond";Type[Type["DenseUnion"]=-23]="DenseUnion";Type[Type["SparseUnion"]=-24]="SparseUnion";Type[Type["IntervalDayTime"]=-25]="IntervalDayTime";Type[Type["IntervalYearMonth"]=-26]="IntervalYearMonth";return Type;}({});var _Symbol$toStringTag,_Symbol$toStringTag2,_Symbol$toStringTag7;var DataType=/*#__PURE__*/function(){function DataType(){_classCallCheck(this,DataType);}return _createClass(DataType,[{key:"typeId",get:function get(){return Type.NONE;}},{key:"compareTo",value:function compareTo(other){return this===other;}}],[{key:"isNull",value:function isNull(x){return x&&x.typeId===Type.Null;}},{key:"isInt",value:function isInt(x){return x&&x.typeId===Type.Int;}},{key:"isFloat",value:function isFloat(x){return x&&x.typeId===Type.Float;}},{key:"isBinary",value:function isBinary(x){return x&&x.typeId===Type.Binary;}},{key:"isUtf8",value:function isUtf8(x){return x&&x.typeId===Type.Utf8;}},{key:"isBool",value:function isBool(x){return x&&x.typeId===Type.Bool;}},{key:"isDecimal",value:function isDecimal(x){return x&&x.typeId===Type.Decimal;}},{key:"isDate",value:function isDate(x){return x&&x.typeId===Type.Date;}},{key:"isTime",value:function isTime(x){return x&&x.typeId===Type.Time;}},{key:"isTimestamp",value:function isTimestamp(x){return x&&x.typeId===Type.Timestamp;}},{key:"isInterval",value:function isInterval(x){return x&&x.typeId===Type.Interval;}},{key:"isList",value:function isList(x){return x&&x.typeId===Type.List;}},{key:"isStruct",value:function isStruct(x){return x&&x.typeId===Type.Struct;}},{key:"isUnion",value:function isUnion(x){return x&&x.typeId===Type.Union;}},{key:"isFixedSizeBinary",value:function isFixedSizeBinary(x){return x&&x.typeId===Type.FixedSizeBinary;}},{key:"isFixedSizeList",value:function isFixedSizeList(x){return x&&x.typeId===Type.FixedSizeList;}},{key:"isMap",value:function isMap(x){return x&&x.typeId===Type.Map;}},{key:"isDictionary",value:function isDictionary(x){return x&&x.typeId===Type.Dictionary;}}]);}();_Symbol$toStringTag=Symbol.toStringTag;var Int=/*#__PURE__*/function(_DataType,_Symbol$toStringTag3){function Int(isSigned,bitWidth){var _this123;_classCallCheck(this,Int);_this123=_callSuper(this,Int);_defineProperty(_this123,"isSigned",void 0);_defineProperty(_this123,"bitWidth",void 0);_this123.isSigned=isSigned;_this123.bitWidth=bitWidth;return _this123;}_inherits(Int,_DataType);return _createClass(Int,[{key:"typeId",get:function get(){return Type.Int;}},{key:_Symbol$toStringTag3,get:function get(){return'Int';}},{key:"toString",value:function toString(){return"".concat(this.isSigned?'I':'Ui',"nt").concat(this.bitWidth);}}]);}(DataType,_Symbol$toStringTag);var Int8=/*#__PURE__*/function(_Int){function Int8(){_classCallCheck(this,Int8);return _callSuper(this,Int8,[true,8]);}_inherits(Int8,_Int);return _createClass(Int8);}(Int);var Int16=/*#__PURE__*/function(_Int2){function Int16(){_classCallCheck(this,Int16);return _callSuper(this,Int16,[true,16]);}_inherits(Int16,_Int2);return _createClass(Int16);}(Int);var Int32=/*#__PURE__*/function(_Int3){function Int32(){_classCallCheck(this,Int32);return _callSuper(this,Int32,[true,32]);}_inherits(Int32,_Int3);return _createClass(Int32);}(Int);var Uint8=/*#__PURE__*/function(_Int4){function Uint8(){_classCallCheck(this,Uint8);return _callSuper(this,Uint8,[false,8]);}_inherits(Uint8,_Int4);return _createClass(Uint8);}(Int);var Uint16=/*#__PURE__*/function(_Int5){function Uint16(){_classCallCheck(this,Uint16);return _callSuper(this,Uint16,[false,16]);}_inherits(Uint16,_Int5);return _createClass(Uint16);}(Int);var Uint32=/*#__PURE__*/function(_Int6){function Uint32(){_classCallCheck(this,Uint32);return _callSuper(this,Uint32,[false,32]);}_inherits(Uint32,_Int6);return _createClass(Uint32);}(Int);var Precision={HALF:16,SINGLE:32,DOUBLE:64};_Symbol$toStringTag2=Symbol.toStringTag;var Float=/*#__PURE__*/function(_DataType2,_Symbol$toStringTag4){function Float(precision){var _this124;_classCallCheck(this,Float);_this124=_callSuper(this,Float);_defineProperty(_this124,"precision",void 0);_this124.precision=precision;return _this124;}_inherits(Float,_DataType2);return _createClass(Float,[{key:"typeId",get:function get(){return Type.Float;}},{key:_Symbol$toStringTag4,get:function get(){return'Float';}},{key:"toString",value:function toString(){return"Float".concat(this.precision);}}]);}(DataType,_Symbol$toStringTag2);var Float32=/*#__PURE__*/function(_Float){function Float32(){_classCallCheck(this,Float32);return _callSuper(this,Float32,[Precision.SINGLE]);}_inherits(Float32,_Float);return _createClass(Float32);}(Float);var Float64=/*#__PURE__*/function(_Float2){function Float64(){_classCallCheck(this,Float64);return _callSuper(this,Float64,[Precision.DOUBLE]);}_inherits(Float64,_Float2);return _createClass(Float64);}(Float);_Symbol$toStringTag7=Symbol.toStringTag;var FixedSizeList=/*#__PURE__*/function(_DataType3,_Symbol$toStringTag5){function FixedSizeList(listSize,child){var _this125;_classCallCheck(this,FixedSizeList);_this125=_callSuper(this,FixedSizeList);_defineProperty(_this125,"listSize",void 0);_defineProperty(_this125,"children",void 0);_this125.listSize=listSize;_this125.children=[child];return _this125;}_inherits(FixedSizeList,_DataType3);return _createClass(FixedSizeList,[{key:"typeId",get:function get(){return Type.FixedSizeList;}},{key:"valueType",get:function get(){return this.children[0].type;}},{key:"valueField",get:function get(){return this.children[0];}},{key:_Symbol$toStringTag5,get:function get(){return'FixedSizeList';}},{key:"toString",value:function toString(){return"FixedSizeList[".concat(this.listSize,"]<").concat(this.valueType,">");}}]);}(DataType,_Symbol$toStringTag7);function getArrowTypeFromTypedArray(array){switch(array.constructor){case Int8Array:return new Int8();case Uint8Array:return new Uint8();case Int16Array:return new Int16();case Uint16Array:return new Uint16();case Int32Array:return new Int32();case Uint32Array:return new Uint32();case Float32Array:return new Float32();case Float64Array:return new Float64();default:throw new Error('array type not supported');}}function deduceMeshField(attributeName,attribute,optionalMetadata){var type=getArrowTypeFromTypedArray(attribute.value);var metadata=optionalMetadata?optionalMetadata:makeMeshAttributeMetadata(attribute);var field=new Field(attributeName,new FixedSizeList(attribute.size,new Field('value',type)),false,metadata);return field;}function makeMeshAttributeMetadata(attribute){var result=new Map();if('byteOffset'in attribute){result.set('byteOffset',attribute.byteOffset.toString(10));}if('byteStride'in attribute){result.set('byteStride',attribute.byteStride.toString(10));}if('normalized'in attribute){result.set('normalized',attribute.normalized.toString());}return result;}function getDracoSchema(attributes,loaderData,indices){var metadataMap=makeMetadata(loaderData.metadata);var fields=[];var namedLoaderDataAttributes=transformAttributesLoaderData(loaderData.attributes);for(var attributeName in attributes){var attribute=attributes[attributeName];var field=getArrowFieldFromAttribute(attributeName,attribute,namedLoaderDataAttributes[attributeName]);fields.push(field);}if(indices){var indicesField=getArrowFieldFromAttribute('indices',indices);fields.push(indicesField);}return new Schema(fields,metadataMap);}function transformAttributesLoaderData(loaderData){var result={};for(var key in loaderData){var dracoAttribute=loaderData[key];result[dracoAttribute.name||'undefined']=dracoAttribute;}return result;}function getArrowFieldFromAttribute(attributeName,attribute,loaderData){var metadataMap=loaderData?makeMetadata(loaderData.metadata):undefined;var field=deduceMeshField(attributeName,attribute,metadataMap);return field;}function makeMetadata(metadata){var metadataMap=new Map();for(var key in metadata){metadataMap.set("".concat(key,".string"),JSON.stringify(metadata[key]));}return metadataMap;}var DRACO_TO_GLTF_ATTRIBUTE_NAME_MAP={POSITION:'POSITION',NORMAL:'NORMAL',COLOR:'COLOR_0',TEX_COORD:'TEXCOORD_0'};var DRACO_DATA_TYPE_TO_TYPED_ARRAY_MAP={1:Int8Array,2:Uint8Array,3:Int16Array,4:Uint16Array,5:Int32Array,6:Uint32Array,9:Float32Array};var INDEX_ITEM_SIZE=4;var DracoParser=/*#__PURE__*/function(){function DracoParser(draco){_classCallCheck(this,DracoParser);_defineProperty(this,"draco",void 0);_defineProperty(this,"decoder",void 0);_defineProperty(this,"metadataQuerier",void 0);this.draco=draco;this.decoder=new this.draco.Decoder();this.metadataQuerier=new this.draco.MetadataQuerier();}return _createClass(DracoParser,[{key:"destroy",value:function destroy(){this.draco.destroy(this.decoder);this.draco.destroy(this.metadataQuerier);}},{key:"parseSync",value:function parseSync(arrayBuffer){var options=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};var buffer=new this.draco.DecoderBuffer();buffer.Init(new Int8Array(arrayBuffer),arrayBuffer.byteLength);this._disableAttributeTransforms(options);var geometry_type=this.decoder.GetEncodedGeometryType(buffer);var dracoGeometry=geometry_type===this.draco.TRIANGULAR_MESH?new this.draco.Mesh():new this.draco.PointCloud();try{var dracoStatus;switch(geometry_type){case this.draco.TRIANGULAR_MESH:dracoStatus=this.decoder.DecodeBufferToMesh(buffer,dracoGeometry);break;case this.draco.POINT_CLOUD:dracoStatus=this.decoder.DecodeBufferToPointCloud(buffer,dracoGeometry);break;default:throw new Error('DRACO: Unknown geometry type.');}if(!dracoStatus.ok()||!dracoGeometry.ptr){var message="DRACO decompression failed: ".concat(dracoStatus.error_msg());throw new Error(message);}var loaderData=this._getDracoLoaderData(dracoGeometry,geometry_type,options);var geometry=this._getMeshData(dracoGeometry,loaderData,options);var boundingBox=getMeshBoundingBox(geometry.attributes);var schema=getDracoSchema(geometry.attributes,loaderData,geometry.indices);var data=_objectSpread(_objectSpread({loader:'draco',loaderData:loaderData,header:{vertexCount:dracoGeometry.num_points(),boundingBox:boundingBox}},geometry),{},{schema:schema});return data;}finally{this.draco.destroy(buffer);if(dracoGeometry){this.draco.destroy(dracoGeometry);}}}},{key:"_getDracoLoaderData",value:function _getDracoLoaderData(dracoGeometry,geometry_type,options){var metadata=this._getTopLevelMetadata(dracoGeometry);var attributes=this._getDracoAttributes(dracoGeometry,options);return{geometry_type:geometry_type,num_attributes:dracoGeometry.num_attributes(),num_points:dracoGeometry.num_points(),num_faces:dracoGeometry instanceof this.draco.Mesh?dracoGeometry.num_faces():0,metadata:metadata,attributes:attributes};}},{key:"_getDracoAttributes",value:function _getDracoAttributes(dracoGeometry,options){var dracoAttributes={};for(var attributeId=0;attributeId<dracoGeometry.num_attributes();attributeId++){var dracoAttribute=this.decoder.GetAttribute(dracoGeometry,attributeId);var metadata=this._getAttributeMetadata(dracoGeometry,attributeId);dracoAttributes[dracoAttribute.unique_id()]={unique_id:dracoAttribute.unique_id(),attribute_type:dracoAttribute.attribute_type(),data_type:dracoAttribute.data_type(),num_components:dracoAttribute.num_components(),byte_offset:dracoAttribute.byte_offset(),byte_stride:dracoAttribute.byte_stride(),normalized:dracoAttribute.normalized(),attribute_index:attributeId,metadata:metadata};var quantization=this._getQuantizationTransform(dracoAttribute,options);if(quantization){dracoAttributes[dracoAttribute.unique_id()].quantization_transform=quantization;}var octahedron=this._getOctahedronTransform(dracoAttribute,options);if(octahedron){dracoAttributes[dracoAttribute.unique_id()].octahedron_transform=octahedron;}}return dracoAttributes;}},{key:"_getMeshData",value:function _getMeshData(dracoGeometry,loaderData,options){var attributes=this._getMeshAttributes(loaderData,dracoGeometry,options);var positionAttribute=attributes.POSITION;if(!positionAttribute){throw new Error('DRACO: No position attribute found.');}if(dracoGeometry instanceof this.draco.Mesh){switch(options.topology){case'triangle-strip':return{topology:'triangle-strip',mode:4,attributes:attributes,indices:{value:this._getTriangleStripIndices(dracoGeometry),size:1}};case'triangle-list':default:return{topology:'triangle-list',mode:5,attributes:attributes,indices:{value:this._getTriangleListIndices(dracoGeometry),size:1}};}}return{topology:'point-list',mode:0,attributes:attributes};}},{key:"_getMeshAttributes",value:function _getMeshAttributes(loaderData,dracoGeometry,options){var attributes={};for(var _i517=0,_Object$values=Object.values(loaderData.attributes);_i517<_Object$values.length;_i517++){var loaderAttribute=_Object$values[_i517];var attributeName=this._deduceAttributeName(loaderAttribute,options);loaderAttribute.name=attributeName;var _this$_getAttributeVa=this._getAttributeValues(dracoGeometry,loaderAttribute),value=_this$_getAttributeVa.value,size=_this$_getAttributeVa.size;attributes[attributeName]={value:value,size:size,byteOffset:loaderAttribute.byte_offset,byteStride:loaderAttribute.byte_stride,normalized:loaderAttribute.normalized};}return attributes;}},{key:"_getTriangleListIndices",value:function _getTriangleListIndices(dracoGeometry){var numFaces=dracoGeometry.num_faces();var numIndices=numFaces*3;var byteLength=numIndices*INDEX_ITEM_SIZE;var ptr=this.draco._malloc(byteLength);try{this.decoder.GetTrianglesUInt32Array(dracoGeometry,byteLength,ptr);return new Uint32Array(this.draco.HEAPF32.buffer,ptr,numIndices).slice();}finally{this.draco._free(ptr);}}},{key:"_getTriangleStripIndices",value:function _getTriangleStripIndices(dracoGeometry){var dracoArray=new this.draco.DracoInt32Array();try{this.decoder.GetTriangleStripsFromMesh(dracoGeometry,dracoArray);return getUint32Array(dracoArray);}finally{this.draco.destroy(dracoArray);}}},{key:"_getAttributeValues",value:function _getAttributeValues(dracoGeometry,attribute){var TypedArrayCtor=DRACO_DATA_TYPE_TO_TYPED_ARRAY_MAP[attribute.data_type];var numComponents=attribute.num_components;var numPoints=dracoGeometry.num_points();var numValues=numPoints*numComponents;var byteLength=numValues*TypedArrayCtor.BYTES_PER_ELEMENT;var dataType=getDracoDataType(this.draco,TypedArrayCtor);var value;var ptr=this.draco._malloc(byteLength);try{var dracoAttribute=this.decoder.GetAttribute(dracoGeometry,attribute.attribute_index);this.decoder.GetAttributeDataArrayForAllPoints(dracoGeometry,dracoAttribute,dataType,byteLength,ptr);value=new TypedArrayCtor(this.draco.HEAPF32.buffer,ptr,numValues).slice();}finally{this.draco._free(ptr);}return{value:value,size:numComponents};}},{key:"_deduceAttributeName",value:function _deduceAttributeName(attribute,options){var uniqueId=attribute.unique_id;for(var _i518=0,_Object$entries4=Object.entries(options.extraAttributes||{});_i518<_Object$entries4.length;_i518++){var _Object$entries4$_i=_slicedToArray(_Object$entries4[_i518],2),attributeName=_Object$entries4$_i[0],attributeUniqueId=_Object$entries4$_i[1];if(attributeUniqueId===uniqueId){return attributeName;}}var thisAttributeType=attribute.attribute_type;for(var dracoAttributeConstant in DRACO_TO_GLTF_ATTRIBUTE_NAME_MAP){var attributeType=this.draco[dracoAttributeConstant];if(attributeType===thisAttributeType){return DRACO_TO_GLTF_ATTRIBUTE_NAME_MAP[dracoAttributeConstant];}}var entryName=options.attributeNameEntry||'name';if(attribute.metadata[entryName]){return attribute.metadata[entryName].string;}return"CUSTOM_ATTRIBUTE_".concat(uniqueId);}},{key:"_getTopLevelMetadata",value:function _getTopLevelMetadata(dracoGeometry){var dracoMetadata=this.decoder.GetMetadata(dracoGeometry);return this._getDracoMetadata(dracoMetadata);}},{key:"_getAttributeMetadata",value:function _getAttributeMetadata(dracoGeometry,attributeId){var dracoMetadata=this.decoder.GetAttributeMetadata(dracoGeometry,attributeId);return this._getDracoMetadata(dracoMetadata);}},{key:"_getDracoMetadata",value:function _getDracoMetadata(dracoMetadata){if(!dracoMetadata||!dracoMetadata.ptr){return{};}var result={};var numEntries=this.metadataQuerier.NumEntries(dracoMetadata);for(var entryIndex=0;entryIndex<numEntries;entryIndex++){var entryName=this.metadataQuerier.GetEntryName(dracoMetadata,entryIndex);result[entryName]=this._getDracoMetadataField(dracoMetadata,entryName);}return result;}},{key:"_getDracoMetadataField",value:function _getDracoMetadataField(dracoMetadata,entryName){var dracoArray=new this.draco.DracoInt32Array();try{this.metadataQuerier.GetIntEntryArray(dracoMetadata,entryName,dracoArray);var intArray=getInt32Array(dracoArray);return{"int":this.metadataQuerier.GetIntEntry(dracoMetadata,entryName),string:this.metadataQuerier.GetStringEntry(dracoMetadata,entryName),"double":this.metadataQuerier.GetDoubleEntry(dracoMetadata,entryName),intArray:intArray};}finally{this.draco.destroy(dracoArray);}}},{key:"_disableAttributeTransforms",value:function _disableAttributeTransforms(options){var _options$quantizedAtt=options.quantizedAttributes,quantizedAttributes=_options$quantizedAtt===void 0?[]:_options$quantizedAtt,_options$octahedronAt=options.octahedronAttributes,octahedronAttributes=_options$octahedronAt===void 0?[]:_options$octahedronAt;var skipAttributes=[].concat(_toConsumableArray(quantizedAttributes),_toConsumableArray(octahedronAttributes));var _iterator23=_createForOfIteratorHelper(skipAttributes),_step23;try{for(_iterator23.s();!(_step23=_iterator23.n()).done;){var dracoAttributeName=_step23.value;this.decoder.SkipAttributeTransform(this.draco[dracoAttributeName]);}}catch(err){_iterator23.e(err);}finally{_iterator23.f();}}},{key:"_getQuantizationTransform",value:function _getQuantizationTransform(dracoAttribute,options){var _this126=this;var _options$quantizedAtt2=options.quantizedAttributes,quantizedAttributes=_options$quantizedAtt2===void 0?[]:_options$quantizedAtt2;var attribute_type=dracoAttribute.attribute_type();var skip=quantizedAttributes.map(function(type){return _this126.decoder[type];}).includes(attribute_type);if(skip){var _transform2=new this.draco.AttributeQuantizationTransform();try{if(_transform2.InitFromAttribute(dracoAttribute)){return{quantization_bits:_transform2.quantization_bits(),range:_transform2.range(),min_values:new Float32Array([1,2,3]).map(function(i){return _transform2.min_value(i);})};}}finally{this.draco.destroy(_transform2);}}return null;}},{key:"_getOctahedronTransform",value:function _getOctahedronTransform(dracoAttribute,options){var _this127=this;var _options$octahedronAt2=options.octahedronAttributes,octahedronAttributes=_options$octahedronAt2===void 0?[]:_options$octahedronAt2;var attribute_type=dracoAttribute.attribute_type();var octahedron=octahedronAttributes.map(function(type){return _this127.decoder[type];}).includes(attribute_type);if(octahedron){var _transform3=new this.draco.AttributeQuantizationTransform();try{if(_transform3.InitFromAttribute(dracoAttribute)){return{quantization_bits:_transform3.quantization_bits()};}}finally{this.draco.destroy(_transform3);}}return null;}}]);}();function getDracoDataType(draco,attributeType){switch(attributeType){case Float32Array:return draco.DT_FLOAT32;case Int8Array:return draco.DT_INT8;case Int16Array:return draco.DT_INT16;case Int32Array:return draco.DT_INT32;case Uint8Array:return draco.DT_UINT8;case Uint16Array:return draco.DT_UINT16;case Uint32Array:return draco.DT_UINT32;default:return draco.DT_INVALID;}}function getInt32Array(dracoArray){var numValues=dracoArray.size();var intArray=new Int32Array(numValues);for(var _i519=0;_i519<numValues;_i519++){intArray[_i519]=dracoArray.GetValue(_i519);}return intArray;}function getUint32Array(dracoArray){var numValues=dracoArray.size();var intArray=new Int32Array(numValues);for(var _i520=0;_i520<numValues;_i520++){intArray[_i520]=dracoArray.GetValue(_i520);}return intArray;}var DRACO_DECODER_VERSION='1.5.5';var STATIC_DECODER_URL="https://www.gstatic.com/draco/versioned/decoders/".concat(DRACO_DECODER_VERSION);var DRACO_JS_DECODER_URL="".concat(STATIC_DECODER_URL,"/draco_decoder.js");var DRACO_WASM_WRAPPER_URL="".concat(STATIC_DECODER_URL,"/draco_wasm_wrapper.js");var DRACO_WASM_DECODER_URL="".concat(STATIC_DECODER_URL,"/draco_decoder.wasm");var loadDecoderPromise;function loadDracoDecoderModule(_x69){return _loadDracoDecoderModule.apply(this,arguments);}function _loadDracoDecoderModule(){_loadDracoDecoderModule=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee42(options){var modules;return _regeneratorRuntime().wrap(function _callee42$(_context45){while(1)switch(_context45.prev=_context45.next){case 0:modules=options.modules||{};if(modules.draco3d){loadDecoderPromise=loadDecoderPromise||modules.draco3d.createDecoderModule({}).then(function(draco){return{draco:draco};});}else{loadDecoderPromise=loadDecoderPromise||loadDracoDecoder(options);}_context45.next=4;return loadDecoderPromise;case 4:return _context45.abrupt("return",_context45.sent);case 5:case"end":return _context45.stop();}},_callee42);}));return _loadDracoDecoderModule.apply(this,arguments);}function loadDracoDecoder(_x70){return _loadDracoDecoder.apply(this,arguments);}function _loadDracoDecoder(){_loadDracoDecoder=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee43(options){var DracoDecoderModule,wasmBinary,_yield$Promise$all5,_yield$Promise$all6;return _regeneratorRuntime().wrap(function _callee43$(_context46){while(1)switch(_context46.prev=_context46.next){case 0:_context46.t0=options.draco&&options.draco.decoderType;_context46.next=_context46.t0==='js'?3:_context46.t0==='wasm'?7:7;break;case 3:_context46.next=5;return loadLibrary(DRACO_JS_DECODER_URL,'draco',options);case 5:DracoDecoderModule=_context46.sent;return _context46.abrupt("break",21);case 7:_context46.t1=Promise;_context46.next=10;return loadLibrary(DRACO_WASM_WRAPPER_URL,'draco',options);case 10:_context46.t2=_context46.sent;_context46.next=13;return loadLibrary(DRACO_WASM_DECODER_URL,'draco',options);case 13:_context46.t3=_context46.sent;_context46.t4=[_context46.t2,_context46.t3];_context46.next=17;return _context46.t1.all.call(_context46.t1,_context46.t4);case 17:_yield$Promise$all5=_context46.sent;_yield$Promise$all6=_slicedToArray(_yield$Promise$all5,2);DracoDecoderModule=_yield$Promise$all6[0];wasmBinary=_yield$Promise$all6[1];case 21:DracoDecoderModule=DracoDecoderModule||globalThis.DracoDecoderModule;_context46.next=24;return initializeDracoDecoder(DracoDecoderModule,wasmBinary);case 24:return _context46.abrupt("return",_context46.sent);case 25:case"end":return _context46.stop();}},_callee43);}));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});}}));});}({id:isBrowser?'draco-writer':'draco-writer-nodejs',name:'Draco compressed geometry writer',module:'draco',version:VERSION$1,worker:true,options:{draco:{},source:null}});var DracoLoader=_objectSpread(_objectSpread({},DracoLoader$1),{},{parse:parse$1});function parse$1(_x71,_x72){return _parse$2.apply(this,arguments);}function _parse$2(){_parse$2=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee44(arrayBuffer,options){var _yield$loadDracoDecod,draco,dracoParser;return _regeneratorRuntime().wrap(function _callee44$(_context47){while(1)switch(_context47.prev=_context47.next){case 0:_context47.next=2;return loadDracoDecoderModule(options);case 2:_yield$loadDracoDecod=_context47.sent;draco=_yield$loadDracoDecod.draco;dracoParser=new DracoParser(draco);_context47.prev=5;return _context47.abrupt("return",dracoParser.parseSync(arrayBuffer,options===null||options===void 0?void 0:options.draco));case 7:_context47.prev=7;dracoParser.destroy();return _context47.finish(7);case 10:case"end":return _context47.stop();}},_callee44,null,[[5,,7,10]]);}));return _parse$2.apply(this,arguments);}function getGLTFAccessors(attributes){var accessors={};for(var _name7 in attributes){var attribute=attributes[_name7];if(_name7!=='indices'){var glTFAccessor=getGLTFAccessor(attribute);accessors[_name7]=glTFAccessor;}}return accessors;}function getGLTFAccessor(attribute){var _getAccessorData=getAccessorData(attribute),buffer=_getAccessorData.buffer,size=_getAccessorData.size,count=_getAccessorData.count;var glTFAccessor={value:buffer,size:size,byteOffset:0,count:count,type:getAccessorTypeFromSize(size),componentType:getComponentTypeFromArray(buffer)};return glTFAccessor;}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};}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;}var KHR_DRACO_MESH_COMPRESSION='KHR_draco_mesh_compression';var name$5=KHR_DRACO_MESH_COMPRESSION;function preprocess$1(gltfData,options,context){var scenegraph=new GLTFScenegraph(gltfData);var _iterator24=_createForOfIteratorHelper(makeMeshPrimitiveIterator(scenegraph)),_step24;try{for(_iterator24.s();!(_step24=_iterator24.n()).done;){var _primitive=_step24.value;if(scenegraph.getObjectExtension(_primitive,KHR_DRACO_MESH_COMPRESSION));}}catch(err){_iterator24.e(err);}finally{_iterator24.f();}}function decode$5(_x73,_x74,_x75){return _decode$2.apply(this,arguments);}function _decode$2(){_decode$2=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee45(gltfData,options,context){var _options$gltf,scenegraph,promises,_iterator45,_step45,_primitive6;return _regeneratorRuntime().wrap(function _callee45$(_context48){while(1)switch(_context48.prev=_context48.next){case 0:if(options!==null&&options!==void 0&&(_options$gltf=options.gltf)!==null&&_options$gltf!==void 0&&_options$gltf.decompressMeshes){_context48.next=2;break;}return _context48.abrupt("return");case 2:scenegraph=new GLTFScenegraph(gltfData);promises=[];_iterator45=_createForOfIteratorHelper(makeMeshPrimitiveIterator(scenegraph));try{for(_iterator45.s();!(_step45=_iterator45.n()).done;){_primitive6=_step45.value;if(scenegraph.getObjectExtension(_primitive6,KHR_DRACO_MESH_COMPRESSION)){promises.push(decompressPrimitive(scenegraph,_primitive6,options,context));}}}catch(err){_iterator45.e(err);}finally{_iterator45.f();}_context48.next=8;return Promise.all(promises);case 8:scenegraph.removeExtension(KHR_DRACO_MESH_COMPRESSION);case 9:case"end":return _context48.stop();}},_callee45);}));return _decode$2.apply(this,arguments);}function encode$3(gltfData){var options=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};var scenegraph=new GLTFScenegraph(gltfData);var _iterator25=_createForOfIteratorHelper(scenegraph.json.meshes||[]),_step25;try{for(_iterator25.s();!(_step25=_iterator25.n()).done;){var _mesh4=_step25.value;compressMesh(_mesh4,options);scenegraph.addRequiredExtension(KHR_DRACO_MESH_COMPRESSION);}}catch(err){_iterator25.e(err);}finally{_iterator25.f();}}function decompressPrimitive(_x76,_x77,_x78,_x79){return _decompressPrimitive.apply(this,arguments);}function _decompressPrimitive(){_decompressPrimitive=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee46(scenegraph,primitive,options,context){var dracoExtension,buffer,bufferCopy,parse,dracoOptions,decodedData,decodedAttributes,_i637,_Object$entries5,_Object$entries5$_i,attributeName,decodedAttribute,accessorIndex,accessor;return _regeneratorRuntime().wrap(function _callee46$(_context49){while(1)switch(_context49.prev=_context49.next){case 0:dracoExtension=scenegraph.getObjectExtension(primitive,KHR_DRACO_MESH_COMPRESSION);if(dracoExtension){_context49.next=3;break;}return _context49.abrupt("return");case 3:buffer=scenegraph.getTypedArrayForBufferView(dracoExtension.bufferView);bufferCopy=sliceArrayBuffer(buffer.buffer,buffer.byteOffset);parse=context.parse;dracoOptions=_objectSpread({},options);delete dracoOptions['3d-tiles'];_context49.next=10;return parse(bufferCopy,DracoLoader,dracoOptions,context);case 10:decodedData=_context49.sent;decodedAttributes=getGLTFAccessors(decodedData.attributes);for(_i637=0,_Object$entries5=Object.entries(decodedAttributes);_i637<_Object$entries5.length;_i637++){_Object$entries5$_i=_slicedToArray(_Object$entries5[_i637],2),attributeName=_Object$entries5$_i[0],decodedAttribute=_Object$entries5$_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;}}}primitive.attributes=decodedAttributes;if(decodedData.indices){primitive.indices=getGLTFAccessor(decodedData.indices);}checkPrimitive(primitive);case 16:case"end":return _context49.stop();}},_callee46);}));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');}var compressedData=options.DracoWriter.encodeSync({attributes:attributes});var decodedData=context===null||context===void 0?void 0:(_context$parseSync=context.parseSync)===null||_context$parseSync===void 0?void 0:_context$parseSync.call(context,{attributes:attributes});var fauxAccessors=options._addFauxAttributes(decodedData.attributes);var bufferViewIndex=options.addBufferView(compressedData);var glTFMesh={primitives:[{attributes:fauxAccessors,mode:mode,extensions:_defineProperty2({},KHR_DRACO_MESH_COMPRESSION,{bufferView:bufferViewIndex,attributes:fauxAccessors})}]};return glTFMesh;}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 _iterator26,_step26,_mesh5,_iterator27,_step27,_primitive2;return _regeneratorRuntime().wrap(function makeMeshPrimitiveIterator$(_context10){while(1)switch(_context10.prev=_context10.next){case 0:_iterator26=_createForOfIteratorHelper(scenegraph.json.meshes||[]);_context10.prev=1;_iterator26.s();case 3:if((_step26=_iterator26.n()).done){_context10.next=24;break;}_mesh5=_step26.value;_iterator27=_createForOfIteratorHelper(_mesh5.primitives);_context10.prev=6;_iterator27.s();case 8:if((_step27=_iterator27.n()).done){_context10.next=14;break;}_primitive2=_step27.value;_context10.next=12;return _primitive2;case 12:_context10.next=8;break;case 14:_context10.next=19;break;case 16:_context10.prev=16;_context10.t0=_context10["catch"](6);_iterator27.e(_context10.t0);case 19:_context10.prev=19;_iterator27.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);_iterator26.e(_context10.t1);case 29:_context10.prev=29;_iterator26.f();return _context10.finish(29);case 32:case"end":return _context10.stop();}},_marked2,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$5,encode:encode$3});function assert(condition,message){if(!condition){throw new Error("math.gl assertion ".concat(message));}}var config={EPSILON:1e-12,debug:false,precision:4,printTypes:false,printDegrees:false,printRowMajor:true};function formatValue(value){var _ref17=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{},_ref17$precision=_ref17.precision,precision=_ref17$precision===void 0?config.precision:_ref17$precision;value=round(value);return"".concat(parseFloat(value.toPrecision(precision)));}function isArray(value){return Array.isArray(value)||ArrayBuffer.isView(value)&&!(value instanceof DataView);}function _equals(a,b,epsilon){var oldEpsilon=config.EPSILON;if(epsilon){config.EPSILON=epsilon;}try{if(a===b){return true;}if(isArray(a)&&isArray(b)){if(a.length!==b.length){return false;}for(var _i521=0;_i521<a.length;++_i521){if(!_equals(a[_i521],b[_i521])){return false;}}return true;}if(a&&a.equals){return a.equals(b);}if(b&&b.equals){return b.equals(a);}if(typeof a==='number'&&typeof b==='number'){return Math.abs(a-b)<=config.EPSILON*Math.max(1,Math.abs(a),Math.abs(b));}return false;}finally{config.EPSILON=oldEpsilon;}}function round(value){return Math.round(value/config.EPSILON)*config.EPSILON;}function _extendableBuiltin(cls){function ExtendableBuiltin(){var instance=Reflect.construct(cls,Array.from(arguments));Object.setPrototypeOf(instance,Object.getPrototypeOf(this));return instance;}ExtendableBuiltin.prototype=Object.create(cls.prototype,{constructor:{value:cls,enumerable:false,writable:true,configurable:true}});if(Object.setPrototypeOf){Object.setPrototypeOf(ExtendableBuiltin,cls);}else{ExtendableBuiltin.__proto__=cls;}return ExtendableBuiltin;}var MathArray=/*#__PURE__*/function(_extendableBuiltin2){function MathArray(){_classCallCheck(this,MathArray);return _callSuper(this,MathArray,arguments);}_inherits(MathArray,_extendableBuiltin2);return _createClass(MathArray,[{key:"clone",value:function clone(){return new this.constructor().copy(this);}},{key:"fromArray",value:function fromArray(array){var offset=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0;for(var _i522=0;_i522<this.ELEMENTS;++_i522){this[_i522]=array[_i522+offset];}return this.check();}},{key:"toArray",value:function toArray(){var targetArray=arguments.length>0&&arguments[0]!==undefined?arguments[0]:[];var offset=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0;for(var _i523=0;_i523<this.ELEMENTS;++_i523){targetArray[offset+_i523]=this[_i523];}return targetArray;}},{key:"from",value:function from(arrayOrObject){return Array.isArray(arrayOrObject)?this.copy(arrayOrObject):this.fromObject(arrayOrObject);}},{key:"to",value:function to(arrayOrObject){if(arrayOrObject===this){return this;}return isArray(arrayOrObject)?this.toArray(arrayOrObject):this.toObject(arrayOrObject);}},{key:"toTarget",value:function toTarget(target){return target?this.to(target):this;}},{key:"toFloat32Array",value:function toFloat32Array(){return new Float32Array(this);}},{key:"toString",value:function toString(){return this.formatString(config);}},{key:"formatString",value:function formatString(opts){var string='';for(var _i524=0;_i524<this.ELEMENTS;++_i524){string+=(_i524>0?', ':'')+formatValue(this[_i524],opts);}return"".concat(opts.printTypes?this.constructor.name:'',"[").concat(string,"]");}},{key:"equals",value:function equals(array){if(!array||this.length!==array.length){return false;}for(var _i525=0;_i525<this.ELEMENTS;++_i525){if(!_equals(this[_i525],array[_i525])){return false;}}return true;}},{key:"exactEquals",value:function exactEquals(array){if(!array||this.length!==array.length){return false;}for(var _i526=0;_i526<this.ELEMENTS;++_i526){if(this[_i526]!==array[_i526]){return false;}}return true;}},{key:"negate",value:function negate(){for(var _i527=0;_i527<this.ELEMENTS;++_i527){this[_i527]=-this[_i527];}return this.check();}},{key:"lerp",value:function lerp(a,b,t){if(t===undefined){return this.lerp(this,a,b);}for(var _i528=0;_i528<this.ELEMENTS;++_i528){var ai=a[_i528];this[_i528]=ai+t*(b[_i528]-ai);}return this.check();}},{key:"min",value:function min(vector){for(var _i529=0;_i529<this.ELEMENTS;++_i529){this[_i529]=Math.min(vector[_i529],this[_i529]);}return this.check();}},{key:"max",value:function max(vector){for(var _i530=0;_i530<this.ELEMENTS;++_i530){this[_i530]=Math.max(vector[_i530],this[_i530]);}return this.check();}},{key:"clamp",value:function clamp(minVector,maxVector){for(var _i531=0;_i531<this.ELEMENTS;++_i531){this[_i531]=Math.min(Math.max(this[_i531],minVector[_i531]),maxVector[_i531]);}return this.check();}},{key:"add",value:function add(){for(var _len101=arguments.length,vectors=new Array(_len101),_key8=0;_key8<_len101;_key8++){vectors[_key8]=arguments[_key8];}for(var _i532=0,_vectors=vectors;_i532<_vectors.length;_i532++){var vector=_vectors[_i532];for(var _i533=0;_i533<this.ELEMENTS;++_i533){this[_i533]+=vector[_i533];}}return this.check();}},{key:"subtract",value:function subtract(){for(var _len102=arguments.length,vectors=new Array(_len102),_key9=0;_key9<_len102;_key9++){vectors[_key9]=arguments[_key9];}for(var _i534=0,_vectors2=vectors;_i534<_vectors2.length;_i534++){var vector=_vectors2[_i534];for(var _i535=0;_i535<this.ELEMENTS;++_i535){this[_i535]-=vector[_i535];}}return this.check();}},{key:"scale",value:function scale(_scale7){if(typeof _scale7==='number'){for(var _i536=0;_i536<this.ELEMENTS;++_i536){this[_i536]*=_scale7;}}else{for(var _i537=0;_i537<this.ELEMENTS&&_i537<_scale7.length;++_i537){this[_i537]*=_scale7[_i537];}}return this.check();}},{key:"multiplyByScalar",value:function multiplyByScalar(scalar){for(var _i538=0;_i538<this.ELEMENTS;++_i538){this[_i538]*=scalar;}return this.check();}},{key:"check",value:function check(){if(config.debug&&!this.validate()){throw new Error("math.gl: ".concat(this.constructor.name," some fields set to invalid numbers'"));}return this;}},{key:"validate",value:function validate(){var valid=this.length===this.ELEMENTS;for(var _i539=0;_i539<this.ELEMENTS;++_i539){valid=valid&&Number.isFinite(this[_i539]);}return valid;}},{key:"sub",value:function sub(a){return this.subtract(a);}},{key:"setScalar",value:function setScalar(a){for(var _i540=0;_i540<this.ELEMENTS;++_i540){this[_i540]=a;}return this.check();}},{key:"addScalar",value:function addScalar(a){for(var _i541=0;_i541<this.ELEMENTS;++_i541){this[_i541]+=a;}return this.check();}},{key:"subScalar",value:function subScalar(a){return this.addScalar(-a);}},{key:"multiplyScalar",value:function multiplyScalar(scalar){for(var _i542=0;_i542<this.ELEMENTS;++_i542){this[_i542]*=scalar;}return this.check();}},{key:"divideScalar",value:function divideScalar(a){return this.multiplyByScalar(1/a);}},{key:"clampScalar",value:function clampScalar(min,max){for(var _i543=0;_i543<this.ELEMENTS;++_i543){this[_i543]=Math.min(Math.max(this[_i543],min),max);}return this.check();}},{key:"elements",get:function get(){return this;}}]);}(_extendableBuiltin(Array));function validateVector(v,length){if(v.length!==length){return false;}for(var _i544=0;_i544<v.length;++_i544){if(!Number.isFinite(v[_i544])){return false;}}return true;}function checkNumber(value){if(!Number.isFinite(value)){throw new Error("Invalid number ".concat(value));}return value;}function checkVector(v,length){var callerName=arguments.length>2&&arguments[2]!==undefined?arguments[2]:'';if(config.debug&&!validateVector(v,length)){throw new Error("math.gl: ".concat(callerName," some fields set to invalid numbers'"));}return v;}var Vector=/*#__PURE__*/function(_MathArray){function Vector(){_classCallCheck(this,Vector);return _callSuper(this,Vector,arguments);}_inherits(Vector,_MathArray);return _createClass(Vector,[{key:"x",get:function get(){return this[0];},set:function set(value){this[0]=checkNumber(value);}},{key:"y",get:function get(){return this[1];},set:function set(value){this[1]=checkNumber(value);}},{key:"len",value:function len(){return Math.sqrt(this.lengthSquared());}},{key:"magnitude",value:function magnitude(){return this.len();}},{key:"lengthSquared",value:function lengthSquared(){var length=0;for(var _i545=0;_i545<this.ELEMENTS;++_i545){length+=this[_i545]*this[_i545];}return length;}},{key:"magnitudeSquared",value:function magnitudeSquared(){return this.lengthSquared();}},{key:"distance",value:function distance(mathArray){return Math.sqrt(this.distanceSquared(mathArray));}},{key:"distanceSquared",value:function distanceSquared(mathArray){var length=0;for(var _i546=0;_i546<this.ELEMENTS;++_i546){var dist=this[_i546]-mathArray[_i546];length+=dist*dist;}return checkNumber(length);}},{key:"dot",value:function dot(mathArray){var product=0;for(var _i547=0;_i547<this.ELEMENTS;++_i547){product+=this[_i547]*mathArray[_i547];}return checkNumber(product);}},{key:"normalize",value:function normalize(){var length=this.magnitude();if(length!==0){for(var _i548=0;_i548<this.ELEMENTS;++_i548){this[_i548]/=length;}}return this.check();}},{key:"multiply",value:function multiply(){for(var _len103=arguments.length,vectors=new Array(_len103),_key10=0;_key10<_len103;_key10++){vectors[_key10]=arguments[_key10];}for(var _i549=0,_vectors3=vectors;_i549<_vectors3.length;_i549++){var vector=_vectors3[_i549];for(var _i550=0;_i550<this.ELEMENTS;++_i550){this[_i550]*=vector[_i550];}}return this.check();}},{key:"divide",value:function divide(){for(var _len104=arguments.length,vectors=new Array(_len104),_key11=0;_key11<_len104;_key11++){vectors[_key11]=arguments[_key11];}for(var _i551=0,_vectors4=vectors;_i551<_vectors4.length;_i551++){var vector=_vectors4[_i551];for(var _i552=0;_i552<this.ELEMENTS;++_i552){this[_i552]/=vector[_i552];}}return this.check();}},{key:"lengthSq",value:function lengthSq(){return this.lengthSquared();}},{key:"distanceTo",value:function distanceTo(vector){return this.distance(vector);}},{key:"distanceToSquared",value:function distanceToSquared(vector){return this.distanceSquared(vector);}},{key:"getComponent",value:function getComponent(i){assert(i>=0&&i<this.ELEMENTS,'index is out of range');return checkNumber(this[i]);}},{key:"setComponent",value:function setComponent(i,value){assert(i>=0&&i<this.ELEMENTS,'index is out of range');this[i]=value;return this.check();}},{key:"addVectors",value:function addVectors(a,b){return this.copy(a).add(b);}},{key:"subVectors",value:function subVectors(a,b){return this.copy(a).subtract(b);}},{key:"multiplyVectors",value:function multiplyVectors(a,b){return this.copy(a).multiply(b);}},{key:"addScaledVector",value:function addScaledVector(a,b){return this.add(new this.constructor(a).multiplyScalar(b));}}]);}(MathArray);/**
24798
25045
  * Common utilities
24799
25046
  * @module glMatrix
24800
25047
  */var ARRAY_TYPE=typeof Float32Array!=='undefined'?Float32Array:Array;if(!Math.hypot)Math.hypot=function(){var y=0,i=arguments.length;while(i--){y+=arguments[i]*arguments[i];}return Math.sqrt(y);};/**
@@ -24919,7 +25166,7 @@ out[0]=r[0]+b[0];out[1]=r[1]+b[1];out[2]=r[2]+b[2];return out;}/**
24919
25166
  * @param {Object} [arg] additional argument to pass to fn
24920
25167
  * @returns {Array} a
24921
25168
  * @function
24922
- */(function(){var vec=create();return function(a,stride,offset,count,fn,arg){var i,l;if(!stride){stride=3;}if(!offset){offset=0;}if(count){l=Math.min(count*stride+offset,a.length);}else{l=a.length;}for(i=offset;i<l;i+=stride){vec[0]=a[i];vec[1]=a[i+1];vec[2]=a[i+2];fn(vec,vec,arg);a[i]=vec[0];a[i+1]=vec[1];a[i+2]=vec[2];}return a;};})();var ORIGIN=[0,0,0];var ZERO;var Vector3=/*#__PURE__*/function(_Vector){function Vector3(){var _this127;var x=arguments.length>0&&arguments[0]!==undefined?arguments[0]:0;var y=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0;var z=arguments.length>2&&arguments[2]!==undefined?arguments[2]:0;_classCallCheck(this,Vector3);_this127=_callSuper(this,Vector3,[-0,-0,-0]);if(arguments.length===1&&isArray(x)){_this127.copy(x);}else{if(config.debug){checkNumber(x);checkNumber(y);checkNumber(z);}_this127[0]=x;_this127[1]=y;_this127[2]=z;}return _this127;}_inherits(Vector3,_Vector);return _createClass(Vector3,[{key:"set",value:function set(x,y,z){this[0]=x;this[1]=y;this[2]=z;return this.check();}},{key:"copy",value:function copy(array){this[0]=array[0];this[1]=array[1];this[2]=array[2];return this.check();}},{key:"fromObject",value:function fromObject(object){if(config.debug){checkNumber(object.x);checkNumber(object.y);checkNumber(object.z);}this[0]=object.x;this[1]=object.y;this[2]=object.z;return this.check();}},{key:"toObject",value:function toObject(object){object.x=this[0];object.y=this[1];object.z=this[2];return object;}},{key:"ELEMENTS",get:function get(){return 3;}},{key:"z",get:function get(){return this[2];},set:function set(value){this[2]=checkNumber(value);}},{key:"angle",value:function angle(vector){return _angle3(this,vector);}},{key:"cross",value:function cross(vector){_cross(this,this,vector);return this.check();}},{key:"rotateX",value:function rotateX(_ref18){var radians=_ref18.radians,_ref18$origin=_ref18.origin,origin=_ref18$origin===void 0?ORIGIN:_ref18$origin;_rotateX(this,this,origin,radians);return this.check();}},{key:"rotateY",value:function rotateY(_ref19){var radians=_ref19.radians,_ref19$origin=_ref19.origin,origin=_ref19$origin===void 0?ORIGIN:_ref19$origin;_rotateY(this,this,origin,radians);return this.check();}},{key:"rotateZ",value:function rotateZ(_ref20){var radians=_ref20.radians,_ref20$origin=_ref20.origin,origin=_ref20$origin===void 0?ORIGIN:_ref20$origin;_rotateZ(this,this,origin,radians);return this.check();}},{key:"transform",value:function transform(matrix4){return this.transformAsPoint(matrix4);}},{key:"transformAsPoint",value:function transformAsPoint(matrix4){transformMat4(this,this,matrix4);return this.check();}},{key:"transformAsVector",value:function transformAsVector(matrix4){vec3_transformMat4AsVector(this,this,matrix4);return this.check();}},{key:"transformByMatrix3",value:function transformByMatrix3(matrix3){transformMat3(this,this,matrix3);return this.check();}},{key:"transformByMatrix2",value:function transformByMatrix2(matrix2){vec3_transformMat2(this,this,matrix2);return this.check();}},{key:"transformByQuaternion",value:function transformByQuaternion(quaternion){transformQuat(this,this,quaternion);return this.check();}}],[{key:"ZERO",get:function get(){if(!ZERO){ZERO=new Vector3(0,0,0);Object.freeze(ZERO);}return ZERO;}}]);}(Vector);var Matrix=/*#__PURE__*/function(_MathArray2){function Matrix(){_classCallCheck(this,Matrix);return _callSuper(this,Matrix,arguments);}_inherits(Matrix,_MathArray2);return _createClass(Matrix,[{key:"toString",value:function toString(){var string='[';if(config.printRowMajor){string+='row-major:';for(var row=0;row<this.RANK;++row){for(var col=0;col<this.RANK;++col){string+=" ".concat(this[col*this.RANK+row]);}}}else{string+='column-major:';for(var _i553=0;_i553<this.ELEMENTS;++_i553){string+=" ".concat(this[_i553]);}}string+=']';return string;}},{key:"getElementIndex",value:function getElementIndex(row,col){return col*this.RANK+row;}},{key:"getElement",value:function getElement(row,col){return this[col*this.RANK+row];}},{key:"setElement",value:function setElement(row,col,value){this[col*this.RANK+row]=checkNumber(value);return this;}},{key:"getColumn",value:function getColumn(columnIndex){var result=arguments.length>1&&arguments[1]!==undefined?arguments[1]:new Array(this.RANK).fill(-0);var firstIndex=columnIndex*this.RANK;for(var _i554=0;_i554<this.RANK;++_i554){result[_i554]=this[firstIndex+_i554];}return result;}},{key:"setColumn",value:function setColumn(columnIndex,columnVector){var firstIndex=columnIndex*this.RANK;for(var _i555=0;_i555<this.RANK;++_i555){this[firstIndex+_i555]=columnVector[_i555];}return this;}}]);}(MathArray);/**
25169
+ */(function(){var vec=create();return function(a,stride,offset,count,fn,arg){var i,l;if(!stride){stride=3;}if(!offset){offset=0;}if(count){l=Math.min(count*stride+offset,a.length);}else{l=a.length;}for(i=offset;i<l;i+=stride){vec[0]=a[i];vec[1]=a[i+1];vec[2]=a[i+2];fn(vec,vec,arg);a[i]=vec[0];a[i+1]=vec[1];a[i+2]=vec[2];}return a;};})();var ORIGIN=[0,0,0];var ZERO;var Vector3=/*#__PURE__*/function(_Vector){function Vector3(){var _this128;var x=arguments.length>0&&arguments[0]!==undefined?arguments[0]:0;var y=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0;var z=arguments.length>2&&arguments[2]!==undefined?arguments[2]:0;_classCallCheck(this,Vector3);_this128=_callSuper(this,Vector3,[-0,-0,-0]);if(arguments.length===1&&isArray(x)){_this128.copy(x);}else{if(config.debug){checkNumber(x);checkNumber(y);checkNumber(z);}_this128[0]=x;_this128[1]=y;_this128[2]=z;}return _this128;}_inherits(Vector3,_Vector);return _createClass(Vector3,[{key:"set",value:function set(x,y,z){this[0]=x;this[1]=y;this[2]=z;return this.check();}},{key:"copy",value:function copy(array){this[0]=array[0];this[1]=array[1];this[2]=array[2];return this.check();}},{key:"fromObject",value:function fromObject(object){if(config.debug){checkNumber(object.x);checkNumber(object.y);checkNumber(object.z);}this[0]=object.x;this[1]=object.y;this[2]=object.z;return this.check();}},{key:"toObject",value:function toObject(object){object.x=this[0];object.y=this[1];object.z=this[2];return object;}},{key:"ELEMENTS",get:function get(){return 3;}},{key:"z",get:function get(){return this[2];},set:function set(value){this[2]=checkNumber(value);}},{key:"angle",value:function angle(vector){return _angle3(this,vector);}},{key:"cross",value:function cross(vector){_cross(this,this,vector);return this.check();}},{key:"rotateX",value:function rotateX(_ref18){var radians=_ref18.radians,_ref18$origin=_ref18.origin,origin=_ref18$origin===void 0?ORIGIN:_ref18$origin;_rotateX(this,this,origin,radians);return this.check();}},{key:"rotateY",value:function rotateY(_ref19){var radians=_ref19.radians,_ref19$origin=_ref19.origin,origin=_ref19$origin===void 0?ORIGIN:_ref19$origin;_rotateY(this,this,origin,radians);return this.check();}},{key:"rotateZ",value:function rotateZ(_ref20){var radians=_ref20.radians,_ref20$origin=_ref20.origin,origin=_ref20$origin===void 0?ORIGIN:_ref20$origin;_rotateZ(this,this,origin,radians);return this.check();}},{key:"transform",value:function transform(matrix4){return this.transformAsPoint(matrix4);}},{key:"transformAsPoint",value:function transformAsPoint(matrix4){transformMat4(this,this,matrix4);return this.check();}},{key:"transformAsVector",value:function transformAsVector(matrix4){vec3_transformMat4AsVector(this,this,matrix4);return this.check();}},{key:"transformByMatrix3",value:function transformByMatrix3(matrix3){transformMat3(this,this,matrix3);return this.check();}},{key:"transformByMatrix2",value:function transformByMatrix2(matrix2){vec3_transformMat2(this,this,matrix2);return this.check();}},{key:"transformByQuaternion",value:function transformByQuaternion(quaternion){transformQuat(this,this,quaternion);return this.check();}}],[{key:"ZERO",get:function get(){if(!ZERO){ZERO=new Vector3(0,0,0);Object.freeze(ZERO);}return ZERO;}}]);}(Vector);var Matrix=/*#__PURE__*/function(_MathArray2){function Matrix(){_classCallCheck(this,Matrix);return _callSuper(this,Matrix,arguments);}_inherits(Matrix,_MathArray2);return _createClass(Matrix,[{key:"toString",value:function toString(){var string='[';if(config.printRowMajor){string+='row-major:';for(var row=0;row<this.RANK;++row){for(var col=0;col<this.RANK;++col){string+=" ".concat(this[col*this.RANK+row]);}}}else{string+='column-major:';for(var _i553=0;_i553<this.ELEMENTS;++_i553){string+=" ".concat(this[_i553]);}}string+=']';return string;}},{key:"getElementIndex",value:function getElementIndex(row,col){return col*this.RANK+row;}},{key:"getElement",value:function getElement(row,col){return this[col*this.RANK+row];}},{key:"setElement",value:function setElement(row,col,value){this[col*this.RANK+row]=checkNumber(value);return this;}},{key:"getColumn",value:function getColumn(columnIndex){var result=arguments.length>1&&arguments[1]!==undefined?arguments[1]:new Array(this.RANK).fill(-0);var firstIndex=columnIndex*this.RANK;for(var _i554=0;_i554<this.RANK;++_i554){result[_i554]=this[firstIndex+_i554];}return result;}},{key:"setColumn",value:function setColumn(columnIndex,columnVector){var firstIndex=columnIndex*this.RANK;for(var _i555=0;_i555<this.RANK;++_i555){this[firstIndex+_i555]=columnVector[_i555];}return this;}}]);}(MathArray);/**
24923
25170
  * Transpose the values of a mat3
24924
25171
  *
24925
25172
  * @param {mat3} out the receiving matrix
@@ -24973,9 +25220,9 @@ var det=a00*b01+a01*b11+a02*b21;if(!det){return null;}det=1.0/det;out[0]=b01*det
24973
25220
  * @param {ReadonlyQuat} q Quaternion to create matrix from
24974
25221
  *
24975
25222
  * @returns {mat3} out
24976
- */function fromQuat(out,q){var x=q[0],y=q[1],z=q[2],w=q[3];var x2=x+x;var y2=y+y;var z2=z+z;var xx=x*x2;var yx=y*x2;var yy=y*y2;var zx=z*x2;var zy=z*y2;var zz=z*z2;var wx=w*x2;var wy=w*y2;var wz=w*z2;out[0]=1-yy-zz;out[3]=yx-wz;out[6]=zx+wy;out[1]=yx+wz;out[4]=1-xx-zz;out[7]=zy-wx;out[2]=zx-wy;out[5]=zy+wx;out[8]=1-xx-yy;return out;}var INDICES;(function(INDICES){INDICES[INDICES["COL0ROW0"]=0]="COL0ROW0";INDICES[INDICES["COL0ROW1"]=1]="COL0ROW1";INDICES[INDICES["COL0ROW2"]=2]="COL0ROW2";INDICES[INDICES["COL1ROW0"]=3]="COL1ROW0";INDICES[INDICES["COL1ROW1"]=4]="COL1ROW1";INDICES[INDICES["COL1ROW2"]=5]="COL1ROW2";INDICES[INDICES["COL2ROW0"]=6]="COL2ROW0";INDICES[INDICES["COL2ROW1"]=7]="COL2ROW1";INDICES[INDICES["COL2ROW2"]=8]="COL2ROW2";})(INDICES||(INDICES={}));var IDENTITY_MATRIX=Object.freeze([1,0,0,0,1,0,0,0,1]);var Matrix3=/*#__PURE__*/function(_Matrix){function Matrix3(array){var _this128;for(var _len105=arguments.length,args=new Array(_len105>1?_len105-1:0),_key12=1;_key12<_len105;_key12++){args[_key12-1]=arguments[_key12];}_classCallCheck(this,Matrix3);_this128=_callSuper(this,Matrix3,[-0,-0,-0,-0,-0,-0,-0,-0,-0]);if(arguments.length===1&&Array.isArray(array)){_this128.copy(array);}else if(args.length>0){_this128.copy([array].concat(args));}else{_this128.identity();}return _this128;}_inherits(Matrix3,_Matrix);return _createClass(Matrix3,[{key:"ELEMENTS",get:function get(){return 9;}},{key:"RANK",get:function get(){return 3;}},{key:"INDICES",get:function get(){return INDICES;}},{key:"copy",value:function copy(array){this[0]=array[0];this[1]=array[1];this[2]=array[2];this[3]=array[3];this[4]=array[4];this[5]=array[5];this[6]=array[6];this[7]=array[7];this[8]=array[8];return this.check();}},{key:"identity",value:function identity(){return this.copy(IDENTITY_MATRIX);}},{key:"fromObject",value:function fromObject(object){return this.check();}},{key:"fromQuaternion",value:function fromQuaternion(q){fromQuat(this,q);return this.check();}},{key:"set",value:function set(m00,m10,m20,m01,m11,m21,m02,m12,m22){this[0]=m00;this[1]=m10;this[2]=m20;this[3]=m01;this[4]=m11;this[5]=m21;this[6]=m02;this[7]=m12;this[8]=m22;return this.check();}},{key:"setRowMajor",value:function setRowMajor(m00,m01,m02,m10,m11,m12,m20,m21,m22){this[0]=m00;this[1]=m10;this[2]=m20;this[3]=m01;this[4]=m11;this[5]=m21;this[6]=m02;this[7]=m12;this[8]=m22;return this.check();}},{key:"determinant",value:function determinant(){return _determinant(this);}},{key:"transpose",value:function transpose(){_transpose(this,this);return this.check();}},{key:"invert",value:function invert(){_invert(this,this);return this.check();}},{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)){_scale8(this,this,factor);}else{_scale8(this,this,[factor,factor]);}return this.check();}},{key:"translate",value:function translate(vec){_translate(this,this,vec);return this.check();}},{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;}},{key:"transformVector",value:function transformVector(vector,result){return this.transform(vector,result);}},{key:"transformVector2",value:function transformVector2(vector,result){return this.transform(vector,result);}},{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();}}]);}(Matrix);var ZERO_MATRIX3;var IDENTITY_MATRIX3;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;}var COMPONENTS$1={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16};var BYTES$1={5120:1,5121:1,5122:2,5123:2,5125:4,5126:4};var EXT_MESHOPT_TRANSFORM='KHR_texture_transform';var name$4=EXT_MESHOPT_TRANSFORM;var scratchVector=new Vector3();var scratchRotationMatrix=new Matrix3();var scratchScaleMatrix=new Matrix3();function decode$4(_x80,_x81){return _decode$3.apply(this,arguments);}function _decode$3(){_decode$3=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee46(gltfData,options){var gltfScenegraph,extension,materials,_i634;return _regeneratorRuntime().wrap(function _callee46$(_context49){while(1)switch(_context49.prev=_context49.next){case 0:gltfScenegraph=new GLTFScenegraph(gltfData);extension=gltfScenegraph.getExtension(EXT_MESHOPT_TRANSFORM);if(extension){_context49.next=4;break;}return _context49.abrupt("return");case 4:materials=gltfData.json.materials||[];for(_i634=0;_i634<materials.length;_i634++){transformTexCoords(_i634,gltfData);}case 6:case"end":return _context49.stop();}},_callee46);}));return _decode$3.apply(this,arguments);}function transformTexCoords(materialIndex,gltfData){var _gltfData$json$materi,_material$pbrMetallic,_material$pbrMetallic2;var processedTexCoords=[];var material=(_gltfData$json$materi=gltfData.json.materials)===null||_gltfData$json$materi===void 0?void 0:_gltfData$json$materi[materialIndex];var baseColorTexture=material===null||material===void 0?void 0:(_material$pbrMetallic=material.pbrMetallicRoughness)===null||_material$pbrMetallic===void 0?void 0:_material$pbrMetallic.baseColorTexture;if(baseColorTexture){transformPrimitives(gltfData,materialIndex,baseColorTexture,processedTexCoords);}var emisiveTexture=material===null||material===void 0?void 0:material.emissiveTexture;if(emisiveTexture){transformPrimitives(gltfData,materialIndex,emisiveTexture,processedTexCoords);}var normalTexture=material===null||material===void 0?void 0:material.normalTexture;if(normalTexture){transformPrimitives(gltfData,materialIndex,normalTexture,processedTexCoords);}var occlusionTexture=material===null||material===void 0?void 0:material.occlusionTexture;if(occlusionTexture){transformPrimitives(gltfData,materialIndex,occlusionTexture,processedTexCoords);}var metallicRoughnessTexture=material===null||material===void 0?void 0:(_material$pbrMetallic2=material.pbrMetallicRoughness)===null||_material$pbrMetallic2===void 0?void 0:_material$pbrMetallic2.metallicRoughnessTexture;if(metallicRoughnessTexture){transformPrimitives(gltfData,materialIndex,metallicRoughnessTexture,processedTexCoords);}}function transformPrimitives(gltfData,materialIndex,texture,processedTexCoords){var transformParameters=getTransformParameters(texture,processedTexCoords);if(!transformParameters){return;}var meshes=gltfData.json.meshes||[];var _iterator28=_createForOfIteratorHelper(meshes),_step28;try{for(_iterator28.s();!(_step28=_iterator28.n()).done;){var _mesh6=_step28.value;var _iterator29=_createForOfIteratorHelper(_mesh6.primitives),_step29;try{for(_iterator29.s();!(_step29=_iterator29.n()).done;){var _primitive3=_step29.value;var material=_primitive3.material;if(Number.isFinite(material)&&materialIndex===material){transformPrimitive(gltfData,_primitive3,transformParameters);}}}catch(err){_iterator29.e(err);}finally{_iterator29.f();}}}catch(err){_iterator28.e(err);}finally{_iterator28.f();}}function getTransformParameters(texture,processedTexCoords){var _texture$extensions;var textureInfo=(_texture$extensions=texture.extensions)===null||_texture$extensions===void 0?void 0:_texture$extensions[EXT_MESHOPT_TRANSFORM];var _texture$texCoord=texture.texCoord,originalTexCoord=_texture$texCoord===void 0?0:_texture$texCoord;var _textureInfo$texCoord=textureInfo.texCoord,texCoord=_textureInfo$texCoord===void 0?originalTexCoord:_textureInfo$texCoord;var isProcessed=processedTexCoords.findIndex(function(_ref){var _ref21=_slicedToArray(_ref,2),original=_ref21[0],newTexCoord=_ref21[1];return original===originalTexCoord&&newTexCoord===texCoord;})!==-1;if(!isProcessed){var _matrix2=makeTransformationMatrix(textureInfo);if(originalTexCoord!==texCoord){texture.texCoord=texCoord;}processedTexCoords.push([originalTexCoord,texCoord]);return{originalTexCoord:originalTexCoord,texCoord:texCoord,matrix:_matrix2};}return null;}function transformPrimitive(gltfData,primitive,transformParameters){var originalTexCoord=transformParameters.originalTexCoord,texCoord=transformParameters.texCoord,matrix=transformParameters.matrix;var texCoordAccessor=primitive.attributes["TEXCOORD_".concat(originalTexCoord)];if(Number.isFinite(texCoordAccessor)){var _gltfData$json$access;var accessor=(_gltfData$json$access=gltfData.json.accessors)===null||_gltfData$json$access===void 0?void 0:_gltfData$json$access[texCoordAccessor];if(accessor&&accessor.bufferView){var _gltfData$json$buffer;var bufferView=(_gltfData$json$buffer=gltfData.json.bufferViews)===null||_gltfData$json$buffer===void 0?void 0:_gltfData$json$buffer[accessor.bufferView];if(bufferView){var _gltfData$buffers$buf=gltfData.buffers[bufferView.buffer],arrayBuffer=_gltfData$buffers$buf.arrayBuffer,bufferByteOffset=_gltfData$buffers$buf.byteOffset;var byteOffset=(bufferByteOffset||0)+(accessor.byteOffset||0)+(bufferView.byteOffset||0);var _getAccessorArrayType2=getAccessorArrayTypeAndLength(accessor,bufferView),ArrayType=_getAccessorArrayType2.ArrayType,length=_getAccessorArrayType2.length;var bytes=BYTES$1[accessor.componentType];var components=COMPONENTS$1[accessor.type];var elementAddressScale=bufferView.byteStride||bytes*components;var result=new Float32Array(length);for(var _i556=0;_i556<accessor.count;_i556++){var uv=new ArrayType(arrayBuffer,byteOffset+_i556*elementAddressScale,2);scratchVector.set(uv[0],uv[1],1);scratchVector.transformByMatrix3(matrix);result.set([scratchVector[0],scratchVector[1]],_i556*components);}if(originalTexCoord===texCoord){updateGltf(accessor,bufferView,gltfData.buffers,result);}else{createAttribute(texCoord,accessor,primitive,gltfData,result);}}}}}function updateGltf(accessor,bufferView,buffers,newTexCoordArray){accessor.componentType=5126;buffers.push({arrayBuffer:newTexCoordArray.buffer,byteOffset:0,byteLength:newTexCoordArray.buffer.byteLength});bufferView.buffer=buffers.length-1;bufferView.byteLength=newTexCoordArray.buffer.byteLength;bufferView.byteOffset=0;delete bufferView.byteStride;}function createAttribute(newTexCoord,originalAccessor,primitive,gltfData,newTexCoordArray){gltfData.buffers.push({arrayBuffer:newTexCoordArray.buffer,byteOffset:0,byteLength:newTexCoordArray.buffer.byteLength});var bufferViews=gltfData.json.bufferViews;if(!bufferViews){return;}bufferViews.push({buffer:gltfData.buffers.length-1,byteLength:newTexCoordArray.buffer.byteLength,byteOffset:0});var accessors=gltfData.json.accessors;if(!accessors){return;}accessors.push({bufferView:(bufferViews===null||bufferViews===void 0?void 0:bufferViews.length)-1,byteOffset:0,componentType:5126,count:originalAccessor.count,type:'VEC2'});primitive.attributes["TEXCOORD_".concat(newTexCoord)]=accessors.length-1;}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 translationMatirx=new Matrix3().set(1,0,0,0,1,0,offset[0],offset[1],1);var rotationMatirx=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 translationMatirx.multiplyRight(rotationMatirx).multiplyRight(scaleMatrix);}var KHR_texture_transform=/*#__PURE__*/Object.freeze({__proto__:null,name:name$4,decode:decode$4});var KHR_LIGHTS_PUNCTUAL='KHR_lights_punctual';var name$3=KHR_LIGHTS_PUNCTUAL;function decode$3(_x82){return _decode$4.apply(this,arguments);}function _decode$4(){_decode$4=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee47(gltfData){var gltfScenegraph,json,extension,_iterator44,_step44,_node10,nodeExtension;return _regeneratorRuntime().wrap(function _callee47$(_context50){while(1)switch(_context50.prev=_context50.next){case 0:gltfScenegraph=new GLTFScenegraph(gltfData);json=gltfScenegraph.json;extension=gltfScenegraph.getExtension(KHR_LIGHTS_PUNCTUAL);if(extension){gltfScenegraph.json.lights=extension.lights;gltfScenegraph.removeExtension(KHR_LIGHTS_PUNCTUAL);}_iterator44=_createForOfIteratorHelper(json.nodes||[]);try{for(_iterator44.s();!(_step44=_iterator44.n()).done;){_node10=_step44.value;nodeExtension=gltfScenegraph.getObjectExtension(_node10,KHR_LIGHTS_PUNCTUAL);if(nodeExtension){_node10.light=nodeExtension.light;}gltfScenegraph.removeObjectExtension(_node10,KHR_LIGHTS_PUNCTUAL);}}catch(err){_iterator44.e(err);}finally{_iterator44.f();}case 6:case"end":return _context50.stop();}},_callee47);}));return _decode$4.apply(this,arguments);}function encode$2(_x83){return _encode$.apply(this,arguments);}function _encode$(){_encode$=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee48(gltfData){var gltfScenegraph,json,extension,_iterator45,_step45,light,_node11;return _regeneratorRuntime().wrap(function _callee48$(_context51){while(1)switch(_context51.prev=_context51.next){case 0:gltfScenegraph=new GLTFScenegraph(gltfData);json=gltfScenegraph.json;if(json.lights){extension=gltfScenegraph.addExtension(KHR_LIGHTS_PUNCTUAL);assert$3(!extension.lights);extension.lights=json.lights;delete json.lights;}if(gltfScenegraph.json.lights){_iterator45=_createForOfIteratorHelper(gltfScenegraph.json.lights);try{for(_iterator45.s();!(_step45=_iterator45.n()).done;){light=_step45.value;_node11=light.node;gltfScenegraph.addObjectExtension(_node11,KHR_LIGHTS_PUNCTUAL,light);}}catch(err){_iterator45.e(err);}finally{_iterator45.f();}delete gltfScenegraph.json.lights;}case 4:case"end":return _context51.stop();}},_callee48);}));return _encode$.apply(this,arguments);}var KHR_lights_punctual=/*#__PURE__*/Object.freeze({__proto__:null,name:name$3,decode:decode$3,encode:encode$2});var KHR_MATERIALS_UNLIT='KHR_materials_unlit';var name$2=KHR_MATERIALS_UNLIT;function decode$2(_x84){return _decode$5.apply(this,arguments);}function _decode$5(){_decode$5=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee49(gltfData){var gltfScenegraph,json,_iterator46,_step46,material,extension;return _regeneratorRuntime().wrap(function _callee49$(_context52){while(1)switch(_context52.prev=_context52.next){case 0:gltfScenegraph=new GLTFScenegraph(gltfData);json=gltfScenegraph.json;_iterator46=_createForOfIteratorHelper(json.materials||[]);try{for(_iterator46.s();!(_step46=_iterator46.n()).done;){material=_step46.value;extension=material.extensions&&material.extensions.KHR_materials_unlit;if(extension){material.unlit=true;}gltfScenegraph.removeObjectExtension(material,KHR_MATERIALS_UNLIT);}}catch(err){_iterator46.e(err);}finally{_iterator46.f();}gltfScenegraph.removeExtension(KHR_MATERIALS_UNLIT);case 5:case"end":return _context52.stop();}},_callee49);}));return _decode$5.apply(this,arguments);}function encode$1(gltfData){var gltfScenegraph=new GLTFScenegraph(gltfData);var json=gltfScenegraph.json;if(gltfScenegraph.materials){var _iterator30=_createForOfIteratorHelper(json.materials||[]),_step30;try{for(_iterator30.s();!(_step30=_iterator30.n()).done;){var material=_step30.value;if(material.unlit){delete material.unlit;gltfScenegraph.addObjectExtension(material,KHR_MATERIALS_UNLIT,{});gltfScenegraph.addExtension(KHR_MATERIALS_UNLIT);}}}catch(err){_iterator30.e(err);}finally{_iterator30.f();}}}var KHR_materials_unlit=/*#__PURE__*/Object.freeze({__proto__:null,name:name$2,decode:decode$2,encode:encode$1});var KHR_TECHNIQUES_WEBGL='KHR_techniques_webgl';var name$1=KHR_TECHNIQUES_WEBGL;function decode$1(_x85){return _decode$6.apply(this,arguments);}function _decode$6(){_decode$6=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee50(gltfData){var gltfScenegraph,json,extension,techniques,_iterator47,_step47,material,materialExtension;return _regeneratorRuntime().wrap(function _callee50$(_context53){while(1)switch(_context53.prev=_context53.next){case 0:gltfScenegraph=new GLTFScenegraph(gltfData);json=gltfScenegraph.json;extension=gltfScenegraph.getExtension(KHR_TECHNIQUES_WEBGL);if(extension){techniques=resolveTechniques(extension,gltfScenegraph);_iterator47=_createForOfIteratorHelper(json.materials||[]);try{for(_iterator47.s();!(_step47=_iterator47.n()).done;){material=_step47.value;materialExtension=gltfScenegraph.getObjectExtension(material,KHR_TECHNIQUES_WEBGL);if(materialExtension){material.technique=Object.assign({},materialExtension,techniques[materialExtension.technique]);material.technique.values=resolveValues(material.technique,gltfScenegraph);}gltfScenegraph.removeObjectExtension(material,KHR_TECHNIQUES_WEBGL);}}catch(err){_iterator47.e(err);}finally{_iterator47.f();}gltfScenegraph.removeExtension(KHR_TECHNIQUES_WEBGL);}case 4:case"end":return _context53.stop();}},_callee50);}));return _decode$6.apply(this,arguments);}function encode(_x86,_x87){return _encode.apply(this,arguments);}function _encode(){_encode=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee51(gltfData,options){return _regeneratorRuntime().wrap(function _callee51$(_context54){while(1)switch(_context54.prev=_context54.next){case 0:case"end":return _context54.stop();}},_callee51);}));return _encode.apply(this,arguments);}function resolveTechniques(techniquesExtension,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{throw new Error('KHR_techniques_webgl: no shader code');}});programs.forEach(function(program){program.fragmentShader=shaders[program.fragmentShader];program.vertexShader=shaders[program.vertexShader];});techniques.forEach(function(technique){technique.program=programs[technique.program];});return techniques;}function resolveValues(technique,gltfScenegraph){var values=Object.assign({},technique.values);Object.keys(technique.uniforms||{}).forEach(function(uniform){if(technique.uniforms[uniform].value&&!(uniform in values)){values[uniform]=technique.uniforms[uniform].value;}});Object.keys(values).forEach(function(uniform){if(_typeof2(values[uniform])==='object'&&values[uniform].index!==undefined){values[uniform].texture=gltfScenegraph.getTexture(values[uniform].index);}});return values;}var KHR_techniques_webgl=/*#__PURE__*/Object.freeze({__proto__:null,name:name$1,decode:decode$1,encode:encode});var EXT_FEATURE_METADATA='EXT_feature_metadata';var name=EXT_FEATURE_METADATA;function decode(_x88){return _decode.apply(this,arguments);}function _decode(){_decode=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee52(gltfData){var scenegraph;return _regeneratorRuntime().wrap(function _callee52$(_context55){while(1)switch(_context55.prev=_context55.next){case 0:scenegraph=new GLTFScenegraph(gltfData);decodeExtFeatureMetadata(scenegraph);case 2:case"end":return _context55.stop();}},_callee52);}));return _decode.apply(this,arguments);}function decodeExtFeatureMetadata(scenegraph){var _extension$schema;var extension=scenegraph.getExtension(EXT_FEATURE_METADATA);var schemaClasses=extension===null||extension===void 0?void 0:(_extension$schema=extension.schema)===null||_extension$schema===void 0?void 0:_extension$schema.classes;var featureTables=extension===null||extension===void 0?void 0:extension.featureTables;var featureTextures=extension===null||extension===void 0?void 0:extension.featureTextures;if(featureTextures){console.warn('featureTextures is not yet supported in the "EXT_feature_metadata" extension.');}if(schemaClasses&&featureTables){for(var schemaName in schemaClasses){var schemaClass=schemaClasses[schemaName];var featureTable=findFeatureTableByName(featureTables,schemaName);if(featureTable){handleFeatureTableProperties(scenegraph,featureTable,schemaClass);}}}}function handleFeatureTableProperties(scenegraph,featureTable,schemaClass){for(var propertyName in schemaClass.properties){var _featureTable$propert;var schemaProperty=schemaClass.properties[propertyName];var featureTableProperty=featureTable===null||featureTable===void 0?void 0:(_featureTable$propert=featureTable.properties)===null||_featureTable$propert===void 0?void 0:_featureTable$propert[propertyName];var numberOfFeatures=featureTable.count;if(featureTableProperty){var data=getPropertyDataFromBinarySource(scenegraph,schemaProperty,numberOfFeatures,featureTableProperty);featureTableProperty.data=data;}}}function getPropertyDataFromBinarySource(scenegraph,schemaProperty,numberOfFeatures,featureTableProperty){var bufferView=featureTableProperty.bufferView;var data=scenegraph.getTypedArrayForBufferView(bufferView);switch(schemaProperty.type){case'STRING':{var stringOffsetBufferView=featureTableProperty.stringOffsetBufferView;var offsetsData=scenegraph.getTypedArrayForBufferView(stringOffsetBufferView);data=getStringAttributes(data,offsetsData,numberOfFeatures);break;}}return data;}function findFeatureTableByName(featureTables,schemaClassName){for(var featureTableName in featureTables){var featureTable=featureTables[featureTableName];if(featureTable["class"]===schemaClassName){return featureTable;}}return null;}function getStringAttributes(data,offsetsData,stringsCount){var stringsArray=[];var textDecoder=new TextDecoder('utf8');var stringOffset=0;var bytesPerStringSize=4;for(var index=0;index<stringsCount;index++){var stringByteSize=offsetsData[(index+1)*bytesPerStringSize]-offsetsData[index*bytesPerStringSize];var stringData=data.subarray(stringOffset,stringByteSize+stringOffset);var stringAttribute=textDecoder.decode(stringData);stringsArray.push(stringAttribute);stringOffset+=stringByteSize;}return stringsArray;}var EXT_feature_metadata=/*#__PURE__*/Object.freeze({__proto__:null,name:name,decode:decode});var EXTENSIONS=[EXT_meshopt_compression,EXT_texture_webp,KHR_texture_basisu,KHR_draco_mesh_compression,KHR_lights_punctual,KHR_materials_unlit,KHR_techniques_webgl,KHR_texture_transform,EXT_feature_metadata];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 _iterator31=_createForOfIteratorHelper(extensions),_step31;try{for(_iterator31.s();!(_step31=_iterator31.n()).done;){var extension=_step31.value;var _extension$preprocess;(_extension$preprocess=extension.preprocess)===null||_extension$preprocess===void 0?void 0:_extension$preprocess.call(extension,gltf,options,context);}}catch(err){_iterator31.e(err);}finally{_iterator31.f();}}function decodeExtensions(_x89){return _decodeExtensions.apply(this,arguments);}function _decodeExtensions(){_decodeExtensions=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee53(gltf){var options,context,extensions,_iterator48,_step48,extension,_extension$decode,_args49=arguments;return _regeneratorRuntime().wrap(function _callee53$(_context56){while(1)switch(_context56.prev=_context56.next){case 0:options=_args49.length>1&&_args49[1]!==undefined?_args49[1]:{};context=_args49.length>2?_args49[2]:undefined;extensions=EXTENSIONS.filter(function(extension){return useExtension(extension.name,options);});_iterator48=_createForOfIteratorHelper(extensions);_context56.prev=4;_iterator48.s();case 6:if((_step48=_iterator48.n()).done){_context56.next=12;break;}extension=_step48.value;_context56.next=10;return(_extension$decode=extension.decode)===null||_extension$decode===void 0?void 0:_extension$decode.call(extension,gltf,options,context);case 10:_context56.next=6;break;case 12:_context56.next=17;break;case 14:_context56.prev=14;_context56.t0=_context56["catch"](4);_iterator48.e(_context56.t0);case 17:_context56.prev=17;_iterator48.f();return _context56.finish(17);case 20:case"end":return _context56.stop();}},_callee53,null,[[4,14,17,20]]);}));return _decodeExtensions.apply(this,arguments);}function useExtension(extensionName,options){var _options$gltf;var excludes=(options===null||options===void 0?void 0:(_options$gltf=options.gltf)===null||_options$gltf===void 0?void 0:_options$gltf.excludeExtensions)||{};var exclude=extensionName in excludes&&!excludes[extensionName];return!exclude;}var KHR_BINARY_GLTF='KHR_binary_glTF';function preprocess(gltfData){var gltfScenegraph=new GLTFScenegraph(gltfData);var json=gltfScenegraph.json;var _iterator32=_createForOfIteratorHelper(json.images||[]),_step32;try{for(_iterator32.s();!(_step32=_iterator32.n()).done;){var _image6=_step32.value;var extension=gltfScenegraph.getObjectExtension(_image6,KHR_BINARY_GLTF);if(extension){Object.assign(_image6,extension);}gltfScenegraph.removeObjectExtension(_image6,KHR_BINARY_GLTF);}}catch(err){_iterator32.e(err);}finally{_iterator32.f();}if(json.buffers&&json.buffers[0]){delete json.buffers[0].uri;}gltfScenegraph.removeExtension(KHR_BINARY_GLTF);}var GLTF_ARRAYS={accessors:'accessor',animations:'animation',buffers:'buffer',bufferViews:'bufferView',images:'image',materials:'material',meshes:'mesh',nodes:'node',samplers:'sampler',scenes:'scene',skins:'skin',textures:'texture'};var GLTF_KEYS={accessor:'accessors',animations:'animation',buffer:'buffers',bufferView:'bufferViews',image:'images',material:'materials',mesh:'meshes',node:'nodes',sampler:'samplers',scene:'scenes',skin:'skins',texture:'textures'};var GLTFV1Normalizer=/*#__PURE__*/function(){function GLTFV1Normalizer(){_classCallCheck(this,GLTFV1Normalizer);_defineProperty(this,"idToIndexMap",{animations:{},accessors:{},buffers:{},bufferViews:{},images:{},materials:{},meshes:{},nodes:{},samplers:{},scenes:{},skins:{},textures:{}});_defineProperty(this,"json",void 0);}return _createClass(GLTFV1Normalizer,[{key:"normalize",value:function normalize(gltf,options){this.json=gltf.json;var json=gltf.json;switch(json.asset&&json.asset.version){case'2.0':return;case undefined:case'1.0':break;default:console.warn("glTF: Unknown version ".concat(json.asset.version));return;}if(!options.normalize){throw new Error('glTF v1 is not supported.');}console.warn('Converting glTF v1 to glTF v2 format. This is experimental and may fail.');this._addAsset(json);this._convertTopLevelObjectsToArrays(json);preprocess(gltf);this._convertObjectIdsToArrayIndices(json);this._updateObjects(json);this._updateMaterial(json);}},{key:"_addAsset",value:function _addAsset(json){json.asset=json.asset||{};json.asset.version='2.0';json.asset.generator=json.asset.generator||'Normalized to glTF 2.0 by loaders.gl';}},{key:"_convertTopLevelObjectsToArrays",value:function _convertTopLevelObjectsToArrays(json){for(var arrayName in GLTF_ARRAYS){this._convertTopLevelObjectToArray(json,arrayName);}}},{key:"_convertTopLevelObjectToArray",value:function _convertTopLevelObjectToArray(json,mapName){var objectMap=json[mapName];if(!objectMap||Array.isArray(objectMap)){return;}json[mapName]=[];for(var id in objectMap){var object=objectMap[id];object.id=object.id||id;var index=json[mapName].length;json[mapName].push(object);this.idToIndexMap[mapName][id]=index;}}},{key:"_convertObjectIdsToArrayIndices",value:function _convertObjectIdsToArrayIndices(json){for(var arrayName in GLTF_ARRAYS){this._convertIdsToIndices(json,arrayName);}if('scene'in json){json.scene=this._convertIdToIndex(json.scene,'scene');}var _iterator33=_createForOfIteratorHelper(json.textures),_step33;try{for(_iterator33.s();!(_step33=_iterator33.n()).done;){var texture=_step33.value;this._convertTextureIds(texture);}}catch(err){_iterator33.e(err);}finally{_iterator33.f();}var _iterator34=_createForOfIteratorHelper(json.meshes),_step34;try{for(_iterator34.s();!(_step34=_iterator34.n()).done;){var _mesh7=_step34.value;this._convertMeshIds(_mesh7);}}catch(err){_iterator34.e(err);}finally{_iterator34.f();}var _iterator35=_createForOfIteratorHelper(json.nodes),_step35;try{for(_iterator35.s();!(_step35=_iterator35.n()).done;){var _node4=_step35.value;this._convertNodeIds(_node4);}}catch(err){_iterator35.e(err);}finally{_iterator35.f();}var _iterator36=_createForOfIteratorHelper(json.scenes),_step36;try{for(_iterator36.s();!(_step36=_iterator36.n()).done;){var _node5=_step36.value;this._convertSceneIds(_node5);}}catch(err){_iterator36.e(err);}finally{_iterator36.f();}}},{key:"_convertTextureIds",value:function _convertTextureIds(texture){if(texture.source){texture.source=this._convertIdToIndex(texture.source,'image');}}},{key:"_convertMeshIds",value:function _convertMeshIds(mesh){var _iterator37=_createForOfIteratorHelper(mesh.primitives),_step37;try{for(_iterator37.s();!(_step37=_iterator37.n()).done;){var _primitive4=_step37.value;var attributes=_primitive4.attributes,indices=_primitive4.indices,material=_primitive4.material;for(var attributeName in attributes){attributes[attributeName]=this._convertIdToIndex(attributes[attributeName],'accessor');}if(indices){_primitive4.indices=this._convertIdToIndex(indices,'accessor');}if(material){_primitive4.material=this._convertIdToIndex(material,'material');}}}catch(err){_iterator37.e(err);}finally{_iterator37.f();}}},{key:"_convertNodeIds",value:function _convertNodeIds(node){var _this129=this;if(node.children){node.children=node.children.map(function(child){return _this129._convertIdToIndex(child,'node');});}if(node.meshes){node.meshes=node.meshes.map(function(mesh){return _this129._convertIdToIndex(mesh,'mesh');});}}},{key:"_convertSceneIds",value:function _convertSceneIds(scene){var _this130=this;if(scene.nodes){scene.nodes=scene.nodes.map(function(node){return _this130._convertIdToIndex(node,'node');});}}},{key:"_convertIdsToIndices",value:function _convertIdsToIndices(json,topLevelArrayName){if(!json[topLevelArrayName]){console.warn("gltf v1: json doesn't contain attribute ".concat(topLevelArrayName));json[topLevelArrayName]=[];}var _iterator38=_createForOfIteratorHelper(json[topLevelArrayName]),_step38;try{for(_iterator38.s();!(_step38=_iterator38.n()).done;){var object=_step38.value;for(var key in object){var id=object[key];var index=this._convertIdToIndex(id,key);object[key]=index;}}}catch(err){_iterator38.e(err);}finally{_iterator38.f();}}},{key:"_convertIdToIndex",value:function _convertIdToIndex(id,key){var arrayName=GLTF_KEYS[key];if(arrayName in this.idToIndexMap){var index=this.idToIndexMap[arrayName][id];if(!Number.isFinite(index)){throw new Error("gltf v1: failed to resolve ".concat(key," with id ").concat(id));}return index;}return id;}},{key:"_updateObjects",value:function _updateObjects(json){var _iterator39=_createForOfIteratorHelper(this.json.buffers),_step39;try{for(_iterator39.s();!(_step39=_iterator39.n()).done;){var buffer=_step39.value;delete buffer.type;}}catch(err){_iterator39.e(err);}finally{_iterator39.f();}}},{key:"_updateMaterial",value:function _updateMaterial(json){var _iterator40=_createForOfIteratorHelper(json.materials),_step40;try{var _loop4=function _loop4(){var material=_step40.value;material.pbrMetallicRoughness={baseColorFactor:[1,1,1,1],metallicFactor:1,roughnessFactor:1};var textureId=((_material$values=material.values)===null||_material$values===void 0?void 0:_material$values.tex)||((_material$values2=material.values)===null||_material$values2===void 0?void 0:_material$values2.texture2d_0)||((_material$values3=material.values)===null||_material$values3===void 0?void 0:_material$values3.diffuseTex);var textureIndex=json.textures.findIndex(function(texture){return texture.id===textureId;});if(textureIndex!==-1){material.pbrMetallicRoughness.baseColorTexture={index:textureIndex};}},_material$values,_material$values2,_material$values3;for(_iterator40.s();!(_step40=_iterator40.n()).done;){_loop4();}}catch(err){_iterator40.e(err);}finally{_iterator40.f();}}}]);}();function normalizeGLTFV1(gltf){var options=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};return new GLTFV1Normalizer().normalize(gltf,options);}var COMPONENTS={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16};var BYTES={5120:1,5121:1,5122:2,5123:2,5125:4,5126:4};var GL_SAMPLER={TEXTURE_MAG_FILTER:0x2800,TEXTURE_MIN_FILTER:0x2801,TEXTURE_WRAP_S:0x2802,TEXTURE_WRAP_T:0x2803,REPEAT:0x2901,LINEAR:0x2601,NEAREST_MIPMAP_LINEAR:0x2702};var SAMPLER_PARAMETER_GLTF_TO_GL={magFilter:GL_SAMPLER.TEXTURE_MAG_FILTER,minFilter:GL_SAMPLER.TEXTURE_MIN_FILTER,wrapS:GL_SAMPLER.TEXTURE_WRAP_S,wrapT:GL_SAMPLER.TEXTURE_WRAP_T};var DEFAULT_SAMPLER=_defineProperty2(_defineProperty2(_defineProperty2(_defineProperty2({},GL_SAMPLER.TEXTURE_MAG_FILTER,GL_SAMPLER.LINEAR),GL_SAMPLER.TEXTURE_MIN_FILTER,GL_SAMPLER.NEAREST_MIPMAP_LINEAR),GL_SAMPLER.TEXTURE_WRAP_S,GL_SAMPLER.REPEAT),GL_SAMPLER.TEXTURE_WRAP_T,GL_SAMPLER.REPEAT);function getBytesFromComponentType(componentType){return BYTES[componentType];}function getSizeFromAccessorType(type){return COMPONENTS[type];}var GLTFPostProcessor=/*#__PURE__*/function(){function GLTFPostProcessor(){_classCallCheck(this,GLTFPostProcessor);_defineProperty(this,"baseUri",'');_defineProperty(this,"json",{});_defineProperty(this,"buffers",[]);_defineProperty(this,"images",[]);}return _createClass(GLTFPostProcessor,[{key:"postProcess",value:function postProcess(gltf){var options=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};var json=gltf.json,_gltf$buffers=gltf.buffers,buffers=_gltf$buffers===void 0?[]:_gltf$buffers,_gltf$images=gltf.images,images=_gltf$images===void 0?[]:_gltf$images,_gltf$baseUri=gltf.baseUri,baseUri=_gltf$baseUri===void 0?'':_gltf$baseUri;assert$3(json);this.baseUri=baseUri;this.json=json;this.buffers=buffers;this.images=images;this._resolveTree(this.json,options);return this.json;}},{key:"_resolveTree",value:function _resolveTree(json){var _this131=this;if(json.bufferViews){json.bufferViews=json.bufferViews.map(function(bufView,i){return _this131._resolveBufferView(bufView,i);});}if(json.images){json.images=json.images.map(function(image,i){return _this131._resolveImage(image,i);});}if(json.samplers){json.samplers=json.samplers.map(function(sampler,i){return _this131._resolveSampler(sampler,i);});}if(json.textures){json.textures=json.textures.map(function(texture,i){return _this131._resolveTexture(texture,i);});}if(json.accessors){json.accessors=json.accessors.map(function(accessor,i){return _this131._resolveAccessor(accessor,i);});}if(json.materials){json.materials=json.materials.map(function(material,i){return _this131._resolveMaterial(material,i);});}if(json.meshes){json.meshes=json.meshes.map(function(mesh,i){return _this131._resolveMesh(mesh,i);});}if(json.nodes){json.nodes=json.nodes.map(function(node,i){return _this131._resolveNode(node,i);});}if(json.skins){json.skins=json.skins.map(function(skin,i){return _this131._resolveSkin(skin,i);});}if(json.scenes){json.scenes=json.scenes.map(function(scene,i){return _this131._resolveScene(scene,i);});}if(json.scene!==undefined){json.scene=json.scenes[this.json.scene];}}},{key:"getScene",value:function getScene(index){return this._get('scenes',index);}},{key:"getNode",value:function getNode(index){return this._get('nodes',index);}},{key:"getSkin",value:function getSkin(index){return this._get('skins',index);}},{key:"getMesh",value:function getMesh(index){return this._get('meshes',index);}},{key:"getMaterial",value:function getMaterial(index){return this._get('materials',index);}},{key:"getAccessor",value:function getAccessor(index){return this._get('accessors',index);}},{key:"getCamera",value:function getCamera(index){return null;}},{key:"getTexture",value:function getTexture(index){return this._get('textures',index);}},{key:"getSampler",value:function getSampler(index){return this._get('samplers',index);}},{key:"getImage",value:function getImage(index){return this._get('images',index);}},{key:"getBufferView",value:function getBufferView(index){return this._get('bufferViews',index);}},{key:"getBuffer",value:function getBuffer(index){return this._get('buffers',index);}},{key:"_get",value:function _get(array,index){if(_typeof2(index)==='object'){return index;}var object=this.json[array]&&this.json[array][index];if(!object){console.warn("glTF file error: Could not find ".concat(array,"[").concat(index,"]"));}return object;}},{key:"_resolveScene",value:function _resolveScene(scene,index){var _this132=this;scene.id=scene.id||"scene-".concat(index);scene.nodes=(scene.nodes||[]).map(function(node){return _this132.getNode(node);});return scene;}},{key:"_resolveNode",value:function _resolveNode(node,index){var _this133=this;node.id=node.id||"node-".concat(index);if(node.children){node.children=node.children.map(function(child){return _this133.getNode(child);});}if(node.mesh!==undefined){node.mesh=this.getMesh(node.mesh);}else if(node.meshes!==undefined&&node.meshes.length){node.mesh=node.meshes.reduce(function(accum,meshIndex){var mesh=_this133.getMesh(meshIndex);accum.id=mesh.id;accum.primitives=accum.primitives.concat(mesh.primitives);return accum;},{primitives:[]});}if(node.camera!==undefined){node.camera=this.getCamera(node.camera);}if(node.skin!==undefined){node.skin=this.getSkin(node.skin);}return node;}},{key:"_resolveSkin",value:function _resolveSkin(skin,index){skin.id=skin.id||"skin-".concat(index);skin.inverseBindMatrices=this.getAccessor(skin.inverseBindMatrices);return skin;}},{key:"_resolveMesh",value:function _resolveMesh(mesh,index){var _this134=this;mesh.id=mesh.id||"mesh-".concat(index);if(mesh.primitives){mesh.primitives=mesh.primitives.map(function(primitive){primitive=_objectSpread({},primitive);var attributes=primitive.attributes;primitive.attributes={};for(var attribute in attributes){primitive.attributes[attribute]=_this134.getAccessor(attributes[attribute]);}if(primitive.indices!==undefined){primitive.indices=_this134.getAccessor(primitive.indices);}if(primitive.material!==undefined){primitive.material=_this134.getMaterial(primitive.material);}return primitive;});}return mesh;}},{key:"_resolveMaterial",value:function _resolveMaterial(material,index){material.id=material.id||"material-".concat(index);if(material.normalTexture){material.normalTexture=_objectSpread({},material.normalTexture);material.normalTexture.texture=this.getTexture(material.normalTexture.index);}if(material.occlusionTexture){material.occlustionTexture=_objectSpread({},material.occlustionTexture);material.occlusionTexture.texture=this.getTexture(material.occlusionTexture.index);}if(material.emissiveTexture){material.emmisiveTexture=_objectSpread({},material.emmisiveTexture);material.emissiveTexture.texture=this.getTexture(material.emissiveTexture.index);}if(!material.emissiveFactor){material.emissiveFactor=material.emmisiveTexture?[1,1,1]:[0,0,0];}if(material.pbrMetallicRoughness){material.pbrMetallicRoughness=_objectSpread({},material.pbrMetallicRoughness);var mr=material.pbrMetallicRoughness;if(mr.baseColorTexture){mr.baseColorTexture=_objectSpread({},mr.baseColorTexture);mr.baseColorTexture.texture=this.getTexture(mr.baseColorTexture.index);}if(mr.metallicRoughnessTexture){mr.metallicRoughnessTexture=_objectSpread({},mr.metallicRoughnessTexture);mr.metallicRoughnessTexture.texture=this.getTexture(mr.metallicRoughnessTexture.index);}}return material;}},{key:"_resolveAccessor",value:function _resolveAccessor(accessor,index){accessor.id=accessor.id||"accessor-".concat(index);if(accessor.bufferView!==undefined){accessor.bufferView=this.getBufferView(accessor.bufferView);}accessor.bytesPerComponent=getBytesFromComponentType(accessor.componentType);accessor.components=getSizeFromAccessorType(accessor.type);accessor.bytesPerElement=accessor.bytesPerComponent*accessor.components;if(accessor.bufferView){var buffer=accessor.bufferView.buffer;var _getAccessorArrayType3=getAccessorArrayTypeAndLength(accessor,accessor.bufferView),ArrayType=_getAccessorArrayType3.ArrayType,byteLength=_getAccessorArrayType3.byteLength;var byteOffset=(accessor.bufferView.byteOffset||0)+(accessor.byteOffset||0)+buffer.byteOffset;var cutBuffer=buffer.arrayBuffer.slice(byteOffset,byteOffset+byteLength);if(accessor.bufferView.byteStride){cutBuffer=this._getValueFromInterleavedBuffer(buffer,byteOffset,accessor.bufferView.byteStride,accessor.bytesPerElement,accessor.count);}accessor.value=new ArrayType(cutBuffer);}return accessor;}},{key:"_getValueFromInterleavedBuffer",value:function _getValueFromInterleavedBuffer(buffer,byteOffset,byteStride,bytesPerElement,count){var result=new Uint8Array(count*bytesPerElement);for(var _i557=0;_i557<count;_i557++){var elementOffset=byteOffset+_i557*byteStride;result.set(new Uint8Array(buffer.arrayBuffer.slice(elementOffset,elementOffset+bytesPerElement)),_i557*bytesPerElement);}return result.buffer;}},{key:"_resolveTexture",value:function _resolveTexture(texture,index){texture.id=texture.id||"texture-".concat(index);texture.sampler='sampler'in texture?this.getSampler(texture.sampler):DEFAULT_SAMPLER;texture.source=this.getImage(texture.source);return texture;}},{key:"_resolveSampler",value:function _resolveSampler(sampler,index){sampler.id=sampler.id||"sampler-".concat(index);sampler.parameters={};for(var key in sampler){var glEnum=this._enumSamplerParameter(key);if(glEnum!==undefined){sampler.parameters[glEnum]=sampler[key];}}return sampler;}},{key:"_enumSamplerParameter",value:function _enumSamplerParameter(key){return SAMPLER_PARAMETER_GLTF_TO_GL[key];}},{key:"_resolveImage",value:function _resolveImage(image,index){image.id=image.id||"image-".concat(index);if(image.bufferView!==undefined){image.bufferView=this.getBufferView(image.bufferView);}var preloadedImage=this.images[index];if(preloadedImage){image.image=preloadedImage;}return image;}},{key:"_resolveBufferView",value:function _resolveBufferView(bufferView,index){var bufferIndex=bufferView.buffer;var result=_objectSpread(_objectSpread({id:"bufferView-".concat(index)},bufferView),{},{buffer:this.buffers[bufferIndex]});var arrayBuffer=this.buffers[bufferIndex].arrayBuffer;var byteOffset=this.buffers[bufferIndex].byteOffset||0;if('byteOffset'in bufferView){byteOffset+=bufferView.byteOffset;}result.data=new Uint8Array(arrayBuffer,byteOffset,bufferView.byteLength);return result;}},{key:"_resolveCamera",value:function _resolveCamera(camera,index){camera.id=camera.id||"camera-".concat(index);if(camera.perspective);if(camera.orthographic);return camera;}}]);}();function postProcessGLTF(gltf,options){return new GLTFPostProcessor().postProcess(gltf,options);}var MAGIC_glTF=0x676c5446;var GLB_FILE_HEADER_SIZE=12;var GLB_CHUNK_HEADER_SIZE=8;var GLB_CHUNK_TYPE_JSON=0x4e4f534a;var GLB_CHUNK_TYPE_BIN=0x004e4942;var GLB_CHUNK_TYPE_JSON_XVIZ_DEPRECATED=0;var GLB_CHUNK_TYPE_BIX_XVIZ_DEPRECATED=1;var GLB_V1_CONTENT_FORMAT_JSON=0x0;var LE=true;function getMagicString(dataView){var byteOffset=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0;return"".concat(String.fromCharCode(dataView.getUint8(byteOffset+0))).concat(String.fromCharCode(dataView.getUint8(byteOffset+1))).concat(String.fromCharCode(dataView.getUint8(byteOffset+2))).concat(String.fromCharCode(dataView.getUint8(byteOffset+3)));}function isGLB(arrayBuffer){var byteOffset=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0;var options=arguments.length>2&&arguments[2]!==undefined?arguments[2]:{};var dataView=new DataView(arrayBuffer);var _options$magic=options.magic,magic=_options$magic===void 0?MAGIC_glTF:_options$magic;var magic1=dataView.getUint32(byteOffset,false);return magic1===magic||magic1===MAGIC_glTF;}function parseGLBSync(glb,arrayBuffer){var byteOffset=arguments.length>2&&arguments[2]!==undefined?arguments[2]:0;var dataView=new DataView(arrayBuffer);var type=getMagicString(dataView,byteOffset+0);var version=dataView.getUint32(byteOffset+4,LE);var byteLength=dataView.getUint32(byteOffset+8,LE);Object.assign(glb,{header:{byteOffset:byteOffset,byteLength:byteLength,hasBinChunk:false},type:type,version:version,json:{},binChunks:[]});byteOffset+=GLB_FILE_HEADER_SIZE;switch(glb.version){case 1:return parseGLBV1(glb,dataView,byteOffset);case 2:return parseGLBV2(glb,dataView,byteOffset,{});default:throw new Error("Invalid GLB version ".concat(glb.version,". Only supports v1 and v2."));}}function parseGLBV1(glb,dataView,byteOffset){assert$4(glb.header.byteLength>GLB_FILE_HEADER_SIZE+GLB_CHUNK_HEADER_SIZE);var contentLength=dataView.getUint32(byteOffset+0,LE);var contentFormat=dataView.getUint32(byteOffset+4,LE);byteOffset+=GLB_CHUNK_HEADER_SIZE;assert$4(contentFormat===GLB_V1_CONTENT_FORMAT_JSON);parseJSONChunk(glb,dataView,byteOffset,contentLength);byteOffset+=contentLength;byteOffset+=parseBINChunk(glb,dataView,byteOffset,glb.header.byteLength);return byteOffset;}function parseGLBV2(glb,dataView,byteOffset,options){assert$4(glb.header.byteLength>GLB_FILE_HEADER_SIZE+GLB_CHUNK_HEADER_SIZE);parseGLBChunksSync(glb,dataView,byteOffset,options);return byteOffset+glb.header.byteLength;}function parseGLBChunksSync(glb,dataView,byteOffset,options){while(byteOffset+8<=glb.header.byteLength){var chunkLength=dataView.getUint32(byteOffset+0,LE);var chunkFormat=dataView.getUint32(byteOffset+4,LE);byteOffset+=GLB_CHUNK_HEADER_SIZE;switch(chunkFormat){case GLB_CHUNK_TYPE_JSON:parseJSONChunk(glb,dataView,byteOffset,chunkLength);break;case GLB_CHUNK_TYPE_BIN:parseBINChunk(glb,dataView,byteOffset,chunkLength);break;case GLB_CHUNK_TYPE_JSON_XVIZ_DEPRECATED:if(!options.strict){parseJSONChunk(glb,dataView,byteOffset,chunkLength);}break;case GLB_CHUNK_TYPE_BIX_XVIZ_DEPRECATED:if(!options.strict){parseBINChunk(glb,dataView,byteOffset,chunkLength);}break;}byteOffset+=padToNBytes(chunkLength,4);}return byteOffset;}function parseJSONChunk(glb,dataView,byteOffset,chunkLength){var jsonChunk=new Uint8Array(dataView.buffer,byteOffset,chunkLength);var textDecoder=new TextDecoder('utf8');var jsonText=textDecoder.decode(jsonChunk);glb.json=JSON.parse(jsonText);return padToNBytes(chunkLength,4);}function parseBINChunk(glb,dataView,byteOffset,chunkLength){glb.header.hasBinChunk=true;glb.binChunks.push({byteOffset:byteOffset,byteLength:chunkLength,arrayBuffer:dataView.buffer});return padToNBytes(chunkLength,4);}function parseGLTF$1(_x90,_x91){return _parseGLTF$.apply(this,arguments);}function _parseGLTF$(){_parseGLTF$=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee54(gltf,arrayBufferOrString){var _options$gltf,_options$gltf2,_options$gltf3,_options$gltf4,byteOffset,options,context,promises,_promise,promise,_args50=arguments;return _regeneratorRuntime().wrap(function _callee54$(_context57){while(1)switch(_context57.prev=_context57.next){case 0:byteOffset=_args50.length>2&&_args50[2]!==undefined?_args50[2]:0;options=_args50.length>3?_args50[3]:undefined;context=_args50.length>4?_args50[4]:undefined;parseGLTFContainerSync(gltf,arrayBufferOrString,byteOffset,options);normalizeGLTFV1(gltf,{normalize:options===null||options===void 0?void 0:(_options$gltf=options.gltf)===null||_options$gltf===void 0?void 0:_options$gltf.normalize});preprocessExtensions(gltf,options,context);promises=[];if(!(options!==null&&options!==void 0&&(_options$gltf2=options.gltf)!==null&&_options$gltf2!==void 0&&_options$gltf2.loadBuffers&&gltf.json.buffers)){_context57.next=10;break;}_context57.next=10;return loadBuffers(gltf,options,context);case 10:if(options!==null&&options!==void 0&&(_options$gltf3=options.gltf)!==null&&_options$gltf3!==void 0&&_options$gltf3.loadImages){_promise=loadImages(gltf,options,context);promises.push(_promise);}promise=decodeExtensions(gltf,options,context);promises.push(promise);_context57.next=15;return Promise.all(promises);case 15:return _context57.abrupt("return",options!==null&&options!==void 0&&(_options$gltf4=options.gltf)!==null&&_options$gltf4!==void 0&&_options$gltf4.postProcess?postProcessGLTF(gltf,options):gltf);case 16:case"end":return _context57.stop();}},_callee54);}));return _parseGLTF$.apply(this,arguments);}function parseGLTFContainerSync(gltf,data,byteOffset,options){if(options.uri){gltf.baseUri=options.uri;}if(data instanceof ArrayBuffer&&!isGLB(data,byteOffset,options)){var textDecoder=new TextDecoder();data=textDecoder.decode(data);}if(typeof data==='string'){gltf.json=parseJSON(data);}else if(data instanceof ArrayBuffer){var glb={};byteOffset=parseGLBSync(glb,data,byteOffset,options.glb);assert$3(glb.type==='glTF',"Invalid GLB magic string ".concat(glb.type));gltf._glb=glb;gltf.json=glb.json;}else{assert$3(false,'GLTF: must be ArrayBuffer or string');}var buffers=gltf.json.buffers||[];gltf.buffers=new Array(buffers.length).fill(null);if(gltf._glb&&gltf._glb.header.hasBinChunk){var binChunks=gltf._glb.binChunks;gltf.buffers[0]={arrayBuffer:binChunks[0].arrayBuffer,byteOffset:binChunks[0].byteOffset,byteLength:binChunks[0].byteLength};}var images=gltf.json.images||[];gltf.images=new Array(images.length).fill({});}function loadBuffers(_x92,_x93,_x94){return _loadBuffers.apply(this,arguments);}function _loadBuffers(){_loadBuffers=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee55(gltf,options,context){var buffers,_i635,buffer,_context$fetch,_response$arrayBuffer,_fetch,uri,response,arrayBuffer;return _regeneratorRuntime().wrap(function _callee55$(_context58){while(1)switch(_context58.prev=_context58.next){case 0:buffers=gltf.json.buffers||[];_i635=0;case 2:if(!(_i635<buffers.length)){_context58.next=22;break;}buffer=buffers[_i635];if(!buffer.uri){_context58.next=18;break;}_fetch=context.fetch;assert$3(_fetch);uri=resolveUrl(buffer.uri,options);_context58.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=_context58.sent;_context58.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=_context58.sent;gltf.buffers[_i635]={arrayBuffer:arrayBuffer,byteOffset:0,byteLength:arrayBuffer.byteLength};delete buffer.uri;_context58.next=19;break;case 18:if(gltf.buffers[_i635]===null){gltf.buffers[_i635]={arrayBuffer:new ArrayBuffer(buffer.byteLength),byteOffset:0,byteLength:buffer.byteLength};}case 19:++_i635;_context58.next=2;break;case 22:case"end":return _context58.stop();}},_callee55);}));return _loadBuffers.apply(this,arguments);}function loadImages(_x95,_x96,_x97){return _loadImages.apply(this,arguments);}function _loadImages(){_loadImages=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee56(gltf,options,context){var imageIndices,images,promises,_iterator49,_step49,imageIndex;return _regeneratorRuntime().wrap(function _callee56$(_context59){while(1)switch(_context59.prev=_context59.next){case 0:imageIndices=getReferencesImageIndices(gltf);images=gltf.json.images||[];promises=[];_iterator49=_createForOfIteratorHelper(imageIndices);try{for(_iterator49.s();!(_step49=_iterator49.n()).done;){imageIndex=_step49.value;promises.push(loadImage(gltf,images[imageIndex],imageIndex,options,context));}}catch(err){_iterator49.e(err);}finally{_iterator49.f();}_context59.next=7;return Promise.all(promises);case 7:return _context59.abrupt("return",_context59.sent);case 8:case"end":return _context59.stop();}},_callee56);}));return _loadImages.apply(this,arguments);}function getReferencesImageIndices(gltf){var imageIndices=new Set();var textures=gltf.json.textures||[];var _iterator41=_createForOfIteratorHelper(textures),_step41;try{for(_iterator41.s();!(_step41=_iterator41.n()).done;){var texture=_step41.value;if(texture.source!==undefined){imageIndices.add(texture.source);}}}catch(err){_iterator41.e(err);}finally{_iterator41.f();}return Array.from(imageIndices).sort();}function loadImage(_x98,_x99,_x100,_x101,_x102){return _loadImage.apply(this,arguments);}function _loadImage(){_loadImage=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee57(gltf,image,index,options,context){var fetch,parse,arrayBuffer,uri,response,array,parsedImage;return _regeneratorRuntime().wrap(function _callee57$(_context60){while(1)switch(_context60.prev=_context60.next){case 0:fetch=context.fetch,parse=context.parse;if(!(image.uri&&!image.hasOwnProperty('bufferView'))){_context60.next=10;break;}uri=resolveUrl(image.uri,options);_context60.next=5;return fetch(uri);case 5:response=_context60.sent;_context60.next=8;return response.arrayBuffer();case 8:arrayBuffer=_context60.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$3(arrayBuffer,'glTF image has no data');_context60.next=14;return parse(arrayBuffer,[ImageLoader,BasisLoader],{mimeType:image.mimeType,basis:options.basis||{format:selectSupportedBasisFormat()}},context);case 14:parsedImage=_context60.sent;if(parsedImage&&parsedImage[0]){parsedImage={compressed:true,mipmaps:false,width:parsedImage[0].width,height:parsedImage[0].height,data:parsedImage[0]};}gltf.images=gltf.images||[];gltf.images[index]=parsedImage;case 18:case"end":return _context60.stop();}},_callee57);}));return _loadImage.apply(this,arguments);}var GLTFLoader={name:'glTF',id:'gltf',module:'gltf',version:VERSION$7,extensions:['gltf','glb'],mimeTypes:['model/gltf+json','model/gltf-binary'],text:true,binary:true,tests:['glTF'],parse:parse,options:{gltf:{normalize:true,loadBuffers:true,loadImages:true,decompressMeshes:true,postProcess:true},log:console},deprecatedOptions:{fetchImages:'gltf.loadImages',createImages:'gltf.loadImages',decompress:'gltf.decompressMeshes',postProcess:'gltf.postProcess',gltf:{decompress:'gltf.decompressMeshes'}}};function parse(_x103){return _parse.apply(this,arguments);}/**
25223
+ */function fromQuat(out,q){var x=q[0],y=q[1],z=q[2],w=q[3];var x2=x+x;var y2=y+y;var z2=z+z;var xx=x*x2;var yx=y*x2;var yy=y*y2;var zx=z*x2;var zy=z*y2;var zz=z*z2;var wx=w*x2;var wy=w*y2;var wz=w*z2;out[0]=1-yy-zz;out[3]=yx-wz;out[6]=zx+wy;out[1]=yx+wz;out[4]=1-xx-zz;out[7]=zy-wx;out[2]=zx-wy;out[5]=zy+wx;out[8]=1-xx-yy;return out;}var INDICES;(function(INDICES){INDICES[INDICES["COL0ROW0"]=0]="COL0ROW0";INDICES[INDICES["COL0ROW1"]=1]="COL0ROW1";INDICES[INDICES["COL0ROW2"]=2]="COL0ROW2";INDICES[INDICES["COL1ROW0"]=3]="COL1ROW0";INDICES[INDICES["COL1ROW1"]=4]="COL1ROW1";INDICES[INDICES["COL1ROW2"]=5]="COL1ROW2";INDICES[INDICES["COL2ROW0"]=6]="COL2ROW0";INDICES[INDICES["COL2ROW1"]=7]="COL2ROW1";INDICES[INDICES["COL2ROW2"]=8]="COL2ROW2";})(INDICES||(INDICES={}));var IDENTITY_MATRIX=Object.freeze([1,0,0,0,1,0,0,0,1]);var Matrix3=/*#__PURE__*/function(_Matrix){function Matrix3(array){var _this129;for(var _len105=arguments.length,args=new Array(_len105>1?_len105-1:0),_key12=1;_key12<_len105;_key12++){args[_key12-1]=arguments[_key12];}_classCallCheck(this,Matrix3);_this129=_callSuper(this,Matrix3,[-0,-0,-0,-0,-0,-0,-0,-0,-0]);if(arguments.length===1&&Array.isArray(array)){_this129.copy(array);}else if(args.length>0){_this129.copy([array].concat(args));}else{_this129.identity();}return _this129;}_inherits(Matrix3,_Matrix);return _createClass(Matrix3,[{key:"ELEMENTS",get:function get(){return 9;}},{key:"RANK",get:function get(){return 3;}},{key:"INDICES",get:function get(){return INDICES;}},{key:"copy",value:function copy(array){this[0]=array[0];this[1]=array[1];this[2]=array[2];this[3]=array[3];this[4]=array[4];this[5]=array[5];this[6]=array[6];this[7]=array[7];this[8]=array[8];return this.check();}},{key:"identity",value:function identity(){return this.copy(IDENTITY_MATRIX);}},{key:"fromObject",value:function fromObject(object){return this.check();}},{key:"fromQuaternion",value:function fromQuaternion(q){fromQuat(this,q);return this.check();}},{key:"set",value:function set(m00,m10,m20,m01,m11,m21,m02,m12,m22){this[0]=m00;this[1]=m10;this[2]=m20;this[3]=m01;this[4]=m11;this[5]=m21;this[6]=m02;this[7]=m12;this[8]=m22;return this.check();}},{key:"setRowMajor",value:function setRowMajor(m00,m01,m02,m10,m11,m12,m20,m21,m22){this[0]=m00;this[1]=m10;this[2]=m20;this[3]=m01;this[4]=m11;this[5]=m21;this[6]=m02;this[7]=m12;this[8]=m22;return this.check();}},{key:"determinant",value:function determinant(){return _determinant(this);}},{key:"transpose",value:function transpose(){_transpose(this,this);return this.check();}},{key:"invert",value:function invert(){_invert(this,this);return this.check();}},{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)){_scale8(this,this,factor);}else{_scale8(this,this,[factor,factor]);}return this.check();}},{key:"translate",value:function translate(vec){_translate(this,this,vec);return this.check();}},{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;}},{key:"transformVector",value:function transformVector(vector,result){return this.transform(vector,result);}},{key:"transformVector2",value:function transformVector2(vector,result){return this.transform(vector,result);}},{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();}}]);}(Matrix);var ZERO_MATRIX3;var IDENTITY_MATRIX3;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;}var COMPONENTS$1={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16};var BYTES$1={5120:1,5121:1,5122:2,5123:2,5125:4,5126:4};var EXT_MESHOPT_TRANSFORM='KHR_texture_transform';var name$4=EXT_MESHOPT_TRANSFORM;var scratchVector=new Vector3();var scratchRotationMatrix=new Matrix3();var scratchScaleMatrix=new Matrix3();function decode$4(_x80,_x81){return _decode$3.apply(this,arguments);}function _decode$3(){_decode$3=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee47(gltfData,options){var gltfScenegraph,extension,materials,_i638;return _regeneratorRuntime().wrap(function _callee47$(_context50){while(1)switch(_context50.prev=_context50.next){case 0:gltfScenegraph=new GLTFScenegraph(gltfData);extension=gltfScenegraph.getExtension(EXT_MESHOPT_TRANSFORM);if(extension){_context50.next=4;break;}return _context50.abrupt("return");case 4:materials=gltfData.json.materials||[];for(_i638=0;_i638<materials.length;_i638++){transformTexCoords(_i638,gltfData);}case 6:case"end":return _context50.stop();}},_callee47);}));return _decode$3.apply(this,arguments);}function transformTexCoords(materialIndex,gltfData){var _gltfData$json$materi,_material$pbrMetallic,_material$pbrMetallic2;var processedTexCoords=[];var material=(_gltfData$json$materi=gltfData.json.materials)===null||_gltfData$json$materi===void 0?void 0:_gltfData$json$materi[materialIndex];var baseColorTexture=material===null||material===void 0?void 0:(_material$pbrMetallic=material.pbrMetallicRoughness)===null||_material$pbrMetallic===void 0?void 0:_material$pbrMetallic.baseColorTexture;if(baseColorTexture){transformPrimitives(gltfData,materialIndex,baseColorTexture,processedTexCoords);}var emisiveTexture=material===null||material===void 0?void 0:material.emissiveTexture;if(emisiveTexture){transformPrimitives(gltfData,materialIndex,emisiveTexture,processedTexCoords);}var normalTexture=material===null||material===void 0?void 0:material.normalTexture;if(normalTexture){transformPrimitives(gltfData,materialIndex,normalTexture,processedTexCoords);}var occlusionTexture=material===null||material===void 0?void 0:material.occlusionTexture;if(occlusionTexture){transformPrimitives(gltfData,materialIndex,occlusionTexture,processedTexCoords);}var metallicRoughnessTexture=material===null||material===void 0?void 0:(_material$pbrMetallic2=material.pbrMetallicRoughness)===null||_material$pbrMetallic2===void 0?void 0:_material$pbrMetallic2.metallicRoughnessTexture;if(metallicRoughnessTexture){transformPrimitives(gltfData,materialIndex,metallicRoughnessTexture,processedTexCoords);}}function transformPrimitives(gltfData,materialIndex,texture,processedTexCoords){var transformParameters=getTransformParameters(texture,processedTexCoords);if(!transformParameters){return;}var meshes=gltfData.json.meshes||[];var _iterator28=_createForOfIteratorHelper(meshes),_step28;try{for(_iterator28.s();!(_step28=_iterator28.n()).done;){var _mesh6=_step28.value;var _iterator29=_createForOfIteratorHelper(_mesh6.primitives),_step29;try{for(_iterator29.s();!(_step29=_iterator29.n()).done;){var _primitive3=_step29.value;var material=_primitive3.material;if(Number.isFinite(material)&&materialIndex===material){transformPrimitive(gltfData,_primitive3,transformParameters);}}}catch(err){_iterator29.e(err);}finally{_iterator29.f();}}}catch(err){_iterator28.e(err);}finally{_iterator28.f();}}function getTransformParameters(texture,processedTexCoords){var _texture$extensions;var textureInfo=(_texture$extensions=texture.extensions)===null||_texture$extensions===void 0?void 0:_texture$extensions[EXT_MESHOPT_TRANSFORM];var _texture$texCoord=texture.texCoord,originalTexCoord=_texture$texCoord===void 0?0:_texture$texCoord;var _textureInfo$texCoord=textureInfo.texCoord,texCoord=_textureInfo$texCoord===void 0?originalTexCoord:_textureInfo$texCoord;var isProcessed=processedTexCoords.findIndex(function(_ref){var _ref21=_slicedToArray(_ref,2),original=_ref21[0],newTexCoord=_ref21[1];return original===originalTexCoord&&newTexCoord===texCoord;})!==-1;if(!isProcessed){var _matrix2=makeTransformationMatrix(textureInfo);if(originalTexCoord!==texCoord){texture.texCoord=texCoord;}processedTexCoords.push([originalTexCoord,texCoord]);return{originalTexCoord:originalTexCoord,texCoord:texCoord,matrix:_matrix2};}return null;}function transformPrimitive(gltfData,primitive,transformParameters){var originalTexCoord=transformParameters.originalTexCoord,texCoord=transformParameters.texCoord,matrix=transformParameters.matrix;var texCoordAccessor=primitive.attributes["TEXCOORD_".concat(originalTexCoord)];if(Number.isFinite(texCoordAccessor)){var _gltfData$json$access;var accessor=(_gltfData$json$access=gltfData.json.accessors)===null||_gltfData$json$access===void 0?void 0:_gltfData$json$access[texCoordAccessor];if(accessor&&accessor.bufferView){var _gltfData$json$buffer;var bufferView=(_gltfData$json$buffer=gltfData.json.bufferViews)===null||_gltfData$json$buffer===void 0?void 0:_gltfData$json$buffer[accessor.bufferView];if(bufferView){var _gltfData$buffers$buf=gltfData.buffers[bufferView.buffer],arrayBuffer=_gltfData$buffers$buf.arrayBuffer,bufferByteOffset=_gltfData$buffers$buf.byteOffset;var byteOffset=(bufferByteOffset||0)+(accessor.byteOffset||0)+(bufferView.byteOffset||0);var _getAccessorArrayType2=getAccessorArrayTypeAndLength(accessor,bufferView),ArrayType=_getAccessorArrayType2.ArrayType,length=_getAccessorArrayType2.length;var bytes=BYTES$1[accessor.componentType];var components=COMPONENTS$1[accessor.type];var elementAddressScale=bufferView.byteStride||bytes*components;var result=new Float32Array(length);for(var _i556=0;_i556<accessor.count;_i556++){var uv=new ArrayType(arrayBuffer,byteOffset+_i556*elementAddressScale,2);scratchVector.set(uv[0],uv[1],1);scratchVector.transformByMatrix3(matrix);result.set([scratchVector[0],scratchVector[1]],_i556*components);}if(originalTexCoord===texCoord){updateGltf(accessor,bufferView,gltfData.buffers,result);}else{createAttribute(texCoord,accessor,primitive,gltfData,result);}}}}}function updateGltf(accessor,bufferView,buffers,newTexCoordArray){accessor.componentType=5126;buffers.push({arrayBuffer:newTexCoordArray.buffer,byteOffset:0,byteLength:newTexCoordArray.buffer.byteLength});bufferView.buffer=buffers.length-1;bufferView.byteLength=newTexCoordArray.buffer.byteLength;bufferView.byteOffset=0;delete bufferView.byteStride;}function createAttribute(newTexCoord,originalAccessor,primitive,gltfData,newTexCoordArray){gltfData.buffers.push({arrayBuffer:newTexCoordArray.buffer,byteOffset:0,byteLength:newTexCoordArray.buffer.byteLength});var bufferViews=gltfData.json.bufferViews;if(!bufferViews){return;}bufferViews.push({buffer:gltfData.buffers.length-1,byteLength:newTexCoordArray.buffer.byteLength,byteOffset:0});var accessors=gltfData.json.accessors;if(!accessors){return;}accessors.push({bufferView:(bufferViews===null||bufferViews===void 0?void 0:bufferViews.length)-1,byteOffset:0,componentType:5126,count:originalAccessor.count,type:'VEC2'});primitive.attributes["TEXCOORD_".concat(newTexCoord)]=accessors.length-1;}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 translationMatirx=new Matrix3().set(1,0,0,0,1,0,offset[0],offset[1],1);var rotationMatirx=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 translationMatirx.multiplyRight(rotationMatirx).multiplyRight(scaleMatrix);}var KHR_texture_transform=/*#__PURE__*/Object.freeze({__proto__:null,name:name$4,decode:decode$4});var KHR_LIGHTS_PUNCTUAL='KHR_lights_punctual';var name$3=KHR_LIGHTS_PUNCTUAL;function decode$3(_x82){return _decode$4.apply(this,arguments);}function _decode$4(){_decode$4=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee48(gltfData){var gltfScenegraph,json,extension,_iterator46,_step46,_node10,nodeExtension;return _regeneratorRuntime().wrap(function _callee48$(_context51){while(1)switch(_context51.prev=_context51.next){case 0:gltfScenegraph=new GLTFScenegraph(gltfData);json=gltfScenegraph.json;extension=gltfScenegraph.getExtension(KHR_LIGHTS_PUNCTUAL);if(extension){gltfScenegraph.json.lights=extension.lights;gltfScenegraph.removeExtension(KHR_LIGHTS_PUNCTUAL);}_iterator46=_createForOfIteratorHelper(json.nodes||[]);try{for(_iterator46.s();!(_step46=_iterator46.n()).done;){_node10=_step46.value;nodeExtension=gltfScenegraph.getObjectExtension(_node10,KHR_LIGHTS_PUNCTUAL);if(nodeExtension){_node10.light=nodeExtension.light;}gltfScenegraph.removeObjectExtension(_node10,KHR_LIGHTS_PUNCTUAL);}}catch(err){_iterator46.e(err);}finally{_iterator46.f();}case 6:case"end":return _context51.stop();}},_callee48);}));return _decode$4.apply(this,arguments);}function encode$2(_x83){return _encode$.apply(this,arguments);}function _encode$(){_encode$=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee49(gltfData){var gltfScenegraph,json,extension,_iterator47,_step47,light,_node11;return _regeneratorRuntime().wrap(function _callee49$(_context52){while(1)switch(_context52.prev=_context52.next){case 0:gltfScenegraph=new GLTFScenegraph(gltfData);json=gltfScenegraph.json;if(json.lights){extension=gltfScenegraph.addExtension(KHR_LIGHTS_PUNCTUAL);assert$3(!extension.lights);extension.lights=json.lights;delete json.lights;}if(gltfScenegraph.json.lights){_iterator47=_createForOfIteratorHelper(gltfScenegraph.json.lights);try{for(_iterator47.s();!(_step47=_iterator47.n()).done;){light=_step47.value;_node11=light.node;gltfScenegraph.addObjectExtension(_node11,KHR_LIGHTS_PUNCTUAL,light);}}catch(err){_iterator47.e(err);}finally{_iterator47.f();}delete gltfScenegraph.json.lights;}case 4:case"end":return _context52.stop();}},_callee49);}));return _encode$.apply(this,arguments);}var KHR_lights_punctual=/*#__PURE__*/Object.freeze({__proto__:null,name:name$3,decode:decode$3,encode:encode$2});var KHR_MATERIALS_UNLIT='KHR_materials_unlit';var name$2=KHR_MATERIALS_UNLIT;function decode$2(_x84){return _decode$5.apply(this,arguments);}function _decode$5(){_decode$5=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee50(gltfData){var gltfScenegraph,json,_iterator48,_step48,material,extension;return _regeneratorRuntime().wrap(function _callee50$(_context53){while(1)switch(_context53.prev=_context53.next){case 0:gltfScenegraph=new GLTFScenegraph(gltfData);json=gltfScenegraph.json;_iterator48=_createForOfIteratorHelper(json.materials||[]);try{for(_iterator48.s();!(_step48=_iterator48.n()).done;){material=_step48.value;extension=material.extensions&&material.extensions.KHR_materials_unlit;if(extension){material.unlit=true;}gltfScenegraph.removeObjectExtension(material,KHR_MATERIALS_UNLIT);}}catch(err){_iterator48.e(err);}finally{_iterator48.f();}gltfScenegraph.removeExtension(KHR_MATERIALS_UNLIT);case 5:case"end":return _context53.stop();}},_callee50);}));return _decode$5.apply(this,arguments);}function encode$1(gltfData){var gltfScenegraph=new GLTFScenegraph(gltfData);var json=gltfScenegraph.json;if(gltfScenegraph.materials){var _iterator30=_createForOfIteratorHelper(json.materials||[]),_step30;try{for(_iterator30.s();!(_step30=_iterator30.n()).done;){var material=_step30.value;if(material.unlit){delete material.unlit;gltfScenegraph.addObjectExtension(material,KHR_MATERIALS_UNLIT,{});gltfScenegraph.addExtension(KHR_MATERIALS_UNLIT);}}}catch(err){_iterator30.e(err);}finally{_iterator30.f();}}}var KHR_materials_unlit=/*#__PURE__*/Object.freeze({__proto__:null,name:name$2,decode:decode$2,encode:encode$1});var KHR_TECHNIQUES_WEBGL='KHR_techniques_webgl';var name$1=KHR_TECHNIQUES_WEBGL;function decode$1(_x85){return _decode$6.apply(this,arguments);}function _decode$6(){_decode$6=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee51(gltfData){var gltfScenegraph,json,extension,techniques,_iterator49,_step49,material,materialExtension;return _regeneratorRuntime().wrap(function _callee51$(_context54){while(1)switch(_context54.prev=_context54.next){case 0:gltfScenegraph=new GLTFScenegraph(gltfData);json=gltfScenegraph.json;extension=gltfScenegraph.getExtension(KHR_TECHNIQUES_WEBGL);if(extension){techniques=resolveTechniques(extension,gltfScenegraph);_iterator49=_createForOfIteratorHelper(json.materials||[]);try{for(_iterator49.s();!(_step49=_iterator49.n()).done;){material=_step49.value;materialExtension=gltfScenegraph.getObjectExtension(material,KHR_TECHNIQUES_WEBGL);if(materialExtension){material.technique=Object.assign({},materialExtension,techniques[materialExtension.technique]);material.technique.values=resolveValues(material.technique,gltfScenegraph);}gltfScenegraph.removeObjectExtension(material,KHR_TECHNIQUES_WEBGL);}}catch(err){_iterator49.e(err);}finally{_iterator49.f();}gltfScenegraph.removeExtension(KHR_TECHNIQUES_WEBGL);}case 4:case"end":return _context54.stop();}},_callee51);}));return _decode$6.apply(this,arguments);}function encode(_x86,_x87){return _encode.apply(this,arguments);}function _encode(){_encode=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee52(gltfData,options){return _regeneratorRuntime().wrap(function _callee52$(_context55){while(1)switch(_context55.prev=_context55.next){case 0:case"end":return _context55.stop();}},_callee52);}));return _encode.apply(this,arguments);}function resolveTechniques(techniquesExtension,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{throw new Error('KHR_techniques_webgl: no shader code');}});programs.forEach(function(program){program.fragmentShader=shaders[program.fragmentShader];program.vertexShader=shaders[program.vertexShader];});techniques.forEach(function(technique){technique.program=programs[technique.program];});return techniques;}function resolveValues(technique,gltfScenegraph){var values=Object.assign({},technique.values);Object.keys(technique.uniforms||{}).forEach(function(uniform){if(technique.uniforms[uniform].value&&!(uniform in values)){values[uniform]=technique.uniforms[uniform].value;}});Object.keys(values).forEach(function(uniform){if(_typeof2(values[uniform])==='object'&&values[uniform].index!==undefined){values[uniform].texture=gltfScenegraph.getTexture(values[uniform].index);}});return values;}var KHR_techniques_webgl=/*#__PURE__*/Object.freeze({__proto__:null,name:name$1,decode:decode$1,encode:encode});var EXT_FEATURE_METADATA='EXT_feature_metadata';var name=EXT_FEATURE_METADATA;function decode(_x88){return _decode.apply(this,arguments);}function _decode(){_decode=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee53(gltfData){var scenegraph;return _regeneratorRuntime().wrap(function _callee53$(_context56){while(1)switch(_context56.prev=_context56.next){case 0:scenegraph=new GLTFScenegraph(gltfData);decodeExtFeatureMetadata(scenegraph);case 2:case"end":return _context56.stop();}},_callee53);}));return _decode.apply(this,arguments);}function decodeExtFeatureMetadata(scenegraph){var _extension$schema;var extension=scenegraph.getExtension(EXT_FEATURE_METADATA);var schemaClasses=extension===null||extension===void 0?void 0:(_extension$schema=extension.schema)===null||_extension$schema===void 0?void 0:_extension$schema.classes;var featureTables=extension===null||extension===void 0?void 0:extension.featureTables;var featureTextures=extension===null||extension===void 0?void 0:extension.featureTextures;if(featureTextures){console.warn('featureTextures is not yet supported in the "EXT_feature_metadata" extension.');}if(schemaClasses&&featureTables){for(var schemaName in schemaClasses){var schemaClass=schemaClasses[schemaName];var featureTable=findFeatureTableByName(featureTables,schemaName);if(featureTable){handleFeatureTableProperties(scenegraph,featureTable,schemaClass);}}}}function handleFeatureTableProperties(scenegraph,featureTable,schemaClass){for(var propertyName in schemaClass.properties){var _featureTable$propert;var schemaProperty=schemaClass.properties[propertyName];var featureTableProperty=featureTable===null||featureTable===void 0?void 0:(_featureTable$propert=featureTable.properties)===null||_featureTable$propert===void 0?void 0:_featureTable$propert[propertyName];var numberOfFeatures=featureTable.count;if(featureTableProperty){var data=getPropertyDataFromBinarySource(scenegraph,schemaProperty,numberOfFeatures,featureTableProperty);featureTableProperty.data=data;}}}function getPropertyDataFromBinarySource(scenegraph,schemaProperty,numberOfFeatures,featureTableProperty){var bufferView=featureTableProperty.bufferView;var data=scenegraph.getTypedArrayForBufferView(bufferView);switch(schemaProperty.type){case'STRING':{var stringOffsetBufferView=featureTableProperty.stringOffsetBufferView;var offsetsData=scenegraph.getTypedArrayForBufferView(stringOffsetBufferView);data=getStringAttributes(data,offsetsData,numberOfFeatures);break;}}return data;}function findFeatureTableByName(featureTables,schemaClassName){for(var featureTableName in featureTables){var featureTable=featureTables[featureTableName];if(featureTable["class"]===schemaClassName){return featureTable;}}return null;}function getStringAttributes(data,offsetsData,stringsCount){var stringsArray=[];var textDecoder=new TextDecoder('utf8');var stringOffset=0;var bytesPerStringSize=4;for(var index=0;index<stringsCount;index++){var stringByteSize=offsetsData[(index+1)*bytesPerStringSize]-offsetsData[index*bytesPerStringSize];var stringData=data.subarray(stringOffset,stringByteSize+stringOffset);var stringAttribute=textDecoder.decode(stringData);stringsArray.push(stringAttribute);stringOffset+=stringByteSize;}return stringsArray;}var EXT_feature_metadata=/*#__PURE__*/Object.freeze({__proto__:null,name:name,decode:decode});var EXTENSIONS=[EXT_meshopt_compression,EXT_texture_webp,KHR_texture_basisu,KHR_draco_mesh_compression,KHR_lights_punctual,KHR_materials_unlit,KHR_techniques_webgl,KHR_texture_transform,EXT_feature_metadata];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 _iterator31=_createForOfIteratorHelper(extensions),_step31;try{for(_iterator31.s();!(_step31=_iterator31.n()).done;){var extension=_step31.value;var _extension$preprocess;(_extension$preprocess=extension.preprocess)===null||_extension$preprocess===void 0?void 0:_extension$preprocess.call(extension,gltf,options,context);}}catch(err){_iterator31.e(err);}finally{_iterator31.f();}}function decodeExtensions(_x89){return _decodeExtensions.apply(this,arguments);}function _decodeExtensions(){_decodeExtensions=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee54(gltf){var options,context,extensions,_iterator50,_step50,extension,_extension$decode,_args50=arguments;return _regeneratorRuntime().wrap(function _callee54$(_context57){while(1)switch(_context57.prev=_context57.next){case 0:options=_args50.length>1&&_args50[1]!==undefined?_args50[1]:{};context=_args50.length>2?_args50[2]:undefined;extensions=EXTENSIONS.filter(function(extension){return useExtension(extension.name,options);});_iterator50=_createForOfIteratorHelper(extensions);_context57.prev=4;_iterator50.s();case 6:if((_step50=_iterator50.n()).done){_context57.next=12;break;}extension=_step50.value;_context57.next=10;return(_extension$decode=extension.decode)===null||_extension$decode===void 0?void 0:_extension$decode.call(extension,gltf,options,context);case 10:_context57.next=6;break;case 12:_context57.next=17;break;case 14:_context57.prev=14;_context57.t0=_context57["catch"](4);_iterator50.e(_context57.t0);case 17:_context57.prev=17;_iterator50.f();return _context57.finish(17);case 20:case"end":return _context57.stop();}},_callee54,null,[[4,14,17,20]]);}));return _decodeExtensions.apply(this,arguments);}function useExtension(extensionName,options){var _options$gltf;var excludes=(options===null||options===void 0?void 0:(_options$gltf=options.gltf)===null||_options$gltf===void 0?void 0:_options$gltf.excludeExtensions)||{};var exclude=extensionName in excludes&&!excludes[extensionName];return!exclude;}var KHR_BINARY_GLTF='KHR_binary_glTF';function preprocess(gltfData){var gltfScenegraph=new GLTFScenegraph(gltfData);var json=gltfScenegraph.json;var _iterator32=_createForOfIteratorHelper(json.images||[]),_step32;try{for(_iterator32.s();!(_step32=_iterator32.n()).done;){var _image6=_step32.value;var extension=gltfScenegraph.getObjectExtension(_image6,KHR_BINARY_GLTF);if(extension){Object.assign(_image6,extension);}gltfScenegraph.removeObjectExtension(_image6,KHR_BINARY_GLTF);}}catch(err){_iterator32.e(err);}finally{_iterator32.f();}if(json.buffers&&json.buffers[0]){delete json.buffers[0].uri;}gltfScenegraph.removeExtension(KHR_BINARY_GLTF);}var GLTF_ARRAYS={accessors:'accessor',animations:'animation',buffers:'buffer',bufferViews:'bufferView',images:'image',materials:'material',meshes:'mesh',nodes:'node',samplers:'sampler',scenes:'scene',skins:'skin',textures:'texture'};var GLTF_KEYS={accessor:'accessors',animations:'animation',buffer:'buffers',bufferView:'bufferViews',image:'images',material:'materials',mesh:'meshes',node:'nodes',sampler:'samplers',scene:'scenes',skin:'skins',texture:'textures'};var GLTFV1Normalizer=/*#__PURE__*/function(){function GLTFV1Normalizer(){_classCallCheck(this,GLTFV1Normalizer);_defineProperty(this,"idToIndexMap",{animations:{},accessors:{},buffers:{},bufferViews:{},images:{},materials:{},meshes:{},nodes:{},samplers:{},scenes:{},skins:{},textures:{}});_defineProperty(this,"json",void 0);}return _createClass(GLTFV1Normalizer,[{key:"normalize",value:function normalize(gltf,options){this.json=gltf.json;var json=gltf.json;switch(json.asset&&json.asset.version){case'2.0':return;case undefined:case'1.0':break;default:console.warn("glTF: Unknown version ".concat(json.asset.version));return;}if(!options.normalize){throw new Error('glTF v1 is not supported.');}console.warn('Converting glTF v1 to glTF v2 format. This is experimental and may fail.');this._addAsset(json);this._convertTopLevelObjectsToArrays(json);preprocess(gltf);this._convertObjectIdsToArrayIndices(json);this._updateObjects(json);this._updateMaterial(json);}},{key:"_addAsset",value:function _addAsset(json){json.asset=json.asset||{};json.asset.version='2.0';json.asset.generator=json.asset.generator||'Normalized to glTF 2.0 by loaders.gl';}},{key:"_convertTopLevelObjectsToArrays",value:function _convertTopLevelObjectsToArrays(json){for(var arrayName in GLTF_ARRAYS){this._convertTopLevelObjectToArray(json,arrayName);}}},{key:"_convertTopLevelObjectToArray",value:function _convertTopLevelObjectToArray(json,mapName){var objectMap=json[mapName];if(!objectMap||Array.isArray(objectMap)){return;}json[mapName]=[];for(var id in objectMap){var object=objectMap[id];object.id=object.id||id;var index=json[mapName].length;json[mapName].push(object);this.idToIndexMap[mapName][id]=index;}}},{key:"_convertObjectIdsToArrayIndices",value:function _convertObjectIdsToArrayIndices(json){for(var arrayName in GLTF_ARRAYS){this._convertIdsToIndices(json,arrayName);}if('scene'in json){json.scene=this._convertIdToIndex(json.scene,'scene');}var _iterator33=_createForOfIteratorHelper(json.textures),_step33;try{for(_iterator33.s();!(_step33=_iterator33.n()).done;){var texture=_step33.value;this._convertTextureIds(texture);}}catch(err){_iterator33.e(err);}finally{_iterator33.f();}var _iterator34=_createForOfIteratorHelper(json.meshes),_step34;try{for(_iterator34.s();!(_step34=_iterator34.n()).done;){var _mesh7=_step34.value;this._convertMeshIds(_mesh7);}}catch(err){_iterator34.e(err);}finally{_iterator34.f();}var _iterator35=_createForOfIteratorHelper(json.nodes),_step35;try{for(_iterator35.s();!(_step35=_iterator35.n()).done;){var _node4=_step35.value;this._convertNodeIds(_node4);}}catch(err){_iterator35.e(err);}finally{_iterator35.f();}var _iterator36=_createForOfIteratorHelper(json.scenes),_step36;try{for(_iterator36.s();!(_step36=_iterator36.n()).done;){var _node5=_step36.value;this._convertSceneIds(_node5);}}catch(err){_iterator36.e(err);}finally{_iterator36.f();}}},{key:"_convertTextureIds",value:function _convertTextureIds(texture){if(texture.source){texture.source=this._convertIdToIndex(texture.source,'image');}}},{key:"_convertMeshIds",value:function _convertMeshIds(mesh){var _iterator37=_createForOfIteratorHelper(mesh.primitives),_step37;try{for(_iterator37.s();!(_step37=_iterator37.n()).done;){var _primitive4=_step37.value;var attributes=_primitive4.attributes,indices=_primitive4.indices,material=_primitive4.material;for(var attributeName in attributes){attributes[attributeName]=this._convertIdToIndex(attributes[attributeName],'accessor');}if(indices){_primitive4.indices=this._convertIdToIndex(indices,'accessor');}if(material){_primitive4.material=this._convertIdToIndex(material,'material');}}}catch(err){_iterator37.e(err);}finally{_iterator37.f();}}},{key:"_convertNodeIds",value:function _convertNodeIds(node){var _this130=this;if(node.children){node.children=node.children.map(function(child){return _this130._convertIdToIndex(child,'node');});}if(node.meshes){node.meshes=node.meshes.map(function(mesh){return _this130._convertIdToIndex(mesh,'mesh');});}}},{key:"_convertSceneIds",value:function _convertSceneIds(scene){var _this131=this;if(scene.nodes){scene.nodes=scene.nodes.map(function(node){return _this131._convertIdToIndex(node,'node');});}}},{key:"_convertIdsToIndices",value:function _convertIdsToIndices(json,topLevelArrayName){if(!json[topLevelArrayName]){console.warn("gltf v1: json doesn't contain attribute ".concat(topLevelArrayName));json[topLevelArrayName]=[];}var _iterator38=_createForOfIteratorHelper(json[topLevelArrayName]),_step38;try{for(_iterator38.s();!(_step38=_iterator38.n()).done;){var object=_step38.value;for(var key in object){var id=object[key];var index=this._convertIdToIndex(id,key);object[key]=index;}}}catch(err){_iterator38.e(err);}finally{_iterator38.f();}}},{key:"_convertIdToIndex",value:function _convertIdToIndex(id,key){var arrayName=GLTF_KEYS[key];if(arrayName in this.idToIndexMap){var index=this.idToIndexMap[arrayName][id];if(!Number.isFinite(index)){throw new Error("gltf v1: failed to resolve ".concat(key," with id ").concat(id));}return index;}return id;}},{key:"_updateObjects",value:function _updateObjects(json){var _iterator39=_createForOfIteratorHelper(this.json.buffers),_step39;try{for(_iterator39.s();!(_step39=_iterator39.n()).done;){var buffer=_step39.value;delete buffer.type;}}catch(err){_iterator39.e(err);}finally{_iterator39.f();}}},{key:"_updateMaterial",value:function _updateMaterial(json){var _iterator40=_createForOfIteratorHelper(json.materials),_step40;try{var _loop4=function _loop4(){var material=_step40.value;material.pbrMetallicRoughness={baseColorFactor:[1,1,1,1],metallicFactor:1,roughnessFactor:1};var textureId=((_material$values=material.values)===null||_material$values===void 0?void 0:_material$values.tex)||((_material$values2=material.values)===null||_material$values2===void 0?void 0:_material$values2.texture2d_0)||((_material$values3=material.values)===null||_material$values3===void 0?void 0:_material$values3.diffuseTex);var textureIndex=json.textures.findIndex(function(texture){return texture.id===textureId;});if(textureIndex!==-1){material.pbrMetallicRoughness.baseColorTexture={index:textureIndex};}},_material$values,_material$values2,_material$values3;for(_iterator40.s();!(_step40=_iterator40.n()).done;){_loop4();}}catch(err){_iterator40.e(err);}finally{_iterator40.f();}}}]);}();function normalizeGLTFV1(gltf){var options=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};return new GLTFV1Normalizer().normalize(gltf,options);}var COMPONENTS={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16};var BYTES={5120:1,5121:1,5122:2,5123:2,5125:4,5126:4};var GL_SAMPLER={TEXTURE_MAG_FILTER:0x2800,TEXTURE_MIN_FILTER:0x2801,TEXTURE_WRAP_S:0x2802,TEXTURE_WRAP_T:0x2803,REPEAT:0x2901,LINEAR:0x2601,NEAREST_MIPMAP_LINEAR:0x2702};var SAMPLER_PARAMETER_GLTF_TO_GL={magFilter:GL_SAMPLER.TEXTURE_MAG_FILTER,minFilter:GL_SAMPLER.TEXTURE_MIN_FILTER,wrapS:GL_SAMPLER.TEXTURE_WRAP_S,wrapT:GL_SAMPLER.TEXTURE_WRAP_T};var DEFAULT_SAMPLER=_defineProperty2(_defineProperty2(_defineProperty2(_defineProperty2({},GL_SAMPLER.TEXTURE_MAG_FILTER,GL_SAMPLER.LINEAR),GL_SAMPLER.TEXTURE_MIN_FILTER,GL_SAMPLER.NEAREST_MIPMAP_LINEAR),GL_SAMPLER.TEXTURE_WRAP_S,GL_SAMPLER.REPEAT),GL_SAMPLER.TEXTURE_WRAP_T,GL_SAMPLER.REPEAT);function getBytesFromComponentType(componentType){return BYTES[componentType];}function getSizeFromAccessorType(type){return COMPONENTS[type];}var GLTFPostProcessor=/*#__PURE__*/function(){function GLTFPostProcessor(){_classCallCheck(this,GLTFPostProcessor);_defineProperty(this,"baseUri",'');_defineProperty(this,"json",{});_defineProperty(this,"buffers",[]);_defineProperty(this,"images",[]);}return _createClass(GLTFPostProcessor,[{key:"postProcess",value:function postProcess(gltf){var options=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};var json=gltf.json,_gltf$buffers=gltf.buffers,buffers=_gltf$buffers===void 0?[]:_gltf$buffers,_gltf$images=gltf.images,images=_gltf$images===void 0?[]:_gltf$images,_gltf$baseUri=gltf.baseUri,baseUri=_gltf$baseUri===void 0?'':_gltf$baseUri;assert$3(json);this.baseUri=baseUri;this.json=json;this.buffers=buffers;this.images=images;this._resolveTree(this.json,options);return this.json;}},{key:"_resolveTree",value:function _resolveTree(json){var _this132=this;if(json.bufferViews){json.bufferViews=json.bufferViews.map(function(bufView,i){return _this132._resolveBufferView(bufView,i);});}if(json.images){json.images=json.images.map(function(image,i){return _this132._resolveImage(image,i);});}if(json.samplers){json.samplers=json.samplers.map(function(sampler,i){return _this132._resolveSampler(sampler,i);});}if(json.textures){json.textures=json.textures.map(function(texture,i){return _this132._resolveTexture(texture,i);});}if(json.accessors){json.accessors=json.accessors.map(function(accessor,i){return _this132._resolveAccessor(accessor,i);});}if(json.materials){json.materials=json.materials.map(function(material,i){return _this132._resolveMaterial(material,i);});}if(json.meshes){json.meshes=json.meshes.map(function(mesh,i){return _this132._resolveMesh(mesh,i);});}if(json.nodes){json.nodes=json.nodes.map(function(node,i){return _this132._resolveNode(node,i);});}if(json.skins){json.skins=json.skins.map(function(skin,i){return _this132._resolveSkin(skin,i);});}if(json.scenes){json.scenes=json.scenes.map(function(scene,i){return _this132._resolveScene(scene,i);});}if(json.scene!==undefined){json.scene=json.scenes[this.json.scene];}}},{key:"getScene",value:function getScene(index){return this._get('scenes',index);}},{key:"getNode",value:function getNode(index){return this._get('nodes',index);}},{key:"getSkin",value:function getSkin(index){return this._get('skins',index);}},{key:"getMesh",value:function getMesh(index){return this._get('meshes',index);}},{key:"getMaterial",value:function getMaterial(index){return this._get('materials',index);}},{key:"getAccessor",value:function getAccessor(index){return this._get('accessors',index);}},{key:"getCamera",value:function getCamera(index){return null;}},{key:"getTexture",value:function getTexture(index){return this._get('textures',index);}},{key:"getSampler",value:function getSampler(index){return this._get('samplers',index);}},{key:"getImage",value:function getImage(index){return this._get('images',index);}},{key:"getBufferView",value:function getBufferView(index){return this._get('bufferViews',index);}},{key:"getBuffer",value:function getBuffer(index){return this._get('buffers',index);}},{key:"_get",value:function _get(array,index){if(_typeof2(index)==='object'){return index;}var object=this.json[array]&&this.json[array][index];if(!object){console.warn("glTF file error: Could not find ".concat(array,"[").concat(index,"]"));}return object;}},{key:"_resolveScene",value:function _resolveScene(scene,index){var _this133=this;scene.id=scene.id||"scene-".concat(index);scene.nodes=(scene.nodes||[]).map(function(node){return _this133.getNode(node);});return scene;}},{key:"_resolveNode",value:function _resolveNode(node,index){var _this134=this;node.id=node.id||"node-".concat(index);if(node.children){node.children=node.children.map(function(child){return _this134.getNode(child);});}if(node.mesh!==undefined){node.mesh=this.getMesh(node.mesh);}else if(node.meshes!==undefined&&node.meshes.length){node.mesh=node.meshes.reduce(function(accum,meshIndex){var mesh=_this134.getMesh(meshIndex);accum.id=mesh.id;accum.primitives=accum.primitives.concat(mesh.primitives);return accum;},{primitives:[]});}if(node.camera!==undefined){node.camera=this.getCamera(node.camera);}if(node.skin!==undefined){node.skin=this.getSkin(node.skin);}return node;}},{key:"_resolveSkin",value:function _resolveSkin(skin,index){skin.id=skin.id||"skin-".concat(index);skin.inverseBindMatrices=this.getAccessor(skin.inverseBindMatrices);return skin;}},{key:"_resolveMesh",value:function _resolveMesh(mesh,index){var _this135=this;mesh.id=mesh.id||"mesh-".concat(index);if(mesh.primitives){mesh.primitives=mesh.primitives.map(function(primitive){primitive=_objectSpread({},primitive);var attributes=primitive.attributes;primitive.attributes={};for(var attribute in attributes){primitive.attributes[attribute]=_this135.getAccessor(attributes[attribute]);}if(primitive.indices!==undefined){primitive.indices=_this135.getAccessor(primitive.indices);}if(primitive.material!==undefined){primitive.material=_this135.getMaterial(primitive.material);}return primitive;});}return mesh;}},{key:"_resolveMaterial",value:function _resolveMaterial(material,index){material.id=material.id||"material-".concat(index);if(material.normalTexture){material.normalTexture=_objectSpread({},material.normalTexture);material.normalTexture.texture=this.getTexture(material.normalTexture.index);}if(material.occlusionTexture){material.occlustionTexture=_objectSpread({},material.occlustionTexture);material.occlusionTexture.texture=this.getTexture(material.occlusionTexture.index);}if(material.emissiveTexture){material.emmisiveTexture=_objectSpread({},material.emmisiveTexture);material.emissiveTexture.texture=this.getTexture(material.emissiveTexture.index);}if(!material.emissiveFactor){material.emissiveFactor=material.emmisiveTexture?[1,1,1]:[0,0,0];}if(material.pbrMetallicRoughness){material.pbrMetallicRoughness=_objectSpread({},material.pbrMetallicRoughness);var mr=material.pbrMetallicRoughness;if(mr.baseColorTexture){mr.baseColorTexture=_objectSpread({},mr.baseColorTexture);mr.baseColorTexture.texture=this.getTexture(mr.baseColorTexture.index);}if(mr.metallicRoughnessTexture){mr.metallicRoughnessTexture=_objectSpread({},mr.metallicRoughnessTexture);mr.metallicRoughnessTexture.texture=this.getTexture(mr.metallicRoughnessTexture.index);}}return material;}},{key:"_resolveAccessor",value:function _resolveAccessor(accessor,index){accessor.id=accessor.id||"accessor-".concat(index);if(accessor.bufferView!==undefined){accessor.bufferView=this.getBufferView(accessor.bufferView);}accessor.bytesPerComponent=getBytesFromComponentType(accessor.componentType);accessor.components=getSizeFromAccessorType(accessor.type);accessor.bytesPerElement=accessor.bytesPerComponent*accessor.components;if(accessor.bufferView){var buffer=accessor.bufferView.buffer;var _getAccessorArrayType3=getAccessorArrayTypeAndLength(accessor,accessor.bufferView),ArrayType=_getAccessorArrayType3.ArrayType,byteLength=_getAccessorArrayType3.byteLength;var byteOffset=(accessor.bufferView.byteOffset||0)+(accessor.byteOffset||0)+buffer.byteOffset;var cutBuffer=buffer.arrayBuffer.slice(byteOffset,byteOffset+byteLength);if(accessor.bufferView.byteStride){cutBuffer=this._getValueFromInterleavedBuffer(buffer,byteOffset,accessor.bufferView.byteStride,accessor.bytesPerElement,accessor.count);}accessor.value=new ArrayType(cutBuffer);}return accessor;}},{key:"_getValueFromInterleavedBuffer",value:function _getValueFromInterleavedBuffer(buffer,byteOffset,byteStride,bytesPerElement,count){var result=new Uint8Array(count*bytesPerElement);for(var _i557=0;_i557<count;_i557++){var elementOffset=byteOffset+_i557*byteStride;result.set(new Uint8Array(buffer.arrayBuffer.slice(elementOffset,elementOffset+bytesPerElement)),_i557*bytesPerElement);}return result.buffer;}},{key:"_resolveTexture",value:function _resolveTexture(texture,index){texture.id=texture.id||"texture-".concat(index);texture.sampler='sampler'in texture?this.getSampler(texture.sampler):DEFAULT_SAMPLER;texture.source=this.getImage(texture.source);return texture;}},{key:"_resolveSampler",value:function _resolveSampler(sampler,index){sampler.id=sampler.id||"sampler-".concat(index);sampler.parameters={};for(var key in sampler){var glEnum=this._enumSamplerParameter(key);if(glEnum!==undefined){sampler.parameters[glEnum]=sampler[key];}}return sampler;}},{key:"_enumSamplerParameter",value:function _enumSamplerParameter(key){return SAMPLER_PARAMETER_GLTF_TO_GL[key];}},{key:"_resolveImage",value:function _resolveImage(image,index){image.id=image.id||"image-".concat(index);if(image.bufferView!==undefined){image.bufferView=this.getBufferView(image.bufferView);}var preloadedImage=this.images[index];if(preloadedImage){image.image=preloadedImage;}return image;}},{key:"_resolveBufferView",value:function _resolveBufferView(bufferView,index){var bufferIndex=bufferView.buffer;var result=_objectSpread(_objectSpread({id:"bufferView-".concat(index)},bufferView),{},{buffer:this.buffers[bufferIndex]});var arrayBuffer=this.buffers[bufferIndex].arrayBuffer;var byteOffset=this.buffers[bufferIndex].byteOffset||0;if('byteOffset'in bufferView){byteOffset+=bufferView.byteOffset;}result.data=new Uint8Array(arrayBuffer,byteOffset,bufferView.byteLength);return result;}},{key:"_resolveCamera",value:function _resolveCamera(camera,index){camera.id=camera.id||"camera-".concat(index);if(camera.perspective);if(camera.orthographic);return camera;}}]);}();function postProcessGLTF(gltf,options){return new GLTFPostProcessor().postProcess(gltf,options);}var MAGIC_glTF=0x676c5446;var GLB_FILE_HEADER_SIZE=12;var GLB_CHUNK_HEADER_SIZE=8;var GLB_CHUNK_TYPE_JSON=0x4e4f534a;var GLB_CHUNK_TYPE_BIN=0x004e4942;var GLB_CHUNK_TYPE_JSON_XVIZ_DEPRECATED=0;var GLB_CHUNK_TYPE_BIX_XVIZ_DEPRECATED=1;var GLB_V1_CONTENT_FORMAT_JSON=0x0;var LE=true;function getMagicString(dataView){var byteOffset=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0;return"".concat(String.fromCharCode(dataView.getUint8(byteOffset+0))).concat(String.fromCharCode(dataView.getUint8(byteOffset+1))).concat(String.fromCharCode(dataView.getUint8(byteOffset+2))).concat(String.fromCharCode(dataView.getUint8(byteOffset+3)));}function isGLB(arrayBuffer){var byteOffset=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0;var options=arguments.length>2&&arguments[2]!==undefined?arguments[2]:{};var dataView=new DataView(arrayBuffer);var _options$magic=options.magic,magic=_options$magic===void 0?MAGIC_glTF:_options$magic;var magic1=dataView.getUint32(byteOffset,false);return magic1===magic||magic1===MAGIC_glTF;}function parseGLBSync(glb,arrayBuffer){var byteOffset=arguments.length>2&&arguments[2]!==undefined?arguments[2]:0;var dataView=new DataView(arrayBuffer);var type=getMagicString(dataView,byteOffset+0);var version=dataView.getUint32(byteOffset+4,LE);var byteLength=dataView.getUint32(byteOffset+8,LE);Object.assign(glb,{header:{byteOffset:byteOffset,byteLength:byteLength,hasBinChunk:false},type:type,version:version,json:{},binChunks:[]});byteOffset+=GLB_FILE_HEADER_SIZE;switch(glb.version){case 1:return parseGLBV1(glb,dataView,byteOffset);case 2:return parseGLBV2(glb,dataView,byteOffset,{});default:throw new Error("Invalid GLB version ".concat(glb.version,". Only supports v1 and v2."));}}function parseGLBV1(glb,dataView,byteOffset){assert$4(glb.header.byteLength>GLB_FILE_HEADER_SIZE+GLB_CHUNK_HEADER_SIZE);var contentLength=dataView.getUint32(byteOffset+0,LE);var contentFormat=dataView.getUint32(byteOffset+4,LE);byteOffset+=GLB_CHUNK_HEADER_SIZE;assert$4(contentFormat===GLB_V1_CONTENT_FORMAT_JSON);parseJSONChunk(glb,dataView,byteOffset,contentLength);byteOffset+=contentLength;byteOffset+=parseBINChunk(glb,dataView,byteOffset,glb.header.byteLength);return byteOffset;}function parseGLBV2(glb,dataView,byteOffset,options){assert$4(glb.header.byteLength>GLB_FILE_HEADER_SIZE+GLB_CHUNK_HEADER_SIZE);parseGLBChunksSync(glb,dataView,byteOffset,options);return byteOffset+glb.header.byteLength;}function parseGLBChunksSync(glb,dataView,byteOffset,options){while(byteOffset+8<=glb.header.byteLength){var chunkLength=dataView.getUint32(byteOffset+0,LE);var chunkFormat=dataView.getUint32(byteOffset+4,LE);byteOffset+=GLB_CHUNK_HEADER_SIZE;switch(chunkFormat){case GLB_CHUNK_TYPE_JSON:parseJSONChunk(glb,dataView,byteOffset,chunkLength);break;case GLB_CHUNK_TYPE_BIN:parseBINChunk(glb,dataView,byteOffset,chunkLength);break;case GLB_CHUNK_TYPE_JSON_XVIZ_DEPRECATED:if(!options.strict){parseJSONChunk(glb,dataView,byteOffset,chunkLength);}break;case GLB_CHUNK_TYPE_BIX_XVIZ_DEPRECATED:if(!options.strict){parseBINChunk(glb,dataView,byteOffset,chunkLength);}break;}byteOffset+=padToNBytes(chunkLength,4);}return byteOffset;}function parseJSONChunk(glb,dataView,byteOffset,chunkLength){var jsonChunk=new Uint8Array(dataView.buffer,byteOffset,chunkLength);var textDecoder=new TextDecoder('utf8');var jsonText=textDecoder.decode(jsonChunk);glb.json=JSON.parse(jsonText);return padToNBytes(chunkLength,4);}function parseBINChunk(glb,dataView,byteOffset,chunkLength){glb.header.hasBinChunk=true;glb.binChunks.push({byteOffset:byteOffset,byteLength:chunkLength,arrayBuffer:dataView.buffer});return padToNBytes(chunkLength,4);}function parseGLTF$1(_x90,_x91){return _parseGLTF$.apply(this,arguments);}function _parseGLTF$(){_parseGLTF$=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee55(gltf,arrayBufferOrString){var _options$gltf,_options$gltf2,_options$gltf3,_options$gltf4,byteOffset,options,context,promises,_promise,promise,_args51=arguments;return _regeneratorRuntime().wrap(function _callee55$(_context58){while(1)switch(_context58.prev=_context58.next){case 0:byteOffset=_args51.length>2&&_args51[2]!==undefined?_args51[2]:0;options=_args51.length>3?_args51[3]:undefined;context=_args51.length>4?_args51[4]:undefined;parseGLTFContainerSync(gltf,arrayBufferOrString,byteOffset,options);normalizeGLTFV1(gltf,{normalize:options===null||options===void 0?void 0:(_options$gltf=options.gltf)===null||_options$gltf===void 0?void 0:_options$gltf.normalize});preprocessExtensions(gltf,options,context);promises=[];if(!(options!==null&&options!==void 0&&(_options$gltf2=options.gltf)!==null&&_options$gltf2!==void 0&&_options$gltf2.loadBuffers&&gltf.json.buffers)){_context58.next=10;break;}_context58.next=10;return loadBuffers(gltf,options,context);case 10:if(options!==null&&options!==void 0&&(_options$gltf3=options.gltf)!==null&&_options$gltf3!==void 0&&_options$gltf3.loadImages){_promise=loadImages(gltf,options,context);promises.push(_promise);}promise=decodeExtensions(gltf,options,context);promises.push(promise);_context58.next=15;return Promise.all(promises);case 15:return _context58.abrupt("return",options!==null&&options!==void 0&&(_options$gltf4=options.gltf)!==null&&_options$gltf4!==void 0&&_options$gltf4.postProcess?postProcessGLTF(gltf,options):gltf);case 16:case"end":return _context58.stop();}},_callee55);}));return _parseGLTF$.apply(this,arguments);}function parseGLTFContainerSync(gltf,data,byteOffset,options){if(options.uri){gltf.baseUri=options.uri;}if(data instanceof ArrayBuffer&&!isGLB(data,byteOffset,options)){var textDecoder=new TextDecoder();data=textDecoder.decode(data);}if(typeof data==='string'){gltf.json=parseJSON(data);}else if(data instanceof ArrayBuffer){var glb={};byteOffset=parseGLBSync(glb,data,byteOffset,options.glb);assert$3(glb.type==='glTF',"Invalid GLB magic string ".concat(glb.type));gltf._glb=glb;gltf.json=glb.json;}else{assert$3(false,'GLTF: must be ArrayBuffer or string');}var buffers=gltf.json.buffers||[];gltf.buffers=new Array(buffers.length).fill(null);if(gltf._glb&&gltf._glb.header.hasBinChunk){var binChunks=gltf._glb.binChunks;gltf.buffers[0]={arrayBuffer:binChunks[0].arrayBuffer,byteOffset:binChunks[0].byteOffset,byteLength:binChunks[0].byteLength};}var images=gltf.json.images||[];gltf.images=new Array(images.length).fill({});}function loadBuffers(_x92,_x93,_x94){return _loadBuffers.apply(this,arguments);}function _loadBuffers(){_loadBuffers=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee56(gltf,options,context){var buffers,_i639,buffer,_context$fetch,_response$arrayBuffer,_fetch,uri,response,arrayBuffer;return _regeneratorRuntime().wrap(function _callee56$(_context59){while(1)switch(_context59.prev=_context59.next){case 0:buffers=gltf.json.buffers||[];_i639=0;case 2:if(!(_i639<buffers.length)){_context59.next=22;break;}buffer=buffers[_i639];if(!buffer.uri){_context59.next=18;break;}_fetch=context.fetch;assert$3(_fetch);uri=resolveUrl(buffer.uri,options);_context59.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=_context59.sent;_context59.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=_context59.sent;gltf.buffers[_i639]={arrayBuffer:arrayBuffer,byteOffset:0,byteLength:arrayBuffer.byteLength};delete buffer.uri;_context59.next=19;break;case 18:if(gltf.buffers[_i639]===null){gltf.buffers[_i639]={arrayBuffer:new ArrayBuffer(buffer.byteLength),byteOffset:0,byteLength:buffer.byteLength};}case 19:++_i639;_context59.next=2;break;case 22:case"end":return _context59.stop();}},_callee56);}));return _loadBuffers.apply(this,arguments);}function loadImages(_x95,_x96,_x97){return _loadImages.apply(this,arguments);}function _loadImages(){_loadImages=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee57(gltf,options,context){var imageIndices,images,promises,_iterator51,_step51,imageIndex;return _regeneratorRuntime().wrap(function _callee57$(_context60){while(1)switch(_context60.prev=_context60.next){case 0:imageIndices=getReferencesImageIndices(gltf);images=gltf.json.images||[];promises=[];_iterator51=_createForOfIteratorHelper(imageIndices);try{for(_iterator51.s();!(_step51=_iterator51.n()).done;){imageIndex=_step51.value;promises.push(loadImage(gltf,images[imageIndex],imageIndex,options,context));}}catch(err){_iterator51.e(err);}finally{_iterator51.f();}_context60.next=7;return Promise.all(promises);case 7:return _context60.abrupt("return",_context60.sent);case 8:case"end":return _context60.stop();}},_callee57);}));return _loadImages.apply(this,arguments);}function getReferencesImageIndices(gltf){var imageIndices=new Set();var textures=gltf.json.textures||[];var _iterator41=_createForOfIteratorHelper(textures),_step41;try{for(_iterator41.s();!(_step41=_iterator41.n()).done;){var texture=_step41.value;if(texture.source!==undefined){imageIndices.add(texture.source);}}}catch(err){_iterator41.e(err);}finally{_iterator41.f();}return Array.from(imageIndices).sort();}function loadImage(_x98,_x99,_x100,_x101,_x102){return _loadImage.apply(this,arguments);}function _loadImage(){_loadImage=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee58(gltf,image,index,options,context){var fetch,parse,arrayBuffer,uri,response,array,parsedImage;return _regeneratorRuntime().wrap(function _callee58$(_context61){while(1)switch(_context61.prev=_context61.next){case 0:fetch=context.fetch,parse=context.parse;if(!(image.uri&&!image.hasOwnProperty('bufferView'))){_context61.next=10;break;}uri=resolveUrl(image.uri,options);_context61.next=5;return fetch(uri);case 5:response=_context61.sent;_context61.next=8;return response.arrayBuffer();case 8:arrayBuffer=_context61.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$3(arrayBuffer,'glTF image has no data');_context61.next=14;return parse(arrayBuffer,[ImageLoader,BasisLoader],{mimeType:image.mimeType,basis:options.basis||{format:selectSupportedBasisFormat()}},context);case 14:parsedImage=_context61.sent;if(parsedImage&&parsedImage[0]){parsedImage={compressed:true,mipmaps:false,width:parsedImage[0].width,height:parsedImage[0].height,data:parsedImage[0]};}gltf.images=gltf.images||[];gltf.images[index]=parsedImage;case 18:case"end":return _context61.stop();}},_callee58);}));return _loadImage.apply(this,arguments);}var GLTFLoader={name:'glTF',id:'gltf',module:'gltf',version:VERSION$7,extensions:['gltf','glb'],mimeTypes:['model/gltf+json','model/gltf-binary'],text:true,binary:true,tests:['glTF'],parse:parse,options:{gltf:{normalize:true,loadBuffers:true,loadImages:true,decompressMeshes:true,postProcess:true},log:console},deprecatedOptions:{fetchImages:'gltf.loadImages',createImages:'gltf.loadImages',decompress:'gltf.decompressMeshes',postProcess:'gltf.postProcess',gltf:{decompress:'gltf.decompressMeshes'}}};function parse(_x103){return _parse.apply(this,arguments);}/**
24977
25224
  * @private
24978
- */function _parse(){_parse=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee58(arrayBuffer){var options,context,_options2,_options2$byteOffset,byteOffset,gltf,_args54=arguments;return _regeneratorRuntime().wrap(function _callee58$(_context61){while(1)switch(_context61.prev=_context61.next){case 0:options=_args54.length>1&&_args54[1]!==undefined?_args54[1]:{};context=_args54.length>2?_args54[2]:undefined;options=_objectSpread(_objectSpread({},GLTFLoader.options),options);options.gltf=_objectSpread(_objectSpread({},GLTFLoader.options.gltf),options.gltf);_options2=options,_options2$byteOffset=_options2.byteOffset,byteOffset=_options2$byteOffset===void 0?0:_options2$byteOffset;gltf={};_context61.next=8;return parseGLTF$1(gltf,arrayBuffer,byteOffset,options,context);case 8:return _context61.abrupt("return",_context61.sent);case 9:case"end":return _context61.stop();}},_callee58);}));return _parse.apply(this,arguments);}var GLTFSceneModelLoader=/*#__PURE__*/function(){function GLTFSceneModelLoader(cfg){_classCallCheck(this,GLTFSceneModelLoader);}return _createClass(GLTFSceneModelLoader,[{key:"load",value:function load(plugin,src,metaModelJSON,options,sceneModel,ok,error){options=options||{};loadGLTF(plugin,src,metaModelJSON,options,sceneModel,function(){core.scheduleTask(function(){sceneModel.scene.fire("modelLoaded",sceneModel.id);// FIXME: Assumes listeners know order of these two events
25225
+ */function _parse(){_parse=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee59(arrayBuffer){var options,context,_options2,_options2$byteOffset,byteOffset,gltf,_args55=arguments;return _regeneratorRuntime().wrap(function _callee59$(_context62){while(1)switch(_context62.prev=_context62.next){case 0:options=_args55.length>1&&_args55[1]!==undefined?_args55[1]:{};context=_args55.length>2?_args55[2]:undefined;options=_objectSpread(_objectSpread({},GLTFLoader.options),options);options.gltf=_objectSpread(_objectSpread({},GLTFLoader.options.gltf),options.gltf);_options2=options,_options2$byteOffset=_options2.byteOffset,byteOffset=_options2$byteOffset===void 0?0:_options2$byteOffset;gltf={};_context62.next=8;return parseGLTF$1(gltf,arrayBuffer,byteOffset,options,context);case 8:return _context62.abrupt("return",_context62.sent);case 9:case"end":return _context62.stop();}},_callee59);}));return _parse.apply(this,arguments);}var GLTFSceneModelLoader=/*#__PURE__*/function(){function GLTFSceneModelLoader(cfg){_classCallCheck(this,GLTFSceneModelLoader);}return _createClass(GLTFSceneModelLoader,[{key:"load",value:function load(plugin,src,metaModelJSON,options,sceneModel,ok,error){options=options||{};loadGLTF(plugin,src,metaModelJSON,options,sceneModel,function(){core.scheduleTask(function(){sceneModel.scene.fire("modelLoaded",sceneModel.id);// FIXME: Assumes listeners know order of these two events
24979
25226
  sceneModel.fire("loaded",true,false);});if(ok){ok();}},function(msg){plugin.error(msg);if(error){error(msg);}sceneModel.fire("error",msg);});}},{key:"parse",value:function parse(plugin,gltf,metaModelJSON,options,sceneModel,ok,error){options=options||{};parseGLTF(plugin,"",gltf,metaModelJSON,options,sceneModel,function(){sceneModel.scene.fire("modelLoaded",sceneModel.id);// FIXME: Assumes listeners know order of these two events
24980
25227
  sceneModel.fire("loaded",true,false);if(ok){ok();}});}}]);}();function loadGLTF(plugin,src,metaModelJSON,options,sceneModel,ok,error){var spinner=plugin.viewer.scene.canvas.spinner;spinner.processes++;var isGLB=src.split(".").pop()==="glb";if(isGLB){plugin.dataSource.getGLB(src,function(arrayBuffer){// OK
24981
25228
  options.basePath=getBasePath(src);parseGLTF(plugin,src,arrayBuffer,metaModelJSON,options,sceneModel,ok);spinner.processes--;},function(err){spinner.processes--;error(err);});}else{plugin.dataSource.getGLTF(src,function(gltf){// OK
@@ -25167,7 +25414,7 @@ if(rtcNeeded){meshCfg.origin=origin;}ctx.sceneModel.createMesh(meshCfg);meshIds.
25167
25414
  * });
25168
25415
  * ````
25169
25416
  * @class GLTFLoaderPlugin
25170
- */var GLTFLoaderPlugin=/*#__PURE__*/function(_Plugin6){/**
25417
+ */var GLTFLoaderPlugin=/*#__PURE__*/function(_Plugin7){/**
25171
25418
  * @constructor
25172
25419
  *
25173
25420
  * @param {Viewer} viewer The Viewer.
@@ -25175,13 +25422,13 @@ if(rtcNeeded){meshCfg.origin=origin;}ctx.sceneModel.createMesh(meshCfg);meshIds.
25175
25422
  * @param {String} [cfg.id="GLTFLoader"] Optional ID for this plugin, so that we can find it within {@link Viewer#plugins}.
25176
25423
  * @param {Object} [cfg.objectDefaults] Map of initial default states for each loaded {@link Entity} that represents an object. Default value is {@link IFCObjectDefaults}.
25177
25424
  * @param {Object} [cfg.dataSource] A custom data source through which the GLTFLoaderPlugin can load metadata, glTF and binary attachments. Defaults to an instance of {@link GLTFDefaultDataSource}, which loads over HTTP.
25178
- */function GLTFLoaderPlugin(viewer){var _this135;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,GLTFLoaderPlugin);_this135=_callSuper(this,GLTFLoaderPlugin,["GLTFLoader",viewer,cfg]);_this135._sceneModelLoader=new GLTFSceneModelLoader(_this135,cfg);_this135.dataSource=cfg.dataSource;_this135.objectDefaults=cfg.objectDefaults;return _this135;}/**
25425
+ */function GLTFLoaderPlugin(viewer){var _this136;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,GLTFLoaderPlugin);_this136=_callSuper(this,GLTFLoaderPlugin,["GLTFLoader",viewer,cfg]);_this136._sceneModelLoader=new GLTFSceneModelLoader(_this136,cfg);_this136.dataSource=cfg.dataSource;_this136.objectDefaults=cfg.objectDefaults;return _this136;}/**
25179
25426
  * Sets a custom data source through which the GLTFLoaderPlugin can load metadata, glTF and binary attachments.
25180
25427
  *
25181
25428
  * Default value is {@link GLTFDefaultDataSource}, which loads via an XMLHttpRequest.
25182
25429
  *
25183
25430
  * @type {Object}
25184
- */_inherits(GLTFLoaderPlugin,_Plugin6);return _createClass(GLTFLoaderPlugin,[{key:"dataSource",get:/**
25431
+ */_inherits(GLTFLoaderPlugin,_Plugin7);return _createClass(GLTFLoaderPlugin,[{key:"dataSource",get:/**
25185
25432
  * Gets the custom data source through which the GLTFLoaderPlugin can load metadata, glTF and binary attachments.
25186
25433
  *
25187
25434
  * Default value is {@link GLTFDefaultDataSource}, which loads via an XMLHttpRequest.
@@ -25228,9 +25475,9 @@ if(rtcNeeded){meshCfg.origin=origin;}ctx.sceneModel.createMesh(meshCfg);meshIds.
25228
25475
  * @param {Boolean} [params.autoMetaModel] When supplied, creates a default MetaModel with a single MetaObject.
25229
25476
  * @param {Boolean} [params.globalizeObjectIds=false] Indicates whether to globalize each {@link Entity#id} and {@link MetaObject#id}, in case you need to prevent ID clashes with other models.
25230
25477
  * @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}
25231
- */,set:function set(value){this._objectDefaults=value||IFCObjectDefaults;}},{key:"load",value:function load(){var _this136=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,dtxEnabled:params.dtxEnabled}));var modelId=sceneModel.id;// In case ID was auto-generated
25478
+ */,set:function set(value){this._objectDefaults=value||IFCObjectDefaults;}},{key:"load",value:function load(){var _this137=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,dtxEnabled:params.dtxEnabled}));var modelId=sceneModel.id;// In case ID was auto-generated
25232
25479
  if(!params.src&&!params.gltf){this.error("load() param expected: src or gltf");return sceneModel;// Return new empty model
25233
- }if(params.metaModelSrc||params.metaModelJSON){var processMetaModelJSON=function processMetaModelJSON(metaModelJSON){_this136.viewer.metaScene.createMetaModel(modelId,metaModelJSON,{});_this136.viewer.scene.canvas.spinner.processes--;if(params.src){_this136._sceneModelLoader.load(_this136,params.src,metaModelJSON,params,sceneModel);}else{_this136._sceneModelLoader.parse(_this136,params.gltf,metaModelJSON,params,sceneModel);}};if(params.metaModelSrc){var metaModelSrc=params.metaModelSrc;this.viewer.scene.canvas.spinner.processes++;this._dataSource.getMetaModel(metaModelSrc,function(metaModelJSON){_this136.viewer.scene.canvas.spinner.processes--;processMetaModelJSON(metaModelJSON);},function(errMsg){_this136.error("load(): Failed to load model metadata for model '".concat(modelId," from '").concat(metaModelSrc,"' - ").concat(errMsg));_this136.viewer.scene.canvas.spinner.processes--;});}else if(params.metaModelJSON){processMetaModelJSON(params.metaModelJSON);}}else{if(params.src){this._sceneModelLoader.load(this,params.src,null,params,sceneModel);}else{this._sceneModelLoader.parse(this,params.gltf,null,params,sceneModel);}}sceneModel.once("destroyed",function(){_this136.viewer.metaScene.destroyMetaModel(modelId);});return sceneModel;}/**
25480
+ }if(params.metaModelSrc||params.metaModelJSON){var processMetaModelJSON=function processMetaModelJSON(metaModelJSON){_this137.viewer.metaScene.createMetaModel(modelId,metaModelJSON,{});_this137.viewer.scene.canvas.spinner.processes--;if(params.src){_this137._sceneModelLoader.load(_this137,params.src,metaModelJSON,params,sceneModel);}else{_this137._sceneModelLoader.parse(_this137,params.gltf,metaModelJSON,params,sceneModel);}};if(params.metaModelSrc){var metaModelSrc=params.metaModelSrc;this.viewer.scene.canvas.spinner.processes++;this._dataSource.getMetaModel(metaModelSrc,function(metaModelJSON){_this137.viewer.scene.canvas.spinner.processes--;processMetaModelJSON(metaModelJSON);},function(errMsg){_this137.error("load(): Failed to load model metadata for model '".concat(modelId," from '").concat(metaModelSrc,"' - ").concat(errMsg));_this137.viewer.scene.canvas.spinner.processes--;});}else if(params.metaModelJSON){processMetaModelJSON(params.metaModelJSON);}}else{if(params.src){this._sceneModelLoader.load(this,params.src,null,params,sceneModel);}else{this._sceneModelLoader.parse(this,params.gltf,null,params,sceneModel);}}sceneModel.once("destroyed",function(){_this137.viewer.metaScene.destroyMetaModel(modelId);});return sceneModel;}/**
25234
25481
  * Destroys this GLTFLoaderPlugin.
25235
25482
  */},{key:"destroy",value:function destroy(){_superPropGet(GLTFLoaderPlugin,"destroy",this,3)([]);}}]);}(Plugin);/**
25236
25483
  * @private
@@ -25334,7 +25581,7 @@ for(var i=0,len=areas.length;i<len;i++){var area=areas[i];var boundaries=area.bo
25334
25581
  * edges: true
25335
25582
  * });
25336
25583
  * ````
25337
- */var NavCubePlugin=/*#__PURE__*/function(_Plugin7){/**
25584
+ */var NavCubePlugin=/*#__PURE__*/function(_Plugin8){/**
25338
25585
  * @constructor
25339
25586
  * @param {Viewer} viewer The {@link Viewer}.
25340
25587
  * @param {Object} cfg NavCubePlugin configuration.
@@ -25361,14 +25608,14 @@ for(var i=0,len=areas.length;i<len;i++){var area=areas[i];var boundaries=area.bo
25361
25608
  * @param {Boolean} [cfg.synchProjection=false] Sets whether the NavCube switches between perspective and orthographic projections in synchrony with the {@link Camera}. When ````false````, the NavCube will always be rendered with perspective projection.
25362
25609
  * @param {Boolean} [cfg.isProjectNorth] sets whether the NavCube switches between true north and project north - using the project north offset angle.
25363
25610
  * @param {number} [cfg.projectNorthOffsetAngle] sets the NavCube project north offset angle - when the {@link isProjectNorth} is true.
25364
- */function NavCubePlugin(viewer){var _this137;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,NavCubePlugin);_this137=_callSuper(this,NavCubePlugin,["NavCube",viewer,cfg]);viewer.navCube=_this137;var visible=true;try{_this137._navCubeScene=new Scene(viewer,{canvasId:cfg.canvasId,canvasElement:cfg.canvasElement,transparent:true,spinnerElementId:"navcube_spinner",edgesEnabled:true,contextAttr:{antialias:true},resolutionScale:window.devicePixelRatio,worldAxis:viewer.scene.camera.worldAxis});_this137._navCubeCanvas=_this137._navCubeScene.canvas.canvas;_this137._navCubeScene.input.keyboardEnabled=false;// Don't want keyboard input in the NavCube
25365
- }catch(error){_this137.error(error);return _possibleConstructorReturn(_this137);}var navCubeScene=_this137._navCubeScene;navCubeScene.clearLights();new DirLight(navCubeScene,{dir:[0.4,-0.4,0.8],color:[0.8,1.0,1.0],intensity:0.8,space:"view"});new DirLight(navCubeScene,{dir:[-0.8,-0.3,-0.4],color:[0.8,0.8,0.8],intensity:0.8,space:"view"});new DirLight(navCubeScene,{dir:[0.8,-0.6,-0.8],color:[1.0,1.0,1.0],intensity:0.8,space:"view"});_this137._navCubeCamera=navCubeScene.camera;_this137._navCubeCamera.ortho.scale=7.0;_this137._navCubeCamera.ortho.near=0.1;_this137._navCubeCamera.ortho.far=2000;navCubeScene.edgeMaterial.edgeColor=[0.47,0.62,0.67];//120,160,170,0.8
25366
- navCubeScene.edgeMaterial.edgeAlpha=0.2;navCubeScene.edgeMaterial.edgeWidth=1;_this137._zUp=Boolean(viewer.camera.zUp);var self=_this137;_this137.mousedown=false;_this137.mouseover=false;_this137.setIsProjectNorth(cfg.isProjectNorth);_this137.setProjectNorthOffsetAngle(cfg.projectNorthOffsetAngle);var rotateTrueNorth=_this137.rotateTrueNorth=function(){var trueNorthMatrix=math.mat4();return function(dir,vec,dest){math.identityMat4(trueNorthMatrix);math.rotationMat4v(dir*self._projectNorthOffsetAngle*math.DEGTORAD,[0,1,0],trueNorthMatrix);return math.transformVec3(trueNorthMatrix,vec,dest);};}();var viewerNormalUp=false;viewer.scene.on("aabb",function(){viewerNormalUp=viewer.scene.camera.normalUp;});_this137._synchCamera=function(){var matrix=math.rotationMat4c(-90*math.DEGTORAD,1,0,0);var eyeLookVec=math.vec3();var eyeLookVecCube=math.vec3();var upCube=math.vec3();return function(){var eye=viewer.camera.eye;var look=viewer.camera.look;var up=viewer.camera.up;eyeLookVec=math.mulVec3Scalar(math.normalizeVec3(math.subVec3(eye,look,eyeLookVec)),5);if(self._isProjectNorth&&self._projectNorthOffsetAngle){eyeLookVec=rotateTrueNorth(-1,eyeLookVec,tempVec3a$1);up=rotateTrueNorth(-1,up,tempVec3b);}if(self._zUp){// +Z up
25611
+ */function NavCubePlugin(viewer){var _this138;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,NavCubePlugin);_this138=_callSuper(this,NavCubePlugin,["NavCube",viewer,cfg]);viewer.navCube=_this138;var visible=true;try{_this138._navCubeScene=new Scene(viewer,{canvasId:cfg.canvasId,canvasElement:cfg.canvasElement,transparent:true,spinnerElementId:"navcube_spinner",edgesEnabled:true,contextAttr:{antialias:true},resolutionScale:window.devicePixelRatio,worldAxis:viewer.scene.camera.worldAxis});_this138._navCubeCanvas=_this138._navCubeScene.canvas.canvas;_this138._navCubeScene.input.keyboardEnabled=false;// Don't want keyboard input in the NavCube
25612
+ }catch(error){_this138.error(error);return _possibleConstructorReturn(_this138);}var navCubeScene=_this138._navCubeScene;navCubeScene.clearLights();new DirLight(navCubeScene,{dir:[0.4,-0.4,0.8],color:[0.8,1.0,1.0],intensity:0.8,space:"view"});new DirLight(navCubeScene,{dir:[-0.8,-0.3,-0.4],color:[0.8,0.8,0.8],intensity:0.8,space:"view"});new DirLight(navCubeScene,{dir:[0.8,-0.6,-0.8],color:[1.0,1.0,1.0],intensity:0.8,space:"view"});_this138._navCubeCamera=navCubeScene.camera;_this138._navCubeCamera.ortho.scale=7.0;_this138._navCubeCamera.ortho.near=0.1;_this138._navCubeCamera.ortho.far=2000;navCubeScene.edgeMaterial.edgeColor=[0.47,0.62,0.67];//120,160,170,0.8
25613
+ navCubeScene.edgeMaterial.edgeAlpha=0.2;navCubeScene.edgeMaterial.edgeWidth=1;_this138._zUp=Boolean(viewer.camera.zUp);var self=_this138;_this138.mousedown=false;_this138.mouseover=false;_this138.setIsProjectNorth(cfg.isProjectNorth);_this138.setProjectNorthOffsetAngle(cfg.projectNorthOffsetAngle);var rotateTrueNorth=_this138.rotateTrueNorth=function(){var trueNorthMatrix=math.mat4();return function(dir,vec,dest){math.identityMat4(trueNorthMatrix);math.rotationMat4v(dir*self._projectNorthOffsetAngle*math.DEGTORAD,[0,1,0],trueNorthMatrix);return math.transformVec3(trueNorthMatrix,vec,dest);};}();var viewerNormalUp=false;viewer.scene.on("aabb",function(){viewerNormalUp=viewer.scene.camera.normalUp;});_this138._synchCamera=function(){var matrix=math.rotationMat4c(-90*math.DEGTORAD,1,0,0);var eyeLookVec=math.vec3();var eyeLookVecCube=math.vec3();var upCube=math.vec3();return function(){var eye=viewer.camera.eye;var look=viewer.camera.look;var up=viewer.camera.up;eyeLookVec=math.mulVec3Scalar(math.normalizeVec3(math.subVec3(eye,look,eyeLookVec)),5);if(self._isProjectNorth&&self._projectNorthOffsetAngle){eyeLookVec=rotateTrueNorth(-1,eyeLookVec,tempVec3a$1);up=rotateTrueNorth(-1,up,tempVec3b);}if(self._zUp){// +Z up
25367
25614
  math.transformVec3(matrix,eyeLookVec,eyeLookVecCube);math.transformVec3(matrix,up,upCube);self._navCubeCamera.look=[0,0,0];self._navCubeCamera.eye=math.transformVec3(matrix,eyeLookVec,eyeLookVecCube);self._navCubeCamera.up=math.transformPoint3(matrix,up,upCube);}else{// +Y up
25368
- self._navCubeCamera.look=[0,0,0];self._navCubeCamera.eye=viewerNormalUp?eyeLookVec:math.mulVec3(eyeLookVec,[-1,-1,1]);if(viewerNormalUp){self._navCubeCamera.up=up;}else{self._navCubeCamera.up=math.mulVec3Scalar(up,-1);}}};}();_this137._cubeTextureCanvas=new CubeTextureCanvas(viewer,navCubeScene,cfg);_this137._cubeSampler=new Texture(navCubeScene,{image:_this137._cubeTextureCanvas.getImage(),flipY:true,wrapS:ClampToEdgeWrapping,wrapT:ClampToEdgeWrapping});_this137._cubeMesh=new Mesh(navCubeScene,{geometry:new ReadableGeometry(navCubeScene,{primitive:"triangles",normals:[0,0,1,0,0,1,0,0,1,0,0,1,1,0,0,1,0,0,1,0,0,1,0,0,0,1,0,0,1,0,0,1,0,0,1,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,0,-1,0,0,-1,0,0,-1,0,0,-1],positions:[1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,1,1,-1,-1,1,-1,-1,1,1,-1,1,1,-1,1,-1,-1,-1,-1,-1,-1,1,-1,-1,-1,1,-1,-1,1,-1,1,-1,-1,1,1,-1,-1,-1,-1,-1,-1,1,-1,1,1,-1],uv:[0.5,0.6666,0.25,0.6666,0.25,0.3333,0.5,0.3333,0.5,0.6666,0.5,0.3333,0.75,0.3333,0.75,0.6666,0.5,0.6666,0.5,1,0.25,1,0.25,0.6666,0.25,0.6666,0.0,0.6666,0.0,0.3333,0.25,0.3333,0.25,0,0.5,0,0.5,0.3333,0.25,0.3333,0.75,0.3333,1.0,0.3333,1.0,0.6666,0.75,0.6666],indices:[0,1,2,0,2,3,4,5,6,4,6,7,8,9,10,8,10,11,12,13,14,12,14,15,16,17,18,16,18,19,20,21,22,20,22,23]}),material:new PhongMaterial(navCubeScene,{diffuse:[0.4,0.4,0.4],specular:[0.4,0.4,0.4],emissive:[0.6,0.6,0.6],diffuseMap:_this137._cubeSampler,emissiveMap:_this137._cubeSampler}),visible:!!visible,edges:true});_this137._shadow=cfg.shadowVisible===false?null:new Mesh(navCubeScene,{geometry:new ReadableGeometry(navCubeScene,buildCylinderGeometry({center:[0,0,0],radiusTop:0.001,radiusBottom:1.4,height:0.01,radialSegments:20,heightSegments:1,openEnded:true})),material:new PhongMaterial(navCubeScene,{diffuse:[0.0,0.0,0.0],specular:[0,0,0],emissive:[0.0,0.0,0.0],alpha:0.5}),position:[0,-1.5,0],visible:!!visible,pickable:false,backfaces:false});_this137._onCameraMatrix=viewer.camera.on("matrix",_this137._synchCamera);_this137._onCameraWorldAxis=viewer.camera.on("worldAxis",function(){if(viewer.camera.zUp){_this137._zUp=true;_this137._cubeTextureCanvas.setZUp();_this137._repaint();_this137._synchCamera();}else if(viewer.camera.yUp){_this137._zUp=false;_this137._cubeTextureCanvas.setYUp();_this137._repaint();_this137._synchCamera();}viewerNormalUp=viewer.scene.camera.normalUp;});_this137._onCameraFOV=viewer.camera.perspective.on("fov",function(fov){if(_this137._synchProjection){_this137._navCubeCamera.perspective.fov=fov;}});_this137._onCameraProjection=viewer.camera.on("projection",function(projection){if(_this137._synchProjection){_this137._navCubeCamera.projection=projection==="ortho"||projection==="perspective"?projection:"perspective";}});var lastAreaId=-1;function actionMove(posX,posY){var yawInc=(posX-lastX)*-sensitivity;var pitchInc=(posY-lastY)*-sensitivity;viewer.camera.orbitYaw(yawInc);viewer.camera.orbitPitch(-pitchInc);lastX=posX;lastY=posY;}function getCoordsWithinElement(event){var coords=[0,0];if(!event){event=window.event;coords[0]=event.x;coords[1]=event.y;}else{var element=event.target;var totalOffsetLeft=0;var totalOffsetTop=0;while(element.offsetParent){totalOffsetLeft+=element.offsetLeft;totalOffsetTop+=element.offsetTop;element=element.offsetParent;}coords[0]=event.pageX-totalOffsetLeft;coords[1]=event.pageY-totalOffsetTop;}return coords;}{var downX=null;var downY=null;var down=false;self.MOUSEDOWN=false;var over=false;self.MOUSEOVER=false;var sensitivity=0.5;var lastX;var lastY;self._navCubeCanvas.addEventListener("mouseenter",self._onMouseEnter=function(e){over=true;self.MOUSEOVER=true;});self._navCubeCanvas.addEventListener("mouseleave",self._onMouseLeave=function(e){over=false;self.MOUSEOVER=false;});self._navCubeCanvas.addEventListener("mousedown",self._onMouseDown=function(e){if(e.which!==1){return;}downX=e.x;downY=e.y;lastX=e.clientX;lastY=e.clientY;var canvasPos=getCoordsWithinElement(e);var hit=navCubeScene.pick({canvasPos:canvasPos});if(hit){down=true;self.MOUSEDOWN=true;}else{down=false;self.MOUSEDOWN=false;}});document.addEventListener("mouseup",self._onMouseUp=function(e){if(e.which!==1){// Left button
25615
+ self._navCubeCamera.look=[0,0,0];self._navCubeCamera.eye=viewerNormalUp?eyeLookVec:math.mulVec3(eyeLookVec,[-1,-1,1]);if(viewerNormalUp){self._navCubeCamera.up=up;}else{self._navCubeCamera.up=math.mulVec3Scalar(up,-1);}}};}();_this138._cubeTextureCanvas=new CubeTextureCanvas(viewer,navCubeScene,cfg);_this138._cubeSampler=new Texture(navCubeScene,{image:_this138._cubeTextureCanvas.getImage(),flipY:true,wrapS:ClampToEdgeWrapping,wrapT:ClampToEdgeWrapping});_this138._cubeMesh=new Mesh(navCubeScene,{geometry:new ReadableGeometry(navCubeScene,{primitive:"triangles",normals:[0,0,1,0,0,1,0,0,1,0,0,1,1,0,0,1,0,0,1,0,0,1,0,0,0,1,0,0,1,0,0,1,0,0,1,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,0,-1,0,0,-1,0,0,-1,0,0,-1],positions:[1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,1,1,-1,-1,1,-1,-1,1,1,-1,1,1,-1,1,-1,-1,-1,-1,-1,-1,1,-1,-1,-1,1,-1,-1,1,-1,1,-1,-1,1,1,-1,-1,-1,-1,-1,-1,1,-1,1,1,-1],uv:[0.5,0.6666,0.25,0.6666,0.25,0.3333,0.5,0.3333,0.5,0.6666,0.5,0.3333,0.75,0.3333,0.75,0.6666,0.5,0.6666,0.5,1,0.25,1,0.25,0.6666,0.25,0.6666,0.0,0.6666,0.0,0.3333,0.25,0.3333,0.25,0,0.5,0,0.5,0.3333,0.25,0.3333,0.75,0.3333,1.0,0.3333,1.0,0.6666,0.75,0.6666],indices:[0,1,2,0,2,3,4,5,6,4,6,7,8,9,10,8,10,11,12,13,14,12,14,15,16,17,18,16,18,19,20,21,22,20,22,23]}),material:new PhongMaterial(navCubeScene,{diffuse:[0.4,0.4,0.4],specular:[0.4,0.4,0.4],emissive:[0.6,0.6,0.6],diffuseMap:_this138._cubeSampler,emissiveMap:_this138._cubeSampler}),visible:!!visible,edges:true});_this138._shadow=cfg.shadowVisible===false?null:new Mesh(navCubeScene,{geometry:new ReadableGeometry(navCubeScene,buildCylinderGeometry({center:[0,0,0],radiusTop:0.001,radiusBottom:1.4,height:0.01,radialSegments:20,heightSegments:1,openEnded:true})),material:new PhongMaterial(navCubeScene,{diffuse:[0.0,0.0,0.0],specular:[0,0,0],emissive:[0.0,0.0,0.0],alpha:0.5}),position:[0,-1.5,0],visible:!!visible,pickable:false,backfaces:false});_this138._onCameraMatrix=viewer.camera.on("matrix",_this138._synchCamera);_this138._onCameraWorldAxis=viewer.camera.on("worldAxis",function(){if(viewer.camera.zUp){_this138._zUp=true;_this138._cubeTextureCanvas.setZUp();_this138._repaint();_this138._synchCamera();}else if(viewer.camera.yUp){_this138._zUp=false;_this138._cubeTextureCanvas.setYUp();_this138._repaint();_this138._synchCamera();}viewerNormalUp=viewer.scene.camera.normalUp;});_this138._onCameraFOV=viewer.camera.perspective.on("fov",function(fov){if(_this138._synchProjection){_this138._navCubeCamera.perspective.fov=fov;}});_this138._onCameraProjection=viewer.camera.on("projection",function(projection){if(_this138._synchProjection){_this138._navCubeCamera.projection=projection==="ortho"||projection==="perspective"?projection:"perspective";}});var lastAreaId=-1;function actionMove(posX,posY){var yawInc=(posX-lastX)*-sensitivity;var pitchInc=(posY-lastY)*-sensitivity;viewer.camera.orbitYaw(yawInc);viewer.camera.orbitPitch(-pitchInc);lastX=posX;lastY=posY;}function getCoordsWithinElement(event){var coords=[0,0];if(!event){event=window.event;coords[0]=event.x;coords[1]=event.y;}else{var element=event.target;var totalOffsetLeft=0;var totalOffsetTop=0;while(element.offsetParent){totalOffsetLeft+=element.offsetLeft;totalOffsetTop+=element.offsetTop;element=element.offsetParent;}coords[0]=event.pageX-totalOffsetLeft;coords[1]=event.pageY-totalOffsetTop;}return coords;}{var downX=null;var downY=null;var down=false;self.MOUSEDOWN=false;var over=false;self.MOUSEOVER=false;var sensitivity=0.5;var lastX;var lastY;self._navCubeCanvas.addEventListener("mouseenter",self._onMouseEnter=function(e){over=true;self.MOUSEOVER=true;});self._navCubeCanvas.addEventListener("mouseleave",self._onMouseLeave=function(e){over=false;self.MOUSEOVER=false;});self._navCubeCanvas.addEventListener("mousedown",self._onMouseDown=function(e){if(e.which!==1){return;}downX=e.x;downY=e.y;lastX=e.clientX;lastY=e.clientY;var canvasPos=getCoordsWithinElement(e);var hit=navCubeScene.pick({canvasPos:canvasPos});if(hit){down=true;self.MOUSEDOWN=true;}else{down=false;self.MOUSEDOWN=false;}});document.addEventListener("mouseup",self._onMouseUp=function(e){if(e.which!==1){// Left button
25369
25616
  return;}down=false;self.MOUSEDOWN=false;if(downX===null){return;}var canvasPos=getCoordsWithinElement(e);var hit=navCubeScene.pick({canvasPos:canvasPos,pickSurface:true});if(hit){if(hit.uv){var areaId=self._cubeTextureCanvas.getArea(hit.uv);if(areaId>=0){// document.body.style.cursor = "pointer";
25370
25617
  if(lastAreaId>=0){self._cubeTextureCanvas.setAreaHighlighted(lastAreaId,false);self._repaint();lastAreaId=-1;}if(areaId>=0){self._cubeTextureCanvas.setAreaHighlighted(areaId,true);lastAreaId=areaId;self._repaint();if(e.x<downX-3||e.x>downX+3||e.y<downY-3||e.y>downY+3){return;}var dir=self._cubeTextureCanvas.getAreaDir(areaId);if(dir){var up=self._cubeTextureCanvas.getAreaUp(areaId);if(self._isProjectNorth&&self._projectNorthOffsetAngle){dir=rotateTrueNorth(+1,dir,tempVec3a$1);up=rotateTrueNorth(+1,up,tempVec3b);}flyTo(dir,up,function(){if(lastAreaId>=0){self._cubeTextureCanvas.setAreaHighlighted(lastAreaId,false);self._repaint();lastAreaId=-1;}// document.body.style.cursor = "pointer";
25371
- if(lastAreaId>=0){self._cubeTextureCanvas.setAreaHighlighted(lastAreaId,false);self._repaint();lastAreaId=-1;}if(areaId>=0){self._cubeTextureCanvas.setAreaHighlighted(areaId,false);lastAreaId=-1;self._repaint();}});}}}}}});document.addEventListener("mousemove",self._onMouseMove=function(e){if(lastAreaId>=0){self._cubeTextureCanvas.setAreaHighlighted(lastAreaId,false);self._repaint();lastAreaId=-1;}if(e.buttons===1&&!down){return;}if(down){var posX=e.clientX;var posY=e.clientY;document.body.style.cursor="move";actionMove(posX,posY);return;}if(!over){return;}var canvasPos=getCoordsWithinElement(e);var hit=navCubeScene.pick({canvasPos:canvasPos,pickSurface:true});if(hit){if(hit.uv){document.body.style.cursor="pointer";var areaId=self._cubeTextureCanvas.getArea(hit.uv);if(areaId===lastAreaId){return;}if(lastAreaId>=0){self._cubeTextureCanvas.setAreaHighlighted(lastAreaId,false);}if(areaId>=0){self._cubeTextureCanvas.setAreaHighlighted(areaId,true);self._repaint();lastAreaId=areaId;}}}else{document.body.style.cursor="default";if(lastAreaId>=0){self._cubeTextureCanvas.setAreaHighlighted(lastAreaId,false);self._repaint();lastAreaId=-1;}}});var flyTo=_this137.flyTo=function(){var center=math.vec3();return function(dir,up,ok){var aabb=self._fitVisible?viewer.scene.getAABB(viewer.scene.visibleObjectIds):viewer.scene.aabb;var diag=math.getAABB3Diag(aabb);math.getAABB3Center(aabb,center);var dist=Math.abs(diag/Math.tan(self._cameraFitFOV*math.DEGTORAD));viewer.cameraControl.pivotPos=center;if(self._cameraFly){viewer.cameraFlight.flyTo({look:center,eye:[center[0]-dist*dir[0],center[1]-dist*dir[1],center[2]-dist*dir[2]],up:up||[0,1,0],orthoScale:diag*1.1,fitFOV:self._cameraFitFOV,duration:self._cameraFlyDuration},ok);}else{viewer.cameraFlight.jumpTo({look:center,eye:[center[0]-dist*dir[0],center[1]-dist*dir[1],center[2]-dist*dir[2]],up:up||[0,1,0],orthoScale:diag*1.1,fitFOV:self._cameraFitFOV},ok);}};}();}_this137._onUpdated=viewer.localeService.on("updated",function(){_this137._cubeTextureCanvas.clear();_this137._repaint();});_this137.setVisible(cfg.visible);_this137.setCameraFitFOV(cfg.cameraFitFOV);_this137.setCameraFly(cfg.cameraFly);_this137.setCameraFlyDuration(cfg.cameraFlyDuration);_this137.setFitVisible(cfg.fitVisible);_this137.setSynchProjection(cfg.synchProjection);return _this137;}_inherits(NavCubePlugin,_Plugin7);return _createClass(NavCubePlugin,[{key:"flyByClick",value:function flyByClick(areaId,ok){if(areaId>=0){this._cubeTextureCanvas.setAreaHighlighted(areaId,true);this._repaint();var dir=this._cubeTextureCanvas.getAreaDir(areaId);if(dir){var up=this._cubeTextureCanvas.getAreaUp(areaId);if(this._isProjectNorth&&this._projectNorthOffsetAngle){dir=this.rotateTrueNorth(+1,dir,tempVec3a$1);up=this.rotateTrueNorth(+1,up,tempVec3b);}this.flyTo(dir,up,ok);}}}},{key:"jumpByClick",value:function jumpByClick(areaId){this.setCameraFly(false);this.flyByClick(areaId);this.setCameraFly(true);}},{key:"navCubeScene",get:function get(){return this._navCubeScene;}},{key:"MOUSEDOWN",get:function get(){return this.mousedown;},set:function set(down){this.mousedown=down;}},{key:"MOUSEOVER",get:function get(){return this.mouseover;},set:function set(over){this.mouseover=over;}},{key:"send",value:function send(name,value){switch(name){case"language":this._cubeTextureCanvas.clear();this._repaint();// CubeTextureCanvas gets language from Viewer
25618
+ if(lastAreaId>=0){self._cubeTextureCanvas.setAreaHighlighted(lastAreaId,false);self._repaint();lastAreaId=-1;}if(areaId>=0){self._cubeTextureCanvas.setAreaHighlighted(areaId,false);lastAreaId=-1;self._repaint();}});}}}}}});document.addEventListener("mousemove",self._onMouseMove=function(e){if(lastAreaId>=0){self._cubeTextureCanvas.setAreaHighlighted(lastAreaId,false);self._repaint();lastAreaId=-1;}if(e.buttons===1&&!down){return;}if(down){var posX=e.clientX;var posY=e.clientY;document.body.style.cursor="move";actionMove(posX,posY);return;}if(!over){return;}var canvasPos=getCoordsWithinElement(e);var hit=navCubeScene.pick({canvasPos:canvasPos,pickSurface:true});if(hit){if(hit.uv){document.body.style.cursor="pointer";var areaId=self._cubeTextureCanvas.getArea(hit.uv);if(areaId===lastAreaId){return;}if(lastAreaId>=0){self._cubeTextureCanvas.setAreaHighlighted(lastAreaId,false);}if(areaId>=0){self._cubeTextureCanvas.setAreaHighlighted(areaId,true);self._repaint();lastAreaId=areaId;}}}else{document.body.style.cursor="default";if(lastAreaId>=0){self._cubeTextureCanvas.setAreaHighlighted(lastAreaId,false);self._repaint();lastAreaId=-1;}}});var flyTo=_this138.flyTo=function(){var center=math.vec3();return function(dir,up,ok){var aabb=self._fitVisible?viewer.scene.getAABB(viewer.scene.visibleObjectIds):viewer.scene.aabb;var diag=math.getAABB3Diag(aabb);math.getAABB3Center(aabb,center);var dist=Math.abs(diag/Math.tan(self._cameraFitFOV*math.DEGTORAD));viewer.cameraControl.pivotPos=center;if(self._cameraFly){viewer.cameraFlight.flyTo({look:center,eye:[center[0]-dist*dir[0],center[1]-dist*dir[1],center[2]-dist*dir[2]],up:up||[0,1,0],orthoScale:diag*1.1,fitFOV:self._cameraFitFOV,duration:self._cameraFlyDuration},ok);}else{viewer.cameraFlight.jumpTo({look:center,eye:[center[0]-dist*dir[0],center[1]-dist*dir[1],center[2]-dist*dir[2]],up:up||[0,1,0],orthoScale:diag*1.1,fitFOV:self._cameraFitFOV},ok);}};}();}_this138._onUpdated=viewer.localeService.on("updated",function(){_this138._cubeTextureCanvas.clear();_this138._repaint();});_this138.setVisible(cfg.visible);_this138.setCameraFitFOV(cfg.cameraFitFOV);_this138.setCameraFly(cfg.cameraFly);_this138.setCameraFlyDuration(cfg.cameraFlyDuration);_this138.setFitVisible(cfg.fitVisible);_this138.setSynchProjection(cfg.synchProjection);return _this138;}_inherits(NavCubePlugin,_Plugin8);return _createClass(NavCubePlugin,[{key:"flyByClick",value:function flyByClick(areaId,ok){if(areaId>=0){this._cubeTextureCanvas.setAreaHighlighted(areaId,true);this._repaint();var dir=this._cubeTextureCanvas.getAreaDir(areaId);if(dir){var up=this._cubeTextureCanvas.getAreaUp(areaId);if(this._isProjectNorth&&this._projectNorthOffsetAngle){dir=this.rotateTrueNorth(+1,dir,tempVec3a$1);up=this.rotateTrueNorth(+1,up,tempVec3b);}this.flyTo(dir,up,ok);}}}},{key:"jumpByClick",value:function jumpByClick(areaId){this.setCameraFly(false);this.flyByClick(areaId);this.setCameraFly(true);}},{key:"navCubeScene",get:function get(){return this._navCubeScene;}},{key:"MOUSEDOWN",get:function get(){return this.mousedown;},set:function set(down){this.mousedown=down;}},{key:"MOUSEOVER",get:function get(){return this.mouseover;},set:function set(over){this.mouseover=over;}},{key:"send",value:function send(name,value){switch(name){case"language":this._cubeTextureCanvas.clear();this._repaint();// CubeTextureCanvas gets language from Viewer
25372
25619
  break;}}},{key:"_repaint",value:function _repaint(){var image=this._cubeTextureCanvas.getImage();this._cubeMesh.material.diffuseMap.image=image;this._cubeMesh.material.emissiveMap.image=image;}/**
25373
25620
  * Sets if the NavCube is visible.
25374
25621
  *
@@ -25480,7 +25727,7 @@ this._ignoreNextSectionPlaneDirUpdate=false;this._createNodes();this._bindEvents
25480
25727
  * SectionPlanesPlugin keeps SectionPlaneControls in a reuse pool.
25481
25728
  * Call with a null or undefined value to disconnect the Control ffrom whatever SectionPlane it was assigned to.
25482
25729
  * @private
25483
- */return _createClass(Control,[{key:"_setSectionPlane",value:function _setSectionPlane(sectionPlane){var _this138=this;if(this._sectionPlane){this._sectionPlane.off(this._onSectionPlanePos);this._sectionPlane.off(this._onSectionPlaneDir);this._onSectionPlanePos=null;this._onSectionPlaneDir=null;this._sectionPlane=null;}if(sectionPlane){this.id=sectionPlane.id;this._setPos(sectionPlane.pos);this._setDir(sectionPlane.dir);this._sectionPlane=sectionPlane;this._onSectionPlanePos=sectionPlane.on("pos",function(){_this138._setPos(_this138._sectionPlane.pos);});this._onSectionPlaneDir=sectionPlane.on("dir",function(){if(!_this138._ignoreNextSectionPlaneDirUpdate){_this138._setDir(_this138._sectionPlane.dir);}else{_this138._ignoreNextSectionPlaneDirUpdate=false;}});}}/**
25730
+ */return _createClass(Control,[{key:"_setSectionPlane",value:function _setSectionPlane(sectionPlane){var _this139=this;if(this._sectionPlane){this._sectionPlane.off(this._onSectionPlanePos);this._sectionPlane.off(this._onSectionPlaneDir);this._onSectionPlanePos=null;this._onSectionPlaneDir=null;this._sectionPlane=null;}if(sectionPlane){this.id=sectionPlane.id;this._setPos(sectionPlane.pos);this._setDir(sectionPlane.dir);this._sectionPlane=sectionPlane;this._onSectionPlanePos=sectionPlane.on("pos",function(){_this139._setPos(_this139._sectionPlane.pos);});this._onSectionPlaneDir=sectionPlane.on("dir",function(){if(!_this139._ignoreNextSectionPlaneDirUpdate){_this139._setDir(_this139._sectionPlane.dir);}else{_this139._ignoreNextSectionPlaneDirUpdate=false;}});}}/**
25484
25731
  * Gets the {@link SectionPlane} controlled by this Control.
25485
25732
  * @returns {SectionPlane} The SectionPlane.
25486
25733
  */},{key:"sectionPlane",get:function get(){return this._sectionPlane;}/**
@@ -25611,10 +25858,10 @@ yAxisArrow:rootNode.addChild(new Mesh(rootNode,{geometry:shapes.arrowHead,materi
25611
25858
  //----------------------------------------------------------------------------------------------------------
25612
25859
  zAxisArrow:rootNode.addChild(new Mesh(rootNode,{geometry:shapes.arrowHead,material:materials.blue,matrix:function(){var translate=math.translateMat4c(0,radius+0.1,0,math.identityMat4());var rotate=math.rotationMat4v(-90*math.DEGTORAD,[0.8,0,0],math.identityMat4());return math.mulMat4(rotate,translate,math.identityMat4());}(),pickable:false,collidable:false,clippable:false,visible:false,isObject:false}),NO_STATE_INHERIT),zAxisArrowHandle:rootNode.addChild(new Mesh(rootNode,{geometry:shapes.arrowHeadHandle,material:materials.pickable,matrix:function(){var translate=math.translateMat4c(0,radius+0.1,0,math.identityMat4());var rotate=math.rotationMat4v(-90*math.DEGTORAD,[0.8,0,0],math.identityMat4());return math.mulMat4(rotate,translate,math.identityMat4());}(),pickable:true,collidable:false,clippable:false,visible:false,isObject:false}),NO_STATE_INHERIT),zShaft:rootNode.addChild(new Mesh(rootNode,{geometry:shapes.axis,material:materials.blue,matrix:function(){var translate=math.translateMat4c(0,radius/2,0,math.identityMat4());var rotate=math.rotationMat4v(-90*math.DEGTORAD,[1,0,0],math.identityMat4());return math.mulMat4(rotate,translate,math.identityMat4());}(),clippable:false,pickable:false,collidable:false,visible:false,isObject:false}),NO_STATE_INHERIT),zAxisHandle:rootNode.addChild(new Mesh(rootNode,{geometry:shapes.axisHandle,material:materials.pickable,matrix:function(){var translate=math.translateMat4c(0,radius/2,0,math.identityMat4());var rotate=math.rotationMat4v(-90*math.DEGTORAD,[1,0,0],math.identityMat4());return math.mulMat4(rotate,translate,math.identityMat4());}(),clippable:false,pickable:true,collidable:false,visible:false,isObject:false}),NO_STATE_INHERIT)};this._affordanceMeshes={planeFrame:rootNode.addChild(new Mesh(rootNode,{geometry:new ReadableGeometry(rootNode,buildTorusGeometry({center:[0,0,0],radius:2,tube:tubeRadius,radialSegments:4,tubeSegments:4,arc:Math.PI*2.0})),material:new PhongMaterial(rootNode,{ambient:[1,1,1],diffuse:[0,0,0],emissive:[1,1,0]}),highlighted:true,highlightMaterial:new EmphasisMaterial(rootNode,{edges:false,filled:true,fillColor:[1,1,0],fillAlpha:1.0}),pickable:false,collidable:false,clippable:false,visible:false,scale:[1,1,1],rotation:[0,0,45],isObject:false}),NO_STATE_INHERIT),xHoop:rootNode.addChild(new Mesh(rootNode,{// Full
25613
25860
  geometry:shapes.hoop,material:materials.red,highlighted:true,highlightMaterial:materials.highlightRed,matrix:function(){var rotate2=math.rotationMat4v(90*math.DEGTORAD,[0,1,0],math.identityMat4());var rotate1=math.rotationMat4v(270*math.DEGTORAD,[1,0,0],math.identityMat4());return math.mulMat4(rotate1,rotate2,math.identityMat4());}(),pickable:false,collidable:false,clippable:false,visible:false,isObject:false}),NO_STATE_INHERIT),yHoop:rootNode.addChild(new Mesh(rootNode,{geometry:shapes.hoop,material:materials.green,highlighted:true,highlightMaterial:materials.highlightGreen,rotation:[-90,0,0],pickable:false,collidable:false,clippable:false,visible:false,isObject:false}),NO_STATE_INHERIT),zHoop:rootNode.addChild(new Mesh(rootNode,{// Blue hoop about Z-axis
25614
- geometry:shapes.hoop,material:materials.blue,highlighted:true,highlightMaterial:materials.highlightBlue,matrix:math.rotationMat4v(180*math.DEGTORAD,[1,0,0],math.identityMat4()),pickable:false,collidable:false,clippable:false,backfaces:true,visible:false,isObject:false}),NO_STATE_INHERIT),xAxisArrow:rootNode.addChild(new Mesh(rootNode,{geometry:shapes.arrowHeadBig,material:materials.red,matrix:function(){var translate=math.translateMat4c(0,radius+0.1,0,math.identityMat4());var rotate=math.rotationMat4v(-90*math.DEGTORAD,[0,0,1],math.identityMat4());return math.mulMat4(rotate,translate,math.identityMat4());}(),pickable:false,collidable:false,clippable:false,visible:false,isObject:false}),NO_STATE_INHERIT),yAxisArrow:rootNode.addChild(new Mesh(rootNode,{geometry:shapes.arrowHeadBig,material:materials.green,matrix:function(){var translate=math.translateMat4c(0,radius+0.1,0,math.identityMat4());var rotate=math.rotationMat4v(180*math.DEGTORAD,[1,0,0],math.identityMat4());return math.mulMat4(rotate,translate,math.identityMat4());}(),pickable:false,collidable:false,clippable:false,visible:false,isObject:false}),NO_STATE_INHERIT),zAxisArrow:rootNode.addChild(new Mesh(rootNode,{geometry:shapes.arrowHeadBig,material:materials.blue,matrix:function(){var translate=math.translateMat4c(0,radius+0.1,0,math.identityMat4());var rotate=math.rotationMat4v(-90*math.DEGTORAD,[0.8,0,0],math.identityMat4());return math.mulMat4(rotate,translate,math.identityMat4());}(),pickable:false,collidable:false,clippable:false,visible:false,isObject:false}),NO_STATE_INHERIT)};}},{key:"_bindEvents",value:function _bindEvents(){var _this139=this;var self=this;var grabbed=false;var DRAG_ACTIONS={none:-1,xTranslate:0,yTranslate:1,zTranslate:2,xRotate:3,yRotate:4,zRotate:5};var rootNode=this._rootNode;var nextDragAction=null;// As we hover grabbed an arrow or hoop, self is the action we would do if we then dragged it.
25861
+ geometry:shapes.hoop,material:materials.blue,highlighted:true,highlightMaterial:materials.highlightBlue,matrix:math.rotationMat4v(180*math.DEGTORAD,[1,0,0],math.identityMat4()),pickable:false,collidable:false,clippable:false,backfaces:true,visible:false,isObject:false}),NO_STATE_INHERIT),xAxisArrow:rootNode.addChild(new Mesh(rootNode,{geometry:shapes.arrowHeadBig,material:materials.red,matrix:function(){var translate=math.translateMat4c(0,radius+0.1,0,math.identityMat4());var rotate=math.rotationMat4v(-90*math.DEGTORAD,[0,0,1],math.identityMat4());return math.mulMat4(rotate,translate,math.identityMat4());}(),pickable:false,collidable:false,clippable:false,visible:false,isObject:false}),NO_STATE_INHERIT),yAxisArrow:rootNode.addChild(new Mesh(rootNode,{geometry:shapes.arrowHeadBig,material:materials.green,matrix:function(){var translate=math.translateMat4c(0,radius+0.1,0,math.identityMat4());var rotate=math.rotationMat4v(180*math.DEGTORAD,[1,0,0],math.identityMat4());return math.mulMat4(rotate,translate,math.identityMat4());}(),pickable:false,collidable:false,clippable:false,visible:false,isObject:false}),NO_STATE_INHERIT),zAxisArrow:rootNode.addChild(new Mesh(rootNode,{geometry:shapes.arrowHeadBig,material:materials.blue,matrix:function(){var translate=math.translateMat4c(0,radius+0.1,0,math.identityMat4());var rotate=math.rotationMat4v(-90*math.DEGTORAD,[0.8,0,0],math.identityMat4());return math.mulMat4(rotate,translate,math.identityMat4());}(),pickable:false,collidable:false,clippable:false,visible:false,isObject:false}),NO_STATE_INHERIT)};}},{key:"_bindEvents",value:function _bindEvents(){var _this140=this;var self=this;var grabbed=false;var DRAG_ACTIONS={none:-1,xTranslate:0,yTranslate:1,zTranslate:2,xRotate:3,yRotate:4,zRotate:5};var rootNode=this._rootNode;var nextDragAction=null;// As we hover grabbed an arrow or hoop, self is the action we would do if we then dragged it.
25615
25862
  var dragAction=null;// Action we're doing while we drag an arrow or hoop.
25616
25863
  var lastCanvasPos=math.vec2();var xBaseAxis=math.vec3([1,0,0]);var yBaseAxis=math.vec3([0,1,0]);var zBaseAxis=math.vec3([0,0,1]);var canvas=this._viewer.scene.canvas.canvas;var camera=this._viewer.camera;var scene=this._viewer.scene;{// Keep gizmo screen size constant
25617
- var _tempVec3a=math.vec3([0,0,0]);var lastDist=-1;this._onCameraViewMatrix=scene.camera.on("viewMatrix",function(){});this._onCameraProjMatrix=scene.camera.on("projMatrix",function(){});this._onSceneTick=scene.on("tick",function(){var dist=Math.abs(math.lenVec3(math.subVec3(scene.camera.eye,_this139._pos,_tempVec3a)));if(dist!==lastDist){if(camera.projection==="perspective"){var worldSize=Math.tan(camera.perspective.fov*math.DEGTORAD)*dist;var size=0.07*worldSize;rootNode.scale=[size,size,size];lastDist=dist;}}if(camera.projection==="ortho"){var _worldSize=camera.ortho.scale/10;var _size=_worldSize;rootNode.scale=[_size,_size,_size];lastDist=dist;}});}var getClickCoordsWithinElement=function(){var canvasPos=new Float64Array(2);return function(event){if(!event){event=window.event;canvasPos[0]=event.x;canvasPos[1]=event.y;}else{var element=event.target;var totalOffsetLeft=0;var totalOffsetTop=0;while(element.offsetParent){totalOffsetLeft+=element.offsetLeft;totalOffsetTop+=element.offsetTop;element=element.offsetParent;}canvasPos[0]=event.pageX-totalOffsetLeft;canvasPos[1]=event.pageY-totalOffsetTop;}return canvasPos;};}();var getTouchCoordsWithinElement=function(){var canvasPos=new Float64Array(2);return function(event){if(!event){event=window.event;}if(event.touches&&event.touches.length){// 如果有触摸事件,使用第一个触摸点的坐标
25864
+ var _tempVec3a=math.vec3([0,0,0]);var lastDist=-1;this._onCameraViewMatrix=scene.camera.on("viewMatrix",function(){});this._onCameraProjMatrix=scene.camera.on("projMatrix",function(){});this._onSceneTick=scene.on("tick",function(){var dist=Math.abs(math.lenVec3(math.subVec3(scene.camera.eye,_this140._pos,_tempVec3a)));if(dist!==lastDist){if(camera.projection==="perspective"){var worldSize=Math.tan(camera.perspective.fov*math.DEGTORAD)*dist;var size=0.07*worldSize;rootNode.scale=[size,size,size];lastDist=dist;}}if(camera.projection==="ortho"){var _worldSize=camera.ortho.scale/10;var _size=_worldSize;rootNode.scale=[_size,_size,_size];lastDist=dist;}});}var getClickCoordsWithinElement=function(){var canvasPos=new Float64Array(2);return function(event){if(!event){event=window.event;canvasPos[0]=event.x;canvasPos[1]=event.y;}else{var element=event.target;var totalOffsetLeft=0;var totalOffsetTop=0;while(element.offsetParent){totalOffsetLeft+=element.offsetLeft;totalOffsetTop+=element.offsetTop;element=element.offsetParent;}canvasPos[0]=event.pageX-totalOffsetLeft;canvasPos[1]=event.pageY-totalOffsetTop;}return canvasPos;};}();var getTouchCoordsWithinElement=function(){var canvasPos=new Float64Array(2);return function(event){if(!event){event=window.event;}if(event.touches&&event.touches.length){// 如果有触摸事件,使用第一个触摸点的坐标
25618
25865
  canvasPos[0]=event.touches[0].pageX;canvasPos[1]=event.touches[0].pageY;}else{// 否则,假设是鼠标事件
25619
25866
  var element=event.target;var totalOffsetLeft=0;var totalOffsetTop=0;while(element.offsetParent){totalOffsetLeft+=element.offsetLeft;totalOffsetTop+=element.offsetTop;element=element.offsetParent;}canvasPos[0]=event.pageX-totalOffsetLeft;canvasPos[1]=event.pageY-totalOffsetTop;}return canvasPos;};}();var localToWorldVec=function(){var mat=math.mat4();return function(localVec,worldVec){math.quaternionToMat4(self._rootNode.quaternion,mat);math.transformVec3(mat,localVec,worldVec);math.normalizeVec3(worldVec);return worldVec;};}();var getTranslationPlane=function(){var planeNormal=math.vec3();return function(worldAxis){var absX=Math.abs(worldAxis[0]);if(absX>Math.abs(worldAxis[1])&&absX>Math.abs(worldAxis[2])){math.cross3Vec3(worldAxis,[0,1,0],planeNormal);}else{math.cross3Vec3(worldAxis,[1,0,0],planeNormal);}math.cross3Vec3(planeNormal,worldAxis,planeNormal);math.normalizeVec3(planeNormal);return planeNormal;};}();var dragTranslateSectionPlane=function(){var p1=math.vec3();var p2=math.vec3();var worldAxis=math.vec4();return function(baseAxis,fromMouse,toMouse){localToWorldVec(baseAxis,worldAxis);var planeNormal=getTranslationPlane(worldAxis,fromMouse,toMouse);getPointerPlaneIntersect(fromMouse,planeNormal,p1);getPointerPlaneIntersect(toMouse,planeNormal,p2);math.subVec3(p2,p1);var dot=math.dotVec3(p2,worldAxis);self._pos[0]+=worldAxis[0]*dot*0.6;self._pos[1]+=worldAxis[1]*dot*0.6;self._pos[2]+=worldAxis[2]*dot*0.6;self._rootNode.position=self._pos;if(self._sectionPlane){self._sectionPlane.pos=self._pos;}};}();var dragRotateSectionPlane=function(){var p1=math.vec4();var p2=math.vec4();var c=math.vec4();var worldAxis=math.vec4();return function(baseAxis,fromMouse,toMouse){localToWorldVec(baseAxis,worldAxis);var hasData=getPointerPlaneIntersect(fromMouse,worldAxis,p1)&&getPointerPlaneIntersect(toMouse,worldAxis,p2);if(!hasData){// Find intersections with view plane and project down to origin
25620
25867
  var planeNormal=getTranslationPlane(worldAxis,fromMouse,toMouse);getPointerPlaneIntersect(fromMouse,planeNormal,p1,1);// Ensure plane moves closer to camera so angles become workable
@@ -25624,25 +25871,25 @@ math.inverseMat4(matrix);math.transformVec4(matrix,dir,dir);math.mulVec4Scalar(d
25624
25871
  var rayO=camera.eye;// The direction
25625
25872
  math.subVec4(dir,rayO,dir);var origin=self._sectionPlane.pos;// Plane origin:
25626
25873
  var d=-math.dotVec3(origin,axis)-offset;var dot=math.dotVec3(axis,dir);if(Math.abs(dot)>0.005){var t=-(math.dotVec3(axis,rayO)+d)/dot;math.mulVec3Scalar(dir,t,dest);math.addVec3(dest,rayO);math.subVec3(dest,origin,dest);return true;}return false;};}();var rotateSectionPlane=function(){var dir=math.vec3();var mat=math.mat4();return function(){if(self.sectionPlane){math.quaternionToMat4(rootNode.quaternion,mat);// << ---
25627
- math.transformVec3(mat,[0,0,1],dir);self._setSectionPlaneDir(dir);}};}();{var down=false;var lastAffordanceMesh;this._onCameraControlHover=this._viewer.cameraControl.on("hoverEnter",function(hit){if(!_this139._visible){return;}if(down){return;}grabbed=false;if(lastAffordanceMesh){lastAffordanceMesh.visible=false;}var affordanceMesh;var meshId=hit.entity.id;switch(meshId){case _this139._displayMeshes.xAxisArrowHandle.id:affordanceMesh=_this139._affordanceMeshes.xAxisArrow;nextDragAction=DRAG_ACTIONS.xTranslate;break;case _this139._displayMeshes.xAxisHandle.id:affordanceMesh=_this139._affordanceMeshes.xAxisArrow;nextDragAction=DRAG_ACTIONS.xTranslate;break;case _this139._displayMeshes.yAxisArrowHandle.id:affordanceMesh=_this139._affordanceMeshes.yAxisArrow;nextDragAction=DRAG_ACTIONS.yTranslate;break;case _this139._displayMeshes.yShaftHandle.id:affordanceMesh=_this139._affordanceMeshes.yAxisArrow;nextDragAction=DRAG_ACTIONS.yTranslate;break;case _this139._displayMeshes.zAxisArrowHandle.id:affordanceMesh=_this139._affordanceMeshes.zAxisArrow;nextDragAction=DRAG_ACTIONS.zTranslate;break;case _this139._displayMeshes.zAxisHandle.id:affordanceMesh=_this139._affordanceMeshes.zAxisArrow;nextDragAction=DRAG_ACTIONS.zTranslate;break;case _this139._displayMeshes.xCurveHandle.id:affordanceMesh=_this139._affordanceMeshes.xHoop;nextDragAction=DRAG_ACTIONS.xRotate;break;case _this139._displayMeshes.yCurveHandle.id:affordanceMesh=_this139._affordanceMeshes.yHoop;nextDragAction=DRAG_ACTIONS.yRotate;break;// case this._displayMeshes.zCurveHandle.id:
25874
+ math.transformVec3(mat,[0,0,1],dir);self._setSectionPlaneDir(dir);}};}();{var down=false;var lastAffordanceMesh;this._onCameraControlHover=this._viewer.cameraControl.on("hoverEnter",function(hit){if(!_this140._visible){return;}if(down){return;}grabbed=false;if(lastAffordanceMesh){lastAffordanceMesh.visible=false;}var affordanceMesh;var meshId=hit.entity.id;switch(meshId){case _this140._displayMeshes.xAxisArrowHandle.id:affordanceMesh=_this140._affordanceMeshes.xAxisArrow;nextDragAction=DRAG_ACTIONS.xTranslate;break;case _this140._displayMeshes.xAxisHandle.id:affordanceMesh=_this140._affordanceMeshes.xAxisArrow;nextDragAction=DRAG_ACTIONS.xTranslate;break;case _this140._displayMeshes.yAxisArrowHandle.id:affordanceMesh=_this140._affordanceMeshes.yAxisArrow;nextDragAction=DRAG_ACTIONS.yTranslate;break;case _this140._displayMeshes.yShaftHandle.id:affordanceMesh=_this140._affordanceMeshes.yAxisArrow;nextDragAction=DRAG_ACTIONS.yTranslate;break;case _this140._displayMeshes.zAxisArrowHandle.id:affordanceMesh=_this140._affordanceMeshes.zAxisArrow;nextDragAction=DRAG_ACTIONS.zTranslate;break;case _this140._displayMeshes.zAxisHandle.id:affordanceMesh=_this140._affordanceMeshes.zAxisArrow;nextDragAction=DRAG_ACTIONS.zTranslate;break;case _this140._displayMeshes.xCurveHandle.id:affordanceMesh=_this140._affordanceMeshes.xHoop;nextDragAction=DRAG_ACTIONS.xRotate;break;case _this140._displayMeshes.yCurveHandle.id:affordanceMesh=_this140._affordanceMeshes.yHoop;nextDragAction=DRAG_ACTIONS.yRotate;break;// case this._displayMeshes.zCurveHandle.id:
25628
25875
  // affordanceMesh = this._affordanceMeshes.zHoop;
25629
25876
  // nextDragAction = DRAG_ACTIONS.zRotate;
25630
25877
  // break;
25631
25878
  default:nextDragAction=DRAG_ACTIONS.none;return;// Not clicked an arrow or hoop
25632
- }if(affordanceMesh){affordanceMesh.visible=true;}lastAffordanceMesh=affordanceMesh;grabbed=true;});this._onCameraControlHoverLeave=this._viewer.cameraControl.on("hoverOut",function(hit){if(!_this139._visible){return;}if(lastAffordanceMesh){lastAffordanceMesh.visible=false;}lastAffordanceMesh=null;nextDragAction=DRAG_ACTIONS.none;grabbed=false;});//mousedown
25633
- canvas.addEventListener("mousedown",this._canvasMouseDownListener=function(e){e.preventDefault();if(!_this139._visible||!grabbed)return;_this139._viewer.cameraControl.pointerEnabled=false;switch(e.which){case 1:// Left button
25634
- down=true;var canvasPos=getClickCoordsWithinElement(e);dragAction=nextDragAction;lastCanvasPos[0]=canvasPos[0];lastCanvasPos[1]=canvasPos[1];_this139.plugin.fire("clickPlaneStart");break;}});//mousemove
25635
- canvas.addEventListener("mousemove",this._canvasMouseMoveListener=function(e){if(!_this139._visible){return;}if(!down){return;}var canvasPos=getClickCoordsWithinElement(e);var x=canvasPos[0];var y=canvasPos[1];switch(dragAction){case DRAG_ACTIONS.xTranslate:dragTranslateSectionPlane(xBaseAxis,lastCanvasPos,canvasPos);break;case DRAG_ACTIONS.yTranslate:dragTranslateSectionPlane(yBaseAxis,lastCanvasPos,canvasPos);break;case DRAG_ACTIONS.zTranslate:dragTranslateSectionPlane(zBaseAxis,lastCanvasPos,canvasPos);break;case DRAG_ACTIONS.xRotate:dragRotateSectionPlane(xBaseAxis,lastCanvasPos,canvasPos);break;case DRAG_ACTIONS.yRotate:dragRotateSectionPlane(yBaseAxis,lastCanvasPos,canvasPos);break;case DRAG_ACTIONS.zRotate:dragRotateSectionPlane(zBaseAxis,lastCanvasPos,canvasPos);break;}lastCanvasPos[0]=x;lastCanvasPos[1]=y;});//mouseup
25636
- canvas.addEventListener("mouseup",this._canvasMouseUpListener=function(e){if(!_this139._visible)return;_this139._viewer.cameraControl.pointerEnabled=true;if(!down){return;}switch(e.which){}down=false;grabbed=false;_this139.plugin.fire("clickPlaneEnd");});//wheel
25637
- canvas.addEventListener("wheel",this._canvasWheelListener=function(e){if(!_this139._visible){return;}var delta=Math.max(-1,Math.min(1,-e.deltaY*40));if(delta===0){return;}});this._onCameraControlHover=this._viewer.cameraControl.on("touchEntity",function(hit){if(!_this139._visible||down||grabbed)return;grabbed=false;if(lastAffordanceMesh){lastAffordanceMesh.visible=false;}var affordanceMesh;var meshId=hit.entity.id;switch(meshId){case _this139._displayMeshes.xAxisArrowHandle.id:affordanceMesh=_this139._affordanceMeshes.xAxisArrow;nextDragAction=DRAG_ACTIONS.xTranslate;break;case _this139._displayMeshes.xAxisHandle.id:affordanceMesh=_this139._affordanceMeshes.xAxisArrow;nextDragAction=DRAG_ACTIONS.xTranslate;break;case _this139._displayMeshes.yAxisArrowHandle.id:affordanceMesh=_this139._affordanceMeshes.yAxisArrow;nextDragAction=DRAG_ACTIONS.yTranslate;break;case _this139._displayMeshes.yShaftHandle.id:affordanceMesh=_this139._affordanceMeshes.yAxisArrow;nextDragAction=DRAG_ACTIONS.yTranslate;break;case _this139._displayMeshes.zAxisArrowHandle.id:affordanceMesh=_this139._affordanceMeshes.zAxisArrow;nextDragAction=DRAG_ACTIONS.zTranslate;break;case _this139._displayMeshes.zAxisHandle.id:affordanceMesh=_this139._affordanceMeshes.zAxisArrow;nextDragAction=DRAG_ACTIONS.zTranslate;break;case _this139._displayMeshes.xCurveHandle.id:affordanceMesh=_this139._affordanceMeshes.xHoop;nextDragAction=DRAG_ACTIONS.xRotate;break;case _this139._displayMeshes.yCurveHandle.id:affordanceMesh=_this139._affordanceMeshes.yHoop;nextDragAction=DRAG_ACTIONS.yRotate;break;// case this._displayMeshes.zCurveHandle.id:
25879
+ }if(affordanceMesh){affordanceMesh.visible=true;}lastAffordanceMesh=affordanceMesh;grabbed=true;});this._onCameraControlHoverLeave=this._viewer.cameraControl.on("hoverOut",function(hit){if(!_this140._visible){return;}if(lastAffordanceMesh){lastAffordanceMesh.visible=false;}lastAffordanceMesh=null;nextDragAction=DRAG_ACTIONS.none;grabbed=false;});//mousedown
25880
+ canvas.addEventListener("mousedown",this._canvasMouseDownListener=function(e){e.preventDefault();if(!_this140._visible||!grabbed)return;_this140._viewer.cameraControl.pointerEnabled=false;switch(e.which){case 1:// Left button
25881
+ down=true;var canvasPos=getClickCoordsWithinElement(e);dragAction=nextDragAction;lastCanvasPos[0]=canvasPos[0];lastCanvasPos[1]=canvasPos[1];_this140.plugin.fire("clickPlaneStart");break;}});//mousemove
25882
+ canvas.addEventListener("mousemove",this._canvasMouseMoveListener=function(e){if(!_this140._visible){return;}if(!down){return;}var canvasPos=getClickCoordsWithinElement(e);var x=canvasPos[0];var y=canvasPos[1];switch(dragAction){case DRAG_ACTIONS.xTranslate:dragTranslateSectionPlane(xBaseAxis,lastCanvasPos,canvasPos);break;case DRAG_ACTIONS.yTranslate:dragTranslateSectionPlane(yBaseAxis,lastCanvasPos,canvasPos);break;case DRAG_ACTIONS.zTranslate:dragTranslateSectionPlane(zBaseAxis,lastCanvasPos,canvasPos);break;case DRAG_ACTIONS.xRotate:dragRotateSectionPlane(xBaseAxis,lastCanvasPos,canvasPos);break;case DRAG_ACTIONS.yRotate:dragRotateSectionPlane(yBaseAxis,lastCanvasPos,canvasPos);break;case DRAG_ACTIONS.zRotate:dragRotateSectionPlane(zBaseAxis,lastCanvasPos,canvasPos);break;}lastCanvasPos[0]=x;lastCanvasPos[1]=y;});//mouseup
25883
+ canvas.addEventListener("mouseup",this._canvasMouseUpListener=function(e){if(!_this140._visible)return;_this140._viewer.cameraControl.pointerEnabled=true;if(!down){return;}switch(e.which){}down=false;grabbed=false;_this140.plugin.fire("clickPlaneEnd");});//wheel
25884
+ canvas.addEventListener("wheel",this._canvasWheelListener=function(e){if(!_this140._visible){return;}var delta=Math.max(-1,Math.min(1,-e.deltaY*40));if(delta===0){return;}});this._onCameraControlHover=this._viewer.cameraControl.on("touchEntity",function(hit){if(!_this140._visible||down||grabbed)return;grabbed=false;if(lastAffordanceMesh){lastAffordanceMesh.visible=false;}var affordanceMesh;var meshId=hit.entity.id;switch(meshId){case _this140._displayMeshes.xAxisArrowHandle.id:affordanceMesh=_this140._affordanceMeshes.xAxisArrow;nextDragAction=DRAG_ACTIONS.xTranslate;break;case _this140._displayMeshes.xAxisHandle.id:affordanceMesh=_this140._affordanceMeshes.xAxisArrow;nextDragAction=DRAG_ACTIONS.xTranslate;break;case _this140._displayMeshes.yAxisArrowHandle.id:affordanceMesh=_this140._affordanceMeshes.yAxisArrow;nextDragAction=DRAG_ACTIONS.yTranslate;break;case _this140._displayMeshes.yShaftHandle.id:affordanceMesh=_this140._affordanceMeshes.yAxisArrow;nextDragAction=DRAG_ACTIONS.yTranslate;break;case _this140._displayMeshes.zAxisArrowHandle.id:affordanceMesh=_this140._affordanceMeshes.zAxisArrow;nextDragAction=DRAG_ACTIONS.zTranslate;break;case _this140._displayMeshes.zAxisHandle.id:affordanceMesh=_this140._affordanceMeshes.zAxisArrow;nextDragAction=DRAG_ACTIONS.zTranslate;break;case _this140._displayMeshes.xCurveHandle.id:affordanceMesh=_this140._affordanceMeshes.xHoop;nextDragAction=DRAG_ACTIONS.xRotate;break;case _this140._displayMeshes.yCurveHandle.id:affordanceMesh=_this140._affordanceMeshes.yHoop;nextDragAction=DRAG_ACTIONS.yRotate;break;// case this._displayMeshes.zCurveHandle.id:
25638
25885
  // affordanceMesh = this._affordanceMeshes.zHoop;
25639
25886
  // nextDragAction = DRAG_ACTIONS.zRotate;
25640
25887
  // break;
25641
25888
  default:nextDragAction=DRAG_ACTIONS.none;return;// Not clicked an arrow or hoop
25642
25889
  }if(affordanceMesh){affordanceMesh.visible=true;}lastAffordanceMesh=affordanceMesh;grabbed=true;});//touchstart
25643
- canvas.addEventListener("touchstart",this._canvasMouseDownListener=function(e){e.preventDefault();if(!_this139._visible||!grabbed)return;_this139._viewer.cameraControl.pointerEnabled=false;down=true;var canvasPos=getTouchCoordsWithinElement(e);dragAction=nextDragAction;lastCanvasPos[0]=canvasPos[0];lastCanvasPos[1]=canvasPos[1];_this139.plugin.fire("touchPlaneStart");});//touchmove
25644
- canvas.addEventListener("touchmove",this._canvasMouseMoveListener=function(e){if(!_this139._visible||!down)return;var canvasPos=getTouchCoordsWithinElement(e);var x=canvasPos[0];var y=canvasPos[1];switch(dragAction){case DRAG_ACTIONS.xTranslate:dragTranslateSectionPlane(xBaseAxis,lastCanvasPos,canvasPos);break;case DRAG_ACTIONS.yTranslate:dragTranslateSectionPlane(yBaseAxis,lastCanvasPos,canvasPos);break;case DRAG_ACTIONS.zTranslate:dragTranslateSectionPlane(zBaseAxis,lastCanvasPos,canvasPos);break;case DRAG_ACTIONS.xRotate:dragRotateSectionPlane(xBaseAxis,lastCanvasPos,canvasPos);break;case DRAG_ACTIONS.yRotate:dragRotateSectionPlane(yBaseAxis,lastCanvasPos,canvasPos);break;case DRAG_ACTIONS.zRotate:dragRotateSectionPlane(zBaseAxis,lastCanvasPos,canvasPos);break;}lastCanvasPos[0]=x;lastCanvasPos[1]=y;});//touchend
25645
- canvas.addEventListener("touchend",this._canvasTouchEndListener=function(e){if(!_this139._visible)return;_this139._viewer.cameraControl.pointerEnabled=true;if(lastAffordanceMesh){lastAffordanceMesh.visible=false;}lastAffordanceMesh=null;nextDragAction=DRAG_ACTIONS.none;down=false;grabbed=false;_this139.plugin.fire("touchPlaneEnd");});canvas.addEventListener("touchcancel",this._canvasTouchEndListener);}}},{key:"_destroy",value:function _destroy(){this._unbindEvents();this._destroyNodes();}},{key:"_unbindEvents",value:function _unbindEvents(){var viewer=this._viewer;var scene=viewer.scene;var canvas=scene.canvas.canvas;var camera=viewer.camera;var cameraControl=viewer.cameraControl;scene.off(this._onSceneTick);canvas.removeEventListener("mousedown",this._canvasMouseDownListener);canvas.removeEventListener("mousemove",this._canvasMouseMoveListener);canvas.removeEventListener("mouseup",this._canvasMouseUpListener);canvas.removeEventListener("wheel",this._canvasWheelListener);canvas.removeEventListener("touchend",this._canvasTouchEndListener);canvas.removeEventListener("touchcancel",this._canvasTouchEndListener);camera.off(this._onCameraViewMatrix);camera.off(this._onCameraProjMatrix);cameraControl.off(this._onCameraControlHover);cameraControl.off(this._onCameraControlHoverLeave);}},{key:"_destroyNodes",value:function _destroyNodes(){this._setSectionPlane(null);this._rootNode.destroy();this._displayMeshes={};this._affordanceMeshes={};}}]);}();var zeroVec$2=new Float64Array([0,0,1]);var quat$2=new Float64Array(4);/**
25890
+ canvas.addEventListener("touchstart",this._canvasMouseDownListener=function(e){e.preventDefault();if(!_this140._visible||!grabbed)return;_this140._viewer.cameraControl.pointerEnabled=false;down=true;var canvasPos=getTouchCoordsWithinElement(e);dragAction=nextDragAction;lastCanvasPos[0]=canvasPos[0];lastCanvasPos[1]=canvasPos[1];_this140.plugin.fire("touchPlaneStart");});//touchmove
25891
+ canvas.addEventListener("touchmove",this._canvasMouseMoveListener=function(e){if(!_this140._visible||!down)return;var canvasPos=getTouchCoordsWithinElement(e);var x=canvasPos[0];var y=canvasPos[1];switch(dragAction){case DRAG_ACTIONS.xTranslate:dragTranslateSectionPlane(xBaseAxis,lastCanvasPos,canvasPos);break;case DRAG_ACTIONS.yTranslate:dragTranslateSectionPlane(yBaseAxis,lastCanvasPos,canvasPos);break;case DRAG_ACTIONS.zTranslate:dragTranslateSectionPlane(zBaseAxis,lastCanvasPos,canvasPos);break;case DRAG_ACTIONS.xRotate:dragRotateSectionPlane(xBaseAxis,lastCanvasPos,canvasPos);break;case DRAG_ACTIONS.yRotate:dragRotateSectionPlane(yBaseAxis,lastCanvasPos,canvasPos);break;case DRAG_ACTIONS.zRotate:dragRotateSectionPlane(zBaseAxis,lastCanvasPos,canvasPos);break;}lastCanvasPos[0]=x;lastCanvasPos[1]=y;});//touchend
25892
+ canvas.addEventListener("touchend",this._canvasTouchEndListener=function(e){if(!_this140._visible)return;_this140._viewer.cameraControl.pointerEnabled=true;if(lastAffordanceMesh){lastAffordanceMesh.visible=false;}lastAffordanceMesh=null;nextDragAction=DRAG_ACTIONS.none;down=false;grabbed=false;_this140.plugin.fire("touchPlaneEnd");});canvas.addEventListener("touchcancel",this._canvasTouchEndListener);}}},{key:"_destroy",value:function _destroy(){this._unbindEvents();this._destroyNodes();}},{key:"_unbindEvents",value:function _unbindEvents(){var viewer=this._viewer;var scene=viewer.scene;var canvas=scene.canvas.canvas;var camera=viewer.camera;var cameraControl=viewer.cameraControl;scene.off(this._onSceneTick);canvas.removeEventListener("mousedown",this._canvasMouseDownListener);canvas.removeEventListener("mousemove",this._canvasMouseMoveListener);canvas.removeEventListener("mouseup",this._canvasMouseUpListener);canvas.removeEventListener("wheel",this._canvasWheelListener);canvas.removeEventListener("touchend",this._canvasTouchEndListener);canvas.removeEventListener("touchcancel",this._canvasTouchEndListener);camera.off(this._onCameraViewMatrix);camera.off(this._onCameraProjMatrix);cameraControl.off(this._onCameraControlHover);cameraControl.off(this._onCameraControlHoverLeave);}},{key:"_destroyNodes",value:function _destroyNodes(){this._setSectionPlane(null);this._rootNode.destroy();this._displayMeshes={};this._affordanceMeshes={};}}]);}();var zeroVec$2=new Float64Array([0,0,1]);var quat$2=new Float64Array(4);/**
25646
25893
  * Controls a {@link SectionPlane} with mouse and touch input.
25647
25894
  *
25648
25895
  * @private
@@ -25875,7 +26122,7 @@ geometry:shapes.hoop,material:materials.blue,highlighted:true,highlightMaterial:
25875
26122
  * SectionPlanesPlugin keeps SectionPlaneControls in a reuse pool.
25876
26123
  * Call with a null or undefined value to disconnect the Control ffrom whatever SectionPlane it was assigned to.
25877
26124
  * @private
25878
- */},{key:"_setSectionPlane",value:function _setSectionPlane(sectionPlane){var _this140=this;if(this._sectionPlane){this._sectionPlane.off(this._onSectionPlanePos);this._sectionPlane.off(this._onSectionPlaneDir);this._onSectionPlanePos=null;this._onSectionPlaneDir=null;this._sectionPlane=null;}if(sectionPlane){this.id=sectionPlane.controlId;this._createNodes();this._bindEvents();this._setPos(sectionPlane.pos);this._setDir(sectionPlane.dir);this._sectionPlane=sectionPlane;this._onSectionPlanePos=sectionPlane.on("pos",function(){_this140._setPos(_this140._sectionPlane.pos);});this._onSectionPlaneDir=sectionPlane.on("dir",function(){if(!_this140._ignoreNextSectionPlaneDirUpdate){_this140._setDir(_this140._sectionPlane.dir);}else{_this140._ignoreNextSectionPlaneDirUpdate=false;}});}}/**
26125
+ */},{key:"_setSectionPlane",value:function _setSectionPlane(sectionPlane){var _this141=this;if(this._sectionPlane){this._sectionPlane.off(this._onSectionPlanePos);this._sectionPlane.off(this._onSectionPlaneDir);this._onSectionPlanePos=null;this._onSectionPlaneDir=null;this._sectionPlane=null;}if(sectionPlane){this.id=sectionPlane.controlId;this._createNodes();this._bindEvents();this._setPos(sectionPlane.pos);this._setDir(sectionPlane.dir);this._sectionPlane=sectionPlane;this._onSectionPlanePos=sectionPlane.on("pos",function(){_this141._setPos(_this141._sectionPlane.pos);});this._onSectionPlaneDir=sectionPlane.on("dir",function(){if(!_this141._ignoreNextSectionPlaneDirUpdate){_this141._setDir(_this141._sectionPlane.dir);}else{_this141._ignoreNextSectionPlaneDirUpdate=false;}});}}/**
25879
26126
  * Gets the {@link SectionPlane} controlled by this Control.
25880
26127
  * @returns {SectionPlane} The SectionPlane.
25881
26128
  */},{key:"sectionPlane",get:function get(){return this._sectionPlane;}/**
@@ -25903,10 +26150,10 @@ posRate=Math.max(0,Math.min(100,posRate));return parseInt(posRate);}/** @private
25903
26150
  * Sets if this Control is culled. This is called by SectionPlanesPlugin to
25904
26151
  * temporarily hide the Control while a snapshot is being taken by Viewer#getSnapshot().
25905
26152
  * @param culled
25906
- */},{key:"setCulled",value:function setCulled(culled){var id;for(id in this._displayMeshes){if(this._displayMeshes.hasOwnProperty(id)){this._displayMeshes[id].culled=culled;}}if(!culled){for(id in this._affordanceMeshes){if(this._affordanceMeshes.hasOwnProperty(id)){this._affordanceMeshes[id].culled=culled;}}}}},{key:"_bindEvents",value:function _bindEvents(){var _this141=this;var self=this;var grabbed=false;var DRAG_ACTIONS={none:-1,xTranslate:0,yTranslate:1,zTranslate:2,xRotate:3,yRotate:4,zRotate:5};var rootNode=this._rootNode;var nextDragAction=null;// As we hover grabbed an arrow or hoop, self is the action we would do if we then dragged it.
26153
+ */},{key:"setCulled",value:function setCulled(culled){var id;for(id in this._displayMeshes){if(this._displayMeshes.hasOwnProperty(id)){this._displayMeshes[id].culled=culled;}}if(!culled){for(id in this._affordanceMeshes){if(this._affordanceMeshes.hasOwnProperty(id)){this._affordanceMeshes[id].culled=culled;}}}}},{key:"_bindEvents",value:function _bindEvents(){var _this142=this;var self=this;var grabbed=false;var DRAG_ACTIONS={none:-1,xTranslate:0,yTranslate:1,zTranslate:2,xRotate:3,yRotate:4,zRotate:5};var rootNode=this._rootNode;var nextDragAction=null;// As we hover grabbed an arrow or hoop, self is the action we would do if we then dragged it.
25907
26154
  var dragAction=null;// Action we're doing while we drag an arrow or hoop.
25908
26155
  var lastCanvasPos=math.vec2();var xBaseAxis=math.vec3([1,0,0]);var yBaseAxis=math.vec3([0,1,0]);var zBaseAxis=math.vec3([0,0,1]);var canvas=this._viewer.scene.canvas.canvas;var camera=this._viewer.camera;var scene=this._viewer.scene;{// Keep gizmo screen size constant
25909
- var _tempVec3a2=math.vec3([0,0,0]);var lastDist=-1;this._onCameraViewMatrix=scene.camera.on("viewMatrix",function(){});this._onCameraProjMatrix=scene.camera.on("projMatrix",function(){});this._onSceneTick=scene.on("tick",function(){var dist=Math.abs(math.lenVec3(math.subVec3(scene.camera.eye,_this141._pos,_tempVec3a2)));if(dist!==lastDist){if(camera.projection==="perspective"){Math.tan(camera.perspective.fov*math.DEGTORAD)*dist;// const size = 0.07 * worldSize;
26156
+ var _tempVec3a2=math.vec3([0,0,0]);var lastDist=-1;this._onCameraViewMatrix=scene.camera.on("viewMatrix",function(){});this._onCameraProjMatrix=scene.camera.on("projMatrix",function(){});this._onSceneTick=scene.on("tick",function(){var dist=Math.abs(math.lenVec3(math.subVec3(scene.camera.eye,_this142._pos,_tempVec3a2)));if(dist!==lastDist){if(camera.projection==="perspective"){Math.tan(camera.perspective.fov*math.DEGTORAD)*dist;// const size = 0.07 * worldSize;
25910
26157
  // rootNode.scale = [size, size, size];
25911
26158
  lastDist=dist;}}if(camera.projection==="ortho"){camera.ortho.scale/10;// const size = worldSize;
25912
26159
  // rootNode.scale = [size, size, size];
@@ -25920,24 +26167,24 @@ math.inverseMat4(matrix);math.transformVec4(matrix,dir,dir);math.mulVec4Scalar(d
25920
26167
  var rayO=camera.eye;// The direction
25921
26168
  math.subVec4(dir,rayO,dir);var origin=self._sectionPlane.pos;// Plane origin:
25922
26169
  var d=-math.dotVec3(origin,axis)-offset;var dot=math.dotVec3(axis,dir);if(Math.abs(dot)>0.005){var t=-(math.dotVec3(axis,rayO)+d)/dot;math.mulVec3Scalar(dir,t,dest);math.addVec3(dest,rayO);math.subVec3(dest,origin,dest);return true;}return false;};}();var rotateSectionPlane=function(){var dir=math.vec3();var mat=math.mat4();return function(){if(self.sectionPlane){math.quaternionToMat4(rootNode.quaternion,mat);// << ---
25923
- math.transformVec3(mat,[0,0,1],dir);self._setSectionPlaneDir(dir);}};}();{var down=false;var lastAffordanceMesh;this._onCameraControlHover=this._viewer.cameraControl.on("hoverEnter",function(hit){if(!_this141._visible){return;}if(down){return;}grabbed=false;if(lastAffordanceMesh){lastAffordanceMesh.visible=false;}var affordanceMesh;var meshId=hit.entity.id;switch(meshId){case _this141._displayMeshes.xAxisArrowHandle.id:affordanceMesh=_this141._affordanceMeshes.xAxisArrow;nextDragAction=DRAG_ACTIONS.xTranslate;break;case _this141._displayMeshes.xAxisHandle.id:affordanceMesh=_this141._affordanceMeshes.xAxisArrow;nextDragAction=DRAG_ACTIONS.xTranslate;break;case _this141._displayMeshes.yAxisArrowHandle.id:affordanceMesh=_this141._affordanceMeshes.yAxisArrow;nextDragAction=DRAG_ACTIONS.yTranslate;break;case _this141._displayMeshes.yShaftHandle.id:affordanceMesh=_this141._affordanceMeshes.yAxisArrow;nextDragAction=DRAG_ACTIONS.yTranslate;break;case _this141._displayMeshes.zAxisArrowHandle.id:affordanceMesh=_this141._affordanceMeshes.zAxisArrow;nextDragAction=DRAG_ACTIONS.zTranslate;break;case _this141._displayMeshes.zAxisHandle.id:affordanceMesh=_this141._affordanceMeshes.zAxisArrow;nextDragAction=DRAG_ACTIONS.zTranslate;break;case _this141._displayMeshes.xCurveHandle.id:affordanceMesh=_this141._affordanceMeshes.xHoop;nextDragAction=DRAG_ACTIONS.xRotate;break;case _this141._displayMeshes.yCurveHandle.id:affordanceMesh=_this141._affordanceMeshes.yHoop;nextDragAction=DRAG_ACTIONS.yRotate;break;// case this._displayMeshes.zCurveHandle.id:
26170
+ math.transformVec3(mat,[0,0,1],dir);self._setSectionPlaneDir(dir);}};}();{var down=false;var lastAffordanceMesh;this._onCameraControlHover=this._viewer.cameraControl.on("hoverEnter",function(hit){if(!_this142._visible){return;}if(down){return;}grabbed=false;if(lastAffordanceMesh){lastAffordanceMesh.visible=false;}var affordanceMesh;var meshId=hit.entity.id;switch(meshId){case _this142._displayMeshes.xAxisArrowHandle.id:affordanceMesh=_this142._affordanceMeshes.xAxisArrow;nextDragAction=DRAG_ACTIONS.xTranslate;break;case _this142._displayMeshes.xAxisHandle.id:affordanceMesh=_this142._affordanceMeshes.xAxisArrow;nextDragAction=DRAG_ACTIONS.xTranslate;break;case _this142._displayMeshes.yAxisArrowHandle.id:affordanceMesh=_this142._affordanceMeshes.yAxisArrow;nextDragAction=DRAG_ACTIONS.yTranslate;break;case _this142._displayMeshes.yShaftHandle.id:affordanceMesh=_this142._affordanceMeshes.yAxisArrow;nextDragAction=DRAG_ACTIONS.yTranslate;break;case _this142._displayMeshes.zAxisArrowHandle.id:affordanceMesh=_this142._affordanceMeshes.zAxisArrow;nextDragAction=DRAG_ACTIONS.zTranslate;break;case _this142._displayMeshes.zAxisHandle.id:affordanceMesh=_this142._affordanceMeshes.zAxisArrow;nextDragAction=DRAG_ACTIONS.zTranslate;break;case _this142._displayMeshes.xCurveHandle.id:affordanceMesh=_this142._affordanceMeshes.xHoop;nextDragAction=DRAG_ACTIONS.xRotate;break;case _this142._displayMeshes.yCurveHandle.id:affordanceMesh=_this142._affordanceMeshes.yHoop;nextDragAction=DRAG_ACTIONS.yRotate;break;// case this._displayMeshes.zCurveHandle.id:
25924
26171
  // affordanceMesh = this._affordanceMeshes.zHoop;
25925
26172
  // nextDragAction = DRAG_ACTIONS.zRotate;
25926
26173
  // break;
25927
26174
  default:nextDragAction=DRAG_ACTIONS.none;return;// Not clicked an arrow or hoop
25928
- }if(affordanceMesh){affordanceMesh.visible=true;}lastAffordanceMesh=affordanceMesh;grabbed=true;});this._onCameraControlHoverLeave=this._viewer.cameraControl.on("hoverOut",function(hit){if(!_this141._visible){return;}if(lastAffordanceMesh){lastAffordanceMesh.visible=false;}lastAffordanceMesh=null;nextDragAction=DRAG_ACTIONS.none;grabbed=false;});//mousedown
25929
- canvas.addEventListener("mousedown",this._canvasMouseDownListener=function(e){e.preventDefault();if(!_this141._visible||!grabbed)return;_this141._viewer.cameraControl.pointerEnabled=false;switch(e.which){case 1:down=true;var canvasPos=getClickCoordsWithinElement(e);dragAction=nextDragAction;lastCanvasPos[0]=canvasPos[0];lastCanvasPos[1]=canvasPos[1];_this141.plugin.fire("clickPlaneStart");break;}});//mousemove
25930
- canvas.addEventListener("mousemove",this._canvasMouseMoveListener=function(e){if(!_this141._visible){return;}if(!down||!grabbed){return;}var canvasPos=getClickCoordsWithinElement(e);var x=canvasPos[0];var y=canvasPos[1];switch(dragAction){case DRAG_ACTIONS.xTranslate:dragTranslateSectionPlane(xBaseAxis,lastCanvasPos,canvasPos);break;case DRAG_ACTIONS.yTranslate:dragTranslateSectionPlane(yBaseAxis,lastCanvasPos,canvasPos);break;case DRAG_ACTIONS.zTranslate:dragTranslateSectionPlane(zBaseAxis,lastCanvasPos,canvasPos);break;case DRAG_ACTIONS.xRotate:dragRotateSectionPlane(xBaseAxis,lastCanvasPos,canvasPos);break;case DRAG_ACTIONS.yRotate:dragRotateSectionPlane(yBaseAxis,lastCanvasPos,canvasPos);break;case DRAG_ACTIONS.zRotate:dragRotateSectionPlane(zBaseAxis,lastCanvasPos,canvasPos);break;}lastCanvasPos[0]=x;lastCanvasPos[1]=y;});//mouseup
25931
- canvas.addEventListener("mouseup",this._canvasMouseUpListener=function(e){if(!_this141._visible)return;_this141._viewer.cameraControl.pointerEnabled=true;if(!down){return;}down=false;grabbed=false;_this141.plugin.fire("clickPlaneEnd");});//wheel
25932
- canvas.addEventListener("wheel",this._canvasWheelListener=function(e){if(!_this141._visible){return;}var delta=Math.max(-1,Math.min(1,-e.deltaY*40));if(delta===0){return;}});this._onCameraControlHover=this._viewer.cameraControl.on("touchEntity",function(hit){if(!_this141._visible||down||grabbed)return;grabbed=false;if(lastAffordanceMesh){lastAffordanceMesh.visible=false;}var affordanceMesh;var meshId=hit.entity.id;switch(meshId){case _this141._displayMeshes.xAxisArrowHandle.id:affordanceMesh=_this141._affordanceMeshes.xAxisArrow;nextDragAction=DRAG_ACTIONS.xTranslate;break;case _this141._displayMeshes.xAxisHandle.id:affordanceMesh=_this141._affordanceMeshes.xAxisArrow;nextDragAction=DRAG_ACTIONS.xTranslate;break;case _this141._displayMeshes.yAxisArrowHandle.id:affordanceMesh=_this141._affordanceMeshes.yAxisArrow;nextDragAction=DRAG_ACTIONS.yTranslate;break;case _this141._displayMeshes.yShaftHandle.id:affordanceMesh=_this141._affordanceMeshes.yAxisArrow;nextDragAction=DRAG_ACTIONS.yTranslate;break;case _this141._displayMeshes.zAxisArrowHandle.id:affordanceMesh=_this141._affordanceMeshes.zAxisArrow;nextDragAction=DRAG_ACTIONS.zTranslate;break;case _this141._displayMeshes.zAxisHandle.id:affordanceMesh=_this141._affordanceMeshes.zAxisArrow;nextDragAction=DRAG_ACTIONS.zTranslate;break;case _this141._displayMeshes.xCurveHandle.id:affordanceMesh=_this141._affordanceMeshes.xHoop;nextDragAction=DRAG_ACTIONS.xRotate;break;case _this141._displayMeshes.yCurveHandle.id:affordanceMesh=_this141._affordanceMeshes.yHoop;nextDragAction=DRAG_ACTIONS.yRotate;break;// case this._displayMeshes.zCurveHandle.id:
26175
+ }if(affordanceMesh){affordanceMesh.visible=true;}lastAffordanceMesh=affordanceMesh;grabbed=true;});this._onCameraControlHoverLeave=this._viewer.cameraControl.on("hoverOut",function(hit){if(!_this142._visible){return;}if(lastAffordanceMesh){lastAffordanceMesh.visible=false;}lastAffordanceMesh=null;nextDragAction=DRAG_ACTIONS.none;grabbed=false;});//mousedown
26176
+ canvas.addEventListener("mousedown",this._canvasMouseDownListener=function(e){e.preventDefault();if(!_this142._visible||!grabbed)return;_this142._viewer.cameraControl.pointerEnabled=false;switch(e.which){case 1:down=true;var canvasPos=getClickCoordsWithinElement(e);dragAction=nextDragAction;lastCanvasPos[0]=canvasPos[0];lastCanvasPos[1]=canvasPos[1];_this142.plugin.fire("clickPlaneStart");break;}});//mousemove
26177
+ canvas.addEventListener("mousemove",this._canvasMouseMoveListener=function(e){if(!_this142._visible){return;}if(!down||!grabbed){return;}var canvasPos=getClickCoordsWithinElement(e);var x=canvasPos[0];var y=canvasPos[1];switch(dragAction){case DRAG_ACTIONS.xTranslate:dragTranslateSectionPlane(xBaseAxis,lastCanvasPos,canvasPos);break;case DRAG_ACTIONS.yTranslate:dragTranslateSectionPlane(yBaseAxis,lastCanvasPos,canvasPos);break;case DRAG_ACTIONS.zTranslate:dragTranslateSectionPlane(zBaseAxis,lastCanvasPos,canvasPos);break;case DRAG_ACTIONS.xRotate:dragRotateSectionPlane(xBaseAxis,lastCanvasPos,canvasPos);break;case DRAG_ACTIONS.yRotate:dragRotateSectionPlane(yBaseAxis,lastCanvasPos,canvasPos);break;case DRAG_ACTIONS.zRotate:dragRotateSectionPlane(zBaseAxis,lastCanvasPos,canvasPos);break;}lastCanvasPos[0]=x;lastCanvasPos[1]=y;});//mouseup
26178
+ canvas.addEventListener("mouseup",this._canvasMouseUpListener=function(e){if(!_this142._visible)return;_this142._viewer.cameraControl.pointerEnabled=true;if(!down){return;}down=false;grabbed=false;_this142.plugin.fire("clickPlaneEnd");});//wheel
26179
+ canvas.addEventListener("wheel",this._canvasWheelListener=function(e){if(!_this142._visible){return;}var delta=Math.max(-1,Math.min(1,-e.deltaY*40));if(delta===0){return;}});this._onCameraControlHover=this._viewer.cameraControl.on("touchEntity",function(hit){if(!_this142._visible||down||grabbed)return;grabbed=false;if(lastAffordanceMesh){lastAffordanceMesh.visible=false;}var affordanceMesh;var meshId=hit.entity.id;switch(meshId){case _this142._displayMeshes.xAxisArrowHandle.id:affordanceMesh=_this142._affordanceMeshes.xAxisArrow;nextDragAction=DRAG_ACTIONS.xTranslate;break;case _this142._displayMeshes.xAxisHandle.id:affordanceMesh=_this142._affordanceMeshes.xAxisArrow;nextDragAction=DRAG_ACTIONS.xTranslate;break;case _this142._displayMeshes.yAxisArrowHandle.id:affordanceMesh=_this142._affordanceMeshes.yAxisArrow;nextDragAction=DRAG_ACTIONS.yTranslate;break;case _this142._displayMeshes.yShaftHandle.id:affordanceMesh=_this142._affordanceMeshes.yAxisArrow;nextDragAction=DRAG_ACTIONS.yTranslate;break;case _this142._displayMeshes.zAxisArrowHandle.id:affordanceMesh=_this142._affordanceMeshes.zAxisArrow;nextDragAction=DRAG_ACTIONS.zTranslate;break;case _this142._displayMeshes.zAxisHandle.id:affordanceMesh=_this142._affordanceMeshes.zAxisArrow;nextDragAction=DRAG_ACTIONS.zTranslate;break;case _this142._displayMeshes.xCurveHandle.id:affordanceMesh=_this142._affordanceMeshes.xHoop;nextDragAction=DRAG_ACTIONS.xRotate;break;case _this142._displayMeshes.yCurveHandle.id:affordanceMesh=_this142._affordanceMeshes.yHoop;nextDragAction=DRAG_ACTIONS.yRotate;break;// case this._displayMeshes.zCurveHandle.id:
25933
26180
  // affordanceMesh = this._affordanceMeshes.zHoop;
25934
26181
  // nextDragAction = DRAG_ACTIONS.zRotate;
25935
26182
  // break;
25936
26183
  default:nextDragAction=DRAG_ACTIONS.none;return;// Not clicked an arrow or hoop
25937
26184
  }if(affordanceMesh){affordanceMesh.visible=true;}lastAffordanceMesh=affordanceMesh;grabbed=true;});//touchstart
25938
- canvas.addEventListener("touchstart",this._canvasMouseDownListener=function(e){e.preventDefault();if(!_this141._visible||!grabbed)return;_this141._viewer.cameraControl.pointerEnabled=false;down=true;var canvasPos=getTouchCoordsWithinElement(e);dragAction=nextDragAction;lastCanvasPos[0]=canvasPos[0];lastCanvasPos[1]=canvasPos[1];_this141.plugin.fire("touchPlaneStart");});//touchmove
25939
- canvas.addEventListener("touchmove",this._canvasMouseMoveListener=function(e){if(!_this141._visible||!down)return;var canvasPos=getTouchCoordsWithinElement(e);var x=canvasPos[0];var y=canvasPos[1];switch(dragAction){case DRAG_ACTIONS.xTranslate:dragTranslateSectionPlane(xBaseAxis,lastCanvasPos,canvasPos);break;case DRAG_ACTIONS.yTranslate:dragTranslateSectionPlane(yBaseAxis,lastCanvasPos,canvasPos);break;case DRAG_ACTIONS.zTranslate:dragTranslateSectionPlane(zBaseAxis,lastCanvasPos,canvasPos);break;case DRAG_ACTIONS.xRotate:dragRotateSectionPlane(xBaseAxis,lastCanvasPos,canvasPos);break;case DRAG_ACTIONS.yRotate:dragRotateSectionPlane(yBaseAxis,lastCanvasPos,canvasPos);break;case DRAG_ACTIONS.zRotate:dragRotateSectionPlane(zBaseAxis,lastCanvasPos,canvasPos);break;}lastCanvasPos[0]=x;lastCanvasPos[1]=y;});//touchend
25940
- canvas.addEventListener("touchend",this._canvasTouchEndListener=function(e){if(!_this141._visible)return;_this141._viewer.cameraControl.pointerEnabled=true;if(lastAffordanceMesh){lastAffordanceMesh.visible=false;}lastAffordanceMesh=null;nextDragAction=DRAG_ACTIONS.none;down=false;grabbed=false;_this141.plugin.fire("touchPlaneEnd");});canvas.addEventListener("touchcancel",this._canvasTouchEndListener);}}},{key:"_destroy",value:function _destroy(){this._unbindEvents();this._destroyNodes();}},{key:"_unbindEvents",value:function _unbindEvents(){var viewer=this._viewer;var scene=viewer.scene;var canvas=scene.canvas.canvas;var camera=viewer.camera;var cameraControl=viewer.cameraControl;scene.off(this._onSceneTick);canvas.removeEventListener("mousedown",this._canvasMouseDownListener);canvas.removeEventListener("mousemove",this._canvasMouseMoveListener);canvas.removeEventListener("mouseup",this._canvasMouseUpListener);canvas.removeEventListener("wheel",this._canvasWheelListener);canvas.removeEventListener("touchend",this._canvasTouchEndListener);canvas.removeEventListener("touchcancel",this._canvasTouchEndListener);camera.off(this._onCameraViewMatrix);camera.off(this._onCameraProjMatrix);cameraControl.off(this._onCameraControlHover);cameraControl.off(this._onCameraControlHoverLeave);}},{key:"_destroyNodes",value:function _destroyNodes(){this._setSectionPlane(null);this._rootNode.destroy();this._displayMeshes={};this._affordanceMeshes={};}}]);}();var zeroVec$1=new Float64Array([0,0,1]);var quat$1=new Float64Array(4);/**
26185
+ canvas.addEventListener("touchstart",this._canvasMouseDownListener=function(e){e.preventDefault();if(!_this142._visible||!grabbed)return;_this142._viewer.cameraControl.pointerEnabled=false;down=true;var canvasPos=getTouchCoordsWithinElement(e);dragAction=nextDragAction;lastCanvasPos[0]=canvasPos[0];lastCanvasPos[1]=canvasPos[1];_this142.plugin.fire("touchPlaneStart");});//touchmove
26186
+ canvas.addEventListener("touchmove",this._canvasMouseMoveListener=function(e){if(!_this142._visible||!down)return;var canvasPos=getTouchCoordsWithinElement(e);var x=canvasPos[0];var y=canvasPos[1];switch(dragAction){case DRAG_ACTIONS.xTranslate:dragTranslateSectionPlane(xBaseAxis,lastCanvasPos,canvasPos);break;case DRAG_ACTIONS.yTranslate:dragTranslateSectionPlane(yBaseAxis,lastCanvasPos,canvasPos);break;case DRAG_ACTIONS.zTranslate:dragTranslateSectionPlane(zBaseAxis,lastCanvasPos,canvasPos);break;case DRAG_ACTIONS.xRotate:dragRotateSectionPlane(xBaseAxis,lastCanvasPos,canvasPos);break;case DRAG_ACTIONS.yRotate:dragRotateSectionPlane(yBaseAxis,lastCanvasPos,canvasPos);break;case DRAG_ACTIONS.zRotate:dragRotateSectionPlane(zBaseAxis,lastCanvasPos,canvasPos);break;}lastCanvasPos[0]=x;lastCanvasPos[1]=y;});//touchend
26187
+ canvas.addEventListener("touchend",this._canvasTouchEndListener=function(e){if(!_this142._visible)return;_this142._viewer.cameraControl.pointerEnabled=true;if(lastAffordanceMesh){lastAffordanceMesh.visible=false;}lastAffordanceMesh=null;nextDragAction=DRAG_ACTIONS.none;down=false;grabbed=false;_this142.plugin.fire("touchPlaneEnd");});canvas.addEventListener("touchcancel",this._canvasTouchEndListener);}}},{key:"_destroy",value:function _destroy(){this._unbindEvents();this._destroyNodes();}},{key:"_unbindEvents",value:function _unbindEvents(){var viewer=this._viewer;var scene=viewer.scene;var canvas=scene.canvas.canvas;var camera=viewer.camera;var cameraControl=viewer.cameraControl;scene.off(this._onSceneTick);canvas.removeEventListener("mousedown",this._canvasMouseDownListener);canvas.removeEventListener("mousemove",this._canvasMouseMoveListener);canvas.removeEventListener("mouseup",this._canvasMouseUpListener);canvas.removeEventListener("wheel",this._canvasWheelListener);canvas.removeEventListener("touchend",this._canvasTouchEndListener);canvas.removeEventListener("touchcancel",this._canvasTouchEndListener);camera.off(this._onCameraViewMatrix);camera.off(this._onCameraProjMatrix);cameraControl.off(this._onCameraControlHover);cameraControl.off(this._onCameraControlHoverLeave);}},{key:"_destroyNodes",value:function _destroyNodes(){this._setSectionPlane(null);this._rootNode.destroy();this._displayMeshes={};this._affordanceMeshes={};}}]);}();var zeroVec$1=new Float64Array([0,0,1]);var quat$1=new Float64Array(4);/**
25941
26188
  * Controls a {@link SectionPlane} with mouse and touch input.
25942
26189
  *
25943
26190
  * @private
@@ -26009,7 +26256,7 @@ width/2,-height/2,0.012,// 右下角
26009
26256
  * SectionPlanesPlugin keeps SectionPlaneControls in a reuse pool.
26010
26257
  * Call with a null or undefined value to disconnect the Control ffrom whatever SectionPlane it was assigned to.
26011
26258
  * @private
26012
- */},{key:"_setSectionPlane",value:function _setSectionPlane(sectionPlane){var _this142=this;if(this._sectionPlane){this._sectionPlane.off(this._onSectionPlanePos);this._sectionPlane.off(this._onSectionPlaneDir);this._onSectionPlanePos=null;this._onSectionPlaneDir=null;this._sectionPlane=null;}if(sectionPlane){this.id=sectionPlane.controlId;this.dir=sectionPlane.dir;this._createNodes();this._bindEvents();this._setPos(sectionPlane.pos);this._setDir(sectionPlane.dir);this._sectionPlane=sectionPlane;sectionPlane.control=this;this._onSectionPlanePos=sectionPlane.on("pos",function(){_this142._setPos(_this142._sectionPlane.pos);});this._onSectionPlaneDir=sectionPlane.on("dir",function(){if(!_this142._ignoreNextSectionPlaneDirUpdate){_this142._setDir(_this142._sectionPlane.dir);}else{_this142._ignoreNextSectionPlaneDirUpdate=false;}});}}/**
26259
+ */},{key:"_setSectionPlane",value:function _setSectionPlane(sectionPlane){var _this143=this;if(this._sectionPlane){this._sectionPlane.off(this._onSectionPlanePos);this._sectionPlane.off(this._onSectionPlaneDir);this._onSectionPlanePos=null;this._onSectionPlaneDir=null;this._sectionPlane=null;}if(sectionPlane){this.id=sectionPlane.controlId;this.dir=sectionPlane.dir;this._createNodes();this._bindEvents();this._setPos(sectionPlane.pos);this._setDir(sectionPlane.dir);this._sectionPlane=sectionPlane;sectionPlane.control=this;this._onSectionPlanePos=sectionPlane.on("pos",function(){_this143._setPos(_this143._sectionPlane.pos);});this._onSectionPlaneDir=sectionPlane.on("dir",function(){if(!_this143._ignoreNextSectionPlaneDirUpdate){_this143._setDir(_this143._sectionPlane.dir);}else{_this143._ignoreNextSectionPlaneDirUpdate=false;}});}}/**
26013
26260
  * Gets the {@link SectionPlane} controlled by this Control.
26014
26261
  * @returns {SectionPlane} The SectionPlane.
26015
26262
  */},{key:"sectionPlane",get:function get(){return this._sectionPlane;}/**
@@ -26037,7 +26284,7 @@ posRate=Math.max(0,Math.min(100,posRate));return parseInt(posRate);}/** @private
26037
26284
  * Sets if this Control is culled. This is called by SectionPlanesPlugin to
26038
26285
  * temporarily hide the Control while a snapshot is being taken by Viewer#getSnapshot().
26039
26286
  * @param culled
26040
- */},{key:"setCulled",value:function setCulled(culled){var id;for(id in this._displayMeshes){if(this._displayMeshes.hasOwnProperty(id)){this._displayMeshes[id].culled=culled;}}if(!culled){for(id in this._affordanceMeshes){if(this._affordanceMeshes.hasOwnProperty(id)){this._affordanceMeshes[id].culled=culled;}}}}},{key:"_bindEvents",value:function _bindEvents(){var _this143=this;var self=this;var grabbed=false;var DRAG_ACTIONS={none:-1,xTranslate:0,yTranslate:1,zTranslate:2,xRotate:3,yRotate:4,zRotate:5};this._rootNode;var nextDragAction=null;// As we hover grabbed an arrow or hoop, self is the action we would do if we then dragged it.
26287
+ */},{key:"setCulled",value:function setCulled(culled){var id;for(id in this._displayMeshes){if(this._displayMeshes.hasOwnProperty(id)){this._displayMeshes[id].culled=culled;}}if(!culled){for(id in this._affordanceMeshes){if(this._affordanceMeshes.hasOwnProperty(id)){this._affordanceMeshes[id].culled=culled;}}}}},{key:"_bindEvents",value:function _bindEvents(){var _this144=this;var self=this;var grabbed=false;var DRAG_ACTIONS={none:-1,xTranslate:0,yTranslate:1,zTranslate:2,xRotate:3,yRotate:4,zRotate:5};this._rootNode;var nextDragAction=null;// As we hover grabbed an arrow or hoop, self is the action we would do if we then dragged it.
26041
26288
  var dragAction=null;// Action we're doing while we drag an arrow or hoop.
26042
26289
  var lastCanvasPos=math.vec2();this.lastCanvasPos=lastCanvasPos;var xBaseAxis=math.vec3([1,0,0]);var yBaseAxis=math.vec3([0,1,0]);var zBaseAxis=math.vec3([0,0,1]);var canvas=this._viewer.scene.canvas.canvas;var camera=this._viewer.camera;var scene=this._viewer.scene;{this._onCameraViewMatrix=scene.camera.on("viewMatrix",function(){});this._onCameraProjMatrix=scene.camera.on("projMatrix",function(){});// const tempVec3a = math.vec3([0, 0, 0]);
26043
26290
  // let lastDist = -1;
@@ -26064,14 +26311,14 @@ var dragTranslateSectionPlane=function(){var p1=math.vec3();var p2=math.vec3();v
26064
26311
  math.inverseMat4(matrix);math.transformVec4(matrix,dir,dir);math.mulVec4Scalar(dir,1.0/dir[3]);// This is now point A on the ray in world space
26065
26312
  var rayO=camera.eye;// The direction
26066
26313
  math.subVec4(dir,rayO,dir);var origin=self._sectionPlane.pos;// Plane origin:
26067
- var d=-math.dotVec3(origin,axis)-offset;var dot=math.dotVec3(axis,dir);if(Math.abs(dot)>0.005){var t=-(math.dotVec3(axis,rayO)+d)/dot;math.mulVec3Scalar(dir,t,dest);math.addVec3(dest,rayO);math.subVec3(dest,origin,dest);return true;}return false;};}();{var down=false;var lastAffordanceMesh;this._onCameraControlHover=this._viewer.cameraControl.on("hoverEnter",function(hit){if(!_this143._visible){return;}if(down){return;}grabbed=false;if(lastAffordanceMesh){lastAffordanceMesh.visible=false;}var affordanceMesh;var meshId=hit.entity.id;switch(meshId){case _this143._displayMeshes.plane.id:affordanceMesh=_this143._affordanceMeshes.plane;nextDragAction=DRAG_ACTIONS.zTranslate;break;default:nextDragAction=DRAG_ACTIONS.none;return;// Not clicked an arrow or hoop
26068
- }if(affordanceMesh){affordanceMesh.visible=true;}lastAffordanceMesh=affordanceMesh;grabbed=true;});this._onCameraControlHoverLeave=this._viewer.cameraControl.on("hoverOut",function(hit){if(!_this143._visible){return;}if(lastAffordanceMesh){lastAffordanceMesh.visible=false;}nextDragAction=DRAG_ACTIONS.none;grabbed=false;});//mousedown
26069
- canvas.addEventListener("mousedown",this._canvasMouseDownListener=function(e){e.preventDefault();if(!_this143._visible||!grabbed)return;_this143._viewer.cameraControl.pointerEnabled=false;switch(e.which){case 1:// Left button
26314
+ var d=-math.dotVec3(origin,axis)-offset;var dot=math.dotVec3(axis,dir);if(Math.abs(dot)>0.005){var t=-(math.dotVec3(axis,rayO)+d)/dot;math.mulVec3Scalar(dir,t,dest);math.addVec3(dest,rayO);math.subVec3(dest,origin,dest);return true;}return false;};}();{var down=false;var lastAffordanceMesh;this._onCameraControlHover=this._viewer.cameraControl.on("hoverEnter",function(hit){if(!_this144._visible){return;}if(down){return;}grabbed=false;if(lastAffordanceMesh){lastAffordanceMesh.visible=false;}var affordanceMesh;var meshId=hit.entity.id;switch(meshId){case _this144._displayMeshes.plane.id:affordanceMesh=_this144._affordanceMeshes.plane;nextDragAction=DRAG_ACTIONS.zTranslate;break;default:nextDragAction=DRAG_ACTIONS.none;return;// Not clicked an arrow or hoop
26315
+ }if(affordanceMesh){affordanceMesh.visible=true;}lastAffordanceMesh=affordanceMesh;grabbed=true;});this._onCameraControlHoverLeave=this._viewer.cameraControl.on("hoverOut",function(hit){if(!_this144._visible){return;}if(lastAffordanceMesh){lastAffordanceMesh.visible=false;}nextDragAction=DRAG_ACTIONS.none;grabbed=false;});//mousedown
26316
+ canvas.addEventListener("mousedown",this._canvasMouseDownListener=function(e){e.preventDefault();if(!_this144._visible||!grabbed)return;_this144._viewer.cameraControl.pointerEnabled=false;switch(e.which){case 1:// Left button
26070
26317
  down=true;var canvasPos=getClickCoordsWithinElement(e);//获取鼠标点击对应坐标
26071
- dragAction=nextDragAction;lastCanvasPos[0]=canvasPos[0];lastCanvasPos[1]=canvasPos[1];_this143.plugin.fire("clickPlaneStart");break;}});//mousemove
26072
- canvas.addEventListener("mousemove",this._canvasMouseMoveListener=function(e){if(!_this143._visible){return;}if(!down){return;}var canvasPos=getClickCoordsWithinElement(e);var x=canvasPos[0];var y=canvasPos[1];switch(dragAction){case DRAG_ACTIONS.xTranslate:dragTranslateSectionPlane(xBaseAxis,lastCanvasPos,canvasPos);break;case DRAG_ACTIONS.yTranslate:dragTranslateSectionPlane(yBaseAxis,lastCanvasPos,canvasPos);break;case DRAG_ACTIONS.zTranslate:dragTranslateSectionPlane(zBaseAxis,lastCanvasPos,canvasPos);break;}lastCanvasPos[0]=x;lastCanvasPos[1]=y;});//mouseup
26073
- canvas.addEventListener("mouseup",this._canvasMouseUpListener=function(e){if(!_this143._visible)return;_this143._viewer.cameraControl.pointerEnabled=true;if(!down){return;}down=false;grabbed=false;_this143.plugin.fire("clickPlaneEnd");});//wheel
26074
- canvas.addEventListener("wheel",this._canvasWheelListener=function(e){if(!_this143._visible){return;}var delta=Math.max(-1,Math.min(1,-e.deltaY*40));if(delta===0){return;}});}}},{key:"_destroy",value:function _destroy(){this._unbindEvents();this._destroyNodes();}},{key:"_unbindEvents",value:function _unbindEvents(){var viewer=this._viewer;var scene=viewer.scene;var canvas=scene.canvas.canvas;var camera=viewer.camera;var cameraControl=viewer.cameraControl;scene.off(this._onSceneTick);canvas.removeEventListener("mousedown",this._canvasMouseDownListener);canvas.removeEventListener("mousemove",this._canvasMouseMoveListener);canvas.removeEventListener("mouseup",this._canvasMouseUpListener);canvas.removeEventListener("wheel",this._canvasWheelListener);canvas.removeEventListener("touchend",this._canvasTouchEndListener);canvas.removeEventListener("touchcancel",this._canvasTouchEndListener);camera.off(this._onCameraViewMatrix);camera.off(this._onCameraProjMatrix);cameraControl.off(this._onCameraControlHover);cameraControl.off(this._onCameraControlHoverLeave);}},{key:"_destroyNodes",value:function _destroyNodes(){this._setSectionPlane(null);this._rootNode.destroy();this._displayMeshes={};this._affordanceMeshes={};}}]);}();var zeroVec=new Float64Array([0,0,1]);var quat=new Float64Array(4);/**
26318
+ dragAction=nextDragAction;lastCanvasPos[0]=canvasPos[0];lastCanvasPos[1]=canvasPos[1];_this144.plugin.fire("clickPlaneStart");break;}});//mousemove
26319
+ canvas.addEventListener("mousemove",this._canvasMouseMoveListener=function(e){if(!_this144._visible){return;}if(!down){return;}var canvasPos=getClickCoordsWithinElement(e);var x=canvasPos[0];var y=canvasPos[1];switch(dragAction){case DRAG_ACTIONS.xTranslate:dragTranslateSectionPlane(xBaseAxis,lastCanvasPos,canvasPos);break;case DRAG_ACTIONS.yTranslate:dragTranslateSectionPlane(yBaseAxis,lastCanvasPos,canvasPos);break;case DRAG_ACTIONS.zTranslate:dragTranslateSectionPlane(zBaseAxis,lastCanvasPos,canvasPos);break;}lastCanvasPos[0]=x;lastCanvasPos[1]=y;});//mouseup
26320
+ canvas.addEventListener("mouseup",this._canvasMouseUpListener=function(e){if(!_this144._visible)return;_this144._viewer.cameraControl.pointerEnabled=true;if(!down){return;}down=false;grabbed=false;_this144.plugin.fire("clickPlaneEnd");});//wheel
26321
+ canvas.addEventListener("wheel",this._canvasWheelListener=function(e){if(!_this144._visible){return;}var delta=Math.max(-1,Math.min(1,-e.deltaY*40));if(delta===0){return;}});}}},{key:"_destroy",value:function _destroy(){this._unbindEvents();this._destroyNodes();}},{key:"_unbindEvents",value:function _unbindEvents(){var viewer=this._viewer;var scene=viewer.scene;var canvas=scene.canvas.canvas;var camera=viewer.camera;var cameraControl=viewer.cameraControl;scene.off(this._onSceneTick);canvas.removeEventListener("mousedown",this._canvasMouseDownListener);canvas.removeEventListener("mousemove",this._canvasMouseMoveListener);canvas.removeEventListener("mouseup",this._canvasMouseUpListener);canvas.removeEventListener("wheel",this._canvasWheelListener);canvas.removeEventListener("touchend",this._canvasTouchEndListener);canvas.removeEventListener("touchcancel",this._canvasTouchEndListener);camera.off(this._onCameraViewMatrix);camera.off(this._onCameraProjMatrix);cameraControl.off(this._onCameraControlHover);cameraControl.off(this._onCameraControlHoverLeave);}},{key:"_destroyNodes",value:function _destroyNodes(){this._setSectionPlane(null);this._rootNode.destroy();this._displayMeshes={};this._affordanceMeshes={};}}]);}();var zeroVec=new Float64Array([0,0,1]);var quat=new Float64Array(4);/**
26075
26322
  * Controls a {@link SectionPlane} with mouse and touch input.
26076
26323
  *
26077
26324
  * @private
@@ -26154,7 +26401,7 @@ width/2,-height/2,0.02,// 右下角
26154
26401
  * SectionPlanesPlugin keeps SectionPlaneControls in a reuse pool.
26155
26402
  * Call with a null or undefined value to disconnect the Control ffrom whatever SectionPlane it was assigned to.
26156
26403
  * @private
26157
- */},{key:"_setSectionPlane",value:function _setSectionPlane(sectionPlane){var _this144=this;if(this._sectionPlane){this._sectionPlane.off(this._onSectionPlanePos);this._sectionPlane.off(this._onSectionPlaneDir);this._onSectionPlanePos=null;this._onSectionPlaneDir=null;this._sectionPlane=null;}if(sectionPlane){this.id=sectionPlane.id;this._setPos(sectionPlane.pos);this._setDir(sectionPlane.dir);this._sectionPlane=sectionPlane;sectionPlane.control=this;this._onSectionPlanePos=sectionPlane.on("pos",function(){_this144._setPos(_this144._sectionPlane.pos);});this._onSectionPlaneDir=sectionPlane.on("dir",function(){if(!_this144._ignoreNextSectionPlaneDirUpdate){_this144._setDir(_this144._sectionPlane.dir);}else{_this144._ignoreNextSectionPlaneDirUpdate=false;}});}}/**
26404
+ */},{key:"_setSectionPlane",value:function _setSectionPlane(sectionPlane){var _this145=this;if(this._sectionPlane){this._sectionPlane.off(this._onSectionPlanePos);this._sectionPlane.off(this._onSectionPlaneDir);this._onSectionPlanePos=null;this._onSectionPlaneDir=null;this._sectionPlane=null;}if(sectionPlane){this.id=sectionPlane.id;this._setPos(sectionPlane.pos);this._setDir(sectionPlane.dir);this._sectionPlane=sectionPlane;sectionPlane.control=this;this._onSectionPlanePos=sectionPlane.on("pos",function(){_this145._setPos(_this145._sectionPlane.pos);});this._onSectionPlaneDir=sectionPlane.on("dir",function(){if(!_this145._ignoreNextSectionPlaneDirUpdate){_this145._setDir(_this145._sectionPlane.dir);}else{_this145._ignoreNextSectionPlaneDirUpdate=false;}});}}/**
26158
26405
  * Gets the {@link SectionPlane} controlled by this Control.
26159
26406
  * @returns {SectionPlane} The SectionPlane.
26160
26407
  */},{key:"sectionPlane",get:function get(){return this._sectionPlane;}/**
@@ -26182,10 +26429,10 @@ posRate=Math.max(0,Math.min(100,posRate));return parseInt(posRate);}/** @private
26182
26429
  * Sets if this Control is culled. This is called by SectionPlanesPlugin to
26183
26430
  * temporarily hide the Control while a snapshot is being taken by Viewer#getSnapshot().
26184
26431
  * @param culled
26185
- */},{key:"setCulled",value:function setCulled(culled){var id;for(id in this._displayMeshes){if(this._displayMeshes.hasOwnProperty(id)){this._displayMeshes[id].culled=culled;}}if(!culled){for(id in this._affordanceMeshes){if(this._affordanceMeshes.hasOwnProperty(id)){this._affordanceMeshes[id].culled=culled;}}}}},{key:"_bindEvents",value:function _bindEvents(){var _this145=this;var self=this;var grabbed=false;var DRAG_ACTIONS={none:-1,xTranslate:0,yTranslate:1,zTranslate:2,xRotate:3,yRotate:4,zRotate:5};this._rootNode;var nextDragAction=null;// As we hover grabbed an arrow or hoop, self is the action we would do if we then dragged it.
26432
+ */},{key:"setCulled",value:function setCulled(culled){var id;for(id in this._displayMeshes){if(this._displayMeshes.hasOwnProperty(id)){this._displayMeshes[id].culled=culled;}}if(!culled){for(id in this._affordanceMeshes){if(this._affordanceMeshes.hasOwnProperty(id)){this._affordanceMeshes[id].culled=culled;}}}}},{key:"_bindEvents",value:function _bindEvents(){var _this146=this;var self=this;var grabbed=false;var DRAG_ACTIONS={none:-1,xTranslate:0,yTranslate:1,zTranslate:2,xRotate:3,yRotate:4,zRotate:5};this._rootNode;var nextDragAction=null;// As we hover grabbed an arrow or hoop, self is the action we would do if we then dragged it.
26186
26433
  var dragAction=null;// Action we're doing while we drag an arrow or hoop.
26187
26434
  var lastCanvasPos=math.vec2();this.lastCanvasPos=lastCanvasPos;var xBaseAxis=math.vec3([1,0,0]);var yBaseAxis=math.vec3([0,1,0]);var zBaseAxis=math.vec3([0,0,1]);var canvas=this._viewer.scene.canvas.canvas;var camera=this._viewer.camera;var scene=this._viewer.scene;{// Keep gizmo screen size constant
26188
- var _tempVec3a3=math.vec3([0,0,0]);var lastDist=-1;this._onCameraViewMatrix=scene.camera.on("viewMatrix",function(){});this._onCameraProjMatrix=scene.camera.on("projMatrix",function(){});this._onSceneTick=scene.on("tick",function(){var dist=Math.abs(math.lenVec3(math.subVec3(scene.camera.eye,_this145._pos,_tempVec3a3)));if(dist!==lastDist){if(camera.projection==="perspective"){Math.tan(camera.perspective.fov*math.DEGTORAD)*dist;// const size = this._controlSize * worldSize;
26435
+ var _tempVec3a3=math.vec3([0,0,0]);var lastDist=-1;this._onCameraViewMatrix=scene.camera.on("viewMatrix",function(){});this._onCameraProjMatrix=scene.camera.on("projMatrix",function(){});this._onSceneTick=scene.on("tick",function(){var dist=Math.abs(math.lenVec3(math.subVec3(scene.camera.eye,_this146._pos,_tempVec3a3)));if(dist!==lastDist){if(camera.projection==="perspective"){Math.tan(camera.perspective.fov*math.DEGTORAD)*dist;// const size = this._controlSize * worldSize;
26189
26436
  // rootNode.scale = [size, size, size];
26190
26437
  lastDist=dist;}}if(camera.projection==="ortho"){camera.ortho.scale/10;// const size = worldSize;
26191
26438
  // rootNode.scale = [size, size, size];
@@ -26198,23 +26445,23 @@ math.inverseMat4(matrix);math.transformVec4(matrix,dir,dir);math.mulVec4Scalar(d
26198
26445
  var rayO=camera.eye;// The direction
26199
26446
  math.subVec4(dir,rayO,dir);var origin=self._sectionPlane.pos;// Plane origin:
26200
26447
  var d=-math.dotVec3(origin,axis)-offset;var dot=math.dotVec3(axis,dir);if(Math.abs(dot)>0.005){var t=-(math.dotVec3(axis,rayO)+d)/dot;math.mulVec3Scalar(dir,t,dest);math.addVec3(dest,rayO);math.subVec3(dest,origin,dest);return true;}return false;};}();{var down=false;// var lastAffordanceMesh;
26201
- this._onCameraControlHover=this._viewer.cameraControl.on("hoverEnter",function(hit){if(!_this145._visible){return;}if(down){return;}grabbed=false;var meshId=hit.entity.id;switch(meshId){case _this145._displayMeshes.plane.id:// affordanceMesh = this._affordanceMeshes.plane;
26448
+ this._onCameraControlHover=this._viewer.cameraControl.on("hoverEnter",function(hit){if(!_this146._visible){return;}if(down){return;}grabbed=false;var meshId=hit.entity.id;switch(meshId){case _this146._displayMeshes.plane.id:// affordanceMesh = this._affordanceMeshes.plane;
26202
26449
  nextDragAction=DRAG_ACTIONS.zTranslate;break;default:nextDragAction=DRAG_ACTIONS.none;return;// Not clicked an arrow or hoop
26203
- }grabbed=true;});this._onCameraControlHoverLeave=this._viewer.cameraControl.on("hoverOut",function(hit){if(!_this145._visible){return;}nextDragAction=DRAG_ACTIONS.none;grabbed=false;});//mousedown
26204
- canvas.addEventListener("mousedown",this._canvasMouseDownListener=function(e){e.preventDefault();if(!_this145._visible||!grabbed)return;_this145._viewer.cameraControl.pointerEnabled=false;switch(e.which){case 1:// Left button
26450
+ }grabbed=true;});this._onCameraControlHoverLeave=this._viewer.cameraControl.on("hoverOut",function(hit){if(!_this146._visible){return;}nextDragAction=DRAG_ACTIONS.none;grabbed=false;});//mousedown
26451
+ canvas.addEventListener("mousedown",this._canvasMouseDownListener=function(e){e.preventDefault();if(!_this146._visible||!grabbed)return;_this146._viewer.cameraControl.pointerEnabled=false;switch(e.which){case 1:// Left button
26205
26452
  down=true;var canvasPos=getClickCoordsWithinElement(e);//获取鼠标点击对应坐标
26206
- dragAction=nextDragAction;lastCanvasPos[0]=canvasPos[0];lastCanvasPos[1]=canvasPos[1];_this145.plugin.fire("clickPlaneStart");break;}});//mousemove
26207
- canvas.addEventListener("mousemove",this._canvasMouseMoveListener=function(e){if(!_this145._visible){return;}if(!down){return;}var canvasPos=getClickCoordsWithinElement(e);var x=canvasPos[0];var y=canvasPos[1];switch(dragAction){case DRAG_ACTIONS.xTranslate:dragTranslateSectionPlane(xBaseAxis,lastCanvasPos,canvasPos);break;case DRAG_ACTIONS.yTranslate:dragTranslateSectionPlane(yBaseAxis,lastCanvasPos,canvasPos);break;case DRAG_ACTIONS.zTranslate:dragTranslateSectionPlane(zBaseAxis,lastCanvasPos,canvasPos);break;}lastCanvasPos[0]=x;lastCanvasPos[1]=y;});//mouseup
26208
- canvas.addEventListener("mouseup",this._canvasMouseUpListener=function(e){if(!_this145._visible)return;_this145._viewer.cameraControl.pointerEnabled=true;if(!down){return;}switch(e.which){}down=false;grabbed=false;_this145.plugin.fire("clickPlaneEnd");});//wheel
26209
- canvas.addEventListener("wheel",this._canvasWheelListener=function(e){if(!_this145._visible){return;}var delta=Math.max(-1,Math.min(1,-e.deltaY*40));if(delta===0){return;}});this._onCameraControlHover=this._viewer.cameraControl.on("touchEntity",function(hit){if(!_this145._visible||down||grabbed)return;var affordanceMesh;var meshId=hit.entity.id;switch(meshId){case _this145._displayMeshes.plane.id:affordanceMesh=_this145._affordanceMeshes.plane;nextDragAction=DRAG_ACTIONS.zTranslate;break;default:nextDragAction=DRAG_ACTIONS.none;return;// Not clicked an arrow or hoop
26453
+ dragAction=nextDragAction;lastCanvasPos[0]=canvasPos[0];lastCanvasPos[1]=canvasPos[1];_this146.plugin.fire("clickPlaneStart");break;}});//mousemove
26454
+ canvas.addEventListener("mousemove",this._canvasMouseMoveListener=function(e){if(!_this146._visible){return;}if(!down){return;}var canvasPos=getClickCoordsWithinElement(e);var x=canvasPos[0];var y=canvasPos[1];switch(dragAction){case DRAG_ACTIONS.xTranslate:dragTranslateSectionPlane(xBaseAxis,lastCanvasPos,canvasPos);break;case DRAG_ACTIONS.yTranslate:dragTranslateSectionPlane(yBaseAxis,lastCanvasPos,canvasPos);break;case DRAG_ACTIONS.zTranslate:dragTranslateSectionPlane(zBaseAxis,lastCanvasPos,canvasPos);break;}lastCanvasPos[0]=x;lastCanvasPos[1]=y;});//mouseup
26455
+ canvas.addEventListener("mouseup",this._canvasMouseUpListener=function(e){if(!_this146._visible)return;_this146._viewer.cameraControl.pointerEnabled=true;if(!down){return;}switch(e.which){}down=false;grabbed=false;_this146.plugin.fire("clickPlaneEnd");});//wheel
26456
+ canvas.addEventListener("wheel",this._canvasWheelListener=function(e){if(!_this146._visible){return;}var delta=Math.max(-1,Math.min(1,-e.deltaY*40));if(delta===0){return;}});this._onCameraControlHover=this._viewer.cameraControl.on("touchEntity",function(hit){if(!_this146._visible||down||grabbed)return;var affordanceMesh;var meshId=hit.entity.id;switch(meshId){case _this146._displayMeshes.plane.id:affordanceMesh=_this146._affordanceMeshes.plane;nextDragAction=DRAG_ACTIONS.zTranslate;break;default:nextDragAction=DRAG_ACTIONS.none;return;// Not clicked an arrow or hoop
26210
26457
  }if(affordanceMesh){affordanceMesh.visible=true;}grabbed=true;down=true;});//touchstart
26211
- canvas.addEventListener("touchstart",this._canvasMouseDownListener=function(e){e.preventDefault();if(!_this145._visible||!grabbed||!down)return;_this145._viewer.cameraControl.pointerEnabled=false;var canvasPos=getTouchCoordsWithinElement(e);dragAction=nextDragAction;lastCanvasPos[0]=canvasPos[0];lastCanvasPos[1]=canvasPos[1];_this145.plugin.fire("touchPlaneStart");});//touchmove
26212
- canvas.addEventListener("touchmove",this._canvasMouseMoveListener=function(e){if(!_this145._visible||!down||!grabbed)return;var canvasPos=getTouchCoordsWithinElement(e);var x=canvasPos[0];var y=canvasPos[1];switch(dragAction){case DRAG_ACTIONS.xTranslate:dragTranslateSectionPlane(xBaseAxis,lastCanvasPos,canvasPos);break;case DRAG_ACTIONS.yTranslate:dragTranslateSectionPlane(yBaseAxis,lastCanvasPos,canvasPos);break;case DRAG_ACTIONS.zTranslate:dragTranslateSectionPlane(zBaseAxis,lastCanvasPos,canvasPos);break;}lastCanvasPos[0]=x;lastCanvasPos[1]=y;});//touchend
26213
- canvas.addEventListener("touchend",this._canvasTouchEndListener=function(e){if(!_this145._visible)return;if(grabbed)_this145._viewer.cameraControl.pointerEnabled=true;nextDragAction=DRAG_ACTIONS.none;down=false;grabbed=false;_this145.plugin.fire("touchPlaneEnd");});canvas.addEventListener("touchcancel",this._canvasTouchEndListener);}}},{key:"_destroy",value:function _destroy(){this._unbindEvents();this._destroyNodes();}},{key:"_unbindEvents",value:function _unbindEvents(){var viewer=this._viewer;var scene=viewer.scene;var canvas=scene.canvas.canvas;var camera=viewer.camera;var cameraControl=viewer.cameraControl;scene.off(this._onSceneTick);canvas.removeEventListener("mousedown",this._canvasMouseDownListener);canvas.removeEventListener("mousemove",this._canvasMouseMoveListener);canvas.removeEventListener("mouseup",this._canvasMouseUpListener);canvas.removeEventListener("wheel",this._canvasWheelListener);canvas.removeEventListener("touchend",this._canvasTouchEndListener);canvas.removeEventListener("touchcancel",this._canvasTouchEndListener);camera.off(this._onCameraViewMatrix);camera.off(this._onCameraProjMatrix);cameraControl.off(this._onCameraControlHover);cameraControl.off(this._onCameraControlHoverLeave);}},{key:"_destroyNodes",value:function _destroyNodes(){this._setSectionPlane(null);this._rootNode.destroy();this._displayMeshes={};this._affordanceMeshes={};}}]);}();/**
26458
+ canvas.addEventListener("touchstart",this._canvasMouseDownListener=function(e){e.preventDefault();if(!_this146._visible||!grabbed||!down)return;_this146._viewer.cameraControl.pointerEnabled=false;var canvasPos=getTouchCoordsWithinElement(e);dragAction=nextDragAction;lastCanvasPos[0]=canvasPos[0];lastCanvasPos[1]=canvasPos[1];_this146.plugin.fire("touchPlaneStart");});//touchmove
26459
+ canvas.addEventListener("touchmove",this._canvasMouseMoveListener=function(e){if(!_this146._visible||!down||!grabbed)return;var canvasPos=getTouchCoordsWithinElement(e);var x=canvasPos[0];var y=canvasPos[1];switch(dragAction){case DRAG_ACTIONS.xTranslate:dragTranslateSectionPlane(xBaseAxis,lastCanvasPos,canvasPos);break;case DRAG_ACTIONS.yTranslate:dragTranslateSectionPlane(yBaseAxis,lastCanvasPos,canvasPos);break;case DRAG_ACTIONS.zTranslate:dragTranslateSectionPlane(zBaseAxis,lastCanvasPos,canvasPos);break;}lastCanvasPos[0]=x;lastCanvasPos[1]=y;});//touchend
26460
+ canvas.addEventListener("touchend",this._canvasTouchEndListener=function(e){if(!_this146._visible)return;if(grabbed)_this146._viewer.cameraControl.pointerEnabled=true;nextDragAction=DRAG_ACTIONS.none;down=false;grabbed=false;_this146.plugin.fire("touchPlaneEnd");});canvas.addEventListener("touchcancel",this._canvasTouchEndListener);}}},{key:"_destroy",value:function _destroy(){this._unbindEvents();this._destroyNodes();}},{key:"_unbindEvents",value:function _unbindEvents(){var viewer=this._viewer;var scene=viewer.scene;var canvas=scene.canvas.canvas;var camera=viewer.camera;var cameraControl=viewer.cameraControl;scene.off(this._onSceneTick);canvas.removeEventListener("mousedown",this._canvasMouseDownListener);canvas.removeEventListener("mousemove",this._canvasMouseMoveListener);canvas.removeEventListener("mouseup",this._canvasMouseUpListener);canvas.removeEventListener("wheel",this._canvasWheelListener);canvas.removeEventListener("touchend",this._canvasTouchEndListener);canvas.removeEventListener("touchcancel",this._canvasTouchEndListener);camera.off(this._onCameraViewMatrix);camera.off(this._onCameraProjMatrix);cameraControl.off(this._onCameraControlHover);cameraControl.off(this._onCameraControlHoverLeave);}},{key:"_destroyNodes",value:function _destroyNodes(){this._setSectionPlane(null);this._rootNode.destroy();this._displayMeshes={};this._affordanceMeshes={};}}]);}();/**
26214
26461
  * Renders a 3D plane within an {@link Overview} to indicate its {@link SectionPlane}'s current position and orientation.
26215
26462
  *
26216
26463
  * @private
26217
- */var Plane=/*#__PURE__*/function(){/** @private */function Plane(overview,overviewScene,sectionPlane){var _this146=this;_classCallCheck(this,Plane);/**
26464
+ */var Plane=/*#__PURE__*/function(){/** @private */function Plane(overview,overviewScene,sectionPlane){var _this147=this;_classCallCheck(this,Plane);/**
26218
26465
  * The ID of this SectionPlanesOverviewPlane.
26219
26466
  *
26220
26467
  * @type {String}
@@ -26222,7 +26469,7 @@ canvas.addEventListener("touchend",this._canvasTouchEndListener=function(e){if(!
26222
26469
  * The {@link SectionPlane} represented by this SectionPlanesOverviewPlane.
26223
26470
  *
26224
26471
  * @type {SectionPlane}
26225
- */this._sectionPlane=sectionPlane;this._mesh=new Mesh(overviewScene,{id:sectionPlane.id,geometry:new ReadableGeometry(overviewScene,buildBoxGeometry({xSize:.5,ySize:.5,zSize:.001})),material:new PhongMaterial(overviewScene,{emissive:[1,1,1],diffuse:[0,0,0],backfaces:false}),edgeMaterial:new EdgeMaterial(overviewScene,{edgeColor:[0.0,0.0,0.0],edgeAlpha:1.0,edgeWidth:1}),highlightMaterial:new EmphasisMaterial(overviewScene,{fill:true,fillColor:[0.5,1,0.5],fillAlpha:0.7,edges:true,edgeColor:[0.0,0.0,0.0],edgeAlpha:1.0,edgeWidth:1}),selectedMaterial:new EmphasisMaterial(overviewScene,{fill:true,fillColor:[0,0,1],fillAlpha:0.7,edges:true,edgeColor:[1.0,0.0,0.0],edgeAlpha:1.0,edgeWidth:1}),highlighted:true,scale:[3,3,3],position:[0,0,0],rotation:[0,0,0],opacity:0.3,edges:true});{var vec=math.vec3([0,0,0]);var pos2=math.vec3();var _zeroVec=math.vec3([0,0,1]);var _quat=math.vec4(4);var pos3=math.vec3();var update=function update(){var origin=_this146._sectionPlane.scene.center;var negDir=[-_this146._sectionPlane.dir[0],-_this146._sectionPlane.dir[1],-_this146._sectionPlane.dir[2]];math.subVec3(origin,_this146._sectionPlane.pos,vec);var dist=-math.dotVec3(negDir,vec);math.normalizeVec3(negDir);math.mulVec3Scalar(negDir,dist,pos2);var quaternion=math.vec3PairToQuaternion(_zeroVec,_this146._sectionPlane.dir,_quat);pos3[0]=pos2[0]*0.1;pos3[1]=pos2[1]*0.1;pos3[2]=pos2[2]*0.1;_this146._mesh.quaternion=quaternion;_this146._mesh.position=pos3;};this._onSectionPlanePos=this._sectionPlane.on("pos",update);this._onSectionPlaneDir=this._sectionPlane.on("dir",update);// update();
26472
+ */this._sectionPlane=sectionPlane;this._mesh=new Mesh(overviewScene,{id:sectionPlane.id,geometry:new ReadableGeometry(overviewScene,buildBoxGeometry({xSize:.5,ySize:.5,zSize:.001})),material:new PhongMaterial(overviewScene,{emissive:[1,1,1],diffuse:[0,0,0],backfaces:false}),edgeMaterial:new EdgeMaterial(overviewScene,{edgeColor:[0.0,0.0,0.0],edgeAlpha:1.0,edgeWidth:1}),highlightMaterial:new EmphasisMaterial(overviewScene,{fill:true,fillColor:[0.5,1,0.5],fillAlpha:0.7,edges:true,edgeColor:[0.0,0.0,0.0],edgeAlpha:1.0,edgeWidth:1}),selectedMaterial:new EmphasisMaterial(overviewScene,{fill:true,fillColor:[0,0,1],fillAlpha:0.7,edges:true,edgeColor:[1.0,0.0,0.0],edgeAlpha:1.0,edgeWidth:1}),highlighted:true,scale:[3,3,3],position:[0,0,0],rotation:[0,0,0],opacity:0.3,edges:true});{var vec=math.vec3([0,0,0]);var pos2=math.vec3();var _zeroVec=math.vec3([0,0,1]);var _quat=math.vec4(4);var pos3=math.vec3();var update=function update(){var origin=_this147._sectionPlane.scene.center;var negDir=[-_this147._sectionPlane.dir[0],-_this147._sectionPlane.dir[1],-_this147._sectionPlane.dir[2]];math.subVec3(origin,_this147._sectionPlane.pos,vec);var dist=-math.dotVec3(negDir,vec);math.normalizeVec3(negDir);math.mulVec3Scalar(negDir,dist,pos2);var quaternion=math.vec3PairToQuaternion(_zeroVec,_this147._sectionPlane.dir,_quat);pos3[0]=pos2[0]*0.1;pos3[1]=pos2[1]*0.1;pos3[2]=pos2[2]*0.1;_this147._mesh.quaternion=quaternion;_this147._mesh.position=pos3;};this._onSectionPlanePos=this._sectionPlane.on("pos",update);this._onSectionPlaneDir=this._sectionPlane.on("dir",update);// update();
26226
26473
  }this._highlighted=false;this._selected=false;}/**
26227
26474
  * Sets if this SectionPlanesOverviewPlane is highlighted.
26228
26475
  *
@@ -26248,7 +26495,7 @@ canvas.addEventListener("touchend",this._canvasTouchEndListener=function(e){if(!
26248
26495
  * Renders a 3D plane within an {@link Overview} to indicate its {@link SectionPlane}'s current position and orientation.
26249
26496
  *
26250
26497
  * @private
26251
- */var Box=/*#__PURE__*/function(){/** @private */function Box(overview,overviewScene,sectionBox){var _this147=this;_classCallCheck(this,Box);/**
26498
+ */var Box=/*#__PURE__*/function(){/** @private */function Box(overview,overviewScene,sectionBox){var _this148=this;_classCallCheck(this,Box);/**
26252
26499
  * The ID of this SectionPlanesOverviewPlane.
26253
26500
  *
26254
26501
  * @type {String}
@@ -26256,7 +26503,7 @@ canvas.addEventListener("touchend",this._canvasTouchEndListener=function(e){if(!
26256
26503
  * The {@link SectionPlane} represented by this SectionPlanesOverviewPlane.
26257
26504
  *
26258
26505
  * @type {SectionPlane}
26259
- */this._sectionBox=sectionBox;this._mesh=new Mesh(overviewScene,{id:sectionPlane.id,geometry:new ReadableGeometry(overviewScene,buildBoxGeometry({xSize:0.5,ySize:0.5,zSize:0.001})),material:new PhongMaterial(overviewScene,{emissive:[1,1,1],diffuse:[0,0,0],backfaces:false}),edgeMaterial:new EdgeMaterial(overviewScene,{edgeColor:[0.0,0.0,0.0],edgeAlpha:1.0,edgeWidth:1}),highlightMaterial:new EmphasisMaterial(overviewScene,{fill:true,fillColor:[0.5,1,0.5],fillAlpha:0.7,edges:true,edgeColor:[0.0,0.0,0.0],edgeAlpha:1.0,edgeWidth:1}),selectedMaterial:new EmphasisMaterial(overviewScene,{fill:true,fillColor:[0,0,1],fillAlpha:0.7,edges:true,edgeColor:[1.0,0.0,0.0],edgeAlpha:1.0,edgeWidth:1}),highlighted:true,scale:[3,3,3],position:[0,0,0],rotation:[0,0,0],opacity:0.3,edges:true});{var vec=math.vec3([0,0,0]);var pos2=math.vec3();var _zeroVec2=math.vec3([0,0,1]);var _quat2=math.vec4(4);var pos3=math.vec3();var update=function update(){var origin=_this147._sectionBox.scene.center;var negDir=[-_this147._sectionBox.dir[0],-_this147._sectionBox.dir[1],-_this147._sectionBox.dir[2]];math.subVec3(origin,_this147._sectionBox.pos,vec);var dist=-math.dotVec3(negDir,vec);math.normalizeVec3(negDir);math.mulVec3Scalar(negDir,dist,pos2);var quaternion=math.vec3PairToQuaternion(_zeroVec2,_this147._sectionBox.dir,_quat2);pos3[0]=pos2[0]*0.1;pos3[1]=pos2[1]*0.1;pos3[2]=pos2[2]*0.1;_this147._mesh.quaternion=quaternion;_this147._mesh.position=pos3;};this._onSectionPlanePos=this._sectionBox.on("pos",update);this._onSectionPlaneDir=this._sectionBox.on("dir",update);// update();
26506
+ */this._sectionBox=sectionBox;this._mesh=new Mesh(overviewScene,{id:sectionPlane.id,geometry:new ReadableGeometry(overviewScene,buildBoxGeometry({xSize:0.5,ySize:0.5,zSize:0.001})),material:new PhongMaterial(overviewScene,{emissive:[1,1,1],diffuse:[0,0,0],backfaces:false}),edgeMaterial:new EdgeMaterial(overviewScene,{edgeColor:[0.0,0.0,0.0],edgeAlpha:1.0,edgeWidth:1}),highlightMaterial:new EmphasisMaterial(overviewScene,{fill:true,fillColor:[0.5,1,0.5],fillAlpha:0.7,edges:true,edgeColor:[0.0,0.0,0.0],edgeAlpha:1.0,edgeWidth:1}),selectedMaterial:new EmphasisMaterial(overviewScene,{fill:true,fillColor:[0,0,1],fillAlpha:0.7,edges:true,edgeColor:[1.0,0.0,0.0],edgeAlpha:1.0,edgeWidth:1}),highlighted:true,scale:[3,3,3],position:[0,0,0],rotation:[0,0,0],opacity:0.3,edges:true});{var vec=math.vec3([0,0,0]);var pos2=math.vec3();var _zeroVec2=math.vec3([0,0,1]);var _quat2=math.vec4(4);var pos3=math.vec3();var update=function update(){var origin=_this148._sectionBox.scene.center;var negDir=[-_this148._sectionBox.dir[0],-_this148._sectionBox.dir[1],-_this148._sectionBox.dir[2]];math.subVec3(origin,_this148._sectionBox.pos,vec);var dist=-math.dotVec3(negDir,vec);math.normalizeVec3(negDir);math.mulVec3Scalar(negDir,dist,pos2);var quaternion=math.vec3PairToQuaternion(_zeroVec2,_this148._sectionBox.dir,_quat2);pos3[0]=pos2[0]*0.1;pos3[1]=pos2[1]*0.1;pos3[2]=pos2[2]*0.1;_this148._mesh.quaternion=quaternion;_this148._mesh.position=pos3;};this._onSectionPlanePos=this._sectionBox.on("pos",update);this._onSectionPlaneDir=this._sectionBox.on("dir",update);// update();
26260
26507
  }this._highlighted=false;this._selected=false;}/**
26261
26508
  * Sets if this SectionPlanesOverviewPlane is highlighted.
26262
26509
  *
@@ -26289,7 +26536,7 @@ canvas.addEventListener("touchend",this._canvasTouchEndListener=function(e){if(!
26289
26536
  * @private
26290
26537
  */var Overview=/*#__PURE__*/function(){/**
26291
26538
  * @private
26292
- */function Overview(plugin,cfg){var _this148=this;_classCallCheck(this,Overview);if(!cfg.onHoverEnterPlane||!cfg.onHoverLeavePlane||!cfg.onClickedNothing||!cfg.onClickedPlane){throw"Missing config(s): onHoverEnterPlane, onHoverLeavePlane, onClickedNothing || onClickedPlane";}/**
26539
+ */function Overview(plugin,cfg){var _this149=this;_classCallCheck(this,Overview);if(!cfg.onHoverEnterPlane||!cfg.onHoverLeavePlane||!cfg.onClickedNothing||!cfg.onClickedPlane){throw"Missing config(s): onHoverEnterPlane, onHoverLeavePlane, onClickedNothing || onClickedPlane";}/**
26293
26540
  * The {@link SectionPlanesPlugin} that owns this SectionPlanesOverview.
26294
26541
  *
26295
26542
  * @type {SectionPlanesPlugin}
@@ -26302,12 +26549,12 @@ this._canvas=cfg.overviewCanvas;//----------------------------------------------
26302
26549
  this._scene=new Scene(this._viewer,{canvasId:this._canvas.id,transparent:true,spinnerElementId:"overviewer_spinner"});this._scene.clearLights();new DirLight(this._scene,{dir:[0.4,-0.4,0.8],color:[0.8,1.0,1.0],intensity:1.0,space:"view"});new DirLight(this._scene,{dir:[-0.8,-0.3,-0.4],color:[0.8,0.8,0.8],intensity:1.0,space:"view"});new DirLight(this._scene,{dir:[0.8,-0.6,-0.8],color:[1.0,1.0,1.0],intensity:1.0,space:"view"});this._scene.camera;this._scene.camera.perspective.fov=70;this._zUp=false;//--------------------------------------------------------------------------------------------------------------
26303
26550
  // Synchronize overview scene camera with viewer camera
26304
26551
  //--------------------------------------------------------------------------------------------------------------
26305
- {var camera=this._scene.camera;var _matrix3=math.rotationMat4c(-90*math.DEGTORAD,1,0,0);var _eyeLookVec3=math.vec3();var eyeLookVecOverview=math.vec3();var upOverview=math.vec3();this._synchCamera=function(){var eye=_this148._viewer.camera.eye;var look=_this148._viewer.camera.look;var up=_this148._viewer.camera.up;math.mulVec3Scalar(math.normalizeVec3(math.subVec3(eye,look,_eyeLookVec3)),7);if(_this148._zUp){// +Z up
26552
+ {var camera=this._scene.camera;var _matrix3=math.rotationMat4c(-90*math.DEGTORAD,1,0,0);var _eyeLookVec3=math.vec3();var eyeLookVecOverview=math.vec3();var upOverview=math.vec3();this._synchCamera=function(){var eye=_this149._viewer.camera.eye;var look=_this149._viewer.camera.look;var up=_this149._viewer.camera.up;math.mulVec3Scalar(math.normalizeVec3(math.subVec3(eye,look,_eyeLookVec3)),7);if(_this149._zUp){// +Z up
26306
26553
  math.transformVec3(_matrix3,_eyeLookVec3,eyeLookVecOverview);math.transformVec3(_matrix3,up,upOverview);camera.look=[0,0,0];camera.eye=math.transformVec3(_matrix3,_eyeLookVec3,eyeLookVecOverview);camera.up=math.transformPoint3(_matrix3,up,upOverview);}else{// +Y up
26307
- camera.look=[0,0,0];camera.eye=_eyeLookVec3;camera.up=up;}};}this._onViewerCameraMatrix=this._viewer.camera.on("matrix",this._synchCamera);this._onViewerCameraWorldAxis=this._viewer.camera.on("worldAxis",this._synchCamera);this._onViewerCameraFOV=this._viewer.camera.perspective.on("fov",function(fov){_this148._scene.camera.perspective.fov=fov;});//--------------------------------------------------------------------------------------------------------------
26554
+ camera.look=[0,0,0];camera.eye=_eyeLookVec3;camera.up=up;}};}this._onViewerCameraMatrix=this._viewer.camera.on("matrix",this._synchCamera);this._onViewerCameraWorldAxis=this._viewer.camera.on("worldAxis",this._synchCamera);this._onViewerCameraFOV=this._viewer.camera.perspective.on("fov",function(fov){_this149._scene.camera.perspective.fov=fov;});//--------------------------------------------------------------------------------------------------------------
26308
26555
  // Bind overview canvas events
26309
26556
  //--------------------------------------------------------------------------------------------------------------
26310
- {var hoveredEntity=null;this._onInputMouseMove=this._scene.input.on("mousemove",function(coords){var hit=_this148._scene.pick({canvasPos:coords});if(hit){if(!hoveredEntity||hit.entity.id!==hoveredEntity.id){if(hoveredEntity){var _plane=_this148._planes[hoveredEntity.id];if(_plane){_this148._onHoverLeavePlane(hoveredEntity.id);}}hoveredEntity=hit.entity;var plane=_this148._planes[hoveredEntity.id];if(plane){_this148._onHoverEnterPlane(hoveredEntity.id);}}}else{if(hoveredEntity){_this148._onHoverLeavePlane(hoveredEntity.id);hoveredEntity=null;}}});this._scene.canvas.canvas.addEventListener("mouseup",this._onCanvasMouseUp=function(){if(hoveredEntity){var plane=_this148._planes[hoveredEntity.id];if(plane){_this148._onClickedPlane(hoveredEntity.id);}}else{_this148._onClickedNothing();}});this._scene.canvas.canvas.addEventListener("mouseout",this._onCanvasMouseOut=function(){if(hoveredEntity){_this148._onHoverLeavePlane(hoveredEntity.id);hoveredEntity=null;}});}//--------------------------------------------------------------------------------------------------------------
26557
+ {var hoveredEntity=null;this._onInputMouseMove=this._scene.input.on("mousemove",function(coords){var hit=_this149._scene.pick({canvasPos:coords});if(hit){if(!hoveredEntity||hit.entity.id!==hoveredEntity.id){if(hoveredEntity){var _plane=_this149._planes[hoveredEntity.id];if(_plane){_this149._onHoverLeavePlane(hoveredEntity.id);}}hoveredEntity=hit.entity;var plane=_this149._planes[hoveredEntity.id];if(plane){_this149._onHoverEnterPlane(hoveredEntity.id);}}}else{if(hoveredEntity){_this149._onHoverLeavePlane(hoveredEntity.id);hoveredEntity=null;}}});this._scene.canvas.canvas.addEventListener("mouseup",this._onCanvasMouseUp=function(){if(hoveredEntity){var plane=_this149._planes[hoveredEntity.id];if(plane){_this149._onClickedPlane(hoveredEntity.id);}}else{_this149._onClickedNothing();}});this._scene.canvas.canvas.addEventListener("mouseout",this._onCanvasMouseOut=function(){if(hoveredEntity){_this149._onHoverLeavePlane(hoveredEntity.id);hoveredEntity=null;}});}//--------------------------------------------------------------------------------------------------------------
26311
26558
  // Configure overview
26312
26559
  //--------------------------------------------------------------------------------------------------------------
26313
26560
  this.setVisible(cfg.overviewVisible);}/** Called by SectionPlanesPlugin#createSectionPlane()
@@ -26419,21 +26666,21 @@ var newgeo=buildBoxLinesGeometry({center:center,xSize:(a>0?a:-1*a)*num+0.2,ySize
26419
26666
  * mySectionPlane2.pos = [11.0, 6.0, -12];
26420
26667
  * mySectionPlane2.dir = [0.4, 0.0, 0.5];
26421
26668
  * ````
26422
- */var SectionPlanesPlugin=/*#__PURE__*/function(_Plugin8){/**
26669
+ */var SectionPlanesPlugin=/*#__PURE__*/function(_Plugin9){/**
26423
26670
  * @constructor
26424
26671
  * @param {Viewer} viewer The Viewer.
26425
26672
  * @param {Object} cfg Plugin configuration.
26426
26673
  * @param {String} [cfg.id="SectionPlanes"] Optional ID for this plugin, so that we can find it within {@link Viewer#plugins}.
26427
26674
  * @param {String} [cfg.overviewCanvasId] ID of a canvas element to display the overview.
26428
26675
  * @param {String} [cfg.overviewVisible=true] Initial visibility of the overview canvas.
26429
- */function SectionPlanesPlugin(viewer){var _this149;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,SectionPlanesPlugin);_this149=_callSuper(this,SectionPlanesPlugin,["SectionPlanes",viewer]);_this149._freeControls=[];_this149._controlBox=null;_this149._singleCtrlBox=null;_this149._sectionWay=null;_this149._sectionPlanes=viewer.scene.sectionPlanes;_this149._controls={};_this149._currentControl=null;_this149._shownControlId=null;_this149._shownControlIds=[];_this149._boxPlaneConfig={id:"",planeId:-1,enableClip:false,controlFillColor:[3,9,9]};if(cfg.overviewCanvasId!==null&&cfg.overviewCanvasId!==undefined){var overviewCanvas=document.getElementById(cfg.overviewCanvasId);if(!overviewCanvas){_this149.warn("Can't find overview canvas: '"+cfg.overviewCanvasId+"' - will create plugin without overview");}else{_this149._overview=new Overview(_this149,{overviewCanvas:overviewCanvas,visible:cfg.overviewVisible,onHoverEnterPlane:function onHoverEnterPlane(id){_this149._overview.setPlaneHighlighted(id,true);},onHoverLeavePlane:function onHoverLeavePlane(id){_this149._overview.setPlaneHighlighted(id,false);},onClickedPlane:function onClickedPlane(id){if(_this149.getShownControl()===id){_this149.hideControl();return;}_this149.showControl(id);var sectionPlane=_this149.sectionPlanes[id];var sectionPlanePos=sectionPlane.pos;tempAABB.set(_this149.viewer.scene.aabb);math.getAABB3Center(tempAABB,tempVec3);tempAABB[0]+=sectionPlanePos[0]-tempVec3[0];tempAABB[1]+=sectionPlanePos[1]-tempVec3[1];tempAABB[2]+=sectionPlanePos[2]-tempVec3[2];tempAABB[3]+=sectionPlanePos[0]-tempVec3[0];tempAABB[4]+=sectionPlanePos[1]-tempVec3[1];tempAABB[5]+=sectionPlanePos[2]-tempVec3[2];_this149.viewer.cameraFlight.flyTo({aabb:tempAABB,fitFOV:65});},onClickedNothing:function onClickedNothing(){_this149.hideControl();}});}}_this149._onSceneSectionPlaneCreated=viewer.scene.on("sectionPlaneCreated",function(sectionPlane){// SectionPlane created, either via SectionPlanesPlugin#createSectionPlane(), or by directly
26676
+ */function SectionPlanesPlugin(viewer){var _this150;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,SectionPlanesPlugin);_this150=_callSuper(this,SectionPlanesPlugin,["SectionPlanes",viewer]);_this150._freeControls=[];_this150._controlBox=null;_this150._singleCtrlBox=null;_this150._sectionWay=null;_this150._sectionPlanes=viewer.scene.sectionPlanes;_this150._controls={};_this150._currentControl=null;_this150._shownControlId=null;_this150._shownControlIds=[];_this150._boxPlaneConfig={id:"",planeId:-1,enableClip:false,controlFillColor:[3,9,9]};if(cfg.overviewCanvasId!==null&&cfg.overviewCanvasId!==undefined){var overviewCanvas=document.getElementById(cfg.overviewCanvasId);if(!overviewCanvas){_this150.warn("Can't find overview canvas: '"+cfg.overviewCanvasId+"' - will create plugin without overview");}else{_this150._overview=new Overview(_this150,{overviewCanvas:overviewCanvas,visible:cfg.overviewVisible,onHoverEnterPlane:function onHoverEnterPlane(id){_this150._overview.setPlaneHighlighted(id,true);},onHoverLeavePlane:function onHoverLeavePlane(id){_this150._overview.setPlaneHighlighted(id,false);},onClickedPlane:function onClickedPlane(id){if(_this150.getShownControl()===id){_this150.hideControl();return;}_this150.showControl(id);var sectionPlane=_this150.sectionPlanes[id];var sectionPlanePos=sectionPlane.pos;tempAABB.set(_this150.viewer.scene.aabb);math.getAABB3Center(tempAABB,tempVec3);tempAABB[0]+=sectionPlanePos[0]-tempVec3[0];tempAABB[1]+=sectionPlanePos[1]-tempVec3[1];tempAABB[2]+=sectionPlanePos[2]-tempVec3[2];tempAABB[3]+=sectionPlanePos[0]-tempVec3[0];tempAABB[4]+=sectionPlanePos[1]-tempVec3[1];tempAABB[5]+=sectionPlanePos[2]-tempVec3[2];_this150.viewer.cameraFlight.flyTo({aabb:tempAABB,fitFOV:65});},onClickedNothing:function onClickedNothing(){_this150.hideControl();}});}}_this150._onSceneSectionPlaneCreated=viewer.scene.on("sectionPlaneCreated",function(sectionPlane){// SectionPlane created, either via SectionPlanesPlugin#createSectionPlane(), or by directly
26430
26677
  // instantiating a SectionPlane independently of SectionPlanesPlugin, which can be done
26431
26678
  // by BCFViewpointsPlugin#loadViewpoint().
26432
- _this149._sectionPlaneCreated(sectionPlane);});_this149._onSceneSectionBoxCreated=viewer.scene.on("sectionBoxCreated",function(sectionBox){_this149._controlBox=sectionBox;});_this149.controlset=cfg.controlset;return _this149;}/**
26679
+ _this150._sectionPlaneCreated(sectionPlane);});_this150._onSceneSectionBoxCreated=viewer.scene.on("sectionBoxCreated",function(sectionBox){_this150._controlBox=sectionBox;});_this150.controlset=cfg.controlset;return _this150;}/**
26433
26680
  * Sets if the overview canvas is visible.
26434
26681
  *
26435
26682
  * @param {Boolean} visible Whether or not the overview canvas is visible.
26436
- */_inherits(SectionPlanesPlugin,_Plugin8);return _createClass(SectionPlanesPlugin,[{key:"setOverviewVisible",value:function setOverviewVisible(visible){if(this._overview){this._overview.setVisible(visible);}}/**
26683
+ */_inherits(SectionPlanesPlugin,_Plugin9);return _createClass(SectionPlanesPlugin,[{key:"setOverviewVisible",value:function setOverviewVisible(visible){if(this._overview){this._overview.setVisible(visible);}}/**
26437
26684
  * Gets if the overview canvas is visible.
26438
26685
  *
26439
26686
  * @return {Boolean} True when the overview canvas is visible.
@@ -26455,7 +26702,7 @@ _this149._sectionPlaneCreated(sectionPlane);});_this149._onSceneSectionBoxCreate
26455
26702
  */},{key:"createSectionPlane",value:function createSectionPlane(){var params=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};if(params.id!==undefined&&params.id!==null&&this.viewer.scene.components[params.id]){this.error("Viewer component with this ID already exists: "+params.id);delete params.id;}// Note that SectionPlane constructor fires "sectionPlaneCreated" on the Scene,
26456
26703
  // which SectionPlanesPlugin handles and calls #_sectionPlaneCreated to create gizmo and add to overview canvas.
26457
26704
  var sectionPlane=new SectionPlane(this.viewer.scene,{id:params.id,pos:params.pos,dir:params.dir,active:true});return sectionPlane;}},{key:"createSectionBox",value:function createSectionBox(){var params=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};this._sectionWay="box";var lineBox=new LineBox(this);var sectionBox=new SectionBox(this.viewer.scene,{id:"sectionBox",active:true,controlIdName:"sectionBoxPlane_",lineBox:lineBox});return sectionBox;}},{key:"createSectionSingle",value:function createSectionSingle(){var params=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};this._sectionWay="box";var sectionBox=new SectionBox(this.viewer.scene,{id:"sectionBox",active:true,pickable:false,enableClip:false,controlIdName:"sectionBoxPlane_"});return sectionBox;}//剖切面创建后,创建一个控制器
26458
- },{key:"_sectionPlaneCreated",value:function _sectionPlaneCreated(sectionPlane){var _this150=this;var newControl;switch(this._sectionWay){case"plane":newControl=this._freeControls.length>0?this._freeControls.pop():new ClippingPlane(this,this._controlsConfig);break;case"box":this._boxPlaneConfig.enableClip=sectionPlane.enableClip;this._boxPlaneConfig.pickable=sectionPlane.pickable;this._boxPlaneConfig.controlFillColor=sectionPlane.controlFillColor;newControl=this._freeControls.length>0?this._freeControls.pop():new ClippingBoxPlane(this,this._boxPlaneConfig);break;case"singleCtrl":newControl=this._freeControls.length>0?this._freeControls.pop():new ClippingSinglePlane(this,this.controlset);break;default:newControl=new Control(this);break;}var control=newControl;control._setSectionPlane(sectionPlane);control.setVisible(true);sectionPlane.control=control;this._currentControl=control;if(sectionPlane.box==null){this._controls[sectionPlane.id]=control;}if(this._overview){this._overview.addSectionPlane(sectionPlane);}sectionPlane.once("destroyed",function(){_this150._sectionPlaneDestroyed(sectionPlane);});}/**
26705
+ },{key:"_sectionPlaneCreated",value:function _sectionPlaneCreated(sectionPlane){var _this151=this;var newControl;switch(this._sectionWay){case"plane":newControl=this._freeControls.length>0?this._freeControls.pop():new ClippingPlane(this,this._controlsConfig);break;case"box":this._boxPlaneConfig.enableClip=sectionPlane.enableClip;this._boxPlaneConfig.pickable=sectionPlane.pickable;this._boxPlaneConfig.controlFillColor=sectionPlane.controlFillColor;newControl=this._freeControls.length>0?this._freeControls.pop():new ClippingBoxPlane(this,this._boxPlaneConfig);break;case"singleCtrl":newControl=this._freeControls.length>0?this._freeControls.pop():new ClippingSinglePlane(this,this.controlset);break;default:newControl=new Control(this);break;}var control=newControl;control._setSectionPlane(sectionPlane);control.setVisible(true);sectionPlane.control=control;this._currentControl=control;if(sectionPlane.box==null){this._controls[sectionPlane.id]=control;}if(this._overview){this._overview.addSectionPlane(sectionPlane);}sectionPlane.once("destroyed",function(){_this151._sectionPlaneDestroyed(sectionPlane);});}/**
26459
26706
  * 设置是否是触屏模式
26460
26707
  * @param {boolean} touch
26461
26708
  */},{key:"isTouch",set:function set(touch){this._isTouch=touch;if(touch===true)this.sectionWay="plane";else this.sectionWay=this._sectionWay?this._sectionWay:"control";}/**
@@ -26833,14 +27080,14 @@ for(var _id4 in this._controls){if(this._controls.hasOwnProperty(_id4)){this._co
26833
27080
  * pickResult.entity.highlighted = true;
26834
27081
  * }
26835
27082
  * ````
26836
- */var StoreyViewsPlugin=/*#__PURE__*/function(_Plugin9){/**
27083
+ */var StoreyViewsPlugin=/*#__PURE__*/function(_Plugin10){/**
26837
27084
  * @constructor
26838
27085
  *
26839
27086
  * @param {Viewer} viewer The Viewer.
26840
27087
  * @param {Object} cfg Plugin configuration.
26841
27088
  * @param {String} [cfg.id="StoreyViews"] Optional ID for this plugin, so that we can find it within {@link Viewer#plugins}.
26842
27089
  * @param {Boolean} [cfg.fitStoreyMaps=false] If enabled, the elements of each floor map image will be proportionally resized to encompass the entire image. This leads to varying scales among different floor map images. If disabled, each floor map image will display the model's extents, ensuring a consistent scale across all images.
26843
- */function StoreyViewsPlugin(viewer){var _this151;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,StoreyViewsPlugin);_this151=_callSuper(this,StoreyViewsPlugin,["StoreyViews",viewer]);_this151._objectsMemento=new ObjectsMemento();_this151._cameraMemento=new CameraMemento();/**
27090
+ */function StoreyViewsPlugin(viewer){var _this152;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,StoreyViewsPlugin);_this152=_callSuper(this,StoreyViewsPlugin,["StoreyViews",viewer]);_this152._objectsMemento=new ObjectsMemento();_this152._cameraMemento=new CameraMemento();/**
26844
27091
  * A {@link Storey} for each ````IfcBuildingStorey```.
26845
27092
  *
26846
27093
  * There will be a {@link Storey} for every existing {@link MetaObject} whose {@link MetaObject#type} equals "IfcBuildingStorey".
@@ -26848,13 +27095,13 @@ for(var _id4 in this._controls){if(this._controls.hasOwnProperty(_id4)){this._co
26848
27095
  * These are created and destroyed automatically as models are loaded and destroyed.
26849
27096
  *
26850
27097
  * @type {{String:Storey}}
26851
- */_this151.storeys={};/**
27098
+ */_this152.storeys={};/**
26852
27099
  * A set of {@link Storey}s for each {@link MetaModel}.
26853
27100
  *
26854
27101
  * These are created and destroyed automatically as models are loaded and destroyed.
26855
27102
  *
26856
27103
  * @type {{String: {String:Storey}}}
26857
- */_this151.modelStoreys={};_this151._fitStoreyMaps=!!cfg.fitStoreyMaps;_this151._onModelLoaded=_this151.viewer.scene.on("modelLoaded",function(modelId){_this151._registerModelStoreys(modelId);_this151.fire("storeys",_this151.storeys);});return _this151;}_inherits(StoreyViewsPlugin,_Plugin9);return _createClass(StoreyViewsPlugin,[{key:"_registerModelStoreys",value:function _registerModelStoreys(modelId){var _this152=this;var viewer=this.viewer;var scene=viewer.scene;var metaScene=viewer.metaScene;var metaModel=metaScene.metaModels[modelId];var model=scene.models[modelId];if(!metaModel||!metaModel.rootMetaObjects){return;}var rootMetaObjects=metaModel.rootMetaObjects;for(var j=0,lenj=rootMetaObjects.length;j<lenj;j++){var storeyIds=rootMetaObjects[j].getObjectIDsInSubtreeByType(["IfcBuildingStorey"]);for(var _i565=0,len=storeyIds.length;_i565<len;_i565++){var storeyId=storeyIds[_i565];var metaObject=metaScene.metaObjects[storeyId];var childObjectIds=metaObject.getObjectIDsInSubtree();var storeyAABB=scene.getAABB(childObjectIds);var numObjects=Math.random()>0.5?childObjectIds.length:0;var storey=new Storey(this,model.aabb,storeyAABB,modelId,storeyId,numObjects);storey._onModelDestroyed=model.once("destroyed",function(){_this152._deregisterModelStoreys(modelId);_this152.fire("storeys",_this152.storeys);});this.storeys[storeyId]=storey;if(!this.modelStoreys[modelId]){this.modelStoreys[modelId]={};}this.modelStoreys[modelId][storeyId]=storey;}}}},{key:"_deregisterModelStoreys",value:function _deregisterModelStoreys(modelId){var storeys=this.modelStoreys[modelId];if(storeys){var scene=this.viewer.scene;for(var storyObjectId in storeys){if(storeys.hasOwnProperty(storyObjectId)){var storey=storeys[storyObjectId];var model=scene.models[storey.modelId];if(model){model.off(storey._onModelDestroyed);}delete this.storeys[storyObjectId];}}delete this.modelStoreys[modelId];}}/**
27104
+ */_this152.modelStoreys={};_this152._fitStoreyMaps=!!cfg.fitStoreyMaps;_this152._onModelLoaded=_this152.viewer.scene.on("modelLoaded",function(modelId){_this152._registerModelStoreys(modelId);_this152.fire("storeys",_this152.storeys);});return _this152;}_inherits(StoreyViewsPlugin,_Plugin10);return _createClass(StoreyViewsPlugin,[{key:"_registerModelStoreys",value:function _registerModelStoreys(modelId){var _this153=this;var viewer=this.viewer;var scene=viewer.scene;var metaScene=viewer.metaScene;var metaModel=metaScene.metaModels[modelId];var model=scene.models[modelId];if(!metaModel||!metaModel.rootMetaObjects){return;}var rootMetaObjects=metaModel.rootMetaObjects;for(var j=0,lenj=rootMetaObjects.length;j<lenj;j++){var storeyIds=rootMetaObjects[j].getObjectIDsInSubtreeByType(["IfcBuildingStorey"]);for(var _i565=0,len=storeyIds.length;_i565<len;_i565++){var storeyId=storeyIds[_i565];var metaObject=metaScene.metaObjects[storeyId];var childObjectIds=metaObject.getObjectIDsInSubtree();var storeyAABB=scene.getAABB(childObjectIds);var numObjects=Math.random()>0.5?childObjectIds.length:0;var storey=new Storey(this,model.aabb,storeyAABB,modelId,storeyId,numObjects);storey._onModelDestroyed=model.once("destroyed",function(){_this153._deregisterModelStoreys(modelId);_this153.fire("storeys",_this153.storeys);});this.storeys[storeyId]=storey;if(!this.modelStoreys[modelId]){this.modelStoreys[modelId]={};}this.modelStoreys[modelId][storeyId]=storey;}}}},{key:"_deregisterModelStoreys",value:function _deregisterModelStoreys(modelId){var storeys=this.modelStoreys[modelId];if(storeys){var scene=this.viewer.scene;for(var storyObjectId in storeys){if(storeys.hasOwnProperty(storyObjectId)){var storey=storeys[storyObjectId];var model=scene.models[storey.modelId];if(model){model.off(storey._onModelDestroyed);}delete this.storeys[storyObjectId];}}delete this.modelStoreys[modelId];}}/**
26858
27105
  * When true, the elements of each floor map image will be proportionally resized to encompass the entire image. This leads to varying scales among different
26859
27106
  * floor map images. If false, each floor map image will display the model's extents, ensuring a consistent scale across all images.
26860
27107
  * @returns {*|boolean}
@@ -26995,9 +27242,9 @@ imagePos[0]=Math.floor(storeyMap.width-(worldPos[0]-xmin)*ratioX);imagePos[1]=Ma
26995
27242
  * });
26996
27243
  *
26997
27244
  * @class SkyboxesPlugin
26998
- */var SkyboxesPlugin=/*#__PURE__*/function(_Plugin10){function SkyboxesPlugin(viewer){var _this153;_classCallCheck(this,SkyboxesPlugin);_this153=_callSuper(this,SkyboxesPlugin,["skyboxes",viewer]);_this153.skyboxes={};_this153._active=false;return _this153;}/**
27245
+ */var SkyboxesPlugin=/*#__PURE__*/function(_Plugin11){function SkyboxesPlugin(viewer){var _this154;_classCallCheck(this,SkyboxesPlugin);_this154=_callSuper(this,SkyboxesPlugin,["skyboxes",viewer]);_this154.skyboxes={};_this154._active=false;return _this154;}/**
26999
27246
  * @private
27000
- */_inherits(SkyboxesPlugin,_Plugin10);return _createClass(SkyboxesPlugin,[{key:"send",value:function send(name,value){switch(name){case"clear":this.clear();break;}}/**
27247
+ */_inherits(SkyboxesPlugin,_Plugin11);return _createClass(SkyboxesPlugin,[{key:"send",value:function send(name,value){switch(name){case"clear":this.clear();break;}}/**
27001
27248
  Creates a skybox.
27002
27249
 
27003
27250
  @param {String} id Unique ID to assign to the skybox.
@@ -27355,7 +27602,7 @@ imagePos[0]=Math.floor(storeyMap.width-(worldPos[0]-xmin)*ratioX);imagePos[1]=Ma
27355
27602
  * ````
27356
27603
  *
27357
27604
  * @class TreeViewPlugin
27358
- */var TreeViewPlugin=/*#__PURE__*/function(_Plugin11){/**
27605
+ */var TreeViewPlugin=/*#__PURE__*/function(_Plugin12){/**
27359
27606
  * @constructor
27360
27607
  *
27361
27608
  * @param {Viewer} viewer The Viewer.
@@ -27370,13 +27617,13 @@ imagePos[0]=Math.floor(storeyMap.width-(worldPos[0]-xmin)*ratioX);imagePos[1]=Ma
27370
27617
  * vertical World axis. For all hierarchy types, other node types will be ordered in the ascending alphanumeric order of their titles.
27371
27618
  * @param {Boolean} [cfg.pruneEmptyNodes=true] When true, will not contain nodes that don't have content in the {@link Scene}. These are nodes whose {@link MetaObject}s don't have {@link Entity}s.
27372
27619
  * @param {RenderService} [cfg.renderService] Optional {@link RenderService} to use. Defaults to the {@link TreeViewPlugin}'s default {@link RenderService}.
27373
- */function TreeViewPlugin(viewer){var _this154;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,TreeViewPlugin);_this154=_callSuper(this,TreeViewPlugin,["TreeViewPlugin",viewer]);/**
27620
+ */function TreeViewPlugin(viewer){var _this155;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,TreeViewPlugin);_this155=_callSuper(this,TreeViewPlugin,["TreeViewPlugin",viewer]);/**
27374
27621
  * Contains messages for any errors found while last rebuilding this TreeView.
27375
27622
  * @type {String[]}
27376
- */_this154.errors=[];/**
27623
+ */_this155.errors=[];/**
27377
27624
  * True if errors were found generating this TreeView.
27378
27625
  * @type {boolean}
27379
- */_this154.valid=true;// const containerElement =
27626
+ */_this155.valid=true;// const containerElement =
27380
27627
  // cfg.containerElement || document.getElementById(cfg.containerElementId);
27381
27628
  // if (!(containerElement instanceof HTMLElement)) {
27382
27629
  // this.error(
@@ -27384,23 +27631,23 @@ imagePos[0]=Math.floor(storeyMap.width-(worldPos[0]-xmin)*ratioX);imagePos[1]=Ma
27384
27631
  // );
27385
27632
  // return;
27386
27633
  // }
27387
- for(var _i567=0;;_i567++){if(!treeViews[_i567]){treeViews[_i567]=_this154;_this154._index=_i567;_this154._id="tree-".concat(_i567);break;}}// this._containerElement = containerElement;
27388
- _this154._metaModels={};_this154._autoAddModels=cfg.autoAddModels!==false;_this154._autoExpandDepth=cfg.autoExpandDepth||0;_this154._sortNodes=cfg.sortNodes!==false;_this154._viewer=viewer;_this154._rootElement=null;_this154._muteSceneEvents=false;_this154._muteTreeEvents=false;_this154._rootNodes=[];_this154._objectNodes={};// Object ID -> Node
27389
- _this154._nodeNodes={};// Node ID -> Node
27390
- _this154._rootNames={};// Node ID -> Root name
27391
- _this154._sortNodes=cfg.sortNodes;_this154._pruneEmptyNodes=cfg.pruneEmptyNodes;_this154._showListItemElementId=null;// this._renderService = cfg.renderService || new RenderService();
27634
+ for(var _i567=0;;_i567++){if(!treeViews[_i567]){treeViews[_i567]=_this155;_this155._index=_i567;_this155._id="tree-".concat(_i567);break;}}// this._containerElement = containerElement;
27635
+ _this155._metaModels={};_this155._autoAddModels=cfg.autoAddModels!==false;_this155._autoExpandDepth=cfg.autoExpandDepth||0;_this155._sortNodes=cfg.sortNodes!==false;_this155._viewer=viewer;_this155._rootElement=null;_this155._muteSceneEvents=false;_this155._muteTreeEvents=false;_this155._rootNodes=[];_this155._objectNodes={};// Object ID -> Node
27636
+ _this155._nodeNodes={};// Node ID -> Node
27637
+ _this155._rootNames={};// Node ID -> Root name
27638
+ _this155._sortNodes=cfg.sortNodes;_this155._pruneEmptyNodes=cfg.pruneEmptyNodes;_this155._showListItemElementId=null;// this._renderService = cfg.renderService || new RenderService();
27392
27639
  // if (!this._renderService) {
27393
27640
  // throw new Error('TreeViewPlugin: no render service set');
27394
27641
  // }
27395
27642
  // this._containerElement.oncontextmenu = (e) => {
27396
27643
  // e.preventDefault();
27397
27644
  // };
27398
- _this154._onObjectVisibility=_this154._viewer.scene.on("objectVisibility",function(entity){if(_this154._muteSceneEvents){return;}var objectId=entity.id;var node=_this154._objectNodes[objectId];if(!node){return;// Not in this tree
27399
- }var visible=entity.visible;var updated=visible!==node.checked;if(!updated){return;}_this154._muteTreeEvents=true;node.checked=visible;if(visible){node.numVisibleEntities++;}else{node.numVisibleEntities--;}// this._renderService.setCheckbox(node.nodeId, visible);
27645
+ _this155._onObjectVisibility=_this155._viewer.scene.on("objectVisibility",function(entity){if(_this155._muteSceneEvents){return;}var objectId=entity.id;var node=_this155._objectNodes[objectId];if(!node){return;// Not in this tree
27646
+ }var visible=entity.visible;var updated=visible!==node.checked;if(!updated){return;}_this155._muteTreeEvents=true;node.checked=visible;if(visible){node.numVisibleEntities++;}else{node.numVisibleEntities--;}// this._renderService.setCheckbox(node.nodeId, visible);
27400
27647
  var parent=node.parent;while(parent){parent.checked=visible;if(visible){parent.numVisibleEntities++;}else{parent.numVisibleEntities--;}// this._renderService.setCheckbox(parent.nodeId, (parent.numVisibleEntities > 0));
27401
- parent=parent.parent;}_this154._muteTreeEvents=false;});_this154._onObjectXrayed=_this154._viewer.scene.on("objectXRayed",function(entity){if(_this154._muteSceneEvents){return;}var objectId=entity.id;var node=_this154._objectNodes[objectId];if(!node){return;// Not in this tree
27402
- }_this154._muteTreeEvents=true;var xrayed=entity.xrayed;var updated=xrayed!==node.xrayed;if(!updated){return;}node.xrayed=xrayed;// this._renderService.setXRayed(node.nodeId, xrayed);
27403
- _this154._muteTreeEvents=false;});// this._switchExpandHandler = (event) => {
27648
+ parent=parent.parent;}_this155._muteTreeEvents=false;});_this155._onObjectXrayed=_this155._viewer.scene.on("objectXRayed",function(entity){if(_this155._muteSceneEvents){return;}var objectId=entity.id;var node=_this155._objectNodes[objectId];if(!node){return;// Not in this tree
27649
+ }_this155._muteTreeEvents=true;var xrayed=entity.xrayed;var updated=xrayed!==node.xrayed;if(!updated){return;}node.xrayed=xrayed;// this._renderService.setXRayed(node.nodeId, xrayed);
27650
+ _this155._muteTreeEvents=false;});// this._switchExpandHandler = (event) => {
27404
27651
  // this.switchExpandHandler(event)
27405
27652
  // };
27406
27653
  // this._switchCollapseHandler = (event) => {
@@ -27409,8 +27656,8 @@ _this154._muteTreeEvents=false;});// this._switchExpandHandler = (event) => {
27409
27656
  // this._checkboxChangeHandler = (event) => {
27410
27657
  // this.checkboxChangeHandler(event)
27411
27658
  // };
27412
- _this154._hierarchy=cfg.hierarchy||"containment";_this154._autoExpandDepth=cfg.autoExpandDepth||0;if(_this154._autoAddModels){var modelIds=Object.keys(_this154.viewer.metaScene.metaModels);for(var _i568=0,len=modelIds.length;_i568<len;_i568++){var modelId=modelIds[_i568];var metaModel=_this154.viewer.metaScene.metaModels[modelId];if(metaModel.finalized){_this154.addModel(modelId);}}_this154.viewer.scene.on("modelLoaded",function(modelId){if(_this154.viewer.metaScene.metaModels[modelId]){_this154.addModel(modelId);}});}return _this154;}//展开点击事件
27413
- _inherits(TreeViewPlugin,_Plugin11);return _createClass(TreeViewPlugin,[{key:"switchExpandHandler",value:function switchExpandHandler(event){event.preventDefault();event.stopPropagation();event.target;// this._expandSwitchElement(switchElement);
27659
+ _this155._hierarchy=cfg.hierarchy||"containment";_this155._autoExpandDepth=cfg.autoExpandDepth||0;if(_this155._autoAddModels){var modelIds=Object.keys(_this155.viewer.metaScene.metaModels);for(var _i568=0,len=modelIds.length;_i568<len;_i568++){var modelId=modelIds[_i568];var metaModel=_this155.viewer.metaScene.metaModels[modelId];if(metaModel.finalized){_this155.addModel(modelId);}}_this155.viewer.scene.on("modelLoaded",function(modelId){if(_this155.viewer.metaScene.metaModels[modelId]){_this155.addModel(modelId);}});}return _this155;}//展开点击事件
27660
+ _inherits(TreeViewPlugin,_Plugin12);return _createClass(TreeViewPlugin,[{key:"switchExpandHandler",value:function switchExpandHandler(event){event.preventDefault();event.stopPropagation();event.target;// this._expandSwitchElement(switchElement);
27414
27661
  this.fire("ExpandHandler",event);}//收起点击事件
27415
27662
  },{key:"switchCollapseHandler",value:function switchCollapseHandler(event){event.preventDefault();event.stopPropagation();// const switchElement = event.target;
27416
27663
  // this._collapseSwitchElement(switchElement);
@@ -27521,11 +27768,11 @@ return true;}/**
27521
27768
  * @param {String} [options.rootName] Optional display name for the root node. Ordinary, for "containment"
27522
27769
  * and "storeys" hierarchy types, the tree would derive the root node name from the model's "IfcProject" element
27523
27770
  * name. This option allows to override that name when it is not suitable as a display name.
27524
- */},{key:"addModel",value:function addModel(modelId){var _this155=this;var options=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};// if (!this._containerElement) {
27771
+ */},{key:"addModel",value:function addModel(modelId){var _this156=this;var options=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};// if (!this._containerElement) {
27525
27772
  // return;
27526
27773
  // }
27527
27774
  var model=this.viewer.scene.models[modelId];if(!model){throw"Model not found: "+modelId;}var metaModel=this.viewer.metaScene.metaModels[modelId];if(!metaModel){this.error("MetaModel not found: "+modelId);return;}if(this._metaModels[modelId]){this._metaModels[modelId]=null;// this.warn("Model already added: " + modelId);
27528
- return;}this._metaModels[modelId]=metaModel;if(options&&options.rootName){this._rootNames[modelId]=options.rootName;}model.on("destroyed",function(){_this155.removeModel(model.id);});this._createNodes();}/**
27775
+ return;}this._metaModels[modelId]=metaModel;if(options&&options.rootName){this._rootNames[modelId]=options.rootName;}model.on("destroyed",function(){_this156.removeModel(model.id);});this._createNodes();}/**
27529
27776
  * Removes a model from this tree view.
27530
27777
  *
27531
27778
  * Does nothing if model not currently in tree view.
@@ -27694,12 +27941,12 @@ var title2=node2.title.toUpperCase();if(title1<title2){return-1;}if(title1>title
27694
27941
  */var ObjectCullStates=/*#__PURE__*/function(){/**
27695
27942
  * @private
27696
27943
  * @param scene
27697
- */function ObjectCullStates(scene){var _this156=this;_classCallCheck(this,ObjectCullStates);this._scene=scene;this._objects=[];// Array of all Entity instances that represent objects
27944
+ */function ObjectCullStates(scene){var _this157=this;_classCallCheck(this,ObjectCullStates);this._scene=scene;this._objects=[];// Array of all Entity instances that represent objects
27698
27945
  this._objectsViewCulled=[];// A flag for each object to indicate its view-cull status
27699
27946
  this._objectsDetailCulled=[];// A flag for each object to indicate its detail-cull status
27700
27947
  this._objectsChanged=[];// A flag for each object, set whenever its cull status has changed since last _applyChanges()
27701
27948
  this._objectsChangedList=[];// A list of objects whose cull status has changed, applied and cleared by _applyChanges()
27702
- this._modelInfos={};this._numObjects=0;this._lenObjectsChangedList=0;this._dirty=true;this._onModelLoaded=scene.on("modelLoaded",function(modelId){var model=scene.models[modelId];if(model){_this156._addModel(model);}});this._onTick=scene.on("tick",function(){if(_this156._dirty){_this156._build();}_this156._applyChanges();});}return _createClass(ObjectCullStates,[{key:"_addModel",value:function _addModel(model){var _this157=this;var modelInfo={model:model,onDestroyed:model.on("destroyed",function(){_this157._removeModel(model);})};this._modelInfos[model.id]=modelInfo;this._dirty=true;}},{key:"_removeModel",value:function _removeModel(model){var modelInfo=this._modelInfos[model.id];if(modelInfo){modelInfo.model.off(modelInfo.onDestroyed);delete this._modelInfos[model.id];this._dirty=true;}}},{key:"_build",value:function _build(){if(!this._dirty){return;}this._applyChanges();var objects=this._scene.objects;for(var _i578=0;_i578<this._numObjects;_i578++){this._objects[_i578]=null;}this._numObjects=0;for(var objectId in objects){var entity=objects[objectId];this._objects[this._numObjects++]=entity;}this._lenObjectsChangedList=0;this._dirty=false;}},{key:"_applyChanges",value:function _applyChanges(){if(this._lenObjectsChangedList>0){for(var _i579=0;_i579<this._lenObjectsChangedList;_i579++){var objectIdx=this._objectsChangedList[_i579];var object=this._objects[objectIdx];var viewCulled=this._objectsViewCulled[objectIdx];var detailCulled=this._objectsDetailCulled[objectIdx];var culled=viewCulled||detailCulled;object.culled=culled;this._objectsChanged[objectIdx]=false;}this._lenObjectsChangedList=0;}}/**
27949
+ this._modelInfos={};this._numObjects=0;this._lenObjectsChangedList=0;this._dirty=true;this._onModelLoaded=scene.on("modelLoaded",function(modelId){var model=scene.models[modelId];if(model){_this157._addModel(model);}});this._onTick=scene.on("tick",function(){if(_this157._dirty){_this157._build();}_this157._applyChanges();});}return _createClass(ObjectCullStates,[{key:"_addModel",value:function _addModel(model){var _this158=this;var modelInfo={model:model,onDestroyed:model.on("destroyed",function(){_this158._removeModel(model);})};this._modelInfos[model.id]=modelInfo;this._dirty=true;}},{key:"_removeModel",value:function _removeModel(model){var modelInfo=this._modelInfos[model.id];if(modelInfo){modelInfo.model.off(modelInfo.onDestroyed);delete this._modelInfos[model.id];this._dirty=true;}}},{key:"_build",value:function _build(){if(!this._dirty){return;}this._applyChanges();var objects=this._scene.objects;for(var _i578=0;_i578<this._numObjects;_i578++){this._objects[_i578]=null;}this._numObjects=0;for(var objectId in objects){var entity=objects[objectId];this._objects[this._numObjects++]=entity;}this._lenObjectsChangedList=0;this._dirty=false;}},{key:"_applyChanges",value:function _applyChanges(){if(this._lenObjectsChangedList>0){for(var _i579=0;_i579<this._lenObjectsChangedList;_i579++){var objectIdx=this._objectsChangedList[_i579];var object=this._objects[objectIdx];var viewCulled=this._objectsViewCulled[objectIdx];var detailCulled=this._objectsDetailCulled[objectIdx];var culled=viewCulled||detailCulled;object.culled=culled;this._objectsChanged[objectIdx]=false;}this._lenObjectsChangedList=0;}}/**
27703
27950
  * Array of {@link Entity} instances that represent objects in the {@link Scene}.
27704
27951
  *
27705
27952
  * ObjectCullStates rebuilds this from {@link Scene#objects} whenever ````Scene```` fires a ````modelLoaded```` event.
@@ -27760,15 +28007,15 @@ var kdTreeDimLength=new Float32Array(3);/**
27760
28007
  * src: "./models/xtc/OTCConferenceCenter.xtc"
27761
28008
  * });
27762
28009
  * ````
27763
- */var ViewCullPlugin=/*#__PURE__*/function(_Plugin12){/**
28010
+ */var ViewCullPlugin=/*#__PURE__*/function(_Plugin13){/**
27764
28011
  * @constructor
27765
28012
  * @param {Viewer} viewer The Viewer.
27766
28013
  * @param {Object} cfg Plugin configuration.
27767
28014
  * @param {String} [cfg.id="ViewCull"] Optional ID for this plugin, so that we can find it within {@link Viewer#plugins}.
27768
28015
  * @param {Number} [cfg.maxTreeDepth=8] Maximum depth of the kd-tree.
27769
- */function ViewCullPlugin(viewer){var _this158;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,ViewCullPlugin);_this158=_callSuper(this,ViewCullPlugin,["ViewCull",viewer]);_this158._objectCullStates=getObjectCullStates(viewer.scene);// Combines updates from multiple culling systems for its Scene's Entities
27770
- _this158._maxTreeDepth=cfg.maxTreeDepth||MAX_KD_TREE_DEPTH;_this158._modelInfos={};_this158._frustum=new Frustum$1();_this158._kdRoot=null;_this158._frustumDirty=false;_this158._kdTreeDirty=false;_this158._insideView=false;_this158.enabled=cfg.enabled;var camera=viewer.scene.camera;_this158._onViewMatrix=viewer.scene.camera.on("viewMatrix",function(){_this158._frustumDirty=true;});_this158._onProjMatrix=viewer.scene.camera.on("projMatMatrix",function(){_this158._frustumDirty=true;});_this158._onModelLoaded=viewer.scene.on("modelLoaded",function(modelId){var model=_this158.viewer.scene.models[modelId];if(model){_this158._addModel(model);}});_this158._onSceneTick=viewer.scene.on("tick",function(){if(_this158._enabled)_this158._doCull();_this158.insideView=_this158.isBoxInFrustum(_this158.extractFrustumPlanes(camera.projMatrix,camera.viewMatrix),viewer.scene.aabb);});return _this158;}//包围盒和视锥相交测试
27771
- _inherits(ViewCullPlugin,_Plugin12);return _createClass(ViewCullPlugin,[{key:"isBoxInFrustum",value:function isBoxInFrustum(frustumPlanes,aabb){for(var _i580=0;_i580<6;_i580++){var plane=frustumPlanes[_i580];var _p4=[plane[0]>0?aabb[3]:aabb[0],plane[1]>0?aabb[4]:aabb[1],plane[2]>0?aabb[5]:aabb[2]];if(plane[0]*_p4[0]+plane[1]*_p4[1]+plane[2]*_p4[2]+plane[3]<0){return false;}}return true;}//视锥计算
28016
+ */function ViewCullPlugin(viewer){var _this159;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,ViewCullPlugin);_this159=_callSuper(this,ViewCullPlugin,["ViewCull",viewer]);_this159._objectCullStates=getObjectCullStates(viewer.scene);// Combines updates from multiple culling systems for its Scene's Entities
28017
+ _this159._maxTreeDepth=cfg.maxTreeDepth||MAX_KD_TREE_DEPTH;_this159._modelInfos={};_this159._frustum=new Frustum$1();_this159._kdRoot=null;_this159._frustumDirty=false;_this159._kdTreeDirty=false;_this159._insideView=false;_this159.enabled=cfg.enabled;var camera=viewer.scene.camera;_this159._onViewMatrix=viewer.scene.camera.on("viewMatrix",function(){_this159._frustumDirty=true;});_this159._onProjMatrix=viewer.scene.camera.on("projMatMatrix",function(){_this159._frustumDirty=true;});_this159._onModelLoaded=viewer.scene.on("modelLoaded",function(modelId){var model=_this159.viewer.scene.models[modelId];if(model){_this159._addModel(model);}});_this159._onSceneTick=viewer.scene.on("tick",function(){if(_this159._enabled)_this159._doCull();_this159.insideView=_this159.isBoxInFrustum(_this159.extractFrustumPlanes(camera.projMatrix,camera.viewMatrix),viewer.scene.aabb);});return _this159;}//包围盒和视锥相交测试
28018
+ _inherits(ViewCullPlugin,_Plugin13);return _createClass(ViewCullPlugin,[{key:"isBoxInFrustum",value:function isBoxInFrustum(frustumPlanes,aabb){for(var _i580=0;_i580<6;_i580++){var plane=frustumPlanes[_i580];var _p4=[plane[0]>0?aabb[3]:aabb[0],plane[1]>0?aabb[4]:aabb[1],plane[2]>0?aabb[5]:aabb[2]];if(plane[0]*_p4[0]+plane[1]*_p4[1]+plane[2]*_p4[2]+plane[3]<0){return false;}}return true;}//视锥计算
27772
28019
  },{key:"extractFrustumPlanes",value:function extractFrustumPlanes(projectionMatrix,viewMatrix){var combinedMatrix=math.identityMat4();math.mulMat4(projectionMatrix,viewMatrix,combinedMatrix);var planes=[];for(var _i581=0;_i581<6;_i581++){planes.push(math.identityMat4());}// Left plane
27773
28020
  planes[0][0]=combinedMatrix[3]+combinedMatrix[0];planes[0][1]=combinedMatrix[7]+combinedMatrix[4];planes[0][2]=combinedMatrix[11]+combinedMatrix[8];planes[0][3]=combinedMatrix[15]+combinedMatrix[12];// Right plane
27774
28021
  planes[1][0]=combinedMatrix[3]-combinedMatrix[0];planes[1][1]=combinedMatrix[7]-combinedMatrix[4];planes[1][2]=combinedMatrix[11]-combinedMatrix[8];planes[1][3]=combinedMatrix[15]-combinedMatrix[12];// Bottom plane
@@ -27783,7 +28030,7 @@ planes[5][0]=combinedMatrix[3]-combinedMatrix[2];planes[5][1]=combinedMatrix[7]-
27783
28030
  * Gets whether view culling is enabled.
27784
28031
  *
27785
28032
  * @retutns {Boolean} Whether view culling is enabled.
27786
- */function get(){return this._enabled;},set:function set(enabled){this._enabled=enabled;}},{key:"_addModel",value:function _addModel(model){var _this159=this;var modelInfo={model:model,onDestroyed:model.on("destroyed",function(){_this159._removeModel(model);})};this._modelInfos[model.id]=modelInfo;this._kdTreeDirty=true;}},{key:"_removeModel",value:function _removeModel(model){var modelInfo=this._modelInfos[model.id];if(modelInfo){modelInfo.model.off(modelInfo.onDestroyed);delete this._modelInfos[model.id];this._kdTreeDirty=true;}}},{key:"_doCull",value:function _doCull(){var cullDirty=this._frustumDirty||this._kdTreeDirty;if(this._frustumDirty){this._buildFrustum();}if(this._kdTreeDirty){this._buildKDTree();}if(cullDirty){var kdNode=this._kdRoot;if(kdNode){this._visitKDNode(kdNode);}}}},{key:"_buildFrustum",value:function _buildFrustum(){var camera=this.viewer.scene.camera;setFrustum(this._frustum,camera.viewMatrix,camera.projMatrix);this._frustumDirty=false;}},{key:"_buildKDTree",value:function _buildKDTree(){var viewer=this.viewer;var scene=viewer.scene;var depth=0;if(this._kdRoot);this._kdRoot={aabb:scene.getAABB(),intersection:Frustum$1.INTERSECT};for(var objectIdx=0,len=this._objectCullStates.numObjects;objectIdx<len;objectIdx++){var entity=this._objectCullStates.objects[objectIdx];this._insertEntityIntoKDTree(this._kdRoot,entity,objectIdx,depth+1);}this._kdTreeDirty=false;}},{key:"_insertEntityIntoKDTree",value:function _insertEntityIntoKDTree(kdNode,entity,objectIdx,depth){var entityAABB=entity.aabb;if(depth>=this._maxTreeDepth){kdNode.objects=kdNode.objects||[];kdNode.objects.push(objectIdx);math.expandAABB3(kdNode.aabb,entityAABB);return;}if(kdNode.left){if(math.containsAABB3(kdNode.left.aabb,entityAABB)){this._insertEntityIntoKDTree(kdNode.left,entity,objectIdx,depth+1);return;}}if(kdNode.right){if(math.containsAABB3(kdNode.right.aabb,entityAABB)){this._insertEntityIntoKDTree(kdNode.right,entity,objectIdx,depth+1);return;}}var nodeAABB=kdNode.aabb;kdTreeDimLength[0]=nodeAABB[3]-nodeAABB[0];kdTreeDimLength[1]=nodeAABB[4]-nodeAABB[1];kdTreeDimLength[2]=nodeAABB[5]-nodeAABB[2];var dim=0;if(kdTreeDimLength[1]>kdTreeDimLength[dim]){dim=1;}if(kdTreeDimLength[2]>kdTreeDimLength[dim]){dim=2;}if(!kdNode.left){var aabbLeft=nodeAABB.slice();aabbLeft[dim+3]=(nodeAABB[dim]+nodeAABB[dim+3])/2.0;kdNode.left={aabb:aabbLeft,intersection:Frustum$1.INTERSECT};if(math.containsAABB3(aabbLeft,entityAABB)){this._insertEntityIntoKDTree(kdNode.left,entity,objectIdx,depth+1);return;}}if(!kdNode.right){var aabbRight=nodeAABB.slice();aabbRight[dim]=(nodeAABB[dim]+nodeAABB[dim+3])/2.0;kdNode.right={aabb:aabbRight,intersection:Frustum$1.INTERSECT};if(math.containsAABB3(aabbRight,entityAABB)){this._insertEntityIntoKDTree(kdNode.right,entity,objectIdx,depth+1);return;}}kdNode.objects=kdNode.objects||[];kdNode.objects.push(objectIdx);math.expandAABB3(kdNode.aabb,entityAABB);}},{key:"_visitKDNode",value:function _visitKDNode(kdNode){var intersects=arguments.length>1&&arguments[1]!==undefined?arguments[1]:Frustum$1.INTERSECT;if(intersects!==Frustum$1.INTERSECT&&kdNode.intersects===intersects){return;}if(intersects===Frustum$1.INTERSECT){intersects=frustumIntersectsAABB3(this._frustum,kdNode.aabb);// this.insideView = intersects == 0 || intersects == 1;
28033
+ */function get(){return this._enabled;},set:function set(enabled){this._enabled=enabled;}},{key:"_addModel",value:function _addModel(model){var _this160=this;var modelInfo={model:model,onDestroyed:model.on("destroyed",function(){_this160._removeModel(model);})};this._modelInfos[model.id]=modelInfo;this._kdTreeDirty=true;}},{key:"_removeModel",value:function _removeModel(model){var modelInfo=this._modelInfos[model.id];if(modelInfo){modelInfo.model.off(modelInfo.onDestroyed);delete this._modelInfos[model.id];this._kdTreeDirty=true;}}},{key:"_doCull",value:function _doCull(){var cullDirty=this._frustumDirty||this._kdTreeDirty;if(this._frustumDirty){this._buildFrustum();}if(this._kdTreeDirty){this._buildKDTree();}if(cullDirty){var kdNode=this._kdRoot;if(kdNode){this._visitKDNode(kdNode);}}}},{key:"_buildFrustum",value:function _buildFrustum(){var camera=this.viewer.scene.camera;setFrustum(this._frustum,camera.viewMatrix,camera.projMatrix);this._frustumDirty=false;}},{key:"_buildKDTree",value:function _buildKDTree(){var viewer=this.viewer;var scene=viewer.scene;var depth=0;if(this._kdRoot);this._kdRoot={aabb:scene.getAABB(),intersection:Frustum$1.INTERSECT};for(var objectIdx=0,len=this._objectCullStates.numObjects;objectIdx<len;objectIdx++){var entity=this._objectCullStates.objects[objectIdx];this._insertEntityIntoKDTree(this._kdRoot,entity,objectIdx,depth+1);}this._kdTreeDirty=false;}},{key:"_insertEntityIntoKDTree",value:function _insertEntityIntoKDTree(kdNode,entity,objectIdx,depth){var entityAABB=entity.aabb;if(depth>=this._maxTreeDepth){kdNode.objects=kdNode.objects||[];kdNode.objects.push(objectIdx);math.expandAABB3(kdNode.aabb,entityAABB);return;}if(kdNode.left){if(math.containsAABB3(kdNode.left.aabb,entityAABB)){this._insertEntityIntoKDTree(kdNode.left,entity,objectIdx,depth+1);return;}}if(kdNode.right){if(math.containsAABB3(kdNode.right.aabb,entityAABB)){this._insertEntityIntoKDTree(kdNode.right,entity,objectIdx,depth+1);return;}}var nodeAABB=kdNode.aabb;kdTreeDimLength[0]=nodeAABB[3]-nodeAABB[0];kdTreeDimLength[1]=nodeAABB[4]-nodeAABB[1];kdTreeDimLength[2]=nodeAABB[5]-nodeAABB[2];var dim=0;if(kdTreeDimLength[1]>kdTreeDimLength[dim]){dim=1;}if(kdTreeDimLength[2]>kdTreeDimLength[dim]){dim=2;}if(!kdNode.left){var aabbLeft=nodeAABB.slice();aabbLeft[dim+3]=(nodeAABB[dim]+nodeAABB[dim+3])/2.0;kdNode.left={aabb:aabbLeft,intersection:Frustum$1.INTERSECT};if(math.containsAABB3(aabbLeft,entityAABB)){this._insertEntityIntoKDTree(kdNode.left,entity,objectIdx,depth+1);return;}}if(!kdNode.right){var aabbRight=nodeAABB.slice();aabbRight[dim]=(nodeAABB[dim]+nodeAABB[dim+3])/2.0;kdNode.right={aabb:aabbRight,intersection:Frustum$1.INTERSECT};if(math.containsAABB3(aabbRight,entityAABB)){this._insertEntityIntoKDTree(kdNode.right,entity,objectIdx,depth+1);return;}}kdNode.objects=kdNode.objects||[];kdNode.objects.push(objectIdx);math.expandAABB3(kdNode.aabb,entityAABB);}},{key:"_visitKDNode",value:function _visitKDNode(kdNode){var intersects=arguments.length>1&&arguments[1]!==undefined?arguments[1]:Frustum$1.INTERSECT;if(intersects!==Frustum$1.INTERSECT&&kdNode.intersects===intersects){return;}if(intersects===Frustum$1.INTERSECT){intersects=frustumIntersectsAABB3(this._frustum,kdNode.aabb);// this.insideView = intersects == 0 || intersects == 1;
27787
28034
  kdNode.intersects=intersects;}var culled=intersects===Frustum$1.OUTSIDE;var objects=kdNode.objects;if(objects&&objects.length>0){for(var _i583=0,len=objects.length;_i583<len;_i583++){var objectIdx=objects[_i583];this._objectCullStates.setObjectViewCulled(objectIdx,culled);}}if(kdNode.left){this._visitKDNode(kdNode.left,intersects);}if(kdNode.right){this._visitKDNode(kdNode.right,intersects);}}/**
27788
28035
  * @private
27789
28036
  */},{key:"send",value:function send(name,value){}/**
@@ -27812,9 +28059,29 @@ kdNode.intersects=intersects;}var culled=intersects===Frustum$1.OUTSIDE;var obje
27812
28059
  var isBase64=!!dataUriRegexResult[2];var data=dataUriRegexResult[3];data=window.decodeURIComponent(data);if(isBase64){data=window.atob(data);}try{var buffer=new ArrayBuffer(data.length);var view=new Uint8Array(buffer);for(var i=0;i<data.length;i++){view[i]=data.charCodeAt(i);}ok(buffer);}catch(errMsg){error(errMsg);}}else{var request=new XMLHttpRequest();request.open("GET",src,true);request.responseType="arraybuffer";request.onreadystatechange=function(){if(request.readyState===4){if(request.status===200){ok(request.response);}else{error("getXTC error : "+request.response);}}};request.send(null);}}}]);}();/*! pako 2.1.0 https://github.com/nodeca/pako @license (MIT AND Zlib) */!function(t,e){"object"==(typeof exports==="undefined"?"undefined":_typeof2(exports))&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).pako={});}(undefined,function(t){function e(t){var e=t.length;for(;--e>=0;)t[e]=0;}var a=256,i=286,n=30,s=15,r=new Uint8Array([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0]),o=new Uint8Array([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13]),l=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),h=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),d=new Array(576);e(d);var _=new Array(60);e(_);var f=new Array(512);e(f);var c=new Array(256);e(c);var u=new Array(29);e(u);var w=new Array(n);function m(t,e,a,i,n){this.static_tree=t,this.extra_bits=e,this.extra_base=a,this.elems=i,this.max_length=n,this.has_stree=t&&t.length;}var b,g,p;function k(t,e){this.dyn_tree=t,this.max_code=0,this.stat_desc=e;}e(w);var v=function v(t){return t<256?f[t]:f[256+(t>>>7)];},y=function y(t,e){t.pending_buf[t.pending++]=255&e,t.pending_buf[t.pending++]=e>>>8&255;},x=function x(t,e,a){t.bi_valid>16-a?(t.bi_buf|=e<<t.bi_valid&65535,y(t,t.bi_buf),t.bi_buf=e>>16-t.bi_valid,t.bi_valid+=a-16):(t.bi_buf|=e<<t.bi_valid&65535,t.bi_valid+=a);},z=function z(t,e,a){x(t,a[2*e],a[2*e+1]);},A=function A(t,e){var a=0;do{a|=1&t,t>>>=1,a<<=1;}while(--e>0);return a>>>1;},E=function E(t,e,a){var i=new Array(16);var n,r,o=0;for(n=1;n<=s;n++)o=o+a[n-1]<<1,i[n]=o;for(r=0;r<=e;r++){var _e2=t[2*r+1];0!==_e2&&(t[2*r]=A(i[_e2]++,_e2));}},R=function R(t){var e;for(e=0;e<i;e++)t.dyn_ltree[2*e]=0;for(e=0;e<n;e++)t.dyn_dtree[2*e]=0;for(e=0;e<19;e++)t.bl_tree[2*e]=0;t.dyn_ltree[512]=1,t.opt_len=t.static_len=0,t.sym_next=t.matches=0;},Z=function Z(t){t.bi_valid>8?y(t,t.bi_buf):t.bi_valid>0&&(t.pending_buf[t.pending++]=t.bi_buf),t.bi_buf=0,t.bi_valid=0;},U=function U(t,e,a,i){var n=2*e,s=2*a;return t[n]<t[s]||t[n]===t[s]&&i[e]<=i[a];},S=function S(t,e,a){var i=t.heap[a];var n=a<<1;for(;n<=t.heap_len&&(n<t.heap_len&&U(e,t.heap[n+1],t.heap[n],t.depth)&&n++,!U(e,i,t.heap[n],t.depth));)t.heap[a]=t.heap[n],a=n,n<<=1;t.heap[a]=i;},D=function D(t,e,i){var n,s,l,h,d=0;if(0!==t.sym_next)do{n=255&t.pending_buf[t.sym_buf+d++],n+=(255&t.pending_buf[t.sym_buf+d++])<<8,s=t.pending_buf[t.sym_buf+d++],0===n?z(t,s,e):(l=c[s],z(t,l+a+1,e),h=r[l],0!==h&&(s-=u[l],x(t,s,h)),n--,l=v(n),z(t,l,i),h=o[l],0!==h&&(n-=w[l],x(t,n,h)));}while(d<t.sym_next);z(t,256,e);},T=function T(t,e){var a=e.dyn_tree,i=e.stat_desc.static_tree,n=e.stat_desc.has_stree,r=e.stat_desc.elems;var o,l,h,d=-1;for(t.heap_len=0,t.heap_max=573,o=0;o<r;o++)0!==a[2*o]?(t.heap[++t.heap_len]=d=o,t.depth[o]=0):a[2*o+1]=0;for(;t.heap_len<2;)h=t.heap[++t.heap_len]=d<2?++d:0,a[2*h]=1,t.depth[h]=0,t.opt_len--,n&&(t.static_len-=i[2*h+1]);for(e.max_code=d,o=t.heap_len>>1;o>=1;o--)S(t,a,o);h=r;do{o=t.heap[1],t.heap[1]=t.heap[t.heap_len--],S(t,a,1),l=t.heap[1],t.heap[--t.heap_max]=o,t.heap[--t.heap_max]=l,a[2*h]=a[2*o]+a[2*l],t.depth[h]=(t.depth[o]>=t.depth[l]?t.depth[o]:t.depth[l])+1,a[2*o+1]=a[2*l+1]=h,t.heap[1]=h++,S(t,a,1);}while(t.heap_len>=2);t.heap[--t.heap_max]=t.heap[1],function(t,e){var a=e.dyn_tree,i=e.max_code,n=e.stat_desc.static_tree,r=e.stat_desc.has_stree,o=e.stat_desc.extra_bits,l=e.stat_desc.extra_base,h=e.stat_desc.max_length;var d,_,f,c,u,w,m=0;for(c=0;c<=s;c++)t.bl_count[c]=0;for(a[2*t.heap[t.heap_max]+1]=0,d=t.heap_max+1;d<573;d++)_=t.heap[d],c=a[2*a[2*_+1]+1]+1,c>h&&(c=h,m++),a[2*_+1]=c,_>i||(t.bl_count[c]++,u=0,_>=l&&(u=o[_-l]),w=a[2*_],t.opt_len+=w*(c+u),r&&(t.static_len+=w*(n[2*_+1]+u)));if(0!==m){do{for(c=h-1;0===t.bl_count[c];)c--;t.bl_count[c]--,t.bl_count[c+1]+=2,t.bl_count[h]--,m-=2;}while(m>0);for(c=h;0!==c;c--)for(_=t.bl_count[c];0!==_;)f=t.heap[--d],f>i||(a[2*f+1]!==c&&(t.opt_len+=(c-a[2*f+1])*a[2*f],a[2*f+1]=c),_--);}}(t,e),E(a,d,t.bl_count);},O=function O(t,e,a){var i,n,s=-1,r=e[1],o=0,l=7,h=4;for(0===r&&(l=138,h=3),e[2*(a+1)+1]=65535,i=0;i<=a;i++)n=r,r=e[2*(i+1)+1],++o<l&&n===r||(o<h?t.bl_tree[2*n]+=o:0!==n?(n!==s&&t.bl_tree[2*n]++,t.bl_tree[32]++):o<=10?t.bl_tree[34]++:t.bl_tree[36]++,o=0,s=n,0===r?(l=138,h=3):n===r?(l=6,h=3):(l=7,h=4));},I=function I(t,e,a){var i,n,s=-1,r=e[1],o=0,l=7,h=4;for(0===r&&(l=138,h=3),i=0;i<=a;i++)if(n=r,r=e[2*(i+1)+1],!(++o<l&&n===r)){if(o<h)do{z(t,n,t.bl_tree);}while(0!=--o);else 0!==n?(n!==s&&(z(t,n,t.bl_tree),o--),z(t,16,t.bl_tree),x(t,o-3,2)):o<=10?(z(t,17,t.bl_tree),x(t,o-3,3)):(z(t,18,t.bl_tree),x(t,o-11,7));o=0,s=n,0===r?(l=138,h=3):n===r?(l=6,h=3):(l=7,h=4);}};var F=!1;var L=function L(t,e,a,i){x(t,0+(i?1:0),3),Z(t),y(t,a),y(t,~a),a&&t.pending_buf.set(t.window.subarray(e,e+a),t.pending),t.pending+=a;};var N=function N(t,e,i,n){var s,r,o=0;t.level>0?(2===t.strm.data_type&&(t.strm.data_type=function(t){var e,i=4093624447;for(e=0;e<=31;e++,i>>>=1)if(1&i&&0!==t.dyn_ltree[2*e])return 0;if(0!==t.dyn_ltree[18]||0!==t.dyn_ltree[20]||0!==t.dyn_ltree[26])return 1;for(e=32;e<a;e++)if(0!==t.dyn_ltree[2*e])return 1;return 0;}(t)),T(t,t.l_desc),T(t,t.d_desc),o=function(t){var e;for(O(t,t.dyn_ltree,t.l_desc.max_code),O(t,t.dyn_dtree,t.d_desc.max_code),T(t,t.bl_desc),e=18;e>=3&&0===t.bl_tree[2*h[e]+1];e--);return t.opt_len+=3*(e+1)+5+5+4,e;}(t),s=t.opt_len+3+7>>>3,r=t.static_len+3+7>>>3,r<=s&&(s=r)):s=r=i+5,i+4<=s&&-1!==e?L(t,e,i,n):4===t.strategy||r===s?(x(t,2+(n?1:0),3),D(t,d,_)):(x(t,4+(n?1:0),3),function(t,e,a,i){var n;for(x(t,e-257,5),x(t,a-1,5),x(t,i-4,4),n=0;n<i;n++)x(t,t.bl_tree[2*h[n]+1],3);I(t,t.dyn_ltree,e-1),I(t,t.dyn_dtree,a-1);}(t,t.l_desc.max_code+1,t.d_desc.max_code+1,o+1),D(t,t.dyn_ltree,t.dyn_dtree)),R(t),n&&Z(t);},B={_tr_init:function _tr_init(t){F||(function(){var t,e,a,h,k;var v=new Array(16);for(a=0,h=0;h<28;h++)for(u[h]=a,t=0;t<1<<r[h];t++)c[a++]=h;for(c[a-1]=h,k=0,h=0;h<16;h++)for(w[h]=k,t=0;t<1<<o[h];t++)f[k++]=h;for(k>>=7;h<n;h++)for(w[h]=k<<7,t=0;t<1<<o[h]-7;t++)f[256+k++]=h;for(e=0;e<=s;e++)v[e]=0;for(t=0;t<=143;)d[2*t+1]=8,t++,v[8]++;for(;t<=255;)d[2*t+1]=9,t++,v[9]++;for(;t<=279;)d[2*t+1]=7,t++,v[7]++;for(;t<=287;)d[2*t+1]=8,t++,v[8]++;for(E(d,287,v),t=0;t<n;t++)_[2*t+1]=5,_[2*t]=A(t,5);b=new m(d,r,257,i,s),g=new m(_,o,0,n,s),p=new m(new Array(0),l,0,19,7);}(),F=!0),t.l_desc=new k(t.dyn_ltree,b),t.d_desc=new k(t.dyn_dtree,g),t.bl_desc=new k(t.bl_tree,p),t.bi_buf=0,t.bi_valid=0,R(t);},_tr_stored_block:L,_tr_flush_block:N,_tr_tally:function _tr_tally(t,e,i){return t.pending_buf[t.sym_buf+t.sym_next++]=e,t.pending_buf[t.sym_buf+t.sym_next++]=e>>8,t.pending_buf[t.sym_buf+t.sym_next++]=i,0===e?t.dyn_ltree[2*i]++:(t.matches++,e--,t.dyn_ltree[2*(c[i]+a+1)]++,t.dyn_dtree[2*v(e)]++),t.sym_next===t.sym_end;},_tr_align:function _tr_align(t){x(t,2,3),z(t,256,d),function(t){16===t.bi_valid?(y(t,t.bi_buf),t.bi_buf=0,t.bi_valid=0):t.bi_valid>=8&&(t.pending_buf[t.pending++]=255&t.bi_buf,t.bi_buf>>=8,t.bi_valid-=8);}(t);}};var C=function C(t,e,a,i){var n=65535&t|0,s=t>>>16&65535|0,r=0;for(;0!==a;){r=a>2e3?2e3:a,a-=r;do{n=n+e[i++]|0,s=s+n|0;}while(--r);n%=65521,s%=65521;}return n|s<<16|0;};var M=new Uint32Array(function(){var t,e=[];for(var a=0;a<256;a++){t=a;for(var i=0;i<8;i++)t=1&t?3988292384^t>>>1:t>>>1;e[a]=t;}return e;}());var H=function H(t,e,a,i){var n=M,s=i+a;t^=-1;for(var _a7=i;_a7<s;_a7++)t=t>>>8^n[255&(t^e[_a7])];return-1^t;},j={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"},K={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8};var P=B._tr_init,Y=B._tr_stored_block,G=B._tr_flush_block,X=B._tr_tally,W=B._tr_align,q=K.Z_NO_FLUSH,J=K.Z_PARTIAL_FLUSH,Q=K.Z_FULL_FLUSH,V=K.Z_FINISH,$=K.Z_BLOCK,tt=K.Z_OK,et=K.Z_STREAM_END,at=K.Z_STREAM_ERROR,it=K.Z_DATA_ERROR,nt=K.Z_BUF_ERROR,st=K.Z_DEFAULT_COMPRESSION,rt=K.Z_FILTERED,ot=K.Z_HUFFMAN_ONLY,lt=K.Z_RLE,ht=K.Z_FIXED,dt=K.Z_DEFAULT_STRATEGY,_t=K.Z_UNKNOWN,ft=K.Z_DEFLATED,ct=258,ut=262,wt=42,mt=113,bt=666,gt=function gt(t,e){return t.msg=j[e],e;},pt=function pt(t){return 2*t-(t>4?9:0);},kt=function kt(t){var e=t.length;for(;--e>=0;)t[e]=0;},vt=function vt(t){var e,a,i,n=t.w_size;e=t.hash_size,i=e;do{a=t.head[--i],t.head[i]=a>=n?a-n:0;}while(--e);e=n,i=e;do{a=t.prev[--i],t.prev[i]=a>=n?a-n:0;}while(--e);};var yt=function yt(t,e,a){return(e<<t.hash_shift^a)&t.hash_mask;};var xt=function xt(t){var e=t.state;var a=e.pending;a>t.avail_out&&(a=t.avail_out),0!==a&&(t.output.set(e.pending_buf.subarray(e.pending_out,e.pending_out+a),t.next_out),t.next_out+=a,e.pending_out+=a,t.total_out+=a,t.avail_out-=a,e.pending-=a,0===e.pending&&(e.pending_out=0));},zt=function zt(t,e){G(t,t.block_start>=0?t.block_start:-1,t.strstart-t.block_start,e),t.block_start=t.strstart,xt(t.strm);},At=function At(t,e){t.pending_buf[t.pending++]=e;},Et=function Et(t,e){t.pending_buf[t.pending++]=e>>>8&255,t.pending_buf[t.pending++]=255&e;},Rt=function Rt(t,e,a,i){var n=t.avail_in;return n>i&&(n=i),0===n?0:(t.avail_in-=n,e.set(t.input.subarray(t.next_in,t.next_in+n),a),1===t.state.wrap?t.adler=C(t.adler,e,n,a):2===t.state.wrap&&(t.adler=H(t.adler,e,n,a)),t.next_in+=n,t.total_in+=n,n);},Zt=function Zt(t,e){var a,i,n=t.max_chain_length,s=t.strstart,r=t.prev_length,o=t.nice_match;var l=t.strstart>t.w_size-ut?t.strstart-(t.w_size-ut):0,h=t.window,d=t.w_mask,_=t.prev,f=t.strstart+ct;var c=h[s+r-1],u=h[s+r];t.prev_length>=t.good_match&&(n>>=2),o>t.lookahead&&(o=t.lookahead);do{if(a=e,h[a+r]===u&&h[a+r-1]===c&&h[a]===h[s]&&h[++a]===h[s+1]){s+=2,a++;do{}while(h[++s]===h[++a]&&h[++s]===h[++a]&&h[++s]===h[++a]&&h[++s]===h[++a]&&h[++s]===h[++a]&&h[++s]===h[++a]&&h[++s]===h[++a]&&h[++s]===h[++a]&&s<f);if(i=ct-(f-s),s=f-ct,i>r){if(t.match_start=e,r=i,i>=o)break;c=h[s+r-1],u=h[s+r];}}}while((e=_[e&d])>l&&0!=--n);return r<=t.lookahead?r:t.lookahead;},Ut=function Ut(t){var e=t.w_size;var a,i,n;do{if(i=t.window_size-t.lookahead-t.strstart,t.strstart>=e+(e-ut)&&(t.window.set(t.window.subarray(e,e+e-i),0),t.match_start-=e,t.strstart-=e,t.block_start-=e,t.insert>t.strstart&&(t.insert=t.strstart),vt(t),i+=e),0===t.strm.avail_in)break;if(a=Rt(t.strm,t.window,t.strstart+t.lookahead,i),t.lookahead+=a,t.lookahead+t.insert>=3)for(n=t.strstart-t.insert,t.ins_h=t.window[n],t.ins_h=yt(t,t.ins_h,t.window[n+1]);t.insert&&(t.ins_h=yt(t,t.ins_h,t.window[n+3-1]),t.prev[n&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=n,n++,t.insert--,!(t.lookahead+t.insert<3)););}while(t.lookahead<ut&&0!==t.strm.avail_in);},St=function St(t,e){var a,i,n,s=t.pending_buf_size-5>t.w_size?t.w_size:t.pending_buf_size-5,r=0,o=t.strm.avail_in;do{if(a=65535,n=t.bi_valid+42>>3,t.strm.avail_out<n)break;if(n=t.strm.avail_out-n,i=t.strstart-t.block_start,a>i+t.strm.avail_in&&(a=i+t.strm.avail_in),a>n&&(a=n),a<s&&(0===a&&e!==V||e===q||a!==i+t.strm.avail_in))break;r=e===V&&a===i+t.strm.avail_in?1:0,Y(t,0,0,r),t.pending_buf[t.pending-4]=a,t.pending_buf[t.pending-3]=a>>8,t.pending_buf[t.pending-2]=~a,t.pending_buf[t.pending-1]=~a>>8,xt(t.strm),i&&(i>a&&(i=a),t.strm.output.set(t.window.subarray(t.block_start,t.block_start+i),t.strm.next_out),t.strm.next_out+=i,t.strm.avail_out-=i,t.strm.total_out+=i,t.block_start+=i,a-=i),a&&(Rt(t.strm,t.strm.output,t.strm.next_out,a),t.strm.next_out+=a,t.strm.avail_out-=a,t.strm.total_out+=a);}while(0===r);return o-=t.strm.avail_in,o&&(o>=t.w_size?(t.matches=2,t.window.set(t.strm.input.subarray(t.strm.next_in-t.w_size,t.strm.next_in),0),t.strstart=t.w_size,t.insert=t.strstart):(t.window_size-t.strstart<=o&&(t.strstart-=t.w_size,t.window.set(t.window.subarray(t.w_size,t.w_size+t.strstart),0),t.matches<2&&t.matches++,t.insert>t.strstart&&(t.insert=t.strstart)),t.window.set(t.strm.input.subarray(t.strm.next_in-o,t.strm.next_in),t.strstart),t.strstart+=o,t.insert+=o>t.w_size-t.insert?t.w_size-t.insert:o),t.block_start=t.strstart),t.high_water<t.strstart&&(t.high_water=t.strstart),r?4:e!==q&&e!==V&&0===t.strm.avail_in&&t.strstart===t.block_start?2:(n=t.window_size-t.strstart,t.strm.avail_in>n&&t.block_start>=t.w_size&&(t.block_start-=t.w_size,t.strstart-=t.w_size,t.window.set(t.window.subarray(t.w_size,t.w_size+t.strstart),0),t.matches<2&&t.matches++,n+=t.w_size,t.insert>t.strstart&&(t.insert=t.strstart)),n>t.strm.avail_in&&(n=t.strm.avail_in),n&&(Rt(t.strm,t.window,t.strstart,n),t.strstart+=n,t.insert+=n>t.w_size-t.insert?t.w_size-t.insert:n),t.high_water<t.strstart&&(t.high_water=t.strstart),n=t.bi_valid+42>>3,n=t.pending_buf_size-n>65535?65535:t.pending_buf_size-n,s=n>t.w_size?t.w_size:n,i=t.strstart-t.block_start,(i>=s||(i||e===V)&&e!==q&&0===t.strm.avail_in&&i<=n)&&(a=i>n?n:i,r=e===V&&0===t.strm.avail_in&&a===i?1:0,Y(t,t.block_start,a,r),t.block_start+=a,xt(t.strm)),r?3:1);},Dt=function Dt(t,e){var a,i;for(;;){if(t.lookahead<ut){if(Ut(t),t.lookahead<ut&&e===q)return 1;if(0===t.lookahead)break;}if(a=0,t.lookahead>=3&&(t.ins_h=yt(t,t.ins_h,t.window[t.strstart+3-1]),a=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),0!==a&&t.strstart-a<=t.w_size-ut&&(t.match_length=Zt(t,a)),t.match_length>=3){if(i=X(t,t.strstart-t.match_start,t.match_length-3),t.lookahead-=t.match_length,t.match_length<=t.max_lazy_match&&t.lookahead>=3){t.match_length--;do{t.strstart++,t.ins_h=yt(t,t.ins_h,t.window[t.strstart+3-1]),a=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart;}while(0!=--t.match_length);t.strstart++;}else t.strstart+=t.match_length,t.match_length=0,t.ins_h=t.window[t.strstart],t.ins_h=yt(t,t.ins_h,t.window[t.strstart+1]);}else i=X(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++;if(i&&(zt(t,!1),0===t.strm.avail_out))return 1;}return t.insert=t.strstart<2?t.strstart:2,e===V?(zt(t,!0),0===t.strm.avail_out?3:4):t.sym_next&&(zt(t,!1),0===t.strm.avail_out)?1:2;},Tt=function Tt(t,e){var a,i,n;for(;;){if(t.lookahead<ut){if(Ut(t),t.lookahead<ut&&e===q)return 1;if(0===t.lookahead)break;}if(a=0,t.lookahead>=3&&(t.ins_h=yt(t,t.ins_h,t.window[t.strstart+3-1]),a=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),t.prev_length=t.match_length,t.prev_match=t.match_start,t.match_length=2,0!==a&&t.prev_length<t.max_lazy_match&&t.strstart-a<=t.w_size-ut&&(t.match_length=Zt(t,a),t.match_length<=5&&(t.strategy===rt||3===t.match_length&&t.strstart-t.match_start>4096)&&(t.match_length=2)),t.prev_length>=3&&t.match_length<=t.prev_length){n=t.strstart+t.lookahead-3,i=X(t,t.strstart-1-t.prev_match,t.prev_length-3),t.lookahead-=t.prev_length-1,t.prev_length-=2;do{++t.strstart<=n&&(t.ins_h=yt(t,t.ins_h,t.window[t.strstart+3-1]),a=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart);}while(0!=--t.prev_length);if(t.match_available=0,t.match_length=2,t.strstart++,i&&(zt(t,!1),0===t.strm.avail_out))return 1;}else if(t.match_available){if(i=X(t,0,t.window[t.strstart-1]),i&&zt(t,!1),t.strstart++,t.lookahead--,0===t.strm.avail_out)return 1;}else t.match_available=1,t.strstart++,t.lookahead--;}return t.match_available&&(i=X(t,0,t.window[t.strstart-1]),t.match_available=0),t.insert=t.strstart<2?t.strstart:2,e===V?(zt(t,!0),0===t.strm.avail_out?3:4):t.sym_next&&(zt(t,!1),0===t.strm.avail_out)?1:2;};function Ot(t,e,a,i,n){this.good_length=t,this.max_lazy=e,this.nice_length=a,this.max_chain=i,this.func=n;}var It=[new Ot(0,0,0,0,St),new Ot(4,4,8,4,Dt),new Ot(4,5,16,8,Dt),new Ot(4,6,32,32,Dt),new Ot(4,4,16,16,Tt),new Ot(8,16,32,32,Tt),new Ot(8,16,128,128,Tt),new Ot(8,32,128,256,Tt),new Ot(32,128,258,1024,Tt),new Ot(32,258,258,4096,Tt)];function Ft(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=ft,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new Uint16Array(1146),this.dyn_dtree=new Uint16Array(122),this.bl_tree=new Uint16Array(78),kt(this.dyn_ltree),kt(this.dyn_dtree),kt(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array(16),this.heap=new Uint16Array(573),kt(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(573),kt(this.depth),this.sym_buf=0,this.lit_bufsize=0,this.sym_next=0,this.sym_end=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0;}var Lt=function Lt(t){if(!t)return 1;var e=t.state;return!e||e.strm!==t||e.status!==wt&&57!==e.status&&69!==e.status&&73!==e.status&&91!==e.status&&103!==e.status&&e.status!==mt&&e.status!==bt?1:0;},Nt=function Nt(t){if(Lt(t))return gt(t,at);t.total_in=t.total_out=0,t.data_type=_t;var e=t.state;return e.pending=0,e.pending_out=0,e.wrap<0&&(e.wrap=-e.wrap),e.status=2===e.wrap?57:e.wrap?wt:mt,t.adler=2===e.wrap?0:1,e.last_flush=-2,P(e),tt;},Bt=function Bt(t){var e=Nt(t);var a;return e===tt&&((a=t.state).window_size=2*a.w_size,kt(a.head),a.max_lazy_match=It[a.level].max_lazy,a.good_match=It[a.level].good_length,a.nice_match=It[a.level].nice_length,a.max_chain_length=It[a.level].max_chain,a.strstart=0,a.block_start=0,a.lookahead=0,a.insert=0,a.match_length=a.prev_length=2,a.match_available=0,a.ins_h=0),e;},Ct=function Ct(t,e,a,i,n,s){if(!t)return at;var r=1;if(e===st&&(e=6),i<0?(r=0,i=-i):i>15&&(r=2,i-=16),n<1||n>9||a!==ft||i<8||i>15||e<0||e>9||s<0||s>ht||8===i&&1!==r)return gt(t,at);8===i&&(i=9);var o=new Ft();return t.state=o,o.strm=t,o.status=wt,o.wrap=r,o.gzhead=null,o.w_bits=i,o.w_size=1<<o.w_bits,o.w_mask=o.w_size-1,o.hash_bits=n+7,o.hash_size=1<<o.hash_bits,o.hash_mask=o.hash_size-1,o.hash_shift=~~((o.hash_bits+3-1)/3),o.window=new Uint8Array(2*o.w_size),o.head=new Uint16Array(o.hash_size),o.prev=new Uint16Array(o.w_size),o.lit_bufsize=1<<n+6,o.pending_buf_size=4*o.lit_bufsize,o.pending_buf=new Uint8Array(o.pending_buf_size),o.sym_buf=o.lit_bufsize,o.sym_end=3*(o.lit_bufsize-1),o.level=e,o.strategy=s,o.method=a,Bt(t);};var Mt={deflateInit:function deflateInit(t,e){return Ct(t,e,ft,15,8,dt);},deflateInit2:Ct,deflateReset:Bt,deflateResetKeep:Nt,deflateSetHeader:function deflateSetHeader(t,e){return Lt(t)||2!==t.state.wrap?at:(t.state.gzhead=e,tt);},deflate:function deflate(t,e){if(Lt(t)||e>$||e<0)return t?gt(t,at):at;var a=t.state;if(!t.output||0!==t.avail_in&&!t.input||a.status===bt&&e!==V)return gt(t,0===t.avail_out?nt:at);var i=a.last_flush;if(a.last_flush=e,0!==a.pending){if(xt(t),0===t.avail_out)return a.last_flush=-1,tt;}else if(0===t.avail_in&&pt(e)<=pt(i)&&e!==V)return gt(t,nt);if(a.status===bt&&0!==t.avail_in)return gt(t,nt);if(a.status===wt&&0===a.wrap&&(a.status=mt),a.status===wt){var _e3=ft+(a.w_bits-8<<4)<<8,_i584=-1;if(_i584=a.strategy>=ot||a.level<2?0:a.level<6?1:6===a.level?2:3,_e3|=_i584<<6,0!==a.strstart&&(_e3|=32),_e3+=31-_e3%31,Et(a,_e3),0!==a.strstart&&(Et(a,t.adler>>>16),Et(a,65535&t.adler)),t.adler=1,a.status=mt,xt(t),0!==a.pending)return a.last_flush=-1,tt;}if(57===a.status)if(t.adler=0,At(a,31),At(a,139),At(a,8),a.gzhead)At(a,(a.gzhead.text?1:0)+(a.gzhead.hcrc?2:0)+(a.gzhead.extra?4:0)+(a.gzhead.name?8:0)+(a.gzhead.comment?16:0)),At(a,255&a.gzhead.time),At(a,a.gzhead.time>>8&255),At(a,a.gzhead.time>>16&255),At(a,a.gzhead.time>>24&255),At(a,9===a.level?2:a.strategy>=ot||a.level<2?4:0),At(a,255&a.gzhead.os),a.gzhead.extra&&a.gzhead.extra.length&&(At(a,255&a.gzhead.extra.length),At(a,a.gzhead.extra.length>>8&255)),a.gzhead.hcrc&&(t.adler=H(t.adler,a.pending_buf,a.pending,0)),a.gzindex=0,a.status=69;else if(At(a,0),At(a,0),At(a,0),At(a,0),At(a,0),At(a,9===a.level?2:a.strategy>=ot||a.level<2?4:0),At(a,3),a.status=mt,xt(t),0!==a.pending)return a.last_flush=-1,tt;if(69===a.status){if(a.gzhead.extra){var _e4=a.pending,_i585=(65535&a.gzhead.extra.length)-a.gzindex;for(;a.pending+_i585>a.pending_buf_size;){var _n=a.pending_buf_size-a.pending;if(a.pending_buf.set(a.gzhead.extra.subarray(a.gzindex,a.gzindex+_n),a.pending),a.pending=a.pending_buf_size,a.gzhead.hcrc&&a.pending>_e4&&(t.adler=H(t.adler,a.pending_buf,a.pending-_e4,_e4)),a.gzindex+=_n,xt(t),0!==a.pending)return a.last_flush=-1,tt;_e4=0,_i585-=_n;}var _n2=new Uint8Array(a.gzhead.extra);a.pending_buf.set(_n2.subarray(a.gzindex,a.gzindex+_i585),a.pending),a.pending+=_i585,a.gzhead.hcrc&&a.pending>_e4&&(t.adler=H(t.adler,a.pending_buf,a.pending-_e4,_e4)),a.gzindex=0;}a.status=73;}if(73===a.status){if(a.gzhead.name){var _e5,_i586=a.pending;do{if(a.pending===a.pending_buf_size){if(a.gzhead.hcrc&&a.pending>_i586&&(t.adler=H(t.adler,a.pending_buf,a.pending-_i586,_i586)),xt(t),0!==a.pending)return a.last_flush=-1,tt;_i586=0;}_e5=a.gzindex<a.gzhead.name.length?255&a.gzhead.name.charCodeAt(a.gzindex++):0,At(a,_e5);}while(0!==_e5);a.gzhead.hcrc&&a.pending>_i586&&(t.adler=H(t.adler,a.pending_buf,a.pending-_i586,_i586)),a.gzindex=0;}a.status=91;}if(91===a.status){if(a.gzhead.comment){var _e6,_i587=a.pending;do{if(a.pending===a.pending_buf_size){if(a.gzhead.hcrc&&a.pending>_i587&&(t.adler=H(t.adler,a.pending_buf,a.pending-_i587,_i587)),xt(t),0!==a.pending)return a.last_flush=-1,tt;_i587=0;}_e6=a.gzindex<a.gzhead.comment.length?255&a.gzhead.comment.charCodeAt(a.gzindex++):0,At(a,_e6);}while(0!==_e6);a.gzhead.hcrc&&a.pending>_i587&&(t.adler=H(t.adler,a.pending_buf,a.pending-_i587,_i587));}a.status=103;}if(103===a.status){if(a.gzhead.hcrc){if(a.pending+2>a.pending_buf_size&&(xt(t),0!==a.pending))return a.last_flush=-1,tt;At(a,255&t.adler),At(a,t.adler>>8&255),t.adler=0;}if(a.status=mt,xt(t),0!==a.pending)return a.last_flush=-1,tt;}if(0!==t.avail_in||0!==a.lookahead||e!==q&&a.status!==bt){var _i588=0===a.level?St(a,e):a.strategy===ot?function(t,e){var a;for(;;){if(0===t.lookahead&&(Ut(t),0===t.lookahead)){if(e===q)return 1;break;}if(t.match_length=0,a=X(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++,a&&(zt(t,!1),0===t.strm.avail_out))return 1;}return t.insert=0,e===V?(zt(t,!0),0===t.strm.avail_out?3:4):t.sym_next&&(zt(t,!1),0===t.strm.avail_out)?1:2;}(a,e):a.strategy===lt?function(t,e){var a,i,n,s;var r=t.window;for(;;){if(t.lookahead<=ct){if(Ut(t),t.lookahead<=ct&&e===q)return 1;if(0===t.lookahead)break;}if(t.match_length=0,t.lookahead>=3&&t.strstart>0&&(n=t.strstart-1,i=r[n],i===r[++n]&&i===r[++n]&&i===r[++n])){s=t.strstart+ct;do{}while(i===r[++n]&&i===r[++n]&&i===r[++n]&&i===r[++n]&&i===r[++n]&&i===r[++n]&&i===r[++n]&&i===r[++n]&&n<s);t.match_length=ct-(s-n),t.match_length>t.lookahead&&(t.match_length=t.lookahead);}if(t.match_length>=3?(a=X(t,1,t.match_length-3),t.lookahead-=t.match_length,t.strstart+=t.match_length,t.match_length=0):(a=X(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++),a&&(zt(t,!1),0===t.strm.avail_out))return 1;}return t.insert=0,e===V?(zt(t,!0),0===t.strm.avail_out?3:4):t.sym_next&&(zt(t,!1),0===t.strm.avail_out)?1:2;}(a,e):It[a.level].func(a,e);if(3!==_i588&&4!==_i588||(a.status=bt),1===_i588||3===_i588)return 0===t.avail_out&&(a.last_flush=-1),tt;if(2===_i588&&(e===J?W(a):e!==$&&(Y(a,0,0,!1),e===Q&&(kt(a.head),0===a.lookahead&&(a.strstart=0,a.block_start=0,a.insert=0))),xt(t),0===t.avail_out))return a.last_flush=-1,tt;}return e!==V?tt:a.wrap<=0?et:(2===a.wrap?(At(a,255&t.adler),At(a,t.adler>>8&255),At(a,t.adler>>16&255),At(a,t.adler>>24&255),At(a,255&t.total_in),At(a,t.total_in>>8&255),At(a,t.total_in>>16&255),At(a,t.total_in>>24&255)):(Et(a,t.adler>>>16),Et(a,65535&t.adler)),xt(t),a.wrap>0&&(a.wrap=-a.wrap),0!==a.pending?tt:et);},deflateEnd:function deflateEnd(t){if(Lt(t))return at;var e=t.state.status;return t.state=null,e===mt?gt(t,it):tt;},deflateSetDictionary:function deflateSetDictionary(t,e){var a=e.length;if(Lt(t))return at;var i=t.state,n=i.wrap;if(2===n||1===n&&i.status!==wt||i.lookahead)return at;if(1===n&&(t.adler=C(t.adler,e,a,0)),i.wrap=0,a>=i.w_size){0===n&&(kt(i.head),i.strstart=0,i.block_start=0,i.insert=0);var _t2=new Uint8Array(i.w_size);_t2.set(e.subarray(a-i.w_size,a),0),e=_t2,a=i.w_size;}var s=t.avail_in,r=t.next_in,o=t.input;for(t.avail_in=a,t.next_in=0,t.input=e,Ut(i);i.lookahead>=3;){var _t3=i.strstart,_e7=i.lookahead-2;do{i.ins_h=yt(i,i.ins_h,i.window[_t3+3-1]),i.prev[_t3&i.w_mask]=i.head[i.ins_h],i.head[i.ins_h]=_t3,_t3++;}while(--_e7);i.strstart=_t3,i.lookahead=2,Ut(i);}return i.strstart+=i.lookahead,i.block_start=i.strstart,i.insert=i.lookahead,i.lookahead=0,i.match_length=i.prev_length=2,i.match_available=0,t.next_in=r,t.input=o,t.avail_in=s,i.wrap=n,tt;},deflateInfo:"pako deflate (from Nodeca project)"};var Ht=function Ht(t,e){return Object.prototype.hasOwnProperty.call(t,e);};var jt=function jt(t){var e=Array.prototype.slice.call(arguments,1);for(;e.length;){var _a8=e.shift();if(_a8){if("object"!=_typeof2(_a8))throw new TypeError(_a8+"must be non-object");for(var _e8 in _a8)Ht(_a8,_e8)&&(t[_e8]=_a8[_e8]);}}return t;},Kt=function Kt(t){var e=0;for(var _a9=0,_i589=t.length;_a9<_i589;_a9++)e+=t[_a9].length;var a=new Uint8Array(e);for(var _e9=0,_i590=0,_n3=t.length;_e9<_n3;_e9++){var _n4=t[_e9];a.set(_n4,_i590),_i590+=_n4.length;}return a;};var Pt=!0;try{String.fromCharCode.apply(null,new Uint8Array(1));}catch(t){Pt=!1;}var Yt=new Uint8Array(256);for(var _t4=0;_t4<256;_t4++)Yt[_t4]=_t4>=252?6:_t4>=248?5:_t4>=240?4:_t4>=224?3:_t4>=192?2:1;Yt[254]=Yt[254]=1;var Gt=function Gt(t){if("function"==typeof TextEncoder&&TextEncoder.prototype.encode)return new TextEncoder().encode(t);var e,a,i,n,s,r=t.length,o=0;for(n=0;n<r;n++)a=t.charCodeAt(n),55296==(64512&a)&&n+1<r&&(i=t.charCodeAt(n+1),56320==(64512&i)&&(a=65536+(a-55296<<10)+(i-56320),n++)),o+=a<128?1:a<2048?2:a<65536?3:4;for(e=new Uint8Array(o),s=0,n=0;s<o;n++)a=t.charCodeAt(n),55296==(64512&a)&&n+1<r&&(i=t.charCodeAt(n+1),56320==(64512&i)&&(a=65536+(a-55296<<10)+(i-56320),n++)),a<128?e[s++]=a:a<2048?(e[s++]=192|a>>>6,e[s++]=128|63&a):a<65536?(e[s++]=224|a>>>12,e[s++]=128|a>>>6&63,e[s++]=128|63&a):(e[s++]=240|a>>>18,e[s++]=128|a>>>12&63,e[s++]=128|a>>>6&63,e[s++]=128|63&a);return e;},Xt=function Xt(t,e){var a=e||t.length;if("function"==typeof TextDecoder&&TextDecoder.prototype.decode)return new TextDecoder().decode(t.subarray(0,e));var i,n;var s=new Array(2*a);for(n=0,i=0;i<a;){var _e10=t[i++];if(_e10<128){s[n++]=_e10;continue;}var _r6=Yt[_e10];if(_r6>4)s[n++]=65533,i+=_r6-1;else{for(_e10&=2===_r6?31:3===_r6?15:7;_r6>1&&i<a;)_e10=_e10<<6|63&t[i++],_r6--;_r6>1?s[n++]=65533:_e10<65536?s[n++]=_e10:(_e10-=65536,s[n++]=55296|_e10>>10&1023,s[n++]=56320|1023&_e10);}}return function(t,e){if(e<65534&&t.subarray&&Pt)return String.fromCharCode.apply(null,t.length===e?t:t.subarray(0,e));var a="";for(var _i591=0;_i591<e;_i591++)a+=String.fromCharCode(t[_i591]);return a;}(s,n);},Wt=function Wt(t,e){(e=e||t.length)>t.length&&(e=t.length);var a=e-1;for(;a>=0&&128==(192&t[a]);)a--;return a<0||0===a?e:a+Yt[t[a]]>e?a:e;};var qt=function qt(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0;};var Jt=Object.prototype.toString,Qt=K.Z_NO_FLUSH,Vt=K.Z_SYNC_FLUSH,$t=K.Z_FULL_FLUSH,te=K.Z_FINISH,ee=K.Z_OK,ae=K.Z_STREAM_END,ie=K.Z_DEFAULT_COMPRESSION,ne=K.Z_DEFAULT_STRATEGY,se=K.Z_DEFLATED;function re(t){this.options=jt({level:ie,method:se,chunkSize:16384,windowBits:15,memLevel:8,strategy:ne},t||{});var e=this.options;e.raw&&e.windowBits>0?e.windowBits=-e.windowBits:e.gzip&&e.windowBits>0&&e.windowBits<16&&(e.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new qt(),this.strm.avail_out=0;var a=Mt.deflateInit2(this.strm,e.level,e.method,e.windowBits,e.memLevel,e.strategy);if(a!==ee)throw new Error(j[a]);if(e.header&&Mt.deflateSetHeader(this.strm,e.header),e.dictionary){var _t5;if(_t5="string"==typeof e.dictionary?Gt(e.dictionary):"[object ArrayBuffer]"===Jt.call(e.dictionary)?new Uint8Array(e.dictionary):e.dictionary,a=Mt.deflateSetDictionary(this.strm,_t5),a!==ee)throw new Error(j[a]);this._dict_set=!0;}}function oe(t,e){var a=new re(e);if(a.push(t,!0),a.err)throw a.msg||j[a.err];return a.result;}re.prototype.push=function(t,e){var a=this.strm,i=this.options.chunkSize;var n,s;if(this.ended)return!1;for(s=e===~~e?e:!0===e?te:Qt,"string"==typeof t?a.input=Gt(t):"[object ArrayBuffer]"===Jt.call(t)?a.input=new Uint8Array(t):a.input=t,a.next_in=0,a.avail_in=a.input.length;;)if(0===a.avail_out&&(a.output=new Uint8Array(i),a.next_out=0,a.avail_out=i),(s===Vt||s===$t)&&a.avail_out<=6)this.onData(a.output.subarray(0,a.next_out)),a.avail_out=0;else{if(n=Mt.deflate(a,s),n===ae)return a.next_out>0&&this.onData(a.output.subarray(0,a.next_out)),n=Mt.deflateEnd(this.strm),this.onEnd(n),this.ended=!0,n===ee;if(0!==a.avail_out){if(s>0&&a.next_out>0)this.onData(a.output.subarray(0,a.next_out)),a.avail_out=0;else if(0===a.avail_in)break;}else this.onData(a.output);}return!0;},re.prototype.onData=function(t){this.chunks.push(t);},re.prototype.onEnd=function(t){t===ee&&(this.result=Kt(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg;};var le={Deflate:re,deflate:oe,deflateRaw:function deflateRaw(t,e){return(e=e||{}).raw=!0,oe(t,e);},gzip:function gzip(t,e){return(e=e||{}).gzip=!0,oe(t,e);},constants:K};var he=16209;var de=function de(t,e){var a,i,n,s,r,o,l,h,d,_,f,c,u,w,m,b,g,p,k,v,y,x,z,A;var E=t.state;a=t.next_in,z=t.input,i=a+(t.avail_in-5),n=t.next_out,A=t.output,s=n-(e-t.avail_out),r=n+(t.avail_out-257),o=E.dmax,l=E.wsize,h=E.whave,d=E.wnext,_=E.window,f=E.hold,c=E.bits,u=E.lencode,w=E.distcode,m=(1<<E.lenbits)-1,b=(1<<E.distbits)-1;t:do{c<15&&(f+=z[a++]<<c,c+=8,f+=z[a++]<<c,c+=8),g=u[f&m];e:for(;;){if(p=g>>>24,f>>>=p,c-=p,p=g>>>16&255,0===p)A[n++]=65535&g;else{if(!(16&p)){if(0==(64&p)){g=u[(65535&g)+(f&(1<<p)-1)];continue e;}if(32&p){E.mode=16191;break t;}t.msg="invalid literal/length code",E.mode=he;break t;}k=65535&g,p&=15,p&&(c<p&&(f+=z[a++]<<c,c+=8),k+=f&(1<<p)-1,f>>>=p,c-=p),c<15&&(f+=z[a++]<<c,c+=8,f+=z[a++]<<c,c+=8),g=w[f&b];a:for(;;){if(p=g>>>24,f>>>=p,c-=p,p=g>>>16&255,!(16&p)){if(0==(64&p)){g=w[(65535&g)+(f&(1<<p)-1)];continue a;}t.msg="invalid distance code",E.mode=he;break t;}if(v=65535&g,p&=15,c<p&&(f+=z[a++]<<c,c+=8,c<p&&(f+=z[a++]<<c,c+=8)),v+=f&(1<<p)-1,v>o){t.msg="invalid distance too far back",E.mode=he;break t;}if(f>>>=p,c-=p,p=n-s,v>p){if(p=v-p,p>h&&E.sane){t.msg="invalid distance too far back",E.mode=he;break t;}if(y=0,x=_,0===d){if(y+=l-p,p<k){k-=p;do{A[n++]=_[y++];}while(--p);y=n-v,x=A;}}else if(d<p){if(y+=l+d-p,p-=d,p<k){k-=p;do{A[n++]=_[y++];}while(--p);if(y=0,d<k){p=d,k-=p;do{A[n++]=_[y++];}while(--p);y=n-v,x=A;}}}else if(y+=d-p,p<k){k-=p;do{A[n++]=_[y++];}while(--p);y=n-v,x=A;}for(;k>2;)A[n++]=x[y++],A[n++]=x[y++],A[n++]=x[y++],k-=3;k&&(A[n++]=x[y++],k>1&&(A[n++]=x[y++]));}else{y=n-v;do{A[n++]=A[y++],A[n++]=A[y++],A[n++]=A[y++],k-=3;}while(k>2);k&&(A[n++]=A[y++],k>1&&(A[n++]=A[y++]));}break;}}break;}}while(a<i&&n<r);k=c>>3,a-=k,c-=k<<3,f&=(1<<c)-1,t.next_in=a,t.next_out=n,t.avail_in=a<i?i-a+5:5-(a-i),t.avail_out=n<r?r-n+257:257-(n-r),E.hold=f,E.bits=c;};var _e=15,fe=new Uint16Array([3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0]),ce=new Uint8Array([16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78]),ue=new Uint16Array([1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0]),we=new Uint8Array([16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64]);var me=function me(t,e,a,i,n,s,r,o){var l=o.bits;var h,d,_,f,c,u,w=0,m=0,b=0,g=0,p=0,k=0,v=0,y=0,x=0,z=0,A=null;var E=new Uint16Array(16),R=new Uint16Array(16);var Z,U,S,D=null;for(w=0;w<=_e;w++)E[w]=0;for(m=0;m<i;m++)E[e[a+m]]++;for(p=l,g=_e;g>=1&&0===E[g];g--);if(p>g&&(p=g),0===g)return n[s++]=20971520,n[s++]=20971520,o.bits=1,0;for(b=1;b<g&&0===E[b];b++);for(p<b&&(p=b),y=1,w=1;w<=_e;w++)if(y<<=1,y-=E[w],y<0)return-1;if(y>0&&(0===t||1!==g))return-1;for(R[1]=0,w=1;w<_e;w++)R[w+1]=R[w]+E[w];for(m=0;m<i;m++)0!==e[a+m]&&(r[R[e[a+m]]++]=m);if(0===t?(A=D=r,u=20):1===t?(A=fe,D=ce,u=257):(A=ue,D=we,u=0),z=0,m=0,w=b,c=s,k=p,v=0,_=-1,x=1<<p,f=x-1,1===t&&x>852||2===t&&x>592)return 1;for(;;){Z=w-v,r[m]+1<u?(U=0,S=r[m]):r[m]>=u?(U=D[r[m]-u],S=A[r[m]-u]):(U=96,S=0),h=1<<w-v,d=1<<k,b=d;do{d-=h,n[c+(z>>v)+d]=Z<<24|U<<16|S|0;}while(0!==d);for(h=1<<w-1;z&h;)h>>=1;if(0!==h?(z&=h-1,z+=h):z=0,m++,0==--E[w]){if(w===g)break;w=e[a+r[m]];}if(w>p&&(z&f)!==_){for(0===v&&(v=p),c+=b,k=w-v,y=1<<k;k+v<g&&(y-=E[k+v],!(y<=0));)k++,y<<=1;if(x+=1<<k,1===t&&x>852||2===t&&x>592)return 1;_=z&f,n[_]=p<<24|k<<16|c-s|0;}}return 0!==z&&(n[c+z]=w-v<<24|64<<16|0),o.bits=p,0;};var be=K.Z_FINISH,ge=K.Z_BLOCK,pe=K.Z_TREES,ke=K.Z_OK,ve=K.Z_STREAM_END,ye=K.Z_NEED_DICT,xe=K.Z_STREAM_ERROR,ze=K.Z_DATA_ERROR,Ae=K.Z_MEM_ERROR,Ee=K.Z_BUF_ERROR,Re=K.Z_DEFLATED,Ze=16180,Ue=16190,Se=16191,De=16192,Te=16194,Oe=16199,Ie=16200,Fe=16206,Le=16209,Ne=function Ne(t){return(t>>>24&255)+(t>>>8&65280)+((65280&t)<<8)+((255&t)<<24);};function Be(){this.strm=null,this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new Uint16Array(320),this.work=new Uint16Array(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0;}var Ce=function Ce(t){if(!t)return 1;var e=t.state;return!e||e.strm!==t||e.mode<Ze||e.mode>16211?1:0;},Me=function Me(t){if(Ce(t))return xe;var e=t.state;return t.total_in=t.total_out=e.total=0,t.msg="",e.wrap&&(t.adler=1&e.wrap),e.mode=Ze,e.last=0,e.havedict=0,e.flags=-1,e.dmax=32768,e.head=null,e.hold=0,e.bits=0,e.lencode=e.lendyn=new Int32Array(852),e.distcode=e.distdyn=new Int32Array(592),e.sane=1,e.back=-1,ke;},He=function He(t){if(Ce(t))return xe;var e=t.state;return e.wsize=0,e.whave=0,e.wnext=0,Me(t);},je=function je(t,e){var a;if(Ce(t))return xe;var i=t.state;return e<0?(a=0,e=-e):(a=5+(e>>4),e<48&&(e&=15)),e&&(e<8||e>15)?xe:(null!==i.window&&i.wbits!==e&&(i.window=null),i.wrap=a,i.wbits=e,He(t));},Ke=function Ke(t,e){if(!t)return xe;var a=new Be();t.state=a,a.strm=t,a.window=null,a.mode=Ze;var i=je(t,e);return i!==ke&&(t.state=null),i;};var Pe,Ye,Ge=!0;var Xe=function Xe(t){if(Ge){Pe=new Int32Array(512),Ye=new Int32Array(32);var _e11=0;for(;_e11<144;)t.lens[_e11++]=8;for(;_e11<256;)t.lens[_e11++]=9;for(;_e11<280;)t.lens[_e11++]=7;for(;_e11<288;)t.lens[_e11++]=8;for(me(1,t.lens,0,288,Pe,0,t.work,{bits:9}),_e11=0;_e11<32;)t.lens[_e11++]=5;me(2,t.lens,0,32,Ye,0,t.work,{bits:5}),Ge=!1;}t.lencode=Pe,t.lenbits=9,t.distcode=Ye,t.distbits=5;},We=function We(t,e,a,i){var n;var s=t.state;return null===s.window&&(s.wsize=1<<s.wbits,s.wnext=0,s.whave=0,s.window=new Uint8Array(s.wsize)),i>=s.wsize?(s.window.set(e.subarray(a-s.wsize,a),0),s.wnext=0,s.whave=s.wsize):(n=s.wsize-s.wnext,n>i&&(n=i),s.window.set(e.subarray(a-i,a-i+n),s.wnext),(i-=n)?(s.window.set(e.subarray(a-i,a),0),s.wnext=i,s.whave=s.wsize):(s.wnext+=n,s.wnext===s.wsize&&(s.wnext=0),s.whave<s.wsize&&(s.whave+=n))),0;};var qe={inflateReset:He,inflateReset2:je,inflateResetKeep:Me,inflateInit:function inflateInit(t){return Ke(t,15);},inflateInit2:Ke,inflate:function inflate(t,e){var a,i,n,s,r,o,l,h,d,_,f,c,u,w,m,b,g,p,k,v,y,x,z=0;var A=new Uint8Array(4);var E,R;var Z=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(Ce(t)||!t.output||!t.input&&0!==t.avail_in)return xe;a=t.state,a.mode===Se&&(a.mode=De),r=t.next_out,n=t.output,l=t.avail_out,s=t.next_in,i=t.input,o=t.avail_in,h=a.hold,d=a.bits,_=o,f=l,x=ke;t:for(;;)switch(a.mode){case Ze:if(0===a.wrap){a.mode=De;break;}for(;d<16;){if(0===o)break t;o--,h+=i[s++]<<d,d+=8;}if(2&a.wrap&&35615===h){0===a.wbits&&(a.wbits=15),a.check=0,A[0]=255&h,A[1]=h>>>8&255,a.check=H(a.check,A,2,0),h=0,d=0,a.mode=16181;break;}if(a.head&&(a.head.done=!1),!(1&a.wrap)||(((255&h)<<8)+(h>>8))%31){t.msg="incorrect header check",a.mode=Le;break;}if((15&h)!==Re){t.msg="unknown compression method",a.mode=Le;break;}if(h>>>=4,d-=4,y=8+(15&h),0===a.wbits&&(a.wbits=y),y>15||y>a.wbits){t.msg="invalid window size",a.mode=Le;break;}a.dmax=1<<a.wbits,a.flags=0,t.adler=a.check=1,a.mode=512&h?16189:Se,h=0,d=0;break;case 16181:for(;d<16;){if(0===o)break t;o--,h+=i[s++]<<d,d+=8;}if(a.flags=h,(255&a.flags)!==Re){t.msg="unknown compression method",a.mode=Le;break;}if(57344&a.flags){t.msg="unknown header flags set",a.mode=Le;break;}a.head&&(a.head.text=h>>8&1),512&a.flags&&4&a.wrap&&(A[0]=255&h,A[1]=h>>>8&255,a.check=H(a.check,A,2,0)),h=0,d=0,a.mode=16182;case 16182:for(;d<32;){if(0===o)break t;o--,h+=i[s++]<<d,d+=8;}a.head&&(a.head.time=h),512&a.flags&&4&a.wrap&&(A[0]=255&h,A[1]=h>>>8&255,A[2]=h>>>16&255,A[3]=h>>>24&255,a.check=H(a.check,A,4,0)),h=0,d=0,a.mode=16183;case 16183:for(;d<16;){if(0===o)break t;o--,h+=i[s++]<<d,d+=8;}a.head&&(a.head.xflags=255&h,a.head.os=h>>8),512&a.flags&&4&a.wrap&&(A[0]=255&h,A[1]=h>>>8&255,a.check=H(a.check,A,2,0)),h=0,d=0,a.mode=16184;case 16184:if(1024&a.flags){for(;d<16;){if(0===o)break t;o--,h+=i[s++]<<d,d+=8;}a.length=h,a.head&&(a.head.extra_len=h),512&a.flags&&4&a.wrap&&(A[0]=255&h,A[1]=h>>>8&255,a.check=H(a.check,A,2,0)),h=0,d=0;}else a.head&&(a.head.extra=null);a.mode=16185;case 16185:if(1024&a.flags&&(c=a.length,c>o&&(c=o),c&&(a.head&&(y=a.head.extra_len-a.length,a.head.extra||(a.head.extra=new Uint8Array(a.head.extra_len)),a.head.extra.set(i.subarray(s,s+c),y)),512&a.flags&&4&a.wrap&&(a.check=H(a.check,i,c,s)),o-=c,s+=c,a.length-=c),a.length))break t;a.length=0,a.mode=16186;case 16186:if(2048&a.flags){if(0===o)break t;c=0;do{y=i[s+c++],a.head&&y&&a.length<65536&&(a.head.name+=String.fromCharCode(y));}while(y&&c<o);if(512&a.flags&&4&a.wrap&&(a.check=H(a.check,i,c,s)),o-=c,s+=c,y)break t;}else a.head&&(a.head.name=null);a.length=0,a.mode=16187;case 16187:if(4096&a.flags){if(0===o)break t;c=0;do{y=i[s+c++],a.head&&y&&a.length<65536&&(a.head.comment+=String.fromCharCode(y));}while(y&&c<o);if(512&a.flags&&4&a.wrap&&(a.check=H(a.check,i,c,s)),o-=c,s+=c,y)break t;}else a.head&&(a.head.comment=null);a.mode=16188;case 16188:if(512&a.flags){for(;d<16;){if(0===o)break t;o--,h+=i[s++]<<d,d+=8;}if(4&a.wrap&&h!==(65535&a.check)){t.msg="header crc mismatch",a.mode=Le;break;}h=0,d=0;}a.head&&(a.head.hcrc=a.flags>>9&1,a.head.done=!0),t.adler=a.check=0,a.mode=Se;break;case 16189:for(;d<32;){if(0===o)break t;o--,h+=i[s++]<<d,d+=8;}t.adler=a.check=Ne(h),h=0,d=0,a.mode=Ue;case Ue:if(0===a.havedict)return t.next_out=r,t.avail_out=l,t.next_in=s,t.avail_in=o,a.hold=h,a.bits=d,ye;t.adler=a.check=1,a.mode=Se;case Se:if(e===ge||e===pe)break t;case De:if(a.last){h>>>=7&d,d-=7&d,a.mode=Fe;break;}for(;d<3;){if(0===o)break t;o--,h+=i[s++]<<d,d+=8;}switch(a.last=1&h,h>>>=1,d-=1,3&h){case 0:a.mode=16193;break;case 1:if(Xe(a),a.mode=Oe,e===pe){h>>>=2,d-=2;break t;}break;case 2:a.mode=16196;break;case 3:t.msg="invalid block type",a.mode=Le;}h>>>=2,d-=2;break;case 16193:for(h>>>=7&d,d-=7&d;d<32;){if(0===o)break t;o--,h+=i[s++]<<d,d+=8;}if((65535&h)!=(h>>>16^65535)){t.msg="invalid stored block lengths",a.mode=Le;break;}if(a.length=65535&h,h=0,d=0,a.mode=Te,e===pe)break t;case Te:a.mode=16195;case 16195:if(c=a.length,c){if(c>o&&(c=o),c>l&&(c=l),0===c)break t;n.set(i.subarray(s,s+c),r),o-=c,s+=c,l-=c,r+=c,a.length-=c;break;}a.mode=Se;break;case 16196:for(;d<14;){if(0===o)break t;o--,h+=i[s++]<<d,d+=8;}if(a.nlen=257+(31&h),h>>>=5,d-=5,a.ndist=1+(31&h),h>>>=5,d-=5,a.ncode=4+(15&h),h>>>=4,d-=4,a.nlen>286||a.ndist>30){t.msg="too many length or distance symbols",a.mode=Le;break;}a.have=0,a.mode=16197;case 16197:for(;a.have<a.ncode;){for(;d<3;){if(0===o)break t;o--,h+=i[s++]<<d,d+=8;}a.lens[Z[a.have++]]=7&h,h>>>=3,d-=3;}for(;a.have<19;)a.lens[Z[a.have++]]=0;if(a.lencode=a.lendyn,a.lenbits=7,E={bits:a.lenbits},x=me(0,a.lens,0,19,a.lencode,0,a.work,E),a.lenbits=E.bits,x){t.msg="invalid code lengths set",a.mode=Le;break;}a.have=0,a.mode=16198;case 16198:for(;a.have<a.nlen+a.ndist;){for(;z=a.lencode[h&(1<<a.lenbits)-1],m=z>>>24,b=z>>>16&255,g=65535&z,!(m<=d);){if(0===o)break t;o--,h+=i[s++]<<d,d+=8;}if(g<16)h>>>=m,d-=m,a.lens[a.have++]=g;else{if(16===g){for(R=m+2;d<R;){if(0===o)break t;o--,h+=i[s++]<<d,d+=8;}if(h>>>=m,d-=m,0===a.have){t.msg="invalid bit length repeat",a.mode=Le;break;}y=a.lens[a.have-1],c=3+(3&h),h>>>=2,d-=2;}else if(17===g){for(R=m+3;d<R;){if(0===o)break t;o--,h+=i[s++]<<d,d+=8;}h>>>=m,d-=m,y=0,c=3+(7&h),h>>>=3,d-=3;}else{for(R=m+7;d<R;){if(0===o)break t;o--,h+=i[s++]<<d,d+=8;}h>>>=m,d-=m,y=0,c=11+(127&h),h>>>=7,d-=7;}if(a.have+c>a.nlen+a.ndist){t.msg="invalid bit length repeat",a.mode=Le;break;}for(;c--;)a.lens[a.have++]=y;}}if(a.mode===Le)break;if(0===a.lens[256]){t.msg="invalid code -- missing end-of-block",a.mode=Le;break;}if(a.lenbits=9,E={bits:a.lenbits},x=me(1,a.lens,0,a.nlen,a.lencode,0,a.work,E),a.lenbits=E.bits,x){t.msg="invalid literal/lengths set",a.mode=Le;break;}if(a.distbits=6,a.distcode=a.distdyn,E={bits:a.distbits},x=me(2,a.lens,a.nlen,a.ndist,a.distcode,0,a.work,E),a.distbits=E.bits,x){t.msg="invalid distances set",a.mode=Le;break;}if(a.mode=Oe,e===pe)break t;case Oe:a.mode=Ie;case Ie:if(o>=6&&l>=258){t.next_out=r,t.avail_out=l,t.next_in=s,t.avail_in=o,a.hold=h,a.bits=d,de(t,f),r=t.next_out,n=t.output,l=t.avail_out,s=t.next_in,i=t.input,o=t.avail_in,h=a.hold,d=a.bits,a.mode===Se&&(a.back=-1);break;}for(a.back=0;z=a.lencode[h&(1<<a.lenbits)-1],m=z>>>24,b=z>>>16&255,g=65535&z,!(m<=d);){if(0===o)break t;o--,h+=i[s++]<<d,d+=8;}if(b&&0==(240&b)){for(p=m,k=b,v=g;z=a.lencode[v+((h&(1<<p+k)-1)>>p)],m=z>>>24,b=z>>>16&255,g=65535&z,!(p+m<=d);){if(0===o)break t;o--,h+=i[s++]<<d,d+=8;}h>>>=p,d-=p,a.back+=p;}if(h>>>=m,d-=m,a.back+=m,a.length=g,0===b){a.mode=16205;break;}if(32&b){a.back=-1,a.mode=Se;break;}if(64&b){t.msg="invalid literal/length code",a.mode=Le;break;}a.extra=15&b,a.mode=16201;case 16201:if(a.extra){for(R=a.extra;d<R;){if(0===o)break t;o--,h+=i[s++]<<d,d+=8;}a.length+=h&(1<<a.extra)-1,h>>>=a.extra,d-=a.extra,a.back+=a.extra;}a.was=a.length,a.mode=16202;case 16202:for(;z=a.distcode[h&(1<<a.distbits)-1],m=z>>>24,b=z>>>16&255,g=65535&z,!(m<=d);){if(0===o)break t;o--,h+=i[s++]<<d,d+=8;}if(0==(240&b)){for(p=m,k=b,v=g;z=a.distcode[v+((h&(1<<p+k)-1)>>p)],m=z>>>24,b=z>>>16&255,g=65535&z,!(p+m<=d);){if(0===o)break t;o--,h+=i[s++]<<d,d+=8;}h>>>=p,d-=p,a.back+=p;}if(h>>>=m,d-=m,a.back+=m,64&b){t.msg="invalid distance code",a.mode=Le;break;}a.offset=g,a.extra=15&b,a.mode=16203;case 16203:if(a.extra){for(R=a.extra;d<R;){if(0===o)break t;o--,h+=i[s++]<<d,d+=8;}a.offset+=h&(1<<a.extra)-1,h>>>=a.extra,d-=a.extra,a.back+=a.extra;}if(a.offset>a.dmax){t.msg="invalid distance too far back",a.mode=Le;break;}a.mode=16204;case 16204:if(0===l)break t;if(c=f-l,a.offset>c){if(c=a.offset-c,c>a.whave&&a.sane){t.msg="invalid distance too far back",a.mode=Le;break;}c>a.wnext?(c-=a.wnext,u=a.wsize-c):u=a.wnext-c,c>a.length&&(c=a.length),w=a.window;}else w=n,u=r-a.offset,c=a.length;c>l&&(c=l),l-=c,a.length-=c;do{n[r++]=w[u++];}while(--c);0===a.length&&(a.mode=Ie);break;case 16205:if(0===l)break t;n[r++]=a.length,l--,a.mode=Ie;break;case Fe:if(a.wrap){for(;d<32;){if(0===o)break t;o--,h|=i[s++]<<d,d+=8;}if(f-=l,t.total_out+=f,a.total+=f,4&a.wrap&&f&&(t.adler=a.check=a.flags?H(a.check,n,f,r-f):C(a.check,n,f,r-f)),f=l,4&a.wrap&&(a.flags?h:Ne(h))!==a.check){t.msg="incorrect data check",a.mode=Le;break;}h=0,d=0;}a.mode=16207;case 16207:if(a.wrap&&a.flags){for(;d<32;){if(0===o)break t;o--,h+=i[s++]<<d,d+=8;}if(4&a.wrap&&h!==(4294967295&a.total)){t.msg="incorrect length check",a.mode=Le;break;}h=0,d=0;}a.mode=16208;case 16208:x=ve;break t;case Le:x=ze;break t;case 16210:return Ae;default:return xe;}return t.next_out=r,t.avail_out=l,t.next_in=s,t.avail_in=o,a.hold=h,a.bits=d,(a.wsize||f!==t.avail_out&&a.mode<Le&&(a.mode<Fe||e!==be))&&We(t,t.output,t.next_out,f-t.avail_out),_-=t.avail_in,f-=t.avail_out,t.total_in+=_,t.total_out+=f,a.total+=f,4&a.wrap&&f&&(t.adler=a.check=a.flags?H(a.check,n,f,t.next_out-f):C(a.check,n,f,t.next_out-f)),t.data_type=a.bits+(a.last?64:0)+(a.mode===Se?128:0)+(a.mode===Oe||a.mode===Te?256:0),(0===_&&0===f||e===be)&&x===ke&&(x=Ee),x;},inflateEnd:function inflateEnd(t){if(Ce(t))return xe;var e=t.state;return e.window&&(e.window=null),t.state=null,ke;},inflateGetHeader:function inflateGetHeader(t,e){if(Ce(t))return xe;var a=t.state;return 0==(2&a.wrap)?xe:(a.head=e,e.done=!1,ke);},inflateSetDictionary:function inflateSetDictionary(t,e){var a=e.length;var i,n,s;return Ce(t)?xe:(i=t.state,0!==i.wrap&&i.mode!==Ue?xe:i.mode===Ue&&(n=1,n=C(n,e,a,0),n!==i.check)?ze:(s=We(t,e,a,a),s?(i.mode=16210,Ae):(i.havedict=1,ke)));},inflateInfo:"pako inflate (from Nodeca project)"};var Je=function Je(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1;};var Qe=Object.prototype.toString,Ve=K.Z_NO_FLUSH,$e=K.Z_FINISH,ta=K.Z_OK,ea=K.Z_STREAM_END,aa=K.Z_NEED_DICT,ia=K.Z_STREAM_ERROR,na=K.Z_DATA_ERROR,sa=K.Z_MEM_ERROR;function ra(t){this.options=jt({chunkSize:65536,windowBits:15,to:""},t||{});var e=this.options;e.raw&&e.windowBits>=0&&e.windowBits<16&&(e.windowBits=-e.windowBits,0===e.windowBits&&(e.windowBits=-15)),!(e.windowBits>=0&&e.windowBits<16)||t&&t.windowBits||(e.windowBits+=32),e.windowBits>15&&e.windowBits<48&&0==(15&e.windowBits)&&(e.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new qt(),this.strm.avail_out=0;var a=qe.inflateInit2(this.strm,e.windowBits);if(a!==ta)throw new Error(j[a]);if(this.header=new Je(),qe.inflateGetHeader(this.strm,this.header),e.dictionary&&("string"==typeof e.dictionary?e.dictionary=Gt(e.dictionary):"[object ArrayBuffer]"===Qe.call(e.dictionary)&&(e.dictionary=new Uint8Array(e.dictionary)),e.raw&&(a=qe.inflateSetDictionary(this.strm,e.dictionary),a!==ta)))throw new Error(j[a]);}function oa(t,e){var a=new ra(e);if(a.push(t),a.err)throw a.msg||j[a.err];return a.result;}ra.prototype.push=function(t,e){var a=this.strm,i=this.options.chunkSize,n=this.options.dictionary;var s,r,o;if(this.ended)return!1;for(r=e===~~e?e:!0===e?$e:Ve,"[object ArrayBuffer]"===Qe.call(t)?a.input=new Uint8Array(t):a.input=t,a.next_in=0,a.avail_in=a.input.length;;){for(0===a.avail_out&&(a.output=new Uint8Array(i),a.next_out=0,a.avail_out=i),s=qe.inflate(a,r),s===aa&&n&&(s=qe.inflateSetDictionary(a,n),s===ta?s=qe.inflate(a,r):s===na&&(s=aa));a.avail_in>0&&s===ea&&a.state.wrap>0&&0!==t[a.next_in];)qe.inflateReset(a),s=qe.inflate(a,r);switch(s){case ia:case na:case aa:case sa:return this.onEnd(s),this.ended=!0,!1;}if(o=a.avail_out,a.next_out&&(0===a.avail_out||s===ea))if("string"===this.options.to){var _t6=Wt(a.output,a.next_out),_e12=a.next_out-_t6,_n5=Xt(a.output,_t6);a.next_out=_e12,a.avail_out=i-_e12,_e12&&a.output.set(a.output.subarray(_t6,_t6+_e12),0),this.onData(_n5);}else this.onData(a.output.length===a.next_out?a.output:a.output.subarray(0,a.next_out));if(s!==ta||0!==o){if(s===ea)return s=qe.inflateEnd(this.strm),this.onEnd(s),this.ended=!0,!0;if(0===a.avail_in)break;}}return!0;},ra.prototype.onData=function(t){this.chunks.push(t);},ra.prototype.onEnd=function(t){t===ta&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=Kt(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg;};var la={Inflate:ra,inflate:oa,inflateRaw:function inflateRaw(t,e){return(e=e||{}).raw=!0,oa(t,e);},ungzip:oa,constants:K};var ha=le.Deflate,da=le.deflate,_a=le.deflateRaw,fa=le.gzip,ca=la.Inflate,ua=la.inflate,wa=la.inflateRaw,ma=la.ungzip;var ba=ha,ga=da,pa=_a,ka=fa,va=ca,ya=ua,xa=wa,za=ma,Aa=K,Ea={Deflate:ba,deflate:ga,deflateRaw:pa,gzip:ka,Inflate:va,inflate:ya,inflateRaw:xa,ungzip:za,constants:Aa};t.Deflate=ba,t.Inflate=va,t.constants=Aa,t["default"]=Ea,t.deflate=ga,t.deflateRaw=pa,t.gzip=ka,t.inflate=ya,t.inflateRaw=xa,t.ungzip=za,Object.defineProperty(t,"__esModule",{value:!0});});var p=/*#__PURE__*/Object.freeze({__proto__:null});/*
27813
28060
  Parser for .XTC Format V10
27814
28061
  */var pako=window.pako||p;if(!pako.inflate){// See https://github.com/nodeca/pako/issues/97
27815
- pako=pako["default"];}var tempVec4a=math.vec4();var tempVec4b=math.vec4();var NUM_TEXTURE_ATTRIBUTES=9;function extract(elements){var i=0;return{metadata:elements[i++],textureData:elements[i++],eachTextureDataPortion:elements[i++],eachTextureAttributes:elements[i++],positions:elements[i++],normals:elements[i++],colors:elements[i++],uvs:elements[i++],indices:elements[i++],edgeIndices:elements[i++],eachTextureSetTextures:elements[i++],matrices:elements[i++],reusedGeometriesDecodeMatrix:elements[i++],eachGeometryPrimitiveType:elements[i++],eachGeometryPositionsPortion:elements[i++],eachGeometryNormalsPortion:elements[i++],eachGeometryColorsPortion:elements[i++],eachGeometryUVsPortion:elements[i++],eachGeometryIndicesPortion:elements[i++],eachGeometryEdgeIndicesPortion:elements[i++],eachMeshGeometriesPortion:elements[i++],eachMeshMatricesPortion:elements[i++],eachMeshTextureSet:elements[i++],eachMeshMaterialAttributes:elements[i++],eachEntityId:elements[i++],eachEntityMeshesPortion:elements[i++],eachTileAABB:elements[i++],eachTileEntitiesPortion:elements[i++]};}function inflate(deflatedData){function inflate(array,options){return array.length===0?[]:pako.inflate(array,options).buffer;}return{metadata:JSON.parse(pako.inflate(deflatedData.metadata,{to:"string"})),textureData:new Uint8Array(inflate(deflatedData.textureData)),// <<----------------------------- ??? ZIPPing to blame?
27816
- eachTextureDataPortion:new Uint32Array(inflate(deflatedData.eachTextureDataPortion)),eachTextureAttributes:new Uint16Array(inflate(deflatedData.eachTextureAttributes)),positions:new Uint16Array(inflate(deflatedData.positions)),normals:new Int8Array(inflate(deflatedData.normals)),colors:new Uint8Array(inflate(deflatedData.colors)),uvs:new Float32Array(inflate(deflatedData.uvs)),indices:new Uint32Array(inflate(deflatedData.indices)),edgeIndices:new Uint32Array(inflate(deflatedData.edgeIndices)),eachTextureSetTextures:new Int32Array(inflate(deflatedData.eachTextureSetTextures)),matrices:new Float32Array(inflate(deflatedData.matrices)),reusedGeometriesDecodeMatrix:new Float32Array(inflate(deflatedData.reusedGeometriesDecodeMatrix)),eachGeometryPrimitiveType:new Uint8Array(inflate(deflatedData.eachGeometryPrimitiveType)),eachGeometryPositionsPortion:new Uint32Array(inflate(deflatedData.eachGeometryPositionsPortion)),eachGeometryNormalsPortion:new Uint32Array(inflate(deflatedData.eachGeometryNormalsPortion)),eachGeometryColorsPortion:new Uint32Array(inflate(deflatedData.eachGeometryColorsPortion)),eachGeometryUVsPortion:new Uint32Array(inflate(deflatedData.eachGeometryUVsPortion)),eachGeometryIndicesPortion:new Uint32Array(inflate(deflatedData.eachGeometryIndicesPortion)),eachGeometryEdgeIndicesPortion:new Uint32Array(inflate(deflatedData.eachGeometryEdgeIndicesPortion)),eachMeshGeometriesPortion:new Uint32Array(inflate(deflatedData.eachMeshGeometriesPortion)),eachMeshMatricesPortion:new Uint32Array(inflate(deflatedData.eachMeshMatricesPortion)),eachMeshTextureSet:new Int32Array(inflate(deflatedData.eachMeshTextureSet)),// Can be -1
27817
- eachMeshMaterialAttributes:new Uint8Array(inflate(deflatedData.eachMeshMaterialAttributes)),eachEntityId:JSON.parse(pako.inflate(deflatedData.eachEntityId,{to:"string"})),eachEntityMeshesPortion:new Uint32Array(inflate(deflatedData.eachEntityMeshesPortion)),eachTileAABB:new Float64Array(inflate(deflatedData.eachTileAABB)),eachTileEntitiesPortion:new Uint32Array(inflate(deflatedData.eachTileEntitiesPortion))};}function inflateMetadata(deflatedData){return JSON.parse(pako.inflate(deflatedData,{to:"string"}));}var decompressColor=function(){var floatColor=new Float32Array(3);return function(intColor){floatColor[0]=intColor[0]/255.0;floatColor[1]=intColor[1]/255.0;floatColor[2]=intColor[2]/255.0;return floatColor;};}();(function(){var canvas=document.createElement("canvas");var context=canvas.getContext("2d");return function(imagedata){canvas.width=imagedata.width;canvas.height=imagedata.height;context.putImageData(imagedata,0,0);return canvas.toDataURL();};})();function load(viewer,options,inflatedData,sceneModel,metaModel,manifestCtx){var modelPartId=manifestCtx.getNextId();var metadata=inflatedData.metadata;var textureData=inflatedData.textureData;var eachTextureDataPortion=inflatedData.eachTextureDataPortion;var eachTextureAttributes=inflatedData.eachTextureAttributes;var positions=inflatedData.positions;var normals=inflatedData.normals;var colors=inflatedData.colors;var uvs=inflatedData.uvs;var indices=inflatedData.indices;var edgeIndices=inflatedData.edgeIndices;var eachTextureSetTextures=inflatedData.eachTextureSetTextures;var matrices=inflatedData.matrices;var reusedGeometriesDecodeMatrix=inflatedData.reusedGeometriesDecodeMatrix;var eachGeometryPrimitiveType=inflatedData.eachGeometryPrimitiveType;var eachGeometryPositionsPortion=inflatedData.eachGeometryPositionsPortion;var eachGeometryNormalsPortion=inflatedData.eachGeometryNormalsPortion;var eachGeometryColorsPortion=inflatedData.eachGeometryColorsPortion;var eachGeometryUVsPortion=inflatedData.eachGeometryUVsPortion;var eachGeometryIndicesPortion=inflatedData.eachGeometryIndicesPortion;var eachGeometryEdgeIndicesPortion=inflatedData.eachGeometryEdgeIndicesPortion;var eachMeshGeometriesPortion=inflatedData.eachMeshGeometriesPortion;var eachMeshMatricesPortion=inflatedData.eachMeshMatricesPortion;var eachMeshTextureSet=inflatedData.eachMeshTextureSet;var eachMeshMaterialAttributes=inflatedData.eachMeshMaterialAttributes;var eachEntityId=inflatedData.eachEntityId;var eachEntityMeshesPortion=inflatedData.eachEntityMeshesPortion;var eachTileAABB=inflatedData.eachTileAABB;var eachTileEntitiesPortion=inflatedData.eachTileEntitiesPortion;var numTextures=eachTextureDataPortion.length;var numTextureSets=eachTextureSetTextures.length/5;var numGeometries=eachGeometryPositionsPortion.length;var numMeshes=eachMeshGeometriesPortion.length;var numEntities=eachEntityMeshesPortion.length;var numTiles=eachTileEntitiesPortion.length;// Metadata
28062
+ pako=pako["default"];}var tempVec4a=math.vec4();var tempVec4b=math.vec4();var NUM_TEXTURE_ATTRIBUTES=9;/**
28063
+ * Ordered element schema for .XTC V10.
28064
+ *
28065
+ * Each entry: [elementName, TypedArrayConstructor | "json"]
28066
+ *
28067
+ * The order MUST match the element order within the XTC binary. "json" elements are
28068
+ * deflated JSON strings, everything else is a deflated binary buffer.
28069
+ *
28070
+ * Shared by the synchronous inflate path and the Web Worker inflate path, so that
28071
+ * both reconstruct identical inflated-data objects.
28072
+ */var ELEMENT_SPECS=[["metadata","json"],["textureData",Uint8Array],["eachTextureDataPortion",Uint32Array],["eachTextureAttributes",Uint16Array],["positions",Uint16Array],["normals",Int8Array],["colors",Uint8Array],["uvs",Float32Array],["indices",Uint32Array],["edgeIndices",Uint32Array],["eachTextureSetTextures",Int32Array],["matrices",Float32Array],["reusedGeometriesDecodeMatrix",Float32Array],["eachGeometryPrimitiveType",Uint8Array],["eachGeometryPositionsPortion",Uint32Array],["eachGeometryNormalsPortion",Uint32Array],["eachGeometryColorsPortion",Uint32Array],["eachGeometryUVsPortion",Uint32Array],["eachGeometryIndicesPortion",Uint32Array],["eachGeometryEdgeIndicesPortion",Uint32Array],["eachMeshGeometriesPortion",Uint32Array],["eachMeshMatricesPortion",Uint32Array],["eachMeshTextureSet",Int32Array],["eachMeshMaterialAttributes",Uint8Array],["eachEntityId","json"],["eachEntityMeshesPortion",Uint32Array],["eachTileAABB",Float64Array],["eachTileEntitiesPortion",Uint32Array]];function extract(elements){var deflatedData={};for(var _i592=0;_i592<ELEMENT_SPECS.length;_i592++){deflatedData[ELEMENT_SPECS[_i592][0]]=elements[_i592];}return deflatedData;}function inflate(deflatedData){var inflatedData={};for(var _i593=0;_i593<ELEMENT_SPECS.length;_i593++){var spec=ELEMENT_SPECS[_i593];var _name8=spec[0];var type=spec[1];var deflated=deflatedData[_name8];if(type==="json"){inflatedData[_name8]=JSON.parse(pako.inflate(deflated,{to:"string"}));}else{inflatedData[_name8]=new type(deflated.length===0?[]:pako.inflate(deflated).buffer);}}return inflatedData;}/**
28073
+ * Builds transfer-friendly descriptors of the deflated elements, so the whole XTC
28074
+ * ArrayBuffer can be transferred to a Web Worker which then inflates each segment.
28075
+ *
28076
+ * @param {Uint8Array[]} elements Deflated elements extracted from the XTC binary.
28077
+ * @returns {{name: string, byteOffset: number, byteLength: number, json: boolean}[]}
28078
+ */function getDeflatedSegments(elements){var segments=[];for(var _i594=0;_i594<ELEMENT_SPECS.length;_i594++){var view=elements[_i594];segments.push({name:ELEMENT_SPECS[_i594][0],byteOffset:view.byteOffset,byteLength:view.byteLength,json:ELEMENT_SPECS[_i594][1]==="json"});}return segments;}/**
28079
+ * Reconstructs the inflated-data object from the results posted back by the inflate worker.
28080
+ *
28081
+ * @param {(ArrayBuffer|string)[]} results Inflated results in ELEMENT_SPECS order -
28082
+ * ArrayBuffers for binary elements, strings for "json" elements.
28083
+ * @returns {*} The same inflated-data structure produced by the synchronous inflate path.
28084
+ */function wrapInflatedResults(results){var inflatedData={};for(var _i595=0;_i595<ELEMENT_SPECS.length;_i595++){var spec=ELEMENT_SPECS[_i595];var _name9=spec[0];var type=spec[1];var result=results[_i595];inflatedData[_name9]=type==="json"?JSON.parse(result):new type(result);}return inflatedData;}function inflateMetadata(deflatedData){return JSON.parse(pako.inflate(deflatedData,{to:"string"}));}var decompressColor=function(){var floatColor=new Float32Array(3);return function(intColor){floatColor[0]=intColor[0]/255.0;floatColor[1]=intColor[1]/255.0;floatColor[2]=intColor[2]/255.0;return floatColor;};}();(function(){var canvas=document.createElement("canvas");var context=canvas.getContext("2d");return function(imagedata){canvas.width=imagedata.width;canvas.height=imagedata.height;context.putImageData(imagedata,0,0);return canvas.toDataURL();};})();function load(viewer,options,inflatedData,sceneModel,metaModel,manifestCtx){var modelPartId=manifestCtx.getNextId();var metadata=inflatedData.metadata;var textureData=inflatedData.textureData;var eachTextureDataPortion=inflatedData.eachTextureDataPortion;var eachTextureAttributes=inflatedData.eachTextureAttributes;var positions=inflatedData.positions;var normals=inflatedData.normals;var colors=inflatedData.colors;var uvs=inflatedData.uvs;var indices=inflatedData.indices;var edgeIndices=inflatedData.edgeIndices;var eachTextureSetTextures=inflatedData.eachTextureSetTextures;var matrices=inflatedData.matrices;var reusedGeometriesDecodeMatrix=inflatedData.reusedGeometriesDecodeMatrix;var eachGeometryPrimitiveType=inflatedData.eachGeometryPrimitiveType;var eachGeometryPositionsPortion=inflatedData.eachGeometryPositionsPortion;var eachGeometryNormalsPortion=inflatedData.eachGeometryNormalsPortion;var eachGeometryColorsPortion=inflatedData.eachGeometryColorsPortion;var eachGeometryUVsPortion=inflatedData.eachGeometryUVsPortion;var eachGeometryIndicesPortion=inflatedData.eachGeometryIndicesPortion;var eachGeometryEdgeIndicesPortion=inflatedData.eachGeometryEdgeIndicesPortion;var eachMeshGeometriesPortion=inflatedData.eachMeshGeometriesPortion;var eachMeshMatricesPortion=inflatedData.eachMeshMatricesPortion;var eachMeshTextureSet=inflatedData.eachMeshTextureSet;var eachMeshMaterialAttributes=inflatedData.eachMeshMaterialAttributes;var eachEntityId=inflatedData.eachEntityId;var eachEntityMeshesPortion=inflatedData.eachEntityMeshesPortion;var eachTileAABB=inflatedData.eachTileAABB;var eachTileEntitiesPortion=inflatedData.eachTileEntitiesPortion;var numTextures=eachTextureDataPortion.length;var numTextureSets=eachTextureSetTextures.length/5;var numGeometries=eachGeometryPositionsPortion.length;var numMeshes=eachMeshGeometriesPortion.length;var numEntities=eachEntityMeshesPortion.length;var numTiles=eachTileEntitiesPortion.length;// Metadata
27818
28085
  if(metaModel){metaModel.loadData(metadata,{includeTypes:options.includeTypes,excludeTypes:options.excludeTypes,globalizeObjectIds:options.globalizeObjectIds});// Can be empty
27819
28086
  }// Create textures
27820
28087
  for(var textureIndex=0;textureIndex<numTextures;textureIndex++){var atLastTexture=textureIndex===numTextures-1;var textureDataPortionStart=eachTextureDataPortion[textureIndex];var textureDataPortionEnd=atLastTexture?textureData.length:eachTextureDataPortion[textureIndex+1];var textureDataPortionSize=textureDataPortionEnd-textureDataPortionStart;var textureDataPortionExists=textureDataPortionSize>0;var textureAttrBaseIdx=textureIndex*NUM_TEXTURE_ATTRIBUTES;var compressed=eachTextureAttributes[textureAttrBaseIdx+0]===1;eachTextureAttributes[textureAttrBaseIdx+1];eachTextureAttributes[textureAttrBaseIdx+2];eachTextureAttributes[textureAttrBaseIdx+3];var minFilter=eachTextureAttributes[textureAttrBaseIdx+4];var magFilter=eachTextureAttributes[textureAttrBaseIdx+5];// LinearFilter | NearestFilter
@@ -27830,8 +28097,54 @@ if(options.excludeTypesMap&&metaObject.type&&options.excludeTypesMap[metaObject.
27830
28097
  var props=options.objectDefaults?options.objectDefaults[metaObject.type]||options.objectDefaults["DEFAULT"]:null;if(props){if(props.visible===false){entityDefaults.visible=false;}if(props.pickable===false){entityDefaults.pickable=false;}if(props.colorize){meshDefaults.color=props.colorize;}if(props.opacity!==undefined&&props.opacity!==null){meshDefaults.opacity=props.opacity;}if(props.metallic!==undefined&&props.metallic!==null){meshDefaults.metallic=props.metallic;}if(props.roughness!==undefined&&props.roughness!==null){meshDefaults.roughness=props.roughness;}}}else{if(options.excludeUnclassifiedObjects){continue;}}// Iterate each entity's meshes
27831
28098
  for(var _meshIndex=firstMeshIndex;_meshIndex<=lastMeshIndex;_meshIndex++){var _geometryIndex=eachMeshGeometriesPortion[_meshIndex];var geometryReuseCount=geometryReuseCounts[_geometryIndex];var isReusedGeometry=geometryReuseCount>1;var atLastGeometry=_geometryIndex===numGeometries-1;var _textureSetIndex=eachMeshTextureSet[_meshIndex];var _textureSetId=_textureSetIndex>=0?"".concat(modelPartId,"-textureSet-").concat(_textureSetIndex):null;var meshColor=decompressColor(eachMeshMaterialAttributes.subarray(_meshIndex*6,_meshIndex*6+3));var meshOpacity=eachMeshMaterialAttributes[_meshIndex*6+3]/255.0;var meshMetallic=eachMeshMaterialAttributes[_meshIndex*6+4]/255.0;var meshRoughness=eachMeshMaterialAttributes[_meshIndex*6+5]/255.0;var meshId=manifestCtx.getNextId();if(isReusedGeometry){// Create mesh for multi-use geometry - create (or reuse) geometry, create mesh using that geometry
27832
28099
  var meshMatrixIndex=eachMeshMatricesPortion[_meshIndex];var meshMatrix=matrices.slice(meshMatrixIndex,meshMatrixIndex+16);var geometryId="".concat(modelPartId,"-geometry.").concat(tileIndex,".").concat(_geometryIndex);// These IDs are local to the SceneModel
27833
- var geometryArrays=geometryArraysCache[geometryId];if(!geometryArrays){geometryArrays={batchThisMesh:!options.reuseGeometries};var primitiveType=eachGeometryPrimitiveType[_geometryIndex];var geometryValid=false;switch(primitiveType){case 0:geometryArrays.primitiveName="solid";geometryArrays.geometryPositions=positions.subarray(eachGeometryPositionsPortion[_geometryIndex],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex+1]);geometryArrays.geometryNormals=normals.subarray(eachGeometryNormalsPortion[_geometryIndex],atLastGeometry?normals.length:eachGeometryNormalsPortion[_geometryIndex+1]);geometryArrays.geometryUVs=uvs.subarray(eachGeometryUVsPortion[_geometryIndex],atLastGeometry?uvs.length:eachGeometryUVsPortion[_geometryIndex+1]);geometryArrays.geometryIndices=indices.subarray(eachGeometryIndicesPortion[_geometryIndex],atLastGeometry?indices.length:eachGeometryIndicesPortion[_geometryIndex+1]);geometryArrays.geometryEdgeIndices=edgeIndices.subarray(eachGeometryEdgeIndicesPortion[_geometryIndex],atLastGeometry?edgeIndices.length:eachGeometryEdgeIndicesPortion[_geometryIndex+1]);geometryValid=geometryArrays.geometryPositions.length>0&&geometryArrays.geometryIndices.length>0;break;case 1:geometryArrays.primitiveName="surface";geometryArrays.geometryPositions=positions.subarray(eachGeometryPositionsPortion[_geometryIndex],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex+1]);geometryArrays.geometryNormals=normals.subarray(eachGeometryNormalsPortion[_geometryIndex],atLastGeometry?normals.length:eachGeometryNormalsPortion[_geometryIndex+1]);geometryArrays.geometryUVs=uvs.subarray(eachGeometryUVsPortion[_geometryIndex],atLastGeometry?uvs.length:eachGeometryUVsPortion[_geometryIndex+1]);geometryArrays.geometryIndices=indices.subarray(eachGeometryIndicesPortion[_geometryIndex],atLastGeometry?indices.length:eachGeometryIndicesPortion[_geometryIndex+1]);geometryArrays.geometryEdgeIndices=edgeIndices.subarray(eachGeometryEdgeIndicesPortion[_geometryIndex],atLastGeometry?edgeIndices.length:eachGeometryEdgeIndicesPortion[_geometryIndex+1]);geometryValid=geometryArrays.geometryPositions.length>0&&geometryArrays.geometryIndices.length>0;break;case 2:geometryArrays.primitiveName="points";geometryArrays.geometryPositions=positions.subarray(eachGeometryPositionsPortion[_geometryIndex],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex+1]);geometryArrays.geometryColors=colors.subarray(eachGeometryColorsPortion[_geometryIndex],atLastGeometry?colors.length:eachGeometryColorsPortion[_geometryIndex+1]);geometryValid=geometryArrays.geometryPositions.length>0;break;case 3:geometryArrays.primitiveName="lines";geometryArrays.geometryPositions=positions.subarray(eachGeometryPositionsPortion[_geometryIndex],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex+1]);geometryArrays.geometryIndices=indices.subarray(eachGeometryIndicesPortion[_geometryIndex],atLastGeometry?indices.length:eachGeometryIndicesPortion[_geometryIndex+1]);geometryValid=geometryArrays.geometryPositions.length>0&&geometryArrays.geometryIndices.length>0;break;case 4:geometryArrays.primitiveName="lines";geometryArrays.geometryPositions=positions.subarray(eachGeometryPositionsPortion[_geometryIndex],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex+1]);geometryArrays.geometryIndices=lineStripToLines(geometryArrays.geometryPositions,indices.subarray(eachGeometryIndicesPortion[_geometryIndex],atLastGeometry?indices.length:eachGeometryIndicesPortion[_geometryIndex+1]));geometryValid=geometryArrays.geometryPositions.length>0&&geometryArrays.geometryIndices.length>0;break;default:continue;}if(!geometryValid){geometryArrays=null;}if(geometryArrays){if(geometryArrays.geometryPositions.length>1000);if(geometryArrays.batchThisMesh){geometryArrays.decompressedPositions=new Float32Array(geometryArrays.geometryPositions.length);geometryArrays.transformedAndRecompressedPositions=new Uint16Array(geometryArrays.geometryPositions.length);var geometryPositions=geometryArrays.geometryPositions;var decompressedPositions=geometryArrays.decompressedPositions;for(var _i592=0,len=geometryPositions.length;_i592<len;_i592+=3){decompressedPositions[_i592+0]=geometryPositions[_i592+0]*reusedGeometriesDecodeMatrix[0]+reusedGeometriesDecodeMatrix[12];decompressedPositions[_i592+1]=geometryPositions[_i592+1]*reusedGeometriesDecodeMatrix[5]+reusedGeometriesDecodeMatrix[13];decompressedPositions[_i592+2]=geometryPositions[_i592+2]*reusedGeometriesDecodeMatrix[10]+reusedGeometriesDecodeMatrix[14];}geometryArrays.geometryPositions=null;geometryArraysCache[geometryId]=geometryArrays;}}}if(geometryArrays){if(geometryArrays.batchThisMesh){var _decompressedPositions=geometryArrays.decompressedPositions;var transformedAndRecompressedPositions=geometryArrays.transformedAndRecompressedPositions;for(var _i593=0,_len109=_decompressedPositions.length;_i593<_len109;_i593+=3){tempVec4a[0]=_decompressedPositions[_i593+0];tempVec4a[1]=_decompressedPositions[_i593+1];tempVec4a[2]=_decompressedPositions[_i593+2];tempVec4a[3]=1;math.transformVec4(meshMatrix,tempVec4a,tempVec4b);geometryCompressionUtils.compressPosition(tempVec4b,rtcAABB,tempVec4a);transformedAndRecompressedPositions[_i593+0]=tempVec4a[0];transformedAndRecompressedPositions[_i593+1]=tempVec4a[1];transformedAndRecompressedPositions[_i593+2]=tempVec4a[2];}sceneModel.createMesh(utils.apply(meshDefaults,{id:meshId,textureSetId:_textureSetId,origin:tileCenter,primitive:geometryArrays.primitiveName,positionsCompressed:transformedAndRecompressedPositions,normalsCompressed:geometryArrays.geometryNormals,uv:geometryArrays.geometryUVs,colorsCompressed:geometryArrays.geometryColors,indices:geometryArrays.geometryIndices,edgeIndices:geometryArrays.geometryEdgeIndices,positionsDecodeMatrix:tileDecodeMatrix,color:meshColor,metallic:meshMetallic,roughness:meshRoughness,opacity:meshOpacity}));meshIds.push(meshId);}else{if(!geometryCreatedInTile[geometryId]){sceneModel.createGeometry({id:geometryId,primitive:geometryArrays.primitiveName,positionsCompressed:geometryArrays.geometryPositions,normalsCompressed:geometryArrays.geometryNormals,uv:geometryArrays.geometryUVs,colorsCompressed:geometryArrays.geometryColors,indices:geometryArrays.geometryIndices,edgeIndices:geometryArrays.geometryEdgeIndices,positionsDecodeMatrix:reusedGeometriesDecodeMatrix});geometryCreatedInTile[geometryId]=true;}sceneModel.createMesh(utils.apply(meshDefaults,{id:meshId,geometryId:geometryId,textureSetId:_textureSetId,matrix:meshMatrix,color:meshColor,metallic:meshMetallic,roughness:meshRoughness,opacity:meshOpacity,origin:tileCenter}));meshIds.push(meshId);}}}else{// Do not reuse geometry
27834
- var _primitiveType=eachGeometryPrimitiveType[_geometryIndex];var primitiveName=void 0;var _geometryPositions=void 0;var geometryNormals=void 0;var geometryUVs=void 0;var geometryColors=void 0;var geometryIndices=void 0;var geometryEdgeIndices=void 0;var _geometryValid=false;switch(_primitiveType){case 0:primitiveName="solid";_geometryPositions=positions.subarray(eachGeometryPositionsPortion[_geometryIndex],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex+1]);geometryNormals=normals.subarray(eachGeometryNormalsPortion[_geometryIndex],atLastGeometry?normals.length:eachGeometryNormalsPortion[_geometryIndex+1]);geometryUVs=uvs.subarray(eachGeometryUVsPortion[_geometryIndex],atLastGeometry?uvs.length:eachGeometryUVsPortion[_geometryIndex+1]);geometryIndices=indices.subarray(eachGeometryIndicesPortion[_geometryIndex],atLastGeometry?indices.length:eachGeometryIndicesPortion[_geometryIndex+1]);geometryEdgeIndices=edgeIndices.subarray(eachGeometryEdgeIndicesPortion[_geometryIndex],atLastGeometry?edgeIndices.length:eachGeometryEdgeIndicesPortion[_geometryIndex+1]);_geometryValid=_geometryPositions.length>0&&geometryIndices.length>0;break;case 1:primitiveName="surface";_geometryPositions=positions.subarray(eachGeometryPositionsPortion[_geometryIndex],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex+1]);geometryNormals=normals.subarray(eachGeometryNormalsPortion[_geometryIndex],atLastGeometry?normals.length:eachGeometryNormalsPortion[_geometryIndex+1]);geometryUVs=uvs.subarray(eachGeometryUVsPortion[_geometryIndex],atLastGeometry?uvs.length:eachGeometryUVsPortion[_geometryIndex+1]);geometryIndices=indices.subarray(eachGeometryIndicesPortion[_geometryIndex],atLastGeometry?indices.length:eachGeometryIndicesPortion[_geometryIndex+1]);geometryEdgeIndices=edgeIndices.subarray(eachGeometryEdgeIndicesPortion[_geometryIndex],atLastGeometry?edgeIndices.length:eachGeometryEdgeIndicesPortion[_geometryIndex+1]);_geometryValid=_geometryPositions.length>0&&geometryIndices.length>0;break;case 2:primitiveName="points";_geometryPositions=positions.subarray(eachGeometryPositionsPortion[_geometryIndex],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex+1]);geometryColors=colors.subarray(eachGeometryColorsPortion[_geometryIndex],atLastGeometry?colors.length:eachGeometryColorsPortion[_geometryIndex+1]);_geometryValid=_geometryPositions.length>0;break;case 3:primitiveName="lines";_geometryPositions=positions.subarray(eachGeometryPositionsPortion[_geometryIndex],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex+1]);geometryIndices=indices.subarray(eachGeometryIndicesPortion[_geometryIndex],atLastGeometry?indices.length:eachGeometryIndicesPortion[_geometryIndex+1]);_geometryValid=_geometryPositions.length>0&&geometryIndices.length>0;break;case 4:primitiveName="lines";_geometryPositions=positions.subarray(eachGeometryPositionsPortion[_geometryIndex],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex+1]);geometryIndices=lineStripToLines(_geometryPositions,indices.subarray(eachGeometryIndicesPortion[_geometryIndex],atLastGeometry?indices.length:eachGeometryIndicesPortion[_geometryIndex+1]));_geometryValid=_geometryPositions.length>0&&geometryIndices.length>0;break;default:continue;}if(_geometryValid){sceneModel.createMesh(utils.apply(meshDefaults,{id:meshId,textureSetId:_textureSetId,origin:tileCenter,primitive:primitiveName,positionsCompressed:_geometryPositions,normalsCompressed:geometryNormals,uv:geometryUVs&&geometryUVs.length>0?geometryUVs:null,colorsCompressed:geometryColors,indices:geometryIndices&&geometryIndices.length>0?geometryIndices:null,edgeIndices:geometryEdgeIndices,positionsDecodeMatrix:tileDecodeMatrix,color:meshColor,metallic:meshMetallic,roughness:meshRoughness,opacity:meshOpacity}));meshIds.push(meshId);}}}if(meshIds.length>0){sceneModel.createEntity(utils.apply(entityDefaults,{id:entityId,isObject:true,meshIds:meshIds}));}}}}function lineStripToLines(positions,indices){var linesIndices=[];if(indices.length>1){for(var _i594=0,len=indices.length-1;_i594<len;_i594++){linesIndices.push(indices[_i594]);linesIndices.push(indices[_i594+1]);}}else if(positions.length>1){for(var _i595=0,_len110=positions.length/3-1;_i595<_len110;_i595++){linesIndices.push(_i595);linesIndices.push(_i595+1);}}return linesIndices;}/** @private */var ParserV10={version:10,parse:function parse(viewer,options,elements,sceneModel,metaModel,manifestCtx){var deflatedData=extract(elements);var inflatedData=inflate(deflatedData);load(viewer,options,inflatedData,sceneModel,metaModel,manifestCtx);},inflateMetadata:inflateMetadata};var parsers={};// parsers[ParserV1.version] = ParserV1;
28100
+ var geometryArrays=geometryArraysCache[geometryId];if(!geometryArrays){geometryArrays={batchThisMesh:!options.reuseGeometries};var primitiveType=eachGeometryPrimitiveType[_geometryIndex];var geometryValid=false;switch(primitiveType){case 0:geometryArrays.primitiveName="solid";geometryArrays.geometryPositions=positions.subarray(eachGeometryPositionsPortion[_geometryIndex],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex+1]);geometryArrays.geometryNormals=normals.subarray(eachGeometryNormalsPortion[_geometryIndex],atLastGeometry?normals.length:eachGeometryNormalsPortion[_geometryIndex+1]);geometryArrays.geometryUVs=uvs.subarray(eachGeometryUVsPortion[_geometryIndex],atLastGeometry?uvs.length:eachGeometryUVsPortion[_geometryIndex+1]);geometryArrays.geometryIndices=indices.subarray(eachGeometryIndicesPortion[_geometryIndex],atLastGeometry?indices.length:eachGeometryIndicesPortion[_geometryIndex+1]);geometryArrays.geometryEdgeIndices=edgeIndices.subarray(eachGeometryEdgeIndicesPortion[_geometryIndex],atLastGeometry?edgeIndices.length:eachGeometryEdgeIndicesPortion[_geometryIndex+1]);geometryValid=geometryArrays.geometryPositions.length>0&&geometryArrays.geometryIndices.length>0;break;case 1:geometryArrays.primitiveName="surface";geometryArrays.geometryPositions=positions.subarray(eachGeometryPositionsPortion[_geometryIndex],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex+1]);geometryArrays.geometryNormals=normals.subarray(eachGeometryNormalsPortion[_geometryIndex],atLastGeometry?normals.length:eachGeometryNormalsPortion[_geometryIndex+1]);geometryArrays.geometryUVs=uvs.subarray(eachGeometryUVsPortion[_geometryIndex],atLastGeometry?uvs.length:eachGeometryUVsPortion[_geometryIndex+1]);geometryArrays.geometryIndices=indices.subarray(eachGeometryIndicesPortion[_geometryIndex],atLastGeometry?indices.length:eachGeometryIndicesPortion[_geometryIndex+1]);geometryArrays.geometryEdgeIndices=edgeIndices.subarray(eachGeometryEdgeIndicesPortion[_geometryIndex],atLastGeometry?edgeIndices.length:eachGeometryEdgeIndicesPortion[_geometryIndex+1]);geometryValid=geometryArrays.geometryPositions.length>0&&geometryArrays.geometryIndices.length>0;break;case 2:geometryArrays.primitiveName="points";geometryArrays.geometryPositions=positions.subarray(eachGeometryPositionsPortion[_geometryIndex],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex+1]);geometryArrays.geometryColors=colors.subarray(eachGeometryColorsPortion[_geometryIndex],atLastGeometry?colors.length:eachGeometryColorsPortion[_geometryIndex+1]);geometryValid=geometryArrays.geometryPositions.length>0;break;case 3:geometryArrays.primitiveName="lines";geometryArrays.geometryPositions=positions.subarray(eachGeometryPositionsPortion[_geometryIndex],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex+1]);geometryArrays.geometryIndices=indices.subarray(eachGeometryIndicesPortion[_geometryIndex],atLastGeometry?indices.length:eachGeometryIndicesPortion[_geometryIndex+1]);geometryValid=geometryArrays.geometryPositions.length>0&&geometryArrays.geometryIndices.length>0;break;case 4:geometryArrays.primitiveName="lines";geometryArrays.geometryPositions=positions.subarray(eachGeometryPositionsPortion[_geometryIndex],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex+1]);geometryArrays.geometryIndices=lineStripToLines(geometryArrays.geometryPositions,indices.subarray(eachGeometryIndicesPortion[_geometryIndex],atLastGeometry?indices.length:eachGeometryIndicesPortion[_geometryIndex+1]));geometryValid=geometryArrays.geometryPositions.length>0&&geometryArrays.geometryIndices.length>0;break;default:continue;}if(!geometryValid){geometryArrays=null;}if(geometryArrays){if(geometryArrays.geometryPositions.length>1000);if(geometryArrays.batchThisMesh){geometryArrays.decompressedPositions=new Float32Array(geometryArrays.geometryPositions.length);geometryArrays.transformedAndRecompressedPositions=new Uint16Array(geometryArrays.geometryPositions.length);var geometryPositions=geometryArrays.geometryPositions;var decompressedPositions=geometryArrays.decompressedPositions;for(var _i596=0,len=geometryPositions.length;_i596<len;_i596+=3){decompressedPositions[_i596+0]=geometryPositions[_i596+0]*reusedGeometriesDecodeMatrix[0]+reusedGeometriesDecodeMatrix[12];decompressedPositions[_i596+1]=geometryPositions[_i596+1]*reusedGeometriesDecodeMatrix[5]+reusedGeometriesDecodeMatrix[13];decompressedPositions[_i596+2]=geometryPositions[_i596+2]*reusedGeometriesDecodeMatrix[10]+reusedGeometriesDecodeMatrix[14];}geometryArrays.geometryPositions=null;geometryArraysCache[geometryId]=geometryArrays;}}}if(geometryArrays){if(geometryArrays.batchThisMesh){var _decompressedPositions=geometryArrays.decompressedPositions;var transformedAndRecompressedPositions=geometryArrays.transformedAndRecompressedPositions;for(var _i597=0,_len109=_decompressedPositions.length;_i597<_len109;_i597+=3){tempVec4a[0]=_decompressedPositions[_i597+0];tempVec4a[1]=_decompressedPositions[_i597+1];tempVec4a[2]=_decompressedPositions[_i597+2];tempVec4a[3]=1;math.transformVec4(meshMatrix,tempVec4a,tempVec4b);geometryCompressionUtils.compressPosition(tempVec4b,rtcAABB,tempVec4a);transformedAndRecompressedPositions[_i597+0]=tempVec4a[0];transformedAndRecompressedPositions[_i597+1]=tempVec4a[1];transformedAndRecompressedPositions[_i597+2]=tempVec4a[2];}sceneModel.createMesh(utils.apply(meshDefaults,{id:meshId,textureSetId:_textureSetId,origin:tileCenter,primitive:geometryArrays.primitiveName,positionsCompressed:transformedAndRecompressedPositions,normalsCompressed:geometryArrays.geometryNormals,uv:geometryArrays.geometryUVs,colorsCompressed:geometryArrays.geometryColors,indices:geometryArrays.geometryIndices,edgeIndices:geometryArrays.geometryEdgeIndices,positionsDecodeMatrix:tileDecodeMatrix,color:meshColor,metallic:meshMetallic,roughness:meshRoughness,opacity:meshOpacity}));meshIds.push(meshId);}else{if(!geometryCreatedInTile[geometryId]){sceneModel.createGeometry({id:geometryId,primitive:geometryArrays.primitiveName,positionsCompressed:geometryArrays.geometryPositions,normalsCompressed:geometryArrays.geometryNormals,uv:geometryArrays.geometryUVs,colorsCompressed:geometryArrays.geometryColors,indices:geometryArrays.geometryIndices,edgeIndices:geometryArrays.geometryEdgeIndices,positionsDecodeMatrix:reusedGeometriesDecodeMatrix});geometryCreatedInTile[geometryId]=true;}sceneModel.createMesh(utils.apply(meshDefaults,{id:meshId,geometryId:geometryId,textureSetId:_textureSetId,matrix:meshMatrix,color:meshColor,metallic:meshMetallic,roughness:meshRoughness,opacity:meshOpacity,origin:tileCenter}));meshIds.push(meshId);}}}else{// Do not reuse geometry
28101
+ var _primitiveType=eachGeometryPrimitiveType[_geometryIndex];var primitiveName=void 0;var _geometryPositions=void 0;var geometryNormals=void 0;var geometryUVs=void 0;var geometryColors=void 0;var geometryIndices=void 0;var geometryEdgeIndices=void 0;var _geometryValid=false;switch(_primitiveType){case 0:primitiveName="solid";_geometryPositions=positions.subarray(eachGeometryPositionsPortion[_geometryIndex],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex+1]);geometryNormals=normals.subarray(eachGeometryNormalsPortion[_geometryIndex],atLastGeometry?normals.length:eachGeometryNormalsPortion[_geometryIndex+1]);geometryUVs=uvs.subarray(eachGeometryUVsPortion[_geometryIndex],atLastGeometry?uvs.length:eachGeometryUVsPortion[_geometryIndex+1]);geometryIndices=indices.subarray(eachGeometryIndicesPortion[_geometryIndex],atLastGeometry?indices.length:eachGeometryIndicesPortion[_geometryIndex+1]);geometryEdgeIndices=edgeIndices.subarray(eachGeometryEdgeIndicesPortion[_geometryIndex],atLastGeometry?edgeIndices.length:eachGeometryEdgeIndicesPortion[_geometryIndex+1]);_geometryValid=_geometryPositions.length>0&&geometryIndices.length>0;break;case 1:primitiveName="surface";_geometryPositions=positions.subarray(eachGeometryPositionsPortion[_geometryIndex],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex+1]);geometryNormals=normals.subarray(eachGeometryNormalsPortion[_geometryIndex],atLastGeometry?normals.length:eachGeometryNormalsPortion[_geometryIndex+1]);geometryUVs=uvs.subarray(eachGeometryUVsPortion[_geometryIndex],atLastGeometry?uvs.length:eachGeometryUVsPortion[_geometryIndex+1]);geometryIndices=indices.subarray(eachGeometryIndicesPortion[_geometryIndex],atLastGeometry?indices.length:eachGeometryIndicesPortion[_geometryIndex+1]);geometryEdgeIndices=edgeIndices.subarray(eachGeometryEdgeIndicesPortion[_geometryIndex],atLastGeometry?edgeIndices.length:eachGeometryEdgeIndicesPortion[_geometryIndex+1]);_geometryValid=_geometryPositions.length>0&&geometryIndices.length>0;break;case 2:primitiveName="points";_geometryPositions=positions.subarray(eachGeometryPositionsPortion[_geometryIndex],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex+1]);geometryColors=colors.subarray(eachGeometryColorsPortion[_geometryIndex],atLastGeometry?colors.length:eachGeometryColorsPortion[_geometryIndex+1]);_geometryValid=_geometryPositions.length>0;break;case 3:primitiveName="lines";_geometryPositions=positions.subarray(eachGeometryPositionsPortion[_geometryIndex],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex+1]);geometryIndices=indices.subarray(eachGeometryIndicesPortion[_geometryIndex],atLastGeometry?indices.length:eachGeometryIndicesPortion[_geometryIndex+1]);_geometryValid=_geometryPositions.length>0&&geometryIndices.length>0;break;case 4:primitiveName="lines";_geometryPositions=positions.subarray(eachGeometryPositionsPortion[_geometryIndex],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex+1]);geometryIndices=lineStripToLines(_geometryPositions,indices.subarray(eachGeometryIndicesPortion[_geometryIndex],atLastGeometry?indices.length:eachGeometryIndicesPortion[_geometryIndex+1]));_geometryValid=_geometryPositions.length>0&&geometryIndices.length>0;break;default:continue;}if(_geometryValid){sceneModel.createMesh(utils.apply(meshDefaults,{id:meshId,textureSetId:_textureSetId,origin:tileCenter,primitive:primitiveName,positionsCompressed:_geometryPositions,normalsCompressed:geometryNormals,uv:geometryUVs&&geometryUVs.length>0?geometryUVs:null,colorsCompressed:geometryColors,indices:geometryIndices&&geometryIndices.length>0?geometryIndices:null,edgeIndices:geometryEdgeIndices,positionsDecodeMatrix:tileDecodeMatrix,color:meshColor,metallic:meshMetallic,roughness:meshRoughness,opacity:meshOpacity}));meshIds.push(meshId);}}}if(meshIds.length>0){sceneModel.createEntity(utils.apply(entityDefaults,{id:entityId,isObject:true,meshIds:meshIds}));}}}}function lineStripToLines(positions,indices){var linesIndices=[];if(indices.length>1){for(var _i598=0,len=indices.length-1;_i598<len;_i598++){linesIndices.push(indices[_i598]);linesIndices.push(indices[_i598+1]);}}else if(positions.length>1){for(var _i599=0,_len110=positions.length/3-1;_i599<_len110;_i599++){linesIndices.push(_i599);linesIndices.push(_i599+1);}}return linesIndices;}/** @private */var ParserV10={version:10,parse:function parse(viewer,options,elements,sceneModel,metaModel,manifestCtx){var deflatedData=extract(elements);var inflatedData=inflate(deflatedData);load(viewer,options,inflatedData,sceneModel,metaModel,manifestCtx);},/**
28102
+ * Parses a model from already-inflated data (eg. inflated within a Web Worker).
28103
+ */parseInflated:function parseInflated(viewer,options,inflatedData,sceneModel,metaModel,manifestCtx){load(viewer,options,inflatedData,sceneModel,metaModel,manifestCtx);},getDeflatedSegments:getDeflatedSegments,wrapInflatedResults:wrapInflatedResults,inflateMetadata:inflateMetadata};/**
28104
+ * Web Worker based geometry inflater for {@link XTCLoaderPlugin}.
28105
+ *
28106
+ * Moves the CPU-intensive pako inflation of .XTC geometry elements off the main thread,
28107
+ * keeping the page responsive while large models load. The whole XTC ArrayBuffer is
28108
+ * transferred (not copied) into the worker, which also releases the compressed data
28109
+ * from the main thread's memory as early as possible.
28110
+ *
28111
+ * The worker is created from an inline Blob (same pattern as the metadata inflate worker
28112
+ * in XTCLoaderPlugin) and loads pako via importScripts(). When pako cannot be loaded
28113
+ * (eg. offline environment), the handshake fails and XTCLoaderPlugin falls back to
28114
+ * synchronous main-thread inflation.
28115
+ *
28116
+ * @private
28117
+ */ /**
28118
+ * Default URL of the pako library loaded into the worker via importScripts().
28119
+ * Version matches the bundled parsers/lib/pako.js (2.1.0).
28120
+ * Can be overridden through XTCLoaderPlugin cfg.pakoUrl, eg. with a locally hosted copy.
28121
+ */var DEFAULT_PAKO_URL="https://cdnjs.cloudflare.com/ajax/libs/pako/2.1.0/pako.min.js";function buildWorkerSource(pakoUrl){return"\n\t\tvar pakoReady = false;\n\t\ttry {\n\t\t\tself.importScripts(".concat(JSON.stringify(pakoUrl),");\n\t\t\tpakoReady = !!(self.pako && self.pako.inflate);\n\t\t} catch (err) {\n\t\t\tpakoReady = false;\n\t\t}\n\n\t\tself.onmessage = function (e) {\n\t\t\tvar msg = e.data;\n\t\t\tif (msg.cmd === \"ping\") {\n\t\t\t\tself.postMessage({ cmd: \"pong\", pakoReady: pakoReady });\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (msg.cmd !== \"inflate\") {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (!pakoReady) {\n\t\t\t\tself.postMessage({ cmd: \"inflated\", id: msg.id, error: \"pako unavailable in worker\" });\n\t\t\t\treturn;\n\t\t\t}\n\t\t\ttry {\n\t\t\t\tvar fileBytes = new Uint8Array(msg.buffer);\n\t\t\t\tvar segments = msg.segments;\n\t\t\t\tvar results = new Array(segments.length);\n\t\t\t\tvar transferables = [];\n\t\t\t\tfor (var i = 0; i < segments.length; i++) {\n\t\t\t\t\tvar seg = segments[i];\n\t\t\t\t\tif (seg.byteLength === 0) {\n\t\t\t\t\t\tresults[i] = seg.json ? \"\" : new ArrayBuffer(0);\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t\tvar deflated = fileBytes.subarray(seg.byteOffset, seg.byteOffset + seg.byteLength);\n\t\t\t\t\tif (seg.json) {\n\t\t\t\t\t\tresults[i] = self.pako.inflate(deflated, { to: \"string\" });\n\t\t\t\t\t} else {\n\t\t\t\t\t\tvar inflated = self.pako.inflate(deflated);\n\t\t\t\t\t\tvar buffer = (inflated.byteOffset === 0 && inflated.byteLength === inflated.buffer.byteLength)\n\t\t\t\t\t\t\t? inflated.buffer\n\t\t\t\t\t\t\t: inflated.slice().buffer;\n\t\t\t\t\t\tresults[i] = buffer;\n\t\t\t\t\t\ttransferables.push(buffer);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tself.postMessage({ cmd: \"inflated\", id: msg.id, results: results }, transferables);\n\t\t\t} catch (err) {\n\t\t\t\tself.postMessage({ cmd: \"inflated\", id: msg.id, error: String((err && err.message) || err) });\n\t\t\t}\n\t\t};\n\t");}/**
28122
+ * Thin promise-based wrapper around the inline inflate Worker.
28123
+ *
28124
+ * @private
28125
+ */var XTCInflateWorker=/*#__PURE__*/function(){/**
28126
+ * @param {String} [pakoUrl] URL of the pako library to importScripts() within the worker.
28127
+ */function XTCInflateWorker(pakoUrl){var _this161=this;_classCallCheck(this,XTCInflateWorker);var source=buildWorkerSource(pakoUrl||DEFAULT_PAKO_URL);var blob=new Blob([source],{type:"application/javascript"});this._workerUrl=URL.createObjectURL(blob);this._worker=new Worker(this._workerUrl);this._nextRequestId=0;this._requests=new Map();// requestId -> {resolve, reject}
28128
+ this._onPong=null;this._onPongError=null;this._worker.onmessage=function(e){var msg=e.data;if(msg.cmd==="pong"){if(_this161._onPong){var onPong=_this161._onPong;_this161._onPong=null;_this161._onPongError=null;onPong(msg.pakoReady);}return;}if(msg.cmd==="inflated"){var request=_this161._requests.get(msg.id);if(request){_this161._requests["delete"](msg.id);if(msg.error){request.reject(new Error(msg.error));}else{request.resolve(msg.results);}}}};this._worker.onerror=function(e){var err=new Error(e.message||"XTC inflate worker error");if(_this161._onPongError){var onPongError=_this161._onPongError;_this161._onPong=null;_this161._onPongError=null;onPongError(err);}var _iterator42=_createForOfIteratorHelper(_this161._requests.values()),_step42;try{for(_iterator42.s();!(_step42=_iterator42.n()).done;){var request=_step42.value;request.reject(err);}}catch(err){_iterator42.e(err);}finally{_iterator42.f();}_this161._requests.clear();};}/**
28129
+ * Verifies that the worker booted and pako is available within it.
28130
+ * Rejects on timeout or when pako could not be loaded.
28131
+ *
28132
+ * @param {Number} [timeoutMs=15000] Handshake timeout - first load may fetch pako from a CDN.
28133
+ * @returns {Promise<void>}
28134
+ */return _createClass(XTCInflateWorker,[{key:"init",value:function init(){var _this162=this;var timeoutMs=arguments.length>0&&arguments[0]!==undefined?arguments[0]:15000;return new Promise(function(resolve,reject){var timer=setTimeout(function(){_this162._onPong=null;_this162._onPongError=null;reject(new Error("XTC inflate worker handshake timeout"));},timeoutMs);_this162._onPong=function(pakoReady){clearTimeout(timer);if(pakoReady){resolve();}else{reject(new Error("pako failed to load in XTC inflate worker"));}};_this162._onPongError=function(err){clearTimeout(timer);reject(err);};_this162._worker.postMessage({cmd:"ping"});});}/**
28135
+ * Inflates the given segments of an XTC file within the worker.
28136
+ *
28137
+ * NOTE: arrayBuffer is TRANSFERRED to the worker and becomes unusable (detached)
28138
+ * on the calling thread.
28139
+ *
28140
+ * @param {ArrayBuffer} arrayBuffer The whole XTC file buffer.
28141
+ * @param {{name: string, byteOffset: number, byteLength: number, json: boolean}[]} segments
28142
+ * Deflated element descriptors, as built by ParserV10.getDeflatedSegments().
28143
+ * @returns {Promise<(ArrayBuffer|string)[]>} Inflated results in segment order -
28144
+ * ArrayBuffers for binary elements, strings for JSON elements.
28145
+ */},{key:"inflate",value:function inflate(arrayBuffer,segments){var _this163=this;return new Promise(function(resolve,reject){var id=_this163._nextRequestId++;_this163._requests.set(id,{resolve:resolve,reject:reject});_this163._worker.postMessage({cmd:"inflate",id:id,buffer:arrayBuffer,segments:segments},[arrayBuffer]);});}/**
28146
+ * Terminates the worker and rejects all pending requests.
28147
+ */},{key:"destroy",value:function destroy(){var _iterator43=_createForOfIteratorHelper(this._requests.values()),_step43;try{for(_iterator43.s();!(_step43=_iterator43.n()).done;){var request=_step43.value;request.reject(new Error("XTC inflate worker destroyed"));}}catch(err){_iterator43.e(err);}finally{_iterator43.f();}this._requests.clear();this._onPong=null;this._onPongError=null;this._worker.terminate();URL.revokeObjectURL(this._workerUrl);}}]);}();var parsers={};// parsers[ParserV1.version] = ParserV1;
27835
28148
  // parsers[ParserV2.version] = ParserV2;
27836
28149
  // parsers[ParserV3.version] = ParserV3;
27837
28150
  // parsers[ParserV4.version] = ParserV4;
@@ -28396,7 +28709,7 @@ parsers[ParserV10.version]=ParserV10;/**
28396
28709
  * ````
28397
28710
  *
28398
28711
  * @class XTCLoaderPlugin
28399
- */var XTCLoaderPlugin=/*#__PURE__*/function(_Plugin13){/**
28712
+ */var XTCLoaderPlugin=/*#__PURE__*/function(_Plugin14){/**
28400
28713
  * @constructor
28401
28714
  *
28402
28715
  * @param {Viewer} viewer The Viewer.
@@ -28418,10 +28731,10 @@ parsers[ParserV10.version]=ParserV10;/**
28418
28731
  * and faster rendering speed. It's recommended to keep this somewhere roughly between ````50000```` and ````50000000```.
28419
28732
  * @param {KTX2TextureTranscoder} [cfg.textureTranscoder] Transcoder used internally to transcode KTX2
28420
28733
  * textures within the XTC. Only required when the XTC is version 10 or later, and contains KTX2 textures.
28421
- */function XTCLoaderPlugin(viewer){var _this160;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,XTCLoaderPlugin);_this160=_callSuper(this,XTCLoaderPlugin,["XTCLoader",viewer,cfg]);_this160._maxGeometryBatchSize=cfg.maxGeometryBatchSize;_this160.textureTranscoder=cfg.textureTranscoder;_this160.dataSource=cfg.dataSource;_this160.objectDefaults=cfg.objectDefaults;_this160.includeTypes=cfg.includeTypes;_this160.excludeTypes=cfg.excludeTypes;_this160.excludeUnclassifiedObjects=cfg.excludeUnclassifiedObjects;_this160.reuseGeometries=cfg.reuseGeometries;return _this160;}/**
28734
+ */function XTCLoaderPlugin(viewer){var _this164;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,XTCLoaderPlugin);_this164=_callSuper(this,XTCLoaderPlugin,["XTCLoader",viewer,cfg]);_this164._maxGeometryBatchSize=cfg.maxGeometryBatchSize;_this164.textureTranscoder=cfg.textureTranscoder;_this164.dataSource=cfg.dataSource;_this164.objectDefaults=cfg.objectDefaults;_this164.includeTypes=cfg.includeTypes;_this164.excludeTypes=cfg.excludeTypes;_this164.excludeUnclassifiedObjects=cfg.excludeUnclassifiedObjects;_this164.reuseGeometries=cfg.reuseGeometries;_this164._inflateWorkerEnabled=cfg.inflateWorkerEnabled!==false;_this164._pakoUrl=cfg.pakoUrl;_this164._inflateWorker=null;_this164._inflateWorkerUnavailable=false;return _this164;}/**
28422
28735
  * Gets the ````.xtc```` format versions supported by this XTCLoaderPlugin/
28423
28736
  * @returns {string[]}
28424
- */_inherits(XTCLoaderPlugin,_Plugin13);return _createClass(XTCLoaderPlugin,[{key:"supportedVersions",get:function get(){return Object.keys(parsers);}/**
28737
+ */_inherits(XTCLoaderPlugin,_Plugin14);return _createClass(XTCLoaderPlugin,[{key:"supportedVersions",get:function get(){return Object.keys(parsers);}/**
28425
28738
  * Gets the texture transcoder.
28426
28739
  *
28427
28740
  * @type {TextureTranscoder}
@@ -28596,14 +28909,27 @@ parsers[ParserV10.version]=ParserV10;/**
28596
28909
  * to non-textured triangle meshes, and that VBOs are always used for meshes that have textures, line segments, or point
28597
28910
  * primitives. Only works while {@link DTX#enabled} is also ````true````.
28598
28911
  * @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}.
28599
- */},{key:"load",value:function load(){var _this161=this;var params=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};if(params.id&&this.viewer.scene.components[params.id]){this.error("Component with this ID already exists in viewer: "+params.id+" - will autogenerate this ID");delete params.id;}if(!params.src&&!params.xtc&&!params.manifestSrc&&!params.manifest){this.error("load() param expected: src, xtc, manifestSrc or manifestData");return sceneModel;// Return new empty model
28600
- }var options={};var includeTypes=params.includeTypes||this._includeTypes;var excludeTypes=params.excludeTypes||this._excludeTypes;var objectDefaults=params.objectDefaults||this._objectDefaults;options.reuseGeometries=params.reuseGeometries!==null&&params.reuseGeometries!==undefined?params.reuseGeometries:this._reuseGeometries!==false;if(includeTypes){options.includeTypesMap={};for(var _i596=0,len=includeTypes.length;_i596<len;_i596++){options.includeTypesMap[includeTypes[_i596]]=true;}}if(excludeTypes){options.excludeTypesMap={};for(var _i597=0,_len111=excludeTypes.length;_i597<_len111;_i597++){options.excludeTypesMap[excludeTypes[_i597]]=true;}}if(objectDefaults){options.objectDefaults=objectDefaults;}options.excludeUnclassifiedObjects=params.excludeUnclassifiedObjects!==undefined?!!params.excludeUnclassifiedObjects:this._excludeUnclassifiedObjects;options.globalizeObjectIds=params.globalizeObjectIds!==undefined&&params.globalizeObjectIds!==null?!!params.globalizeObjectIds:this._globalizeObjectIds;var sceneModel=new SceneModel(this.viewer.scene,utils.apply(params,{isModel:true,textureTranscoder:this._textureTranscoder,maxGeometryBatchSize:this._maxGeometryBatchSize,origin:params.origin,disableVertexWelding:params.disableVertexWelding||false,disableIndexRebucketing:params.disableIndexRebucketing||false,dtxEnabled:params.dtxEnabled}));var modelId=sceneModel.id;// In case ID was auto-generated
28912
+ */},{key:"load",value:function load(){var _this165=this;var params=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};if(params.id&&this.viewer.scene.components[params.id]){this.error("Component with this ID already exists in viewer: "+params.id+" - will autogenerate this ID");delete params.id;}if(!params.src&&!params.xtc&&!params.manifestSrc&&!params.manifest){this.error("load() param expected: src, xtc, manifestSrc or manifestData");return sceneModel;// Return new empty model
28913
+ }var options={};var includeTypes=params.includeTypes||this._includeTypes;var excludeTypes=params.excludeTypes||this._excludeTypes;var objectDefaults=params.objectDefaults||this._objectDefaults;options.reuseGeometries=params.reuseGeometries!==null&&params.reuseGeometries!==undefined?params.reuseGeometries:this._reuseGeometries!==false;if(includeTypes){options.includeTypesMap={};for(var _i600=0,len=includeTypes.length;_i600<len;_i600++){options.includeTypesMap[includeTypes[_i600]]=true;}}if(excludeTypes){options.excludeTypesMap={};for(var _i601=0,_len111=excludeTypes.length;_i601<_len111;_i601++){options.excludeTypesMap[excludeTypes[_i601]]=true;}}if(objectDefaults){options.objectDefaults=objectDefaults;}options.excludeUnclassifiedObjects=params.excludeUnclassifiedObjects!==undefined?!!params.excludeUnclassifiedObjects:this._excludeUnclassifiedObjects;options.globalizeObjectIds=params.globalizeObjectIds!==undefined&&params.globalizeObjectIds!==null?!!params.globalizeObjectIds:this._globalizeObjectIds;var sceneModel=new SceneModel(this.viewer.scene,utils.apply(params,{isModel:true,textureTranscoder:this._textureTranscoder,maxGeometryBatchSize:this._maxGeometryBatchSize,origin:params.origin,disableVertexWelding:params.disableVertexWelding||false,disableIndexRebucketing:params.disableIndexRebucketing||false,dtxEnabled:params.dtxEnabled}));var modelId=sceneModel.id;// In case ID was auto-generated
28601
28914
  var metaModel=new MetaModel({metaScene:this.viewer.metaScene,id:modelId});this.viewer.scene.canvas.spinner.processes++;var finish=function finish(){if(sceneModel.destroyed){return;}// this._createDefaultMetaModelIfNeeded(sceneModel, params, options);
28602
- sceneModel.finalize();metaModel.finalize();_this161.viewer.scene.canvas.spinner.processes--;sceneModel.once("destroyed",function(){_this161.viewer.metaScene.destroyMetaModel(metaModel.id);});_this161.scheduleTask(function(){if(sceneModel.destroyed){return;}sceneModel.scene.fire("modelLoaded",sceneModel.id);// FIXME: Assumes listeners know order of these two events
28915
+ sceneModel.finalize();metaModel.finalize();_this165.viewer.scene.canvas.spinner.processes--;sceneModel.once("destroyed",function(){_this165.viewer.metaScene.destroyMetaModel(metaModel.id);});_this165.scheduleTask(function(){if(sceneModel.destroyed){return;}sceneModel.scene.fire("modelLoaded",sceneModel.id);// FIXME: Assumes listeners know order of these two events
28603
28916
  sceneModel.fire("loaded",true,false);// Don't forget the event, for late subscribers
28604
- });};var error=function error(errMsg){_this161.viewer.scene.canvas.spinner.processes--;_this161.error(errMsg);sceneModel.fire("error",errMsg);};var nextId=0;var manifestCtx={getNextId:function getNextId(){return"".concat(modelId,".").concat(nextId++);}};//模型文件
28605
- if(params.metaModelSrc||params.metaModelData){if(params.metaModelSrc){var metaModelSrc=params.metaModelSrc;this._dataSource.getMetaModel(metaModelSrc,function(metaModelData){if(sceneModel.destroyed){return;}metaModel.loadData(metaModelData,{includeTypes:includeTypes,excludeTypes:excludeTypes,globalizeObjectIds:options.globalizeObjectIds});if(params.src){_this161._loadModel(params.src,params,options,sceneModel,null,manifestCtx,finish,error);}else{_this161._parseModel(params.xtc,params,options,sceneModel,null,manifestCtx);finish();}},function(errMsg){error("load(): Failed to load model metadata for model '".concat(modelId," from '").concat(metaModelSrc,"' - ").concat(errMsg));});}else if(params.metaModelData){metaModel.loadData(params.metaModelData,{includeTypes:includeTypes,excludeTypes:excludeTypes,globalizeObjectIds:options.globalizeObjectIds});if(params.src){this._loadModel(params.src,params,options,sceneModel,null,manifestCtx,finish,error);}else{this._parseModel(params.xtc,params,options,sceneModel,null,manifestCtx);finish();}}}else{if(params.src){this._loadModel(params.src,params,options,sceneModel,metaModel,manifestCtx,finish,error);}else if(params.xtc){this._parseModel(params.xtc,params,options,sceneModel,metaModel,manifestCtx);finish();}else if(params.manifestSrc||params.manifest){var baseDir=params.manifestSrc?getBaseDirectory(params.manifestSrc):"";var loadJSONs=function loadJSONs(metaDataFiles,done,error){var i=0;var _loadNext=function loadNext(){if(sceneModel.destroyed){done();}else if(i>=metaDataFiles.length){done();}else{_this161._dataSource.getMetaModel("".concat(baseDir).concat(metaDataFiles[i]),function(metaModelData){metaModel.loadData(metaModelData,{includeTypes:includeTypes,excludeTypes:excludeTypes,globalizeObjectIds:options.globalizeObjectIds});i++;_this161.scheduleTask(_loadNext,200);},error);}};_loadNext();};var loadXTCs_excludeTheirMetaModels=function loadXTCs_excludeTheirMetaModels(xtcFiles,done,error){var i=0;var _loadNext2=function loadNext(){if(sceneModel.destroyed){done();}else if(i>=xtcFiles.length){done();}else{_this161._dataSource.getXTC("".concat(baseDir).concat(xtcFiles[i]),function(arrayBuffer){_this161._parseModel(arrayBuffer,params,options,sceneModel,null/* Ignore metamodel in XTC */,manifestCtx);sceneModel.preFinalize();i++;_this161.scheduleTask(_loadNext2,200);},error);}};_loadNext2();};var loadXTCs_includeTheirMetaModels=function loadXTCs_includeTheirMetaModels(xtcFiles,done,error){// Load XTCs, parse metamodels from the XTC
28606
- var i=0;var _loadNext3=function loadNext(){if(sceneModel.destroyed){done();}else if(i>=xtcFiles.length){done();}else{_this161._dataSource.getXTC("".concat(baseDir).concat(xtcFiles[i]),function(arrayBuffer){_this161._parseModel(arrayBuffer,params,options,sceneModel,metaModel,manifestCtx);sceneModel.preFinalize();i++;_this161.scheduleTask(_loadNext3,100);},error);}};_loadNext3();};if(params.manifest){var manifestData=params.manifest;var xtcFiles=manifestData.xtcFiles;if(!xtcFiles||xtcFiles.length===0){error("load(): Failed to load model manifest - manifest not valid");return;}var metaModelFiles=manifestData.metaModelFiles;if(metaModelFiles){loadJSONs(metaModelFiles,function(){loadXTCs_excludeTheirMetaModels(xtcFiles,finish,error);},error);}else{loadXTCs_includeTheirMetaModels(xtcFiles,finish,error);}}else{this._dataSource.getManifest(params.manifestSrc,function(manifestData){if(sceneModel.destroyed){return;}var xtcFiles=manifestData.xtcFiles;if(!xtcFiles||xtcFiles.length===0){error("load(): Failed to load model manifest - manifest not valid");return;}var metaModelFiles=manifestData.metaModelFiles;if(metaModelFiles){loadJSONs(metaModelFiles,function(){loadXTCs_excludeTheirMetaModels(xtcFiles,finish,error);},error);}else{loadXTCs_includeTheirMetaModels(xtcFiles,finish,error);}},error);}}}return sceneModel;}},{key:"_loadModel",value:function _loadModel(src,params,options,sceneModel,metaModel,manifestCtx,done,error){var _this162=this;this._dataSource.getXTC(params.src,function(arrayBuffer){_this162._parseModel(arrayBuffer,params,options,sceneModel,metaModel,manifestCtx);sceneModel.preFinalize();done();},error);}},{key:"_parseModel",value:function(){var _parseModel2=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee8(arrayBuffer,params,options,sceneModel,metaModel,manifestCtx){var dataView,dataArray,xtcVersion,parser,numElements,elements,byteOffset,_i598,elementSize;return _regeneratorRuntime().wrap(function _callee8$(_context11){while(1)switch(_context11.prev=_context11.next){case 0:if(!sceneModel.destroyed){_context11.next=2;break;}return _context11.abrupt("return");case 2:dataView=new DataView(arrayBuffer);dataArray=new Uint8Array(arrayBuffer);xtcVersion=dataView.getUint32(0,true);parser=parsers[xtcVersion];if(parser){_context11.next=9;break;}this.error("Unsupported .XTC file version: "+xtcVersion+" - this XTCLoaderPlugin supports versions "+Object.keys(parsers));return _context11.abrupt("return");case 9:this.log("Loading .xtc V"+xtcVersion);numElements=dataView.getUint32(4,true);elements=[];byteOffset=(numElements+2)*4;for(_i598=0;_i598<numElements;_i598++){elementSize=dataView.getUint32((_i598+2)*4,true);elements.push(dataArray.subarray(byteOffset,byteOffset+elementSize));byteOffset+=elementSize;}parser.parse(this.viewer,options,elements,sceneModel,metaModel,manifestCtx);case 15:case"end":return _context11.stop();}},_callee8,this);}));function _parseModel(_x104,_x105,_x106,_x107,_x108,_x109){return _parseModel2.apply(this,arguments);}return _parseModel;}()},{key:"loadMetadata",value:function loadMetadata(metaModel,deflatedMetadata,force,done){var _this163=this;metaModel._finalized=false;try{{this._workerInflate(metaModel,deflatedMetadata,force,function(worker){worker.terminate();_this163.fire("metaLoaded",{result:"success",metaModel:metaModel});if(typeof done==="function")done();},function(worker,error){worker.terminate();_this163.fire("metaLoaded",{result:"failed",message:error,metaModel:metaModel});});}}catch(error){this.fire("metaloaded",{result:error,metaModel:metaModel});}}},{key:"_workerInflate",value:function _workerInflate(metaModel,buffer,force,done,err){var plugin=this;var worker=createInlineWorker();worker.postMessage({buffer:buffer// executionTime: new Date().getTime()
28917
+ });};var error=function error(errMsg){_this165.viewer.scene.canvas.spinner.processes--;_this165.error(errMsg);sceneModel.fire("error",errMsg);};var nextId=0;var manifestCtx={getNextId:function getNextId(){return"".concat(modelId,".").concat(nextId++);}};//模型文件
28918
+ if(params.metaModelSrc||params.metaModelData){if(params.metaModelSrc){var metaModelSrc=params.metaModelSrc;this._dataSource.getMetaModel(metaModelSrc,function(metaModelData){if(sceneModel.destroyed){return;}metaModel.loadData(metaModelData,{includeTypes:includeTypes,excludeTypes:excludeTypes,globalizeObjectIds:options.globalizeObjectIds});if(params.src){_this165._loadModel(params.src,params,options,sceneModel,null,manifestCtx,finish,error);}else{_this165._parseModel(params.xtc,params,options,sceneModel,null,manifestCtx).then(finish)["catch"](function(err){return error("load(): Failed to parse model '".concat(modelId,"' - ").concat(err&&err.message||err));});}},function(errMsg){error("load(): Failed to load model metadata for model '".concat(modelId," from '").concat(metaModelSrc,"' - ").concat(errMsg));});}else if(params.metaModelData){metaModel.loadData(params.metaModelData,{includeTypes:includeTypes,excludeTypes:excludeTypes,globalizeObjectIds:options.globalizeObjectIds});if(params.src){this._loadModel(params.src,params,options,sceneModel,null,manifestCtx,finish,error);}else{this._parseModel(params.xtc,params,options,sceneModel,null,manifestCtx).then(finish)["catch"](function(err){return error("load(): Failed to parse model '".concat(modelId,"' - ").concat(err&&err.message||err));});}}}else{if(params.src){this._loadModel(params.src,params,options,sceneModel,metaModel,manifestCtx,finish,error);}else if(params.xtc){this._parseModel(params.xtc,params,options,sceneModel,metaModel,manifestCtx).then(finish)["catch"](function(err){return error("load(): Failed to parse model '".concat(modelId,"' - ").concat(err&&err.message||err));});}else if(params.manifestSrc||params.manifest){var baseDir=params.manifestSrc?getBaseDirectory(params.manifestSrc):"";var loadJSONs=function loadJSONs(metaDataFiles,done,error){var i=0;var _loadNext=function loadNext(){if(sceneModel.destroyed){done();}else if(i>=metaDataFiles.length){done();}else{_this165._dataSource.getMetaModel("".concat(baseDir).concat(metaDataFiles[i]),function(metaModelData){metaModel.loadData(metaModelData,{includeTypes:includeTypes,excludeTypes:excludeTypes,globalizeObjectIds:options.globalizeObjectIds});i++;_this165.scheduleTask(_loadNext,200);},error);}};_loadNext();};var loadXTCs_excludeTheirMetaModels=function loadXTCs_excludeTheirMetaModels(xtcFiles,done,error){var i=0;var _loadNext2=function loadNext(){if(sceneModel.destroyed){done();}else if(i>=xtcFiles.length){done();}else{_this165._dataSource.getXTC("".concat(baseDir).concat(xtcFiles[i]),function(arrayBuffer){_this165._parseModel(arrayBuffer,params,options,sceneModel,null/* Ignore metamodel in XTC */,manifestCtx).then(function(){sceneModel.preFinalize();i++;_this165.scheduleTask(_loadNext2,200);})["catch"](error);},error);}};_loadNext2();};var loadXTCs_includeTheirMetaModels=function loadXTCs_includeTheirMetaModels(xtcFiles,done,error){// Load XTCs, parse metamodels from the XTC
28919
+ var i=0;var _loadNext3=function loadNext(){if(sceneModel.destroyed){done();}else if(i>=xtcFiles.length){done();}else{_this165._dataSource.getXTC("".concat(baseDir).concat(xtcFiles[i]),function(arrayBuffer){_this165._parseModel(arrayBuffer,params,options,sceneModel,metaModel,manifestCtx).then(function(){sceneModel.preFinalize();i++;_this165.scheduleTask(_loadNext3,100);})["catch"](error);},error);}};_loadNext3();};if(params.manifest){var manifestData=params.manifest;var xtcFiles=manifestData.xtcFiles;if(!xtcFiles||xtcFiles.length===0){error("load(): Failed to load model manifest - manifest not valid");return;}var metaModelFiles=manifestData.metaModelFiles;if(metaModelFiles){loadJSONs(metaModelFiles,function(){loadXTCs_excludeTheirMetaModels(xtcFiles,finish,error);},error);}else{loadXTCs_includeTheirMetaModels(xtcFiles,finish,error);}}else{this._dataSource.getManifest(params.manifestSrc,function(manifestData){if(sceneModel.destroyed){return;}var xtcFiles=manifestData.xtcFiles;if(!xtcFiles||xtcFiles.length===0){error("load(): Failed to load model manifest - manifest not valid");return;}var metaModelFiles=manifestData.metaModelFiles;if(metaModelFiles){loadJSONs(metaModelFiles,function(){loadXTCs_excludeTheirMetaModels(xtcFiles,finish,error);},error);}else{loadXTCs_includeTheirMetaModels(xtcFiles,finish,error);}},error);}}}return sceneModel;}},{key:"_loadModel",value:function _loadModel(src,params,options,sceneModel,metaModel,manifestCtx,done,error){var _this166=this;this._dataSource.getXTC(params.src,function(arrayBuffer){_this166._parseModel(arrayBuffer,params,options,sceneModel,metaModel,manifestCtx).then(function(){sceneModel.preFinalize();done();})["catch"](error);},error);}/**
28920
+ * Gets the shared geometry inflate worker, creating and verifying it on first use.
28921
+ *
28922
+ * Returns `null` when worker-based inflation is disabled or unavailable (eg. pako
28923
+ * could not be loaded within the worker) - callers then fall back to synchronous
28924
+ * main-thread inflation.
28925
+ *
28926
+ * @returns {Promise<XTCInflateWorker|null>}
28927
+ * @private
28928
+ */},{key:"_getInflateWorker",value:(function(){var _getInflateWorker2=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee8(){var inflateWorker;return _regeneratorRuntime().wrap(function _callee8$(_context11){while(1)switch(_context11.prev=_context11.next){case 0:if(!(!this._inflateWorkerEnabled||this._inflateWorkerUnavailable)){_context11.next=2;break;}return _context11.abrupt("return",null);case 2:if(this._inflateWorker){_context11.next=16;break;}inflateWorker=new XTCInflateWorker(this._pakoUrl);_context11.prev=4;_context11.next=7;return inflateWorker.init();case 7:_context11.next=15;break;case 9:_context11.prev=9;_context11.t0=_context11["catch"](4);this.log("XTC geometry inflate worker unavailable, falling back to synchronous inflation: "+(_context11.t0&&_context11.t0.message||_context11.t0));inflateWorker.destroy();this._inflateWorkerUnavailable=true;return _context11.abrupt("return",null);case 15:this._inflateWorker=inflateWorker;case 16:return _context11.abrupt("return",this._inflateWorker);case 17:case"end":return _context11.stop();}},_callee8,this,[[4,9]]);}));function _getInflateWorker(){return _getInflateWorker2.apply(this,arguments);}return _getInflateWorker;}())},{key:"_parseModel",value:function(){var _parseModel2=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee9(arrayBuffer,params,options,sceneModel,metaModel,manifestCtx){var dataView,dataArray,xtcVersion,parser,numElements,elements,byteOffset,_i602,elementSize,inflateWorker,segments,results,inflatedData;return _regeneratorRuntime().wrap(function _callee9$(_context12){while(1)switch(_context12.prev=_context12.next){case 0:if(!sceneModel.destroyed){_context12.next=2;break;}return _context12.abrupt("return");case 2:dataView=new DataView(arrayBuffer);dataArray=new Uint8Array(arrayBuffer);xtcVersion=dataView.getUint32(0,true);parser=parsers[xtcVersion];if(parser){_context12.next=9;break;}this.error("Unsupported .XTC file version: "+xtcVersion+" - this XTCLoaderPlugin supports versions "+Object.keys(parsers));return _context12.abrupt("return");case 9:this.log("Loading .xtc V"+xtcVersion);numElements=dataView.getUint32(4,true);elements=[];byteOffset=(numElements+2)*4;for(_i602=0;_i602<numElements;_i602++){elementSize=dataView.getUint32((_i602+2)*4,true);elements.push(dataArray.subarray(byteOffset,byteOffset+elementSize));byteOffset+=elementSize;}if(!(parser.parseInflated&&parser.getDeflatedSegments)){_context12.next=30;break;}_context12.next=17;return this._getInflateWorker();case 17:inflateWorker=_context12.sent;if(!inflateWorker){_context12.next=30;break;}if(!sceneModel.destroyed){_context12.next=21;break;}return _context12.abrupt("return");case 21:segments=parser.getDeflatedSegments(elements);// NOTE: arrayBuffer is transferred into the worker (detached on this thread),
28929
+ // which also releases the compressed file data from main-thread memory early.
28930
+ _context12.next=24;return inflateWorker.inflate(arrayBuffer,segments);case 24:results=_context12.sent;if(!sceneModel.destroyed){_context12.next=27;break;}return _context12.abrupt("return");case 27:inflatedData=parser.wrapInflatedResults(results);parser.parseInflated(this.viewer,options,inflatedData,sceneModel,metaModel,manifestCtx);return _context12.abrupt("return");case 30:parser.parse(this.viewer,options,elements,sceneModel,metaModel,manifestCtx);case 31:case"end":return _context12.stop();}},_callee9,this);}));function _parseModel(_x104,_x105,_x106,_x107,_x108,_x109){return _parseModel2.apply(this,arguments);}return _parseModel;}()/**
28931
+ * Destroys this XTCLoaderPlugin, terminating the shared inflate worker if it exists.
28932
+ */},{key:"destroy",value:function destroy(){if(this._inflateWorker){this._inflateWorker.destroy();this._inflateWorker=null;}_superPropGet(XTCLoaderPlugin,"destroy",this,3)([]);}},{key:"loadMetadata",value:function loadMetadata(metaModel,deflatedMetadata,force,done){var _this167=this;metaModel._finalized=false;try{{this._workerInflate(metaModel,deflatedMetadata,force,function(worker){worker.terminate();_this167.fire("metaLoaded",{result:"success",metaModel:metaModel});if(typeof done==="function")done();},function(worker,error){worker.terminate();_this167.fire("metaLoaded",{result:"failed",message:error,metaModel:metaModel});});}}catch(error){this.fire("metaloaded",{result:error,metaModel:metaModel});}}},{key:"_workerInflate",value:function _workerInflate(metaModel,buffer,force,done,err){var plugin=this;var worker=createInlineWorker();worker.postMessage({buffer:buffer// executionTime: new Date().getTime()
28607
28933
  });worker.onmessage=function(e){if(force){metaModel.loadData(e.data.metaJson,function(){metaModel.finalize();if(typeof done==="function")done(worker);else worker.terminate();},function(e){if(typeof err==="function")err(worker,e);});}else{plugin.fire("metaLoading",function(){metaModel.loadData(e.data.metaJson,function(){metaModel.finalize();if(typeof done==="function")done(worker);else worker.terminate();},function(e){if(typeof err==="function")err(worker,e);});});}};worker.onerror=function(e){if(typeof err==="function")err(worker,e.message);worker.terminate();};}// _createDefaultMetaModelIfNeeded(sceneModel, params, options) {
28608
28934
  //
28609
28935
  // const metaModelId = sceneModel.id;
@@ -29011,7 +29337,7 @@ var isBase64=!!dataUriRegexResult[2];var data=dataUriRegexResult[3];data=window.
29011
29337
  *
29012
29338
  * @class WebIFCLoaderPlugin
29013
29339
  * @since 2.0.13
29014
- */var WebIFCLoaderPlugin=/*#__PURE__*/function(_Plugin14){/**
29340
+ */var WebIFCLoaderPlugin=/*#__PURE__*/function(_Plugin15){/**
29015
29341
  * @constructor
29016
29342
  *
29017
29343
  * @param {Viewer} viewer The Viewer.
@@ -29023,7 +29349,7 @@ var isBase64=!!dataUriRegexResult[2];var data=dataUriRegexResult[3];data=window.
29023
29349
  * @param {String[]} [cfg.includeTypes] When loading metadata, only loads objects that have {@link MetaObject}s with {@link MetaObject#type} values in this list.
29024
29350
  * @param {String[]} [cfg.excludeTypes] When loading metadata, never loads objects that have {@link MetaObject}s with {@link MetaObject#type} values in this list.
29025
29351
  * @param {Boolean} [cfg.excludeUnclassifiedObjects=false] When loading metadata and this is ````true````, will only load {@link Entity}s that have {@link MetaObject}s (that are not excluded). This is useful when we don't want Entitys in the Scene that are not represented within IFC navigation components, such as {@link TreeViewPlugin}.
29026
- */function WebIFCLoaderPlugin(viewer){var _this164;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,WebIFCLoaderPlugin);_this164=_callSuper(this,WebIFCLoaderPlugin,["ifcLoader",viewer,cfg]);_this164.dataSource=cfg.dataSource;_this164.objectDefaults=cfg.objectDefaults;_this164.includeTypes=cfg.includeTypes;_this164.excludeTypes=cfg.excludeTypes;_this164.excludeUnclassifiedObjects=cfg.excludeUnclassifiedObjects;if(cfg.WebIFC){_this164._webIFC=cfg.WebIFC;_this164._ifcAPI=cfg.IfcAPI;_this164.webIfcFroMOutside=true;}// else {
29352
+ */function WebIFCLoaderPlugin(viewer){var _this168;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,WebIFCLoaderPlugin);_this168=_callSuper(this,WebIFCLoaderPlugin,["ifcLoader",viewer,cfg]);_this168.dataSource=cfg.dataSource;_this168.objectDefaults=cfg.objectDefaults;_this168.includeTypes=cfg.includeTypes;_this168.excludeTypes=cfg.excludeTypes;_this168.excludeUnclassifiedObjects=cfg.excludeUnclassifiedObjects;if(cfg.WebIFC){_this168._webIFC=cfg.WebIFC;_this168._ifcAPI=cfg.IfcAPI;_this168.webIfcFroMOutside=true;}// else {
29027
29353
  // this._webIFC = WebIFC;
29028
29354
  // this.webIfcFroMOutside = false;
29029
29355
  // this._ifcAPI = new this._webIFC.IfcAPI();
@@ -29039,10 +29365,10 @@ var isBase64=!!dataUriRegexResult[2];var data=dataUriRegexResult[3];data=window.
29039
29365
  // this.error(e);
29040
29366
  // });
29041
29367
  // }
29042
- return _this164;}/**
29368
+ return _this168;}/**
29043
29369
  * Gets the ````IFC```` format versions supported by this WebIFCLoaderPlugin.
29044
29370
  * @returns {string[]}
29045
- */_inherits(WebIFCLoaderPlugin,_Plugin14);return _createClass(WebIFCLoaderPlugin,[{key:"supportedVersions",get:function get(){return["2x3","4"];}/**
29371
+ */_inherits(WebIFCLoaderPlugin,_Plugin15);return _createClass(WebIFCLoaderPlugin,[{key:"supportedVersions",get:function get(){return["2x3","4"];}/**
29046
29372
  * Gets the custom data source through which the WebIFCLoaderPlugin can load IFC files.
29047
29373
  *
29048
29374
  * Default value is {@link WebIFCDefaultDataSource}, which loads via HTTP.
@@ -29172,7 +29498,7 @@ return _this164;}/**
29172
29498
  * primitives. Only works while {@link DTX#enabled} is also ````true````.
29173
29499
  * @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}.
29174
29500
  */},{key:"load",value:function load(){var params=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};if(params.id&&this.viewer.scene.components[params.id]){this.error("Component with this ID already exists in viewer: "+params.id+" - will autogenerate this ID");delete params.id;}var sceneModel=new SceneModel(this.viewer.scene,utils.apply(params,{isModel:true}));if(!params.src&&!params.ifc){this.error("load() param expected: src or IFC");return sceneModel;// Return new empty model
29175
- }var options={autoNormals:true};if(params.loadMetadata!==false){var includeTypes=params.includeTypes||this._includeTypes;var excludeTypes=params.excludeTypes||this._excludeTypes;var objectDefaults=params.objectDefaults||this._objectDefaults;if(includeTypes){options.includeTypesMap={};for(var _i599=0,len=includeTypes.length;_i599<len;_i599++){options.includeTypesMap[includeTypes[_i599]]=true;}}if(excludeTypes){options.excludeTypesMap={};for(var _i600=0,_len112=excludeTypes.length;_i600<_len112;_i600++){options.excludeTypesMap[excludeTypes[_i600]]=true;}}if(objectDefaults){options.objectDefaults=objectDefaults;}options.excludeUnclassifiedObjects=params.excludeUnclassifiedObjects!==undefined?!!params.excludeUnclassifiedObjects:this._excludeUnclassifiedObjects;options.globalizeObjectIds=params.globalizeObjectIds!==undefined?!!params.globalizeObjectIds:this._globalizeObjectIds;}if(this.webIfcFroMOutside)try{if(params.src){this._loadModel(params.src,params,options,sceneModel);}else{this._parseModel(params.ifc,params,options,sceneModel);}}catch(e){this.error(e);sceneModel.fire("error",e);}// this.on("initialized", () => {
29501
+ }var options={autoNormals:true};if(params.loadMetadata!==false){var includeTypes=params.includeTypes||this._includeTypes;var excludeTypes=params.excludeTypes||this._excludeTypes;var objectDefaults=params.objectDefaults||this._objectDefaults;if(includeTypes){options.includeTypesMap={};for(var _i603=0,len=includeTypes.length;_i603<len;_i603++){options.includeTypesMap[includeTypes[_i603]]=true;}}if(excludeTypes){options.excludeTypesMap={};for(var _i604=0,_len112=excludeTypes.length;_i604<_len112;_i604++){options.excludeTypesMap[excludeTypes[_i604]]=true;}}if(objectDefaults){options.objectDefaults=objectDefaults;}options.excludeUnclassifiedObjects=params.excludeUnclassifiedObjects!==undefined?!!params.excludeUnclassifiedObjects:this._excludeUnclassifiedObjects;options.globalizeObjectIds=params.globalizeObjectIds!==undefined?!!params.globalizeObjectIds:this._globalizeObjectIds;}if(this.webIfcFroMOutside)try{if(params.src){this._loadModel(params.src,params,options,sceneModel);}else{this._parseModel(params.ifc,params,options,sceneModel);}}catch(e){this.error(e);sceneModel.fire("error",e);}// this.on("initialized", () => {
29176
29502
  // try {
29177
29503
  // if (params.src) {
29178
29504
  // this._loadModel(params.src, params, options, sceneModel);
@@ -29184,13 +29510,13 @@ return _this164;}/**
29184
29510
  // sceneModel.fire("error", e);
29185
29511
  // }
29186
29512
  // });
29187
- return sceneModel;}},{key:"_loadModel",value:function _loadModel(src,params,options,sceneModel){var _this165=this;var spinner=this.viewer.scene.canvas.spinner;spinner.processes++;this._dataSource.getIFC(params.src,function(arrayBuffer){_this165._parseModel(arrayBuffer,params,options,sceneModel);spinner.processes--;},function(errMsg){spinner.processes--;_this165.error(errMsg);sceneModel.fire("error",errMsg);});}},{key:"_parseModel",value:function _parseModel(arrayBuffer,params,options,sceneModel){if(sceneModel.destroyed){return;}var stats=params.stats||{};stats.sourceFormat="IFC";stats.schemaVersion="";stats.title="";stats.author="";stats.created="";stats.numMetaObjects=0;stats.numPropertySets=0;stats.numObjects=0;stats.numGeometries=0;stats.numTriangles=0;stats.numVertices=0;if(this.webIfcFroMOutside){if(!this._ifcAPI){throw"WebIFCLoaderPlugin has no WebIFC instance configured - please inject via WebIFCLoaderPlugin constructor";}}else{if(options.wasmPath){this._ifcAPI.SetWasmPath(options.wasmPath);}}var dataArray=new Uint8Array(arrayBuffer);var modelID=this._ifcAPI.OpenModel(dataArray);var modelSchema=this._ifcAPI.GetModelSchema(modelID);var lines=this._ifcAPI.GetLineIDsWithType(modelID,this._webIFC.IFCPROJECT);var ifcProjectId=lines.get(0);var loadMetadata=params.loadMetadata!==false;var useOutsideMetadata=params.metadata!==undefined&&params.metadata!==null;var outMetadata;if(useOutsideMetadata){outMetadata=params.metadata;}else outMetadata=null;var metadata=loadMetadata?{id:"",projectId:""+ifcProjectId,author:"",createdAt:"",schema:"",creatingApplication:"",metaObjects:[],propertySets:[]}:outMetadata;var ctx={ifcProjectId:ifcProjectId,modelID:modelID,modelSchema:modelSchema,sceneModel:sceneModel,loadMetadata:loadMetadata,metadata:metadata,metaObjects:useOutsideMetadata?sceneModel.metaObjects:{},options:options,// log: function (msg) {},
29188
- nextId:0,stats:stats};if(loadMetadata){if(options.includeTypes){ctx.includeTypes={};for(var _i601=0,len=options.includeTypes.length;_i601<len;_i601++){ctx.includeTypes[options.includeTypes[_i601]]=true;}}if(options.excludeTypes){ctx.excludeTypes={};for(var _i602=0,_len113=options.excludeTypes.length;_i602<_len113;_i602++){ctx.excludeTypes[options.excludeTypes[_i602]]=true;}}this._parseMetaObjects(ctx);this._parsePropertySets(ctx);}this._parseGeometry(ctx);sceneModel.finalize();if(loadMetadata||useOutsideMetadata){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
29513
+ return sceneModel;}},{key:"_loadModel",value:function _loadModel(src,params,options,sceneModel){var _this169=this;var spinner=this.viewer.scene.canvas.spinner;spinner.processes++;this._dataSource.getIFC(params.src,function(arrayBuffer){_this169._parseModel(arrayBuffer,params,options,sceneModel);spinner.processes--;},function(errMsg){spinner.processes--;_this169.error(errMsg);sceneModel.fire("error",errMsg);});}},{key:"_parseModel",value:function _parseModel(arrayBuffer,params,options,sceneModel){if(sceneModel.destroyed){return;}var stats=params.stats||{};stats.sourceFormat="IFC";stats.schemaVersion="";stats.title="";stats.author="";stats.created="";stats.numMetaObjects=0;stats.numPropertySets=0;stats.numObjects=0;stats.numGeometries=0;stats.numTriangles=0;stats.numVertices=0;if(this.webIfcFroMOutside){if(!this._ifcAPI){throw"WebIFCLoaderPlugin has no WebIFC instance configured - please inject via WebIFCLoaderPlugin constructor";}}else{if(options.wasmPath){this._ifcAPI.SetWasmPath(options.wasmPath);}}var dataArray=new Uint8Array(arrayBuffer);var modelID=this._ifcAPI.OpenModel(dataArray);var modelSchema=this._ifcAPI.GetModelSchema(modelID);var lines=this._ifcAPI.GetLineIDsWithType(modelID,this._webIFC.IFCPROJECT);var ifcProjectId=lines.get(0);var loadMetadata=params.loadMetadata!==false;var useOutsideMetadata=params.metadata!==undefined&&params.metadata!==null;var outMetadata;if(useOutsideMetadata){outMetadata=params.metadata;}else outMetadata=null;var metadata=loadMetadata?{id:"",projectId:""+ifcProjectId,author:"",createdAt:"",schema:"",creatingApplication:"",metaObjects:[],propertySets:[]}:outMetadata;var ctx={ifcProjectId:ifcProjectId,modelID:modelID,modelSchema:modelSchema,sceneModel:sceneModel,loadMetadata:loadMetadata,metadata:metadata,metaObjects:useOutsideMetadata?sceneModel.metaObjects:{},options:options,// log: function (msg) {},
29514
+ nextId:0,stats:stats};if(loadMetadata){if(options.includeTypes){ctx.includeTypes={};for(var _i605=0,len=options.includeTypes.length;_i605<len;_i605++){ctx.includeTypes[options.includeTypes[_i605]]=true;}}if(options.excludeTypes){ctx.excludeTypes={};for(var _i606=0,_len113=options.excludeTypes.length;_i606<_len113;_i606++){ctx.excludeTypes[options.excludeTypes[_i606]]=true;}}this._parseMetaObjects(ctx);this._parsePropertySets(ctx);}this._parseGeometry(ctx);sceneModel.finalize();if(loadMetadata||useOutsideMetadata){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
29189
29515
  sceneModel.fire("loaded",true,false);// Don't forget the event, for late subscribers
29190
- });}},{key:"_parseMetaObjects",value:function _parseMetaObjects(ctx){var ifcProject=this._ifcAPI.GetLine(ctx.modelID,ctx.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;if(this.webIfcFroMOutside)metaObjectType=this._ifcAPI.GetNameFromTypeCode(ifcElement.type);else metaObjectType=ifcElement.__proto__.constructor.name;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 _this166=this;var lines=this._ifcAPI.GetLineIDsWithType(ctx.modelID,type);for(var _i603=0;_i603<lines.size();_i603++){var relID=lines.get(_i603);var rel=this._ifcAPI.GetLine(ctx.modelID,relID);if(rel==null)return;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);if(ifcElement==null)return;this._parseSpatialChildren(ctx,ifcElement,parentMetaObjectId);}else{element.forEach(function(element2){var ifcElement=_this166._ifcAPI.GetLine(ctx.modelID,element2.value);if(ifcElement==null)return;_this166._parseSpatialChildren(ctx,ifcElement,parentMetaObjectId);});}}}}},{key:"_parsePropertySets",value:function _parsePropertySets(ctx){this.log("start parse property...");var lines=this._ifcAPI.GetLineIDsWithType(ctx.modelID,this._webIFC.IFCRELDEFINESBYPROPERTIES);for(var _i604=0;_i604<lines.size();_i604++){var relID=lines.get(_i604);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 _i605=0,len=props.length;_i605<len;_i605++){var prop=props[_i605];var _name8=prop.Name;var nominalValue=prop.NominalValue;if(_name8&&nominalValue){var property={name:_name8.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 _i606=0,_len114=relatedObjects.length;_i606<_len114;_i606++){var relatedObject=relatedObjects[_i606];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 _this167=this;this.log("start parse geometry");this._ifcAPI.StreamAllMeshes(ctx.modelID,function(flatMesh){// TODO: Can we do geometry reuse with web-ifc?
29191
- var flatMeshExpressID=flatMesh.expressID;var placedGeometries=flatMesh.geometries;var meshIds=[];var properties=_this167._ifcAPI.GetLine(ctx.modelID,flatMeshExpressID);if(properties==null)return;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=_this167._ifcAPI.GetGeometry(ctx.modelID,placedGeometry.geometryExpressID);var vertexData=_this167._ifcAPI.GetVertexArray(geometry.GetVertexData(),geometry.GetVertexDataSize());var indices=_this167._ifcAPI.GetIndexArray(geometry.GetIndexData(),geometry.GetIndexDataSize());// De-interleave vertex arrays
29516
+ });}},{key:"_parseMetaObjects",value:function _parseMetaObjects(ctx){var ifcProject=this._ifcAPI.GetLine(ctx.modelID,ctx.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;if(this.webIfcFroMOutside)metaObjectType=this._ifcAPI.GetNameFromTypeCode(ifcElement.type);else metaObjectType=ifcElement.__proto__.constructor.name;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 _this170=this;var lines=this._ifcAPI.GetLineIDsWithType(ctx.modelID,type);for(var _i607=0;_i607<lines.size();_i607++){var relID=lines.get(_i607);var rel=this._ifcAPI.GetLine(ctx.modelID,relID);if(rel==null)return;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);if(ifcElement==null)return;this._parseSpatialChildren(ctx,ifcElement,parentMetaObjectId);}else{element.forEach(function(element2){var ifcElement=_this170._ifcAPI.GetLine(ctx.modelID,element2.value);if(ifcElement==null)return;_this170._parseSpatialChildren(ctx,ifcElement,parentMetaObjectId);});}}}}},{key:"_parsePropertySets",value:function _parsePropertySets(ctx){this.log("start parse property...");var lines=this._ifcAPI.GetLineIDsWithType(ctx.modelID,this._webIFC.IFCRELDEFINESBYPROPERTIES);for(var _i608=0;_i608<lines.size();_i608++){var relID=lines.get(_i608);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 _i609=0,len=props.length;_i609<len;_i609++){var prop=props[_i609];var _name10=prop.Name;var nominalValue=prop.NominalValue;if(_name10&&nominalValue){var property={name:_name10.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 _i610=0,_len114=relatedObjects.length;_i610<_len114;_i610++){var relatedObject=relatedObjects[_i610];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 _this171=this;this.log("start parse geometry");this._ifcAPI.StreamAllMeshes(ctx.modelID,function(flatMesh){// TODO: Can we do geometry reuse with web-ifc?
29517
+ var flatMeshExpressID=flatMesh.expressID;var placedGeometries=flatMesh.geometries;var meshIds=[];var properties=_this171._ifcAPI.GetLine(ctx.modelID,flatMeshExpressID);if(properties==null)return;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=_this171._ifcAPI.GetGeometry(ctx.modelID,placedGeometry.geometryExpressID);var vertexData=_this171._ifcAPI.GetVertexArray(geometry.GetVertexData(),geometry.GetVertexDataSize());var indices=_this171._ifcAPI.GetIndexArray(geometry.GetIndexData(),geometry.GetIndexDataSize());// De-interleave vertex arrays
29192
29518
  var positions=new Float64Array(vertexData.length/2);var normals=new Float32Array(vertexData.length/2);for(var k=0,_l3=0,lenk=vertexData.length/6;k<lenk;k++,_l3+=3){positions[_l3+0]=vertexData[k*6+0];positions[_l3+1]=vertexData[k*6+1];positions[_l3+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,_l4=0,_lenk=vertexData.length/6;_k2<_lenk;_k2++,_l4+=3){normals[_l4+0]=vertexData[_k2*6+3];normals[_l4+1]=vertexData[_k2*6+4];normals[_l4+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
29193
- 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++;});this._ifcAPI.StreamAllMeshesWithTypes(ctx.modelID,[3856911033],function(mesh,index,total){var flatMeshExpressID=mesh.expressID;var properties=_this167._ifcAPI.GetLine(ctx.modelID,flatMeshExpressID);if(properties==null)return;var globalId=properties.GlobalId.value;var placedGeometries=mesh.geometries;var meshIds=[];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=_this167._ifcAPI.GetGeometry(ctx.modelID,placedGeometry.geometryExpressID);var vertexData=_this167._ifcAPI.GetVertexArray(geometry.GetVertexData(),geometry.GetVertexDataSize());var indices=_this167._ifcAPI.GetIndexArray(geometry.GetIndexData(),geometry.GetIndexDataSize());// De-interleave vertex arrays
29519
+ 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++;});this._ifcAPI.StreamAllMeshesWithTypes(ctx.modelID,[3856911033],function(mesh,index,total){var flatMeshExpressID=mesh.expressID;var properties=_this171._ifcAPI.GetLine(ctx.modelID,flatMeshExpressID);if(properties==null)return;var globalId=properties.GlobalId.value;var placedGeometries=mesh.geometries;var meshIds=[];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=_this171._ifcAPI.GetGeometry(ctx.modelID,placedGeometry.geometryExpressID);var vertexData=_this171._ifcAPI.GetVertexArray(geometry.GetVertexData(),geometry.GetVertexDataSize());var indices=_this171._ifcAPI.GetIndexArray(geometry.GetIndexData(),geometry.GetIndexDataSize());// De-interleave vertex arrays
29194
29520
  var positions=new Float64Array(vertexData.length/2);var normals=new Float32Array(vertexData.length/2);for(var k=0,_l5=0,lenk=vertexData.length/6;k<lenk;k++,_l5+=3){positions[_l5+0]=vertexData[k*6+0];positions[_l5+1]=vertexData[k*6+1];positions[_l5+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 _k3=0,_l6=0,_lenk2=vertexData.length/6;_k3<_lenk2;_k3++,_l6+=3){normals[_l6+0]=vertexData[_k3*6+3];normals[_l6+1]=vertexData[_k3*6+4];normals[_l6+2]=vertexData[_k3*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
29195
29521
  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<1?placedGeometry.color.w:0.1});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++;});}}]);}(Plugin);/**
29196
29522
  * A 3D gizmo control for interactively editing object transforms (translate / rotate / scale).
@@ -29205,12 +29531,12 @@ this._rotationState={};// { [entityId]: { quat: Float64Array, center: number[] }
29205
29531
  // Animation state
29206
29532
  this._animRAF=null;this._createNodes();this._bindEvents();}return _createClass(TransformControl,[{key:"setTargets",value:function setTargets(ids){this._targetIds=ids||[];this._batchedRotEntries=[];if(this._targetIds.length>0){this._setPos(this._getCentroid());}// Reset gizmo rotation to world-aligned on new target selection
29207
29533
  this._rootNode.quaternion=[0,0,0,1];// Build batched entries for targets whose meshes have no transform (batching layer)
29208
- this._buildBatchedEntries();}},{key:"_buildBatchedEntries",value:function _buildBatchedEntries(){var scene=this._scene;for(var _i607=0,len=this._targetIds.length;_i607<len;_i607++){var id=this._targetIds[_i607];var entity=scene._findObjectEntity(id);if(!entity||!entity.meshes)continue;// Restore persisted rotation state, or create fresh
29534
+ this._buildBatchedEntries();}},{key:"_buildBatchedEntries",value:function _buildBatchedEntries(){var scene=this._scene;for(var _i611=0,len=this._targetIds.length;_i611<len;_i611++){var id=this._targetIds[_i611];var entity=scene._findObjectEntity(id);if(!entity||!entity.meshes)continue;// Restore persisted rotation state, or create fresh
29209
29535
  var state=this._rotationState[id];if(!state){var _localCenter=[0,0,0];state={quat:math.vec4([0,0,0,1]),center:_localCenter};this._rotationState[id]=state;}// Update center each time (object may have moved)
29210
29536
  var localCenter=[0,0,0];for(var j=0,mlen=entity.meshes.length;j<mlen;j++){var _mesh8=entity.meshes[j];if(!_mesh8.transform&&_mesh8.layer&&typeof _mesh8.layer.setMatrix==="function"){var portion=_mesh8.layer._portions&&_mesh8.layer._portions[_mesh8.portionId];if(portion&&portion.aabb){var _a10=portion.aabb;localCenter[0]=(_a10[0]+_a10[3])/2;localCenter[1]=(_a10[1]+_a10[4])/2;localCenter[2]=(_a10[2]+_a10[5])/2;}state.center=localCenter.slice();this._batchedRotEntries.push({entityId:id,mesh:_mesh8,layer:_mesh8.layer,portionId:_mesh8.portionId,quat:state.quat,// shared reference — persists across rebuilds
29211
- center:state.center});}}}}},{key:"_getCentroid",value:function _getCentroid(){var scene=this._scene;var sx=0,sy=0,sz=0,count=0;for(var _i608=0,len=this._targetIds.length;_i608<len;_i608++){var id=this._targetIds[_i608];// Try AABB center first (world-space)
29537
+ center:state.center});}}}}},{key:"_getCentroid",value:function _getCentroid(){var scene=this._scene;var sx=0,sy=0,sz=0,count=0;for(var _i612=0,len=this._targetIds.length;_i612<len;_i612++){var id=this._targetIds[_i612];// Try AABB center first (world-space)
29212
29538
  var aabb=scene.getObjectAABB(id);if(aabb){sx+=(aabb[0]+aabb[3])/2;sy+=(aabb[1]+aabb[4])/2;sz+=(aabb[2]+aabb[5])/2;// Account for entity offset — SceneModelEntity AABB does not include offset
29213
- var entity=scene._findObjectEntity(id);if(entity&&entity.offset){sx+=entity.offset[0];sy+=entity.offset[1];sz+=entity.offset[2];}count++;}else{var _entity3=scene._findObjectEntity(id);if(_entity3&&_entity3.worldMatrix){sx+=_entity3.worldMatrix[12];sy+=_entity3.worldMatrix[13];sz+=_entity3.worldMatrix[14];count++;}}}if(count===0)return[0,0,0];return[sx/count,sy/count,sz/count];}},{key:"_setPos",value:function _setPos(xyz){this._pos.set(xyz);worldToRTCPos(this._pos,this._origin,this._rtcPos);this._rootNode.origin=this._origin;this._rootNode.position=this._rtcPos;}},{key:"setPosition",value:function setPosition(pos){this._setPos(pos);}},{key:"setVisible",value:function setVisible(){var visible=arguments.length>0&&arguments[0]!==undefined?arguments[0]:true;if(this._visible===visible)return;this._visible=visible;this._syncModeVisibility();}},{key:"getVisible",value:function getVisible(){return this._visible;}},{key:"setCulled",value:function setCulled(culled){var id;for(id in this._displayMeshes){if(this._displayMeshes.hasOwnProperty(id))this._displayMeshes[id].culled=culled;}if(!culled){for(id in this._affordanceMeshes){if(this._affordanceMeshes.hasOwnProperty(id))this._affordanceMeshes[id].culled=culled;}}}},{key:"_syncModeVisibility",value:function _syncModeVisibility(){var _this168=this;var keys=Object.keys(this._displayMeshes);for(var _i609=0,_keys=keys;_i609<_keys.length;_i609++){var k=_keys[_i609];if(this._displayMeshes[k])this._displayMeshes[k].visible=false;}if(!this._visible)return;var s=function s(n){if(_this168._displayMeshes[n])_this168._displayMeshes[n].visible=true;};// Translate handles
29539
+ var entity=scene._findObjectEntity(id);if(entity&&entity.offset){sx+=entity.offset[0];sy+=entity.offset[1];sz+=entity.offset[2];}count++;}else{var _entity3=scene._findObjectEntity(id);if(_entity3&&_entity3.worldMatrix){sx+=_entity3.worldMatrix[12];sy+=_entity3.worldMatrix[13];sz+=_entity3.worldMatrix[14];count++;}}}if(count===0)return[0,0,0];return[sx/count,sy/count,sz/count];}},{key:"_setPos",value:function _setPos(xyz){this._pos.set(xyz);worldToRTCPos(this._pos,this._origin,this._rtcPos);this._rootNode.origin=this._origin;this._rootNode.position=this._rtcPos;}},{key:"setPosition",value:function setPosition(pos){this._setPos(pos);}},{key:"setVisible",value:function setVisible(){var visible=arguments.length>0&&arguments[0]!==undefined?arguments[0]:true;if(this._visible===visible)return;this._visible=visible;this._syncModeVisibility();}},{key:"getVisible",value:function getVisible(){return this._visible;}},{key:"setCulled",value:function setCulled(culled){var id;for(id in this._displayMeshes){if(this._displayMeshes.hasOwnProperty(id))this._displayMeshes[id].culled=culled;}if(!culled){for(id in this._affordanceMeshes){if(this._affordanceMeshes.hasOwnProperty(id))this._affordanceMeshes[id].culled=culled;}}}},{key:"_syncModeVisibility",value:function _syncModeVisibility(){var _this172=this;var keys=Object.keys(this._displayMeshes);for(var _i613=0,_keys=keys;_i613<_keys.length;_i613++){var k=_keys[_i613];if(this._displayMeshes[k])this._displayMeshes[k].visible=false;}if(!this._visible)return;var s=function s(n){if(_this172._displayMeshes[n])_this172._displayMeshes[n].visible=true;};// Translate handles
29214
29540
  s("center");s("xAxis");s("xAxisArrow");s("xAxisArrowHandle");s("xAxisHandle");s("yShaft");s("yAxisArrow");s("yAxisArrowHandle");s("yShaftHandle");s("zShaft");s("zAxisArrow");s("zAxisArrowHandle");s("zAxisHandle");// Rotate handles
29215
29541
  s("xCurve");s("xCurveHandle");s("xCurveArrow1");s("xCurveArrow2");s("yCurve");s("yCurveHandle");s("yCurveArrow1");s("yCurveArrow2");s("zCurve");s("zCurveHandle");s("zCurveArrow1");s("zCurveArrow2");// // Scale handles
29216
29542
  // s("xScaleBox");
@@ -29231,23 +29557,23 @@ this._displayMeshes.zAxisArrow=rootNode.addChild(new Mesh(rootNode,{geometry:sha
29231
29557
  this._displayMeshes.zCurve=rootNode.addChild(new Mesh(rootNode,{geometry:shapes.curve,material:materials.blue,matrix:math.rotationMat4v(math.DEGTORAD,[1,0,0],math.identityMat4()),pickable:true,collidable:false,clippable:false,visible:false,isObject:false}),NO_STATE_INHERIT);this._displayMeshes.zCurveHandle=rootNode.addChild(new Mesh(rootNode,{geometry:shapes.curveHandle,material:materials.pickable,matrix:math.rotationMat4v(180*math.DEGTORAD,[1,0,0],math.identityMat4()),pickable:true,collidable:false,clippable:false,visible:false,isObject:false}),NO_STATE_INHERIT);this._displayMeshes.zCurveArrow1=rootNode.addChild(new Mesh(rootNode,{geometry:shapes.arrowHead,material:materials.blue,matrix:function(){var t=math.translateMat4c(0.8,0.07,0,math.identityMat4());var s=math.scaleMat4v([0.6,0.6,0.6],math.identityMat4());var r=math.rotationMat4v(180*math.DEGTORAD,[0,0,1],math.identityMat4());return math.mulMat4(math.mulMat4(t,s,math.identityMat4()),r,math.identityMat4());}(),pickable:true,collidable:false,clippable:false,visible:false,isObject:false}),NO_STATE_INHERIT);this._displayMeshes.zCurveArrow2=rootNode.addChild(new Mesh(rootNode,{geometry:shapes.arrowHead,material:materials.blue,matrix:function(){var t=math.translateMat4c(0.05,0.8,0,math.identityMat4());var s=math.scaleMat4v([0.6,0.6,0.6],math.identityMat4());var r=math.rotationMat4v(90*math.DEGTORAD,[0,0,1],math.identityMat4());return math.mulMat4(math.mulMat4(t,s,math.identityMat4()),r,math.identityMat4());}(),pickable:true,collidable:false,clippable:false,visible:false,isObject:false}),NO_STATE_INHERIT);// Scale boxes
29232
29558
  this._displayMeshes.xScaleBox=rootNode.addChild(new Mesh(rootNode,{geometry:shapes.scaleBox,material:materials.red,matrix:function(){var t=math.translateMat4c(0,radius+0.1,0,math.identityMat4());var r=math.rotationMat4v(-90*math.DEGTORAD,[0,0,1],math.identityMat4());return math.mulMat4(r,t,math.identityMat4());}(),pickable:true,collidable:false,clippable:false,visible:false,isObject:false}),NO_STATE_INHERIT);this._displayMeshes.xScaleBoxHandle=rootNode.addChild(new Mesh(rootNode,{geometry:shapes.scaleBox,material:materials.pickable,matrix:function(){var t=math.translateMat4c(0,radius+0.1,0,math.identityMat4());var r=math.rotationMat4v(-90*math.DEGTORAD,[0,0,1],math.identityMat4());return math.mulMat4(r,t,math.identityMat4());}(),pickable:true,collidable:false,clippable:false,visible:false,isObject:false}),NO_STATE_INHERIT);this._displayMeshes.yScaleBox=rootNode.addChild(new Mesh(rootNode,{geometry:shapes.scaleBox,material:materials.green,position:[0,radius+0.1,0],pickable:true,collidable:false,clippable:false,visible:false,isObject:false}),NO_STATE_INHERIT);this._displayMeshes.yScaleBoxHandle=rootNode.addChild(new Mesh(rootNode,{geometry:shapes.scaleBox,material:materials.pickable,position:[0,radius+0.1,0],pickable:true,collidable:false,clippable:false,visible:false,isObject:false}),NO_STATE_INHERIT);this._displayMeshes.zScaleBox=rootNode.addChild(new Mesh(rootNode,{geometry:shapes.scaleBox,material:materials.blue,matrix:function(){var t=math.translateMat4c(0,radius+0.1,0,math.identityMat4());var r=math.rotationMat4v(90*math.DEGTORAD,[1,0,0],math.identityMat4());return math.mulMat4(r,t,math.identityMat4());}(),pickable:true,collidable:false,clippable:false,visible:false,isObject:false}),NO_STATE_INHERIT);this._displayMeshes.zScaleBoxHandle=rootNode.addChild(new Mesh(rootNode,{geometry:shapes.scaleBox,material:materials.pickable,matrix:function(){var t=math.translateMat4c(0,radius+0.1,0,math.identityMat4());var r=math.rotationMat4v(90*math.DEGTORAD,[1,0,0],math.identityMat4());return math.mulMat4(r,t,math.identityMat4());}(),pickable:true,collidable:false,clippable:false,visible:false,isObject:false}),NO_STATE_INHERIT);this._displayMeshes.uniformScaleBox=rootNode.addChild(new Mesh(rootNode,{geometry:shapes.uniformScaleBox,material:materials.yellow,pickable:true,collidable:false,clippable:false,visible:false,isObject:false}),NO_STATE_INHERIT);this._displayMeshes.uniformScaleBoxHandle=rootNode.addChild(new Mesh(rootNode,{geometry:shapes.uniformScaleBox,material:materials.pickable,pickable:true,collidable:false,clippable:false,visible:false,isObject:false}),NO_STATE_INHERIT);// Center
29233
29559
  this._displayMeshes.center=rootNode.addChild(new Mesh(rootNode,{geometry:new ReadableGeometry(rootNode,buildSphereGeometry({radius:0.05})),material:materials.center,pickable:true,collidable:false,clippable:false,visible:false,isObject:false}),NO_STATE_INHERIT);// Affordance meshes
29234
- this._affordanceMeshes={xHoop:rootNode.addChild(new Mesh(rootNode,{geometry:shapes.hoop,material:materials.red,highlighted:true,highlightMaterial:materials.highlightRed,matrix:function(){var r2=math.rotationMat4v(90*math.DEGTORAD,[0,1,0],math.identityMat4());var r1=math.rotationMat4v(270*math.DEGTORAD,[1,0,0],math.identityMat4());return math.mulMat4(r1,r2,math.identityMat4());}(),pickable:false,collidable:false,clippable:false,visible:false,isObject:false}),NO_STATE_INHERIT),yHoop:rootNode.addChild(new Mesh(rootNode,{geometry:shapes.hoop,material:materials.green,highlighted:true,highlightMaterial:materials.highlightGreen,rotation:[-90,0,0],pickable:false,collidable:false,clippable:false,visible:false,isObject:false}),NO_STATE_INHERIT),zHoop:rootNode.addChild(new Mesh(rootNode,{geometry:shapes.hoop,material:materials.blue,highlighted:true,highlightMaterial:materials.highlightBlue,matrix:math.rotationMat4v(180*math.DEGTORAD,[1,0,0],math.identityMat4()),pickable:false,collidable:false,clippable:false,backfaces:true,visible:false,isObject:false}),NO_STATE_INHERIT),xAxisArrow:rootNode.addChild(new Mesh(rootNode,{geometry:shapes.arrowHeadBig,material:materials.red,matrix:function(){var t=math.translateMat4c(0,radius+0.1,0,math.identityMat4());var r=math.rotationMat4v(-90*math.DEGTORAD,[0,0,1],math.identityMat4());return math.mulMat4(r,t,math.identityMat4());}(),pickable:false,collidable:false,clippable:false,visible:false,isObject:false}),NO_STATE_INHERIT),yAxisArrow:rootNode.addChild(new Mesh(rootNode,{geometry:shapes.arrowHeadBig,material:materials.green,matrix:math.translateMat4c(0,radius+0.1,0,math.identityMat4()),pickable:false,collidable:false,clippable:false,visible:false,isObject:false}),NO_STATE_INHERIT),zAxisArrow:rootNode.addChild(new Mesh(rootNode,{geometry:shapes.arrowHeadBig,material:materials.blue,matrix:function(){var t=math.translateMat4c(0,radius+0.1,0,math.identityMat4());var r=math.rotationMat4v(90*math.DEGTORAD,[1,0,0],math.identityMat4());return math.mulMat4(r,t,math.identityMat4());}(),pickable:false,collidable:false,clippable:false,visible:false,isObject:false}),NO_STATE_INHERIT)};}/* ======================== EVENT BINDING ======================== */},{key:"_bindEvents",value:function _bindEvents(){var _this169=this;var self=this;var grabbed=false;var DRAG_ACTIONS={none:-1,xTranslate:0,yTranslate:1,zTranslate:2,xRotate:3,yRotate:4,zRotate:5,xScale:6,yScale:7,zScale:8,uniformScale:9};var rootNode=this._rootNode;var nextDragAction=DRAG_ACTIONS.none;var dragAction=DRAG_ACTIONS.none;var lastCanvasPos=math.vec2();var xBaseAxis=math.vec3([1,0,0]);var yBaseAxis=math.vec3([0,1,0]);var zBaseAxis=math.vec3([0,0,1]);var canvas=this._viewer.scene.canvas.canvas;var camera=this._viewer.camera;var scene=this._viewer.scene;/* keep gizmo screen size constant */{var _tempVec3a4=math.vec3([0,0,0]);var lastDist=-1;this._onCameraViewMatrix=scene.camera.on("viewMatrix",function(){lastDist=-1;});this._onCameraProjMatrix=scene.camera.on("projMatrix",function(){lastDist=-1;});this._onSceneTick=scene.on("tick",function(){var dist=Math.abs(math.lenVec3(math.subVec3(scene.camera.eye,_this169._pos,_tempVec3a4)));if(dist!==lastDist){if(camera.projection==="perspective"){var worldSize=Math.tan(camera.perspective.fov*math.DEGTORAD)*dist;rootNode.scale=[0.07*worldSize,0.07*worldSize,0.07*worldSize];}if(camera.projection==="ortho"){rootNode.scale=[camera.ortho.scale/10,camera.ortho.scale/10,camera.ortho.scale/10];}lastDist=dist;}});}var getClickCoordsWithinElement=function(){var canvasPos=new Float64Array(2);return function(event){if(!event){event=window.event;canvasPos[0]=event.x;canvasPos[1]=event.y;return canvasPos;}var element=event.target;var totalOffsetLeft=0,totalOffsetTop=0;while(element.offsetParent){totalOffsetLeft+=element.offsetLeft;totalOffsetTop+=element.offsetTop;element=element.offsetParent;}canvasPos[0]=event.pageX-totalOffsetLeft;canvasPos[1]=event.pageY-totalOffsetTop;return canvasPos;};}();var getTouchCoordsWithinElement=function(){var canvasPos=new Float64Array(2);return function(event){if(!event){event=window.event;}if(event.touches&&event.touches.length){canvasPos[0]=event.touches[0].pageX;canvasPos[1]=event.touches[0].pageY;}else{var element=event.target;var totalOffsetLeft=0,totalOffsetTop=0;while(element.offsetParent){totalOffsetLeft+=element.offsetLeft;totalOffsetTop+=element.offsetTop;element=element.offsetParent;}canvasPos[0]=event.pageX-totalOffsetLeft;canvasPos[1]=event.pageY-totalOffsetTop;}return canvasPos;};}();var localToWorldVec=function(){var mat=math.mat4();return function(localVec,worldVec){math.quaternionToMat4(rootNode.quaternion,mat);math.transformVec3(mat,localVec,worldVec);math.normalizeVec3(worldVec);return worldVec;};}();var getTranslationPlane=function(){var planeNormal=math.vec3();return function(worldAxis){var absX=Math.abs(worldAxis[0]);if(absX>Math.abs(worldAxis[1])&&absX>Math.abs(worldAxis[2]))math.cross3Vec3(worldAxis,[0,1,0],planeNormal);else math.cross3Vec3(worldAxis,[1,0,0],planeNormal);math.cross3Vec3(planeNormal,worldAxis,planeNormal);math.normalizeVec3(planeNormal);return planeNormal;};}();/* ── Drag translate entities ── */var dragTranslate=function(){var p1=math.vec3(),p2=math.vec3(),worldAxis=math.vec4();return function(baseAxis,fromMouse,toMouse){localToWorldVec(baseAxis,worldAxis);var planeNormal=getTranslationPlane(worldAxis,fromMouse,toMouse);getPointerPlaneIntersect(fromMouse,planeNormal,p1);getPointerPlaneIntersect(toMouse,planeNormal,p2);math.subVec3(p2,p1);var dot=math.dotVec3(p2,worldAxis);self._pos[0]+=worldAxis[0]*dot*0.6;self._pos[1]+=worldAxis[1]*dot*0.6;self._pos[2]+=worldAxis[2]*dot*0.6;// Update root node using RTC coordinates (convert world -> RTC)
29235
- self._setPos(self._pos);self._applyEntityTranslation(worldAxis,dot*0.6);};}();/* ── Drag rotate entities ── */var dragRotate=function(){var p1=math.vec4(),p2=math.vec4(),c=math.vec4(),worldAxis=math.vec4();return function(baseAxis,fromMouse,toMouse){localToWorldVec(baseAxis,worldAxis);var hasData=getPointerPlaneIntersect(fromMouse,worldAxis,p1)&&getPointerPlaneIntersect(toMouse,worldAxis,p2);if(!hasData){var planeNormal=getTranslationPlane(worldAxis,fromMouse,toMouse);getPointerPlaneIntersect(fromMouse,planeNormal,p1,1);getPointerPlaneIntersect(toMouse,planeNormal,p2,1);var dot=math.dotVec3(p1,worldAxis);p1[0]-=dot*worldAxis[0];p1[1]-=dot*worldAxis[1];p1[2]-=dot*worldAxis[2];dot=math.dotVec3(p2,worldAxis);p2[0]-=dot*worldAxis[0];p2[1]-=dot*worldAxis[1];p2[2]-=dot*worldAxis[2];}math.normalizeVec3(p1);math.normalizeVec3(p2);var dot=math.dotVec3(p1,p2);dot=math.clamp(dot,-1.0,1.0);var incDegrees=Math.acos(dot)*math.RADTODEG;math.cross3Vec3(p1,p2,c);if(math.dotVec3(c,worldAxis)<0.0)incDegrees=-incDegrees;rootNode.rotate(baseAxis,incDegrees);self._applyEntityRotation(baseAxis,incDegrees);};}();/* ── Drag scale entities ── */var dragScale=function(){var p1=math.vec3(),p2=math.vec3(),worldAxis=math.vec4();return function(baseAxis,fromMouse,toMouse,uniform){localToWorldVec(baseAxis,worldAxis);var planeNormal=getTranslationPlane(worldAxis,fromMouse,toMouse);getPointerPlaneIntersect(fromMouse,planeNormal,p1);getPointerPlaneIntersect(toMouse,planeNormal,p2);math.subVec3(p2,p1);var dot=math.dotVec3(p2,worldAxis);var factor=1.0+dot*2.0;if(uniform){self._applyEntityScale([factor,factor,factor]);}else{var axisVec=[1,1,1];if(baseAxis===xBaseAxis)axisVec[0]=factor;else if(baseAxis===yBaseAxis)axisVec[1]=factor;else if(baseAxis===zBaseAxis)axisVec[2]=factor;else axisVec[0]=axisVec[1]=axisVec[2]=factor;self._applyEntityScale(axisVec);}};}();var getPointerPlaneIntersect=function(){var dir=math.vec4([0,0,0,1]);var matrix=math.mat4();return function(mouse,axis,dest,offset){offset=offset||0;dir[0]=mouse[0]/canvas.width*2.0-1.0;dir[1]=-(mouse[1]/canvas.height*2.0-1.0);dir[2]=0.0;dir[3]=1.0;math.mulMat4(camera.projMatrix,camera.viewMatrix,matrix);math.inverseMat4(matrix);math.transformVec4(matrix,dir,dir);math.mulVec4Scalar(dir,1.0/dir[3]);var rayO=camera.eye;math.subVec4(dir,rayO,dir);var origin=self._pos;var d=-math.dotVec3(origin,axis)-offset;var dot=math.dotVec3(axis,dir);if(Math.abs(dot)>0.005){var t=-(math.dotVec3(axis,rayO)+d)/dot;math.mulVec3Scalar(dir,t,dest);math.addVec3(dest,rayO);math.subVec3(dest,origin,dest);return true;}return false;};}();/* ── Hover + mouse/touch events ── */{var down=false;var lastAffordanceMesh;this._onCameraControlHover=this._viewer.cameraControl.on("hoverEnter",function(hit){if(!_this169._visible||down)return;grabbed=false;if(lastAffordanceMesh){lastAffordanceMesh.visible=false;}var affordanceMesh;var meshId=hit.entity.id;switch(meshId){case _this169._displayMeshes.xAxisArrow.id:case _this169._displayMeshes.xAxisArrowHandle.id:case _this169._displayMeshes.xAxis.id:case _this169._displayMeshes.xAxisHandle.id:affordanceMesh=_this169._affordanceMeshes.xAxisArrow;nextDragAction=DRAG_ACTIONS.xTranslate;break;case _this169._displayMeshes.yAxisArrow.id:case _this169._displayMeshes.yAxisArrowHandle.id:case _this169._displayMeshes.yShaft.id:case _this169._displayMeshes.yShaftHandle.id:affordanceMesh=_this169._affordanceMeshes.yAxisArrow;nextDragAction=DRAG_ACTIONS.yTranslate;break;case _this169._displayMeshes.zAxisArrow.id:case _this169._displayMeshes.zAxisArrowHandle.id:case _this169._displayMeshes.zShaft.id:case _this169._displayMeshes.zAxisHandle.id:affordanceMesh=_this169._affordanceMeshes.zAxisArrow;nextDragAction=DRAG_ACTIONS.zTranslate;break;case _this169._displayMeshes.xCurve.id:case _this169._displayMeshes.xCurveHandle.id:case _this169._displayMeshes.xCurveArrow1.id:case _this169._displayMeshes.xCurveArrow2.id:affordanceMesh=_this169._affordanceMeshes.xHoop;nextDragAction=DRAG_ACTIONS.xRotate;break;case _this169._displayMeshes.yCurve.id:case _this169._displayMeshes.yCurveHandle.id:case _this169._displayMeshes.yCurveArrow1.id:case _this169._displayMeshes.yCurveArrow2.id:affordanceMesh=_this169._affordanceMeshes.yHoop;nextDragAction=DRAG_ACTIONS.yRotate;break;case _this169._displayMeshes.zCurve.id:case _this169._displayMeshes.zCurveHandle.id:case _this169._displayMeshes.zCurveArrow1.id:case _this169._displayMeshes.zCurveArrow2.id:affordanceMesh=_this169._affordanceMeshes.zHoop;nextDragAction=DRAG_ACTIONS.zRotate;break;case _this169._displayMeshes.xScaleBoxHandle.id:affordanceMesh=null;nextDragAction=DRAG_ACTIONS.xScale;break;case _this169._displayMeshes.yScaleBoxHandle.id:affordanceMesh=null;nextDragAction=DRAG_ACTIONS.yScale;break;case _this169._displayMeshes.zScaleBoxHandle.id:affordanceMesh=null;nextDragAction=DRAG_ACTIONS.zScale;break;case _this169._displayMeshes.uniformScaleBoxHandle.id:affordanceMesh=null;nextDragAction=DRAG_ACTIONS.uniformScale;break;default:nextDragAction=DRAG_ACTIONS.none;return;}if(affordanceMesh)affordanceMesh.visible=true;lastAffordanceMesh=affordanceMesh;grabbed=true;});this._onCameraControlHoverLeave=this._viewer.cameraControl.on("hoverOut",function(){if(!_this169._visible)return;if(lastAffordanceMesh){lastAffordanceMesh.visible=false;}lastAffordanceMesh=null;nextDragAction=DRAG_ACTIONS.none;grabbed=false;});canvas.addEventListener("mousedown",this._canvasMouseDownListener=function(e){e.preventDefault();if(!_this169._visible||!grabbed)return;_this169._viewer.cameraControl.pointerEnabled=false;if(e.which===1){down=true;var canvasPos=getClickCoordsWithinElement(e);dragAction=nextDragAction;lastCanvasPos[0]=canvasPos[0];lastCanvasPos[1]=canvasPos[1];_this169.plugin.fire("editStart");}});canvas.addEventListener("mousemove",this._canvasMouseMoveListener=function(e){if(!_this169._visible||!down)return;var canvasPos=getClickCoordsWithinElement(e);var x=canvasPos[0],y=canvasPos[1];switch(dragAction){case DRAG_ACTIONS.xTranslate:dragTranslate(xBaseAxis,lastCanvasPos,canvasPos);break;case DRAG_ACTIONS.yTranslate:dragTranslate(yBaseAxis,lastCanvasPos,canvasPos);break;case DRAG_ACTIONS.zTranslate:dragTranslate(zBaseAxis,lastCanvasPos,canvasPos);break;case DRAG_ACTIONS.xRotate:dragRotate(xBaseAxis,lastCanvasPos,canvasPos);break;case DRAG_ACTIONS.yRotate:dragRotate(yBaseAxis,lastCanvasPos,canvasPos);break;case DRAG_ACTIONS.zRotate:dragRotate(zBaseAxis,lastCanvasPos,canvasPos);break;case DRAG_ACTIONS.xScale:dragScale(xBaseAxis,lastCanvasPos,canvasPos,false);break;case DRAG_ACTIONS.yScale:dragScale(yBaseAxis,lastCanvasPos,canvasPos,false);break;case DRAG_ACTIONS.zScale:dragScale(zBaseAxis,lastCanvasPos,canvasPos,false);break;case DRAG_ACTIONS.uniformScale:dragScale(xBaseAxis,lastCanvasPos,canvasPos,true);break;}lastCanvasPos[0]=x;lastCanvasPos[1]=y;});canvas.addEventListener("mouseup",this._canvasMouseUpListener=function(e){if(!_this169._visible)return;_this169._viewer.cameraControl.pointerEnabled=true;if(!down)return;if(e.which===1){down=false;grabbed=false;_this169.plugin.fire("editEnd");}});/* Touch hover */this._onCameraControlTouch=this._viewer.cameraControl.on("touchEntity",function(hit){if(!_this169._visible||down||grabbed)return;grabbed=false;if(lastAffordanceMesh){lastAffordanceMesh.visible=false;}var affordanceMesh;var meshId=hit.entity.id;switch(meshId){case _this169._displayMeshes.xAxisArrow.id:case _this169._displayMeshes.xAxisArrowHandle.id:case _this169._displayMeshes.xAxis.id:case _this169._displayMeshes.xAxisHandle.id:affordanceMesh=_this169._affordanceMeshes.xAxisArrow;nextDragAction=DRAG_ACTIONS.xTranslate;break;case _this169._displayMeshes.yAxisArrow.id:case _this169._displayMeshes.yAxisArrowHandle.id:case _this169._displayMeshes.yShaft.id:case _this169._displayMeshes.yShaftHandle.id:affordanceMesh=_this169._affordanceMeshes.yAxisArrow;nextDragAction=DRAG_ACTIONS.yTranslate;break;case _this169._displayMeshes.zAxisArrow.id:case _this169._displayMeshes.zAxisArrowHandle.id:case _this169._displayMeshes.zShaft.id:case _this169._displayMeshes.zAxisHandle.id:affordanceMesh=_this169._affordanceMeshes.zAxisArrow;nextDragAction=DRAG_ACTIONS.zTranslate;break;case _this169._displayMeshes.xCurve.id:case _this169._displayMeshes.xCurveHandle.id:case _this169._displayMeshes.xCurveArrow1.id:case _this169._displayMeshes.xCurveArrow2.id:affordanceMesh=_this169._affordanceMeshes.xHoop;nextDragAction=DRAG_ACTIONS.xRotate;break;case _this169._displayMeshes.yCurve.id:case _this169._displayMeshes.yCurveHandle.id:case _this169._displayMeshes.yCurveArrow1.id:case _this169._displayMeshes.yCurveArrow2.id:affordanceMesh=_this169._affordanceMeshes.yHoop;nextDragAction=DRAG_ACTIONS.yRotate;break;case _this169._displayMeshes.zCurve.id:case _this169._displayMeshes.zCurveHandle.id:case _this169._displayMeshes.zCurveArrow1.id:case _this169._displayMeshes.zCurveArrow2.id:affordanceMesh=_this169._affordanceMeshes.zHoop;nextDragAction=DRAG_ACTIONS.zRotate;break;case _this169._displayMeshes.xScaleBoxHandle.id:affordanceMesh=null;nextDragAction=DRAG_ACTIONS.xScale;break;case _this169._displayMeshes.yScaleBoxHandle.id:affordanceMesh=null;nextDragAction=DRAG_ACTIONS.yScale;break;case _this169._displayMeshes.zScaleBoxHandle.id:affordanceMesh=null;nextDragAction=DRAG_ACTIONS.zScale;break;case _this169._displayMeshes.uniformScaleBoxHandle.id:affordanceMesh=null;nextDragAction=DRAG_ACTIONS.uniformScale;break;default:nextDragAction=DRAG_ACTIONS.none;return;}if(affordanceMesh)affordanceMesh.visible=true;lastAffordanceMesh=affordanceMesh;grabbed=true;});canvas.addEventListener("touchstart",this._canvasTouchStartListener=function(e){e.preventDefault();if(!_this169._visible||!grabbed)return;_this169._viewer.cameraControl.pointerEnabled=false;down=true;var canvasPos=getTouchCoordsWithinElement(e);dragAction=nextDragAction;lastCanvasPos[0]=canvasPos[0];lastCanvasPos[1]=canvasPos[1];_this169.plugin.fire("editStart");});canvas.addEventListener("touchmove",this._canvasTouchMoveListener=function(e){if(!_this169._visible||!down)return;var canvasPos=getTouchCoordsWithinElement(e);var x=canvasPos[0],y=canvasPos[1];switch(dragAction){case DRAG_ACTIONS.xTranslate:dragTranslate(xBaseAxis,lastCanvasPos,canvasPos);break;case DRAG_ACTIONS.yTranslate:dragTranslate(yBaseAxis,lastCanvasPos,canvasPos);break;case DRAG_ACTIONS.zTranslate:dragTranslate(zBaseAxis,lastCanvasPos,canvasPos);break;case DRAG_ACTIONS.xRotate:dragRotate(xBaseAxis,lastCanvasPos,canvasPos);break;case DRAG_ACTIONS.yRotate:dragRotate(yBaseAxis,lastCanvasPos,canvasPos);break;case DRAG_ACTIONS.zRotate:dragRotate(zBaseAxis,lastCanvasPos,canvasPos);break;case DRAG_ACTIONS.xScale:dragScale(xBaseAxis,lastCanvasPos,canvasPos,false);break;case DRAG_ACTIONS.yScale:dragScale(yBaseAxis,lastCanvasPos,canvasPos,false);break;case DRAG_ACTIONS.zScale:dragScale(zBaseAxis,lastCanvasPos,canvasPos,false);break;case DRAG_ACTIONS.uniformScale:dragScale(xBaseAxis,lastCanvasPos,canvasPos,true);break;}lastCanvasPos[0]=x;lastCanvasPos[1]=y;});canvas.addEventListener("touchend",this._canvasTouchEndListener=function(e){if(!_this169._visible)return;_this169._viewer.cameraControl.pointerEnabled=true;if(lastAffordanceMesh){lastAffordanceMesh.visible=false;}lastAffordanceMesh=null;nextDragAction=DRAG_ACTIONS.none;down=false;grabbed=false;_this169.plugin.fire("editEnd");});canvas.addEventListener("touchcancel",this._canvasTouchEndListener);}}/* ======================== ENTITY UPDATE ======================== */ // ── Public programmatic API ──
29560
+ this._affordanceMeshes={xHoop:rootNode.addChild(new Mesh(rootNode,{geometry:shapes.hoop,material:materials.red,highlighted:true,highlightMaterial:materials.highlightRed,matrix:function(){var r2=math.rotationMat4v(90*math.DEGTORAD,[0,1,0],math.identityMat4());var r1=math.rotationMat4v(270*math.DEGTORAD,[1,0,0],math.identityMat4());return math.mulMat4(r1,r2,math.identityMat4());}(),pickable:false,collidable:false,clippable:false,visible:false,isObject:false}),NO_STATE_INHERIT),yHoop:rootNode.addChild(new Mesh(rootNode,{geometry:shapes.hoop,material:materials.green,highlighted:true,highlightMaterial:materials.highlightGreen,rotation:[-90,0,0],pickable:false,collidable:false,clippable:false,visible:false,isObject:false}),NO_STATE_INHERIT),zHoop:rootNode.addChild(new Mesh(rootNode,{geometry:shapes.hoop,material:materials.blue,highlighted:true,highlightMaterial:materials.highlightBlue,matrix:math.rotationMat4v(180*math.DEGTORAD,[1,0,0],math.identityMat4()),pickable:false,collidable:false,clippable:false,backfaces:true,visible:false,isObject:false}),NO_STATE_INHERIT),xAxisArrow:rootNode.addChild(new Mesh(rootNode,{geometry:shapes.arrowHeadBig,material:materials.red,matrix:function(){var t=math.translateMat4c(0,radius+0.1,0,math.identityMat4());var r=math.rotationMat4v(-90*math.DEGTORAD,[0,0,1],math.identityMat4());return math.mulMat4(r,t,math.identityMat4());}(),pickable:false,collidable:false,clippable:false,visible:false,isObject:false}),NO_STATE_INHERIT),yAxisArrow:rootNode.addChild(new Mesh(rootNode,{geometry:shapes.arrowHeadBig,material:materials.green,matrix:math.translateMat4c(0,radius+0.1,0,math.identityMat4()),pickable:false,collidable:false,clippable:false,visible:false,isObject:false}),NO_STATE_INHERIT),zAxisArrow:rootNode.addChild(new Mesh(rootNode,{geometry:shapes.arrowHeadBig,material:materials.blue,matrix:function(){var t=math.translateMat4c(0,radius+0.1,0,math.identityMat4());var r=math.rotationMat4v(90*math.DEGTORAD,[1,0,0],math.identityMat4());return math.mulMat4(r,t,math.identityMat4());}(),pickable:false,collidable:false,clippable:false,visible:false,isObject:false}),NO_STATE_INHERIT)};}/* ======================== EVENT BINDING ======================== */},{key:"_bindEvents",value:function _bindEvents(){var _this173=this;var self=this;var grabbed=false;var DRAG_ACTIONS={none:-1,xTranslate:0,yTranslate:1,zTranslate:2,xRotate:3,yRotate:4,zRotate:5,xScale:6,yScale:7,zScale:8,uniformScale:9};var rootNode=this._rootNode;var nextDragAction=DRAG_ACTIONS.none;var dragAction=DRAG_ACTIONS.none;var lastCanvasPos=math.vec2();var xBaseAxis=math.vec3([1,0,0]);var yBaseAxis=math.vec3([0,1,0]);var zBaseAxis=math.vec3([0,0,1]);var canvas=this._viewer.scene.canvas.canvas;var camera=this._viewer.camera;var scene=this._viewer.scene;/* keep gizmo screen size constant */{var _tempVec3a4=math.vec3([0,0,0]);var lastDist=-1;this._onCameraViewMatrix=scene.camera.on("viewMatrix",function(){lastDist=-1;});this._onCameraProjMatrix=scene.camera.on("projMatrix",function(){lastDist=-1;});this._onSceneTick=scene.on("tick",function(){var dist=Math.abs(math.lenVec3(math.subVec3(scene.camera.eye,_this173._pos,_tempVec3a4)));if(dist!==lastDist){if(camera.projection==="perspective"){var worldSize=Math.tan(camera.perspective.fov*math.DEGTORAD)*dist;rootNode.scale=[0.07*worldSize,0.07*worldSize,0.07*worldSize];}if(camera.projection==="ortho"){rootNode.scale=[camera.ortho.scale/10,camera.ortho.scale/10,camera.ortho.scale/10];}lastDist=dist;}});}var getClickCoordsWithinElement=function(){var canvasPos=new Float64Array(2);return function(event){if(!event){event=window.event;canvasPos[0]=event.x;canvasPos[1]=event.y;return canvasPos;}var element=event.target;var totalOffsetLeft=0,totalOffsetTop=0;while(element.offsetParent){totalOffsetLeft+=element.offsetLeft;totalOffsetTop+=element.offsetTop;element=element.offsetParent;}canvasPos[0]=event.pageX-totalOffsetLeft;canvasPos[1]=event.pageY-totalOffsetTop;return canvasPos;};}();var getTouchCoordsWithinElement=function(){var canvasPos=new Float64Array(2);return function(event){if(!event){event=window.event;}if(event.touches&&event.touches.length){canvasPos[0]=event.touches[0].pageX;canvasPos[1]=event.touches[0].pageY;}else{var element=event.target;var totalOffsetLeft=0,totalOffsetTop=0;while(element.offsetParent){totalOffsetLeft+=element.offsetLeft;totalOffsetTop+=element.offsetTop;element=element.offsetParent;}canvasPos[0]=event.pageX-totalOffsetLeft;canvasPos[1]=event.pageY-totalOffsetTop;}return canvasPos;};}();var localToWorldVec=function(){var mat=math.mat4();return function(localVec,worldVec){math.quaternionToMat4(rootNode.quaternion,mat);math.transformVec3(mat,localVec,worldVec);math.normalizeVec3(worldVec);return worldVec;};}();var getTranslationPlane=function(){var planeNormal=math.vec3();return function(worldAxis){var absX=Math.abs(worldAxis[0]);if(absX>Math.abs(worldAxis[1])&&absX>Math.abs(worldAxis[2]))math.cross3Vec3(worldAxis,[0,1,0],planeNormal);else math.cross3Vec3(worldAxis,[1,0,0],planeNormal);math.cross3Vec3(planeNormal,worldAxis,planeNormal);math.normalizeVec3(planeNormal);return planeNormal;};}();/* ── Drag translate entities ── */var dragTranslate=function(){var p1=math.vec3(),p2=math.vec3(),worldAxis=math.vec4();return function(baseAxis,fromMouse,toMouse){localToWorldVec(baseAxis,worldAxis);var planeNormal=getTranslationPlane(worldAxis,fromMouse,toMouse);getPointerPlaneIntersect(fromMouse,planeNormal,p1);getPointerPlaneIntersect(toMouse,planeNormal,p2);math.subVec3(p2,p1);var dot=math.dotVec3(p2,worldAxis);self._pos[0]+=worldAxis[0]*dot*0.6;self._pos[1]+=worldAxis[1]*dot*0.6;self._pos[2]+=worldAxis[2]*dot*0.6;// Update root node using RTC coordinates (convert world -> RTC)
29561
+ self._setPos(self._pos);self._applyEntityTranslation(worldAxis,dot*0.6);};}();/* ── Drag rotate entities ── */var dragRotate=function(){var p1=math.vec4(),p2=math.vec4(),c=math.vec4(),worldAxis=math.vec4();return function(baseAxis,fromMouse,toMouse){localToWorldVec(baseAxis,worldAxis);var hasData=getPointerPlaneIntersect(fromMouse,worldAxis,p1)&&getPointerPlaneIntersect(toMouse,worldAxis,p2);if(!hasData){var planeNormal=getTranslationPlane(worldAxis,fromMouse,toMouse);getPointerPlaneIntersect(fromMouse,planeNormal,p1,1);getPointerPlaneIntersect(toMouse,planeNormal,p2,1);var dot=math.dotVec3(p1,worldAxis);p1[0]-=dot*worldAxis[0];p1[1]-=dot*worldAxis[1];p1[2]-=dot*worldAxis[2];dot=math.dotVec3(p2,worldAxis);p2[0]-=dot*worldAxis[0];p2[1]-=dot*worldAxis[1];p2[2]-=dot*worldAxis[2];}math.normalizeVec3(p1);math.normalizeVec3(p2);var dot=math.dotVec3(p1,p2);dot=math.clamp(dot,-1.0,1.0);var incDegrees=Math.acos(dot)*math.RADTODEG;math.cross3Vec3(p1,p2,c);if(math.dotVec3(c,worldAxis)<0.0)incDegrees=-incDegrees;rootNode.rotate(baseAxis,incDegrees);self._applyEntityRotation(baseAxis,incDegrees);};}();/* ── Drag scale entities ── */var dragScale=function(){var p1=math.vec3(),p2=math.vec3(),worldAxis=math.vec4();return function(baseAxis,fromMouse,toMouse,uniform){localToWorldVec(baseAxis,worldAxis);var planeNormal=getTranslationPlane(worldAxis,fromMouse,toMouse);getPointerPlaneIntersect(fromMouse,planeNormal,p1);getPointerPlaneIntersect(toMouse,planeNormal,p2);math.subVec3(p2,p1);var dot=math.dotVec3(p2,worldAxis);var factor=1.0+dot*2.0;if(uniform){self._applyEntityScale([factor,factor,factor]);}else{var axisVec=[1,1,1];if(baseAxis===xBaseAxis)axisVec[0]=factor;else if(baseAxis===yBaseAxis)axisVec[1]=factor;else if(baseAxis===zBaseAxis)axisVec[2]=factor;else axisVec[0]=axisVec[1]=axisVec[2]=factor;self._applyEntityScale(axisVec);}};}();var getPointerPlaneIntersect=function(){var dir=math.vec4([0,0,0,1]);var matrix=math.mat4();return function(mouse,axis,dest,offset){offset=offset||0;dir[0]=mouse[0]/canvas.width*2.0-1.0;dir[1]=-(mouse[1]/canvas.height*2.0-1.0);dir[2]=0.0;dir[3]=1.0;math.mulMat4(camera.projMatrix,camera.viewMatrix,matrix);math.inverseMat4(matrix);math.transformVec4(matrix,dir,dir);math.mulVec4Scalar(dir,1.0/dir[3]);var rayO=camera.eye;math.subVec4(dir,rayO,dir);var origin=self._pos;var d=-math.dotVec3(origin,axis)-offset;var dot=math.dotVec3(axis,dir);if(Math.abs(dot)>0.005){var t=-(math.dotVec3(axis,rayO)+d)/dot;math.mulVec3Scalar(dir,t,dest);math.addVec3(dest,rayO);math.subVec3(dest,origin,dest);return true;}return false;};}();/* ── Hover + mouse/touch events ── */{var down=false;var lastAffordanceMesh;this._onCameraControlHover=this._viewer.cameraControl.on("hoverEnter",function(hit){if(!_this173._visible||down)return;grabbed=false;if(lastAffordanceMesh){lastAffordanceMesh.visible=false;}var affordanceMesh;var meshId=hit.entity.id;switch(meshId){case _this173._displayMeshes.xAxisArrow.id:case _this173._displayMeshes.xAxisArrowHandle.id:case _this173._displayMeshes.xAxis.id:case _this173._displayMeshes.xAxisHandle.id:affordanceMesh=_this173._affordanceMeshes.xAxisArrow;nextDragAction=DRAG_ACTIONS.xTranslate;break;case _this173._displayMeshes.yAxisArrow.id:case _this173._displayMeshes.yAxisArrowHandle.id:case _this173._displayMeshes.yShaft.id:case _this173._displayMeshes.yShaftHandle.id:affordanceMesh=_this173._affordanceMeshes.yAxisArrow;nextDragAction=DRAG_ACTIONS.yTranslate;break;case _this173._displayMeshes.zAxisArrow.id:case _this173._displayMeshes.zAxisArrowHandle.id:case _this173._displayMeshes.zShaft.id:case _this173._displayMeshes.zAxisHandle.id:affordanceMesh=_this173._affordanceMeshes.zAxisArrow;nextDragAction=DRAG_ACTIONS.zTranslate;break;case _this173._displayMeshes.xCurve.id:case _this173._displayMeshes.xCurveHandle.id:case _this173._displayMeshes.xCurveArrow1.id:case _this173._displayMeshes.xCurveArrow2.id:affordanceMesh=_this173._affordanceMeshes.xHoop;nextDragAction=DRAG_ACTIONS.xRotate;break;case _this173._displayMeshes.yCurve.id:case _this173._displayMeshes.yCurveHandle.id:case _this173._displayMeshes.yCurveArrow1.id:case _this173._displayMeshes.yCurveArrow2.id:affordanceMesh=_this173._affordanceMeshes.yHoop;nextDragAction=DRAG_ACTIONS.yRotate;break;case _this173._displayMeshes.zCurve.id:case _this173._displayMeshes.zCurveHandle.id:case _this173._displayMeshes.zCurveArrow1.id:case _this173._displayMeshes.zCurveArrow2.id:affordanceMesh=_this173._affordanceMeshes.zHoop;nextDragAction=DRAG_ACTIONS.zRotate;break;case _this173._displayMeshes.xScaleBoxHandle.id:affordanceMesh=null;nextDragAction=DRAG_ACTIONS.xScale;break;case _this173._displayMeshes.yScaleBoxHandle.id:affordanceMesh=null;nextDragAction=DRAG_ACTIONS.yScale;break;case _this173._displayMeshes.zScaleBoxHandle.id:affordanceMesh=null;nextDragAction=DRAG_ACTIONS.zScale;break;case _this173._displayMeshes.uniformScaleBoxHandle.id:affordanceMesh=null;nextDragAction=DRAG_ACTIONS.uniformScale;break;default:nextDragAction=DRAG_ACTIONS.none;return;}if(affordanceMesh)affordanceMesh.visible=true;lastAffordanceMesh=affordanceMesh;grabbed=true;});this._onCameraControlHoverLeave=this._viewer.cameraControl.on("hoverOut",function(){if(!_this173._visible)return;if(lastAffordanceMesh){lastAffordanceMesh.visible=false;}lastAffordanceMesh=null;nextDragAction=DRAG_ACTIONS.none;grabbed=false;});canvas.addEventListener("mousedown",this._canvasMouseDownListener=function(e){e.preventDefault();if(!_this173._visible||!grabbed)return;_this173._viewer.cameraControl.pointerEnabled=false;if(e.which===1){down=true;var canvasPos=getClickCoordsWithinElement(e);dragAction=nextDragAction;lastCanvasPos[0]=canvasPos[0];lastCanvasPos[1]=canvasPos[1];_this173.plugin.fire("editStart");}});canvas.addEventListener("mousemove",this._canvasMouseMoveListener=function(e){if(!_this173._visible||!down)return;var canvasPos=getClickCoordsWithinElement(e);var x=canvasPos[0],y=canvasPos[1];switch(dragAction){case DRAG_ACTIONS.xTranslate:dragTranslate(xBaseAxis,lastCanvasPos,canvasPos);break;case DRAG_ACTIONS.yTranslate:dragTranslate(yBaseAxis,lastCanvasPos,canvasPos);break;case DRAG_ACTIONS.zTranslate:dragTranslate(zBaseAxis,lastCanvasPos,canvasPos);break;case DRAG_ACTIONS.xRotate:dragRotate(xBaseAxis,lastCanvasPos,canvasPos);break;case DRAG_ACTIONS.yRotate:dragRotate(yBaseAxis,lastCanvasPos,canvasPos);break;case DRAG_ACTIONS.zRotate:dragRotate(zBaseAxis,lastCanvasPos,canvasPos);break;case DRAG_ACTIONS.xScale:dragScale(xBaseAxis,lastCanvasPos,canvasPos,false);break;case DRAG_ACTIONS.yScale:dragScale(yBaseAxis,lastCanvasPos,canvasPos,false);break;case DRAG_ACTIONS.zScale:dragScale(zBaseAxis,lastCanvasPos,canvasPos,false);break;case DRAG_ACTIONS.uniformScale:dragScale(xBaseAxis,lastCanvasPos,canvasPos,true);break;}lastCanvasPos[0]=x;lastCanvasPos[1]=y;});canvas.addEventListener("mouseup",this._canvasMouseUpListener=function(e){if(!_this173._visible)return;_this173._viewer.cameraControl.pointerEnabled=true;if(!down)return;if(e.which===1){down=false;grabbed=false;_this173.plugin.fire("editEnd");}});/* Touch hover */this._onCameraControlTouch=this._viewer.cameraControl.on("touchEntity",function(hit){if(!_this173._visible||down||grabbed)return;grabbed=false;if(lastAffordanceMesh){lastAffordanceMesh.visible=false;}var affordanceMesh;var meshId=hit.entity.id;switch(meshId){case _this173._displayMeshes.xAxisArrow.id:case _this173._displayMeshes.xAxisArrowHandle.id:case _this173._displayMeshes.xAxis.id:case _this173._displayMeshes.xAxisHandle.id:affordanceMesh=_this173._affordanceMeshes.xAxisArrow;nextDragAction=DRAG_ACTIONS.xTranslate;break;case _this173._displayMeshes.yAxisArrow.id:case _this173._displayMeshes.yAxisArrowHandle.id:case _this173._displayMeshes.yShaft.id:case _this173._displayMeshes.yShaftHandle.id:affordanceMesh=_this173._affordanceMeshes.yAxisArrow;nextDragAction=DRAG_ACTIONS.yTranslate;break;case _this173._displayMeshes.zAxisArrow.id:case _this173._displayMeshes.zAxisArrowHandle.id:case _this173._displayMeshes.zShaft.id:case _this173._displayMeshes.zAxisHandle.id:affordanceMesh=_this173._affordanceMeshes.zAxisArrow;nextDragAction=DRAG_ACTIONS.zTranslate;break;case _this173._displayMeshes.xCurve.id:case _this173._displayMeshes.xCurveHandle.id:case _this173._displayMeshes.xCurveArrow1.id:case _this173._displayMeshes.xCurveArrow2.id:affordanceMesh=_this173._affordanceMeshes.xHoop;nextDragAction=DRAG_ACTIONS.xRotate;break;case _this173._displayMeshes.yCurve.id:case _this173._displayMeshes.yCurveHandle.id:case _this173._displayMeshes.yCurveArrow1.id:case _this173._displayMeshes.yCurveArrow2.id:affordanceMesh=_this173._affordanceMeshes.yHoop;nextDragAction=DRAG_ACTIONS.yRotate;break;case _this173._displayMeshes.zCurve.id:case _this173._displayMeshes.zCurveHandle.id:case _this173._displayMeshes.zCurveArrow1.id:case _this173._displayMeshes.zCurveArrow2.id:affordanceMesh=_this173._affordanceMeshes.zHoop;nextDragAction=DRAG_ACTIONS.zRotate;break;case _this173._displayMeshes.xScaleBoxHandle.id:affordanceMesh=null;nextDragAction=DRAG_ACTIONS.xScale;break;case _this173._displayMeshes.yScaleBoxHandle.id:affordanceMesh=null;nextDragAction=DRAG_ACTIONS.yScale;break;case _this173._displayMeshes.zScaleBoxHandle.id:affordanceMesh=null;nextDragAction=DRAG_ACTIONS.zScale;break;case _this173._displayMeshes.uniformScaleBoxHandle.id:affordanceMesh=null;nextDragAction=DRAG_ACTIONS.uniformScale;break;default:nextDragAction=DRAG_ACTIONS.none;return;}if(affordanceMesh)affordanceMesh.visible=true;lastAffordanceMesh=affordanceMesh;grabbed=true;});canvas.addEventListener("touchstart",this._canvasTouchStartListener=function(e){e.preventDefault();if(!_this173._visible||!grabbed)return;_this173._viewer.cameraControl.pointerEnabled=false;down=true;var canvasPos=getTouchCoordsWithinElement(e);dragAction=nextDragAction;lastCanvasPos[0]=canvasPos[0];lastCanvasPos[1]=canvasPos[1];_this173.plugin.fire("editStart");});canvas.addEventListener("touchmove",this._canvasTouchMoveListener=function(e){if(!_this173._visible||!down)return;var canvasPos=getTouchCoordsWithinElement(e);var x=canvasPos[0],y=canvasPos[1];switch(dragAction){case DRAG_ACTIONS.xTranslate:dragTranslate(xBaseAxis,lastCanvasPos,canvasPos);break;case DRAG_ACTIONS.yTranslate:dragTranslate(yBaseAxis,lastCanvasPos,canvasPos);break;case DRAG_ACTIONS.zTranslate:dragTranslate(zBaseAxis,lastCanvasPos,canvasPos);break;case DRAG_ACTIONS.xRotate:dragRotate(xBaseAxis,lastCanvasPos,canvasPos);break;case DRAG_ACTIONS.yRotate:dragRotate(yBaseAxis,lastCanvasPos,canvasPos);break;case DRAG_ACTIONS.zRotate:dragRotate(zBaseAxis,lastCanvasPos,canvasPos);break;case DRAG_ACTIONS.xScale:dragScale(xBaseAxis,lastCanvasPos,canvasPos,false);break;case DRAG_ACTIONS.yScale:dragScale(yBaseAxis,lastCanvasPos,canvasPos,false);break;case DRAG_ACTIONS.zScale:dragScale(zBaseAxis,lastCanvasPos,canvasPos,false);break;case DRAG_ACTIONS.uniformScale:dragScale(xBaseAxis,lastCanvasPos,canvasPos,true);break;}lastCanvasPos[0]=x;lastCanvasPos[1]=y;});canvas.addEventListener("touchend",this._canvasTouchEndListener=function(e){if(!_this173._visible)return;_this173._viewer.cameraControl.pointerEnabled=true;if(lastAffordanceMesh){lastAffordanceMesh.visible=false;}lastAffordanceMesh=null;nextDragAction=DRAG_ACTIONS.none;down=false;grabbed=false;_this173.plugin.fire("editEnd");});canvas.addEventListener("touchcancel",this._canvasTouchEndListener);}}/* ======================== ENTITY UPDATE ======================== */ // ── Public programmatic API ──
29236
29562
  /** @param {number[]} delta World-space translation [dx, dy, dz] */},{key:"translate",value:function translate(delta){this._pos[0]+=delta[0];this._pos[1]+=delta[1];this._pos[2]+=delta[2];this._setPos(this._pos);this._applyEntityTranslationRaw(delta);}/** @param {number[]} axis Rotation axis [x, y, z] (normalized)
29237
- * @param {number} degrees Rotation angle in degrees */},{key:"rotate",value:function rotate(axis,degrees){this._rootNode.rotate(axis,degrees);this._applyEntityRotation(axis,degrees);}/** @param {number[]} quat Absolute rotation quaternion [x, y, z, w] */},{key:"setRotation",value:function setRotation(quat){var _this170=this;for(var _i610=0,len=this._batchedRotEntries.length;_i610<len;_i610++){var entry=this._batchedRotEntries[_i610];entry.quat.set(quat);var rotMat=math.mat4();math.quaternionToMat4(quat,rotMat);var toOrigin=math.translationMat4v([-entry.center[0],-entry.center[1],-entry.center[2]],math.mat4());var fromOrigin=math.translationMat4v(entry.center,math.mat4());var pivotRot=math.mulMat4(fromOrigin,math.mulMat4(rotMat,toOrigin,math.mat4()),math.mat4());entry.layer.setMatrix(entry.portionId,pivotRot);}// For instanced entries
29238
- var _loop5=function _loop5(){var id=_this170._targetIds[_i611];if(_this170._batchedRotEntries.some(function(e){return e.entityId===id;}))return 1;// continue
29239
- _this170._scene.setObjectsQuaternion([id],quat);};for(var _i611=0,_len115=this._targetIds.length;_i611<_len115;_i611++){if(_loop5())continue;}// Sync gizmo orientation
29240
- this._rootNode.quaternion=[quat[0],quat[1],quat[2],quat[3]];}/** @param {number[]} scale Scale factors [sx, sy, sz] */},{key:"setScale",value:function setScale(scale){var _this171=this;var _loop6=function _loop6(){var id=_this171._targetIds[_i612];if(_this171._batchedRotEntries.some(function(e){return e.entityId===id;}))return 1;// continue
29241
- _this171._scene.setObjectsScale([id],scale);};for(var _i612=0,len=this._targetIds.length;_i612<len;_i612++){if(_loop6())continue;}}/** @returns {number[]} Current centroid position [x, y, z] */},{key:"getPosition",value:function getPosition(){return[this._pos[0],this._pos[1],this._pos[2]];}/** @returns {number[]|null} Accumulated rotation quaternion [x,y,z,w] or null */},{key:"getRotation",value:function getRotation(){if(this._batchedRotEntries.length>0){var q=this._batchedRotEntries[0].quat;return[q[0],q[1],q[2],q[3]];}if(this._targetIds.length>0){var _q2=this._scene.getObjectQuaternion(this._targetIds[0]);if(_q2)return _q2;}return null;}/** Reset all transforms to identity on current targets */},{key:"resetTransform",value:function resetTransform(){var _this172=this;// Reset batched entries to identity (no rotation, no pivot shift)
29242
- for(var _i613=0,len=this._batchedRotEntries.length;_i613<len;_i613++){var entry=this._batchedRotEntries[_i613];entry.quat.set([0,0,0,1]);entry.layer.setMatrix(entry.portionId,math.identityMat4());}// Also clear persisted state
29243
- for(var _i614=0,_len116=this._targetIds.length;_i614<_len116;_i614++){var state=this._rotationState[this._targetIds[_i614]];if(state)state.quat.set([0,0,0,1]);}// Reset instanced entries
29244
- var _loop7=function _loop7(){var id=_this172._targetIds[_i615];if(_this172._batchedRotEntries.some(function(e){return e.entityId===id;}))return 1;// continue
29245
- _this172._scene.setObjectsQuaternion([id],[0,0,0,1]);_this172._scene.setObjectsScale([id],[1,1,1]);};for(var _i615=0,_len117=this._targetIds.length;_i615<_len117;_i615++){if(_loop7())continue;}this._rootNode.quaternion=[0,0,0,1];}/** Start continuous rotation animation around an axis.
29563
+ * @param {number} degrees Rotation angle in degrees */},{key:"rotate",value:function rotate(axis,degrees){this._rootNode.rotate(axis,degrees);this._applyEntityRotation(axis,degrees);}/** @param {number[]} quat Absolute rotation quaternion [x, y, z, w] */},{key:"setRotation",value:function setRotation(quat){var _this174=this;for(var _i614=0,len=this._batchedRotEntries.length;_i614<len;_i614++){var entry=this._batchedRotEntries[_i614];entry.quat.set(quat);var rotMat=math.mat4();math.quaternionToMat4(quat,rotMat);var toOrigin=math.translationMat4v([-entry.center[0],-entry.center[1],-entry.center[2]],math.mat4());var fromOrigin=math.translationMat4v(entry.center,math.mat4());var pivotRot=math.mulMat4(fromOrigin,math.mulMat4(rotMat,toOrigin,math.mat4()),math.mat4());entry.layer.setMatrix(entry.portionId,pivotRot);}// For instanced entries
29564
+ var _loop5=function _loop5(){var id=_this174._targetIds[_i615];if(_this174._batchedRotEntries.some(function(e){return e.entityId===id;}))return 1;// continue
29565
+ _this174._scene.setObjectsQuaternion([id],quat);};for(var _i615=0,_len115=this._targetIds.length;_i615<_len115;_i615++){if(_loop5())continue;}// Sync gizmo orientation
29566
+ this._rootNode.quaternion=[quat[0],quat[1],quat[2],quat[3]];}/** @param {number[]} scale Scale factors [sx, sy, sz] */},{key:"setScale",value:function setScale(scale){var _this175=this;var _loop6=function _loop6(){var id=_this175._targetIds[_i616];if(_this175._batchedRotEntries.some(function(e){return e.entityId===id;}))return 1;// continue
29567
+ _this175._scene.setObjectsScale([id],scale);};for(var _i616=0,len=this._targetIds.length;_i616<len;_i616++){if(_loop6())continue;}}/** @returns {number[]} Current centroid position [x, y, z] */},{key:"getPosition",value:function getPosition(){return[this._pos[0],this._pos[1],this._pos[2]];}/** @returns {number[]|null} Accumulated rotation quaternion [x,y,z,w] or null */},{key:"getRotation",value:function getRotation(){if(this._batchedRotEntries.length>0){var q=this._batchedRotEntries[0].quat;return[q[0],q[1],q[2],q[3]];}if(this._targetIds.length>0){var _q2=this._scene.getObjectQuaternion(this._targetIds[0]);if(_q2)return _q2;}return null;}/** Reset all transforms to identity on current targets */},{key:"resetTransform",value:function resetTransform(){var _this176=this;// Reset batched entries to identity (no rotation, no pivot shift)
29568
+ for(var _i617=0,len=this._batchedRotEntries.length;_i617<len;_i617++){var entry=this._batchedRotEntries[_i617];entry.quat.set([0,0,0,1]);entry.layer.setMatrix(entry.portionId,math.identityMat4());}// Also clear persisted state
29569
+ for(var _i618=0,_len116=this._targetIds.length;_i618<_len116;_i618++){var state=this._rotationState[this._targetIds[_i618]];if(state)state.quat.set([0,0,0,1]);}// Reset instanced entries
29570
+ var _loop7=function _loop7(){var id=_this176._targetIds[_i619];if(_this176._batchedRotEntries.some(function(e){return e.entityId===id;}))return 1;// continue
29571
+ _this176._scene.setObjectsQuaternion([id],[0,0,0,1]);_this176._scene.setObjectsScale([id],[1,1,1]);};for(var _i619=0,_len117=this._targetIds.length;_i619<_len117;_i619++){if(_loop7())continue;}this._rootNode.quaternion=[0,0,0,1];}/** Start continuous rotation animation around an axis.
29246
29572
  * @param {number[]} axis — normalized axis [x, y, z]
29247
29573
  * @param {number} degreesPerSec — rotation speed in degrees per second
29248
29574
  * @param {number} [duration] — optional max duration in seconds, omit for infinite */},{key:"animateRotation",value:function animateRotation(axis,degreesPerSec,duration){this.stopAnimation();var self=this;var startTime=performance.now();var lastTime=startTime;var _loop8=function loop(now){var elapsed=(now-startTime)/1000;if(duration&&elapsed>=duration){self.stopAnimation();return;}var dt=Math.min((now-lastTime)/1000,0.1);lastTime=now;var deg=degreesPerSec*dt;self._rootNode.rotate(axis,deg);self._applyEntityRotation(axis,deg);self._animRAF=requestAnimationFrame(_loop8);};this._animRAF=requestAnimationFrame(_loop8);}/** Stop any running rotation animation. */},{key:"stopAnimation",value:function stopAnimation(){if(this._animRAF){cancelAnimationFrame(this._animRAF);this._animRAF=null;}}/** Check if animation is running. @returns {boolean} */},{key:"isAnimating",value:function isAnimating(){return!!this._animRAF;}// ── Internal helpers ──
29249
- },{key:"_applyEntityTranslationRaw",value:function _applyEntityTranslationRaw(delta){var scene=this._scene;for(var _i616=0,len=this._targetIds.length;_i616<len;_i616++){var id=this._targetIds[_i616];var entity=scene._findObjectEntity(id);if(entity&&entity.position){var _p5=entity.position;scene.setObjectsPosition([id],[_p5[0]+delta[0],_p5[1]+delta[1],_p5[2]+delta[2]]);}else if(entity&&entity.matrix){var m=entity.matrix.slice();m[12]+=delta[0];m[13]+=delta[1];m[14]+=delta[2];scene.setObjectsMatrix([id],m);}else if(entity&&entity.offset){var off=entity.offset;scene.setObjectsOffset([id],[off[0]+delta[0],off[1]+delta[1],off[2]+delta[2]]);}}}},{key:"_applyEntityTranslation",value:function _applyEntityTranslation(worldAxis,dot){var scene=this._scene;var delta=[worldAxis[0]*dot,worldAxis[1]*dot,worldAxis[2]*dot];for(var _i617=0,len=this._targetIds.length;_i617<len;_i617++){var id=this._targetIds[_i617];var entity=scene._findObjectEntity(id);if(entity&&entity.position){var _p6=entity.position;var newPos=[_p6[0]+delta[0],_p6[1]+delta[1],_p6[2]+delta[2]];scene.setObjectsPosition([id],newPos);}else if(entity&&entity.matrix){var m=entity.matrix.slice();m[12]+=delta[0];m[13]+=delta[1];m[14]+=delta[2];scene.setObjectsMatrix([id],m);}else if(entity&&entity.offset){var off=entity.offset;var newOff=[off[0]+delta[0],off[1]+delta[1],off[2]+delta[2]];scene.setObjectsOffset([id],newOff);}}}},{key:"_applyEntityRotation",value:function _applyEntityRotation(baseAxis,degrees){var _this173=this;var scene=this._scene;var quatDelta=math.vec4();math.angleAxisToQuaternion([baseAxis[0],baseAxis[1],baseAxis[2],degrees*math.DEGTORAD],quatDelta);// --- Batched meshes: direct layer.setMatrix ---
29250
- for(var _i618=0,len=this._batchedRotEntries.length;_i618<len;_i618++){var entry=this._batchedRotEntries[_i618];var newQ=math.vec4();// Post-multiply (existing * delta) — same order as Node.rotate for correct direction
29575
+ },{key:"_applyEntityTranslationRaw",value:function _applyEntityTranslationRaw(delta){var scene=this._scene;for(var _i620=0,len=this._targetIds.length;_i620<len;_i620++){var id=this._targetIds[_i620];var entity=scene._findObjectEntity(id);if(entity&&entity.position){var _p5=entity.position;scene.setObjectsPosition([id],[_p5[0]+delta[0],_p5[1]+delta[1],_p5[2]+delta[2]]);}else if(entity&&entity.matrix){var m=entity.matrix.slice();m[12]+=delta[0];m[13]+=delta[1];m[14]+=delta[2];scene.setObjectsMatrix([id],m);}else if(entity&&entity.offset){var off=entity.offset;scene.setObjectsOffset([id],[off[0]+delta[0],off[1]+delta[1],off[2]+delta[2]]);}}}},{key:"_applyEntityTranslation",value:function _applyEntityTranslation(worldAxis,dot){var scene=this._scene;var delta=[worldAxis[0]*dot,worldAxis[1]*dot,worldAxis[2]*dot];for(var _i621=0,len=this._targetIds.length;_i621<len;_i621++){var id=this._targetIds[_i621];var entity=scene._findObjectEntity(id);if(entity&&entity.position){var _p6=entity.position;var newPos=[_p6[0]+delta[0],_p6[1]+delta[1],_p6[2]+delta[2]];scene.setObjectsPosition([id],newPos);}else if(entity&&entity.matrix){var m=entity.matrix.slice();m[12]+=delta[0];m[13]+=delta[1];m[14]+=delta[2];scene.setObjectsMatrix([id],m);}else if(entity&&entity.offset){var off=entity.offset;var newOff=[off[0]+delta[0],off[1]+delta[1],off[2]+delta[2]];scene.setObjectsOffset([id],newOff);}}}},{key:"_applyEntityRotation",value:function _applyEntityRotation(baseAxis,degrees){var _this177=this;var scene=this._scene;var quatDelta=math.vec4();math.angleAxisToQuaternion([baseAxis[0],baseAxis[1],baseAxis[2],degrees*math.DEGTORAD],quatDelta);// --- Batched meshes: direct layer.setMatrix ---
29576
+ for(var _i622=0,len=this._batchedRotEntries.length;_i622<len;_i622++){var entry=this._batchedRotEntries[_i622];var newQ=math.vec4();// Post-multiply (existing * delta) — same order as Node.rotate for correct direction
29251
29577
  math.mulQuaternions(entry.quat,quatDelta,newQ);entry.quat.set(newQ);// Compose pivot rotation manually: T(center) * R * T(-center)
29252
29578
  var rotMat=math.mat4();math.quaternionToMat4(entry.quat,rotMat);var cx=entry.center[0],cy=entry.center[1],cz=entry.center[2];// M = T(c) * R * T(-c), built manually in column-major
29253
29579
  var m=math.identityMat4();// Apply T(-center) to rotation matrix: R' = R * T(-c)
@@ -29256,15 +29582,15 @@ var m=math.identityMat4();// Apply T(-center) to rotation matrix: R' = R * T(-c)
29256
29582
  var rx=rotMat[0],ry=rotMat[1],rz=rotMat[2];var r0x=rotMat[4],r0y=rotMat[5],r0z=rotMat[6];var r1x=rotMat[8],r1y=rotMat[9],r1z=rotMat[10];// result = T(c) * (R * T(-c))
29257
29583
  m[12]=cx+rx*-cx+r0x*-cy+r1x*-cz;m[13]=cy+ry*-cx+r0y*-cy+r1y*-cz;m[14]=cz+rz*-cx+r0z*-cy+r1z*-cz;// Rotation part (upper 3x3) stays the same
29258
29584
  m[0]=rotMat[0];m[4]=rotMat[4];m[8]=rotMat[8];m[1]=rotMat[1];m[5]=rotMat[5];m[9]=rotMat[9];m[2]=rotMat[2];m[6]=rotMat[6];m[10]=rotMat[10];entry.layer.setMatrix(entry.portionId,m);}// --- Instanced meshes: existing flow via entity quaternion ---
29259
- var _loop9=function _loop9(){var id=_this173._targetIds[_i619];var entity=scene._findObjectEntity(id);if(!entity)return 0;// continue
29585
+ var _loop9=function _loop9(){var id=_this177._targetIds[_i623];var entity=scene._findObjectEntity(id);if(!entity)return 0;// continue
29260
29586
  // Skip if already handled via batched entry
29261
- if(_this173._batchedRotEntries.some(function(e){return e.entityId===id;}))return 0;// continue
29587
+ if(_this177._batchedRotEntries.some(function(e){return e.entityId===id;}))return 0;// continue
29262
29588
  // Ensure entity has a SceneModelTransform for rotation
29263
- if(!entity.quaternion&&!entity.rotation){_this173._ensureEntityTransform(entity);}if(entity.quaternion){var _newQ=math.vec4();// Post-multiply (existing * delta) — same order as Node.rotate
29264
- math.mulQuaternions(entity.quaternion,quatDelta,_newQ);scene.setObjectsQuaternion([id],[_newQ[0],_newQ[1],_newQ[2],_newQ[3]]);}else if(entity.rotation){var _r7=entity.rotation;var delta=[0,0,0];if(Math.abs(baseAxis[0])>0.9)delta[0]=degrees;else if(Math.abs(baseAxis[1])>0.9)delta[1]=degrees;else if(Math.abs(baseAxis[2])>0.9)delta[2]=degrees;scene.setObjectsRotation([id],[_r7[0]+delta[0],_r7[1]+delta[1],_r7[2]+delta[2]]);}},_ret;for(var _i619=0,_len118=this._targetIds.length;_i619<_len118;_i619++){_ret=_loop9();if(_ret===0)continue;}}},{key:"_applyEntityScale",value:function _applyEntityScale(factors){var scene=this._scene;for(var _i620=0,len=this._targetIds.length;_i620<len;_i620++){var id=this._targetIds[_i620];// Ensure entity has a transform before scaling
29589
+ if(!entity.quaternion&&!entity.rotation){_this177._ensureEntityTransform(entity);}if(entity.quaternion){var _newQ=math.vec4();// Post-multiply (existing * delta) — same order as Node.rotate
29590
+ math.mulQuaternions(entity.quaternion,quatDelta,_newQ);scene.setObjectsQuaternion([id],[_newQ[0],_newQ[1],_newQ[2],_newQ[3]]);}else if(entity.rotation){var _r7=entity.rotation;var delta=[0,0,0];if(Math.abs(baseAxis[0])>0.9)delta[0]=degrees;else if(Math.abs(baseAxis[1])>0.9)delta[1]=degrees;else if(Math.abs(baseAxis[2])>0.9)delta[2]=degrees;scene.setObjectsRotation([id],[_r7[0]+delta[0],_r7[1]+delta[1],_r7[2]+delta[2]]);}},_ret;for(var _i623=0,_len118=this._targetIds.length;_i623<_len118;_i623++){_ret=_loop9();if(_ret===0)continue;}}},{key:"_applyEntityScale",value:function _applyEntityScale(factors){var scene=this._scene;for(var _i624=0,len=this._targetIds.length;_i624<len;_i624++){var id=this._targetIds[_i624];// Ensure entity has a transform before scaling
29265
29591
  var _s2=scene.getObjectScale(id);if(!_s2){var entity=scene._findObjectEntity(id);if(entity){this._ensureEntityTransform(entity);}_s2=scene.getObjectScale(id);}if(_s2){scene.setObjectsScale([id],[Math.max(0.01,_s2[0]*factors[0]),Math.max(0.01,_s2[1]*factors[1]),Math.max(0.01,_s2[2]*factors[2])]);}}}},{key:"_ensureEntityTransform",value:function _ensureEntityTransform(entity){// Only for instanced meshes — batched meshes are handled via _batchedRotEntries
29266
29592
  if(!entity.meshes||entity.meshes.length===0)return;var model=entity.model;if(!model||!model.createTransform)return;// Check if any mesh has a render layer that supports setMatrix AND already has a transform
29267
- var hasMatrixCapableLayer=false;for(var _i621=0,len=entity.meshes.length;_i621<len;_i621++){var m=entity.meshes[_i621];if(m&&m.layer&&typeof m.layer.setMatrix==="function"&&m.transform){hasMatrixCapableLayer=true;break;}}if(!hasMatrixCapableLayer)return;var offset=entity.offset;for(var _i622=0,_len119=entity.meshes.length;_i622<_len119;_i622++){var _mesh9=entity.meshes[_i622];if(_mesh9&&!_mesh9.transform&&_mesh9.layer&&typeof _mesh9.layer.setMatrix==="function"){var transformId="__edit_xform_".concat(_mesh9.id||entity.id,"_").concat(_i622);var _transform4=model.createTransform({id:transformId,position:[offset[0],offset[1],offset[2]],quaternion:[0,0,0,1],scale:[1,1,1]});if(_transform4){_transform4._addMesh(_mesh9);}}}entity.offset=[0,0,0];}/* ======================== DESTROY ======================== */},{key:"destroy",value:function destroy(){this.stopAnimation();this._unbindEvents();this._destroyNodes();}},{key:"_unbindEvents",value:function _unbindEvents(){var viewer=this._viewer;var scene=viewer.scene;var canvas=scene.canvas.canvas;var camera=viewer.camera;var cameraControl=viewer.cameraControl;scene.off(this._onSceneTick);camera.off(this._onCameraViewMatrix);camera.off(this._onCameraProjMatrix);cameraControl.off(this._onCameraControlHover);cameraControl.off(this._onCameraControlHoverLeave);cameraControl.off(this._onCameraControlTouch);canvas.removeEventListener("mousedown",this._canvasMouseDownListener);canvas.removeEventListener("mousemove",this._canvasMouseMoveListener);canvas.removeEventListener("mouseup",this._canvasMouseUpListener);canvas.removeEventListener("touchstart",this._canvasTouchStartListener);canvas.removeEventListener("touchmove",this._canvasTouchMoveListener);canvas.removeEventListener("touchend",this._canvasTouchEndListener);canvas.removeEventListener("touchcancel",this._canvasTouchEndListener);}},{key:"_destroyNodes",value:function _destroyNodes(){this._rootNode.destroy();this._displayMeshes={};this._affordanceMeshes={};this._targetIds=[];this._batchedRotEntries=[];this._rotationState={};}}]);}();/**
29593
+ var hasMatrixCapableLayer=false;for(var _i625=0,len=entity.meshes.length;_i625<len;_i625++){var m=entity.meshes[_i625];if(m&&m.layer&&typeof m.layer.setMatrix==="function"&&m.transform){hasMatrixCapableLayer=true;break;}}if(!hasMatrixCapableLayer)return;var offset=entity.offset;for(var _i626=0,_len119=entity.meshes.length;_i626<_len119;_i626++){var _mesh9=entity.meshes[_i626];if(_mesh9&&!_mesh9.transform&&_mesh9.layer&&typeof _mesh9.layer.setMatrix==="function"){var transformId="__edit_xform_".concat(_mesh9.id||entity.id,"_").concat(_i626);var _transform4=model.createTransform({id:transformId,position:[offset[0],offset[1],offset[2]],quaternion:[0,0,0,1],scale:[1,1,1]});if(_transform4){_transform4._addMesh(_mesh9);}}}entity.offset=[0,0,0];}/* ======================== DESTROY ======================== */},{key:"destroy",value:function destroy(){this.stopAnimation();this._unbindEvents();this._destroyNodes();}},{key:"_unbindEvents",value:function _unbindEvents(){var viewer=this._viewer;var scene=viewer.scene;var canvas=scene.canvas.canvas;var camera=viewer.camera;var cameraControl=viewer.cameraControl;scene.off(this._onSceneTick);camera.off(this._onCameraViewMatrix);camera.off(this._onCameraProjMatrix);cameraControl.off(this._onCameraControlHover);cameraControl.off(this._onCameraControlHoverLeave);cameraControl.off(this._onCameraControlTouch);canvas.removeEventListener("mousedown",this._canvasMouseDownListener);canvas.removeEventListener("mousemove",this._canvasMouseMoveListener);canvas.removeEventListener("mouseup",this._canvasMouseUpListener);canvas.removeEventListener("touchstart",this._canvasTouchStartListener);canvas.removeEventListener("touchmove",this._canvasTouchMoveListener);canvas.removeEventListener("touchend",this._canvasTouchEndListener);canvas.removeEventListener("touchcancel",this._canvasTouchEndListener);}},{key:"_destroyNodes",value:function _destroyNodes(){this._rootNode.destroy();this._displayMeshes={};this._affordanceMeshes={};this._targetIds=[];this._batchedRotEntries=[];this._rotationState={};}}]);}();/**
29268
29594
  * ObjectEditPlugin — interactive 3D transform controls (translate / rotate / scale) plus
29269
29595
  * quick colorize, x-ray, and hide for model components.
29270
29596
  *
@@ -29332,7 +29658,7 @@ var hasMatrixCapableLayer=false;for(var _i621=0,len=entity.meshes.length;_i621<l
29332
29658
  * matrix attributes. No manual promotion needed.
29333
29659
  * - The gizmo auto-scales to maintain constant screen size regardless of camera distance.
29334
29660
  * - `setTargets` resets accumulated rotation to identity for batched meshes.
29335
- */var ObjectEditPlugin=/*#__PURE__*/function(_Plugin15){function ObjectEditPlugin(viewer){var _this174;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,ObjectEditPlugin);_this174=_callSuper(this,ObjectEditPlugin,["ObjectEdit",viewer]);_this174._control=new TransformControl(_this174);_this174._targetIds=[];return _this174;}_inherits(ObjectEditPlugin,_Plugin15);return _createClass(ObjectEditPlugin,[{key:"setTargets",value:function setTargets(ids){this._targetIds=ids||[];this._control.setTargets(this._targetIds);}},{key:"getTargets",value:function getTargets(){return this._targetIds;}},{key:"showControl",value:function showControl(){this._control.setVisible(true);this.fire("controlVisible",true);}},{key:"hideControl",value:function hideControl(){this._control.setVisible(false);this.fire("controlVisible",false);}},{key:"isControlVisible",value:function isControlVisible(){return this._control.getVisible();}/** Colorize selected entities. @param {number[]} rgb — [r,g,b] each 0..1 */},{key:"colorize",value:function colorize(rgb){if(this._targetIds.length===0)return;this.viewer.scene.setObjectsColorized(this._targetIds,rgb);this.fire("colorized",rgb);}/** Toggle x-ray on selected entities. @param {boolean} on */},{key:"setXRayed",value:function setXRayed(on){if(this._targetIds.length===0)return;this.viewer.scene.setObjectsXRayed(this._targetIds,on);this.fire("xrayed",on);}/** Toggle visibility of selected entities. @param {boolean} on */},{key:"setHidden",value:function setHidden(on){if(this._targetIds.length===0)return;this.viewer.scene.setObjectsVisible(this._targetIds,!on);this.fire("hidden",on);}},{key:"setPosition",value:function setPosition(pos){this._control.setPosition(pos);}},{key:"setCulled",value:function setCulled(culled){this._control.setCulled(culled);}// ── Programmatic transform API ──
29661
+ */var ObjectEditPlugin=/*#__PURE__*/function(_Plugin16){function ObjectEditPlugin(viewer){var _this178;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,ObjectEditPlugin);_this178=_callSuper(this,ObjectEditPlugin,["ObjectEdit",viewer]);_this178._control=new TransformControl(_this178);_this178._targetIds=[];return _this178;}_inherits(ObjectEditPlugin,_Plugin16);return _createClass(ObjectEditPlugin,[{key:"setTargets",value:function setTargets(ids){this._targetIds=ids||[];this._control.setTargets(this._targetIds);}},{key:"getTargets",value:function getTargets(){return this._targetIds;}},{key:"showControl",value:function showControl(){this._control.setVisible(true);this.fire("controlVisible",true);}},{key:"hideControl",value:function hideControl(){this._control.setVisible(false);this.fire("controlVisible",false);}},{key:"isControlVisible",value:function isControlVisible(){return this._control.getVisible();}/** Colorize selected entities. @param {number[]} rgb — [r,g,b] each 0..1 */},{key:"colorize",value:function colorize(rgb){if(this._targetIds.length===0)return;this.viewer.scene.setObjectsColorized(this._targetIds,rgb);this.fire("colorized",rgb);}/** Toggle x-ray on selected entities. @param {boolean} on */},{key:"setXRayed",value:function setXRayed(on){if(this._targetIds.length===0)return;this.viewer.scene.setObjectsXRayed(this._targetIds,on);this.fire("xrayed",on);}/** Toggle visibility of selected entities. @param {boolean} on */},{key:"setHidden",value:function setHidden(on){if(this._targetIds.length===0)return;this.viewer.scene.setObjectsVisible(this._targetIds,!on);this.fire("hidden",on);}},{key:"setPosition",value:function setPosition(pos){this._control.setPosition(pos);}},{key:"setCulled",value:function setCulled(culled){this._control.setCulled(culled);}// ── Programmatic transform API ──
29336
29662
  /** Translate selected objects by world-space delta.
29337
29663
  * @param {number[]} delta — [dx, dy, dz] */},{key:"translate",value:function translate(delta){this._control.translate(delta);this.fire("translated",delta);}/** Rotate selected objects incrementally around an axis.
29338
29664
  * @param {number[]} axis — normalized axis [x, y, z]
@@ -29361,7 +29687,7 @@ var headerBlockItems=[{item:'FileSignature',format:'char',size:4},{item:'FileSou
29361
29687
  * @private
29362
29688
  * @param arrayBuffer
29363
29689
  * @returns {{}}
29364
- */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(_ref22){var item=_ref22.item,format=_ref22.format,size=_ref22.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 _loop10=function _loop10(){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--){_loop10();}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 _i623=0;_i623<buf.length;++_i623){view[_i623]=buf[_i623];}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
29690
+ */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(_ref22){var item=_ref22.item,format=_ref22.format,size=_ref22.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 _loop10=function _loop10(){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--){_loop10();}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 _i627=0;_i627<buf.length;++_i627){view[_i627]=buf[_i627];}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
29365
29691
  /**
29366
29692
  * {@link Viewer} plugin that loads lidar point cloud geometry from LAS files.
29367
29693
  *
@@ -29498,7 +29824,7 @@ var headerBlockItems=[{item:'FileSignature',format:'char',size:4},{item:'FileSou
29498
29824
  *
29499
29825
  * @class LASLoaderPlugin
29500
29826
  * @since 2.0.17
29501
- */var LASLoaderPlugin=/*#__PURE__*/function(_Plugin16){/**
29827
+ */var LASLoaderPlugin=/*#__PURE__*/function(_Plugin17){/**
29502
29828
  * @constructor
29503
29829
  *
29504
29830
  * @param {Viewer} viewer The Viewer.
@@ -29512,13 +29838,13 @@ var headerBlockItems=[{item:'FileSignature',format:'char',size:4},{item:'FileSou
29512
29838
  * @param {Boolean} [cfg.rotateX=false] Whether to rotate the LAS point positions 90 degrees. Applied after "center".
29513
29839
  * @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".
29514
29840
  * @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".
29515
- */function LASLoaderPlugin(viewer){var _this175;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,LASLoaderPlugin);_this175=_callSuper(this,LASLoaderPlugin,["lasLoader",viewer,cfg]);_this175.dataSource=cfg.dataSource;_this175.skip=cfg.skip;_this175.fp64=cfg.fp64;_this175.colorDepth=cfg.colorDepth;_this175.center=cfg.center;_this175.rotate=cfg.rotate;_this175.rotateX=cfg.rotateX;_this175.transform=cfg.transform;return _this175;}/**
29841
+ */function LASLoaderPlugin(viewer){var _this179;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,LASLoaderPlugin);_this179=_callSuper(this,LASLoaderPlugin,["lasLoader",viewer,cfg]);_this179.dataSource=cfg.dataSource;_this179.skip=cfg.skip;_this179.fp64=cfg.fp64;_this179.colorDepth=cfg.colorDepth;_this179.center=cfg.center;_this179.rotate=cfg.rotate;_this179.rotateX=cfg.rotateX;_this179.transform=cfg.transform;return _this179;}/**
29516
29842
  * Gets the custom data source through which the LASLoaderPlugin can load LAS files.
29517
29843
  *
29518
29844
  * Default value is {@link LASDefaultDataSource}, which loads via HTTP.
29519
29845
  *
29520
29846
  * @type {Object}
29521
- */_inherits(LASLoaderPlugin,_Plugin16);return _createClass(LASLoaderPlugin,[{key:"dataSource",get:function get(){return this._dataSource;}/**
29847
+ */_inherits(LASLoaderPlugin,_Plugin17);return _createClass(LASLoaderPlugin,[{key:"dataSource",get:function get(){return this._dataSource;}/**
29522
29848
  * Sets a custom data source through which the LASLoaderPlugin can load LAS files.
29523
29849
  *
29524
29850
  * Default value is {@link LASDefaultDataSource}, which loads via HTTP.
@@ -29639,8 +29965,8 @@ var headerBlockItems=[{item:'FileSignature',format:'char',size:4},{item:'FileSou
29639
29965
  * @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````.
29640
29966
  * @param {Object} [params.stats] Collects model statistics.
29641
29967
  * @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}.
29642
- */},{key:"load",value:function load(){var _this176=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){this.error("load() param expected: src or las");return sceneModel;// Return new empty model
29643
- }var options={las:{skip:this._skip,fp64:this._fp64,colorDepth:this._colorDepth}};if(params.src){this._loadModel(params.src,params,options,sceneModel);}else{var spinner=this.viewer.scene.canvas.spinner;spinner.processes++;this._parseModel(params.las,params,options,sceneModel).then(function(){spinner.processes--;},function(errMsg){spinner.processes--;_this176.error(errMsg);sceneModel.fire("error",errMsg);});}return sceneModel;}},{key:"_loadModel",value:function _loadModel(src,params,options,sceneModel){var _this177=this;var spinner=this.viewer.scene.canvas.spinner;spinner.processes++;this._dataSource.getLAS(params.src,function(arrayBuffer){_this177._parseModel(arrayBuffer,params,options,sceneModel).then(function(){spinner.processes--;},function(errMsg){spinner.processes--;_this177.error(errMsg);sceneModel.fire("error",errMsg);});},function(errMsg){spinner.processes--;_this177.error(errMsg);sceneModel.fire("error",errMsg);});}},{key:"_parseModel",value:function _parseModel(arrayBuffer,params,options,sceneModel){var _this178=this;var readPositions=function readPositions(attributesPosition){var positionsValue=attributesPosition.value;if(_this178._center){var centerPos=math.vec3();var numPoints=positionsValue.length;for(var _i624=0,len=positionsValue.length;_i624<len;_i624+=3){centerPos[0]+=positionsValue[_i624+0];centerPos[1]+=positionsValue[_i624+1];centerPos[2]+=positionsValue[_i624+2];}centerPos[0]/=numPoints;centerPos[1]/=numPoints;centerPos[2]/=numPoints;for(var _i625=0,_len120=positionsValue.length;_i625<_len120;_i625+=3){positionsValue[_i625+0]-=centerPos[0];positionsValue[_i625+1]-=centerPos[1];positionsValue[_i625+2]-=centerPos[2];}}if(_this178._rotateX){if(positionsValue){for(var _i626=0,_len121=positionsValue.length;_i626<_len121;_i626+=3){var temp=positionsValue[_i626+1];positionsValue[_i626+1]=positionsValue[_i626+2];positionsValue[_i626+2]=temp;}}}if(_this178._rotate){var quaternion=math.identityQuaternion();var mat=math.mat4();math.eulerToQuaternion(_this178._rotate,"XYZ",quaternion);math.quaternionToRotationMat4(quaternion,mat);var pos=math.vec3();for(var _i627=0,_len122=positionsValue.length;_i627<_len122;_i627+=3){pos[0]=positionsValue[_i627+0];pos[1]=positionsValue[_i627+1];pos[2]=positionsValue[_i627+2];math.transformPoint3(mat,pos,pos);positionsValue[_i627+0]=pos[0];positionsValue[_i627+1]=pos[1];positionsValue[_i627+2]=pos[2];}}if(_this178._transform){var _mat=math.mat4(_this178._transform);var _pos=math.vec3();for(var _i628=0,_len123=positionsValue.length;_i628<_len123;_i628+=3){_pos[0]=positionsValue[_i628+0];_pos[1]=positionsValue[_i628+1];_pos[2]=positionsValue[_i628+2];math.transformPoint3(_mat,_pos,_pos);positionsValue[_i628+0]=_pos[0];positionsValue[_i628+1]=_pos[1];positionsValue[_i628+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 _i629=0,j=0,k=0,len=intensities.length;_i629<len;_i629++,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[_i629]/65536*255);}return colorsCompressed;}function readIntensities(attributesIntensity){var intensities=attributesIntensity.value;var colorsCompressedSize=intensities.length*4;var colorsCompressed=new Uint8Array(colorsCompressedSize);for(var _i630=0,j=0,k=0,len=intensities.length;_i630<len;_i630++,k+=3,j+=4){colorsCompressed[j+0]=0;colorsCompressed[j+1]=0;colorsCompressed[j+2]=0;colorsCompressed[j+3]=Math.round(intensities[_i630]/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$2(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 _i631=0,len=pointsChunks.length;_i631<len;_i631++){var meshId="pointsMesh".concat(_i631);meshIds.push(meshId);sceneModel.createMesh({id:meshId,primitive:"points",positions:pointsChunks[_i631],colorsCompressed:_i631<colorsChunks.length?colorsChunks[_i631]:null});}/*
29968
+ */},{key:"load",value:function load(){var _this180=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){this.error("load() param expected: src or las");return sceneModel;// Return new empty model
29969
+ }var options={las:{skip:this._skip,fp64:this._fp64,colorDepth:this._colorDepth}};if(params.src){this._loadModel(params.src,params,options,sceneModel);}else{var spinner=this.viewer.scene.canvas.spinner;spinner.processes++;this._parseModel(params.las,params,options,sceneModel).then(function(){spinner.processes--;},function(errMsg){spinner.processes--;_this180.error(errMsg);sceneModel.fire("error",errMsg);});}return sceneModel;}},{key:"_loadModel",value:function _loadModel(src,params,options,sceneModel){var _this181=this;var spinner=this.viewer.scene.canvas.spinner;spinner.processes++;this._dataSource.getLAS(params.src,function(arrayBuffer){_this181._parseModel(arrayBuffer,params,options,sceneModel).then(function(){spinner.processes--;},function(errMsg){spinner.processes--;_this181.error(errMsg);sceneModel.fire("error",errMsg);});},function(errMsg){spinner.processes--;_this181.error(errMsg);sceneModel.fire("error",errMsg);});}},{key:"_parseModel",value:function _parseModel(arrayBuffer,params,options,sceneModel){var _this182=this;var readPositions=function readPositions(attributesPosition){var positionsValue=attributesPosition.value;if(_this182._center){var centerPos=math.vec3();var numPoints=positionsValue.length;for(var _i628=0,len=positionsValue.length;_i628<len;_i628+=3){centerPos[0]+=positionsValue[_i628+0];centerPos[1]+=positionsValue[_i628+1];centerPos[2]+=positionsValue[_i628+2];}centerPos[0]/=numPoints;centerPos[1]/=numPoints;centerPos[2]/=numPoints;for(var _i629=0,_len120=positionsValue.length;_i629<_len120;_i629+=3){positionsValue[_i629+0]-=centerPos[0];positionsValue[_i629+1]-=centerPos[1];positionsValue[_i629+2]-=centerPos[2];}}if(_this182._rotateX){if(positionsValue){for(var _i630=0,_len121=positionsValue.length;_i630<_len121;_i630+=3){var temp=positionsValue[_i630+1];positionsValue[_i630+1]=positionsValue[_i630+2];positionsValue[_i630+2]=temp;}}}if(_this182._rotate){var quaternion=math.identityQuaternion();var mat=math.mat4();math.eulerToQuaternion(_this182._rotate,"XYZ",quaternion);math.quaternionToRotationMat4(quaternion,mat);var pos=math.vec3();for(var _i631=0,_len122=positionsValue.length;_i631<_len122;_i631+=3){pos[0]=positionsValue[_i631+0];pos[1]=positionsValue[_i631+1];pos[2]=positionsValue[_i631+2];math.transformPoint3(mat,pos,pos);positionsValue[_i631+0]=pos[0];positionsValue[_i631+1]=pos[1];positionsValue[_i631+2]=pos[2];}}if(_this182._transform){var _mat=math.mat4(_this182._transform);var _pos=math.vec3();for(var _i632=0,_len123=positionsValue.length;_i632<_len123;_i632+=3){_pos[0]=positionsValue[_i632+0];_pos[1]=positionsValue[_i632+1];_pos[2]=positionsValue[_i632+2];math.transformPoint3(_mat,_pos,_pos);positionsValue[_i632+0]=_pos[0];positionsValue[_i632+1]=_pos[1];positionsValue[_i632+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 _i633=0,j=0,k=0,len=intensities.length;_i633<len;_i633++,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[_i633]/65536*255);}return colorsCompressed;}function readIntensities(attributesIntensity){var intensities=attributesIntensity.value;var colorsCompressedSize=intensities.length*4;var colorsCompressed=new Uint8Array(colorsCompressedSize);for(var _i634=0,j=0,k=0,len=intensities.length;_i634<len;_i634++,k+=3,j+=4){colorsCompressed[j+0]=0;colorsCompressed[j+1]=0;colorsCompressed[j+2]=0;colorsCompressed[j+3]=Math.round(intensities[_i634]/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$2(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 _i635=0,len=pointsChunks.length;_i635<len;_i635++){var meshId="pointsMesh".concat(_i635);meshIds.push(meshId);sceneModel.createMesh({id:meshId,primitive:"points",positions:pointsChunks[_i635],colorsCompressed:_i635<colorsChunks.length?colorsChunks[_i635]:null});}/*
29644
29970
  const pointsChunks = chunkArray(positionsValue, MAX_VERTICES * 3);
29645
29971
  const colorsChunks = chunkArray(colorsCompressed, MAX_VERTICES * 4);
29646
29972
  const meshIds = [];
@@ -29663,6 +29989,6 @@ var headerBlockItems=[{item:'FileSignature',format:'char',size:4},{item:'FileSou
29663
29989
  geometryId
29664
29990
  });
29665
29991
  }
29666
- */var pointsObjectId=params.entityId||math.createUUID();sceneModel.createEntity({id:pointsObjectId,meshIds:meshIds,isObject:true});sceneModel.finalize();if(params.metaModelJSON){var metaModelId=sceneModel.id;_this178.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;_this178.viewer.metaScene.createMetaModel(_metaModelId,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
29992
+ */var pointsObjectId=params.entityId||math.createUUID();sceneModel.createEntity({id:pointsObjectId,meshIds:meshIds,isObject:true});sceneModel.finalize();if(params.metaModelJSON){var metaModelId=sceneModel.id;_this182.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;_this182.viewer.metaScene.createMetaModel(_metaModelId,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
29667
29993
  sceneModel.fire("loaded",true,false);// Don't forget the event, for late subscribers
29668
- });resolve();});}catch(e){sceneModel.finalize();reject(e);}});}}]);}(Plugin);function chunkArray(array,chunkSize){if(chunkSize>=array.length){return[array];}var result=[];for(var _i632=0;_i632<array.length;_i632+=chunkSize){result.push(array.slice(_i632,_i632+chunkSize));}return result;}export{AlphaFormat,AmbientLight,AngleMeasurementsControl,AngleMeasurementsMouseControl,AngleMeasurementsPlugin,AngleMeasurementsSimulateMouseControl,AngleMeasurementsTouchControl,AnnotationsPlugin,AxisGizmoPlugin,BCFViewpointsPlugin,Bitmap,ByteType,CameraMemento,CameraPath,CameraPathAnimation,Canvas,ClampToEdgeWrapping,Component,CompressedMediaType,Configs,CubicBezierCurve,Curve,DefaultLoadingManager,DepthFormat,DepthStencilFormat,DirLight,DistanceMeasurementsControl,DistanceMeasurementsMouseControl,DistanceMeasurementsPlugin,DistanceMeasurementsSimulateMouseControl,DistanceMeasurementsTouchControl,EdgeMaterial,EmphasisMaterial,FloatType,Fresnel,Frustum$1 as Frustum,FrustumPlane,GIFMediaType,GLTFDefaultDataSource,GLTFLoaderPlugin,HalfFloatType,ImagePlane,IntType,JPEGMediaType,KTX2TextureTranscoder,LASLoaderPlugin,LambertMaterial,LightMap,LineSet,LinearEncoding,LinearFilter,LinearMipMapLinearFilter,LinearMipMapNearestFilter,LinearMipmapLinearFilter,LinearMipmapNearestFilter,Loader,LoadingManager,LocaleService,LuminanceAlphaFormat,LuminanceFormat,Map$1 as Map,Marker,Mesh,MetallicMaterial,MirroredRepeatWrapping,ModelMemento,NavCubePlugin,NearestFilter,NearestMipMapLinearFilter,NearestMipMapNearestFilter,NearestMipmapLinearFilter,NearestMipmapNearestFilter,Node$1 as Node,ObjectEditPlugin,ObjectsKdTree3,ObjectsMemento,PNGMediaType,Path,PerformanceModel,PhongMaterial,Plugin,PointLight,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,Renderer$1 as Renderer,RepeatWrapping,Scene,SceneModel,SceneModelMesh,SceneModelTransform,SectionBox,SectionPlane,SectionPlanesPlugin,ShortType,Skybox,SkyboxesPlugin,SpecularMaterial,SplineCurve,SpriteMarker,StoreyViewsPlugin,Texture,TextureTranscoder,TreeViewPlugin,UnsignedByteType,UnsignedInt248Type,UnsignedIntType,UnsignedShort4444Type,UnsignedShort5551Type,UnsignedShortType,VBOGeometry,ViewCullPlugin,Viewer,WebIFCLoaderPlugin,WorkerPool$1 as WorkerPool,XTCDefaultDataSource,XTCLoaderPlugin,buildBoxGeometry,buildBoxLinesGeometry,buildCylinderGeometry,buildGridGeometry,buildLineGeometry,buildPlaneGeometry,buildPolylineGeometry,buildPolylineGeometryFromCurve,buildSphereGeometry,buildTorusGeometry,buildVectorTextGeometry,createRTCViewMat,frustumIntersectsAABB3,getKTX2TextureTranscoder,getPlaneRTCPos,load3DSGeometry,loadOBJGeometry,math,rtcToWorldPos,sRGBEncoding,setFrustum,stats,utils,worldToRTCPos,worldToRTCPositions};
29994
+ });resolve();});}catch(e){sceneModel.finalize();reject(e);}});}}]);}(Plugin);function chunkArray(array,chunkSize){if(chunkSize>=array.length){return[array];}var result=[];for(var _i636=0;_i636<array.length;_i636+=chunkSize){result.push(array.slice(_i636,_i636+chunkSize));}return result;}export{AlphaFormat,AmbientLight,AngleMeasurementsControl,AngleMeasurementsMouseControl,AngleMeasurementsPlugin,AngleMeasurementsSimulateMouseControl,AngleMeasurementsTouchControl,AnnotationsPlugin,AxisGizmoPlugin,BCFViewpointsPlugin,Bitmap,ByteType,CameraMemento,CameraPath,CameraPathAnimation,Canvas,ClampToEdgeWrapping,Component,CompressedMediaType,Configs,CubicBezierCurve,Curve,DefaultLoadingManager,DepthFormat,DepthStencilFormat,DirLight,DistanceMeasurementsControl,DistanceMeasurementsMouseControl,DistanceMeasurementsPlugin,DistanceMeasurementsSimulateMouseControl,DistanceMeasurementsTouchControl,EdgeMaterial,EmphasisMaterial,FastNavPlugin,FloatType,Fresnel,Frustum$1 as Frustum,FrustumPlane,GIFMediaType,GLTFDefaultDataSource,GLTFLoaderPlugin,HalfFloatType,ImagePlane,IntType,JPEGMediaType,KTX2TextureTranscoder,LASLoaderPlugin,LambertMaterial,LightMap,LineSet,LinearEncoding,LinearFilter,LinearMipMapLinearFilter,LinearMipMapNearestFilter,LinearMipmapLinearFilter,LinearMipmapNearestFilter,Loader,LoadingManager,LocaleService,LuminanceAlphaFormat,LuminanceFormat,Map$1 as Map,Marker,Mesh,MetallicMaterial,MirroredRepeatWrapping,ModelMemento,NavCubePlugin,NearestFilter,NearestMipMapLinearFilter,NearestMipMapNearestFilter,NearestMipmapLinearFilter,NearestMipmapNearestFilter,Node$1 as Node,ObjectEditPlugin,ObjectsKdTree3,ObjectsMemento,PNGMediaType,Path,PerformanceModel,PhongMaterial,Plugin,PointLight,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,Renderer$1 as Renderer,RepeatWrapping,Scene,SceneModel,SceneModelMesh,SceneModelTransform,SectionBox,SectionPlane,SectionPlanesPlugin,ShortType,Skybox,SkyboxesPlugin,SpecularMaterial,SplineCurve,SpriteMarker,StoreyViewsPlugin,Texture,TextureTranscoder,TreeViewPlugin,UnsignedByteType,UnsignedInt248Type,UnsignedIntType,UnsignedShort4444Type,UnsignedShort5551Type,UnsignedShortType,VBOGeometry,ViewCullPlugin,Viewer,WebIFCLoaderPlugin,WorkerPool$1 as WorkerPool,XTCDefaultDataSource,XTCLoaderPlugin,buildBoxGeometry,buildBoxLinesGeometry,buildCylinderGeometry,buildGridGeometry,buildLineGeometry,buildPlaneGeometry,buildPolylineGeometry,buildPolylineGeometryFromCurve,buildSphereGeometry,buildTorusGeometry,buildVectorTextGeometry,createRTCViewMat,frustumIntersectsAABB3,getKTX2TextureTranscoder,getPlaneRTCPos,load3DSGeometry,loadOBJGeometry,math,rtcToWorldPos,sRGBEncoding,setFrustum,stats,utils,worldToRTCPos,worldToRTCPositions};